Editing Module:Abilities/icon

Jump to navigation Jump to search
Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 41: Line 41:
end
end


return string.format('[[File:%s|%s|link=%s]]', icon.img or '', icon.size or '18px', icon.link or '')
return string.format('[[File:%s|%s|18px|link=%s]]', icon.img or '', icon.size or '', icon.link or '')
end
end


-- List of scaling type attributes
-- List of scaling type attributes
local SCALING_ICON_MAP = {
local SCALING_ICON_MAP = {
     ["spirit"] = { class = "spirit", icon = "File:Spirit scaling.png", link = "Spirit Power#Spirit Power Scaling", size = "28px" },
     ["spirit"] = { class = "spirit", icon = "File:Spirit scaling.png", link = "Spirit Power#Spirit Power Scaling", size = "40px" },
     ["stats_count"] = { class = "spirit", icon = "File:Spirit scaling.png", link = "Spirit Power#Spirit Power Scaling", size = "28px" }, -- Mina Rake
     ["stats_count"] = { class = "spirit", icon = "File:Spirit scaling.png", link = "Spirit Power#Spirit Power Scaling", size = "40px" },
     ["weapon_power"] = { class = "weapon", icon = "File:Weapon scaling.png", link = "Weapon Damage#Weapon Damage Scaling", size = "28px" }, -- Paradox Carbine
     ["weapon_power"] = { class = "weapon", icon = "File:Weapon scaling.png", link = "Weapon Damage#Weapon Damage Scaling", size = "40px" },
     ["weapon_damage_increase"] = { class = "weapon", icon = "File:Weapon scaling.png", link = "Weapon Damage#Weapon Damage Scaling", size = "28px" },
     ["weapon_damage_increase"] = { class = "weapon", icon = "File:Weapon scaling.png", link = "Weapon Damage#Weapon Damage Scaling", size = "40px" },
     ["melee"] = { class = "melee", icon = "File:Melee scaling.png", link = "Melee Damage#Abilities", size = "28px" },
     ["melee"] = { class = "weapon", icon = "File:Melee scaling.png", link = "Melee Damage#Abilities", size = "40px" },
     ["heavy_melee"] = { class = "melee", icon = "File:Melee scaling.png", link = "Melee Damage#Abilities", size = "28px" },
     ["heavy_melee"] = { class = "weapon", icon = "File:Melee scaling.png", link = "Melee Damage#Abilities", size = "40px" },
     ["power_increase"] = { class = "boon", icon = "File:Boon scaling.png", link = "Boon", size = "16px" }, -- Boon icon has to be smaller than others
     ["power_increase"] = { class = "boon", icon = "File:Boon scaling.png", link="Boon", size = "25px" }, -- Boon icon has to be smaller than others
    -- Use "default" if the scaling is unused.
     ["duration"] = { class = "default" }, -- Use "default" if the scaling is unused
    -- The types below are stat-category markers rather than coefficients: they
    -- always carry a value of 1 and only flag which ability stats are affected
    -- by Ability Duration, Ability Cooldown, Ability Range, Healing and charge
    -- bonuses. There is no meaningful number to show, so they stay hidden.
     ["duration"] = { class = "default" },
    ["range"] = { class = "default" },
    ["radius"] = { class = "default" },
    ["cooldown"] = { class = "default" },
    ["charge_cooldown"] = { class = "default" },
    ["max_charges"] = { class = "default" },
    ["healing"] = { class = "default" },
}
}


function getScalarIcon(scaleType)
-- get scaling icon attributes associated with a specified scale type
return SCALING_ICON_MAP[scaleType]
function getScalarIcon(scaleType, attribute)
local scalingIcon = SCALING_ICON_MAP[scaleType]
 
    if scalingIcon then
        return scalingIcon[attribute] or "Missing scaling type in Module:Abilities/icon"
    end
 
    return ""
end
end


-- Whether a scale type produces a visible badge.
function p._getScalarIcon(scaleType, attribute)
-- False only for types explicitly mapped as "default". Unknown types count as
return getScalarIcon(scaleType, attribute)
-- displayed, so they still surface through the missing-icon warning below
-- instead of being silently dropped.
function p.isDisplayedScale(scaleType)
local icon = getScalarIcon(scaleType)
return icon == nil or icon.class ~= "default"
end
end


 
function p.getScalarIcon(frame)
-- get scaling icon attribute associated with a specified scale type
function p.getScalarIconAttr(frame)
     local args = frame.args
     local args = frame.args


Line 88: Line 77:
     local attribute = args[2]
     local attribute = args[2]
local icon = getScalarIcon(scaleType, attribute)
return getScalarIcon(scaleType, attribute)
if icon == nil then return '' end
return icon[attribute] or ''
end
end


-- get scaling icon wikitext file associated with a specified scale type
function p.getScalarIconFile(frame)
function p.getScalarIconFile(frame)
     local args = frame.args
     local args = frame.args
     local scaleType = args[1]  
     local scaleType = args[1]  
    local size = args[2]


local icon = getScalarIcon(scaleType)
local icon = getScalarIcon(scaleType, attribute)
     if not icon then
         return frame:preprocess(string.format('{{Tooltip|?|Missing scaling type icon "%s" in Module:Abilities/icon}}', scaleType))
     if not icon or icon.class == "default" then
         return string.format('[[Tooltip|?|Missing scaling type "%s" in Module:Abilities/card]]', scaleType)
     end
     end


if icon.class == "default" then
return ''
end
if not size or size == '' then
size = icon.size
end
     return string.format(
     return string.format(
         '[[%s|link=%s|%s]]',
         '<span class="ac-scaling--%s">[[%s|link=%s|%s]]</span>',
        icon.class,
         icon.icon,
         icon.icon,
         icon.link,
         icon.link,
         size
         icon.size
     )
     )
end
end


return p
return p
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template