task 2 brief - xopherdeep/do-it-for-the-xp GitHub Wiki

Task 2: The Temple Creator's Drops picker (board #1455)

Files:

  • Create: src/app/Admin/XpCompendium/views/XpTemples/components/XpTempleCreator/components/RoomDropsConfig.vue
  • Modify: .../XpTempleCreator/components/index.ts, .../XpTempleCreator/XpRoomEditorPage.vue (next to RoomMonsterConfig, ~line 61)
  • Test: .../XpTempleCreator/components/__tests__/RoomDropsConfig.spec.ts

Interfaces:

  • Consumes: RoomDrops (src/lib/engine/core/dungeons/types.ts, in master) and FIGHT_ROOM_TYPES (src/lib/services/temples/fightDrops.ts, in master); DUNGEON_ITEMS and CONSUMABLE_ITEMS from ../hooks (the lists RoomLootConfig.vue shows).

  • Produces: RoomDropsConfig, which takes props { drops: RoomDrops | null } and emits update:drops with RoomDrops | null. It's mounted for room types in FIGHT_ROOM_TYPES with v-model:drops bound to roomData.content.drops.

  • Step 1: Write failing tests:

    • Picking "Small Key" emits { chest: 'dungeon', dungeon: 'small-key' }.
    • Picking "None" with no gold or items emits null.
    • Typing gold 30 onto a key drop emits { chest: 'dungeon', dungeon: 'small-key', gold: 30 }.
    • Ticking Bomb emits items: ['Bomb'].
  • Step 2: Run chemx test <that spec>. Expected: FAIL.

  • Step 3: Implement a "Drops" section with the dungeon-item row (None first), the consumables row including Bomb, and a gold field, styled like RoomLootConfig.vue. Mount it in the room editor for fight rooms, both classic and quest rooms. XpRoomEditorPage.vue and useTempleRoomEditor.ts are already large: add as few lines there as possible (the component owns its logic; the page only mounts it).

  • Step 4: Run the spec. Expected: PASS.

  • Step 5: Commit feat(temple-creator): fight rooms pick what their beast drops.

⚠️ **GitHub.com Fallback** ⚠️