From ba408ea30d277373e42a30c3fe5698f04c2c0e60 Mon Sep 17 00:00:00 2001 From: ChronoFinale Date: Sat, 25 Jul 2026 09:53:22 -0500 Subject: [PATCH] feat(the-order): log each idol hit for the website log parser 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 332ac4e2..bfb5b4b3 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