Skip to content

feat: Add valid-slots to MenuSpell - #1098

Open
DragonsAscent wants to merge 1 commit into
TheComputerGeek2:mainfrom
DragonsAscent:menuspell-additions
Open

feat: Add valid-slots to MenuSpell#1098
DragonsAscent wants to merge 1 commit into
TheComputerGeek2:mainfrom
DragonsAscent:menuspell-additions

Conversation

@DragonsAscent

Copy link
Copy Markdown
Collaborator

Sorts items into one of the defined valid slots as long as the slot is empty allowing dynamic "filled" sections which is good for shops or to eliminate wasted space without complex modifiers.

Copilot AI lite review requested due to automatic review settings August 23, 2026 18:58

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Using valid-slots without slots/slot currently logs a spurious out-of-bounds error due to adding the legacy default -1 slot value.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR extends MenuSpell inventory placement logic by introducing a new valid-slots configuration option, enabling “first available slot” placement to support dynamically filled menu sections (e.g., shop layouts).

Changes:

  • Added parsing/validation for options.<name>.valid-slots.
  • Split option placement into fixed slots (place in all) vs validSlots (place in first empty).
  • Stored validSlots on MenuOption and applied it during inventory population.
File summaries
File Description
core/src/main/java/com/nisovin/magicspells/spells/MenuSpell.java Adds valid-slots parsing and uses it to place option items into the first empty configured slot.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +74 to +76
List<Integer> configuredSlots = getConfigIntList(path + "slots", new ArrayList<>());
if (configuredSlots.isEmpty()) configuredSlots.add(getConfigInt(path + "slot", -1));
List<Integer> configuredValidSlots = getConfigIntList(path + "valid-slots", new ArrayList<>());
List<Integer> slots = new ArrayList<>();
for (int slot : configuredSlots) {
if (slot < 0 || slot > 53) {
MagicSpells.error("MenuSpell '" + internalName + "' a slot defined which is out of bounds for '" + optionName + "': " + slot);
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.

2 participants