Anonymous

Module:Icons: Difference between revisions

From Melvor Idle
Use class in place of inline styles
(Support v1.01 icons)
(Use class in place of inline styles)
(112 intermediate revisions by 10 users not shown)
Line 1: Line 1:
--You can't generate Templates from within Lua due to the loading order, so instead copying the Icon functionality into a module so it can be pulled elsewhere.
local Shared = require("Module:Shared")
--Should function very similarly to how Template:Icon works


local Shared = require("Module:Shared")
-- Locally index some functions for performance
local sgsub, fixPagename, formatnum, tostring, type = string.gsub, Shared.fixPagename, Shared.formatnum, tostring, type


local p = {}
local p = {}
--Extension overrides for items that have non-svg images
--Extension overrides for items that have non-png images
--Name level overrides take precedence over type level overrides
local extOverrides = {
local extOverrides = {
  ["Adventure"] = "png",
["type"] = {
  ["Crown of Rhaelyx"] = "png",
["skill"] = "svg",
  ["Jewel of Rhaelyx"] = "png",
["spellType"] = "svg",
  ["Circlet of Rhaelyx"] = "png",
["spell"] = "svg",
  ["Charge Stone of Rhaelyx"] = "png",
["curse"] = "svg", -- Some exceptions included by name below
  ["Mysterious Stone"] = "png",
["aurora"] = "svg",
  ["Lemon"] = "jpg",
["combatArea"] = "svg",
  ["Lemons"] = "jpg",
["dungeon"] = "svg", -- Some exceptions included by name below
  ["Lemonade"] = "jpg",
["prayer"] = "svg",
  ["Miolite Sprig"] = "png",
["upgrade"] = "svg", -- Some exceptions included by name below
  ["Miolite Trio"] = "png",
["tree"] = "svg",
  ["Miolite Warden"] = "png",
["rock"] = "svg", -- Some exceptions included by name below
  ["Miolite Monarch"] = "png",
["thieving"] = "svg",
  ["Wicked Greater Dragon"] = "png",
["constellation"] = "svg",
  ["Hunting Greater Dragon"] = "png",
["building"] = "svg",
  ["Chaotic Greater Dragon"] = "png",
["resource"] = "svg",
  ["Beavis"] = "png",
["township"] = "svg"
  ["Pudding Duckie"] = "png",
},
  ["Pyro"] = "png",
["name"] = {
  ["Snek"] = "png",
-- General
  ["Larry, the Lonely Lizard"] = "png",
["Combat"] = "svg",
  ["Caaarrrlll"] = "png",
["Guides"] = "svg",
  ["Gronk"] = "png",
["Mastery"] = "svg",
  ["Finn, the Cat"] = "png",
["Coins"] = "svg",
  ["Marahute"] = "png",
["Slayer Coins"] = "svg",
  ["Monk-ey"] = "png",
["Raid Coins"] = "svg",
  ["Asura"] = "png",
["TotH"] = "svg",
  ["Summoning Shard (Silver)"] = "png",
["Shop"] = "svg",
  ["Summoning Shard (Red)"] = "png",
["Easter"] = "svg",
  ["Summoning Shard (Green)"] = "png",
["Melvor Logo"] = "svg",
  ["Summoning Shard (Gold)"] = "png",
["Question"] = "svg",
  ["Summoning Shard (Blue)"] = "png",
["Timer"] = "svg",
  ["Summoning Shard (Black)"] = "png",
["Hardcore"] = "svg",
  ['Infernal Core'] = 'png',
["Chaos"] = "svg",
  ['Cool Glasses'] = 'png',
["Internal Suffering Speedrun"] = "svg",
  ["Wizard's Sigil"] = 'png',
["Hardcore Adventure Speedrun"] = "svg",
  ["Wizard's Scroll"] = 'png',
["Mastery Tokens"] = "gif",
  ["Whetstone"] = 'png',
["Lesser Relics"] = "gif",
  ["Whale (Perfect)"] = 'png',
["Prat, the Serpent of Fire"] = "svg",
  ["Trout (Perfect)"] = 'png',
["Unholy Prayers"] = "svg",
  ["Training Shield"] = 'png',
["Museum"] = "svg",
  ["Thiever's Cape"] = 'png',
-- Items
  ["Thief's Moneysack"] = 'png',
["Amulet of Fishing"] = "svg",
  ["Swordfish (Perfect)"] = 'png',
["Lemon"] = "jpg",
  ["Strawberry Cupcake (Perfect)"] = 'png',
["Lemons"] = "jpg",
  ["Strawberry Cupcake"] = 'png',
["Lemonade"] = "jpg",
  ["Strawberry Cake (Perfect)"] = 'png',
["Ancient Crossbow"] = "svg",
  ["Strawberry Cake"] = 'png',
["Air Shard"] = "svg",
  ["Stack of Bones"] = 'png',
["Water Shard"] = "svg",
  ["Sneak-Ers"] = 'png',
["Earth Shard"] = "svg",
  ["Shrimp (Perfect)"] = 'png',
["Fire Shard"] = "svg",
  ["Shipwheel"] = 'png',
["Confetti Crossbow"] = "svg",
  ["Shark (Perfect)"] = 'png',
["Cloudburst Staff"] = "gif",
  ["Seed Pouch"] = 'png',
["Shockwave"] = "svg",
  ["Seahorse (Perfect)"] = 'png',
["Event Clue 1"] = "svg",
  ["Sardine (Perfect)"] = 'png',
["Event Clue 2"] = "svg",
  ["Salmon (Perfect)"] = 'png',
["Event Clue 3"] = "svg",
  ["Sailor's Top"] = 'png',
["Event Clue 4"] = "svg",
  ["Runecrafting Pouch"] = 'png',
-- Pets
  ["Ring of Wealth"] = 'png',
["Cris"] = "svg",
  ["Raw Chicken"] = 'png',
["Cool Rock"] = "svg",
  ["Raw Beef"] = 'png',
["Puff, the Baby Dragon"] = "svg",
  ["Prayer Scroll"] = 'png',
["Bruce"] = "svg",
  ["Plain Pizza Slice (Perfect)"] = 'png',
["Lil Ron"] = "svg",
  ["Plain Pizza Slice"] = 'png',
["Leonardo"] = "svg",
  ["Pile of Ores"] = 'png',
["Golden Golbin"] = "svg",
  ["Pile of Logs"] = 'png',
["Ty"] = "svg",
  ["Miner's Helmet"] = 'png',
["Ripper the Reindeer"] = "svg",
  ["Merchant's Permit"] = 'png',
["Chick"] = "svg",
  ["Meat Pizza Slice (Perfect)"] = 'png',
["Zarrah"] = "svg",
  ["Meat Pizza Slice"] = 'png',
["Chio"] = "svg",
  ["Marksman's Sigil"] = 'png',
["Bouncing Bob"] = "svg",
  ["Manta Ray (Perfect)"] = 'png',
["Rosey"] = "svg",
  ["Lumberjack's Top"] = 'png',
["Ayyden"] = "svg",
  ["Lobster (Perfect)"] = 'png',
["Arctic Yeti"] = "svg",
  ["Lemon Cake (Perfect)"] = 'png',
["Mac"] = "svg",
  ["Lemon Cake"] = 'png',
["Jerry the Giraffe"] = "svg",
  ["Knight's Sigil"] = 'png',
["Preston the Platypus"] = "svg",
  ["Knight's Defender"] = 'png',
["Quill"] = "svg",
  ["Knight's Cape"] = 'png',
["Gunter"] = "svg",
  ["Jeweled Necklace"] = 'png',
["Salem"] = "svg",
  ["Jester's Hat"] = 'png',
["Peri"] = "svg",
  ["Jadestone"] = 'png',
["Otto"] = "svg",
  ["Herring (Perfect)"] = 'png',
["Jelly Jim"] = "svg",
  ["Hearty Soup (Perfect)"] = 'png',
["Harley"] = "svg",
  ["Hearty Soup"] = 'png',
["Singe"] = "svg",
  ["Gold Crested Shield"] = 'png',
["Aquarias"] = "svg",
  ["Golbin Mask"] = 'png',
["Norman"] = "svg",
  ["Giant Club"] = 'png',
["Erran"] = "svg",
  ["Fishing Hook"] = 'png',
["Ren"] = "svg",
  ["Fine Coinpurse"] = 'png',
["Pablo"] = "svg",
  ["Fanfish (Perfect)"] = 'png',
["Sam"] = "svg",
  ["Cream Corn Soup (Perfect)"] = 'png',
["Tim the Wolf"] = "svg",
  ["Cream Corn Soup"] = 'png',
["Mark"] = "svg",
  ["Cream"] = 'png',
["Astro"] = "svg",
  ["Crate of Food"] = 'png',
-- Curses & spells, included to override the type level override above
  ["Crate of Basic Supplies"] = 'png',
["Madness"] = "png",
  ["Crab (Perfect)"] = 'png',
["Torment"] = "png",
  ["Cooking Apron"] = 'png',
["Despair"] = "png",
  ["Chicken Soup (Perfect)"] = 'png',
-- Alt. Magic
  ["Chicken Soup"] = 'png',
["Rags to Riches III"] = "png",
  ["Chicken (Perfect)"] = 'png',
-- Upgrades, included to override the type level override above
  ["Chest of Gems"] = 'png',
["Golbin Crate"] = "png",
  ["Cherry Seeds"] = 'png',
["Corundum Axe"] = "png",
  ["Cherry Cupcake (Perfect)"] = 'png',
["Augite Axe"] = "png",
  ["Cherry Cupcake"] = 'png',
["Meteorite Axe"] = "png",
  ["Cherry"] = 'png',
["Divine Axe"] = "png",
  ["Chef's Spoon"] = 'png',
["Spruce Cooking Fire"] = "png",
  ["Chef's Hat"] = 'png',
["Elderwood Cooking Fire"] = "png",
  ["Cheese"] = 'png',
["Carrion Cooking Fire"] = "png",
  ["Cave Giant Boots"] = 'png',
["Iridium Pot"] = "png",
  ["Cave Fish (Perfect)"] = 'png',
["Palladium Pot"] = "png",
  ["Carrot Cake (Perfect)"] = 'png',
["Divine Pot"] = "png",
  ["Carrot Cake"] = 'png',
["Corundum Furnace"] = "png",
  ["Carp (Perfect)"] = 'png',
["Augite Furnace"] = "png",
  ["Bread (Perfect)"] = 'png',
["Divine Furnace"] = "png",
  ["Bread"] = 'png',
["Sign of the Stars"] = "png",
  ["Book of Scholars"] = 'png',
["Summoner's Altar"] = "png",
  ["Bob's Gloves"] = 'png',
["Golden Shard"] = "png",
  ["Beef Pie (Perfect)"] = 'png',
["Labyrinth Solution"] = "png",
  ["Beef Pie"] = 'png',
["Linden Boat"] = "png",
  ["Beef (Perfect)"] = 'png',
["Golden Compass"] = "png",
  ["Beef"] = 'png',
["Ship Combat Overhaul"] = "png",
  ["Basic Soup (Perfect)"] = 'png',
["Blessed Bone Offering"] = "png",
  ["Basic Soup"] = 'png',
["Ship Crow's Nest Upgrade"] = "png",
  ["Basic Bag"] = 'png',
["Extra Bank Tab"] = "png",
  ["Bag of Flour"] = 'png',
["Superior Cooking Pot"] = "png",
  ["Apple Tree Seeds"] = 'png',
["Superior Cauldron"] = "png",
  ["Apple Pie (Perfect)"] = 'png',
["Mithril Brush"] = "png",
  ["Apple Pie"] = 'png',
["Mithril Shovel"] = "png",
  ["Apple"] = 'png',
["Mithril Sieve"] = "png",
  ["Antique Vase"] = 'png',
["Mithril Trowel"] = "png",
  ["Anglerfish (Perfect)"] = 'png',
["Ship Anchor Upgrade"] = "png",
  ["Amulet of Incantation"] = 'png',
["Ship Keel Upgrade"] = "png",
  ["Alchemist's Bag"] = 'png',
["Ship Mast Upgrade"] = "png",
  ["Absorbing Shield"] = 'png',
["Ship Rudder Upgrade"] = "png",
  ["Shield of Melee Power"] = 'png',
["Ship Sails Upgrade"] = "png",
  ["Shield of Ranged Power"] = 'png',
["Ship Hull Upgrade"] = "png",
  ["Shield of Magic Power"] = 'png',
["Adamant Brush"] = "png",
  ["Ring of Power"] = 'png',
["Adamant Shovel"] = "png",
  ["Beginning of the End"] = 'png',
["Adamant Sieve"] = "png",
  ["Goo"] = 'png',
["Adamant Trowel"] = "png",
  ["Wildflower"] = 'png',
["Ancient Brush"] = "png",
  ["Nature's Call Staff Top"] = 'png',
["Ancient Shovel"] = "png",
  ["Nature's Call Staff Bottom"] = 'png',
["Ancient Sieve"] = "png",
  ["Fine Poison Powder"] = 'png',
["Ancient Trowel"] = "png",
  ["Poison Scales"] = 'png',
["Crystal Brush"] = "png",
  ["Miolite Spore"] = 'png',
["Crystal Shovel"] = "png",
  ["Poison Essence"] = 'png',
["Crystal Sieve"] = "png",
  ["Worm Spike"] = 'png',
["Crystal Trowel"] = "png",
  ["Burning Essence"] = 'png',
["Dark Steel Brush"] = "png",
  ["Cursed Hands"] = 'png',
["Dark Steel Shovel"] = "png",
  ["Stinging Essence"] = 'png',
["Dark Steel Sieve"] = "png",
  ["Tough Shell"] = 'png',
["Dark Steel Trowel"] = "png",
  ["Undead Essence"] = 'png',
["Dragon Brush"] = "png",
  ["Desecrated Bones"] = 'png',
["Dragon Shovel"] = "png",
  ["War Axe"] = 'png',
["Dragon Sieve"] = "png",
  ["Warberd"] = 'png',
["Dragon Trowel"] = "png",
  ["Throwing Power Gloves"] = 'png',
["Iron Brush"] = "png",
  ["Slingshot"] = 'png',
["Iron Shovel"] = "png",
  ["Elerine Longbow"] = 'png',
["Iron Sieve"] = "png",
  ["Elerine Spear"] = 'png',
["Iron Trowel"] = "png",
  ["Nature's Call Staff"] = 'png',
["Relic Brush"] = "png",
  ["Nature's Wrath Staff"] = 'png',
["Relic Shovel"] = "png",
  ["Nature's Blessing Ring"] = 'png',
["Relic Sieve"] = "png",
  ["Poisoned Shortbow"] = 'png',
["Relic Trowel"] = "png",
  ["Poisoned Dagger"] = 'png',
["Rune Brush"] = "png",
  ["Scaled Shield"] = 'png',
["Rune Shovel"] = "png",
  ["Poison Virulence Ring"] = 'png',
["Rune Sieve"] = "png",
  ["Poison Virulence Gloves"] = 'png',
["Rune Trowel"] = "png",
  ["Burning Madness Ring"] = 'png',
["Steel Brush"] = "png",
  ["Burning Madness Gloves"] = 'png',
["Steel Shovel"] = "png",
  ["Spiked Shell Ring"] = 'png',
["Steel Sieve"] = "png",
  ["Spiked Shell Gloves"] = 'png',
["Steel Trowel"] = "png",
  ["Relentless Fury Ring"] = 'png',
["Aranite Brush"] = "png",
  ["Relentless Fury Gloves"] = 'png',
["Aranite Shovel"] = "png",
  ["Ring of Blade Echoes"] = 'png',
["Aranite Sieve"] = "png",
  ["Ring of Barrage"] = 'png',
["Aranite Trowel"] = "png",
  ["Ring of Spirit Power"] = 'png',
["Travel Token"] = "png",
  ["Hinder Potion I"] = 'png',
["Dig Site Token"] = "png",
  ["Hinder Potion II"] = 'png',
["Summoner's Pack I"] = "png",
  ["Hinder Potion III"] = 'png',
["Summoners' Pack II"] = "png",
  ["Hinder Potion IV"] = 'png',
["Summoners' Pack III"] = "png",
  ["Famished Potion I"] = 'png',
-- Marks (Summoning), included to override the type level override above
  ["Famished Potion II"] = 'png',
["Eagle"] = "png",
  ["Famished Potion III"] = 'png',
["Owl"] = "png",
  ["Famished Potion IV"] = 'png',
["Beaver"] = "png",
  ["Lethal Toxins Potion I"] = 'png',
["Fox"] = "png",
  ["Lethal Toxins Potion II"] = 'png',
["Lightning Spirit"] = "png",
  ["Lethal Toxins Potion III"] = 'png',
["Siren"] = "png",
  ["Lethal Toxins Potion IV"] = 'png',
["Spider"] = "png",
  ["Impending Darkness"] = 'png',
["Spectre"] = "png",
  ["Mastery Token (Astrology)"] = 'png',
-- Dungeons, included to override the type level override above
  ["Stardust"] = 'png',
["Golem Territory"] = "png",
  ["Golden Stardust"] = 'png',
["Cult Grounds"] = "png",
  ["Astrology Skillcape"] = 'png',
["Trickery Temple"] = "png",
  ["Secret Stardust Potion I"] = 'png',
["Underwater City"] = "png",
  ["Secret Stardust Potion II"] = 'png',
["Underwater Ruins"] = "png",
  ["Secret Stardust Potion III"] = 'png',
["Eye-conic Cave"] = "png",
  ["Secret Stardust Potion IV"] = 'png',
["Mucky Cave"] = "png",
  ["Noxious Serpent"] = 'png',
["Lost Temple"] = "png",
  ["Venomous Snake"] = 'png',
["Ritual Site"] = "png",
  ["Legaran Wurm"] = 'png',
["Shipwreck Cove"] = "png",
  ["Spiked Red Claw"] = 'png',
}
  ["Greater Skeletal Dragon"] = 'png',
  ["Giant Moth"] = 'png',
  ["Elerine Mage"] = 'png',
  ["Elerine Warrior"] = 'png',
  ["Elerine Archer"] = 'png',
  ["Cursed Lich"] = 'png',
  ["Christmas Present (Blue)"] = 'png',
  ["Christmas Present (Green)"] = 'png',
  ["Christmas Present (Purple)"] = 'png',
  ["Christmas Present (Standard)"] = 'png',
  ["Christmas Present (White)"] = 'png',
  ["Christmas Present (Yellow)"] = 'png',
  ["Edible Candy Cane"] = 'png',
  ["Event Token (Holiday 2021)"] = 'png',
  ["Gingerbread House"] = 'png',
  ["Gingerbread Man"] = 'png',
  ["Holiday Scarf"] = 'png',
  ["Locked Chest"] = 'png',
  ["Locked Chest Key"] = 'png',
  ["Festive Chio"] = 'png',
  ["Festive Cool Rock"] = 'png',
}
}


