Module:Pets: Difference between revisions

Added drop odds to boss pet sidebar
(Added initial pass at making boss pets a thing)
(Added drop odds to boss pet sidebar)
Line 74: Line 74:
   local name = (args.name ~= nil and args.name ~= '') and args.name or args[1]
   local name = (args.name ~= nil and args.name ~= '') and args.name or args[1]
   local pet = p.getPet(name)
   local pet = p.getPet(name)
  local effect = (args.effect ~= nil and args.effect ~= '') and args.effect or pet.description


   local source = nil
   local source = nil
Line 87: Line 88:
   end
   end


   local effect = (args.effect ~= nil and args.effect ~= '') and args.effect or pet.description
   local dropChance = nil
  if pet.obtained ~= nil and pet.obtained.dungeonCompletion ~= nil then
    local odds = pet.obtained.dungeonCompletion[1][2]
    dropChance = '1 in '..odds..' ('..Shared.round(100 / odds, 2, 2)..'%)'
  end
 
    
    
   result = '{| class="wikitable" style="float:right; clear:right;"\r\n|-\r\n'
   result = '{| class="wikitable" style="float:right; clear:right;"\r\n|-\r\n'
Line 95: Line 101:


   result = result..'\r\n|-\r\n| Source: '..source
   result = result..'\r\n|-\r\n| Source: '..source
  if dropChance ~= nil then
    result = result..'\r\n|-\r\n| Drop Chance: '..dropChance
  end


   result = result..'\r\n|-\r\n| style ="width: 250px;"|Effect: '..effect..'\r\n|}'
   result = result..'\r\n|-\r\n| style ="width: 250px;"|Effect: '..effect..'\r\n|}'