Skip to content

Centralization of Equipment Slot specifications#589

Merged
Volte6 merged 1 commit into
masterfrom
centralizing-equipment-slots
May 28, 2026
Merged

Centralization of Equipment Slot specifications#589
Volte6 merged 1 commit into
masterfrom
centralizing-equipment-slots

Conversation

@Volte6
Copy link
Copy Markdown
Member

@Volte6 Volte6 commented May 28, 2026

Description

Centralizes the equipment slot system so that the canonical list of slots lives in one place (items.AllEquipSlots()), eliminating large per-slot switch and if/else blocks that had to be updated everywhere a new slot was added or removed.

Changes

  • Added AllEquipSlots(), WeaponSlots(), and ArmorSlots() to internal/items as the single source of truth for the equipment slot list
  • Added Get(slot) and Set(slot, item) accessors to Worn so all slot access goes through one switch rather than being scattered across the codebase
  • Added SlotLabel(slot) to Worn so UI label strings are defined in one place instead of hard-coded in rendering code
  • Replaced all per-slot switch/if-else chains in character.go (defense, validation, equip, unequip, uncurse, gear value, etc.) with loops over AllSlots()
  • Updated combat, mobs, races, inventory/status panels, and the GMCP module to use the new slot iterators instead of their own local slot lists
  • Updated admin HTML templates and the gear window JS to derive slot lists dynamically rather than hard-coding them
  • Added a new items API endpoint to expose the slot list to the web layer
  • Added worn_test.go with tests covering Get/Set/SlotLabel and the slot helper functions

@Volte6 Volte6 merged commit 67194fd into master May 28, 2026
8 of 9 checks passed
@Volte6 Volte6 deleted the centralizing-equipment-slots branch May 28, 2026 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant