Module:AuronTest/ComparisonTables: Difference between revisions

Adapt to revised data format
mNo edit summary
(Adapt to revised data format)
Line 279: Line 279:
     else
     else
       --Now for handling armour
       --Now for handling armour
      local levelReqs =  {['Defence'] = 10} --Items._processEquipmentLevelReqs(item.equipRequirements)
       if type == "Armour" or type == "Melee" then
       if type == "Armour" or type == "Melee" then
         listItem = levelReqs['Defence'] ~= nil or (item.category == 'Combat' and item.type == 'Armour')
         listItem = Items._getItemStat(item, 'defenceLevelRequired') ~= nil or (item.category == 'Combat' and item.type == 'Armour')
       elseif type == "Ranged Armour" or type == "Ranged" then
       elseif type == "Ranged Armour" or type == "Ranged" then
         listItem = levelReqs['Ranged'] ~= nil or (item.category == 'Combat' and item.type == 'Ranged Armour')
         listItem = Items._getItemStat(item, 'rangedLevelRequired') ~= nil or (item.category == 'Combat' and item.type == 'Ranged Armour')
       elseif type == "Magic Armour" or type == "Magic" then
       elseif type == "Magic Armour" or type == "Magic" then
         listItem = levelReqs['Magic'] or (item.category == 'Combat' and item.type == 'Magic Armour')
         listItem = Items._getItemStat(item, 'magicLevelRequired') or (item.category == 'Combat' and item.type == 'Magic Armour')
       else
       else
         listItem = item.type == type and item.category ~= 'Combat'
         listItem = item.type == type and item.category ~= 'Combat'
Line 308: Line 307:
       local isMatch = item.isEquipment
       local isMatch = item.isEquipment
       if isMatch then
       if isMatch then
        local levelReqs = {['Defence'] = 10} -- Items._processEquipmentLevelReqs(item.equipRequirements)
         if style == 'Melee' then
         if style == 'Melee' then
           if (levelReqs['Defence'] == nil and levelReqs['Attack'] == nil) and not Shared.contains(styleOverrides.Melee, item.name) then isMatch = false end
           if (Items._getItemStat(item, 'defenceLevelRequired') == nil and Items._getItemStat(item, 'attackLevelRequired') == nil) and not Shared.contains(styleOverrides.Melee, item.name) then isMatch = false end
         elseif style == 'Ranged' then
         elseif style == 'Ranged' then
           if levelReqs['Ranged'] == nil and not Shared.contains(styleOverrides.Ranged, item.name) then isMatch = false end
           if Items._getItemStat(item, 'rangedLevelRequired') == nil and not Shared.contains(styleOverrides.Ranged, item.name) then isMatch = false end
         elseif style == 'Magic' then
         elseif style == 'Magic' then
           if levelReqs['Magic'] == nil and not Shared.contains(styleOverrides.Magic, item.name) then isMatch = false end
           if Items._getItemStat(item, 'magicLevelRequired') == nil and not Shared.contains(styleOverrides.Magic, item.name) then isMatch = false end
         elseif style == 'None' then
         elseif style == 'None' then
           if (levelReqs['Defence'] ~= nil or levelReqs['Ranged'] ~= nil or levelReqs['Magic'] ~= nil or
           if (Items._getItemStat(item, 'defenceLevelRequired') ~= nil or Items._getItemStat(item, 'rangedLevelRequired') ~= nil or Items._getItemStat(item, 'magicLevelRequired') ~= nil or
             Shared.contains(styleOverrides.Melee, item.name) or Shared.contains(styleOverrides.Ranged, item.name) or Shared.contains(styleOverrides.Magic, item.name)) and
             Shared.contains(styleOverrides.Melee, item.name) or Shared.contains(styleOverrides.Ranged, item.name) or Shared.contains(styleOverrides.Magic, item.name)) and
             not Shared.contains(styleOverrides.None, item.name) then
             not Shared.contains(styleOverrides.None, item.name) then
