Anonymous

Module:Icons: Difference between revisions

From Melvor Idle
Use class in place of inline styles
(Minor fix to text for Agility handling)
(Use class in place of inline styles)
(49 intermediate revisions by 7 users not shown)
Line 1: Line 1:
local Shared = require("Module:Shared")
local Shared = require("Module:Shared")
local GameData = require("Module:GameData")


-- Locally index some functions for performance
-- Locally index some functions for performance
Line 16: Line 15:
["aurora"] = "svg",
["aurora"] = "svg",
["combatArea"] = "svg",
["combatArea"] = "svg",
["dungeon"] = "svg",
["dungeon"] = "svg", -- Some exceptions included by name below
["prayer"] = "svg",
["prayer"] = "svg",
["upgrade"] = "svg", -- Some exceptions included by name below
["upgrade"] = "svg", -- Some exceptions included by name below
Line 35: Line 34:
["Slayer Coins"] = "svg",
["Slayer Coins"] = "svg",
["Raid Coins"] = "svg",
["Raid Coins"] = "svg",
["TotH"] = "svg",
["Shop"] = "svg",
["Shop"] = "svg",
["Easter"] = "svg",
["Easter"] = "svg",
Line 45: Line 45:
["Hardcore Adventure Speedrun"] = "svg",
["Hardcore Adventure Speedrun"] = "svg",
["Mastery Tokens"] = "gif",
["Mastery Tokens"] = "gif",
["Lesser Relics"] = "gif",
["Prat, the Serpent of Fire"] = "svg",
["Prat, the Serpent of Fire"] = "svg",
["Unholy Prayers"] = "svg",
["Museum"] = "svg",
-- Items
-- Items
["Amulet of Fishing"] = "svg",
["Amulet of Fishing"] = "svg",
Line 100: Line 103:
["Mark"] = "svg",
["Mark"] = "svg",
["Astro"] = "svg",
["Astro"] = "svg",
-- Curses, included to override the type level override above
-- Curses & spells, included to override the type level override above
["Madness"] = "png",
["Madness"] = "png",
["Torment"] = "png",
["Torment"] = "png",
Line 127: Line 130:
["Linden Boat"] = "png",
["Linden Boat"] = "png",
["Golden Compass"] = "png",
["Golden Compass"] = "png",
-- Rocks (Mining), included to override the type level override above
["Ship Combat Overhaul"] = "png",
["Rune Essence"] = "png",
["Blessed Bone Offering"] = "png",
["Pure Essence"] = "png",
["Ship Crow's Nest Upgrade"] = "png",
["Onyx"] = "png",
["Extra Bank Tab"] = "png",
["Oricha"] = "png",
["Superior Cooking Pot"] = "png",
["Cerulean"] = "png",
["Superior Cauldron"] = "png",
["Mithril Brush"] = "png",
["Mithril Shovel"] = "png",
["Mithril Sieve"] = "png",
["Mithril Trowel"] = "png",
["Ship Anchor Upgrade"] = "png",
["Ship Keel Upgrade"] = "png",
["Ship Mast Upgrade"] = "png",
["Ship Rudder Upgrade"] = "png",
["Ship Sails Upgrade"] = "png",
["Ship Hull Upgrade"] = "png",
["Adamant Brush"] = "png",
["Adamant Shovel"] = "png",
["Adamant Sieve"] = "png",
["Adamant Trowel"] = "png",
["Ancient Brush"] = "png",
["Ancient Shovel"] = "png",
["Ancient Sieve"] = "png",
["Ancient Trowel"] = "png",
["Crystal Brush"] = "png",
["Crystal Shovel"] = "png",
["Crystal Sieve"] = "png",
["Crystal Trowel"] = "png",
["Dark Steel Brush"] = "png",
["Dark Steel Shovel"] = "png",
["Dark Steel Sieve"] = "png",
["Dark Steel Trowel"] = "png",
["Dragon Brush"] = "png",
["Dragon Shovel"] = "png",
["Dragon Sieve"] = "png",
["Dragon Trowel"] = "png",
["Iron Brush"] = "png",
["Iron Shovel"] = "png",
["Iron Sieve"] = "png",
["Iron Trowel"] = "png",
["Relic Brush"] = "png",
["Relic Shovel"] = "png",
["Relic Sieve"] = "png",
["Relic Trowel"] = "png",
["Rune Brush"] = "png",
["Rune Shovel"] = "png",
["Rune Sieve"] = "png",
["Rune Trowel"] = "png",
["Steel Brush"] = "png",
["Steel Shovel"] = "png",
["Steel Sieve"] = "png",
["Steel Trowel"] = "png",
["Aranite Brush"] = "png",
["Aranite Shovel"] = "png",
["Aranite Sieve"] = "png",
["Aranite Trowel"] = "png",
["Travel Token"] = "png",
["Dig Site Token"] = "png",
["Summoner's Pack I"] = "png",
["Summoners' Pack II"] = "png",
["Summoners' Pack III"] = "png",
-- Marks (Summoning), included to override the type level override above
-- Marks (Summoning), included to override the type level override above
["Eagle"] = "png",
["Eagle"] = "png",
Line 141: Line 199:
["Siren"] = "png",
["Siren"] = "png",
["Spider"] = "png",
["Spider"] = "png",
["Spectre"] = "png"
["Spectre"] = "png",
-- Dungeons, included to override the type level override above
["Golem Territory"] = "png",
["Cult Grounds"] = "png",
["Trickery Temple"] = "png",
["Underwater City"] = "png",
["Underwater Ruins"] = "png",
["Eye-conic Cave"] = "png",
["Mucky Cave"] = "png",
["Lost Temple"] = "png",
["Ritual Site"] = "png",
["Shipwreck Cove"] = "png",
}
}
}
}
Line 170: Line 239:
["Bear"] = "svg",
["Bear"] = "svg",
["Devil"] = "svg"
["Devil"] = "svg"
},
["monster"] = {
["Merman"] = "svg",
["Shipwreck Beast"] = "svg",
["Treacherous Jellyfish"] = "svg",
["Merman Guard"] = "svg",
["Ghost Mercenary"] = "svg",
["Mermaid Archer"] = "svg",
["Cult Member"] = "svg",
["Cursed Pirate Captain"] = "svg",
["Fake Door"] = "svg",
["Possessed Barrel"] = "svg",
["Lich"] = "svg",
["Earth Golem (AoD)"] = "svg",
["Magic Golem"] = "svg",
["Magic Mirror"] = "svg",
["Poison Bloater"] = "svg",
["Cult Imp"] = "svg",
["Cult Monster"] = "svg",
["Ghost Sailor"] = "svg",
["Granite Golem"] = "svg",
["Nagaia"] = "svg",
["Poison Leecher"] = "svg",
["Poison Roamer"] = "svg",
["Poison Slime"] = "svg",
["Ranged Golem"] = "svg",
["Soul Taker Witch"] = "svg",
["Lava Golem"] = "svg",
["Puppet Master"] = "svg"
},
["rock"] = {
["Rune Essence"] = "png",
["Pure Essence"] = "png",
["Onyx"] = "png",
["Oricha"] = "png",
["Cerulean"] = "png",
["Crystal"] = "png",
["Pure Crystal"] = "png"
},
["township"] = {
-- Seasons, which are PNG unlike most other Township images
["Spring"] = "png",
["Summer"] = "png",
["Fall"] = "png",
["Winter"] = "png",
["Nightfall"] = "png",
["Solar Eclipse"] = "png"
}
}
}
}
Line 176: Line 292:
local typeOverrides = {
local typeOverrides = {
['combat'] = 'combatArea',
['combat'] = 'combatArea',
['slayer'] = 'combatArea',
['slayer'] = 'combatArea'
}
}
--When calling for an icon for Key, replace with image Value, and optionally override type also
--When calling for an icon for Key, replace with image Value, and optionally override type also
Line 190: Line 306:
['Event Token - Holiday 2021'] = 'Christmas Present (Yellow)',
['Event Token - Holiday 2021'] = 'Christmas Present (Yellow)',
["I Can't See Helmet"] = {'Golbin', 'monster'},
["I Can't See Helmet"] = {'Golbin', 'monster'},
["Golbin Raid"] = {'Golden Golbin', 'pet'},
["Throne of the Herald Expansion"] = 'TotH',
["Atlas of Discovery Expansion"] = 'AoD',
["Dig Site Map"] = {'Extra Archaeology Map Slot', 'upgrade'},
-- Spellbooks
["Ancient Magicks"] = {'Ancient', 'spellType'},
["Archaic Magicks"] = {'Archaic', 'spellType'},
["Standard Magic"] = {'Standard', 'spellType'},
["Curses"] = {'Curse', 'spellType'},
["Auroras"] = {'Aurora', 'spellType'},
-- Shop purchases
-- Shop purchases
['Extra Bank Slot'] = {'Bank Slot', 'upgrade'},
['Basic Resupply'] = {'Lobster', 'item'},
['Basic Resupply'] = {'Lobster', 'item'},
['Standard Resupply'] = {'Crab', 'item'},
['Standard Resupply'] = {'Crab', 'item'},
Line 201: Line 328:
['Access to Throne of the Herald'] = {'Golden Key', 'item'},
['Access to Throne of the Herald'] = {'Golden Key', 'item'},
["Max Skillcape"] = 'Maximum Skillcape',
["Max Skillcape"] = 'Maximum Skillcape',
["+1 Archaeology Dig Site Map Slot"] = 'Extra Archaeology Map Slot',
["Magic Anvil"] = {'Magic Anvil', 'item'},
["Agility Prosperity"] = {'Agility', 'skill'},
["Agility Item Cost Reduction Enhancement"] = {'Agility', 'skill'},
["Cartographer's Enhancement"] = {'Cartography', 'skill'},
["Cartographer's Knowledge"] = {'Cartography', 'skill'},
["Combat Supply I"] = {'Adamant Javelin', 'item'},
["Combat Supply II"] = {'Rune Javelin', 'item'},
["Combat Supply III"] = {'Dragon Javelin', 'item'},
-- Golbin Raid shop items
["Reduce Wave Skip Cost"] = {'Melvor Logo', ''},
["Food Bonus"] = {'Melvor Logo', ''},
["Ammo Gatherer"] = {'Melvor Logo', ''},
["Rune Pouch"] = {'Melvor Logo', ''},
["Increase Starting Prayer Points"] = {'Melvor Logo', ''},
["Unlock Combat Passive Slot"] = {'Melvor Logo', ''},
["Prayer"] = {'Prayer', 'skill'},
["Increase Prayer Level"] = {'Prayer', 'skill'},
["Increase Prayer Points gained per Wave Completion"] = {'Prayer', 'skill'},
["Faster Golbin Spawns"] = {'Timer', ''},
-- Alt.Magic spells using item icons
-- Alt.Magic spells using item icons
['Item Alchemy'] = {'Item Alchemy III', 'spell'},
['Item Alchemy'] = {'Item Alchemy III', 'spell'},
Line 212: Line 359:
["Holy Invocation III"] = {'Large Urn', 'item'},
["Holy Invocation III"] = {'Large Urn', 'item'},
["Embellish"] = {'Lava Fish (Perfect)', 'item'},
["Embellish"] = {'Lava Fish (Perfect)', 'item'},
["Barrier Dust"] = {'Barrier Dust', 'item'},
["Cursed Offering"] = {'Cursed Logs', 'item'},
["Unholy Offering"] = {'Unholy Prayers', ''},
-- Overrides that allow generic potion pages to be linked to easily
-- Overrides that allow generic potion pages to be linked to easily
['Melee Accuracy Potion'] = {'Melee Accuracy Potion I', 'item'},
['Melee Accuracy Potion'] = {'Melee Accuracy Potion I', 'item'},
Line 232: Line 382:
['Slayer Bounty Potion'] = {'Slayer Bounty Potion I', 'item'},
['Slayer Bounty Potion'] = {'Slayer Bounty Potion I', 'item'},
['Holy Bulwark Potion'] = {'Holy Bulwark Potion I', 'item'},
['Holy Bulwark Potion'] = {'Holy Bulwark Potion I', 'item'},
['Adaptive Accuracy'] = {'Adaptive Accuracy Potion I', 'item'},
['Adaptive Accuracy Potion'] = {'Adaptive Accuracy Potion I', 'item'},
['Reaper Potion'] = {'Reaper Potion I', 'item'},
['Reaper Potion'] = {'Reaper Potion I', 'item'},
['Penetration Potion'] = {'Penetration Potion I', 'item'},
['Penetration Potion'] = {'Penetration Potion I', 'item'},
Line 256: Line 406:
['Star Seeker Potion'] = {'Star Seeker Potion I', 'item'},
['Star Seeker Potion'] = {'Star Seeker Potion I', 'item'},
['Traps Potion'] = {'Traps Potion I', 'item'},
['Traps Potion'] = {'Traps Potion I', 'item'},
['Blacksmith Potion'] = {'Blacksmith Potion I', 'item'},
['Enkindled Yields Potion'] = {'Enkindled Yields Potion I', 'item'},
['Enkindled Yields Potion'] = {'Enkindled Yields Potion I', 'item'},
['Alt Magic Potion'] = {'Alt Magic Potion I', 'item'},
['Alt Magic Potion'] = {'Alt Magic Potion I', 'item'},
['Alt. Magic Potion'] = {'Alt Magic Potion I', 'item'},
['Barrier Touch Potion'] = {'Barrier Touch Potion I', 'item'},
['Crystallization Potion'] = {'Crystallization Potion I', 'item'},
['Unholy Potion'] = {'Unholy Potion I', 'item'},
['Cursed Potion'] = {'Cursed Potion I', 'item'},
['Barrier Igniter Potion'] = {'Barrier Igniter Potion I', 'item'},
['Crystal Sanction Potion'] = {'Crystal Sanction Potion I', 'item'},
-- Township resources
-- Township resources
['GP'] = {'Coins', ''},
['GP'] = {'Coins', ''},
Line 267: Line 425:
-- Township generic statue building
-- Township generic statue building
['Statue of Worship'] = 'Statue of Nothing',
['Statue of Worship'] = 'Statue of Nothing',
-- Township seasons
["Lemon Season"] = 'Spring',
-- Easter egg stuff
-- Easter egg stuff
["Lemonade (Empty)"] = "Lemonade",
["Lemonade (Empty)"] = "Lemonade",
Line 297: Line 457:
["Lemonade (Wait for it)"] = "Lemonade",
["Lemonade (Wait for it)"] = "Lemonade",
["Lemonade (Wait for it!)"] = "Lemonade",
["Lemonade (Wait for it!)"] = "Lemonade",
["Lemonade (Full)"] = "Lemonade"
["Lemonade (Full)"] = "Lemonade",
["Birthday Present (Artisan)"] = "Christmas Present (Yellow)",
["Birthday Present (Utility)"] = "Christmas Present (Blue)",
["Birthday Present (Gathering)"] = "Christmas Present (Green)",
["Birthday Present (Combat)"] = "Christmas Present (White)",
["Clue Scroll 1"] = "Event Clue 1",
["Clue Scroll 2"] = "Event Clue 1",
["Clue Scroll 3"] = "Event Clue 1",
["Clue Scroll 4"] = "Event Clue 1",
["Clue Scroll 5"] = "Event Clue 1",
["Clue Scroll 6"] = "Event Clue 1"
}
}
--When calling for an icon for Key + Type, replace with image Value, and optionally override type also
--When calling for an icon for Key + Type, replace with image Value, and optionally override type also
Line 303: Line 473:
['resource'] = {
['resource'] = {
['Rune Essence'] = {'Rune Essence', 'item'},
['Rune Essence'] = {'Rune Essence', 'item'},
['Leather'] = {'Leather', 'item'},
['Leather'] = {'Leather', 'item'}
},
['combatArea'] = {
-- Combat areas which use POI images
["Eye-conic Cave"] = {'The Eye-Conic Cave', 'poi'},
["Mucky Cave"] = {'Mucky Cave', 'poi'},
["Ritual Site"] = {'Ritual Site', 'poi'},
["Lost Temple"] = {'Lost Temple', 'poi'},
["Shipwreck Cove"] = {'Shipwreck Cove', 'poi'}
},
['dungeon'] = {
-- Dungeons which use POI images
["Trickery Temple"] = {'Lost Temple', 'poi'},
["Golem Territory"] = {'Monuments', 'poi'}
},
['mark'] = {
["Tortoise"] = {'Golbin Thief', 'mark'}
}
}
}
}
Line 310: Line 496:
['Alt Magic'] = 'Alternative Magic',
['Alt Magic'] = 'Alternative Magic',
['Alt. Magic'] = 'Alternative Magic',
['Alt. Magic'] = 'Alternative Magic',
['Spider2'] = 'Brown Spider'
['Spider2'] = 'Brown Spider',
['Earth Golem (AoD)'] = 'Earth Golem (AoD)'
}
}
--When calling for an icon for Key + Type, the link goes to Value
--When calling for an icon for Key + Type, the link goes to Value
local typeLinkOverrides = {
local typeLinkOverrides = {
['biome'] = {
['Grasslands'] = 'Biomes',
['Forest'] = 'Biomes',
['Mountains'] = 'Biomes',
['Water'] = 'Biomes',
['Swamp'] = 'Biomes',
['Valley'] = 'Biomes',
['Arid Plains'] = 'Biomes',
['Jungle'] = 'Biomes',
['Desert'] = 'Biomes',
['Snowlands'] = 'Biomes'
},
['resource'] = {
['resource'] = {
-- Township resources
-- Township resources
Line 328: Line 527:
['Leather'] = '',
['Leather'] = '',
['Clothing'] = ''
['Clothing'] = ''
},
['spellType'] = {
-- Spellbooks
['Standard'] = 'Standard Magic',
['Ancient'] = 'Ancient Magicks',
['Archaic'] = 'Archaic Magicks',
['Curse'] = 'Curses',
['Aurora'] = 'Auroras'
},
},
['township'] = {
['township'] = {
['Workers'] = '',
['Workers'] = '',
['Statistics'] = '',
['Statistics'] = '',
['Town'] = ''
['Town'] = '',
['Spring'] = 'Seasons',
['Summer'] = 'Seasons',
['Fall'] = 'Seasons',
['Winter'] = 'Seasons',
['Nightfall'] = 'Seasons',
['Solar Eclipse'] = 'Seasons'
},
['upgrade'] = {
-- Shop purchases
['Extra Bank Slot'] = 'Bank Slot',
['Reduce Wave Skip Cost'] = '',
['Food Bonus'] = '',
['Ammo Gatherer'] = '',
['Rune Pouch'] = '',
['Increase Starting Prayer Points'] = '',
['Unlock Combat Passive Slot'] = '',
['Prayer'] = '',
['Increase Prayer Level'] = '',
['Increase Prayer Points gained per Wave Completion'] = '',
['Faster Golbin Spawns'] = '',
['Golbin Crate'] = ''
}
}
}
}


