Skip to content

Commit d0d0b02

Browse files
stirbyS1M0N38
authored andcommitted
polished working changes
1 parent a6b8b0f commit d0d0b02

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

docs/protocol-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ The BalatroBot API provides core functions that correspond to the main game acti
118118
| `play_hand_or_discard` | Plays selected cards or discards them |
119119
| `rearrange_hand` | Reorders the current hand according to the supplied index list |
120120
| `cash_out` | Proceeds from round completion to the shop phase |
121-
| `shop` | Performs shop actions. Currently supports proceeding to the next round |
121+
| `shop` | Performs shop actions: proceed to next round (`next_round`) or purchase a card (`buy_card`) |
122122

123123
### Parameters
124124

@@ -130,7 +130,7 @@ The following table details the parameters required for each function. Note that
130130
| `skip_or_select_blind` | `action` (string): Either "select" or "skip" |
131131
| `play_hand_or_discard` | `action` (string): Either "play_hand" or "discard"<br>`cards` (array): Card indices (0-indexed, 1-5 cards) |
132132
| `rearrange_hand` | `cards` (array): Card indices (0-indexed, exactly `hand_size` elements) |
133-
| `shop` | `action` (string): Shop action to perform ("next_round") |
133+
| `shop` | `action` (string): Shop action ("next_round" or "buy_card")<br>`index` (number, required when `action` = "buy_card"): 0-based card index to purchase |
134134

135135
### Errors
136136

src/lua/log.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ function hook_buy_card()
229229
for i, card in ipairs(G.shop_jokers.cards) do
230230
if card.unique_id == c1.unique_id then
231231
LOG.schedule_write({ name = "shop", arguments = { action = action, index = i - 1 } })
232+
sendDebugMessage("Logged shop action: " .. action .. " for card at index " .. i - 1, "LOG")
232233
break
233234
end
234235
end

src/lua/utils.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,9 +378,12 @@ function utils.get_game_state()
378378
cards = {}
379379
}
380380
if G.jokers then
381-
382-
jokers.config.card_limit = G.jokers.config.card_limit
383-
jokers.config.card_count = G.jokers.config.card_count
381+
if G.jokers.config then
382+
jokers.config = {
383+
card_count = G.jokers.config.card_count,
384+
card_limit = G.jokers.config.card_limit,
385+
}
386+
end
384387
if G.jokers.cards then
385388
for i, card in pairs(G.jokers.cards) do
386389
jokers.cards[i] = {

0 commit comments

Comments
 (0)