WARFRAME Wiki
Advertisement
WARFRAME Wiki


Icon returns the in-game icon of a particular item.

On this Wiki, Icon is used in:

Usage

Template

In template: {{#invoke:Icon|function|input1|input2|...}}
In articles: {{Icon|Type|input1|input2|...}}

Module

local p = {}
local Icon = require('Module:Icon')

local function func(iconname, textexist, imagesize)
    return Icon._Item(iconname, textexist, imagesize)
end

Documentation

Package items

Other items

Item(iconname, textexist, imagesize) (function)
Returns the icon for an item.
Parameters:
  • iconname Item name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x26' (string; optional)
Returns: The icon's image in wikitext (string)
_Item(iconname, textexist, imagesize) (function)
Returns the icon for an item.
Parameters:
  • iconname Item name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x26' (string; optional)
Returns: The icon's image in wikitext (string)
Dis(name, color, size) (function)
Returns the icon for a weapon's disposition value.
Parameters:
  • name Disposition value ranging from 0.5 to 1.55 (string)
  • color Icon color, can be 'White' or 'Black'; defaults to 'Black' (string; optional)
  • size Image size, defaults to '27' (string; optional)
Returns: The icon's image in wikitext (string)
_Dis(name, color, size) (function)
Returns the icon for a weapon's disposition value.
Parameters:
  • name Disposition value ranging from 0.5 to 1.55 (string)
  • color Icon color, can be 'White' or 'Black'; defaults to 'Black' (string; optional)
  • size Image size, defaults to '27' (string; optional)
Returns: The icon's image in wikitext (string)
Affinity(iconname, textexist, imagesize) (function)
Returns the icon for an affinity type.
Parameters:
  • iconname Affinity type (e.g. 'Mastery' or 'Clan') (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x26' (string; optional)
Returns: The icon's image in wikitext (string)
_Affinity(iconname, textexist, imagesize) (function)
Returns the icon for an affinity type.
Parameters:
  • iconname Affinity type (e.g. 'Mastery' or 'Clan') (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x26' (string; optional)
Returns: The icon's image in wikitext (string)
Faction(iconname, textexist, color, imagesize) (function)
Returns the icon for a faction type.
Parameters:
  • iconname Faction type (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • color Icon color, can be 'White' or 'Black'; defaults to 'Black' (string; optional)
  • imagesize Image size, defaults to 'x20' (string; optional)
Returns: The icon's image in wikitext (string)
Syndicate(iconname, textexist, color, imagesize) (function)
Returns the icon for a syndicate.
Parameters:
  • iconname Syndicate name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • color Icon color, can be 'White' or 'Black'; defaults to 'Black' (string; optional)
  • imagesize Image size, defaults to 'x32' (string; optional)
Returns: The icon's image in wikitext (string)
Prime(primename, partname, imagesize) (function)
Returns the icon for a primed part.
Parameters:
  • primename Primed item name (string)
  • partname Primed part name (string)
  • imagesize Image size, defaults to '32' (string; optional)
Returns: The icon's image in wikitext (string)
_Prime(primename, partname, imagesize) (function)
Returns the icon for a primed part.
Parameters:
  • primename Primed item name (string)
  • partname Primed part name (string)
  • imagesize Image size, defaults to '32' (string; optional)
Returns: The icon's image in wikitext (string)
Resource(iconname, textexist, imagesize) (function)
Returns the icon for a resource.
Parameters:
  • iconname Resource name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x20' (string; optional)
Returns: The icon's image in wikitext (string)
_Resource(iconname, textexist, imagesize) (function)
Returns the icon for a resource.
Parameters:
  • iconname Resource name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x20' (string; optional)
Returns: The icon's image in wikitext (string)
Fish(iconname, textexist, imagesize) (function)
Returns the icon for a fish.
Parameters:
  • iconname Fish name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x32' (string; optional)
Returns: The icon's image in wikitext (string)
_Fish(iconname, textexist, imagesize) (function)
Returns the icon for a fish.
Parameters:
  • iconname Fish name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x32' (string; optional)
Returns: The icon's image in wikitext (string)
Focus(iconname, textexist, color, icontype, imagesize) (function)
Returns the icon for a Focus node.
Parameters:
  • iconname Focus node name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • color Icon color, can be 'White' or 'Black'; defaults to 'Black' (string; optional)
  • icontype If 'seal' adds a seal next to icon (e.g. SealNaramonTree b.png), otherwise does not add it (string; optional)
  • imagesize Image size, defaults to 'x20' (string; optional)
Returns: The icon's image in wikitext (string)
way(iconname, imagesize) (function)
Returns the icon for a Focus way.
Parameters:
  • iconname Focus way name (string)
  • imagesize Image size, defaults to 'x18' (string; optional)
Returns: The icon's image in wikitext (string)
HUD(iconname, textexist, color, imagesize) (function)
Returns the icon for a HUD element.
Parameters:
  • iconname HUD element name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • color Icon color, can be 'White' or 'Black'; defaults to 'Black' (string; optional)
  • imagesize Image size, defaults to 'x20' (string; optional)
Returns: The icon's image in wikitext (string)
Flag(iconname, tooltip, dest, textexist) (function)
Returns the icon for a real-world country flag.
Parameters:
  • iconname HUD element name (string)
  • tooltip If set to 'Text' or 'text', text is added after icon (string)
  • dest Name of a destination article for linking purposes (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
Returns: The icon's image in wikitext (string)
Melee(AttackType, ProcType, imagesize) (function)
Returns the icon for melee attack.
Parameters:
  • AttackType Melee attack name (e.g. 'Default' or 'Block') (string)
  • ProcType Attack modifier name (e.g. 'Default' or 'Slam') (string)
  • imagesize Image size, defaults to 'x22' (string; optional)
Returns: The icon's image in wikitext (string)
_Melee(AttackType, ProcType, imagesize) (function)
Returns the icon for melee attack.
Parameters:
  • AttackType Melee attack name (e.g. 'Default' or 'Block') (string)
  • ProcType Attack modifier name (e.g. 'Default' or 'Slam') (string)
  • imagesize Image size, defaults to 'x22' (string; optional)
Returns: The icon's image in wikitext (string)
Zaw(zawname, textexist, imagesize) (function)
Returns the icon for a Zaw part.
Parameters:
  • zawname Zaw part name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x26' (string; optional)
Returns: The icon's image in wikitext (string)
_Zaw(zawname, textexist, imagesize) (function)
Returns the icon for a Zaw part.
Parameters:
  • zawname Zaw part name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • imagesize Image size, defaults to 'x26' (string; optional)
Returns: The icon's image in wikitext (string)
Buff(iconname, textexist, color, imagesize) (function)
Returns the icon for a HUD buff or debuff.
Parameters:
  • iconname Buff name (string)
  • textexist If set to 'Text' or 'text', text is added after icon (string; optional)
  • color Icon color, can be 'White' or 'Black'; defaults to 'Black' (string; optional)
  • imagesize Image size, defaults to 'x40' (string; optional)
Returns: The icon's image in wikitext (string)
Clan(iconname, imagesize) (function)
Returns the icon for a Clan tier.
Parameters:
  • iconname Clan tier name (string)
  • imagesize Image size, defaults to 'x26' (string; optional)
Returns: The icon's image in wikitext (string)
_Clan(iconname, imagesize) (function)
Returns the icon for a Clan tier.
Parameters:
  • iconname Clan tier name (string)
  • imagesize Image size, defaults to 'x26' (string; optional)
Returns: The icon's image in wikitext (string)

Created with Docbuntu

See Also

Code


--- '''Icon''' returns the in-game icon of a particular item.<br/>
--  
--  On this Wiki, Icon is used in:
--  * [[Module:DropTables]]
--  * [[Module:Warframes]]
--  * [[Module:Weapons]]
--  * [[Template:Icon]]
--  
--  @module     icon
--  @alias      p
--  @author     [[User:ChickenBar|ChickenBar]]
--  @attribution    [[User:94Connor949|94Connor949]]
--  @attribution    [[User:Hayframe|Hayframe]]
--  @attribution    [[User:FINNER|FINNER]]
--  @attribution    [[User:Falterfire|Falterfire]]
--  @attribution    [[User:Flaicher|Flaicher]]
--  @attribution    [[User:Cephalon Scientia|Cephalon Scientia]]
--  @attribution    [[User:Rngd444|Rngd444]]
--  @attribution    [[User:Gigamicro|Gigamicro]]
--  @image      
--  @require    [[Module:Icon/data]]
--  @release    stable
--  <nowiki>

local p = {}

local IconData = mw.loadData [[Module:Icon/data]]

-- TODO: Lots of the functions share similar code when grabbing arguments from the frame and building the icon's wikitext.
-- Refactor this functionality into a single function.

--- Returns the icon for an item.
--  @function       Item
--  @param          {string} iconname Item name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x26'
--  @return         {string} The icon's image in wikitext
function p.Item(frame)
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local imagesize = frame.args.imgsize

    return p._Item(iconname, textexist, imagesize)
end

--- Returns the icon for an item.
--  @function       _Item
--  @param          {string} iconname Item name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x26'
--  @return         {string} The icon's image in wikitext
function p._Item(iconname, textexist, imagesize)
    iconname = string.gsub(" "..string.lower( iconname ), "%W%l", string.upper):sub(2)
    local link = ''
    local title = ''
    assert(IconData["Items"][iconname] ~= nil, 
        'p._Item(iconname, textexist, imagesize): Invalid icon name "'..(iconname or '')..'" (do you need to update [[Module:Icon/data]]?) [[Category:Icon Module error]]')
    
    link = IconData["Items"][iconname]["link"]
    title = IconData["Items"][iconname]["title"]
    iconname = IconData["Items"][iconname]["icon"]
    if (imagesize == nil or imagesize == '') then
        imagesize = 'x26'
    end

    local imgText = '[[File:'..iconname..'|'..imagesize..'px'
    if(link ~= nil) then
        imgText = imgText..'|link='..link
    end
    if(title ~= nil) then
        imgText = imgText..'|'..title
    end
    imgText = imgText..']]'

    if (textexist == 'text' or textexist == 'Text') then
        if (link ~= nil) then
            if (title ~= nil) then
                return imgText..'&nbsp;[['..link..'|'..title..']]'
            else
                return imgText..'&nbsp;[['..link..']]'
            end
        elseif (title ~= nil) then
            return imgText..'&nbsp;'..title
        else
            return imgText
        end
    end
    return imgText
end

--- Returns the icon for a weapon's disposition value.
--  @function       Dis
--  @param          {string} name Disposition value ranging from 0.5 to 1.55
--  @param[opt]     {string} color Icon color, can be 'White' or 'Black'; defaults to 'Black'
--  @param[opt]     {string} size Image size, defaults to '27'
--  @return         {string} The icon's image in wikitext
function p.Dis(frame)
    local name = frame.args[1]
    local color = frame.args[2]
    local size = frame.args.imgsize
    return p._Dis(name, color, size)
end

--- Returns the icon for a weapon's disposition value.
--  @function       _Dis
--  @param          {string} name Disposition value ranging from 0.5 to 1.55
--  @param[opt]     {string} color Icon color, can be 'White' or 'Black'; defaults to 'Black'
--  @param[opt]     {string} size Image size, defaults to '27'
--  @return         {string} The icon's image in wikitext
function p._Dis(name, color, size)
    local link = 'Riven_Mods#Disposition'
    if(color == nil or color == '') then color = 'black' end
    if(size  == nil or size  == '') then size  = 27      end
    assert(name ~= nil, 
        'p._Dis(name, color, size): Invalid icon name "'..(name or '')..'" [[Category:Icon Module error]]')
    
    local dots = ''
    name = tonumber(name)
    if    (name < 0.7) then   dots = '●○○○○'
    elseif(name < 0.9) then   dots = '●●○○○'
    elseif(name < 1.109) then dots = '●●●○○'
    elseif(name < 1.309) then dots = '●●●●○'
    else                      dots = '●●●●●' end
    return '[['..link..'|<span style="font-size:'..size..'px; display:inline; position:relative; top:2px">'..dots..'</span>]]'
end

--- Returns the icon for an affinity type.
--  @function       Affinity
--  @param          {string} iconname Affinity type (e.g. 'Mastery' or 'Clan')
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x26'
--  @return         {string} The icon's image in wikitext
function p.Affinity(frame)
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local imagesize = frame.args.imgsize
    return p._Affinity(iconname, textexist, imagesize)
end

--- Returns the icon for an affinity type.
--  @function       _Affinity
--  @param          {string} iconname Affinity type (e.g. 'Mastery' or 'Clan')
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x26'
--  @return         {string} The icon's image in wikitext
function p._Affinity(iconname, textexist, imagesize)
    local link = ''
    assert(IconData["Affinity"][iconname] ~= nil, 
        'p._Affinity(iconname, textexist, imagesize): Invalid icon name "'..(iconname or '')..'" [[Category:Icon Module error]]')
    
    link = IconData["Affinity"][iconname]["link"]
    local imgname = IconData["Affinity"][iconname]["icon"]
    if (imagesize == nil or imagesize == '') then
        imagesize = 'x26'
    end
    if (textexist == 'text' or textexist == 'Text') then
        return '[[File:'..imgname..'|'..imagesize..'px|link='..link..']]&nbsp;[['..link..'|'..iconname..']]'
    end
    return '[[File:'..imgname..'|'..imagesize..'px|link='..link..'|class=icon]]'
end

--- Returns the icon for a faction type.
--  @function       Faction
--  @param          {string} iconname Faction type
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} color Icon color, can be 'White' or 'Black'; defaults to 'Black'
--  @param[opt]     {string} imagesize Image size, defaults to 'x20'
--  @return         {string} The icon's image in wikitext
function p.Faction(frame)
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local color = frame.args[3]
    local imagesize = frame.args.imgsize
    local link = ''
    if IconData["Factions"][iconname] == nil then
        return '[['..iconname..']]'
    end
    link = IconData["Factions"][iconname]["link"]
    if (color == 'white' or color == 'White') then
        iconname = IconData["Factions"][iconname]["icon"][2]   --white icon
    else
        iconname = IconData["Factions"][iconname]["icon"][1]   --black icon
    end
    if (imagesize == nil or imagesize == '') then
        imagesize = 'x20'
    end
    if (textexist == 'text' or textexist == 'Text') then
        return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]&nbsp;[['..link..']]'
    end
    return '[[File:'..iconname..'|'..imagesize..'px|link='..link..'|class=icon]]'
end

--- Returns the icon for a syndicate.
--  @function       Syndicate
--  @param          {string} iconname Syndicate name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} color Icon color, can be 'White' or 'Black'; defaults to 'Black'
--  @param[opt]     {string} imagesize Image size, defaults to 'x32'
--  @return         {string} The icon's image in wikitext
function p.Syndicate(frame)
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local color = frame.args[3]
    local imagesize = frame.args.imgsize

    local link = ''

    if IconData["Syndicates"][iconname] == nil then
        return ""
    end

    link = IconData["Syndicates"][iconname]["link"]
    if (color == 'white' or color == 'White') then
        iconname = IconData["Syndicates"][iconname]["icon"][2]   --white icon
    else
        iconname = IconData["Syndicates"][iconname]["icon"][1]   --black icon
    end

    if (imagesize == nil or imagesize == '') then
        imagesize = 'x32'
    end

    if (textexist == 'text' or textexist == 'Text') then
        return '[[File:'..iconname..'|'..imagesize..'px|link='..link..'|class=icon]]&nbsp;[['..link..']]'
    else
        return '[[File:'..iconname..'|'..imagesize..'px|link='..link..'|class=icon]]'
    end
end

--- Returns the icon for a primed part.
--  @function       Prime
--  @param          {string} primename Primed item name
--  @param          {string} partname Primed part name
--  @param[opt]     {string} imagesize Image size, defaults to '32'
--  @return         {string} The icon's image in wikitext
function p.Prime(frame)
    local primename = frame.args[1]
    local partname = frame.args[2]
    local imagesize = frame.args.imgsize
    return p._Prime(primename, partname, imagesize)
end

--- Returns the icon for a primed part.
--  @function       _Prime
--  @param          {string} primename Primed item name
--  @param          {string} partname Primed part name
--  @param[opt]     {string} imagesize Image size, defaults to '32'
--  @return         {string} The icon's image in wikitext
function p._Prime(primename, partname, imagesize)
    local primename = string.gsub(" "..string.lower( primename ), "%W%l", string.upper):sub(2)

    local link = ''
    local iconname = ''
    assert(IconData["Primes"][primename] ~= nil, 
        'p._Prime(primename, partname, imagesize): Invalid icon name "'..(primename or '')..'" [[Category:Icon Module error]]')

    link = IconData["Primes"][primename]["link"]
    iconname = IconData["Primes"][primename]["icon"]
    if (imagesize == nil or imagesize == '') then
        imagesize = '32'
    end

    if partname ~= nil then
        partname = string.gsub(" "..string.lower( partname ), "%W%l", string.upper):sub(2)

        local result = ''
        if primename == "Forma" then
            result =  '[[File:'..iconname..'|x'..imagesize..'px|link='..link..']]'
            result = result..'&nbsp;[['..link..'#Acquisition|'..primename.." "..partname..']]'
        else
            result = '[[File:'..iconname..'|x'..imagesize..'px|link='..link..']]'
            result = result..'&nbsp;[['..link..'#Acquisition|'..primename..' Prime '..partname..']]'
        end
        return result
    end

    return '[[File:'..iconname..'|x'..imagesize..'px|link='..link..']]'
end

--- Returns the icon for a resource.
--  @function       Resource
--  @param          {string} iconname Resource name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x20'
--  @return         {string} The icon's image in wikitext
function p.Resource(frame)
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local imagesize = frame.args.imgsize

    return p._Resource(iconname, textexist, imagesize)
end

--- Returns the icon for a resource.
--  @function       _Resource
--  @param          {string} iconname Resource name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x20'
--  @return         {string} The icon's image in wikitext
function p._Resource(iconname, textexist, imagesize)
    local link = ''
    if IconData["Resources"][iconname] == nil then
        if (textexist == 'text' or textexist == 'Text') then
            return '[['.. iconname ..']]'
        end
        -- TODO: A placeholder icon and do this for all the item types
        return ""
    else
        link = IconData["Resources"][iconname]["link"]
        iconname = IconData["Resources"][iconname]["icon"]
        if (imagesize == nil or imagesize == '') then
            imagesize = 'x20'
        end
        if (textexist == 'text' or textexist == 'Text') then
            return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]&nbsp;[['..link..']]'
        end
        return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'
    end
end

--- Returns the icon for a fish.
--  @function       Fish
--  @param          {string} iconname Fish name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x32'
--  @return         {string} The icon's image in wikitext
function p.Fish( frame )
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local imagesize = frame.args.imgsize

    return p._Fish(iconname, textexist, imagesize)
end

--- Returns the icon for a fish.
--  @function       _Fish
--  @param          {string} iconname Fish name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x32'
--  @return         {string} The icon's image in wikitext
function p._Fish(iconname, textexist, imagesize)
    local link = ''
    local title  = ''
    if IconData["Fish"][iconname] == nil then
        return ""
    else
        link = IconData["Fish"][iconname]["link"]
        iconname = IconData["Fish"][iconname]["icon"]
        if (imagesize == nil or imagesize == '') then
            imagesize = 'x32'
        end
        if (textexist == 'text' or textexist == 'Text') then
            return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]&nbsp;[['..link..'|'..title..']]'
        end
        return '[[File:'..iconname..'|'..imagesize..'px|link='..link..']]'
    end
end

function p.Proc( frame )
mw.log 'Remove Icon.Proc call' procd=true
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local color = frame.args[3]
    local imagesize = frame.args.imgsize
    local ignoreColor = frame.args.ignoreColor
    if(ignoreColor ~= nil and string.upper(ignoreColor) ~= "NO" and string.upper(ignoreColor) ~= "FALSE") then
        ignoreColor = true
    else
        ignoreColor = false
    end
    return p._Proc(iconname, textexist, color, imagesize, ignoreColor)
end

function p._Proc(iconname, textexist, color, imagesize, ignoreTextColor,noTooltip)
if not procd then mw.log 'Remove Icon._Proc call' end
    if textexist ~= nil and textexist:lower():find 'text' then
        return require'module:tooltips'.getIcon(iconname,'DamageTypes')
    else
        return require'module:tooltips'.getImage(iconname,'DamageTypes', not noTooltip)
    end

    error'Remove Icon.Proc call [[Category:Remove Icon.Proc function]]'
end

--- Returns the icon for a Focus node.
--  @function       Focus
--  @param          {string} iconname Focus node name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} color Icon color, can be 'White' or 'Black'; defaults to 'Black'
--  @param[opt]     {string} icontype If 'seal' adds a seal next to icon (e.g. [[File:SealNaramonTree_b.png]]), otherwise does not add it
--  @param[opt]     {string} imagesize Image size, defaults to 'x20'
--  @return         {string} The icon's image in wikitext
function p.Focus(frame)
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local color = frame.args[3]
    local icontype = frame.args[4]
    local imagesize = frame.args.imgsize
    
    assert(IconData["Focus"][iconname] ~= nil, 
        'p.Focus(frame): Invalid icon name "'..(iconname or '')..'" [[Category:Icon Module error]]')
    
    if icontype == 'seal' then
        if (color == 'white' or color == 'White') then
            iconname = IconData["Focus"][iconname]["seal"][2]
        else
            iconname = IconData["Focus"][iconname]["seal"][1]
        end
    else
        if (color == 'white' or color == 'White') then
            iconname = IconData["Focus"][iconname]["icon"][2]
        else
            iconname = IconData["Focus"][iconname]["icon"][1]
        end
    end
    
    if (imagesize == nil or imagesize == '') then
      imagesize = 'x20'
    end
    if (textexist == 'text' or textexist == 'Text') then
        return '[[File:'..iconname..'|'..imagesize..'px|sub|link=Focus]]&nbsp;[[Focus|'..frame.args[1]..']]'
    end
    return '[[File:'..iconname..'|'..imagesize..'px|link=Focus|class=icon]]'
