Implement basic trade commands with merchant NPCs #251
Labels
No labels
Blocked
Duplicate
MoSCoW/Could Have
MoSCoW/Must Have
MoSCoW/Should Have
Points/1
Points/13
Points/2
Points/21
Points/3
Points/5
Points/8
Priority/Backlog
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
State/Completed
State/In progress
State/In review
State/Paused
State/Unverified
State/Verified
State/Wont Do
Type/Bug
Type/Epic
Type/Feature
Type/Legendary
Type/Task
Type/Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#212 Epic: Storage & Trade
aethyr/Aethyr
Reference: aethyr/Aethyr#251
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Metadata
feature/m4-basic-trade-commandsImplement basic trade commands with merchant NPCs (#251)Background and Context
The trade system closes the economic loop in the crafting and resource economy. Players need the ability to sell their crafted goods and harvested resources to merchant NPCs, and to buy supplies and materials they need. Merchants serve as both a gold sink and a gold source, and their pricing is influenced by the player's reputation with them.
Reputation-based pricing creates a meaningful connection between the quality of goods a player sells and the deals they can get in the future. A player known for selling high-quality wares will enjoy better prices, while one who dumps low-quality goods will face worse terms.
Expected Behavior
sell <item>Command: Sells an item from the player's inventory to a merchant NPC in the same room. The sale price is calculated based on the item's base value, quality tier, and the player's reputation with the merchant.base_value * quality_multiplier * reputation_modifier.buy <item>Command: Purchases an item from a merchant NPC's stock. The buy price is calculated similarly with a markup.base_value * merchant_markup * (1 / reputation_modifier).price <item>Command: Shows the buy and/or sell price for an item without committing to a transaction. Useful for price checking.Acceptance Criteria
sell <item>correctly sells an item to a merchant in the same room.buy <item>correctly purchases an item from a merchant's stock.buyfails with an appropriate message if the player lacks sufficient gold.price <item>displays the buy and/or sell price without executing a transaction.Subtasks
sell <item>command handler with pricing calculation and inventory transfer.buy <item>command handler with pricing, gold check, and inventory transfer.price <item>command handler for price checking.tests/unit/basic_trade_commands.featurecovering sell pricing, buy pricing, insufficient gold, price check, reputation modifier scaling, merchant presence check.tests/integration/for end-to-end trade flow with reputation effects.bundle exec rake unit_profileand verify no performance regressions.bundle exec rake unit. If coverage is <97% then review the current unit test coverage report atbuild/tests/unit/coverage/and use it to write new Cucumber based unit tests to improve code coverage. Specifically, write Cucumber/Gherkin style unit tests that are descriptively named and specifically improve coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerunbundle exec rake unitto verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%.bundle exec rake(default task: unit tests with coverage) andbundle exec rake integration, fix any errors if needed ensuring both pass across entire code base, do not ignore any failure even if it seems unrelated to this commit, fix it.Definition of Done
This issue is complete when:
master, reviewed, and merged before this issue is marked done.