Commit Graph
16 Commits
Author SHA1 Message Date
tevans 167df8a266 feat: Group NPC Generator tool
Four NPC types: Carrion, Serial Killer, Monstaret, Machine
Each with SLA-appropriate stat ranges, name generators, ability pools.

Features:
- Type selector tabs (colour-coded per type)
- Count 1-10, Generate / Add More / Clear All
- Compact 2-column grid of NPC cards
- Inline editable: name, STR/AGI/WIT/EMP, HP (current/max), ARM, DMG, notes
- +/- HP buttons with live colour bar (green > yellow > red)
- Defeat toggle (grey out) and Reset HP to max
- Reroll individual NPC (preserves notes)
- Create as World Actors button
- Green "Group NPCs" button in Actor Directory (GM only)

v1.5.2
2026-06-03 16:17:56 +01:00
tevans 313850dcd2 fix: prevent "852,500" corruption in Finance Ledger calculate
When actor.update() fires, Foundry auto-submits any open character
sheet form before re-rendering. If the sheet still showed the old
credits value (e.g. 500), that stale value raced the new one (852)
and got merged server-side into the corrupt string "852,500".

Fix: pass {render: false} to actor.update() so Foundry skips the
auto-submit entirely, then manually call app.render() on all open
sheets for that actor — they read fresh data and render cleanly.
2026-06-03 00:05:18 +01:00
tevans b744b91354 fix: prevent duplicate credits submission causing NaN corruption
The non-Mk2 sheet had two inputs named system.details.credits (header
+ finances tab). Foundry concatenates duplicate names as "500,500"
which is not a valid number, causing the field to show blank/grey
after saving.

Fix: finances tab input made readonly with no name attribute — header
is now the sole authoritative credits field.

Also: on-boot sanitization now covers credits, fixing any actors
already storing the corrupted comma-string value.
2026-06-03 00:01:46 +01:00
tevans 5a43027ec8 fix: rewrite GM Finance Ledger
- Read credits via actor._source (raw DB) to bypass DataModel
- Read all finance fields via _readFinance() using same approach
- Calculate now zeros ALL income + expense fields after applying
  (salary, bpnReward, other income, accommodation, drugs, subs,
   other expense, bulletTax, ammoSpentSession, debt)
- Auto-refresh ledger via updateActor hook whenever any actor updates
- Ledger now reflects live sheet values immediately
2026-06-02 23:47:16 +01:00
tevans bfc05c053f debug: log raw credits value in Finance Ledger, multi-path read, string corruption guard 2026-06-02 23:32:24 +01:00
tevans 2945f66d9a fix: guard against NaN credits in GM Finance Ledger 2026-06-02 23:20:03 +01:00
tevans 02d7177122 feat: Player Character flag + GM Finance Ledger
- Add isPlayerCharacter field to template.json (character.details)
- Bio tab: checkbox 'Player Character' bound to system.details.isPlayerCharacter
- SLAGMFinanceTool Application: GM-only window listing all PC-flagged
  actors with current balance, weekly income, weekly expenses, net
  weekly income, and a Calculate button per character
- Calculate button: applies netWeekly to credits (credits += net)
- Calculate All button: applies week to every listed PC at once
- Actor Directory: GM-only 'Finance Ledger' button opens the tool
- CSS: styled PC flag row and full GM Finance Ledger table
- Version bump: 1.4.5 → 1.4.6
2026-06-02 22:09:34 +00:00
tevans 049273fbc6 fix: bullet tax balance + expenses total (v1.4.5)
Three bugs:
1. weeklyExpenses total omitted bulletTax from the sum (both getData paths)
   Fix: add (_exp.bulletTax||0) to the calculation
2. _applyBulletTax read undefined credits as 0 (actors created before the
   credits field existed have null/undefined, not zero)
   Fix: fallback to 500 (template default) only when value is null/undefined
3. Finances tab CURRENT BALANCE showed just C because input had no placeholder
   Fix: add placeholder=500 min=0 to the credits input in character-sheet.hbs
2026-06-02 22:53:00 +01:00
tevans 7de21e290d fix: split bullet tax credit update into standalone call (v1.4.4)
Foundry v14 rejects actor.update() silently when one field in the payload
has a schema conflict. The combined update (credits + finances nested paths)
was being dropped entirely, so credits never changed.

Fix: two separate actor.update() calls
1. Credit deduction: update("system.details.credits") alone — critical
2. Finances tracking: update(finances paths) — non-critical, caught silently

Added console.log so GMs can confirm credit deductions in browser console:
  Zero Engine | Bullet Tax: Joe credits 500c -> 440c (-60c)
