From 60fb126ccede40500a1177599aec30df5bb236e2 Mon Sep 17 00:00:00 2001 From: giordanobrunocp Date: Sat, 15 Aug 2026 22:06:55 -0300 Subject: [PATCH] fix(sell): allow selling a Joker/consumable while a booster pack is open sell requires_state only allowed SELECTING_HAND/SHOP, so a Buffoon pack pulled with a full Joker roster (5/5) had no way to make room for the new Joker via the API, even though the base game lets you sell from the pack screen. Verified live: without this change `sell` returns INVALID_STATE during SMODS_BOOSTER_OPENED; calling G.FUNCS.sell_card while the pack UI is open works fine, but the completion-check's valid_state gate needed the same state added or the request just hangs waiting for a state it'll never see. Tested manually against a running instance: filled Jokers to 5/5, opened a pack, sold Joker index 0 mid-pack, got a normal gamestate response back with the game state remaining consistent (still SMODS_BOOSTER_OPENED, sell reflected in jokers/money). --- src/lua/endpoints/sell.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/lua/endpoints/sell.lua b/src/lua/endpoints/sell.lua index 5d112222..05e09cad 100644 --- a/src/lua/endpoints/sell.lua +++ b/src/lua/endpoints/sell.lua @@ -32,7 +32,7 @@ return { }, }, - requires_state = { G.STATES.SELECTING_HAND, G.STATES.SHOP }, + requires_state = { G.STATES.SELECTING_HAND, G.STATES.SHOP, G.STATES.SMODS_BOOSTER_OPENED }, ---@param args Request.Endpoint.Sell.Params ---@param send_response fun(response: Response.Endpoint) @@ -144,7 +144,11 @@ return { local state_stable = G.STATE_COMPLETE == true -- 5. Still in valid state - local valid_state = (G.STATE == G.STATES.SHOP or G.STATE == G.STATES.SELECTING_HAND) + local valid_state = ( + G.STATE == G.STATES.SHOP + or G.STATE == G.STATES.SELECTING_HAND + or G.STATE == G.STATES.SMODS_BOOSTER_OPENED + ) -- All conditions must be met if count_decreased and money_increased and card_gone and state_stable and valid_state then