4,951
edits
Falterfire (talk | contribs) mNo edit summary |
Falterfire (talk | contribs) (Adding overrides for resupplies.) |
||
(19 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
["Charge Stone of Rhaelyx"] = "png", | ["Charge Stone of Rhaelyx"] = "png", | ||
["Mysterious Stone"] = "png", | ["Mysterious Stone"] = "png", | ||
["Cloudburst Staff"] = "png", | ["Cloudburst Staff"] = "png", | ||
["Earth Layered Shield"] = "png", | ["Earth Layered Shield"] = "png", | ||
["Lemon"] = "jpg", | |||
["Lemons"] = "jpg", | |||
["Lemonade"] = "jpg", | |||
["Miolite Sprig"] = "png", | |||
["Miolite Trio"] = "png", | |||
["Miolite Warden"] = "png", | |||
["Miolite Monarch"] = "png", | |||
["Wicked Greater Dragon"] = "png", | |||
["Hunting Greater Dragon"] = "png", | |||
["Chaotic Greater Dragon"] = "png", | |||
["Beavis"] = "png", | |||
["Pudding Duckie"] = "png", | |||
["Pyro"] = "png", | |||
["Snek"] = "png", | |||
["Larry, the Lonely Lizard"] = "png", | |||
["Caaarrrlll"] = "png", | |||
["Gronk"] = "png", | |||
["Finn, the Cat"] = "png", | |||
["Marahute"] = "png", | |||
["Monk-ey"] = "png", | |||
["Asura"] = "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 | |||
local imgOverrides = { | |||
['Alt Magic'] = 'Magic', | |||
['Alt. Magic'] = 'Magic', | |||
['Alternative Magic'] = 'Magic', | |||
['Melee'] = 'Combat', | |||
['Spider (lv. 51)'] = 'Spider', | |||
['Spider (lv. 52)'] = 'Spider2', | |||
['Basic Resupply'] = 'Lobster', | |||
['Standard Resupply'] = 'Crab', | |||
['Generous Resupply'] = 'Shark' | |||
} | |||
--When calling for an icon for Key, the link goes to Value | |||
local linkOverrides = { | |||
['Alt Magic'] = 'Alternative Magic', | |||
['Alt. Magic'] = 'Alternative Magic', | |||
['Spider'] = 'Spider (lv. 51)', | |||
['Spider2'] = 'Spider (lv. 52)' | |||
} | |||
--If no other text override was specified for the given link, use these | |||
local txtOverrides = { | |||
['Spider'] = 'Spider (lv. 51)', | |||
['Spider2'] = 'Spider (lv. 52)' | |||
} | |||
--Ambiguous overrides section | |||
local ambiguousOverrides = {'Golbin', 'Chick'} | |||
local Shared= require("Module:Shared") | local Shared= require("Module:Shared") | ||
Line 33: | Line 82: | ||
local img = args.img ~= nil and args.img or link | local img = args.img ~= nil and args.img or link | ||
link = string.gsub(link, "%%27", "'") | |||
link = string.gsub(link, "'", "'") | |||
link = string.gsub(link, "'", "'") | |||
img = string.gsub(img, "%%27", "'") | |||
img = string.gsub(img, "'", "'") | |||
img = string.gsub(img, "'", "'") | |||
img = string.gsub(img, '#', '') | |||
link = string.gsub(link, '#', '') | |||
--MANUAL OVERRIDES | --MANUAL OVERRIDES | ||
if link == | if imgOverrides[link] ~= nil and img == link then | ||
img = | img = imgOverrides[link] | ||
end | |||
if text == nil and txtOverrides[link] ~= nil then | |||
text = txtOverrides[link] | |||
end | |||
if linkOverrides[link] ~= nil then | |||
if text == nil then text = link end | |||
link = linkOverrides[link] | |||
end | |||
if extOverrides[img] ~= nil then | |||
ext = extOverrides[img] | |||
end | |||
if typeOverrides[type] ~= nil then | |||
type = typeOverrides[type] | |||
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 then text = link end | |||
link = link..' ('..type..')' | |||
end | end | ||
--Creating the image... | |||
local result = '[[File:'..img | local result = '[[File:'..img | ||
--Add in type if one is set | |||
if type ~= nil and type ~= '' then result = result..'_('..type..')' end | if type ~= nil and type ~= '' then result = result..'_('..type..')' end | ||
--Add in extension and image size | |||
result = result..'.'..ext..'|'..tostring(imgSize)..'x'..tostring(imgSize)..'px' | result = result..'.'..ext..'|'..tostring(imgSize)..'x'..tostring(imgSize)..'px' | ||
--Include a link unless no link -and- no text was requested | |||
if not (nolink and notext) then result = result..'|link='..link end | if not (nolink and notext) then result = result..'|link='..link end | ||
result = result..']]' | result = result..']]' | ||
if qty ~= nil and qty ~= '' then result = | --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 | ||
Line 70: | Line 136: | ||
else | else | ||
result = result..' [['..link | result = result..' [['..link | ||
if text ~= nil and text ~= '' then | if text ~= nil and text ~= '' and text ~= link then | ||
result = result..'|'..text | result = result..'|'..text | ||
end | end | ||
Line 87: | Line 153: | ||
end | end | ||
function p._SkillReq(skill, level) | function p._SkillReq(skill, level, showText) | ||
local result = | local result = p.Icon({skill, type='skill', notext='true'}) | ||
result = result.." | if showText then | ||
result = result..' [['..skill..']]' | |||
end | |||
result = result.." Level "..level | |||
result = '<span style="display:inline-block">'..result..'</span>' | result = '<span style="display:inline-block">'..result..'</span>' | ||
Line 99: | Line 168: | ||
local skill = args[1] | local skill = args[1] | ||
local level = tonumber(args[2]) | local level = tonumber(args[2]) | ||
return p._SkillReq(skill, level) | local showText = args.showText ~= nil and args.showText ~= '' and args.showText ~= 'false' | ||
return p._SkillReq(skill, level, showText) | |||
end | end | ||
function p. | function p._MasteryReq(itemName, level, showText) | ||
local | local iconname = itemName | ||
local linkname = itemName | |||
if | --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>' | result = '<span style="display:inline-block">'..result..'</span>' | ||
return result | 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 = Shared.formatnum(amt) | |||
if maxAmt ~= nil and maxAmt >= amt then | |||
amtText = amtText .. ' - ' .. Shared.formatnum(maxAmt) | |||
end | |||
local fileText = '' | |||
if fileName ~= nil then | |||
fileText = '[[File:' .. fileName .. '|25px' | |||
if link ~= nil then | |||
fileText = fileText .. '|link=' .. link | |||
end | |||
fileText = fileText .. ']] ' | |||
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 | end | ||
return p | return p |