17,101
edits
(Fix issue with setting spellBook attribute of Alt. Magic spells) |
(Fix Alt. Magic spell IDs (in a less than elegant way)) |
||
Line 60: | Line 60: | ||
// where ruleFunction is a function returning the transformed value | // where ruleFunction is a function returning the transformed value | ||
// to be used in place of the original value | // to be used in place of the original value | ||
langHint: function(entityType, entity) { | langHint: function(ns, entityType, entity) { | ||
let localID = '' | let localID = '' | ||
if (entity.id.indexOf(':') > 0) { | if (entity.id.indexOf(':') > 0) { | ||
Line 70: | Line 70: | ||
return getLangString(entity.category, localID); | return getLangString(entity.category, localID); | ||
}, | }, | ||
equipmentStats: function(entityType, entity) { | equipmentStats: function(ns, entityType, entity) { | ||
const newStats = {}; | const newStats = {}; | ||
entity.forEach((stat) => { | entity.forEach((stat) => { | ||
Line 82: | Line 82: | ||
return newStats; | return newStats; | ||
}, | }, | ||
altSpells: function(entityType, entity) { | altSpells: function(ns, entityType, entity) { | ||
if (entityType !== 'skillData') { | if (entityType !== 'skillData') { | ||
return entity; | return entity; | ||
Line 88: | Line 88: | ||
else { | else { | ||
const newData = structuredClone(entity); | const newData = structuredClone(entity); | ||
newData.forEach((i) => i.spellBook = 'altMagic'); | newData.forEach((i) => { | ||
i.id = ns + ':' + i.id; | |||
i.spellBook = 'altMagic'; | |||
}); | |||
return newData; | return newData; | ||
} | } | ||
Line 190: | Line 193: | ||
if (transformFunc !== undefined) { | if (transformFunc !== undefined) { | ||
// A transformation function is defined for this node | // A transformation function is defined for this node | ||
parentNode[nodeKey] = transformFunc(categoryName, dataNode); | parentNode[nodeKey] = transformFunc(ns, categoryName, dataNode); | ||
} | } | ||
else if (Array.isArray(dataNode)) { | else if (Array.isArray(dataNode)) { |