Expand pre-2024 {@atk} tags to full attack type labels in stat blocks

Old 5etools data uses {@atk mw} instead of {@atkr m}, which the generic
tag handler was reducing to bare "mw" text. Adds dedicated handling for
all {@atk} variants and bumps the bestiary cache version to clear stale
processed data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Lukas
2026-03-24 10:11:54 +01:00
parent 968cc7239b
commit cfd4aef724
4 changed files with 80 additions and 4 deletions

View File

@@ -3,7 +3,7 @@ import { type IDBPDatabase, openDB } from "idb";
const DB_NAME = "initiative-bestiary";
const STORE_NAME = "sources";
const DB_VERSION = 1;
const DB_VERSION = 2;
export interface CachedSourceInfo {
readonly sourceCode: string;
@@ -32,12 +32,16 @@ async function getDb(): Promise<IDBPDatabase | null> {
try {
db = await openDB(DB_NAME, DB_VERSION, {
upgrade(database) {
if (!database.objectStoreNames.contains(STORE_NAME)) {
upgrade(database, oldVersion, _newVersion, transaction) {
if (oldVersion < 1) {
database.createObjectStore(STORE_NAME, {
keyPath: "sourceCode",
});
}
if (oldVersion < 2 && database.objectStoreNames.contains(STORE_NAME)) {
// Clear cached creatures to pick up improved tag processing
transaction.objectStore(STORE_NAME).clear();
}
},
});
return db;