end

--- Returns the icon for a Focus way.
--  @function       way
--  @param          {string} iconname Focus way name
--  @param[opt]     {string} imagesize Image size, defaults to 'x18'
--  @return         {string} The icon's image in wikitext
function p.Way(frame)
    local iconname = frame.args[1]
    local imagesize = frame.args.imgsize
    local link = ''
    
    assert(IconData["Ways"][iconname] ~= nil, 
        'p.Way(frame): Invalid icon name "'..(iconname or '')..'" [[Category:Icon Module error]]')
        
    iconname = IconData["Ways"][iconname]

    if (imagesize == nil or imagesize == '') then
        imagesize = 'x18'
    end
    return '[[File:'..iconname..'|'..imagesize..'px|link='..link..'|class=icon]]'
end

--- Returns the icon for a HUD element.
--  @function       HUD
--  @param          {string} iconname HUD element name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} color Icon color, can be 'White' or 'Black'; defaults to 'Black'
--  @param[opt]     {string} imagesize Image size, defaults to 'x20'
--  @return         {string} The icon's image in wikitext
function p.HUD(frame)
    local iconname = frame.args[1]
    local textexist = frame.args[2]
    local color = frame.args[3]
    local imagesize = frame.args.imgsize
    local link = ''
    if IconData["Heads-Up Display"][iconname] == nil then
        return '[['..iconname..']]'
    end
    link = IconData["Heads-Up Display"][iconname]["link"]
    if (color == 'white' or color == 'White') then
        iconname = IconData["Heads-Up Display"][iconname]["icon"][2]   --white icon
    else
        iconname = IconData["Heads-Up Display"][iconname]["icon"][1]   --black icon
    end
    if (imagesize == nil or imagesize == '') then
        imagesize = 'x20'
    end
    if (textexist == 'text' or textexist == 'Text') then
        return '[[File:'..iconname..'|'..imagesize..'px|link=Heads-Up Display|class=icon]]&nbsp;[[Heads-Up Display|'..link..']]'
    end
    return '[[File:'..iconname..'|'..imagesize..'px|link=Heads-Up Display|class=icon]]'
