Anonymous

Module:Icons: Difference between revisions

From Melvor Idle
Added NoLink option
(Added override to grab proper image for the stupid spiders.)
(Added NoLink option)
Line 11: Line 11:
   local ext = args.ext ~= nil and args.ext or 'svg'
   local ext = args.ext ~= nil and args.ext or 'svg'
   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 menu = args.menu ~= nil and args.menu ~= ''
   local menu = args.menu ~= nil and args.menu ~= ''
   local imgSize = args.size ~= nil and args.size or 25
   local imgSize = args.size ~= nil and args.size or 25
Line 23: Line 24:
   elseif link == 'Spider (lv. 52)' then
   elseif link == 'Spider (lv. 52)' then
     img = 'Spider2'
     img = 'Spider2'
  elseif link == 'Spider2' then
    link = 'Spider (lv. 52)'
   end
   end


   local result = '[[File:'..img
   local result = '[[File:'..img
   if type ~= nil and type ~= '' then result = result..'_('..type..')' end
   if type ~= nil and type ~= '' then result = result..'_('..type..')' end
   result = result..'.'..ext..'|'..tostring(imgSize)..'px|link='..link..']]'
   result = result..'.'..ext..'|'..tostring(imgSize)..'px'
  if not nolink then result = result..'|link='..link end
  result = result..']]'
 
   if qty ~= nil and qty ~= '' then result = result..' '..qty end
   if qty ~= nil and qty ~= '' then result = result..' '..qty end
   if not notext then  
   if not notext then  
     result = result..' [['..link
     if nolink then
    if text ~= nil and text ~= '' then
      if text ~= nil and text ~= '' then
      result = result..'|'..text
        result = result..' '..text
      else
        result = result..' '..link
      end
    else
      result = result..' [['..link
      if text ~= nil and text ~= '' then
        result = result..'|'..text
      end
      result = result..']]'
     end
     end
    result = result..']]'
   end
   end