Fallout Wiki
Advertisement
Fallout Wiki

Template for displaying small icons.

Usage

{{icon|name of icon}}

To update the available icons, the Icon module requires a new parameter in the iconTip (default tooltip) and gameIcon (icon filename) lists. Change icons at Module:Icons/data. Change flags at Module:Flag.

Parameters

Yes
<unnamed 1>
Which icon should be displayed. Multiple icons can be listed by separating them with a comma. ({{Icon|FO1,FO2,FO3}})
Neutral
(default: "x14px")
<unnamed 2>
Specifies the size of the icon. Can either be set to one of the presets below or directly given as a px value (same syntax as for setting the image size of a normal file link).

The presets are:

  • small: Icons will be displayed at 10px height.
  • medium/normal: Icons will be displayed at 14px height.
  • big: Icons will be displayed at 20px height.
Neutral
link
Page the icon should link to (without enclosing "[[]]"). If tooltip is not specified, this is also used as the tooltip text.
Neutral
tooltip
Tooltip text is displayed when hovering over the icon. Overrides the icon's default text.

Available icons

prefix Icon prefix Icon prefix Icon
ability Icon ability.png ac Icon shield bronze.png acid Icon acid.png
action Icon action.png agi FO76 A.png alcohol FO76 Alcohol Icon.svg
amber Icon amber.png ammo Icon ammo.png ammo2 Icon ammo01.png
android Icon android.png ap Icon ap.png apple Icon appleios.png
ar Gametitle-AR.png armorwb Fo4 Armor Work Icon.png atom FO76 Atom Currency 2.png
attack Icon attack.png axed Fire axe icon color.png big gun Icon heavy weapon.png
bigger gun Icon big gun.png blade Icon blade.png bleed Icon bleed.png
blunt Icon blunt.png bonus effect Icon bonus effect.png boss FoS Boss.png
brain Brain icon.png bronze Bronze.png bugged unav Radroach.png
bullion Fo76 Icon Gold Bullion.png camp FO76 ui extra team.png caps Caps.png
caravan Icon cards.png cards Icon cards.png chance FO76 ui roleplay team.png
check Icon check.png check1 Icon CheckYellowShadowed.png checkbrown Icon check temp.png
chems FO76 Chems Icon.svg chemst Fo4 Chem Work Icon.png chr FO76 C.png
companion NW icon ally.png confidence Icon confidence.png cookst Fo4 Cook Work Icon.png
craft Icon crafting.png credit Credits icon.png crit Icon critical damage.png
crit effect Icon crit effect.png cross Icon cross.png crosshair Icon attack.png
cryo Icon cryo.png cut Icon cut.png d20 Gametitle-D20.png
dailyops FO76 ui dailyops team.png damage Icon damage.png dap Icon dap.png
dead Icon dead.png defense Icon shield silver.png detect Icon eye.png
detection Icon eye.png dial Icon dialogue.png dialogue Icon dialogue.png
disease Icon disease.png dislike Dislike.svg distance Icon range.png
doctor Icon doctor.png dps Icon dps.png dr Icon shield silver.png
drink FO76 Drink Icon.svg dt Icon shield gold.png dur Icon limitedtime.png
effect Icon effect.png electrical Icon electrical.png emp Icon EMP.png
end FO76 E.png energy Icon electrical.png enslave Icon cage.png
essential Icon essential.png event FO76 icon map event.png eventpublic FO76 icon map public event.png
experience Icon XP.png explmill Icon fo4cw builder.png explosion Icon explosion.png
eye Icon eye.png facebook FacebookIcon.png fb Gametitle-FB.png
fbg Gametitle-FBG.png fbgagenda FBG Agenda icon.svg fbgaggressive FBG Aggressive icon.svg
fbgagility FBG A icon.svg fbgapparel FBG Apparel icon.svg fbgarmor FBG Armor icon.svg
fbgasset FBG Asset icon.svg fbgcharisma FBG C icon.svg fbgcompanion FBG Companion icon.svg
fbgcritter FBG Critter icon.svg fbgdangerous FBG Dangerous icon.svg fbgdeadly FBG Deadly icon.svg
fbgdieablhits FBG Die ABL Hits.png fbgendurance FBG E icon.svg fbgfreedom FBG Freedom icon.svg
fbghit FBG Hit icon.svg fbghuman FBG Human icon.svg fbgintelligence FBG I icon.svg
fbgloot FBG Loot icon.svg fbgluck FBG L icon.svg fbgmonster FBG Monster icon.svg
fbgnc Gametitle-FBGNC.png fbgperception FBG P icon.svg fbgquest FBG Quest objective.svg
fbgradiation FBG Radiation icon.svg fbgranged FBG Ranged icon.svg fbgretreat FBG Retreat icon.svg
fbgrobot FBG Robot icon.svg fbgsecurity FBG Defender icon.svg fbgsettlement FBG Settlement icon.svg
fbgstrength FBG S icon.svg fbgsupermutant FBG Super Mutant icon.svg fbgvault109 FBG Vault 109 icon.svg
fbgvault84 FBG Vault 84 icon.svg fbgwasteland FBG Wasteland icon.svg fbgweapon FBG Weapon icon.svg
fbgww Gametitle-FBGWW.png female Female-gender-sign.png film Film.png
fire Icon fire.png firerate FO76 UI icon Ammo custom.png fist Icon fist.png
fnv Gametitle-FNV.png fnvcs Gametitle-FNV CS.png fnvdm Gametitle-FNV DM.png
fnvgra Gametitle-FNV GRA.png fnvhh Gametitle-FNV HH.png fnvlr Gametitle-FNV LR.png
fnvowb Gametitle-FNV OWB.png fnvww Icon wildwasteland.png fo Gametitle-FO1.png
fo1 Gametitle-FO1.png fo1st FO1st.png fo2 Gametitle-FO2.png
fo3 Gametitle-FO3.png fo3bs Gametitle-FO3 BS.png fo3mz Gametitle-FO3 MZ.png
fo3oa Gametitle-FO3 OA.png fo3pl Gametitle-FO3 PL.png fo3tp Gametitle-FO3 TP.png
fo4 Gametitle-FO4.png fo4aut Gametitle-FO4 AUT.png fo4cc Gametitle-FO4 CC.png
fo4chain01 Icon Fo4 chain01.png fo4chain02 Icon Fo4 chain02.png fo4chain03 Icon Fo4 chain03.png
fo4cw Gametitle-FO4 CW.png fo4fh Gametitle-FO4 FH.png fo4gencard Icon Fo4 gen keycard.png
fo4holo Icon Fo4 holotape.png fo4key01 Icon Fo4 key01.png fo4key02 Icon Fo4 key02.png
fo4key03 Icon Fo4 key03.png fo4note Icon Fo4 note.png fo4nw Gametitle-FO4 NW.png
fo4vaultid Icon Fo4 vaultid.png fo4vr Gametitle-FO4VR.png fo4vw Gametitle-FO4 VW.png
fo4ww Gametitle-FO4 WW.png fo76 Gametitle-FO76.png fo76fw Gametitle-FO76 FW.png
fo76ib Gametitle-FO76 TS.png fo76ll Gametitle-FO76 Locked n Loaded.png fo76lr Gametitle-FO76 LR.png
fo76nm Gametitle-FO76 NM.png fo76nw Gametitle-FO76 NW.png fo76ow Gametitle-FO76 One Wasteland.png
fo76sd Gametitle-FO76 Steel Dawn.png fo76sr Gametitle-FO76 Steel Reign.png fo76tp Gametitle-FO76 TP.png
fo76ts Gametitle-FO76 TS.png fo76wa Gametitle-FO76 WA.png fo76wl Gametitle-FO76 WL.png
fobos Gametitle-FOBOS.png fobos2 Gametitle-FOBOS2.png food Fallout 76 Food Icon.svg
foodpr Icon fo4cw builder.png fool PV13.png fos Gametitle-FOS.png
foso Gametitle-FOSO.png fot Gametitle-FOT.png fot2 Gametitle-FOT2.png
fow Gametitle-FOW.png foww Gametitle-FWW.png fox Gametitle-FOX.png
fpb Gametitle-FPB.png free ATX FREE.png frost Icon effect.png
fww Gametitle-FWW.png fwwrpg Gametitle-FWWRPG.png game FO76 ui roleplay team.png
gamerscore Gamerscore.svg gas Icon gas.png gold Gold.png
gold bullion Fo76 Icon Gold Bullion.png green Icon green.png grenade FO76 iconwheel grenade.png
group Icon group.png gun Icon gun.png hate Hate.svg
healing Icon healing.png healing rate Icon healing.png health Icon heart.png
heart Icon heart.png hp Icon heart.png image Icon image.png
info Icon info.png instagram Instagram icon.jpg int FO76 I.png
ios Icon appleios.png jes Gametitle-JES.png jury FO76 vaultboy licensedplumber 01.png
laser Icon laser.png lck FO76 L.png legendary Icon legendary.png
legendperk FO76 Perk coin.png level Icon level.png lh Gametitle-LH.png
like Like.svg limited YOU SHOULD BUY THIS.png limitedtime Icon limitedtime.png
linkedin Linkedin icon.png loc FO76 ui exploration team.png love Love.svg
lunchbox FO76 Lunchbox Icon.svg mac Icon mac.png macclassic Icon mac.png
mag Icon mag.png male Male-gender-sign.png melee Icon melee.png
mentioned Icon mentioned.png merchant FO76 ui trading team.png mine FO76 iconwheel minefrag.png
mod Icon plus.png mutate FO76 vaultboy dna.png mutation FO76 Mutation Icon.svg
myspace Myspace icon.png neutral Icon neutral.png neutralface Neutral.svg
new ATX NEW.png no Icon cross.png note Icon Fo4 note.png
notrade Icon NoTrade.png nukamix Icon Nuka-mixer station.png nw FO76NW Vault 51 icon.png
optional Icon optional.png pa Penny Arcade.gif pail Icon FO76 mole miner pail.png
parmorst Fo4 Power Work Icon.png pbgame Fo4 Pip-Boy game.png pc Icon pc.png
per FO76 P.png percent FO76 ui roleplay team.png pistol FO76 iconwheel pistol.png
plasma Icon plasma.png platinum Plat.png poison Icon poison.png
poison2 Poison Icon.png possum FO76 Possum badge blue.png possum dark FO76 Possum badge.png
present FO76 Present Icon.png ps3 Icon ps3.png ps4 Icon ps4.png
publicworkshop Icon Public Workshop.png pv13 PV13.png pve FO76 ui casual team.png
pvp FO76 ui workshopraid team.png quest FO76 ui icon quest.png question Icon question.png
radiation Icon radiation.png random FO76 ui roleplay team.png range Icon range.png
rarity Icon rarity.png ratio Icon ratio.png red Icon red.png
repair FO76 ui workshop team.png repeat Icon repeat.png required Icon required.png
rifle Icon rifle.png robotwb Icon robot workbench.png score FO76 scoresprite seasons.png
scout FO76 Pioneer Scouts.png scrip FO76 Scrip.png season FO76 scoresprite seasons.png
seasonal FO76 Quest Old Man Winter.png semi Icon semi-required.png semi-required Icon semi-required.png
sequence Icon sequence.png shieldbronze Icon shield bronze.png shieldgold Icon shield gold.png
shieldsilver Icon shield silver.png shotgun Icon shotgun.png sic Icon sic.png
silver Silver.png smg Icon smg.png soda FO76 Soda Icon.svg
sound Icon sound.png spawn Icon spawn.png spooky FO76 candyBowl MapIcon.png
spread Icon spread.png star Icon legendary.png stimpak FO76 Stimpak Icon.svg
str FO76 S.png survival FO76 icon roadmap survival.png switch Nintendo Switch icon.png
tadpole FO76 Tadpole badge blue.png tadpole dark FO76 Tadpole badge.png tar Gametitle-TAR.jpg
tea FO76 Drink Tea Icon.svg temp Icon check temp.png text Icon text.png
torn Gametitle-TORN.png tumblr Tumblr Icon.png twitch Twitch icon.png
twitter Twitter icon.png unarmed Icon unarmed.png unused Icon unused.png
upcoming Mbox upcoming.png v76 FO76 Vault 76 icon.png vaultraid Vault Raids.png
vaulttec Icon vaulttec.png vb Gametitle-VB.png vt Icon vaulttec.png
weapwb Fo4 Weapon Work Icon.png weight FO76 icon weight.png wiki Gametitle-Wiki.png
wild wasteland Icon wildwasteland.png windows Icon windows.png workshop Icon workshop.png
ww Icon wildwasteland.png xbox360 Icon xbox360.png xboxone Icon xboxone.png
xp Icon XP.png yes Icon check.png