end

--- Returns the icon for a real-world country flag.
--  @function       Flag
--  @param          {string} iconname HUD element name
--  @param          {string} tooltip If set to 'Text' or 'text', text is added after icon
--  @param          {string} dest Name of a destination article for linking purposes
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @return         {string} The icon's image in wikitext
function p.Flag(frame)
    local iconname = frame.args[1]
    local tooltip = frame.args[2]
    local dest = frame.args[3]
    local textexist = frame.args[4]
    assert(IconData["Flags"][iconname] ~= nil, 
        'p.Focus(frame): Invalid icon name "'..(iconname or '')..'" [[Category:Icon Module error]]')
        
    iconname = IconData["Flags"][iconname]
    if tooltip == nil then
        tooltip = ''
    end
    if dest == nil then
        dest = ''
    end
    if (textexist == 'text' or textexist == 'Text') then
        return '[[File:'..iconname..'|'..tooltip..'|16px|link='..dest..']]&nbsp;[['..dest..'|'..tooltip..']]'
    end
    return '[[File:'..iconname..'|'..tooltip..'|16px|link='..dest..']]'
end

--- Returns the icon for melee attack.
--  @function       Melee
--  @param          {string} AttackType Melee attack name (e.g. 'Default' or 'Block')
--  @param          {string} ProcType Attack modifier name (e.g. 'Default' or 'Slam')
--  @param[opt]     {string} imagesize Image size, defaults to 'x22'
--  @return         {string} The icon's image in wikitext
function p.Melee(frame)
    local AttackType = frame.args[1]
    local ProcType = frame.args[2]
    local imagesize = frame.args.imgsize
    return p._Melee(AttackType, ProcType, imagesize)
