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:
ShaneMcGovernIE
2026-08-13 23:55:31 +01:00
parent 26e9e1d597
commit 1586aec9f6
5 changed files with 94 additions and 12 deletions
+15 -12
View File
@@ -354,20 +354,23 @@ function PackMenu:useSelected()
end
return
end
-- engine/items/tmhm.asm:73
local def = self.items and self.items[row.id]
if def and def.teaches then
self:openTeachParty(row)
return
end
-- UseItem's jumptable runs off ITEMATTR's field-menu nibble, and the first
-- four entries are all .Oak -- an X ATTACK or a POKé DOLL used from the
-- field PACK prints OakThisIsntTheTimeText and goes nowhere. Only the
-- FIELD pack owns that refusal: the battle pack returned above, and the
-- catch tutorial's DUDE pack carries a stub world with no useFieldItem at
-- all -- its POKE BALL is field-NOUSE and must still reach the throw.
-- UseItem's FIELD-pack tail (engine/items/tmhm.asm:73): a TM/HM row opens
-- the party to teach, and a field-NOUSE item -- an X ATTACK or a POKé DOLL
-- used from the field PACK -- prints OakThisIsntTheTimeText and goes
-- nowhere (UseItem's jumptable's first four entries are all .Oak). Both
-- checks live behind `world.useFieldItem` on purpose: DepositSellPack (the
-- mart's SELL, the item PC's DEPOSIT) is a chooser whose jumptable is four
-- ScrollingMenus and never reaches tmhm.asm, so a TM picked there hands
-- its row to onChoose like every other item instead of opening the teach
-- party. The battle pack returned above, and the catch tutorial's DUDE
-- pack carries a stub world with no useFieldItem at all -- its POKE BALL
-- is field-NOUSE and must still reach the throw.
if world and world.useFieldItem then
local def = self.items and self.items[row.id]
if def and def.teaches then
self:openTeachParty(row)
return
end
if def and def.fieldMenu == "ITEMMENU_NOUSE" then
self.message = OAK_THIS_ISNT_THE_TIME
return