In addition, all abbreviations supported by {{Abb}} can be used to produce an icon for the corresponding game.


local p = {}
local util = require( 'Module:Util' )
--[[
	Icon data is now stored on the sub page /data to seperate functional code
	for the dataset users will often need to update. This reduces the risk of
	breaking the code by entering data in the wrong place and makes it easier to
	manage the code itself by not having to pass through the large dataset at 
	the top.
]]

require( 'Module:Icons/data' ) 

local iconSize = {
    --[[
        All sizes are controlled on the height to ensure a string of icons maintain 
        a consistent line height
    ]]
    ["small"]           = "x10px",
    ["medium"]          = "x14px",
    ["normal"]          = "x14px",
    ["big"]             = "x20px",
}

--[[ 28/Oct/2021 Added class control table to array as to handle light/dark 
	themes. This was originally put into the frontend template, when class
	handling should be back end. Adding the ['class'] = 'light' or 
	['class'] = 'dark' parameter to a icon's dataset on /data will enable it to
	access a class if needed.
	]]

--[[ 08/Nov/2021 Remove the class definition as to be able to just pass straight through
local class = {
	['light'] = 'lighticon',
	['dark'] = 'darkicon',
	['general'] = 'generalicon'
}
]]

function _generate(iconList, iconSetting, iconLinks, tipOverride, iconClass, iconSize)
	local parserError = ''
    if util.exists(iconSetting)  then 
    	iconSetting = util.trim(iconSetting)
        if util.exists(iconSize[iconSetting]) then
            iconSetting = iconSize[iconSetting]
        end
    else
        iconSetting = iconSize["medium"]
    end
    
    if util.exists(iconLinks) then
        iconLinks = mw.text.split(iconLinks, ",")
    end
        
    if util.exists(tipOverride) then
        tipOverride = mw.text.split(tipOverride, ",")
    end
    
    if util.exists(iconClass)then
    	iconClass = "|class=" .. tostring(iconClass);
    else
    	iconClass = ""
    end

    local result = ""

    for k, v in ipairs(iconList) do
        newIcon = iconData[util.trim(v)]
        if util.exists(newIcon) then
            currentIcon = newIcon.icon
            if util.exists(tipOverride, k) then
                currentTip = tipOverride[k]
            else
                if util.exists(iconLinks, k) then
                    currentTip = iconLinks[k]
                else
                    currentTip = newIcon.tip
                end
            end
        else
            currentIcon = "Icon question.png"
            currentTip = "Unrecognized icon name"
            result = result .. "[[Category:Modules with invalid parameters]]"
        end
        
        --Create wikitext icon
		dataLine = '[[File:' .. currentIcon .. '|' .. iconSetting
        if util.exists(iconLinks, k) then
            dataLine = dataLine .. '|link=' .. iconLinks[k]
        else
            dataLine = dataLine .. '|link='
        end
        if currentTip ~= nil then
            dataLine = dataLine .. '|' .. currentTip
        end

        dataLine = dataLine .. iconClass .. ']]'

		createTip = mw.html.create('span')
        	createTip:addClass( 'va-icon' )
        	:attr('title', currentTip)
        	:wikitext(dataLine)
        result = result .. tostring(createTip)
        
        if k < table.getn(iconList) then
        	result = result .. " "
        end
    end
    
    return result .. parserError
