Anonymous

Module:Icons: Difference between revisions

From Melvor Idle
no edit summary
(Add Eternal Darkness season overrides)
No edit summary
(35 intermediate revisions by 3 users not shown)
Line 1: Line 1:
local Shared = require("Module:Shared")
local Shared = require("Module:Shared")
 
local Num = require('Module:Number')
local Overrides = require('Module:Icons/Overrides')
-- Locally index some functions for performance
-- Locally index some functions for performance
local sgsub, fixPagename, formatnum, tostring, type = string.gsub, Shared.fixPagename, Shared.formatnum, tostring, type
local sgsub, fixPagename, formatnum, tostring, type = string.gsub, Shared.fixPagename, Num.formatnum, tostring, type


local p = {}
local p = {}
--Extension overrides for items that have non-png images
--Extension overrides for items that have non-png images
--Name level overrides take precedence over type level overrides
--Name level overrides take precedence over type level overrides
local extOverrides = {
local extOverrides = Overrides.extOverrides()
["type"] = {
["skill"] = "svg",
["spellType"] = "svg",
["spell"] = "svg",
["curse"] = "svg", -- Some exceptions included by name below
["aurora"] = "svg",
["combatArea"] = "svg",
["dungeon"] = "svg", -- Some exceptions included by name below
["prayer"] = "svg",
["upgrade"] = "svg", -- Some exceptions included by name below
["tree"] = "svg",
["rock"] = "svg", -- Some exceptions included by name below
["thieving"] = "svg",
["constellation"] = "svg",
["building"] = "svg",
["resource"] = "svg",
["township"] = "svg"
},
["name"] = {
-- General
["Combat"] = "svg",
["Guides"] = "svg",
["Mastery"] = "svg",
["Coins"] = "svg",
["Slayer Coins"] = "svg",
["Raid Coins"] = "svg",
["Abyssal Pieces"] = "svg",
["Abyssal Slayer Coins"] = "svg",
["TotH"] = "svg",
["Shop"] = "svg",
["Easter"] = "svg",
["Melvor Logo"] = "svg",
["Question"] = "svg",
["Timer"] = "svg",
["Hardcore"] = "svg",
["Chaos"] = "svg",
["Internal Suffering Speedrun"] = "svg",
["Hardcore Adventure Speedrun"] = "svg",
["Mastery Tokens"] = "gif",
["Lesser Relics"] = "gif",
["Prat, the Serpent of Fire"] = "svg",
["Unholy Prayers"] = "svg",
["Museum"] = "svg",
-- 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",
["Event Clue 1"] = "svg",
["Event Clue 2"] = "svg",
["Event Clue 3"] = "svg",
["Event Clue 4"] = "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 & spells, included to override the type level override above
["Madness"] = "png",
["Torment"] = "png",
["Despair"] = "png",
-- Alt. Magic
["Rags to Riches III"] = "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",
["Labyrinth Solution"] = "png",
["Linden Boat"] = "png",
["Golden Compass"] = "png",
["Ship Combat Overhaul"] = "png",
["Blessed Bone Offering"] = "png",
["Ship Crow's Nest Upgrade"] = "png",
["Extra Bank Tab"] = "png",
["Superior Cooking Pot"] = "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",
["Summoner's Pack II"] = "png",
["Summoner's Pack III"] = "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",
-- 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",
-- Slayer areas
["Blighted Reach"] = "png",
["Crimson Forest"] = "png",
["Echo Mire"] = "png",
["Eldritch Chasm"] = "png",
["Fractured Spires"] = "png",
["Paranoia Pit"] = "png",
["Petrified Lair"] = "png",
["Tangled Grove"] = "png",
["Tendril Hollow"] = "png",
["Toxic Wastes"] = "png",
["Void Enclave"] = "png",
["Void Nexus"] = "png",
["Whispering Sea"] = "png",
["Withering Catacombs"] = "png"
}
}
 
