17,101
edits
mNo edit summary |
m (Fiddle with structure of data again) |
||
Line 1: | Line 1: | ||
-- Version: ALPHA V0.21 (? | -- Version: ALPHA V0.21 (?1114) | ||
--[[The text to decode can be generated in the console via | --[[The text to decode can be generated in the console via | ||
Line 21: | Line 21: | ||
itemsAdj[i].specialAttacks[j].description = describeAttack(itemsAdj[i].specialAttacks[j], youNoun, enemyNoun).replaceAll(/<span class=\".+?\">(.+?)<\/span>/ig, '$1') | itemsAdj[i].specialAttacks[j].description = describeAttack(itemsAdj[i].specialAttacks[j], youNoun, enemyNoun).replaceAll(/<span class=\".+?\">(.+?)<\/span>/ig, '$1') | ||
} | } | ||
} | |||
// Adjust structure of equipmentStats data | |||
if (itemsAdj[i].equipmentStats !== undefined) { | |||
var newStats = {} | |||
var stat = null | |||
for (var j = 0; j < itemsAdj[i].equipmentStats.length; j++) { | |||
stat = itemsAdj[i].equipmentStats[j] | |||
if (newStats[stat.key] === undefined) { | |||
newStats[stat.key] = stat.value | |||
} | |||
else { | |||
newstats[stat.key] += stat.value | |||
} | |||
} | |||
itemsAdj[i].equipmentStats = newStats | |||
} | |||
// Adjust structure of equipRequirements data, specifically any level requirements | |||
if (itemsAdj[i].equipRequirements !== undefined) { | |||
var newReqs = {} | |||
var req = null | |||
for (var j = 0; j < itemsAdj[i].equipRequirements.length; j++) { | |||
req = itemsAdj[i].equipRequirements[j] | |||
if (req.type === "Level") { | |||
newReqs[req.type] = {} | |||
for (var k = 0; k < req.levels.length; k++) { | |||
newReqs[req.type][req.levels[k].skill] = req.levels[k].level | |||
} | |||
} | |||
else { | |||
newReqs[req.type] = req | |||
} | |||
} | |||
itemsAdj[i].equipRequirements = newReqs | |||
} | } | ||
} | } | ||
Line 40: | Line 73: | ||
local itemData = {} | local itemData = {} | ||
itemData | |||
itemData.EquipmentStatKeys = mw.text.jsonDecode('["attackSpeed","stabAttackBonus","slashAttackBonus","blockAttackBonus","rangedAttackBonus","magicAttackBonus","meleeStrengthBonus","rangedStrengthBonus","magicDamageBonus","meleeDefenceBonus","rangedDefenceBonus","magicDefenceBonus","damageReduction","summoningMaxhit"]') | itemData.EquipmentStatKeys = mw.text.jsonDecode('["attackSpeed","stabAttackBonus","slashAttackBonus","blockAttackBonus","rangedAttackBonus","magicAttackBonus","meleeStrengthBonus","rangedStrengthBonus","magicDamageBonus","meleeDefenceBonus","rangedDefenceBonus","magicDefenceBonus","damageReduction","summoningMaxhit"]') | ||
return itemData | return itemData |