Module:Icons: Difference between revisions

From Melvor Idle
(Amend Melee image override)
(Amend extension overrides & default extension - The majority of images are now of type PNG rather than SVG)
Line 8: Line 8:


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",
["spell"] = "svg",
["Jewel of Rhaelyx"] = "png",
["curse"] = "svg", -- Some exceptions included by name below
["Circlet of Rhaelyx"] = "png",
["aurora"] = "svg",
["Charge Stone of Rhaelyx"] = "png",
["combatArea"] = "svg",
["Mysterious Stone"] = "png",
["dungeon"] = "svg",
["Lemon"] = "jpg",
["prayer"] = "svg",
["Lemons"] = "jpg",
["upgrade"] = "svg", -- Some exceptions included by name below
["Lemonade"] = "jpg",
["tree"] = "svg",
["Miolite Sprig"] = "png",
["rock"] = "svg", -- Some exceptions included by name below
["Miolite Trio"] = "png",
["thieving"] = "svg",
["Miolite Warden"] = "png",
["mark"] = "svg", -- Some exceptions included by name below
["Miolite Monarch"] = "png",
["constellation"] = "svg",
["Wicked Greater Dragon"] = "png",
["building"] = "svg"
["Hunting Greater Dragon"] = "png",
},
["Chaotic Greater Dragon"] = "png",
["name"] = {
["Beavis"] = "png",
-- General
["Pudding Duckie"] = "png",
["Adventure"] = "png",
["Pyro"] = "png",
-- Items
["Snek"] = "png",
["Amulet of Fishing"] = "svg",
["Larry, the Lonely Lizard"] = "png",
["Lemon"] = "jpg",
["Caaarrrlll"] = "png",
["Lemons"] = "jpg",
["Gronk"] = "png",
["Lemonade"] = "jpg",
["Finn, the Cat"] = "png",
["Ancient Crossbow"] = "svg",
["Marahute"] = "png",
["Air Shard"] = "svg",
["Monk-ey"] = "png",
["Water Shard"] = "svg",
["Asura"] = "png",
["Earth Shard"] = "svg",
["Summoning Shard (Silver)"] = "png",
["Fire Shard"] = "svg",
["Summoning Shard (Red)"] = "png",
["Confetti Crossbow"] = "svg",
["Summoning Shard (Green)"] = "png",
["Cloudburst Staff"] = "gif",
["Summoning Shard (Gold)"] = "png",
["Shockwave"] = "svg",
["Summoning Shard (Blue)"] = "png",
["Golbin Thief"] = "svg",
["Summoning Shard (Black)"] = "png",
["Occultist"] = "svg",
['Infernal Core'] = 'png',
["Wolf"] = "svg",
['Cool Glasses'] = 'png',
["Ent"] = "svg",
["Wizard's Sigil"] = 'png',
["Mole"] = "svg",
["Wizard's Scroll"] = 'png',
["Octopus"] = "svg",
["Whetstone"] = 'png',
["Minotaur"] = "svg",
["Whale (Perfect)"] = 'png',
["Centaur"] = "svg",
["Trout (Perfect)"] = 'png',
["Witch"] = "svg",
["Training Shield"] = 'png',
["Pig"] = "svg",
["Thiever's Cape"] = 'png',
["Crow"] = "svg",
["Thief's Moneysack"] = 'png',
["Leprechaun"] = "svg",
["Swordfish (Perfect)"] = 'png',
["Cyclops"] = "svg",
["Strawberry Cupcake (Perfect)"] = 'png',
["Yak"] = "svg",
["Strawberry Cupcake"] = 'png',
["Unicorn"] = "svg",
["Strawberry Cake (Perfect)"] = 'png',
["Dragon"] = "svg",
["Strawberry Cake"] = 'png',
["Monkey"] = "svg",
["Stack of Bones"] = 'png',
["Salamander"] = "svg",
["Sneak-Ers"] = 'png',
["Bear"] = "svg",
["Shrimp (Perfect)"] = 'png',
["Devil"] = "svg",
["Shipwheel"] = 'png',
-- Pets
["Shark (Perfect)"] = 'png',
["Cris"] = "svg",
["Seed Pouch"] = 'png',
["Cool Rock"] = "svg",
["Seahorse (Perfect)"] = 'png',
["Puff, the Baby Dragon"] = "svg",
["Sardine (Perfect)"] = 'png',
["Bruce"] = "svg",
["Salmon (Perfect)"] = 'png',
["Lil Ron"] = "svg",
["Sailor's Top"] = 'png',
["Leonardo"] = "svg",
["Runecrafting Pouch"] = 'png',
["Golden Golbin"] = "svg",
["Ring of Wealth"] = 'png',
["Ty"] = "svg",
["Raw Chicken"] = 'png',
["Ripper the Reindeer"] = "svg",
["Raw Beef"] = 'png',
["Chick"] = "svg",
["Prayer Scroll"] = 'png',
["Zarrah"] = "svg",
["Plain Pizza Slice (Perfect)"] = 'png',
["Chio"] = "svg",
["Plain Pizza Slice"] = 'png',
["Bouncing Bob"] = "svg",
["Pile of Ores"] = 'png',
["Rosey"] = "svg",
["Pile of Logs"] = 'png',
["Ayyden"] = "svg",
["Miner's Helmet"] = 'png',
["Arctic Yeti"] = "svg",
["Merchant's Permit"] = 'png',
["Mac"] = "svg",
["Meat Pizza Slice (Perfect)"] = 'png',
["Jerry the Giraffe"] = "svg",
["Meat Pizza Slice"] = 'png',
["Preston the Platypus"] = "svg",
["Marksman's Sigil"] = 'png',
["Quill"] = "svg",
["Manta Ray (Perfect)"] = 'png',
["Gunter"] = "svg",
["Lumberjack's Top"] = 'png',
["Salem"] = "svg",
["Lobster (Perfect)"] = 'png',
["Peri"] = "svg",
["Lemon Cake (Perfect)"] = 'png',
["Otto"] = "svg",
["Lemon Cake"] = 'png',
["Jelly Jim"] = "svg",
["Knight's Sigil"] = 'png',
["Harley"] = "svg",
["Knight's Defender"] = 'png',
["Singe"] = "svg",
["Knight's Cape"] = 'png',
["Aquarias"] = "svg",
["Jeweled Necklace"] = 'png',
["Norman"] = "svg",
["Jester's Hat"] = 'png',
["Erran"] = "svg",
["Jadestone"] = 'png',
["Ren"] = "svg",
["Herring (Perfect)"] = 'png',
["Pablo"] = "svg",
["Hearty Soup (Perfect)"] = 'png',
["Sam"] = "svg",
["Hearty Soup"] = 'png',
["Tim the Wolf"] = "svg",
["Gold Crested Shield"] = 'png',
["Mark"] = "svg",
["Golbin Mask"] = 'png',
["Astro"] = "svg",
["Giant Club"] = 'png',
-- Curses, included to override the type level override above
["Fishing Hook"] = 'png',
["Madness"] = "png",
["Fine Coinpurse"] = 'png',
["Torment"] = "png",
["Fanfish (Perfect)"] = 'png',
["Despair"] = "png",
["Cream Corn Soup (Perfect)"] = 'png',
-- Upgrades, included to override the type level override above
["Cream Corn Soup"] = 'png',
["Golbin Crate"] = "png",
["Cream"] = 'png',
["Corundum Axe"] = "png",
["Crate of Food"] = 'png',
["Augite Axe"] = "png",
["Crate of Basic Supplies"] = 'png',
["Meteorite Axe"] = "png",
["Crab (Perfect)"] = 'png',
["Divine Axe"] = "png",
["Cooking Apron"] = 'png',
["Spruce Cooking Fire"] = "png",
["Chicken Soup (Perfect)"] = 'png',
["Elderwood Cooking Fire"] = "png",
["Chicken Soup"] = 'png',
["Carrion Cooking Fire"] = "png",
["Chicken (Perfect)"] = 'png',
["Iridium Pot"] = "png",
["Chest of Gems"] = 'png',
["Palladium Pot"] = "png",
["Cherry Seeds"] = 'png',
["Divine Pot"] = "png",
["Cherry Cupcake (Perfect)"] = 'png',
["Corundum Furnace"] = "png",
["Cherry Cupcake"] = 'png',
["Augite Furnace"] = "png",
["Cherry"] = 'png',
["Divine Furnace"] = "png",
["Chef's Spoon"] = 'png',
["Sign of the Stars"] = "png",
["Chef's Hat"] = 'png',
["Summoner's Altar"] = "png",
["Cheese"] = 'png',
["Golden Shard"] = "png",
["Cave Giant Boots"] = 'png',
-- Rocks (Mining), included to override the type level override above
["Cave Fish (Perfect)"] = 'png',
["Rune Essence"] = "png",
["Carrot Cake (Perfect)"] = 'png',
["Pure Essence"] = "png",
["Carrot Cake"] = 'png',
["Onyx"] = "png",
["Carp (Perfect)"] = 'png',
["Oricha"] = "png",
["Bread (Perfect)"] = 'png',
["Cerulean"] = "png",
["Bread"] = 'png',
-- Marks (Summoning), included to override the type level override above
["Book of Scholars"] = 'png',
["Eagle"] = "png",
["Bob's Gloves"] = 'png',
["Owl"] = "png",
["Beef Pie (Perfect)"] = 'png',
["Beaver"] = "png",
["Beef Pie"] = 'png',
["Fox"] = "png",
["Beef (Perfect)"] = 'png',
["Lightning Spirit"] = "png",
["Beef"] = 'png',
["Siren"] = "png",
["Basic Soup (Perfect)"] = 'png',
["Spider"] = "png",
["Basic Soup"] = 'png',
["Spectre"] = "png"
["Basic Bag"] = 'png',
}
["Bag of Flour"] = 'png',
["Apple Tree Seeds"] = 'png',
["Apple Pie (Perfect)"] = 'png',
["Apple Pie"] = 'png',
["Apple"] = 'png',
["Antique Vase"] = 'png',
["Anglerfish (Perfect)"] = 'png',
["Amulet of Incantation"] = 'png',
["Alchemist's Bag"] = 'png',
["Absorbing Shield"] = 'png',
["Shield of Melee Power"] = 'png',
["Shield of Ranged Power"] = 'png',
["Shield of Magic Power"] = 'png',
["Ring of Power"] = 'png',
["Beginning of the End"] = 'png',
["Goo"] = 'png',
["Wildflower"] = 'png',
["Nature's Call Staff Top"] = 'png',
["Nature's Call Staff Bottom"] = 'png',
["Fine Poison Powder"] = 'png',
["Poison Scales"] = 'png',
["Miolite Spore"] = 'png',
["Poison Essence"] = 'png',
["Worm Spike"] = 'png',
["Burning Essence"] = 'png',
["Cursed Hands"] = 'png',
["Stinging Essence"] = 'png',
["Tough Shell"] = 'png',
["Undead Essence"] = 'png',
["Desecrated Bones"] = 'png',
["War Axe"] = 'png',
["Warberd"] = 'png',
["Throwing Power Gloves"] = 'png',
["Slingshot"] = 'png',
["Elerine Longbow"] = 'png',
["Elerine Spear"] = 'png',
["Nature's Call Staff"] = 'png',
["Nature's Wrath Staff"] = 'png',
["Nature's Blessing Ring"] = 'png',
["Poisoned Shortbow"] = 'png',
["Poisoned Dagger"] = 'png',
["Scaled Shield"] = 'png',
["Poison Virulence Ring"] = 'png',
["Poison Virulence Gloves"] = 'png',
["Burning Madness Ring"] = 'png',
["Burning Madness Gloves"] = 'png',
["Spiked Shell Ring"] = 'png',
["Spiked Shell Gloves"] = 'png',
["Relentless Fury Ring"] = 'png',
["Relentless Fury Gloves"] = 'png',
["Ring of Blade Echoes"] = 'png',
["Ring of Barrage"] = 'png',
["Ring of Spirit Power"] = 'png',
["Hinder Potion I"] = 'png',
["Hinder Potion II"] = 'png',
["Hinder Potion III"] = 'png',
["Hinder Potion IV"] = 'png',
["Famished Potion I"] = 'png',
["Famished Potion II"] = 'png',
["Famished Potion III"] = 'png',
["Famished Potion IV"] = 'png',
["Lethal Toxins Potion I"] = 'png',
["Lethal Toxins Potion II"] = 'png',
["Lethal Toxins Potion III"] = 'png',
["Lethal Toxins Potion IV"] = 'png',
["Impending Darkness"] = 'png',
["Mastery Token (Astrology)"] = 'png',
["Stardust"] = 'png',
["Golden Stardust"] = 'png',
["Astrology Skillcape"] = 'png',
["Secret Stardust Potion I"] = 'png',
["Secret Stardust Potion II"] = 'png',
["Secret Stardust Potion III"] = 'png',
["Secret Stardust Potion IV"] = 'png',
["Noxious Serpent"] = 'png',
["Venomous Snake"] = 'png',
["Legaran Wurm"] = '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',
["Mastery Tokens"] = 'gif',
["Enchanted Topaz Bolts"] = 'png',
["Enchanted Sapphire Bolts"] = 'png',
["Enchanted Ruby Bolts"] = 'png',
["Enchanted Emerald Bolts"] = 'png',
["Enchanted Diamond Bolts"] = 'png',
["Enchanted Jadestone Bolts"] = 'png',
["Poison Ring"] = 'png',
["Burning Ring"] = 'png',
["Frostburn Ring"] = 'png',
["Ultima Godsword"] = 'png',
["Mystery Wand"] = 'png',
["Poison Arrows"] = 'png',
["Fire Arrows"] = 'png',
["Frostburn Arrows"] = 'png',
["Burning Wand"] = 'png',
["Frostburn Wand"] = 'png',
["Ring of Balance"] = 'png',
["Flying Cape"] = 'png',
["Amulet of Healing"] = 'png',
["Sword of Some Reliability"] = 'png',
["One Layer Shield"] = 'png',
["Warding Shield"] = 'png',
["Tilted Crossbow"] = 'png',
["Ultimate Speed Boots"] = 'png',
["Almighty Ring"] = 'png',
["Punching Bag Platebody"] = 'png',
["Precision Gloves"] = 'png',
["Heavy Gloves"] = 'png',
["Ultimate Slapping Gloves"] = 'png',
["Amulet of Burning Leech"] = 'png',
["Amulet of Poison Leech"] = 'png',
["Magic Critical Amulet"] = 'png',
["Melee Critical Amulet"] = 'png',
["Bloodthirst Amulet"] = 'png',
["Dragon Head Helmet"] = 'png',
["Stonewall Shield"] = 'png',
["Impossible Longbow"] = 'png',
["Throwing Dragon Sword"] = 'png',
["Golbin Crate"] = 'png',
["Bone"] = 'png',
["Tidal Edge"] = 'png',
["Darksteel Dagger"] = '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'
}
}
}


