File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -217,6 +217,26 @@ function hook_toggle_shop()
217217 sendDebugMessage (" Hooked into G.FUNCS.toggle_shop for logging" , " LOG" )
218218end
219219
220+ function hook_buy_card ()
221+ local original_function = G .FUNCS .buy_card
222+ -- e is the UI element for buy_card button on the targeted card.
223+ G .FUNCS .buy_card = function (e )
224+ -- object that owns the UI element, always a card in shop_jokers.cards
225+ local c1 = e .config .ref_table
226+ -- string representation of action, "buy_card" or "buy_and_use_card"
227+ -- Vouchers are not "bought" but "used"
228+ local action = e .config .id
229+ for i , card in ipairs (G .shop_jokers .cards ) do
230+ if card .unique_id == c1 .unique_id then
231+ LOG .schedule_write ({ name = " shop" , arguments = { action = action , index = i - 1 } })
232+ break
233+ end
234+ end
235+ return original_function (e )
236+ end
237+ sendDebugMessage (" Hooked into G.FUNCS.buy_card for logging" , " LOG" )
238+ end
239+
220240-- -----------------------------------------------------------------------------
221241-- hand_rearrange Hook
222242-- -----------------------------------------------------------------------------
You can’t perform that action at this time.
0 commit comments