Module:Sandbox/Skills/data: Difference between revisions

m
Revert to previous revision
mNo edit summary
m (Revert to previous revision)
Line 1: Line 1:
-- Version: ALPHA V0.21 (?1118)
-- 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 16: Line 16:
   for (var i = 0; i < items.length; i++) {
   for (var i = 0; i < items.length; i++) {
     itemsAdj[i] = {...items[i]}
     itemsAdj[i] = {...items[i]}
    // Add ID
    itemsAdj[i].id = i
    // Remove empty & unused lists/objects in an attempt to save on memory usage within Lua
    for (const key of Object.keys(itemsAdj[i])) {
      if (['media'].includes(key)) {
        delete itemsAdj[i][key]
      }
      else 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 85: Line 71:
})()
})()
--]]
--]]
-- Version: ALPHA V0.21 (?1118)
-- 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