Anonymous

Module:Pets: Difference between revisions

From Melvor Idle
getPetSidebar: Add completion indicator & formatting for consistency with {{ItemBox}}
(Create _getPetSource() & apply source/effect overrides consistently, resolves exception with getPetSidebar() for Golbin Raid pets)
(getPetSidebar: Add completion indicator & formatting for consistency with {{ItemBox}})
Line 128: Line 128:
   local pet = p.getPet(name)
   local pet = p.getPet(name)
   local effect = (args.effect ~= nil and args.effect ~= '') and args.effect or p._getPetEffect(pet)
   local effect = (args.effect ~= nil and args.effect ~= '') and args.effect or p._getPetEffect(pet)
  local completionReq = (pet.ignoreCompletion ~= nil and pet.ignoreCompletion) and 'No' or 'Yes'


   local dropChance = nil
   local dropChance = nil
Line 138: Line 139:
   result = result..'! '..name..'\r\n|-\r\n| '
   result = result..'! '..name..'\r\n|-\r\n| '
   result = result..Icons.Icon({name, type='pet', size='250', notext=true})
   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|'''Pet ID:''' "..pet.id
 
   result = result.."\r\n|-\r\n|'''Source:''' "..p._getPetSource(pet)
   result = result..'\r\n|-\r\n| Source: '..p._getPetSource(pet)
   if dropChance ~= nil then
   if dropChance ~= nil then
     result = result..'\r\n|-\r\n| Drop Chance: '..dropChance
     result = result.."\r\n|-\r\n|'''Drop Chance:''' "..dropChance
   end
   end
 
   result = result.."\r\n|-\r\n| style =\"width: 250px;\"|'''Effect:''' "..effect
   result = result..'\r\n|-\r\n| style ="width: 250px;"|Effect: '..effect..'\r\n|}'
  result = result .. "\r\n|-\r\n|'''Part of 100% Completion:''' " .. completionReq .. "\r\n|}"


   return result
   return result