--If no other text override was specified for the given link, use these
-- If no other text override was specified for the given link, use these
local txtOverrides = {
local txtOverrides = {
['Spider2'] = 'Brown Spider'
['Spider2'] = 'Brown Spider',
['Earth Golem (AoD)'] = 'Earth Golem'
}
}
--Ambiguous overrides section
-- Ambiguous overrides section
local ambiguousOverrides = {
local ambiguousOverrides = {
['Golbin'] = true,
['Golbin'] = true,
Line 355: Line 584:
['Siren'] = true,
['Siren'] = true,
['Lightning Spirit'] = true,
['Lightning Spirit'] = true,
['Ritual Site'] = true,
['Lost Temple'] = true,
['Shipwreck Cove'] = true
}
-- For ambiguous overrides, determines the type text to be used in the page link
local ambiguousTypeMap = {
['mark'] = 'item',
['combatArea'] = 'Combat Area',
['poi'] = 'Dig Site'
}
-- Defines icon types for which a section or anchor on a static page should be linked to, rather
-- than the usual page linking
local sectionLinks = {
['agility'] = {
['link'] = 'Agility',
['img'] = {'Agility', 'skill'},
['exclude'] = {}
},
['poi'] = {
['link'] = 'Cartography',
['exclude'] = {
['Ancient Market'] = true,
['Ritual Site'] = true,
['Melantis'] = true,
['Cathedral'] = true,
['Monuments'] = true,
['Coral Wreckage'] = true,
['Shipwreck Cove'] = true,
['Watchtower'] = true,
['Sacrificial Site'] = true,
['Old Village'] = true,
['Bazaar'] = true,
['Glacia City Ruins'] = true,
['Castle Ruins'] = true,
['Ancient Forge'] = true,
['Quarry'] = true,
['Secret Mines'] = true,
['Lost Temple'] = true,
['Stoneworkers'] = true
}
}
}
}
--When calling for an icon for Key, add a css class
 