2026-06-02 22:40:17 +01:00
tevans 86df96132e fix: bullet tax doubled + full caliber catalog + fix undefined/undefined (v1.4.3)
Bullet tax rules (per user spec):
- Tax is now 2x base round cost on every shot (ammo cost + levy)
- e.g. 7mm standard = 10c/round -> 20c charged per round fired
- Applied immediately on ATTACK press, not deferred to REST
- Weapon locking still only on push + bane (unchanged)

Ammo catalog expanded (was missing 9 calibers -> 0 tax for those weapons):
- .44 (Revolver): 8/24/45c standard/AP/HE
- .454 (Heavy Pistol): 10/28/50c
- .50 (Heavy Pistol): 12/35/60c
- 3mm (Machine Pistol): 3/9/20c
- 7mm (SLA Carbine/LMG): 10/28/55c
- 8mm (Sniper Rifle): 14/40/75c
- 12g (Shotgun): 18/45/80c
- 40mm (Grenade/Launcher): 80/180/140c
- Rail (Rail Gun): 50/120/200c

SLA_WEAPON_DEFAULT_CALIBER expanded to cover all weapon types

Chat display: removed undefined/undefined (Remaining X/Y) - weapons are
always assumed loaded; display now shows Rounds fired + tax cost only

Tax notification updated to show 2x calculation clearly
2026-06-02 22:32:11 +01:00
tevans 4e3554c28b fix: readability — solid dark backgrounds on all chat cards (v1.4.2)
Root cause: all chat card containers used rgba() with 0.2-0.4 opacity,
which becomes nearly transparent on Foundry v14 parchment chat bg.
Light text (white, cyan, yellow, green) was invisible on the result.

CSS fixes (solid dark backgrounds replacing transparent rgba):
- .panic-result: rgba(139,0,0,0.2) -> #1c0808 + color: #e0e0e0
- .panic-success: rgba(0,128,0,0.2) -> #081c08 + green text toned to #55ee55
- .panic-effect: rgba(0,0,0,0.4) -> #111111 + color: #e0e0e0
- .critical-injury: rgba(220,20,60,0.2) -> #1c080d + color: #e0e0e0
- .crit-effects/.crit-healing/.crit-recovery: rgba(0,0,0,0.3) -> #111111
- .time-limit: rgba(255,170,0,0.2) -> #1a1200

New CSS classes added (were missing entirely):
- .instability-result with dark bg, border, and sub-element rules
- .instability-no-effect, .instability-effect-text, .instability-auto-note
- .panic-auto (auto-applied row)
- .drug-gm-alert, .weapon-reload-chat

JS inline style fixes:
- Rest card: rgba(0,60,30,0.3) -> #0a1a0e (solid)
- Ammo empty card: rgba(80,20,0,0.3) -> #1a0800 (solid)
- Instability effect text: color:#333 (dark on dark) -> CSS class #d8d8d8
- Instability auto-note: color:#ffcc44 inline -> CSS class
2026-06-02 22:05:05 +01:00
tevans 76e086ca6c feat: Body Blocker armor + drug credit deduction on use (v1.4.1)
- Add Body Blocker armor (AR 1, Dice 1, 120c) with custom SVG icon
  Concealable civilian vest, sits between Street Clothes and Downtown Jacket
- _activateDrug now automatically deducts drug cost from actor credits
  Shows notification: drug name, cost charged, old and new credit total
  Credits cannot go below 0
- Set costs on 7 drugs that were missing them (cost was 0):
  Painkillers 30c, Stimulant 40c, Sedative 35c, Redline 110c,
  Calm-Line 65c, Rush 85c, UV 200c
- Rebuild: sla-armors (18), sla-drugs (16)
2026-06-02 21:42:29 +01:00
tevans e155a2dd1b fix: correct DSN dice skins + UI tweaks (v1.3.9)
- DSN: register ze-stress-dice system separately so normal/stress d6 presets dont overwrite each other
- DSN: use term.options.appearance.system to force correct preset on every roll - bypasses user saved DSN system preference
- Remove v1.3.8 flag-patching ready hook (no longer needed)
- UI: dice icon on attribute header enlarged (13px to 20px) with glow
- UI: attr-btn smaller (24px to 16px), skill +/- smaller (20px to 14px)
- UI: clicking attribute name, skill name, or weapon name now triggers roll
2026-06-02 21:12:02 +01:00
tevans 6edce3ed77 fix: force zero-engine dice system for all users on load (v1.3.8) 2026-06-02 19:46:45 +00:00
tevans 225255ec13 fix: or Handlebars helper works as both block and inline (v1.3.7) 2026-06-02 20:29:50 +01:00
tevans 2ebd5803fc Initial commit — full system source + zero-engine-state.md reference 2026-06-01 23:19:46 +01:00