17,376
edits
m (Reference second data page) |
(Update for v1.1.2) |
||
Line 207: | Line 207: | ||
dataNode.data.masteryCheckpoints = []; | dataNode.data.masteryCheckpoints = []; | ||
masteryCheckpoints.forEach((pct, idx) => { | masteryCheckpoints.forEach((pct, idx) => { | ||
dataNode.data.masteryCheckpoints[idx] = getLangString('MASTERY_CHECKPOINT', `${ localID }_${ idx }`); | dataNode.data.masteryCheckpoints[idx] = this.getLangString('MASTERY_CHECKPOINT', `${ localID }_${ idx }`); | ||
}); | }); | ||
} | } | ||
Line 279: | Line 279: | ||
// Remap a number of keys from their in-game names | // Remap a number of keys from their in-game names | ||
const townKeys = [ | const townKeys = [ | ||
{ | {from: 'BASE_STORAGE', to: 'baseStorage'}, | ||
{ | {from: 'BASE_TAX_RATE', to: 'baseTaxRate'}, | ||
{ | {from: 'DECREASED_BUILDING_COST_CAP', to: 'decreasedBuildingCostCap' }, | ||
{ | {from: 'GP_PER_CITIZEN', to: 'gpPerCitizen'}, | ||
{ | {from: 'MAX_WORSHIP', to: 'maxWorship'}, | ||
{ | {from: 'MINIMUM_HEALTH', to: 'minimumHealth'}, | ||
{ | {from: 'TICK_LENGTH', to: 'tickLength'}, | ||
{from: 'RARE_SEASON_CHANCE', to: 'rareSeasonChance'}, | |||
{from: 'WORSHIP_CHANGE_COST', to: 'worshipChangeCost'}, | |||
{from: 'WORSHIP_CHECKPOINTS', to: 'worshipCheckpoints'}, | |||
{ | |||
{ | |||
{ | |||
]; | ]; | ||
townKeys.forEach((k) => dataNode.data[k.to] = gameSkill[k.from]); | townKeys.forEach((k) => dataNode.data[k.to] = gameSkill[k.from]); | ||
Line 442: | Line 433: | ||
const skillObj = this.gameData[categoryName][skillIdx].data; | const skillObj = this.gameData[categoryName][skillIdx].data; | ||
Object.keys(skillData.data).forEach((dataKey) => { | Object.keys(skillData.data).forEach((dataKey) => { | ||
if (Array.isArray(skillData.data[dataKey]) && skillData.data[dataKey].length > 0 && skillData.data[dataKey][0].insertAt !== undefined) { | // Special case for Township item conversions | ||
//Data is ordered, special handling applies | if ((skillObj[dataKey] !== undefined) && (skillData.skillID === 'melvorD:Township') && (dataKey === 'itemConversions')) { | ||
Object.keys(skillData.data[dataKey]).forEach((convKey) => { | |||
skillData.data[dataKey][convKey].forEach((resource) => { | |||
// Find the resource if it already exists within the combined data | |||
const resourceIdx = skillObj[dataKey][convKey].findIndex((res) => res.resourceID === resource.resourceID); | |||
if (resourceIdx === -1) { | |||
skillObj[dataKey][convKey].push(resource); | |||
} | |||
else { | |||
skillObj[dataKey][convKey][resourceIdx].items.push(...resource.items); | |||
} | |||
}) | |||
}); | |||
} | |||
else if (Array.isArray(skillData.data[dataKey]) && skillData.data[dataKey].length > 0 && skillData.data[dataKey][0].insertAt !== undefined) { | |||
// Data is ordered, special handling applies | |||
skillObj[dataKey] = this.combineOrderedData(skillObj[dataKey], skillData.data[dataKey]); | skillObj[dataKey] = this.combineOrderedData(skillObj[dataKey], skillData.data[dataKey]); | ||
} | } | ||
Line 597: | Line 603: | ||
if (this.gameData.equipmentSlots === undefined) { | if (this.gameData.equipmentSlots === undefined) { | ||
const slotIDs = Object.keys(EquipmentSlots).filter((slotID) => !isNaN(parseInt(slotID))); | const slotIDs = Object.keys(EquipmentSlots).filter((slotID) => !isNaN(parseInt(slotID))); | ||
this.gameData.equipmentSlots = slotIDs.map((slotID) => ({id: EquipmentSlots[slotID], name: getLangString('EQUIP_SLOT', slotID)})); | this.gameData.equipmentSlots = slotIDs.map((slotID) => ({id: EquipmentSlots[slotID], name: this.getLangString('EQUIP_SLOT', slotID)})); | ||
} | } | ||
if (this.gameData.attackTypes === undefined) { | if (this.gameData.attackTypes === undefined) { | ||
Line 715: | Line 721: | ||
case 'langHint': | case 'langHint': | ||
case 'langCustomDescription': | case 'langCustomDescription': | ||
return getLangString(entity.category, this.getLocalID(entity.id)); | return this.getLangString(entity.category, this.getLocalID(entity.id)); | ||
case 'equipmentStats': | case 'equipmentStats': | ||
const newStats = {}; | const newStats = {}; | ||
Line 765: | Line 771: | ||
return 'ALTMAGIC_DESC_{ID}'; | return 'ALTMAGIC_DESC_{ID}'; | ||
}; | }; | ||
const shopChainPropKey = | const shopChainPropKey = (data, dataKey, propName) => { | ||
// Accepts an upgrade chain data object & key of the property being localized | // Accepts an upgrade chain data object & key of the property being localized | ||
const propToLang = { | const propToLang = { | ||
Line 780: | Line 786: | ||
} | } | ||
} | } | ||
const itemDesc = | const itemDesc = (data) => { | ||
// Items have varying logic based on the type of item, and the lang data contains | // Items have varying logic based on the type of item, and the lang data contains | ||
// some incorrect stuff for items whose descriptions are generated entirely | // some incorrect stuff for items whose descriptions are generated entirely | ||
Line 788: | Line 794: | ||
if (item !== undefined) { | if (item !== undefined) { | ||
desc = item.description; | desc = item.description; | ||
if (desc === getLangString('BANK_STRING', '38')) { | if (desc === this.getLangString('BANK_STRING', '38')) { | ||
// Generic "no description" string | // Generic "no description" string | ||
return undefined; | return undefined; | ||
Line 794: | Line 800: | ||
// Temporary fix for issue with language data keys for FrostSpark 1H Sword | // Temporary fix for issue with language data keys for FrostSpark 1H Sword | ||
else if (desc.includes('UNDEFINED TRANSLATION') && data.id === 'melvorTotH:FrostSpark_1H_Sword') { | else if (desc.includes('UNDEFINED TRANSLATION') && data.id === 'melvorTotH:FrostSpark_1H_Sword') { | ||
return getLangString('ITEM_DESCRIPTION', 'Frostspark_1H_Sword') | return this.getLangString('ITEM_DESCRIPTION', 'Frostspark_1H_Sword') | ||
} | } | ||
else { | else { | ||
Line 1,149: | Line 1,155: | ||
} | } | ||
getLangString(key, identifier) { | getLangString(key, identifier) { | ||
return loadedLangJson[key + '_' + identifier]; | |||
} | } | ||
getNamespacedID(namespace, ID) { | getNamespacedID(namespace, ID) { |