1. Critical Runtime Crashes & Broken Version Gating
#1
Critical
Server crash (math.random(1, 0)) when Mystery Card is the only card enabled
Server_AdvanceTurn.lua
getCards(game) iterates game.Settings.Cards and skips Mod.Settings.MysteryCardID. If a host disables every built-in card so only Mystery Card is active, Mod.PublicGameData.cards becomes an empty table (#cards == 0).
On the first Mystery Card play, line 59 executes math.random(1, 0), which throws a fatal Lua error (bad argument #2 to 'random' (interval is empty)), crashing the mod and halting turn advancement. Furthermore, there is no Client_CreateGame.lua hook (available since 5.34.1) to reject a game template containing only Mystery Cards, and no nil-guard on game.Settings.Cards at line 66 if cards are disabled.
function decideRandomCard(game)
if not Mod.PublicGameData.cards then
getCards(game);
end
return Mod.PublicGameData.cards[math.random(1, #Mod.PublicGameData.cards)]; -- crashes if #cards == 0
end
Fix: Guard #cards == 0 safely (skip/refund or log cleanly) and implement Client_CreateGame.lua to validate at game creation that at least one non-Mystery drawable card exists.
#2
Critical
Client crash (Mod is nil) on Warzone 5.32–5.33.x in Client_PresentPlayCardUI
Client_PresentPlayCardUI.lua
__mod.lua declares clientVersion = '5.32', so Client_GameRefresh.lua suppresses its update warning on versions 5.32–5.33.x. However, per the official Warzone Custom Cards API reference, Mod and UI were not directly accessible inside Client_PresentPlayCardUI before 5.34.0 if invoked before other client hooks.
Reading Mod.Settings.MysteryCardID on line 4 crashes with attempt to index a nil value (global 'Mod') on 5.32–5.33.x. Worse, the check itself is redundant: Warzone only dispatches Client_PresentPlayCardUI for custom cards owned by this mod, and this mod defines only one card.
Fix: Remove the redundant Mod.Settings.MysteryCardID check inside Client_PresentPlayCardUI (or wrap UI access inside game.CreateDialog), and align MOD.clientVersion with the actual minimum supported API version.
#3
Critical
Three-way version contradiction (5.32 vs 5.32.0.1 vs 5.34.1) & silent broken save
Client_SaveConfigureUI.lua
The codebase disagrees with itself on minimum app version across three layers:
__mod.luaclaims5.32, even thoughaddCarddid not returncardIduntil5.32.0.1andModinsideClient_PresentPlayCardUIrequires5.34.0.Client_PresentConfigureUI.luaandClient_SaveConfigureUI.luagate custom cards on5.34.1(solely becauseAutoSettingsFilespasses a 9th argumentexpireBehavior, which Mystery Card does not even use).
Silent broken game creation: In Client_SaveConfigureUI.lua#L124-L127, if a host is on < 5.34.1 and clicks Save, if not canUseCustomCards then return; end returns without calling alert(...). Because Warzone only aborts saving when alert() is invoked, the configuration saves cleanly with Mod.Settings.MysteryCardID == nil and never registers the card — creating a “Mystery Card” game that has no Mystery Card.
Fix: Call alert(...) when custom cards cannot be configured on the host's client, and unify the required version check to one accurate constant.
#4
Critical
serverCanRunMod throws uncaught error(msg) instead of returning false
version.lua
In server hooks (including single-player Server_AdvanceTurn_Start), global UI is nil. When serverCanRunMod(game) fails the version check in single-player (lines 34–38), err(msg) evaluates local alert = (UI and UI.Alert) or error and calls Lua's built-in error(msg).
That immediately aborts execution with an uncaught mod crash. Consequently, return false in version.lua#L38 and if not canRun then return; end in Server_AdvanceTurn.lua#L11-L13 are 100% unreachable dead code.
Fix: Return false cleanly (optionally logging via print(msg) or emitting a GameOrderEvent warning) instead of invoking error(msg) when UI is unavailable.
2. Gameplay, Engine & Fog/Visibility Flaws
#5
High
Mints unobtainable / Weight == 0 cards and ignores card weights
Server_AdvanceTurn.lua
decideRandomCard selects uniformly (math.random(1, #cards)) across every entry in game.Settings.Cards, completely ignoring cardGame.Weight.
As documented on the Warzone Wiki, custom card mods routinely configure Weight = 0, MinimumPiecesPerTurn = 0 for start-of-game-only cards, scenario/boss cards, or admin/mod-distributed cards. Mystery Card grants full copies of Weight == 0 cards at the exact same odds as common cards.
Fix: At minimum, exclude cards where Weight == 0 (unless no positive-weight cards exist, or configure an option), and consider weighted random sampling using cardGame.Weight.
#6
High
Silently consumes Mystery Card for 0 pieces if target card has NumPieces == 0
Server_AdvanceTurn.lua
Since Warzone 5.34, custom cards are allowed to configure NumPieces <= 0 (and DanWaLes's own __settings.lua allows minValue = 0). If randomCard has NumPieces == 0, line 50 executes event.AddCardPiecesOpt = {[playerId] = {[randomCard.id] = 0}}, consuming the Mystery Card and awarding 0 pieces while logging "Receive a full ... from playing a Mystery Card".
Fix: Filter out cards with NumPieces <= 0 from the draw pool (or pass math.max(1, NumPieces) if zero-piece custom cards are meant to be grantable).
#7
High
Broken visibleToOpt leaks fogged plays and hides public card receives
Server_AdvanceTurn.lua
- On error/skip branches (lines 22, 30, 38),
WL.GameOrderEvent.Create(playerId, ...)omits the 3rd argument (visibleToOpt = nil), exposing the event publicly to all players even whengame.Settings.CardPlayingsFogged == true. - Conversely, on success (line 47),
visibleToOptis hardcoded to{}(only visible toplayerId), hiding which card was received even in games wheregame.Settings.CardHoldingsAndReceivesFogged == false.
Fix: Derive visibleToOpt from game.Settings.CardHoldingsAndReceivesFogged / CardPlayingsFogged (using {} when fogged and nil when public, or explicitly including teammates when appropriate).
#8
High
Robs surviving teammates of shared cards in Team games
Server_AdvanceTurn.lua
In Warzone team games, cards are shared by the entire team. If Player A submits a Mystery Card order and gets eliminated during the Attacks phase before WL.TurnPhase.ReceiveCards runs, while teammate Player B is still Playing:
Lines 35–43 neither call skipThisOrder(WL.ModOrderControl.Skip...) to refund the card to the team nor grant AddCardPiecesOpt to a surviving Playing teammate. The inline comment on lines 40–41 confuses playing a card on a teammate's behalf with awarding card pieces via AddCardPiecesOpt, causing the surviving team to forfeit their card.
Fix: Either call skipThisOrder(...) when the player is no longer Playing (so surviving teammates retain the card), or award the card pieces to an active teammate on the same team.
#9
High
AI players (and AI-converted humans) can never play Mystery Cards
Server_AdvanceTurn.lua
Warzone's native AI never invokes Client_PresentPlayCardUI and does not know how to play custom cards. Because Mystery Card requires zero player inputs or map targets, omitting a Server_AdvanceTurn_End handler to auto-convert/play Mystery Cards for AI players (player.IsAIOrHumanTurnedIntoAI) leaves AIs clogging their hands up to MaxCardsHold with unplayable cards.
Fix: Inspect game.ServerGame.LatestTurnStanding.Cards in Server_AdvanceTurn_End for AI players holding Mystery Cards and play/consume them via WL.GameOrderPlayCardCustom or RemoveWholeCardsOpt + AddCardPiecesOpt.
#10
Medium
Misuse of Mod.PublicGameData causes network bloat, spurious refreshes, 3× deserialization, & non-determinism
Server_AdvanceTurn.lua
game.Settings.Cards is immutable for the lifetime of a game and already present in memory on every server turn. Caching it into Mod.PublicGameData.cards introduces four drawbacks:
- Persists redundant data in Warzone's database and broadcasts it to every player/spectator even though no client hook ever reads
Mod.PublicGameData. - Triggers an automatic
Client_GameRefreshpush across all open clients the first time a Mystery Card is played. - Reads
Mod.PublicGameDatathree separate times per draw (line 55, and twice on line 59) — each access clones/deserializes the storage table in Warzone's sandbox. - Builds
cardsviapairs(game.Settings.Cards)(line 66), whose Lua hash iteration order is non-deterministic.
Fix: Cache eligible cards in a local Lua module table per turn in Server_AdvanceTurn_Start (sorted deterministically by cardId), and stop writing Mod.PublicGameData.
#11
Low
Inconsistent custom card naming in getCardName & event message tense
Server_AdvanceTurn.lua
Built-in cards always append ' Card' (e.g., 'Reinforcement Card'), while CardGameCustom returns cardGame.Name verbatim (line 80). If another mod names its card 'Teleport' rather than 'Teleport Card', line 47 displays 'Receive a full Teleport from playing a Mystery Card'. Line 47 also uses imperative 'Receive' instead of past-tense 'Received' used by native history logs.
Fix: Append ' Card' when a custom card's name does not already end with 'Card', and change the history message to 'Received a full ...'.
3. Client UI, Refresh & Configuration Flaws
#12
High
Client_GameRefresh spams spectators/finished games & has a DIALOG.close nil race
Client_GameRefresh.lua
Client_GameRefresh(game) fails to check game.Us, game.Game.State == WL.GameState.Playing, or game.Us.State == WL.GamePlayerState.Playing. As a result, spectators, eliminated players, and users opening finished games on older clients are hit with a modal warning on every single background refresh/poll, even after closing it.
Additionally, lines 30–43 assign DIALOG = dialog ({}) outside game.CreateDialog(...) while dialog.close = close is assigned inside the callback (line 40). If CreateDialog defers or fails to run before the next refresh, DIALOG is truthy while DIALOG.close is nil, crashing on DIALOG.close() (line 27).
if DIALOG then
DIALOG.close(); -- crashes if callback hasn't set .close yet
end
local dialog = {};
game.CreateDialog(function(..., close)
dialog.close = close;
end);
DIALOG = dialog;
Fix: Guard on active Playing state, guard if DIALOG and DIALOG.close then (or track per-session/Mod.ClientStorage dismissal), and only store DIALOG once close exists.
#13
Medium
Cards dialog left open with zero visual feedback when playing a card
Client_PresentPlayCardUI.lua
Client_PresentPlayCardUI ignores the 4th callback argument closeCardsDialog (available since 5.34.0) and performs no game.Us / Playing state checks. Clicking “Play” inserts the order into the orders list behind the still-open Cards modal without closing it or showing feedback.
Fix: Check active playing state and call if type(closeCardsDialog) == 'function' then closeCardsDialog(); end (or gate on WL.IsVersionOrHigher('5.34')) after invoking playCard.
#14
High
Invalid setting bounds (NumPieces = 0), dead all-zero config, & excessive dp = 10
__settings.lua
NumPiecesallows0(minValue = 0): Dividing a card into 0 pieces threw an error prior to Warzone5.34and makes card piece division nonsensical.- Silent unobtainable configuration: Hosts can set
Weight = 0,MinimumPiecesPerTurn = 0, andInitialPieces = 0simultaneously without any validation warning, ensuring no Mystery Card can ever enter the game. - Overkill precision (
dp = 10):round(1000, 10)computes1000 * 10^10 = 10^13, pushing near IEEE-754 double precision boundaries unnecessarily for card weights.
Fix: Set minValue = 1 on NumPieces, reduce Weight precision to dp = 2 or 3, and warn/reject if all three distribution parameters are 0.
#15
Medium
Misleading boundary errors, unvalidated ints, awkward UI layout & unreset state
Client_PresentSettingsUI.lua
- Off-by-one error wording:
Client_SaveConfigureUI.lua#L206-L212reports"must be greater than 0"when< minValue(implying0itself is invalid) and"must be less than <maxValue>"when exceedingmaxValuewithoutabsoluteMax. - No integer enforcement on
'int'inputs:'float'values are rounded, whereas'int'values are never checked (val % 1 == 0) or floored. - Missing card heading/description: Neither Configure UI nor Settings UI displays
customCardName("Mystery Card") orcustomCardDescription, rendering bare fields likeWeightwithout context. - Awkward
[?]placement & state bugs:Client_PresentSettingsUI.lua#L44-L58places[?]between label and value (Weight: [?] 1), omitssettingHelpAreas[setting.name] = nilon destroy (#L121), and passes an unused 3rd arg0tocps(..., 0)(#L13). Meanwhile,Client_PresentConfigureUI.lua#L8-L15never resetsGLOBALS,modDevMadeError, orsettingHelpAreasbetween runs.
Fix: Use inclusive wording (at least / at most), enforce integer values, render a card section header, place [?] after the value, and reset module state at the start of Client_PresentConfigureUI.
4. Latent Crashes & Bugs in Shipped Boilerplate Libraries
#16
Medium
JavaScript + string concatenation in Lua (errMsg = errMsg + 's')
Client_SaveConfigureUI.lua
Line 173 uses + instead of Lua's .. concatenation operator (errMsg = errMsg + 's';), throwing attempt to perform arithmetic on a string value if any 'text' setting exceeds charLimit > 1. Line 170 also misstates 'less than' instead of 'at most'.
Fix: Change + 's' to .. 's' (and update upstream mods/libs/AutoSettingsFiles).
#17
Medium
Undefined variable label in radio settings display
Client_PresentSettingsUI.lua
Line 63 executes settingValueLabel.SetText(tostring((controlIsTable and control.label) or label));, referencing an undefined global label (nil) instead of control, rendering "nil" for string radio options.
Fix: Replace or label with or control.
#18
Medium
bkwrds vs bkwards typo split-brain causes dead code & nil arithmetic crash
settings.lua
addSetting checks otherProps.bkwrds (line 67) while radio validation checks optionalProps.bkwards (always nil, making lines 195–209 and 260–266 dead code, with line 263 also missing ' = ').
In addSettingTemplate, line 314 stores bkwards = options.bkwards, while Client_PresentSettingsUI.lua#L23 reads (Mod.Settings[setting.name] or setting.bkwrds) + 1 — crashing with attempt to perform arithmetic on a nil value whenever a template setting is missing from Mod.Settings.
Fix: Standardize on one property name (or support both with or 0 fallback on line 23).
#19
Medium
Inverted type check (type(tmp.labelColor) ~= 'nil') & dropped labelColor
settings.lua
Inside if tmp.labelColor and type(tmp.labelColor) ~= 'nil', tmp.labelColor is already truthy, so type(...) ~= 'nil' is always true (intended ~= 'string'). It prints an error on valid string colors, forgets return;, and fails to include labelColor = tmp.labelColor in the returned table on lines 362–368.
Fix: Check type(tmp.labelColor) ~= 'string', add return;, and forward labelColor = tmp.labelColor in the returned object.
#20
Medium
Crash inside validation logger due to variable shadowing
settings.lua
local name = tmp.settings[i].name; shadows outer parameter name (without verifying type(ss) == 'table'). When validation triggers because type(name) ~= 'string' (e.g., nil or a table), line 355 executes print('name = ' .. name);, crashing inside its own error handler.
Fix: Rename the inner local to settingName and validate type(ss) == 'table' before indexing ss.name.
#21
Medium
Accidental global nested functions overwrite closures across controls
Client_PresentConfigureUI.lua
Declaring function updateLabelWithOption(...), makeLabelFromOption, etc. without local inside cpcDoSetting binds them onto _G. If multiple 'radio' settings exist, the last control overwrites the global helper functions with its own upvalues, so clicking Radio 1 mutates Radio 2's labels.
Fix: Prefix all nested helper functions with local function.
#22
Medium
Defects in tblprint.lua and ui.lua (cycles, dropped keys, unguarded APIs, no-op)
tblprint.lua / ui.lua
tblprint.lua: LeakstblLen,tblprint_PrintProxyInfo, andtblprint_tprintto_G; infinitely recurses on cyclic tables (stack overflow); silently drops non-string/number keys (lines 81–85); mis-indents nested proxy tables (line 44 passesindentinstead ofindent + 2); and usesO(N²)string concatenation instead oftable.concat.ui.lua: Roughly 95% dead code here (onlyVertandLabelare used); pollutes_Gwith generic names (Btn,Label,Tabs,Empty); callsUI.CreateRadioButton(5.34+) andUI.IsDestroyed(5.21+) without version guards; and togglesbtn.SetInteractable(false)/btn.SetInteractable(true)synchronously on consecutive lines (lines 107–109), which is a complete no-op.
Fix: Drop unused helper files or scope them cleanly, guard version-specific UI APIs, and add cycle detection (visited set) to tblprint.
5. Documentation, Typos & Asset Packaging
#23
Low
User-facing typos & undocumented gameplay caveats
ModDescription.txt
ModDescription.txt#L3:"will not take affect"→ should be"take effect".ModDescription.txtalso fails to inform players that draws ignore card weights, can grantWeight = 0cards, and cannot be played by AIs.Client_PresentConfigureUI.lua#L105:"You must use update your app"→ should be"You must update your app".
Fix: Correct both spelling/grammar typos and document draw odds and AI behavior accurately in ModDescription.txt.
#24
Low
Unused imports, ~92% vendored boilerplate, & raw Inkscape SVG shipped in mod
RawCardImages/MysteryCard.svg
require('tblprint')is imported across 3 hook files (Client_GameRefresh,Client_PresentPlayCardUI,Server_AdvanceTurn) and never invoked once.- Roughly 92% of the Lua code (~910 of ~990 lines) is generic vendored boilerplate for just 4 simple number inputs.
RawCardImages/MysteryCard.svg(13 KB, more than twice the 5.8 KB runtimeCardImages/MysteryCard.png) sits directly inside the mod folder, uses un-outlined systemSansfonts and Inkscape-proprietaryfillet_chamferpath effects, and contains a stray Inkscape guide aty = -182820(line 34).
Fix: Strip unused require('tblprint') calls and keep raw design source SVGs outside the deployable mod bundle (or export paths cleanly).