Line 379: Line 236:
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 ~= ''
Line 415: Line 272:
ovrTypeExt = ovrTypeExt[img]
ovrTypeExt = ovrTypeExt[img]
end
end
local ovrExt = extOverrides[img]
local ovrType = typeOverrides[iconType]
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
if not hasText and ovrTxt ~= nil then
text = ovrTxt
text = ovrTxt
Line 432: Line 292:
elseif ovrExt ~= nil then
elseif ovrExt ~= nil then
ext = ovrExt
ext = ovrExt
elseif iconType == 'mark' then
ext = 'png'
end
end
if ovrType ~= nil then
if ovrType ~= nil then

Revision as of 19:59, 15 October 2022

Documentation for this module may be created at Module:Icons/doc

--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.
--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 = {}
--Extension overrides for items that have non-png images
--Name level overrides take precedence over type level overrides
local extOverrides = {
	["type"] = {
		["spell"] = "svg",
		["curse"] = "svg", -- Some exceptions included by name below
		["aurora"] = "svg",
		["combatArea"] = "svg",
		["dungeon"] = "svg",
		["prayer"] = "svg",
		["upgrade"] = "svg", -- Some exceptions included by name below
		["tree"] = "svg",
		["rock"] = "svg", -- Some exceptions included by name below
		["thieving"] = "svg",
		["mark"] = "svg", -- Some exceptions included by name below
		["constellation"] = "svg",
		["building"] = "svg"
	},
	["name"] = {
		-- General
		["Adventure"] = "png",
		-- Items
		["Amulet of Fishing"] = "svg",
		["Lemon"] = "jpg",
		["Lemons"] = "jpg",
		["Lemonade"] = "jpg",
		["Ancient Crossbow"] = "svg",
		["Air Shard"] = "svg",
		["Water Shard"] = "svg",
		["Earth Shard"] = "svg",
		["Fire Shard"] = "svg",
		["Confetti Crossbow"] = "svg",
		["Cloudburst Staff"] = "gif",
		["Shockwave"] = "svg",
		["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",
		-- Pets
		["Cris"] = "svg",
		["Cool Rock"] = "svg",
		["Puff, the Baby Dragon"] = "svg",
		["Bruce"] = "svg",
		["Lil Ron"] = "svg",
		["Leonardo"] = "svg",
		["Golden Golbin"] = "svg",
		["Ty"] = "svg",
		["Ripper the Reindeer"] = "svg",
		["Chick"] = "svg",
		["Zarrah"] = "svg",
		["Chio"] = "svg",
		["Bouncing Bob"] = "svg",
		["Rosey"] = "svg",
		["Ayyden"] = "svg",
		["Arctic Yeti"] = "svg",
		["Mac"] = "svg",
		["Jerry the Giraffe"] = "svg",
		["Preston the Platypus"] = "svg",
		["Quill"] = "svg",
		["Gunter"] = "svg",
		["Salem"] = "svg",
		["Peri"] = "svg",
		["Otto"] = "svg",
		["Jelly Jim"] = "svg",
		["Harley"] = "svg",
		["Singe"] = "svg",
		["Aquarias"] = "svg",
		["Norman"] = "svg",
		["Erran"] = "svg",
		["Ren"] = "svg",
		["Pablo"] = "svg",
		["Sam"] = "svg",
		["Tim the Wolf"] = "svg",
		["Mark"] = "svg",
		["Astro"] = "svg",
		-- Curses, included to override the type level override above
		["Madness"] = "png",
		["Torment"] = "png",
		["Despair"] = "png",
		-- Upgrades, included to override the type level override above
		["Golbin Crate"] = "png",
		["Corundum Axe"] = "png",
		["Augite Axe"] = "png",
		["Meteorite Axe"] = "png",
		["Divine Axe"] = "png",
		["Spruce Cooking Fire"] = "png",
		["Elderwood Cooking Fire"] = "png",
		["Carrion Cooking Fire"] = "png",
		["Iridium Pot"] = "png",
		["Palladium Pot"] = "png",
		["Divine Pot"] = "png",
		["Corundum Furnace"] = "png",
		["Augite Furnace"] = "png",
		["Divine Furnace"] = "png",
		["Sign of the Stars"] = "png",
		["Summoner's Altar"] = "png",
		["Golden Shard"] = "png",
		-- Rocks (Mining), included to override the type level override above
		["Rune Essence"] = "png",
		["Pure Essence"] = "png",
		["Onyx"] = "png",
		["Oricha"] = "png",
		["Cerulean"] = "png",
		-- Marks (Summoning), included to override the type level override above
		["Eagle"] = "png",
		["Owl"] = "png",
		["Beaver"] = "png",
		["Fox"] = "png",
		["Lightning Spirit"] = "png",
		["Siren"] = "png",
		["Spider"] = "png",
		["Spectre"] = "png"
	}
}

--Some overrides only apply for a specific type
local typeExtOverrides = {
	-- Example: ["item"] = { ["Chicken"] = "png" }
	}

--When calling for an icon of type Key, instead use type Value
local typeOverrides = {
	['combat'] = 'combatArea',
	['slayer'] = 'combatArea',
}
--When calling for an icon for Key, replace with image Value, and optionally override type also
local imgOverrides = {
	['Alt Magic'] = 'Magic',
	['Alt. Magic'] = 'Magic',
	['Alternative Magic'] = 'Magic',
	['Item Alchemy'] = {'Item Alchemy III', 'spell'},
	['Superheat'] = {'Superheat IV', 'spell'},
	['Melee'] = {'Attack', 'skill'},
	['Spider (lv. 51)'] = 'Spider',
	['Spider (lv. 52)'] = 'Brown Spider',
	['Basic Resupply'] = {'Lobster', 'item'},
	['Standard Resupply'] = {'Crab', 'item'},
	['Generous Resupply'] = {'Shark', 'item'},
	['Cooking Upgrade 1'] = {'Cooking', 'skill'},
	['Cooking Upgrade 2'] = {'Cooking', 'skill'},
	['Loot Container Stacking'] = {'Amulet of Looting', 'item'},
	['Bane, Instrument of Fear'] = 'Bane',
	['Mastery Token Astrology'] = 'Mastery Token (Astrology)',
	['Event Token - Holiday 2021'] = 'Christmas Present (Yellow)',
	["I Can't See Helmet"] = {'Golbin', 'monster'},
	-- 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'},
	['Bird Nest Potion'] = {'Bird Nest Potion I', 'item'},
	['Controlled Heat Potion'] = {'Controlled Heat Potion I', 'item'},
	['Generous Cook Potion'] = {'Generous Cook 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'},
	['Seeing Gold Potion'] = {'Seeing Gold Potion I', 'item'}
}
--When calling for an icon for Key, the link goes to Value
local linkOverrides = {
	['Alt Magic'] = 'Alternative Magic',
	['Alt. Magic'] = 'Alternative Magic',
	['Spider2'] = 'Brown Spider',
	["Deedree"] = 'Astrology#Constellations',
	["Iridan"] = 'Astrology#Constellations',
	["Ameria"] = 'Astrology#Constellations',
	["Terra"] = 'Astrology#Constellations',
	["Vale"] = 'Astrology#Constellations',
	["Syllia"] = 'Astrology#Constellations',
	["Arachi"] = 'Astrology#Constellations',
	["Ko"] = 'Astrology#Constellations',
	["Tellus"] = 'Astrology#Constellations',
	["Hyden"] = 'Astrology#Constellations',
	["Qimican"] = 'Astrology#Constellations'
}
--If no other text override was specified for the given link, use these
local txtOverrides = {
	['Spider2'] = 'Brown Spider'
}
--Ambiguous overrides section
local ambiguousOverrides = {
	['Golbin'] = true,
	['Chick'] = true,
	['Chicken'] = true,
	['Cyclops'] = true,
	['Wizard'] = true
}

function p.Icon(frame)
	local args = frame.args ~= nil and frame.args or frame
	local link = args[1]
	local text = args[2]
	local iconType = args.type
	local ext = args.ext ~= nil and args.ext ~= '' and args.ext or 'png'
	local notext = args.notext ~= nil and args.notext ~= ''
	local nolink = args.nolink ~= nil and args.nolink ~= ''
	local noicon = args.noicon ~= nil and args.noicon ~= ''
	local menu = args.menu ~= nil and args.menu ~= ''
	local imgSize = args.size ~= nil and args.size or 25
	local qty = args.qty
	local img = args.img ~= nil and args.img ~= '' and args.img or link

	link = fixPagename(link)
	img = fixPagename(img)

	img = sgsub(img, '#', '')
	img = sgsub(img, '/Training', '')
	img = sgsub(img, '/Guide', '')
	link = sgsub(link, '#', '')

	--MANUAL OVERRIDES
	local ovrImg = imgOverrides[link]
	local ovrTxt = txtOverrides[link]
	local ovrLink = linkOverrides[link]
	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
	-- Type & extension overrides must be after adjustments have been made
	-- for any image overrides
	local ovrTypeExt = typeExtOverrides[iconType]
	if ovrTypeExt ~= nil then
		ovrTypeExt = ovrTypeExt[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
	-- There are a couple specific double overrides to be included that don't fit in the above lists
	if ambiguousOverrides[link] then
		if not hasText then
			text = link
			hasText = true
		end
		link = link..' ('..(iconType == 'mark' and 'item' or iconType)..')'
	end

	local resultText = ''
	if not noicon then
		-- Image size
		local txtSize = tostring(imgSize)
		-- Extension and type if one is set
		local txtImg = (iconType ~= nil and iconType ~= '' and img .. '_(' .. iconType .. ')' or img) .. '.' .. ext
		-- Include a link unless no link -and- no text was requested
		local txtLink = '|link=' .. (nolink and notext and '' or link)
		resultText = '[[File:' .. txtImg .. '|' .. txtSize .. 'x' .. txtSize .. 'px' .. txtLink .. ']]'
	end

	if not notext then
		if nolink then
			resultText = resultText .. (noicon and '' or ' ') .. (hasText and text or link)
		else
			resultText = resultText .. (noicon and '' or ' ') .. '[[' .. link .. (hasText and text ~= link and '|' .. text or '') .. ']]'
		end
	end

	-- Add Quantity to the front if requested
	--local resultQty = (qty ~= nil and qty ~= '' and formatnum(qty) .. ' ' or '')
	if qty ~= nil and qty ~= '' then
		resultText = formatnum(qty) .. ' ' .. resultText
	end

	if menu then
		return '{| class="articletable" style="display:inline-block;vertical-align:middle;"\r\n|-\r\n|' .. resultText .. '\r\n|}'
	elseif not noicon then
		return '<span style="display:inline-block">' .. resultText .. '</span>'
	else
		return resultText
	end
end

-- Wrapper for p.Icon(), uses the same parameters but forces noicon = true
function p.Link(frame)
	local args = frame.args ~= nil and frame.args or frame
	args.noicon = true
	return p.Icon({['args'] = args})
end

function p._SkillReq(skill, level, showText)
	local result = p.Icon({skill, type='skill', notext='true'})
	if showText then
		result = result..' [['..skill..']]'
	end
	if level == nil then level = 'Unknown [[Category:Pages with script errors]]' end
	result = result.." Level "..level

	result = '<span style="display:inline-block">'..result..'</span>'
	return result
end

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

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

	local result = 'Level '..level..' '
	result = result..p.Icon({linkname, img=iconname, type='item', notext = true})..p.Icon({'Mastery', notext=true})
	if showText then result = result..'[['..linkname..']] [[Mastery]]' end
	result = '<span style="display:inline-block">'..result..'</span>'
	return result
end

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

function p._Currency(fileName, link, amt, maxAmt)
	local amtText = formatnum(amt)
	if maxAmt ~= nil and maxAmt >= amt then
		amtText = amtText .. ' - ' .. formatnum(maxAmt)
	end

	local fileText = ''
	if fileName ~= nil then
		fileText = '[[File:' .. fileName .. '|25px'
		if link ~= nil then
			fileText = fileText .. '|link=' .. link
		end
		fileText = fileText .. ']]&nbsp;'
	end

	return '<span style="display:inline-block">' .. fileText .. amtText .. '</span>'
end

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

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

function p.RC(amt, maxamt)
	return p._Currency('Raid_Coins.svg', 'Currency#Raid Coins', amt, maxamt)
end

return p