File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -697,7 +697,7 @@ API.functions["shop"] = function(args)
697697 }
698698
699699 elseif action == " reroll" then
700- -- Capture the state before rerolling
700+ -- Capture the state before rerolling for response validation
701701 local dollars_before = G .GAME .dollars
702702 local reroll_cost = G .GAME .current_round and G .GAME .current_round .reroll_cost or 0
703703 local expected_dollars = dollars_before - reroll_cost
@@ -716,7 +716,7 @@ API.functions["shop"] = function(args)
716716 return
717717 end
718718
719- -- Perform the reroll (nil element because the function doesn't require it)
719+ -- no UI element required for reroll
720720 G .FUNCS .reroll_shop (nil )
721721
722722 --- @type PendingRequest
@@ -734,7 +734,7 @@ API.functions["shop"] = function(args)
734734 end ,
735735 }
736736
737- -- TODO: add other shop actions [buy_and_use | reroll | open_pack | redeem_voucher]
737+ -- TODO: add other shop actions [buy_and_use | open_pack | redeem_voucher]
738738 else
739739 API .send_error_response (
740740 " Invalid action for shop" ,
Original file line number Diff line number Diff line change @@ -237,6 +237,21 @@ function hook_buy_card()
237237 sendDebugMessage (" Hooked into G.FUNCS.buy_card for logging" , " LOG" )
238238end
239239
240+ -- -----------------------------------------------------------------------------
241+ -- reroll_shop Hook
242+ -- -----------------------------------------------------------------------------
243+
244+ --- Hooks into G.FUNCS.reroll_shop
245+ function hook_reroll_shop ()
246+ local original_function = G .FUNCS .reroll_shop
247+ G .FUNCS .reroll_shop = function (e )
248+ local function_call = { name = " shop" , arguments = { action = " reroll" } }
249+ LOG .schedule_write (function_call )
250+ return original_function (e )
251+ end
252+ sendDebugMessage (" Hooked into G.FUNCS.reroll_shop for logging" , " LOG" )
253+ end
254+
240255-- -----------------------------------------------------------------------------
241256-- hand_rearrange Hook
242257-- -----------------------------------------------------------------------------
@@ -369,6 +384,8 @@ function LOG.init()
369384 hook_discard_cards_from_highlighted ()
370385 hook_cash_out ()
371386 hook_toggle_shop ()
387+ hook_buy_card ()
388+ hook_reroll_shop ()
372389 hook_hand_rearrange ()
373390
374391 sendInfoMessage (" Logger initialized" , " LOG" )
You can’t perform that action at this time.
0 commit comments