• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
no edit summary
Line 32: Line 32:  
end
 
end
   −
local tableHeaderFriend = [=[ {|class="wikitable" style="text-align:center"
+
local tableHeaderFriend = [=[{|class="wikitable" style="text-align:center"
 
!Ship
 
!Ship
 
!Lv.
 
!Lv.
Line 90: Line 90:     
local function renderFriend(args, frame)
 
local function renderFriend(args, frame)
     local data = loadData('Fleet/Friend/' .. args.friend)
+
     -- local data = loadData('Fleet/Friend/' .. args.friend)
 +
    local success, data = _.requireModule('Data/Fleet/Friend/' .. args.friend)
 +
    if not success then
 +
        return "''No data''"
 +
    end
 
     local groups = {}
 
     local groups = {}
     for _, e in pairs(data) do
+
     for i, e in pairs(data) do
         local fleetType = getFleetType(e.fleet)
+
         if not args.map or _.ifind(e.maps, args.map) then
        groups[fleetType] = groups[fleetType] or {}
+
            local fleetType = getFleetType(e.fleet)
        table.insert(groups[fleetType], e)
+
            groups[fleetType] = groups[fleetType] or {}
 +
            table.insert(groups[fleetType], e)
 +
        end
 
     end
 
     end
 
     local result = {}
 
     local result = {}
 
     table.insert(result, '{{#tag:tabber|')
 
     table.insert(result, '{{#tag:tabber|')
     for fleetType, fleets in pairs(groups) do
+
     for i, fleetType in ipairs(_.isort(_.keys(groups))) do
 +
        local fleets = groups[fleetType]
 
         table.sort(fleets, function(a, b)
 
         table.sort(fleets, function(a, b)
             return #(a.fleet) < #(b.fleet)
+
             local l1 = table.getn(a.fleet)
 +
            local l2 = table.getn(b.fleet)
 +
            local ships1 = _.ijoin(_.imap(a.fleet, function (e) return e.ship end), ', ')
 +
            local ships2 = _.ijoin(_.imap(b.fleet, function (e) return e.ship end), ', ')
 +
            if ships1 == ships2 then
 +
                return l1 < l2
 +
            end
 +
            return ships1 < ships2
 
         end)
 
         end)
 
         table.insert(result, string.format('{{!}}-{{!}} %s =', fleetType))
 
         table.insert(result, string.format('{{!}}-{{!}} %s =', fleetType))
 
         table.insert(result, '<tabber>')
 
         table.insert(result, '<tabber>')
 
         for i, fleet in ipairs(fleets) do
 
         for i, fleet in ipairs(fleets) do
             table.insert(result, string.format('|-| %s =\n' .. tableHeaderFriend, 'Variant ' .. i))
+
             table.insert(result, string.format('|-| %s =', 'Variant ' .. i))
 +
            if table.getn(fleet.notes) > 0 then
 +
                table.insert(result, _.ijoin(fleet.notes, '<br>'))
 +
            end               
 +
            table.insert(result, tableHeaderFriend)
 
             for j, ship in ipairs(fleet.fleet) do
 
             for j, ship in ipairs(fleet.fleet) do
 
                 table.insert(result, string.format(
 
                 table.insert(result, string.format(
cssedit, gkautomate
7,064

edits

Navigation menu