end

--- Returns the icon for melee attack.
--  @function       _Melee
--  @param          {string} AttackType Melee attack name (e.g. 'Default' or 'Block')
--  @param          {string} ProcType Attack modifier name (e.g. 'Default' or 'Slam')
--  @param[opt]     {string} imagesize Image size, defaults to 'x22'
--  @return         {string} The icon's image in wikitext
function p._Melee(AttackType, ProcType, imagesize)
    if(AttackType == nil or AttackType == '') then
        AttackType = "DEFAULT"
    else
        AttackType = string.upper(AttackType)
    end
    if(ProcType == nil or ProcType == '') then
        ProcType = "DEFAULT"
    else
        ProcType = string.upper(ProcType)
    end
    if (imagesize == nil or imagesize == '') then
        imagesize = 'x22'
    end


    assert(IconData["Melee"][ProcType] ~= nil and IconData["Melee"][ProcType][AttackType] ~= nil, 
        'p._Melee(AttackType, ProcType, imagesize): Invalid proc type "'..ProcType..'" or attack type "'..AttackType..'" [[Category:Icon Module error]]')

    local icon = IconData["Melee"][ProcType][AttackType].icon
    local link = IconData["Melee"][ProcType][AttackType].link
    local title = IconData["Melee"][ProcType][AttackType].title
    local tooltip = IconData["Melee"][ProcType][AttackType].tooltip
    assert(icon ~= nil and icon ~= '', 
        'p._Melee(AttackType, ProcType, imagesize): Invalid proc type "'..ProcType..'" or attack type "'..AttackType..'" [[Category:Icon Module error]]')

    local result = '[[File:'..icon
    if(tooltip ~= nil and tooltip ~= '') then result = result..'|'..tooltip end
    result = result..'|'..imagesize..'px'
    if link ~= nil then result = result..'|link='..link end
    if title ~= nil then result = result..'|'..title end
    result = result..'|class=icon]]'
    return result
