Module:Constants: Difference between revisions

Added getSlayerTierNameByLevel for use in MonsterBox along with a couple other functions for getting slayer tier
(Added difficulties for Combat Area porpoises)
(Added getSlayerTierNameByLevel for use in MonsterBox along with a couple other functions for getting slayer tier)
Line 219: Line 219:
function p.getEquipmentSlotID(name)
function p.getEquipmentSlotID(name)
   return ConstantData.equipmentSlot[name]
   return ConstantData.equipmentSlot[name]
end
function p.getCombatStyleName(styleNum)
  for name, num in Shared.skpairs(ConstantData.attackType) do
    if num == styleNum then
      return name
    end
  end
  return "ERROR: Invalid Slayer tier[[Category:Pages with script errors]]"
end
end


Line 228: Line 237:
   end
   end
   return "ERROR: Invalid Slayer tier[[Category:Pages with script errors]]"
   return "ERROR: Invalid Slayer tier[[Category:Pages with script errors]]"
end
function p.getSlayerTierNameByLevel(lvl)
  for i, tier in Shared.skpairs(ConstantData.Slayer.Tiers) do
    if tier.minLevel <= lvl and (tier.maxLevel >= lvl or tier.maxLevel == -1) then
      return tier.display
    end
  end
  return 'N/A'
end
function p.getSlayerTier(name)
  for i, tier in Shared.skpairs(ConstantData.Slayer.Tiers) do
    if tier.display == name then
      local result = Shared.clone(tier)
      result.id = i - 1
      return result
    end
  end
end
function p.getSlayerTierByID(tierID)
  if ConstantData.Slayer.Tiers[tierID + 1] == nil then
    return nil
  end
  local result = Shared.clone(ConstantData.Slayer.Tiers[tierID + 1])
  result.id = tierID
  return result
end
end