mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-18 03:35:56 +02:00
fix(gen2): sell TMs at Poké Marts instead of opening the teach party
Selecting a TM in the mart's SELL pack (and the item PC's DEPOSIT pack) opened the teach-party screen: PackMenu:useSelected taught any item carrying `teaches`, even when the pack was built as a chooser (DepositSellPack, world = {}). On the cart that chooser's jumptable is four ScrollingMenus and never reaches tmhm.asm, so the row must hand back to the caller instead.
Gate the teach and field-NOUSE branches behind world.useFieldItem so only the real field PACK teaches; choosers now hand TMs to onChoose. Selling then prices a TM at half its ItemAttributes price -- exactly half of what the Goldenrod/Celadon TM shelves charge, and half of the hidden price for the rest, the way SelectQuantityToSell -> GetItemPrice -> Sell_HalvePrice does on the cart.
Closes #1243
This commit is contained in:
@@ -780,6 +780,11 @@ function MartMenu:offerToSell(itemId, count)
|
||||
end
|
||||
-- ScrollingMenu's .a_button copies the row's own quantity into
|
||||
-- wItemQuantity, so the selector's ceiling is how many you hold.
|
||||
-- The unit price is the item's own ItemAttributes price: GetItemPrice is
|
||||
-- what SelectQuantityToSell halves AND what the buy list's
|
||||
-- GetMartItemPrice charges, so a TM sells for exactly half of what the
|
||||
-- Goldenrod/Celadon TM shelves ask for it, and half of its hidden price
|
||||
-- (usually ¥1,500) anywhere else (issue #1243).
|
||||
self.qtyItem = { id = itemId, name = def.name or itemId,
|
||||
price = def.price or 0 }
|
||||
self.qty = 1
|
||||
|
||||
Reference in New Issue
Block a user