Anonymous

Module:Sandbox/Skills/data: Difference between revisions

From Melvor Idle
Generate special attack description using in-game functions
m (Retain special attacks by ID rather than by non-numerical key)
(Generate special attack description using in-game functions)
Line 17: Line 17:


   var attacksByID = []
   var attacksByID = []
   Object.values(attacks).forEach((i, idx) => attacksByID[i.id] = i)
   for (const k of Object.keys(attacks)) {
    var a = attacks[k]
    attacksByID[a.id] = {...a}
    attacksByID[a.id].key = k
    // attacksByID[a.id].descTemplate = a.description
    attacksByID[a.id].description = describeAttack(a, enemyNoun, youNoun).replaceAll(/<span class=\".+?\">(.+?)<\/span>/ig, '$1')
  }
   txt = JSON.stringify(attacksByID)
   txt = JSON.stringify(attacksByID)
   txt = txt.replace(/\'/g, "\\\'")
   txt = txt.replace(/\'/g, "\\\'")
Line 34: Line 40:
--]]
--]]


-- Version: ALPHA V0.21 (?1034)
-- Version: ALPHA V0.21 (?1105)


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