--Some overrides only apply for a specific type
--Some overrides only apply for a specific type
local typeExtOverrides = {
local typeExtOverrides = {
['item'] = {
-- Example: ["item"] = { ["Chicken"] = "png" }
['Chicken'] = 'png'
["item"] = {
}
-- These familiars also exist as type mark, where the image is of PNG format
["Golbin Thief"] = "svg",
["Occultist"] = "svg",
["Wolf"] = "svg",
["Ent"] = "svg",
["Mole"] = "svg",
["Octopus"] = "svg",
["Minotaur"] = "svg",
["Centaur"] = "svg",
["Witch"] = "svg",
["Pig"] = "svg",
["Crow"] = "svg",
["Leprechaun"] = "svg",
["Cyclops"] = "svg",
["Yak"] = "svg",
["Unicorn"] = "svg",
["Dragon"] = "svg",
["Monkey"] = "svg",
["Salamander"] = "svg",
["Bear"] = "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"
}
}
}


--When calling for an icon of type Key, instead use type Value
--When calling for an icon of type Key, instead use type Value
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
local imgOverrides = {
local imgOverrides = {
  ['Alt Magic'] = 'Magic',
['Alt Magic'] = 'Magic',
  ['Alt. Magic'] = 'Magic',
['Alt. Magic'] = 'Magic',
  ['Alternative Magic'] = 'Magic',
['Alternative Magic'] = 'Magic',
  ['Item Alchemy'] = {'Item Alchemy III', 'spell'},
['Melee'] = {'Attack', 'skill'},
  ['Superheat'] = {'Superheat IV', 'spell'},
['Spider (lv. 51)'] = 'Spider',
  ['Melee'] = 'Combat',
['Spider (lv. 52)'] = 'Brown Spider',
  ['Spider (lv. 51)'] = 'Spider',
['Bane, Instrument of Fear'] = 'Bane',
  ['Spider (lv. 52)'] = 'Brown Spider',
['Mastery Token Astrology'] = 'Mastery Token (Astrology)',
  ['Basic Resupply'] = {'Lobster', 'item'},
['Event Token - Holiday 2021'] = 'Christmas Present (Yellow)',
  ['Standard Resupply'] = {'Crab', 'item'},
["I Can't See Helmet"] = {'Golbin', 'monster'},
  ['Generous Resupply'] = {'Shark', 'item'},
["Golbin Raid"] = {'Golden Golbin', 'pet'},
  ['Cooking Upgrade 1'] = {'Cooking', 'skill'},
["Throne of the Herald Expansion"] = 'TotH',
  ['Cooking Upgrade 2'] = {'Cooking', 'skill'},
["Atlas of Discovery Expansion"] = 'AoD',
  ['Loot Container Stacking'] = {'Amulet of Looting', 'item'},
["Dig Site Map"] = {'Extra Archaeology Map Slot', 'upgrade'},
  ['Bane, Instrument of Fear'] = 'Bane',
-- Spellbooks
  ['Mastery Token Astrology'] = 'Mastery Token (Astrology)',
["Ancient Magicks"] = {'Ancient', 'spellType'},
  ['Event Token - Holiday 2021'] = 'Christmas Present (Yellow)'
["Archaic Magicks"] = {'Archaic', 'spellType'},
["Standard Magic"] = {'Standard', 'spellType'},
["Curses"] = {'Curse', 'spellType'},
["Auroras"] = {'Aurora', 'spellType'},
-- Shop purchases
['Extra Bank Slot'] = {'Bank Slot', 'upgrade'},
['Basic Resupply'] = {'Lobster', 'item'},
['Standard Resupply'] = {'Crab', 'item'},
['Generous Resupply'] = {'Shark', 'item'},
['Plentiful Resupply'] = {'Magma Fish', 'item'},
['Bountiful Resupply'] = {'Static Jellyfish', 'item'},
['Cooking Upgrade 1'] = {'Cooking', 'skill'},
['Cooking Upgrade 2'] = {'Cooking', 'skill'},
['Loot Container Stacking'] = {'Amulet of Looting', 'item'},
['Access to Throne of the Herald'] = {'Golden Key', 'item'},
["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
['Item Alchemy'] = {'Item Alchemy III', 'spell'},
['Superheat'] = {'Superheat IV', 'spell'},
["Holy Invocation I"] = {'Small Urn', 'item'},
["Holy Invocation II"] = {'Medium Urn', 'item'},
["Nullification"] = {'Rune Essence', 'item'},
["Transmutation"] = {'Oricha', 'item'},
["Purification"] = {'Pure Essence', 'item'},
["Fragmentation"] = {'Summoning Shard (Black)', 'item'},
["Holy Invocation III"] = {'Large Urn', '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
['Melee Accuracy Potion'] = {'Melee Accuracy Potion I', 'item'},
['Melee Evasion Potion'] = {'Melee Evasion Potion I', 'item'},
['Ranged Assistance Potion'] = {'Ranged Assistance Potion I', 'item'},
['Hinder Potion'] = {'Hinder Potion I', 'item'},
['Magic Assistance Potion'] = {'Magic Assistance Potion I', 'item'},
['Regeneration Potion'] = {'Regeneration Potion I', 'item'},
['Famished Potion'] = {'Famished Potion I', 'item'},
['Ranged Strength Potion'] = {'Ranged Strength Potion I', 'item'},
['Lucky Herb Potion'] = {'Lucky Herb Potion I', 'item'},
['Divine Potion'] = {'Divine Potion I', 'item'},
['Melee Strength Potion'] = {'Melee Strength Potion I', 'item'},
['Magic Damage Potion'] = {'Magic Damage Potion I', 'item'},
['Lethal Toxins Potion'] = {'Lethal Toxins Potion I', 'item'},
['Diamond Luck Potion'] = {'Diamond Luck Potion I', 'item'},
['Damage Reduction Potion'] = {'Damage Reduction Potion I', 'item'},
['Area Control Potion'] = {'Area Control Potion I', 'item'},
['Adaptive Defence Potion'] = {'Adaptive Defence Potion I', 'item'},
['Slayer Bounty Potion'] = {'Slayer Bounty Potion I', 'item'},
['Holy Bulwark Potion'] = {'Holy Bulwark Potion I', 'item'},
['Adaptive Accuracy Potion'] = {'Adaptive Accuracy Potion I', 'item'},
['Reaper Potion'] = {'Reaper Potion I', 'item'},
['Penetration Potion'] = {'Penetration Potion I', 'item'},
['Critical Strike Potion'] = {'Critical Strike Potion I', 'item'},
['Bird Nest Potion'] = {'Bird Nest Potion I', 'item'},
['Controlled Heat Potion'] = {'Controlled Heat Potion I', 'item'},
['Generous Cook Potion'] = {'Generous Cook Potion I', 'item'},
['Seeing Gold Potion'] = {'Seeing Gold Potion I', 'item'},
['Fishermans Potion'] = {'Fishermans Potion I', 'item'},
['Skilled Fletching Potion'] = {'Skilled Fletching Potion I', 'item'},
['Gentle Hands Potion'] = {'Gentle Hands Potion I', 'item'},
['Secret Stardust Potion'] = {'Secret Stardust Potion I', 'item'},
['Crafting Potion'] = {'Crafting Potion I', 'item'},
['Perfect Swing Potion'] = {'Perfect Swing Potion I', 'item'},
['Necromancer Potion'] = {'Necromancer Potion I', 'item'},
['Performance Enhancing Potion'] = {'Performance Enhancing Potion I', 'item'},
['Elemental Potion'] = {'Elemental Potion I', 'item'},
['Herblore Potion'] = {'Herblore Potion I', 'item'},
['Generous Harvest Potion'] = {'Generous Harvest Potion I', 'item'},
['Alchemic Practice Potion'] = {'Alchemic Practice Potion I', 'item'},
['Gem Detector Potion'] = {'Gem Detector Potion I', 'item'},
['Multicooker Potion'] = {'Multicooker Potion I', 'item'},
['Star Seeker Potion'] = {'Star Seeker Potion I', 'item'},
['Traps Potion'] = {'Traps Potion I', 'item'},
['Blacksmith Potion'] = {'Blacksmith 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'},
['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
['GP'] = {'Coins', ''},
['Food'] = {'Raw Beef', 'item'},
['Ore'] = {'Iron', 'rock'},
['Bar'] = {'Iron Bar', 'item'},
['Herbs'] = {'Garum Herb', 'item'},
['Clothing'] = {'Leather Body', 'item'},
-- Township generic statue building
['Statue of Worship'] = 'Statue of Nothing',
-- Township seasons
["Lemon Season"] = 'Spring',
-- Easter egg stuff
["Lemonade (Empty)"] = "Lemonade",
["Lemonade (Very empty)"] = "Lemonade",
["Lemonade (Still very empty)"] = "Lemonade",
["Lemonade (Not as empty as before)"] = "Lemonade",
["Lemonade (Not much)"] = "Lemonade",
["Lemonade (Has a bit now)"] = "Lemonade",
["Lemonade (A little bit more now)"] = "Lemonade",
["Lemonade (Half full)"] = "Lemonade",
["Lemonade (Just over half full)"] = "Lemonade",
["Lemonade (Maybe this is half full?)"] = "Lemonade",
["Lemonade (Nope this is half full now)"] = "Lemonade",
["Lemonade (Wow this is slow)"] = "Lemonade",
["Lemonade (Just fill it up already)"] = "Lemonade",
["Lemonade (Still not full)"] = "Lemonade",
["Lemonade (Again, still not full)"] = "Lemonade",
["Lemonade (Less than before because you drank some)"] = "Lemonade",
["Lemonade (Back to where we were before)"] = "Lemonade",
["Lemonade (Almost full)"] = "Lemonade",
["Lemonade (Still almost full)"] = "Lemonade",
["Lemonade (How full is it supposed to be?)"] = "Lemonade",
["Lemonade (Wait this might be half full now)"] = "Lemonade",
["Lemonade (Haha just joking, hurry up)"] = "Lemonade",
["Lemonade (Okay this looks pretty full now)"] = "Lemonade",
["Lemonade (Now?)"] = "Lemonade",
["Lemonade (What about now?)"] = "Lemonade",
["Lemonade (YAY ITS FINALLY FULL!)"] = "Lemonade",
["Lemonade (Oh... still not full)"] = "Lemonade",
["Lemonade (Wait for it)"] = "Lemonade",
["Lemonade (Wait for it!)"] = "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
local typeImgOverrides = {
['resource'] = {
['Rune Essence'] = {'Rune Essence', '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'}
}
}
}
--When calling for an icon for Key, the link goes to Value
--When calling for an icon for Key, the link goes to Value
local linkOverrides = {
local linkOverrides = {
  ['Alt Magic'] = 'Alternative Magic',
['Alt Magic'] = 'Alternative Magic',
  ['Alt. Magic'] = 'Alternative Magic',
['Alt. Magic'] = 'Alternative Magic',
  ['Spider2'] = 'Brown Spider',
['Spider2'] = 'Brown Spider',
  ["Deedree"] = 'Astrology#Constellations',
['Earth Golem (AoD)'] = 'Earth Golem (AoD)'
  ["Iridan"] = 'Astrology#Constellations',
}
  ["Ameria"] = 'Astrology#Constellations',
--When calling for an icon for Key + Type, the link goes to Value
  ["Terra"] = 'Astrology#Constellations',
local typeLinkOverrides = {
  ["Vale"] = 'Astrology#Constellations',
['biome'] = {
  ["Syllia"] = 'Astrology#Constellations',
['Grasslands'] = 'Biomes',
  ["Arachi"] = 'Astrology#Constellations',
['Forest'] = 'Biomes',
  ["Ko"] = 'Astrology#Constellations',
['Mountains'] = 'Biomes',
  ["Tellus"] = 'Astrology#Constellations',
['Water'] = 'Biomes',
  ["Hyden"] = 'Astrology#Constellations',
['Swamp'] = 'Biomes',
  ["Qimican"] = 'Astrology#Constellations'
['Valley'] = 'Biomes',
['Arid Plains'] = 'Biomes',
['Jungle'] = 'Biomes',
['Desert'] = 'Biomes',
['Snowlands'] = 'Biomes'
},
['resource'] = {
-- Township resources
['Food'] = '',
['Wood'] = '',
['Planks'] = '',
['Stone'] = '',
['Bar'] = '',
['Ore'] = '',
['Coal'] = '',
['Rune Essence'] = '',
['Herbs'] = '',
['Potions'] = '',
['Leather'] = '',
['Clothing'] = ''
},
['spellType'] = {
-- Spellbooks
['Standard'] = 'Standard Magic',
['Ancient'] = 'Ancient Magicks',
['Archaic'] = 'Archaic Magicks',
['Curse'] = 'Curses',
['Aurora'] = 'Auroras'
},
['township'] = {
['Workers'] = '',
['Statistics'] = '',
['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
local ambiguousOverrides = {
['Golbin'] = true,
['Chick'] = true,
['Chicken'] = true,
['Cyclops'] = true,
['Wizard'] = true,
['Spider'] = true,
['Necromancer'] = true,
['Dark Knight'] = true,
['Vampire'] = true,
['Phantom'] = true,
['Spectre'] = true,
['Siren'] = 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
local imgClassOverrides = {
-- Was previously used for Township stat icons prior to v1.1.2
--['Population'] = 'township-colortoggle'
}
}
--Ambiguous overrides section
local ambiguousOverrides = {'Golbin', 'Chick', 'Chicken', 'Cyclops', 'Wizard'}


function p.Icon(frame)
function p.Icon(frame)
  local args = frame.args ~= nil and frame.args or frame
local args = frame.args ~= nil and frame.args or frame
  local link = args[1]
local link = args[1]
  local text = args[2]
local text = args[2]
  local iconType = args.type
local iconType = args.type
  local ext = args.ext ~= nil and args.ext ~= '' and args.ext or 'svg'
local ext = args.ext ~= nil and args.ext ~= '' and args.ext or 'png'
  local notext = args.notext ~= nil and args.notext ~= ''
local notext = args.notext ~= nil and args.notext ~= ''
  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 menu = args.menu ~= nil and args.menu ~= ''
local nospan = args.nospan ~= nil and args.nospan
  local imgSize = args.size ~= nil and args.size or 25
local menu = args.menu ~= nil and args.menu ~= ''
  local qty = args.qty
local imgSize = args.size ~= nil and args.size or 25
  local img = args.img ~= nil and args.img ~= '' and args.img or link
local qty = args.qty
local img = args.img ~= nil and args.img ~= '' and args.img or link
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 linkSection = args.section
local expIcon = args.expicon ~= nil and args.expicon or ''


  link = Shared.fixPagename(link)
link = fixPagename(link)
  img = Shared.fixPagename(img)
img = fixPagename(img)
 
img = sgsub(img, '#', '')
img = sgsub(img, '/Training', '')
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, '#', '')
 
-- Handle types for which links should be to a section of a static page
local sl = sectionLinks[iconType]
if sl ~= nil and not sl.exclude[link] then
if text == nil or text == '' then
text = link
end
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
 
--MANUAL OVERRIDES
local origType = iconType
local ovrImg = imgOverrides[link]
local ovrTypeImg = typeImgOverrides[iconType]
if ovrTypeImg ~= nil then
ovrImg = ovrTypeImg ~= nil and ovrTypeImg[img] or ovrImg
end
local ovrTxt = txtOverrides[link]
local ovrLink = linkOverrides[link]
local ovrTypeLink = typeLinkOverrides[iconType]
if ovrTypeLink ~= nil and ovrTypeLink[img] ~= nil then
if ovrTypeLink[img] == '' then
nolink = true
else
ovrLink = ovrTypeLink[img]
end
end
local hasText = (text ~= nil and text ~= '')
if ovrImg ~= nil and img == link then
if type(ovrImg) == 'string' then
img = ovrImg
elseif type(ovrImg) == 'table' then
img = ovrImg[1]
if ovrImg[2] ~= nil then iconType = ovrImg[2] end
end
end
local ovrClass = imgClassOverrides[link]
-- Type & extension overrides must be after adjustments have been made
-- for any image overrides
local ovrTypeExt, ovrTypeExtTable = nil, typeExtOverrides[iconType]
if ovrTypeExtTable ~= nil then
ovrTypeExt = ovrTypeExtTable[img]
end
local ovrType = typeOverrides[iconType]
local ovrExt = extOverrides.name[img]
if ovrExt == nil then
ovrExt = extOverrides.type[ovrType or iconType]
end
if not hasText and ovrTxt ~= nil then
text = ovrTxt
hasText = true
end
if ovrLink ~= nil then
if not hasText then
text = link
hasText = true
end
link = ovrLink
end
if ovrTypeExt ~= nil then
ext = ovrTypeExt
elseif ovrExt ~= nil then
ext = ovrExt
end
if ovrType ~= nil then
iconType = ovrType
end
if ovrClass ~= nil then
class = ovrClass
end
-- There are a couple specific double overrides to be included that don't fit in the above lists


  img = string.gsub(img, '#', '')
-- If the link requires disambiguation or a section, the modify the link accordingly
  img = string.gsub(img, '/Training', '')
-- while preserving the displayed text
  img = string.gsub(img, '/Guide', '')
local isAmbig, hasSection = ambiguousOverrides[link], linkSection ~= nil and linkSection ~= ''
  link = string.gsub(link, '#', '')
if isAmbig or hasSection then
  --MANUAL OVERRIDES
if not hasText then
  if imgOverrides[link] ~= nil and img == link then
text = link
  local ovr = imgOverrides[link]
hasText = true
  if type(ovr) == 'string' then
end
  img = imgOverrides[link]
if isAmbig then
elseif type(ovr) == 'table' then
link = link .. ' (' .. (ambiguousTypeMap[origType] or origType) .. ')'
  img = ovr[1]
end
  if ovr[2] ~= nil then iconType = ovr[2] end
if hasSection then
link = link .. '#' .. linkSection
end
end
end
  end
  if (text == nil or text == '') and txtOverrides[link] ~= nil then
    text = txtOverrides[link]
  end
  if linkOverrides[link] ~= nil then
    if (text == nil or text == '') then text = link end
    link = linkOverrides[link]
  end
  if typeExtOverrides[iconType] ~= nil and typeExtOverrides[iconType][img] ~= nil then
  ext = typeExtOverrides[iconType][img]
  elseif extOverrides[img] ~= nil then
    ext = extOverrides[img]
  elseif iconType == 'mark' then
    ext = 'png'
  end
  if typeOverrides[iconType] ~= nil then
    iconType = typeOverrides[iconType]
  end
  --There are a couple specific double overrides I want to include that don't fit in the above lists
  if Shared.contains(ambiguousOverrides, link) then
    if (text == nil or text == '') then text = link end
    link = link..' ('..(iconType == 'mark' and 'item' or iconType)..')'
  end


  local result = ''
local resultText = ''
  if not noicon then
if not noicon then
--Creating the image...
-- Image size
result = '[[File:'..img
local txtSize = tostring(imgSize)
--Add in type if one is set
-- Extension and type if one is set
if iconType ~= nil and iconType ~= '' then result = result..'_('..iconType..')' end
local txtImg = (iconType ~= nil and iconType ~= '' and img .. '_(' .. iconType .. ')' or img) .. '.' .. ext
--Add in extension and image size
-- Include a link unless no link -and- no text was requested
result = result..'.'..ext..'|'..tostring(imgSize)..'x'..tostring(imgSize)..'px'
local txtLink = '|link=' .. (nolink and '' or link)
--Include a link unless no link -and- no text was requested
resultText = '[[File:' .. txtImg .. '|' .. txtSize .. 'x' .. txtSize .. 'px|alt=' .. altText .. txtLink .. ']]'
if not (nolink and notext) then result = result..'|link='..link end
if class ~= nil and class ~= '' then
result = result..']]'
resultText = '<span class="'..class..'">'..resultText..'</span>'
  end
end
 
end
  --Add Quantity to the front if requested
  if qty ~= nil and qty ~= '' then result = Shared.formatnum(qty)..' '..result end


  if not notext then
if not notext then
  -- If the result is currently empty then there's no need to pad with whitespace
if nolink then
  local padStr = (string.len(result) > 0 and ' ' or '')
resultText = resultText .. (noicon and '' or ' ') .. (hasText and text or link)
    if nolink then
else
      if text ~= nil and text ~= '' then
resultText = resultText .. (noicon and '' or ' ') .. '[[' .. link .. (hasText and text ~= link and '|' .. text or '') .. ']]'
        result = result..padStr..text
end
      else
end
        result = result..padStr..link
      end
    else
      result = result..padStr..'[['..link
      if text ~= nil and text ~= '' and text ~= link then
        result = result..'|'..text
      end
      result = result..']]'
    end
  end
 
  if not noicon then
    result = '<span style="display:inline-block">'..result..'</span>'
  end


  if menu then
-- Add Quantity to the front if requested
    result = '{| class="articletable" style="display:inline-block;vertical-align:middle;"\r\n|-\r\n|'..result
--local resultQty = (qty ~= nil and qty ~= '' and formatnum(qty) .. ' ' or '')
    result = result..'\r\n|}'
if qty ~= nil and qty ~= '' then
  end
resultText = formatnum(qty) .. ' ' .. resultText
end


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


Line 398: Line 805:


function p._SkillReq(skill, level, showText)
function p._SkillReq(skill, level, showText)
  local result = p.Icon({skill, type='skill', notext='true'})
local altText = (showText and '') or skill
  if showText then
local result = p.Icon({skill, type='skill', notext=(showText and '' or true), nospan=true, alt=altText})
    result = result..' [['..skill..']]'
if level == nil then level = 'Unknown [[Category:Pages with script errors]]' end
  end
result = result.." Level "..level
  if level == nil then level = 'Unknown [[Category:Pages with script errors]]' end
  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


function p.SkillReq(frame)
function p.SkillReq(frame)
  local args = frame.args ~= nil and frame.args or frame
local args = frame.args ~= nil and frame.args or frame
  local skill = args[1]
local skill = args[1]
  local level = tonumber(args[2])
local level = tonumber(args[2])
  local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
  return p._SkillReq(skill, level, showText)
return p._SkillReq(skill, level, showText)
end
end


function p._MasteryReq(itemName, level, showText)
function p._MasteryReq(itemName, level, showText)
  local iconname = itemName
local iconname = itemName
  local linkname = itemName
local linkname = itemName
  --First, go with the lowest tier of potions if a potion is mentioned
--First, go with the lowest tier of potions if a potion is mentioned
  local s, e = string.find(itemName, 'Potion')
local s, e = string.find(itemName, 'Potion')
  if e ~= nil then
if e ~= nil then
    linkname = string.sub(itemName, 1, e)
linkname = string.sub(itemName, 1, e)
    iconname = linkname..' I'
iconname = linkname..' I'
  end
end
local altTextItem = (showText and '') or linkname
local altTextMastery = (showText and '') or '&nbsp;Mastery'


  local result = 'Level '..level..' '
local result = 'Level '..level..' '
  result = result..p.Icon({linkname, img=iconname, type='item', notext = true})..p.Icon({'Mastery', notext=true})
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


function p.MasteryReq(frame)
function p.MasteryReq(frame)
  local args = frame.args ~= nil and frame.args or frame
local args = frame.args ~= nil and frame.args or frame
  local itemName = args[1]
local itemName = args[1]
  local level = tonumber(args[2])
local level = tonumber(args[2])
  local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
  return p._MasteryReq(itemName, level, showText)
return p._MasteryReq(itemName, level, showText)
end
end


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


function p.GP(amt, maxamt)
function p.GP(amt, maxamt)
  return p._Currency('Coins.svg', 'Coins', amt, maxamt)
return p._Currency('Coins.svg', 'Coins', 'GP', amt, maxamt)
end
end


function p.SC(amt, maxamt)
function p.SC(amt, maxamt)
  return p._Currency('Slayer Coins.svg', 'Currency#Slayer Coins', amt, maxamt)
return p._Currency('Slayer Coins.svg', 'Currency#Slayer Coins', 'SC', amt, maxamt)
end
end


function p.RC(amt, maxamt)
function p.RC(amt, maxamt)
  return p._Currency('Raid_Coins.svg', 'Currency#Raid Coins', amt, maxamt)
return p._Currency('Raid_Coins.svg', 'Currency#Raid Coins', 'RC', amt, maxamt)
end
 
--Adding a shortcut function for this
function p.TotH()
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
 
function p.getExpansionIcon(id)
local ns, _ = Shared.getLocalID(id)
if ns == 'melvorTotH' then
return p.TotH()..' '
elseif ns == 'melvorAoD' then
return p.AoD()..' '
else
return ''
end
end
end


return p
return p