--Some overrides only apply for a specific type
--Some overrides only apply for a specific type
local typeExtOverrides = {
local typeExtOverrides = Overrides.typeExtOverrides()
-- Example: ["item"] = { ["Chicken"] = "png" }
["building"] = {
["Abyssal Combat Lab"] = "png",
["Abyssal Enhancer"] = "png",
["Abyssal Gateway"] = "png",
["Abyssal Harvester I"] = "png",
["Abyssal Harvester II"] = "png",
["Abyssal Harvester III"] = "png",
["Abyssal Research Lab"] = "png",
["Arcane Altar"] = "png",
["Armourer I"] = "png",
["Armourer II"] = "png",
["Armourer III"] = "png",
["Armourer IV"] = "png",
["Bonfire"] = "png",
["Divine Sanctuary"] = "png",
["Empowered Altar"] = "png",
["Enchanted Tower"] = "png",
["Ethereal Altar"] = "png",
["Ethereal Sanctuary"] = "png",
["Fire Pit"] = "png",
["Obsidian Blaster"] = "png",
["Obsidian Mines"] = "png",
["Obsidian Quarry"] = "png",
["Obsidian Walls"] = "png",
["Reinforced Carpenter I"] = "png",
["Reinforced Carpenter II"] = "png",
["Reinforced Carpenter III"] = "png",
["Runestone Combiner"] = "png",
["Runestone Crafter"] = "png",
["Runestone Merger"] = "png",
["Sanctuary"] = "png",
["Slayer Research Lab"] = "png",
["Statue of Xon"] = "png",
["Stone Walls"] = "png",
["Void Sanctuary"] = "png",
["Voidfire Beacon"] = "png",
["Weaponsmith I"] = "png",
["Weaponsmith II"] = "png",
["Weaponsmith III"] = "png",
["Weaponsmith IV"] = "png",
["Wooden Walls"] = "png"
},
["combatArea"] = {
-- Combat areas
["Abyssal Farmlands"] = "png",
["Blighted Marsh"] = "png",
["Dark Descent"] = "png",
["Dreaded Crossing"] = "png",
["Eldritch Domain"] = "png",
["Fractured Plains"] = "png",
["Lightless Cave"] = "png",
["Murmuring Forest"] = "png",
["Smoggy Plain"] = "png",
["Void Conflux"] = "png",
["Whisperwind Cove"] = "png",
["Withering Bastion"] = "png",
},
["constellation"] = {
["Corrupted Dhorn"] = "png",
["Corrupted Deedree"] = "png",
["Corrupted Iridan"] = "png",
["Corrupted Ameria"] = "png",
["Corrupted Terra"] = "png",
["Corrupted Vale"] = "png",
["Corrupted Syllia"] = "png",
["Corrupted Arachi"] = "png",
["Corrupted Ko"] = "png",
["Corrupted Tellus"] = "png",
["Corrupted Hyden"] = "png",
["Corrupted Qimican"] = "png",
["Celestis"] = "png"
},
["dungeon"] = {
["Into the Abyss"] = "png",
["The Abyssal Approach"] = "png"
},
["abyssDepth"] = {
["Depths of Woe"] = "png",
["Depths of Decay"] = "png",
["Depths of Fear"] = "png",
["Depths of Ruin"] = "png",
["Depths of Isolation"] = "png",
["Depths of Dissolve"] = "png",
["Depths of Resolve"] = "png",
["The Final Depth"] = "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"
},
["prayer"] = {
-- ItA prayers
["Annihilation"] = "png",
["Brutality"] = "png",
["Cruelty"] = "png",
["Deadshot"] = "png",
["Devastation"] = "png",
["Dispersion"] = "png",
["Dissipation"] = "png",
["Drain"] = "png",
["Elusion"] = "png",
["Endure"] = "png",
["Evisceration"] = "png",
["Ferocity"] = "png",
["Focused"] = "png",
["Instability"] = "png",
["Magic Shroud"] = "png",
["Melee Shroud"] = "png",
["Menace"] = "png",
["Meticulous"] = "png",
["Obliteration"] = "png",
["Opress"] = "png",
["Piercer"] = "png",
["Ranged Shroud"] = "png",
["Ravage"] = "png",
["Renewal"] = "png",
["Savagery"] = "png",
["Siphon"] = "png",
["Terrorize"] = "png",
["Tyranny"] = "png",
["Unrelenting"] = "png",
["Vanish"] = "png",
["Volatility"] = "png"
},
["resource"] = {
-- Abyssal Township resources
["Obsidian"] = "png",
["Runestone"] = "png",
["Voidfire Ash"] = "png",
["Armour & Weaponry"] = "png",
["Abyssal Stone"] = "png",
["Abyssal Pieces"] = "png"
},
["rock"] = {
["Rune Essence"] = "png",
["Pure Essence"] = "png",
["Onyx"] = "png",
["Oricha"] = "png",
["Cerulean"] = "png",
["Crystal"] = "png",
["Pure Crystal"] = "png",
["Abycite"] = "png",
["Abyssal Essence"] = "png",
["Abyssium Ore"] = "png",
["Azurian Outcrop"] = "png",
["Brumite Ore"] = "png",
["Echocite"] = "png",
["Eventide Ore"] = "png",
["Gloomite Ore"] = "png",
["Moonstone"] = "png",
["Mysticite"] = "png",
["Netherite Ore"] = "png",
["Nightopal"] = "png",
["Obsidian Outcrop"] = "png",
["Shadowpearl"] = "png",
["Stellarite"] = "png",
["Voidheart"] = "png",
["Witherite Ore"] = "png"
},
["skill"] = {
["Corruption"] = "png",
["Harvesting"] = "png"
},
["spell"] = {
-- Abyssal spells
["Abyssal Blast"] = "png",
["Abyssal Eruption"] = "png",
["Abyssal Surge"] = "png",
["Abyssal Wave"] = "png",
["Black Hole"] = "png",
["Brume Blast"] = "png",
["Brume Eruption"] = "png",
["Brume Surge"] = "png",
["Brume Wave"] = "png",
["Consuming Grasp"] = "png",
["Gloom Blast"] = "png",
["Gloom Eruption"] = "png",
["Gloom Surge"] = "png",
["Gloom Wave"] = "png",
["Infinite Void"] = "png",
["Madness"] = "png",
["Nether Blast"] = "png",
["Nether Eruption"] = "png",
["Nether Surge"] = "png",
["Nether Wave"] = "png",
["Null Sphere"] = "png",
["Pandemonium"] = "png",
["Tendril Slam"] = "png",
["VoidfireVolley"] = "png",
["Wither Blast"] = "png",
["Wither Eruption"] = "png",
["Wither Surge"] = "png",
["Wither Wave"] = "png"
},
["spellType"] = {
["Abyssal"] = "png"
},
["thieving"] = {
-- Abyssal NPCs
["Blighted Dryad"] = "png",
["Blighted Treant"] = "png",
["Dark Shade"] = "png",
["Dark Shadowmancer"] = "png",
["Dark Wraithlurker"] = "png",
["Silent Keeper"] = "png",
["Silent Poltergeist"] = "png",
["Silent Wanderer"] = "png",
["Turned Farmer"] = "png",
["Turned Man"] = "png",
["Turned Woman"] = "png",
["Void Envoy"] = "png",
["Void Gazer"] = "png",
["Void Shambler"] = "png",
["Withering Gargoyle"] = "png",
["Withering Golem"] = "png"
},
["township"] = {
-- Seasons, which are PNG unlike most other Township images
["Spring"] = "png",
["Summer"] = "png",
["Fall"] = "png",
["Winter"] = "png",
["Nightfall"] = "png",
["Solar Eclipse"] = "png",
["Eternal Darkness"] = "png"
},
["tree"] = {
-- Abyssal trees
["Abyssia Tree"] = "png",
["Brumia Tree"] = "png",
["Crumbletain Tree"] = "png",
["Eldria Tree"] = "png",
["Gloomia Tree"] = "png",
["Nethia Tree"] = "png",
["Plagueroot Tree"] = "png",
["Riftwood Tree"] = "png",
["Shadebark Tree"] = "png",
["Starwood Tree"] = "png",
["Twisted Tree"] = "png",
["Voidia Tree"] = "png",
["Whisperwillow Tree"] = "png",
["Withia Tree"] = "png"
},
["upgrade"] = {
["Abyssium Axe Coating"] = "png",
["Brumite Axe Coating"] = "png",
["Gloomite Axe Coating"] = "png",
["Witherite Axe Coating"] = "png",
["Netherite Axe Coating"] = "png",
["Abyssium Fishing Rod Coating"] = "png",
["Brumite Fishing Rod Coating"] = "png",
["Gloomite Fishing Rod Coating"] = "png",
["Witherite Fishing Rod Coating"] = "png",
["Netherite Fishing Rod Coating"] = "png",
["Abyssium Pickaxe Coating"] = "png",
["Brumite Pickaxe Coating"] = "png",
["Gloomite Pickaxe Coating"] = "png",
["Witherite Pickaxe Coating"] = "png",
["Netherite Pickaxe Coating"] = "png",
["Abyssium Harvester"] = "png",
["Brumite Harvester"] = "png",
["Gloomite Harvester"] = "png",
["Witherite Harvester"] = "png",
["Netherite Harvester"] = "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 = Overrides.typeOverrides()
['combat'] = '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 = Overrides.imgOverrides()
['Alt Magic'] = 'Magic',
['Alt. Magic'] = 'Magic',
['Alternative Magic'] = 'Magic',
['Melee'] = {'Attack', 'skill'},
['Spider (lv. 51)'] = 'Spider',
['Spider (lv. 52)'] = 'Brown Spider',
['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'},
["Golbin Raid"] = {'Golden Golbin', 'pet'},
["Throne of the Herald Expansion"] = 'TotH',
["Atlas of Discovery Expansion"] = 'AoD',
["Into the Abyss Expansion"] = 'ItA',
["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
['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'},
["Harvester's Potion"] = { "Harvester's Potion I", 'item'},
["Corrupted Fighter Potion"] = { 'Corrupted Fighter Potion I', 'item'},
["Piece Finder Potion"] = { 'Piece Finder Potion I', 'item'},
["Pieces Finder Potion"] = { 'Piece Finder Potion I', 'item'},
["Laceration Potion"] = { 'Laceration Potion I', 'item'},
["Gloomgrowth Potion"] = { 'Gloomgrowth Potion I', 'item'},
["Blighted Touch Potion"] = { 'Blighted Touch Potion I', 'item'},
["Abyssal Miner Potion"] = { 'Abyssal Miner Potion I', 'item'},
["Shadeveil Potion"] = { 'Shadeveil Potion I', 'item'},
["Abyssal Combination Potion"] = { 'Abyssal Combination Potion I', 'item'},
["Fear Potion"] = { 'Fear Potion I', 'item'},
["Abyssal Consumable Potion"] = { 'Abyssal Consumable Potion I', 'item'},
["Withering Potion"] = { 'Withering Potion I', 'item'},
["Silent Thief Potion"] = { 'Silent Thief Potion I', 'item'},
["Echoing Lure Potion"] = { 'Echoing Lure Potion I', 'item'},
["Silence Potion"] = { 'Silence Potion I', 'item'},
["Soulsnap Potion"] = { 'Soulsnap Potion I', 'item'},
["Dark Ritual Potion"] = { 'Dark Ritual Potion I', 'item'},
["Eldritch Curse Potion"] = { 'Eldritch Curse Potion I', 'item'},
["Void Stabilisation Potion"] = { 'Void Stabilisation Potion I', 'item'},
["Voidburst Potion"] = { 'Voidburst Potion I', 'item'},
-- Township resources
['GP'] = {'Coins', ''},
['Abyssal Pieces'] = {'Abyssal Pieces', ''},
['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
--When calling for an icon for Key + Type, replace with image Value, and optionally override type also
local typeImgOverrides = {
local typeImgOverrides = Overrides.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'}
},
['monster'] = {
["Xon"] = {'Xon, the Abyssal King (Phase 1)', 'monster'},
["Xon, the Abyssal King"] = {'Xon, the Abyssal King (Phase 1)', 'monster'}
},
['upgrade'] = {
["Abyssal Resupply"] = {'Crimson Bream (Perfect)', 'item'},
["Blighted Resupply"] = {'Crimson Bream (Perfect)', 'item'},
["Withering Resupply"] = {'Crimson Bream (Perfect)', 'item'}
}
}
--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 = Overrides.linkOverrides()
['Alt Magic'] = 'Alternative Magic',
['Alt. Magic'] = 'Alternative Magic',
['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 = Overrides.typeLinkOverrides()
['biome'] = {
['Grasslands'] = 'Biomes',
['Forest'] = 'Biomes',
['Mountains'] = 'Biomes',
['Water'] = 'Biomes',
['Swamp'] = 'Biomes',
['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',
['Eternal Darkness'] = '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 = Overrides.txtOverrides()
['Spider2'] = 'Brown Spider',
['Earth Golem (AoD)'] = 'Earth Golem'
}
-- Ambiguous overrides section
-- Ambiguous overrides section
local ambiguousOverrides = {
local ambiguousOverrides = Overrides.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
-- For ambiguous overrides, determines the type text to be used in the page link
local ambiguousTypeMap = {
local ambiguousTypeMap = Overrides.ambiguousTypeMap()
['mark'] = 'item',
local currencyFormatDefn = Overrides.currencyFormatDefn()
['combatArea'] = 'Combat Area',
['poi'] = 'Dig Site'
}


-- Defines icon types for which a section or anchor on a static page should be linked to, rather
-- Defines icon types for which a section or anchor on a static page should be linked to, rather
-- than the usual page linking
-- than the usual page linking
local sectionLinks = {
local sectionLinks = Overrides.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'
}


function p.Icon(frame)
function p.Icon(frame)
Line 1,002: Line 108:
end
end
end
end
local ovrClass = imgClassOverrides[link]
 
-- 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
Line 1,033: Line 139:
iconType = ovrType
iconType = ovrType
end
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
-- There are a couple specific double overrides to be included that don't fit in the above lists


Line 1,091: Line 195:
end
end


-- Wrapper for p.Icon(), uses the same parameters but forces noicon = true
-- Returns a skill icon based on the realm.
function p.Link(frame)
function p._SkillRealmIcon(skill, realmID, size)
local args = frame.args ~= nil and frame.args or frame
local realm = realmID or 'melvorD:Melvor'
args.noicon = true
local link = fixPagename(skill)
return p.Icon({['args'] = args})
local ext = typeExtOverrides['skill'][skill] or extOverrides.type['skill']
end


function p._SkillReq(skill, level, showText)
local img = mw.html.create('span')
local altText = (showText and '') or skill
if realm == 'melvorItA:Abyssal' then
local result = p.Icon({skill, type='skill', notext=(showText and '' or true), nospan=true, alt=altText})
img:addClass('abyss-icon')
if level == nil then level = 'Unknown [[Category:Pages with script errors]]' end
end
result = result.." Level "..level
 
size = size or 25
result = '<span class="img-text">'..result..'</span>'
img :wikitext('[[File:'):wikitext(link):wikitext('_(skill).'):wikitext(ext)
return result
:wikitext('|'):wikitext(size):wikitext('x'):wikitext(size):wikitext('px')
:wikitext('|link='):wikitext(link):wikitext(']]')
return tostring(img)
end
end


function p.SkillReq(frame)
function p.SkillRealmIcon(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 realmID = args.realm
local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
local size = tonumber(args.size)
return p._SkillReq(skill, level, showText)
return p._SkillRealmIcon(skill, realmID, size)
end
end


function p._AbyssalSkillReq(skill, level, showText)
function p._SkillReq(skill, level, showText, realmID)
local realm = realmID or 'melvorD:Melvor'
local link = fixPagename(skill)
local ext = typeExtOverrides['skill'][skill] or extOverrides.type['skill']
local altText = (showText and '') or skill
local altText = (showText and '') or skill
local result = p.Icon({skill, type='skill', notext=(showText and '' or true), nospan=true, alt=altText})
if level == nil then  
if level == nil then level = 'Unknown [[Category:Pages with script errors]]' end
level = 'Unknown [[Category:Pages with script errors]]'  
result = result.." Abyssal Level "..level
end


result = '<span class="img-text">'..result..'</span>'
-- Create skill image.
return result
local img = mw.html.create()
end
 
if realm == 'melvorItA:Abyssal' then
function p.AbyssalSkillReq(frame)
img = img:tag('span')
local args = frame.args ~= nil and frame.args or frame
:addClass('abyss-icon')
local skill = args[1]
end
local level = tonumber(args[2])
local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
img :wikitext('[[File:'):wikitext(link):wikitext('_(skill).'):wikitext(ext)
return p._AbyssalSkillReq(skill, level, showText)
:wikitext('|25x25px|link='):wikitext(link)
:wikitext('|alt='):wikitext(altText)
:wikitext(']]')
-- Create text and add image.
local text = mw.html.create('span')
:addClass('img-text')
:node(img)
if showText == true then
text:wikitext(' [[' .. link .. ']]')
end
--28/06/2024. Commented this out to try out red icons for abyssal levels
-- as opposed to the text below. Remove entire section if still commented out after
-- a week or two.
--if realm == 'melvorItA:Abyssal' then
-- text:wikitext(" Abyssal Level ")
--else
text:wikitext(" Level ")
--end
text:wikitext(level)
return tostring(text)
end
end


function p._MasteryReq(itemName, level, showText)
function p._MasteryReq(itemName, level, showText)
Line 1,147: Line 278:
local altTextMastery = (showText and '') or '&nbsp;Mastery'
local altTextMastery = (showText and '') or '&nbsp;Mastery'


local result = 'Level '..level..' '
    local result = mw.html.create('span')
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
if showText then result = result..'[['..linkname..']] [[Mastery]]' end
        :addClass('img-text')
result = '<span class="img-text">'..result..'</span>'
        :wikitext('Level ' .. level .. ' ')
return result
        :node(p.Icon({linkname, img=iconname, type='item', notext=true, nospan=true, alt=altTextItem}))
end
        :node('[[File:Mastery.svg|25x25px|alt=' .. altTextMastery .. ']]')


function p.MasteryReq(frame)
    if showText then
local args = frame.args ~= nil and frame.args or frame
        result
local itemName = args[1]
            :wikitext('[[' .. linkname .. ']] ')
local level = tonumber(args[2])
            :wikitext('[[Mastery]]')
local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false'
    end
return p._MasteryReq(itemName, level, showText)
end
 
local currencyFormatDefn = {
["melvorD:GP"] = {
["img"] = 'Coins.svg',
["name"] = 'Gold Pieces',
["abbr"] = 'GP'
},
["melvorD:SlayerCoins"] = {
["img"] = 'Slayer Coins.svg',
["name"] = 'Slayer Coins',
["abbr"] = 'SC'
},
["melvorD:RaidCoins"] = {
["img"] = 'Raid Coins.svg',
["name"] = 'Raid Coins',
["abbr"] = 'RC'
},
["melvorItA:AbyssalPieces"] = {
["img"] = 'Abyssal Pieces.svg',
["name"] = 'Abyssal Pieces',
["abbr"] = 'AP'
},
["melvorItA:AbyssalSlayerCoins"] = {
["img"] = 'Abyssal Slayer Coins.svg',
["name"] = 'Abyssal Slayer Coins',
["abbr"] = 'ASC'
},
}


-- Aliases for the above
    return tostring(result)
for k, v in pairs(currencyFormatDefn) do
if v.abbr ~= nil and currencyFormatDefn[v.abbr] == nil then
currencyFormatDefn[v.abbr] = v
end
end
end


Line 1,268: Line 365:
--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', notext=true, img='TotH', alt=''})
return '<span class="img-text">[[File:TotH.svg|25x25px|link=Throne of the Herald Expansion]]</span>'
end
end


function p.AoD()
function p.AoD()
return p.Icon({'Atlas of Discovery Expansion', notext=true, img='AoD', alt=''})
return '<span class="img-text">[[File:AoD.png|25x25px|link=Atlas of Discovery Expansion]]</span>'
end
end


function p.ItA()
function p.ItA()
return p.Icon({'Into the Abyss Expansion', notext=true, img='ItA', alt=''})
return '<span class="img-text">[[File:ItA.png|25x25px|link=Into the Abyss Expansion]]</span>'
end
end


-- Icon to signify base game
function p.Melvor()
function p.Melvor()
return p.Icon({'Full Version', notext=true, img='Melvor_Logo', ext='svg', alt=''})
return '<span class="img-text">[[File:Melvor_Logo.svg|25x25px|link=Full Version]]</span>'
end
end


2,875

edits