Anonymous

Module:Pets: Difference between revisions

From Melvor Idle
getPetSidebar
(return p)
(getPetSidebar)
Line 4: Line 4:


local PetData = mw.loadData('Module:Pets/data')
local PetData = mw.loadData('Module:Pets/data')
local Constants = mw.loadData('Module:Constants/data')


local Shared = require( "Module:Shared" )
local Shared = require( "Module:Shared" )
Line 57: Line 58:
   result = result..'!Pet!!Name!!Effect'
   result = result..'!Pet!!Name!!Effect'
   result = result..'\r\n|-\r\n|'..Icons.Icon({pet.name, type='pet', size='60', notext=true})
   result = result..'\r\n|-\r\n|'..Icons.Icon({pet.name, type='pet', size='60', notext=true})
  --result = result..'\r\n|-\r\n|[[File:'..pet.name..'_(pet).png|60px]]'
   result = result..'||[['..pet.name..']]||'..pet.description
   result = result..'||[['..pet.name..']]||'..pet.description
   result = result..'\r\n|}'
   result = result..'\r\n|}'
Line 71: Line 71:
   local pet = p.getPetBySkill(skillName)
   local pet = p.getPetBySkill(skillName)
   result = p.getPetTable(pet.name)
   result = p.getPetTable(pet.name)
  return result
end
function p.getPetSidebar(frame)
  local args = frame.args ~= nil and frame.args or frame
  local result = nil
  local name = args.name ~= nil and args.name or args[1]
  local pet = p.getPet(name)
  local skill = args.skill ~= nil and args.skill or Skills.getSkillName(pet.skill)
  local effect = args.effect ~= nil and args.effect or pet.description
 
  result = '{| class="wikitable" style="float:right; clear:right;"\r\n|-\r\n'
  result = result..'! '..name..'\r\n|-\r\n| '
  result = result..Icons.Icon({name, type='pet', size='250', notext=true})
  result = result..'\r\n|-\r\n| Pet ID: '..pet.id
  result = result..'\r\n|-\r\n| Skill: '..skill
  result = result..'\r\n|-\r\n| style ="width: 250px;"|Effect: '..effect..'\r\n|}'
   return result
   return result
end
end


return p
return p
285

edits