Line 477: Line 475:


   --Unfortunately just gonna have to manually check all the changes I think...
   --Unfortunately just gonna have to manually check all the changes I think...
   local itemStats = {
   getSpecificStatString(Items._getItemStat(item1, 'stabAttackBonus'), Items._getItemStat(item2, 'stabAttackBonus'), '{V} '..Icons.Icon({'Melee', notext=true})..' Stab Bonus')
    { Stat = {['stabAttackBonus'] = 10, ['slashAttackBonus'] = 15}, Level = {['Defence'] = 10}, SlayBon = Items._getItemModifier(item1, 'increasedSkillXP', 'Slayer') },
   getSpecificStatString(Items._getItemStat(item1, 'slashAttackBonus'), Items._getItemStat(item2, 'slashAttackBonus'), '{V} '..Icons.Icon({'Melee', notext=true})..' Slash Bonus')
    { Stat = {['stabAttackBonus'] = 20, ['slashAttackBonus'] = 25}, Level = {['Defence'] = 20}, SlayBon = Items._getItemModifier(item2, 'increasedSkillXP', 'Slayer') },
   getSpecificStatString(Items._getItemStat(item1, 'blockAttackBonus'), Items._getItemStat(item2, 'blockAttackBonus'), '{V} '..Icons.Icon({'Melee', notext=true})..' Block Bonus')
    --{ Stat = Items._processEquipmentStats(item1.equipmentStats), Level = Items._processEquipmentLevelReqs(item1.equipRequirements), SlayBon = Items._getItemModifier(item1, 'increasedSkillXP', 'Slayer') },
    --{ Stat = Items._processEquipmentStats(item2.equipmentStats), Level = Items._processEquipmentLevelReqs(item2.equipRequirements), SlayBon = Items._getItemModifier(item2, 'increasedSkillXP', 'Slayer') },
  }
  local attBon1 = item1.attackBonus ~= nil and item1.attackBonus or {0, 0, 0}
  local attBon2 = item2.attackBonus ~= nil and item2.attackBonus or {0, 0, 0}
  getSpecificStatString(itemStats[1]['Stat']['stabAttackBonus'], itemStats[2]['Stat']['stabAttackBonus'], '{V} '..Icons.Icon({'Melee', notext=true})..' Stab Bonus')
   getSpecificStatString(itemStats[1]['Stat']['slashAttackBonus'], itemStats[2]['Stat']['slashAttackBonus'], '{V} '..Icons.Icon({'Melee', notext=true})..' Slash Bonus')
   getSpecificStatString(itemStats[1]['Stat']['blockAttackBonus'], itemStats[2]['Stat']['blockAttackBonus'], '{V} '..Icons.Icon({'Melee', notext=true})..' Block Bonus')


   getSpecificStatString(itemStats[1]['Stat']['meleeStrengthBonus'], itemStats[2]['Stat']['meleeStrengthBonus'], '{V} '..Icons.Icon({'Strength', type='skill', notext=true})..' Strength Bonus')
   getSpecificStatString(Items._getItemStat(item1, 'meleeStrengthBonus'), Items._getItemStat(item2, 'meleeStrengthBonus'), '{V} '..Icons.Icon({'Strength', type='skill', notext=true})..' Strength Bonus')
   getSpecificStatString(itemStats[1]['Stat']['rangedStrengthBonus'], itemStats[2]['Stat']['rangedStrengthBonus'], '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Strength Bonus')
   getSpecificStatString(Items._getItemStat(item1, 'rangedStrengthBonus'), Items._getItemStat(item2, 'rangedStrengthBonus'), '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Strength Bonus')
   getSpecificStatString(itemStats[1]['Stat']['magicStrengthBonus'], itemStats[2]['Stat']['magicStrengthBonus'], '{V}% '..Icons.Icon({'Magic', type='skill', notext=true})..' Damage Bonus')
   getSpecificStatString(Items._getItemStat(item1, 'magicStrengthBonus'), Items._getItemStat(item2, 'magicStrengthBonus'), '{V}% '..Icons.Icon({'Magic', type='skill', notext=true})..' Damage Bonus')


   getSpecificStatString(itemStats[1]['Stat']['meleeDefenceBonus'], itemStats[2]['Stat']['meleeDefenceBonus'], '{V} '..Icons.Icon({'Defence', type='skill', notext=true})..' Defence Bonus')
   getSpecificStatString(Items._getItemStat(item1, 'meleeDefenceBonus'), Items._getItemStat(item2, 'meleeDefenceBonus'), '{V} '..Icons.Icon({'Defence', type='skill', notext=true})..' Defence Bonus')
   getSpecificStatString(itemStats[1]['Stat']['rangedDefenceBonus'], itemStats[2]['Stat']['rangeDefenceBonus'], '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Defence Bonus')
   getSpecificStatString(Items._getItemStat(item1, 'rangedDefenceBonus'), Items._getItemStat(item2, 'rangedDefenceBonus'), '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Defence Bonus')
   getSpecificStatString(itemStats[1]['Stat']['magicDefenceBonus'], itemStats[2]['Stat']['magicDefenceBonus'], '{V} '..Icons.Icon({'Magic', type='skill', notext=true})..' Defence Bonus')
   getSpecificStatString(Items._getItemStat(item1, 'magicDefenceBonus'), Items._getItemStat(item2, 'magicDefenceBonus'), '{V} '..Icons.Icon({'Magic', type='skill', notext=true})..' Defence Bonus')
   getSpecificStatString(itemStats[1]['Stat']['damageReduction'], itemStats[2]['Stat']['damageReduction'], '{V}% Damage Reduction')
   getSpecificStatString(Items._getItemStat(item1, 'damageReduction'), Items._getItemStat(item2, 'damageReduction'), '{V}% Damage Reduction')


   getSpecificStatString(itemStats[1]['SlayBon'], itemStats[2]['SlayBon'], '{V}% '..Icons.Icon({'Slayer', type='skill', notext=true})..' Bonus XP')
   getSpecificStatString(Items._getItemModifier(item1, 'increasedSkillXP', 'Slayer'), Items._getItemModifier(item2, 'increasedSkillXP', 'Slayer'), '{V}% '..Icons.Icon({'Slayer', type='skill', notext=true})..' Bonus XP')


   getSpecificStatString(itemStats[1]['Level']['Attack'], itemStats[2]['Level']['Attack'], '{V} '..Icons.Icon({'Attack', type='skill', notext=true})..' Level Required')
   getSpecificStatString(Items._getItemStat(item1, 'attackLevelRequired'), Items._getItemStat(item2, 'attackLevelRequired'), '{V} '..Icons.Icon({'Attack', type='skill', notext=true})..' Level Required')
   getSpecificStatString(itemStats[1]['Level']['Defence'], itemStats[2]['Level']['Defence'], '{V} '..Icons.Icon({'Defence', type='skill', notext=true})..' Level Required')
   getSpecificStatString(Items._getItemStat(item1, 'defenceLevelRequired'), Items._getItemStat(item2, 'defenceLevelRequired'), '{V} '..Icons.Icon({'Defence', type='skill', notext=true})..' Level Required')
   getSpecificStatString(itemStats[1]['Level']['Ranged'], itemStats[2]['Level']['Ranged'], '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Level Required')
   getSpecificStatString(Items._getItemStat(item1, 'rangedLevelRequired'), Items._getItemStat(item2, 'rangedLevelRequired'), '{V} '..Icons.Icon({'Ranged', type='skill', notext=true})..' Level Required')
   getSpecificStatString(itemStats[1]['Level']['Magic'], itemStats[2]['Level']['Magic'], '{V} '..Icons.Icon({'Magic', type='skill', notext=true})..' Level Required')
   getSpecificStatString(Items._getItemStat(item1, 'magicLevelRequired'), Items._getItemStat(item2, 'magicLevelRequired'), '{V} '..Icons.Icon({'Magic', type='skill', notext=true})..' Level Required')


   return table.concat(changeArray, '<br/>')
   return table.concat(changeArray, '<br/>')