Anonymous

Module:Icons: Difference between revisions

From Melvor Idle
Adding overrides for resupplies.
(just getting no file type override needed)
(Adding overrides for resupplies.)
(6 intermediate revisions by 2 users not shown)
Line 14: Line 14:
   ["Lemon"] = "jpg",
   ["Lemon"] = "jpg",
   ["Lemons"] = "jpg",
   ["Lemons"] = "jpg",
   ["Lemonade"] = "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"
}
}


Line 29: Line 47:
   ['Melee'] = 'Combat',
   ['Melee'] = 'Combat',
   ['Spider (lv. 51)'] = 'Spider',
   ['Spider (lv. 51)'] = 'Spider',
   ['Spider (lv. 52)'] = 'Spider2'
   ['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
--When calling for an icon for Key, the link goes to Value
Line 43: Line 64:
   ['Spider2'] = 'Spider (lv. 52)'
   ['Spider2'] = 'Spider (lv. 52)'
}
}
--Ambiguous overrides section
local ambiguousOverrides = {'Golbin', 'Chick'}


local Shared= require("Module:Shared")
local Shared= require("Module:Shared")
Line 86: Line 109:
   end
   end
   --There are a couple specific double overrides I want to include that don't fit in the above lists
   --There are a couple specific double overrides I want to include that don't fit in the above lists
   if link == 'Golbin' then
   if Shared.contains(ambiguousOverrides, link) then
     if text == nil then text = 'Golbin' end
     if text == nil then text = link end
     link = 'Golbin ('..type..')'
     link = link..' ('..type..')'
   end
   end


Line 172: Line 195:
   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
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
end


function p.GP(amt, maxamt)
function p.GP(amt, maxamt)
   local result = '[[File:Coins.svg|25px|link=Coins]]'
   return p._Currency('Coins.svg', 'Coins', amt, maxamt)
  result = result..'&nbsp;'..Shared.formatnum(amt)
  if maxamt ~= nil then result = result..' - '..Shared.formatnum(maxamt) end
 
  result = '<span style="display:inline-block">'..result..'</span>'
  return result
end
end


function p.SC(amt, maxamt)
function p.SC(amt, maxamt)
   local result = '[[File:Slayer Coins.svg|25px|link=Currency#Slayer Coins]]'
   return p._Currency('Slayer Coins.svg', 'Currency#Slayer Coins', amt, maxamt)
  result = result..'&nbsp;'..Shared.formatnum(amt)
end
  if maxamt ~= nil then result = result..' - '..Shared.formatnum(maxamt) end


   result = '<span style="display:inline-block">'..result..'</span>'
function p.RC(amt, maxamt)
  return result
   return p._Currency('Raid_Coins.svg', 'Currency#Raid Coins', amt, maxamt)
end
end


return p
return p