Anonymous

Module:Pets: Difference between revisions

From Melvor Idle
_getPetSourceText: Further amends to icon types
(_getPetSourceText: Fix combat area icon types)
(_getPetSourceText: Further amends to icon types)
Line 9: Line 9:
local Icons = require('Module:Icons')
local Icons = require('Module:Icons')


local areaDataKeys = { 'combatAreas', 'slayerAreas', 'dungeons', 'strongholds', 'abyssDepths' }
local areaDataKeys = { 'combatAreas', 'slayerAreas', 'dungeons', 'strongholds', 'abyssDepths' }
-- Compute combat pet sources once for use later
-- Compute combat pet sources once for use later
local function getCombatPetSources()
local function getCombatPetSources()
Line 29: Line 29:
name = area.name,
name = area.name,
type = area.type,
type = area.type,
isCombat = true,
weight = area.pet.weight,
weight = area.pet.weight,
fixedChance = (area.fixedPetClears ~= nil and area.fixedPetClears) or area.pet.weight == 1
fixedChance = (area.fixedPetClears ~= nil and area.fixedPetClears) or area.pet.weight == 1
Line 68: Line 69:
if skillID ~= nil then
if skillID ~= nil then
local skillName = Constants.getSkillName(skillID)
local skillName = Constants.getSkillName(skillID)
return { id = skillID, name = skillName, type = 'skill' }
return { id = skillID, name = skillName, type = 'skill', isCombat = false }
end
end
end
end
Line 99: Line 100:
local petSource = p._getPetSource(pet)
local petSource = p._getPetSource(pet)
if petSource ~= nil then
if petSource ~= nil then
iconType = (petSource.type == 'dungeon' and 'dungeon') or 'combatArea'
if petSource.isCombat then
iconType = (petSource.type == 'dungeon' and 'dungeon') or 'combatArea'
else
iconType = petSource.type
end
petSourceText = petSource.name
petSourceText = petSource.name
else
else