-- When calling for an icon for Key, add a css class
local imgClassOverrides = {
local imgClassOverrides = {
-- Township Stat Icons are licensed from Font Awesome Free 5.14.0 under CC BY 4.0 (https://github.com/FortAwesome/Font-Awesome/tree/5.14.0)
-- Was previously used for Township stat icons prior to v1.1.2
['Population'] = 'township-colortoggle',
--['Population'] = 'township-colortoggle'
['Workers'] = 'township-colortoggle',
['Storage'] = 'township-colortoggle',
}
}


Line 373: Line 644:
local nolink = args.nolink ~= nil and args.nolink ~= ''
local nolink = args.nolink ~= nil and args.nolink ~= ''
local noicon = args.noicon ~= nil and args.noicon ~= ''
local noicon = args.noicon ~= nil and args.noicon ~= ''
local nospan = args.nospan ~= nil and args.nospan
local menu = args.menu ~= nil and args.menu ~= ''
local menu = args.menu ~= nil and args.menu ~= ''
local imgSize = args.size ~= nil and args.size or 25
local imgSize = args.size ~= nil and args.size or 25
Line 379: Line 651:
local class = args.class ~= nil and args.class ~= '' and args.class or ''
local class = args.class ~= nil and args.class ~= '' and args.class or ''
local altText = args.alt ~= nil and args.alt or (notext and (text or link)) or ''
local altText = args.alt ~= nil and args.alt or (notext and (text or link)) or ''
local nospan = args.nospan ~= nil and args.nospan
local linkSection = args.section
local expIcon = args.expicon ~= nil and args.expicon or ''
local expIcon = args.expicon ~= nil and args.expicon or ''


Line 388: Line 660:
img = sgsub(img, '/Training', '')
img = sgsub(img, '/Training', '')
img = sgsub(img, '/Guide', '')
img = sgsub(img, '/Guide', '')
-- Remove '#' from links to facilitate linking to things with hashes in
-- their names (e.g. item 'Birthday Cake Piece #1'). Links to sections
-- of a page should instead be performed using the 'section' parameter.
link = sgsub(link, '#', '')
link = sgsub(link, '#', '')
 
-- Special handling for links to Agility obstacles or pillars
-- Handle types for which links should be to a section of a static page
if iconType == 'agility' then
local sl = sectionLinks[iconType]
img = 'Agility'
if sl ~= nil and not sl.exclude[link] then
iconType = 'skill'
if text == nil or text == '' then
if text == nil or text == '' then
text = link
text = link
end
end
link = 'Agility#' .. string.gsub(link, ' ', '')
linkSection = string.gsub(link, ' ', '')
-- Link overwriting must occur after text & linkSection have been set
link = sl.link
if sl.img ~= nil then
img = sl.img[1]
if sl.img[2] ~= nil then
iconType = sl.img[2]
end
end
end
end


--MANUAL OVERRIDES
--MANUAL OVERRIDES
local origType = iconType
local ovrImg = imgOverrides[link]
local ovrImg = imgOverrides[link]
local ovrTypeImg = typeImgOverrides[iconType]
local ovrTypeImg = typeImgOverrides[iconType]
Line 428: Line 711:
-- Type & extension overrides must be after adjustments have been made
-- Type & extension overrides must be after adjustments have been made
-- for any image overrides
-- for any image overrides
local ovrTypeExt = typeExtOverrides[iconType]
local ovrTypeExt, ovrTypeExtTable = nil, typeExtOverrides[iconType]
if ovrTypeExt ~= nil then
if ovrTypeExtTable ~= nil then
ovrTypeExt = ovrTypeExt[img]
ovrTypeExt = ovrTypeExtTable[img]
end
end
local ovrType = typeOverrides[iconType]
local ovrType = typeOverrides[iconType]
Line 460: Line 743:
end
end
-- There are a couple specific double overrides to be included that don't fit in the above lists
-- There are a couple specific double overrides to be included that don't fit in the above lists
if ambiguousOverrides[link] then
 
-- If the link requires disambiguation or a section, the modify the link accordingly
-- while preserving the displayed text
local isAmbig, hasSection = ambiguousOverrides[link], linkSection ~= nil and linkSection ~= ''
if isAmbig or hasSection then
if not hasText then
if not hasText then
text = link
text = link
hasText = true
hasText = true
end
end
link = link..' ('..(iconType == 'mark' and 'item' or iconType)..')'
if isAmbig then
link = link .. ' (' .. (ambiguousTypeMap[origType] or origType) .. ')'
end
if hasSection then
link = link .. '#' .. linkSection
end
end
end


Line 497: Line 789:


if menu then
if menu then
return '{| class="articletable" style="display:inline-block;vertical-align:middle;"\r\n|-\r\n|' .. expIcon .. resultText .. '\r\n|}'
return '{| class="articletable img-text" style="vertical-align:middle;"\r\n|-\r\n|' .. expIcon .. resultText .. '\r\n|}'
elseif not noicon and not nospan then
elseif not noicon and not nospan then
return '<span style="display:inline-block">' .. expIcon .. resultText .. '</span>'
return '<span class="img-text">' .. expIcon .. resultText .. '</span>'
else
else
return resultText
return resultText
Line 518: Line 810:
result = result.." Level "..level
result = result.." Level "..level


result = '<span style="display:inline-block">'..result..'</span>'
result = '<span class="img-text">'..result..'</span>'
return result
return result
end
end
Line 545: Line 837:
result = result..p.Icon({linkname, img=iconname, type='item', notext=true, nospan=true, alt=altTextItem})..p.Icon({'Mastery', notext=true, nospan=true, alt=altTextMastery})
result = result..p.Icon({linkname, img=iconname, type='item', notext=true, nospan=true, alt=altTextItem})..p.Icon({'Mastery', notext=true, nospan=true, alt=altTextMastery})
if showText then result = result..'[['..linkname..']] [[Mastery]]' end
if showText then result = result..'[['..linkname..']] [[Mastery]]' end
result = '<span style="display:inline-block">'..result..'</span>'
result = '<span class="img-text">'..result..'</span>'
return result
return result
end
end
Line 557: Line 849:
end
end


function p._Currency(fileName, link, altText, amt, maxAmt)
function p._Currency(fileName, link, altText, amount, maxAmount)
local amtText = formatnum(amt)
local ret = {}
if maxAmt ~= nil and maxAmt >= amt then
table.insert(ret, '<span class="img-text">')
amtText = amtText .. ' - ' .. formatnum(maxAmt)
local sep = ''
-- Currency amounts
if tonumber(amount) ~= nil then
sep = '&nbsp;'
local function numColour(amount)
if tonumber(amount) < 0 then
return '<span style="color:red;">' .. formatnum(amount) .. '</span>'
else
return formatnum(amount)
end
end
table.insert(ret, numColour(amount))
if (tonumber(maxAmount) ~= nil and maxAmount > amount) then
table.insert(ret, ' - ' .. numColour(maxAmount))
end
end
end
 
-- Currency icon
local fileText = ''
if fileName ~= nil then
if fileName ~= nil then
fileText = '[[File:' .. fileName .. '|25px'
table.insert(ret, sep .. '[[File:' .. fileName .. '|25px')
if link ~= nil then
if link ~= nil then
fileText = fileText .. '|link=' .. link
table.insert(ret, '|link=' .. link)
end
end
fileText = fileText .. '|alt=' .. ((altText == nil and '') or altText) .. ']]&nbsp;'
table.insert(ret, '|alt=' .. ((altText == nil and '') or altText) .. ']]')
end
end
 
table.insert(ret, '</span>')
return '<span style="display:inline-block">' .. fileText .. amtText .. '</span>'
return table.concat(ret)
end
end


Line 589: Line 895:
--Adding a shortcut function for this
--Adding a shortcut function for this
function p.TotH()
function p.TotH()
return p.Icon({'Throne of the Herald Expansion', ext='svg', notext=true, img='TotH', alt=''})
return p.Icon({'Throne of the Herald Expansion', notext=true, img='TotH', alt=''})
end
 
function p.AoD()
return p.Icon({'Atlas of Discovery Expansion', notext=true, img='AoD', alt=''})
end
 
-- Prework to have function call available for when DLC releases.
-- Remove comments and uncomment line below when the image is available.
function p.ItA()
--return p.Icon({'Into the Abyss Expansion', notext=true, img='ItA', alt=''})
return nil
end
end


function p.getExpansionIcon(id)
function p.getExpansionIcon(id)
local ns, _ = GameData.getLocalID(id)
local ns, _ = Shared.getLocalID(id)
if ns == 'melvorTotH' then
if ns == 'melvorTotH' then
return p.TotH()..' '
return p.TotH()..' '
elseif ns == 'melvorAoD' then
return p.AoD()..' '
else
else
return ''
return ''