Skip to content

Commit 48c4fd6

Browse files
committed
feat(api): add shop booster field to game state
Implement shop_booster collection in get_game_state() function: - Add shop booster config with card_count and card_limit - Include individual booster cards with ability, config, cost, and labels - Remove TODO comment for shop_booster implementation This completes the shop data collection alongside existing shop_jokers and shop_vouchers.
1 parent 0c72069 commit 48c4fd6

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

src/lua/utils.lua

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,39 @@ function utils.get_game_state()
445445
}
446446
end
447447

448-
-- TODO: add consumables, ante, and shop
448+
local shop_booster = nil
449+
if G.shop_booster then
450+
-- NOTE: In the game these are called "packs"
451+
-- but the variable name is "cards" in the API.
452+
local config = {}
453+
if G.shop_booster.config then
454+
config = {
455+
card_count = G.shop_booster.config.card_count,
456+
card_limit = G.shop_booster.config.card_limit,
457+
}
458+
end
459+
local cards = {}
460+
if G.shop_booster.cards then
461+
for i, card in pairs(G.shop_booster.cards) do
462+
cards[i] = {
463+
ability = {
464+
set = card.ability.set,
465+
},
466+
config = {
467+
center_key = card.config.center_key,
468+
},
469+
cost = card.cost,
470+
label = card.label,
471+
highlighted = card.highlighted,
472+
sell_cost = card.sell_cost,
473+
}
474+
end
475+
end
476+
shop_booster = {
477+
config = config,
478+
cards = cards,
479+
}
480+
end
449481

450482
return {
451483
state = G.STATE,
@@ -454,9 +486,7 @@ function utils.get_game_state()
454486
jokers = jokers,
455487
shop_jokers = shop_jokers, -- NOTE: This contains all cards in the shop, not only jokers.
456488
shop_vouchers = shop_vouchers,
457-
458-
-- TODO: add later
459-
-- shop_booster = G.shop_booster,
489+
shop_booster = shop_booster,
460490
}
461491
end
462492

0 commit comments

Comments
 (0)