Changes

no edit summary
Line 6: Line 6:  
local function getShipCard(ship)
 
local function getShipCard(ship)
 
   local s = Ship(ship)
 
   local s = Ship(ship)
   local i = s:id() or s:true_id()
+
   -- local i = s:id() or s:true_id()
   local is = i and (i < 10 and '00' .. i or i < 100 and '0' .. i or i) or '?'
+
   -- local is = i and (i < 10 and '00' .. i or i < 100 and '0' .. i or i) or '?'
   return '[[File:KanMusu' .. is .. 'Banner.png|160px|link=' .. s:base_name() .. ']]<br>[[' .. s:base_name() .. '|' .. s:name() .. ']]'
+
   return '[[File:Ship Banner ' .. s:name() .. '.png|160px|link=' .. s:base_name() .. ']]<br>[[' .. s:base_name() .. '|' .. s:name() .. ']]'
 
end
 
end
    
local function getEquipmentCard(eq)
 
local function getEquipmentCard(eq)
   return '[[File:Equipment' .. (Equipment(eq):id() or '?') .. '-1.png|100px|link=' .. eq .. ']]'
+
  local e = Equipment(eq)
 +
   return '[[File:Equipment Card ' .. e:name():gsub("/", " ") .. '.png|100px|link=' .. e:name() .. ']]'
 
end
 
end
    
local function getFleetName(fleet, event)
 
local function getFleetName(fleet, event)
   local names = require('Module:Fleet/Names')[event] or {}
+
   local names = require('Module:FleetNames')[event] or {}
 
   if names == 'flagship' then
 
   if names == 'flagship' then
 
     return Ship(fleet[1].ship):base_name() .. ' FS'
 
     return Ship(fleet[1].ship):base_name() .. ' FS'
Line 57: Line 58:  
   else
 
   else
 
     return string.format('{{tooltip|~/%s|%s}}', maxHp, U.ijoin(hps, ', '))
 
     return string.format('{{tooltip|~/%s|%s}}', maxHp, U.ijoin(hps, ', '))
 +
  end
 +
end
 +
 +
local function formatVoice(e)
 +
  if type(e.voice) == 'number' and e.voice < 10 then
 +
    return string.format('{{audio|file=Ship Voice %s Spring 2019 Event Friend Fleet %s.mp3}}', e.ship, e.voice)
 +
  else
 +
    return string.format('{{audio|file=Ship Voice %s %s.mp3}}', e.ship, e.voice)
 
   end
 
   end
 
end
 
end
Line 76: Line 85:     
local function render(args)
 
local function render(args)
     local success, data = U.requireModule('Data/Fleet/Friend/' .. args.friend)
+
     local success, data = U.requireModule('Data/FriendFleet/' .. args.friend)
 
     if not success then
 
     if not success then
 
         return "''No data''"
 
         return "''No data''"
Line 128: Line 137:  
         first = false
 
         first = false
 
       end
 
       end
       local fleetNote = U.ijoin(fleet.notes, ', ') .. ' : ' ..fleetType .. ' (Variant ' .. i .. ')'
+
       local fleetNote = U.ijoin(fleet.notes, ', ') .. ' : ' ..fleetType .. ' (Variant ' .. i .. ', ' .. (fleet.date or '??') .. '~)'
 
       if fleet.f2p and fleet.f2p > 0 then
 
       if fleet.f2p and fleet.f2p > 0 then
 
         fleetNote = fleetNote .. " '''{{color|green|{{tooltip|Regular|"  .. fleet.f2p ..  " samples}}}}'''"
 
         fleetNote = fleetNote .. " '''{{color|green|{{tooltip|Regular|"  .. fleet.f2p ..  " samples}}}}'''"
Line 134: Line 143:  
       if fleet.p2w and fleet.p2w > 0 then
 
       if fleet.p2w and fleet.p2w > 0 then
 
         fleetNote = fleetNote .. " '''{{color|red|{{tooltip|Powerful|"  .. fleet.p2w ..  " samples}}}}'''"
 
         fleetNote = fleetNote .. " '''{{color|red|{{tooltip|Powerful|"  .. fleet.p2w ..  " samples}}}}'''"
 +
      end
 +
      if table.getn(fleet.voices or {}) > 0 then
 +
        fleetNote = fleetNote .. ' ' .. U.ijoin(U.imap(fleet.voices, formatVoice), ' ')
 
       end
 
       end
 
       table.insert(result, string.format('|-\n!colspan="11"|%s', fleetNote))
 
       table.insert(result, string.format('|-\n!colspan="11"|%s', fleetNote))
Line 141: Line 153:  
           result,
 
           result,
 
           string.format(
 
           string.format(
             '|-\n|%s||%s||style="text-align:left;white-space:nowrap"|%s%s%s%s%s||%s||%s||%s||%s||%s',
+
             '|-\n|%s||%s||style="text-align:left;white-space:nowrap"|%s%s%s%s%s%s||%s||%s||%s||%s||%s',
 
             getShipCard(ship.ship),
 
             getShipCard(ship.ship),
 
             ship.level,
 
             ship.level,
Line 149: Line 161:  
             ship.equipment[4] and getEquipmentCard(ship.equipment[4]) or '',
 
             ship.equipment[4] and getEquipmentCard(ship.equipment[4]) or '',
 
             ship.equipment[5] and getEquipmentCard(ship.equipment[5]) or '',
 
             ship.equipment[5] and getEquipmentCard(ship.equipment[5]) or '',
 +
            ship.extraSlot and string.format('<span style="display:inline-block;border-radius:10px;border:5px solid steelblue">%s</span>', getEquipmentCard(ship.extraSlot)) or '',
 
             type(ship.hp) == 'table' and formatHp(ship.hp, ship.maxHp) or ship.hp ~= ship.maxHp and string.format('%s/%s', ship.hp, ship.maxHp) or
 
             type(ship.hp) == 'table' and formatHp(ship.hp, ship.maxHp) or ship.hp ~= ship.maxHp and string.format('%s/%s', ship.hp, ship.maxHp) or
 
               ship.maxHp,
 
               ship.maxHp,
cssedit, gkautomate
6,926

edits