end

--- Returns the icon for a Zaw part.
--  @function       Zaw
--  @param          {string} zawname Zaw part name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x26'
--  @return         {string} The icon's image in wikitext
function p.Zaw(frame)
    local zawname = frame.args[1]
    local textexist = frame.args[2]
    local imagesize = frame.args.imgsize
    return p._Zaw(zawname, textexist, imagesize)
end

--- Returns the icon for a Zaw part.
--  @function       _Zaw
--  @param          {string} zawname Zaw part name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} imagesize Image size, defaults to 'x26'
--  @return         {string} The icon's image in wikitext
function p._Zaw(zawname, textexist, imagesize)
    zawname = string.gsub(" "..string.lower( zawname ), "%W%l", string.upper):sub(2)
    local link = ''
    
    assert(IconData["Zaws"][zawname] ~= nil,
        'p._Zaw(zawname, textexist, imagesize): Invalid icon name "'..zawname..'" [[Category:Icon Module error]]')
        
    link = IconData["Zaws"][zawname]["link"]
    local title = IconData["Zaws"][zawname]["title"]
    zawname = IconData["Zaws"][zawname]["icon"]
    if (imagesize == nil or imagesize == '') then
        imagesize = 'x26'
    end

    local imgText = '[[File:'..zawname..'|'..imagesize..'px'
    if(link ~= nil) then
        imgText = imgText..'|link='..link
    elseif(title ~= nil) then
        imgText = imgText..'|'..title
    end
    imgText = imgText..']]'

    if (textexist == 'text' or textexist == 'Text') then
        if (link ~= nil) then
            if(title ~= nil) then
                return imgText..'&nbsp;[['..link..'|'..title..']]'
            else
                return imgText..'&nbsp;[['..link..']]'
            end
        elseif(title ~= nil) then
            return imgText..'&nbsp;'..title
        else
            return imgText
        end
    end
    return imgText
