Module:Icons: Difference between revisions

Implement RC function & standardise currency functions
(Added disambiguation override for Chick)
(Implement RC function & standardise currency functions)
Line 192: Line 192:
   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 and maxamt ~= amt 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 and maxamt ~= amt 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