Module:Sandbox/Skills/data: Difference between revisions

m
no edit summary
m (Add item IDs to prevent cloning of item data later)
mNo edit summary
Line 18: Line 18:
     // Add ID
     // Add ID
     itemsAdj[i].id = i
     itemsAdj[i].id = i
    // Remove empty lists/objects in an attempt to save on memory usage within Lua
    for (const key of Object.keys(itemsAdj[i])) {
      if (key === 'isEquipment' && itemsAdj[i][key] === false) {
        delete itemsAdj[i][key]
      }
      else if ((itemsAdj[i][key] instanceof Array && itemsAdj[i][key].length === 0) || (itemsAdj[i][key] instanceof Object && Object.keys(itemsAdj[i][key]).length === 0)) {
        delete itemsAdj[i][key]
      }
    }
     // Amend elements of specialAttacks to include descriptions
     // Amend elements of specialAttacks to include descriptions
     if (itemsAdj[i].specialAttacks !== undefined) {
     if (itemsAdj[i].specialAttacks !== undefined) {
Line 73: Line 82:
})()
})()
--]]
--]]
-- Version: ALPHA V0.21 (?1118)


local itemData = {}
local itemData = {}
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