Module:Icon: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Add placeholder image support for unreleased heroes (Boho, Druid, Fortuna, etc.) to prevent red links in navboxes |
Fix ability link priority: prefer abilities linked to heroes over duplicate/orphan entries with same name |
||
| Line 69: | Line 69: | ||
end | end | ||
-- Process Abilities | |||
for abilityKey, ability in pairs(abilityData) do | for abilityKey, ability in pairs(abilityData) do | ||
if type(ability) == "table" and ability.Name then | if type(ability) == "table" and ability.Name then | ||
| Line 76: | Line 76: | ||
local parentInfo = abilityToHero[abilityKey] | local parentInfo = abilityToHero[abilityKey] | ||
-- | -- If we already have this ability name, prefer the one linked to a hero | ||
if lookup[lowerName] and lookup[lowerName].type == "ability" then | |||
local existingHasParent = lookup[lowerName].link ~= lookup[lowerName].name | |||
local newHasParent = parentInfo ~= nil | |||
-- Skip if existing is linked to hero but this one isn't (prevents orphans from overwriting real ones) | |||
if existingHasParent and not newHasParent then | |||
-- Skip this orphan ability | |||
else | |||
-- Overwrite: new has parent and existing doesn't, or both/neither have parents | |||
local link = parentInfo and parentInfo.heroName or name | |||
lookup[lowerName] = { | |||
name = name, | |||
key = abilityKey, | |||
link = link, | |||
image = name .. ".png", | |||
type = "ability", | |||
class = "theme" | |||
} | |||
end | |||
else | |||
-- No existing entry, add normally | |||
local link = parentInfo and parentInfo.heroName or name | |||
lookup[lowerName] = { | |||
name = name, | |||
key = abilityKey, | |||
link = link, | |||
image = name .. ".png", | |||
type = "ability", | |||
class = "theme" | |||
} | |||
end | |||
end | end | ||
end | end | ||