From aca189c4fc9d9458e1114890b23caadfbefc9dbb Mon Sep 17 00:00:00 2001 From: MJ Harkins Date: Wed, 29 Jul 2026 17:54:37 -0500 Subject: [PATCH] feat(the-order): log each idol hit for the website log parser (#511) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Order weights the idol card by how many copies of each card are in the deck, but nothing about that reaches the player after the fact. Log the hit so the website log parser can show which card won, the value that was rolled, and how likely that card was. Emitted once per selection, right after the winning card is stored: IDOL_ROLL:: `cards` are compact "" tokens (T = 10) in the same order the weighted threshold walk uses, so the reader can reconstruct the exact distribution the roll was made against. base64 keeps it to a single opaque token in the log. Logging only — no game state or RNG is touched. --- compatibility/TheOrder.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/compatibility/TheOrder.lua b/compatibility/TheOrder.lua index 7c74a792..b9d7d1a8 100644 --- a/compatibility/TheOrder.lua +++ b/compatibility/TheOrder.lua @@ -333,6 +333,28 @@ function reset_idol_card() G.GAME.current_round.idol_card.rank = idol_card.base.value G.GAME.current_round.idol_card.suit = idol_card.base.suit G.GAME.current_round.idol_card.id = idol_card.base.id + + -- Log the hit so the website log parser can show which card won and + -- how likely it was. Cards are compact "" tokens + -- in selection order (T = 10), base64'd so the line stays one token: + -- IDOL_ROLL:: + local rank_codes = { Ace = "A", King = "K", Queen = "Q", Jack = "J", ["10"] = "T" } + local function card_token(value, suit) + return (rank_codes[value] or tostring(value)) .. tostring(suit):sub(1, 1) + end + local tokens = {} + for _, reel_entry in ipairs(valid_idol_cards) do + tokens[#tokens + 1] = string.format('"%s%s"', card_token(reel_entry.value, reel_entry.suit), tostring(reel_entry.count)) + end + local idol_payload = string.format( + '{"roll":%s,"winner":"%s","cards":[%s]}', + tostring(raw_random), + card_token(idol_card.base.value, idol_card.base.suit), + table.concat(tokens, ",") + ) + sendDebugMessage("IDOL_ROLL::" .. love.data.encode("string", "base64", idol_payload), "IdolAlgo") + break end end