diff --git a/system.json b/system.json index 6de04c8..8ce7835 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "zero-engine", "title": "Zero Engine (SLA Industries)", "description": "A basic game system for SLA Industries using the Zero Engine rules.", - "version": "1.4.9", + "version": "1.5.0", "compatibility": { "minimum": 13, "verified": "14.359" diff --git a/templates/actor/character-sheet.hbs b/templates/actor/character-sheet.hbs index 9cf71ef..ddb4fb4 100644 --- a/templates/actor/character-sheet.hbs +++ b/templates/actor/character-sheet.hbs @@ -873,7 +873,7 @@
CURRENT BALANCE - c + c {{#if system.finances.debt}}⚠ DEBT {{system.finances.debt}}c{{/if}}
diff --git a/zero-engine.mjs b/zero-engine.mjs index b639f55..fad1ca1 100644 --- a/zero-engine.mjs +++ b/zero-engine.mjs @@ -3522,6 +3522,17 @@ Hooks.once('ready', function() { updates['system.flux.value'] = parseInt(rawFlux) || 0; console.warn(`Zero Engine | Sanitizing corrupt flux on actor "${actor.name}": "${rawFlux}" → ${updates['system.flux.value']}`); } + // Fix credits corrupted by the duplicate-input "500,500" bug + const rawCredits = actor._source?.system?.details?.credits ?? actor.system?.details?.credits; + const creditsCorrupt = (typeof rawCredits === 'string' && (rawCredits.includes(',') || rawCredits === 'NaN' || isNaN(Number(rawCredits)))) + || (typeof rawCredits === 'number' && isNaN(rawCredits)); + if (creditsCorrupt) { + const fixed = typeof rawCredits === 'string' && rawCredits.includes(',') + ? parseInt(rawCredits.split(',')[0]) || 0 + : 0; + updates['system.details.credits'] = fixed; + console.warn(`Zero Engine | Sanitizing corrupt credits on actor "${actor.name}": "${rawCredits}" → ${fixed}`); + } if (Object.keys(updates).length > 0) { await actor.update(updates); }