Fix issue #89: Traits and items are mixed up
All checks were successful
Test / test (push) Successful in 2s

This commit is contained in:
Gitea OpenCode Agent
2026-10-15 21:36:44 +00:00
parent 98aa3be078
commit f8dae95563
7 changed files with 586 additions and 5 deletions

View File

@@ -23,6 +23,14 @@ const NON_GEAR_FOUNDRY_TYPES = new Set([
'spell', 'class', 'subclass', 'background', 'feat', 'race', 'species', 'status', 'spellbook', 'language'
]);
// Whether a Foundry document of this type is gear: something a character carries. Traits,
// species, spells and the rest are documents of the world that mean something else on a
// Dragonroll sheet — a feat is a trait and a race is a species — so they stand in the
// character's own fields, never in its inventory (Syndria98/dragonroll#89).
function isFoundryGearType(type) {
return !NON_GEAR_FOUNDRY_TYPES.has(asText(type).toLowerCase().trim());
}
// Item categories the Dragonroll Item model accepts.
const CATEGORIES = ['weapon', 'armor', 'shield', 'adventuring-gear', 'magic-item', 'consumable', 'tool', 'treasure', 'other'];
@@ -107,4 +115,4 @@ function foundryItemToItemData(foundryItem) {
};
}
module.exports = { foundryItemToItemData };
module.exports = { foundryItemToItemData, isFoundryGearType };