Skip to content

Add quantity selection for selling items to ingredient/stone buyers#1302

Merged
Rangi42 merged 13 commits intomasterfrom
copilot/fix-sell-quantity-issue
Jan 18, 2026
Merged

Add quantity selection for selling items to ingredient/stone buyers#1302
Rangi42 merged 13 commits intomasterfrom
copilot/fix-sell-quantity-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 2, 2025

Plan: Add quantity selection for selling ingredients and stones

  • Explore repository structure and understand the issue
  • Locate the relevant code (GourmetManiac, OreManiac, FossilManiac scripts)
  • Study Kurt's Apricorn selection code as reference
  • Build project successfully to ensure baseline is working
  • Create new quantity selection functions for item maniacs (similar to Kurt's apricorn selection)
  • Add new "How many" text prompt for item maniacs
  • Modify the three maniac scripts to use quantity selection
  • Update GetItemManiacPrice to handle quantity
  • Update takeitem and money transaction to handle quantity
  • Test the changes by building the ROM
  • Request code review
  • Address code review feedback (carry flag, overflow protection, remove unused code)
  • Run security checks
  • Use MAX_MONEY constant instead of magic number
  • Fix additional code review issues (PopBCDEHL, 16-bit CountItem, 24-bit money syntax)
  • Add validation to cap selected quantity at available items
  • Fix byte order bug - wBuffer1 is high byte, wBuffer2 is low byte

Summary

Successfully implemented quantity selection for selling items to the three "maniacs" in the game. Fixed critical bug where high/low bytes were swapped when reading CountItem results, which caused the quantity limit to not work correctly. Now properly limits selection to actual items in bag.

Original prompt

This section details on the original issue you should resolve

<issue_title>Cannot specify number when selling ingredients and stones</issue_title>
<issue_description>Version 3.1.1

Can only sell ingredients to the gourmet Baker and stones to a man in a cave one by one. Cannot specify a number. Is that set deliberately or a bug? When selecting items to be sold, two consequent beep can be heard but I only press once.</issue_description>

<agent_instructions>Maybe code could be reused from giving Kurt Apricorns.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@Rangi42 Yeah, this would be a nice convenience. Maybe code could be reused from giving Kurt Apricorns.

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 2, 2025 21:14
Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
…rotection, remove unused code

Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix selling multiple ingredients and stones at once Add quantity selection for selling items to ingredient/stone buyers Dec 2, 2025
Copilot AI requested a review from vulcandth December 2, 2025 21:20
Comment thread engine/events/item_maniacs.asm Outdated
Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@vulcandth vulcandth left a comment

Choose a reason for hiding this comment

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

@copilot
See my comments.

Comment thread engine/events/item_maniacs.asm Outdated
Comment thread engine/events/item_maniacs.asm
Comment thread engine/events/item_maniacs.asm Outdated
…, fix RGBDS syntax for 24-bit money value

Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Copy link
Copy Markdown
Collaborator

@vulcandth vulcandth left a comment

Choose a reason for hiding this comment

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

@copilot
You don't limit the the number we can select to the number we actually have in our bag.

Copilot AI and others added 2 commits December 3, 2025 03:57
…tems

Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
…ffer2=low)

Co-authored-by: vulcandth <6394873+vulcandth@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 3, 2025

@copilot
You don't limit the the number we can select to the number we actually have in our bag.

Fixed in f4fb96d. The issue was that I had the high/low bytes swapped when reading the CountItem result. CountItem stores the high byte in wBuffer1 and low byte in wBuffer2, but I was reading them in reverse order. Now correctly limits selection to the actual quantity in your bag.

@vulcandth vulcandth marked this pull request as ready for review January 17, 2026 21:38
Copy link
Copy Markdown
Collaborator

@vulcandth vulcandth left a comment

Choose a reason for hiding this comment

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

Did some tweaking and in-game testing looks good to me.

@Rangi42 Rangi42 merged commit 1ef93f2 into master Jan 18, 2026
1 check passed
@Rangi42 Rangi42 deleted the copilot/fix-sell-quantity-issue branch January 18, 2026 22:59
@Rangi42 Rangi42 removed their request for review January 18, 2026 23:05
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.

Cannot specify number when selling ingredients and stones

3 participants