Fix issue #89: Traits and items are mixed up
All checks were successful
Test / test (push) Successful in 2s
All checks were successful
Test / test (push) Successful in 2s
This commit is contained in:
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user