end

--- Returns the icon for a HUD buff or debuff.
--  @function       Buff
--  @param          {string} iconname Buff name
--  @param[opt]     {string} textexist If set to 'Text' or 'text', text is added after icon
--  @param[opt]     {string} color Icon color, can be 'White' or 'Black'; defaults to 'Black'
--  @param[opt]     {string} imagesize Image size, defaults to 'x40'
--  @return         {string} The icon's image in wikitext
function p.Buff(frame)
    local iconname = frame.args[1]
    local color = frame.args[2]
    local imagesize = frame.args.imgsize
    local link = IconData["Buff"][iconname]["link"]
    local iconFile = ""

    assert(IconData["Buff"][iconname] ~= nil, 
        'p.Buff(frame): Invalid icon name "'..iconname..'" [[Category:Icon Module error]]')
    
    if (color == 'white' or color == 'White') then
        iconFile = IconData["Buff"][iconname]["icon"][1]   --white icon
    else
        iconFile = IconData["Buff"][iconname]["icon"][2]   --black icon
    end
    if (imagesize == nil or imagesize == '') then
        imagesize = 'x40'
    end
    return '[[File:'..iconFile..'|'..imagesize..'px|link='..link..'|class=icon]]'
end

--- Returns the icon for a Clan tier.
--  @function       Clan
--  @param          {string} iconname Clan tier name
--  @param[opt]     {string} imagesize Image size, defaults to 'x26'
--  @return         {string} The icon's image in wikitext
function p.Clan(frame)
    local iconname = frame.args[1]
    local imagesize = frame.args.imgsize

    return p._Clan(iconname, imagesize)
end

--- Returns the icon for a Clan tier.
--  @function       _Clan
--  @param          {string} iconname Clan tier name
--  @param[opt]     {string} imagesize Image size, defaults to 'x26'
--  @return         {string} The icon's image in wikitext
function p._Clan(iconname, imagesize)
    local link = IconData["Clan"][iconname]["link"]
    local iconFile = ""

    assert(IconData["Clan"][iconname] ~= nil, 
        'p._Clan(iconname, imagesize): Invalid icon name "'..iconname..'" [[Category:Icon Module error]]')
        
    iconFile = IconData["Clan"][iconname]["icon"]
    if (imagesize == nil or imagesize == '') then
        imagesize = 'x26'
    end
    return '[[File:'..iconFile..'|'..imagesize..'px|link='..link..'|'..iconname..' Clan|class=icon]]'
end

function p.tooltipSpan(name, typename)
    return typename == 'Proc' and
    {'<span class="tooltip" data-param="'..name..'" data-param2="DamageTypes" style="white-space:nowrap;">', '</span>'}
    or nil
end

return p