Update CLAUDE.md for Phase 2 completion

- Add deployment section with deploy.sh/remove.sh usage
- Document all key classes (CardParser, ItemExtensions, TagHelper)
- Update project status to Phase 2 Complete
- Add log file location for debugging
- Document next implementation steps for Phase 3

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Cal Corum 2025-11-19 16:57:18 -06:00
parent d05ba64700
commit 6536a7126a

View File

@ -20,6 +20,22 @@ dotnet build TradingCardMod.csproj -c Release
**Important**: Before building, update `DuckovPath` in `TradingCardMod.csproj` (line 10) to your actual game installation path. **Important**: Before building, update `DuckovPath` in `TradingCardMod.csproj` (line 10) to your actual game installation path.
## Deployment
```bash
# Deploy to game (builds and copies all files)
./deploy.sh
# Deploy release build
./deploy.sh --release
# Remove mod from game
./remove.sh
# Remove with backup
./remove.sh --backup
```
## Testing ## Testing
```bash ```bash
@ -53,7 +69,13 @@ The game loads mods from `Duckov_Data/Mods/`. Each mod requires:
- **`Patches`** (`src/Patches.cs`): Harmony patch definitions. Uses `HarmonyLib` for runtime method patching. Patches are applied in `Start()` and removed in `OnDestroy()`. - **`Patches`** (`src/Patches.cs`): Harmony patch definitions. Uses `HarmonyLib` for runtime method patching. Patches are applied in `Start()` and removed in `OnDestroy()`.
- **`TradingCard`**: Data class representing card properties. Contains `GenerateTypeID()` for creating unique item IDs (100000+ range to avoid game conflicts). - **`TradingCard`** (`src/TradingCard.cs`): Data class representing card properties. Contains `GenerateTypeID()` for creating unique item IDs (100000+ range to avoid game conflicts).
- **`CardParser`** (`src/CardParser.cs`): Parses card definition files. Pure C# with no Unity dependencies, fully unit tested.
- **`ItemExtensions`** (`src/ItemExtensions.cs`): Reflection helpers for setting private fields on game objects.
- **`TagHelper`** (`src/TagHelper.cs`): Utilities for working with game tags, including creating custom tags.
### Dependencies ### Dependencies
@ -92,48 +114,43 @@ Key namespaces and APIs from the game:
## Current Project Status ## Current Project Status
**Phase:** 2 - Core Card Framework **Phase:** 2 Complete - Core Card Framework ✅
**Next Phase:** 3 - Storage System (Binders)
**Project Plan:** `.claude/scratchpad/PROJECT_PLAN.md` **Project Plan:** `.claude/scratchpad/PROJECT_PLAN.md`
**Technical Analysis:** `.claude/scratchpad/item-system-analysis.md` **Technical Analysis:** `.claude/scratchpad/item-system-analysis.md`
### Completed Features
- Cards load from `CardSets/*/cards.txt` files
- Custom PNG images display as item icons
- Cards register as game items with proper TypeIDs
- Custom "TradingCard" tag for filtering
- Debug spawn with F9 key (for testing)
- Deploy/remove scripts for quick iteration
### Implementation Approach: Clone + Reflection ### Implementation Approach: Clone + Reflection
Based on analysis of the AdditionalCollectibles mod, we're using a viable approach: Based on analysis of the AdditionalCollectibles mod:
1. **Clone existing game items** as templates (not create from scratch) 1. **Clone existing game items** as templates (base item ID 135)
2. **Use reflection** to set private fields (typeID, weight, value, etc.) 2. **Use reflection** to set private fields (typeID, weight, value, etc.)
3. **Create custom tags** by cloning existing ScriptableObject tags 3. **Create custom tags** by cloning existing ScriptableObject tags
4. **Load sprites** from user files in `CardSets/*/images/` 4. **Load sprites** from user files in `CardSets/*/images/`
Key patterns:
```csharp
// Clone base item
Item original = ItemAssetsCollection.GetPrefab(135);
GameObject clone = Object.Instantiate(original.gameObject);
Object.DontDestroyOnLoad(clone);
// Set properties via reflection
item.SetPrivateField("typeID", newId);
item.SetPrivateField("value", cardValue);
// Get/create tags
Tag tag = Resources.FindObjectsOfTypeAll<Tag>()
.FirstOrDefault(t => t.name == "Luxury");
```
### Next Implementation Steps ### Next Implementation Steps
1. Create `src/ItemExtensions.cs` - reflection helper methods Phase 3 - Storage System:
2. Create `src/TagHelper.cs` - tag operations 1. Research existing storage items in game
3. Update `src/ModBehaviour.cs` - use clone+reflection approach 2. Create binder item with Inventory component
4. Test card creation in-game 3. Implement slot-based filtering for "TradingCard" tag
4. Create card box variant with higher capacity
### Files to Create ### Log File Location
| File | Purpose | Unity logs (for debugging):
|------|---------| ```
| `src/ItemExtensions.cs` | `SetPrivateField()`, `GetPrivateField()` extensions | /mnt/NV2/SteamLibrary/steamapps/compatdata/3167020/pfx/drive_c/users/steamuser/AppData/LocalLow/TeamSoda/Duckov/Player.log
| `src/TagHelper.cs` | `GetTargetTag()`, `CreateOrCloneTag()` | ```
## Research References ## Research References