Module:Items: Difference between revisions

Added p.hasCombatStats
(Fixed string.upper call)
(Added p.hasCombatStats)
Line 194: Line 194:
     return result
     return result
   end
   end
end
function p.hasCombatStats(item)
  if item.equipmentSlot == nil then
    return false
  elseif item.equipmentSlot == Constants.getEquipmentSlotID('Weapon') then
    return true
  end
  local combatStatList = {'strengthBonus', 'defenceBonus', 'stabAttackBonus', 'slashAttackBonus', 'blockAttackBonus', 'damageReduction',
                          'rangedDefenceBonus', 'magicDefenceBonus', 'rangedAttackBonus', 'rangedStrengthBonus', 'magicAttackBonus', 'magicDamageBonus'}
 
  for i, stat in Shared.skpairs(combatStatList) do
    if p._getItemStat(item, stat, true) > 0 then
      return true
    end
  end
  return false
end
end