end

function p.Icons(frame) 
	--[[All icons are now lower case to reduce script errors from 
	incorrectly entering the icon code in a different case to the list]]
    local iconList = mw.text.split(string.lower(frame.args[1]), ",")
    local iconSetting = frame.args[2]
    local iconLinks = frame.args[3]
    local tipOverride = frame.args[4]
    local iconClass = frame.args[5]	
	local iconSize = {
    	--[[
    	    All sizes are controlled on the height to ensure a string of icons maintain 
	        a consistent line height
    	]]
    	["small"]           = "x10px",
    	["medium"]          = "x14px",
    	["normal"]          = "x14px",
    	["big"]             = "x20px"
	}
    return _generate(iconList, iconSetting, iconLinks, tipOverride, iconClass, iconSize)    
end

function p.platforms(frame)
	--[[All icons are now lower case to reduce script errors from 
	incorrectly entering the icon code in a different case to the list]]
    local icons = mw.text.split(string.lower(frame.args[1]), ",")
    local result = ""
    
    for k, v in ipairs(icons) do
        currentIcon = iconData[util.trim(v)]
        
        if util.exists(currentIcon, 'platform') == true then
        	
            createSM = mw.html.create('span')
            	createSM:css('display', 'none')
            	:wikitext('[[Has platform::' .. currentIcon.tip .. ']]')
            	:allDone()
            createPlatform = mw.html.create('span')
            	createPlatform:addClass('va-icon')
            		:attr('title', currentIcon.tip)
            		:wikitext('[[File:' 
            			.. currentIcon.icon 
            			.. '|alt='
            			.. currentIcon.alt
            			.. '|x14px|link=]]')
            		:allDone()
            	--[[ Uncommenting tostring(createSM) below will enable 
            	Semantic Mediawiki data tracking]]
            	result = result .. tostring(createSM) 
            			.. tostring(createPlatform)
            if k < table.getn(icons) then
                result = result .. " "
            end
        end
    end
    if result == '' then
        result = '<sup>[Platforms needed]</sup>[[Category:Platforms needed]]'
    end
    
    return result
end    

function p.documentation()
    keys = {}
    for k in pairs(iconData) do
        table.insert(keys, k)
    end
 
    table.sort(keys)
    result = '{| class="va-table va-table-full"\n|-\n !prefix!!Icon!!prefix!!Icon!!prefix!!Icon\n|-\n'
    set = 1
    for k,v in ipairs(keys) do
		i = iconData[v]
        result = result .. "||'''" .. v .. "'''"
        if util.exists(i) == true and i.class ~= nil then
        	newFile = mw.html.create(span)
        		--:addClass(class[i.class])
        		:wikitext('[[File:' .. iconData[v].icon .. '|25px]]')
        else
        	newFile = mw.html.create(span)
        		:wikitext('[[File:' .. iconData[v].icon .. '|25px]]')
        end
        result = result .. '||' .. tostring(newFile)
 
        if set == 3 then
            result = result .. '\n|-\n'
        end
 
        if set < 3 then
            set = set + 1
        else
            set = 1
        end
    end
 
    result = result .. '\n|}'
 
    return result
end

function p.Test(frame) 
	--Please empty when done debugging so other users know it is free to use

end

return p
Advertisement