v2.0.0 — Complete Rewrite · dnd5e v4/v5 Activities · Active Effects · Modular Architecture
✅ Complete Modular Rewrite
- Monolithic
script.jsfully refactored into 15 ES modules - Clean separation of concerns: API, generators, utilities, and UI
- File structure:
scripts/main.js— Entry point, hooks, dialogscripts/settings.js— 19 configurable settingsscripts/api/— OpenAI and Stable Diffusion integrationsscripts/generators/— Item, roll table, and name generationscripts/utils/— Activities, armor, weapons, spells, descriptions, JSON, files, UI
✅ D&D 5e v4/v5 Activities System
Automatically creates fully populated activities on generated items:
- Attack — To-hit with ability modifier and magical bonus
- Save — Save DC, ability, and half-damage on success
- Damage — Correct dice formulas and damage types
- Heal — Healing formulas for potions and consumables
- Utility — General-purpose activities
- Cast — Linked to real spell documents from your world or compendiums
✅ Active Effects Engine
Parses item descriptions and maps bonuses to 80+ effect keys:
- Ability scores, skills, saves
- AC, movement, senses
- Damage resistances, immunities, vulnerabilities
- Condition immunities
- Proficiencies and more
Built-in EFFECT_KEY_MAP covers the full dnd5e v4 effect vocabulary.
✅ PHB Defaults Tables
Authoritative fallback stats pulled from the Player's Handbook:
- 40+ weapons — Damage dice, damage type, properties, weight, cost, 2024 mastery
- 18 armor types — AC, dex cap, strength requirement, stealth disadvantage, weight, cost
When the AI provides incomplete data, PHB defaults fill in the gaps accurately.
✅ Two-Pass Description Validation
Every generated item description is scanned twice for mechanical bonuses:
- Regex Scan (instant) — 10 pattern categories: attack bonuses, extra damage, resistances, immunities, skills, senses, speed, AC, saves
- GPT-Informed Scan — Catches nuanced bonuses the regex missed
Both passes de-duplicate against existing effects and protect against armor AC double-counting.
✅ Three-Stage Type Safety Net
Items are always classified correctly, even when the AI gets it wrong:
- Stage 1: Explicit UI selection (user override)
- Stage 2: GPT's
itemTypefield from generated JSON - Stage 3: Keyword-based safety net
- Phase A (always runs): High-confidence overrides for spells, feats, and weapons
- Phase B (equipment fallback): Consumable, tool, and loot detection
✅ GPT-4.1 & GPT Image 1 Support
- Primary Model defaults to
gpt-4.1(Best Quality) - Light Model defaults to
gpt-4.1-mini(names, fixes, properties) - Image Model defaults to
gpt-image-1(Recommended) - DALL·E 3/2 still available but deprecated — will stop working after May 12, 2026
- New JPEG image format option alongside PNG and WebP
✅ Castable Spell Embedding
Items with spell-casting abilities (staves, wands, cloaks, etc.) get Cast activities automatically linked to real spell documents:
- Searches world items first, then compendiums
- Imports from compendium if found
✅ New Item Types
Added support for:
- Container — Bags, chests, and storage items
- Background — Character backgrounds with features and proficiencies
- Equipment — Properly handles clothing, trinkets, rings, amulets, cloaks with subtypes
✅ Weapon & Armor Improvements
- Generic Weapon Mapping — katana → longsword, cutlass → scimitar, claymore → greatsword, and more
- Versatile Damage — Automatically populated for versatile weapons
- Armor Parsing — Longest-first matching prevents "half plate" matching "plate"
- Correct
system.type.baseItem— Fixed for dnd5e v4 data path
✅ Spell Normalization
Full normalization of spell fields:
- School, activation cost, duration, range, target, components, materials
- Compendium lookup via
findSpellByName()
✅ Themed Dialog UI
- Dark-themed generator dialog with purple accent (#7c5cfc)
- Scoped CSS using Foundry variables — no style bleeding
- Responsive layout with auto-height resizing
✅ Foundry v13 Native DOM
renderItemDirectoryhook uses native DOM for v13, jQuery for v12- Zero deprecation warnings on either version
- Version detection via
game.release.generation
✅ Bug Fixes
- Feat misclassification — Feats no longer created as consumables
- Weapon misclassification — Weapons with ambiguous descriptions no longer fall to "equipment"
system.type.baseItempath — Fixed for dnd5e v4 (was using v3 path)- Consumable subtype — Potions, scrolls, ammo correctly set
system.type.value - Armor AC calculation — Base AC from PHB defaults + magical bonus, no more doubling
- Equipment subtype mapping — Trinkets, cloaks, rings mapped to correct subtypes
- Description cleaning — Embedded
<b>Item Name:</b>properly stripped - JSON parse resilience — Triple-layer fallback dramatically reduces failures
