Changes

m
15 revisions imported
Line 4: Line 4:  
local Equipment = require("Module:Equipment")
 
local Equipment = require("Module:Equipment")
 
local Formatting = require("Module:Formatting")
 
local Formatting = require("Module:Formatting")
local format = require("Module:StringInterpolation").format
+
local format = require("Module:Core").format
    
local Functions = require("Module:NanaminFunctions")
 
local Functions = require("Module:NanaminFunctions")
Line 11: Line 11:  
     _rows = {},
 
     _rows = {},
 
     _ship_list = { ["main"] = {}, ["escort"] = {} },
 
     _ship_list = { ["main"] = {}, ["escort"] = {} },
 +
    _counts = { ["main"] = {}, ["escort"] = {} },
 
      
 
      
 
     _table_start = [[{| class="mw-collapsible mw-collapsed" id="mw-customcollapsible-${table_name}-${id}"]],
 
     _table_start = [[{| class="mw-collapsible mw-collapsed" id="mw-customcollapsible-${table_name}-${id}"]],
Line 16: Line 17:  
     _row_starter = "|-",
 
     _row_starter = "|-",
 
      
 
      
     _header_top_template = [[<div class="mw-customtoggle-${toggle_class}" style="width: 615px; background: #A596B5; border-top-right-radius: 60px; border-top-left-radius: 60px; text-align: center; font-size: 18px; color: #000040;">''Main Fleet''</div>]],
+
     _header_top_template = [[<div class="mw-customtoggle-${toggle_class}" style="width: 615px; background: #A596B5; border-top-right-radius: 60px; border-top-left-radius: 60px; text-align: center; font-size: 18px; color: #000040; cursor: hand; cursor: pointer;">''Main Fleet''</div>]],
     _header_mid_template = [[<div class="mw-customtoggle-${toggle_class}" style="width: 615px; background: #A596B5; text-align:center; font-size: 18px; color:#000040;">''${text}''</div>]],
+
     _header_mid_template = [[<div class="mw-customtoggle-${toggle_class}" style="width: 615px; background: #A596B5; text-align:center; font-size: 18px; color:#000040; cursor: hand; cursor: pointer;">''${text}''</div>]],
 
     _header_bot_template = [[<div style="width: 615px; background: #A596B5; border-bottom-right-radius: 60px; border-bottom-left-radius: 60px; text-align: center; font-size: 18px; color:#000040;">''${map}''</div>]],
 
     _header_bot_template = [[<div style="width: 615px; background: #A596B5; border-bottom-right-radius: 60px; border-bottom-left-radius: 60px; text-align: center; font-size: 18px; color:#000040;">''${map}''</div>]],
 
      
 
      
 
     _ship_image_template = [[| colspan="2" style="background-color: #BDACA0; height: 50px;" mode="packed" |<div style="float: left; margin-top: 7px; margin-left: 3px;">${position_image}</div>${ship_card}]],
 
     _ship_image_template = [[| colspan="2" style="background-color: #BDACA0; height: 50px;" mode="packed" |<div style="float: left; margin-top: 7px; margin-left: 3px;">${position_image}</div>${ship_card}]],
     _equip_template = [[| style="height: 46px; text-align: center; background-color: #BDACA0;" |${equip_icon}
+
     _equip_template = [[| style="height: 46px; min-width: 22px; text-align: center; background-color: #BDACA0;" |${equip_icon}
 
| style="width: 175px; text-align: center; background: #E3D6C9;" |${equip_link}]],
 
| style="width: 175px; text-align: center; background: #E3D6C9;" |${equip_link}]],
 
     _info_template = [[| style="background-color: #363636; height: 25px; width: 611px;" |
 
     _info_template = [[| style="background-color: #363636; height: 25px; width: 611px;" |
Line 89: Line 90:  
         equip_link = "- Unequipped -"
 
         equip_link = "- Unequipped -"
 
     else
 
     else
         local equip = Equipment(entry[slot + 3])
+
         local equip = Equipment(Functions.process_legacy_name(entry[slot + 3]))
 
         self._fighter_power = Functions.add_to_fighter_power(self._fighter_power, equip, select(2, ship:slot(slot)))
 
         self._fighter_power = Functions.add_to_fighter_power(self._fighter_power, equip, select(2, ship:slot(slot)))
 
         self._elos = Functions.add_to_elos(self._elos, equip)
 
         self._elos = Functions.add_to_elos(self._elos, equip)
         equip_icon = Formatting:format_image{ Formatting:format_equipment_icon(equip:icon()), size = "22x22px" }
+
         equip_icon = Formatting:format_image{ Formatting:format_equipment_icon(equip:icon()), size = "22x22px", link = "" }
 
         equip_link = Formatting:format_link(equip:link())
 
         equip_link = Formatting:format_link(equip:link())
 
     end
 
     end
Line 125: Line 126:  
     local ship_list = self._ship_list[table_name]
 
     local ship_list = self._ship_list[table_name]
 
     for i = 1, 6, 3 do
 
     for i = 1, 6, 3 do
 +
        local ship_suffix1 = ship_list[i][2] and ship_list[i][2]:gsub('/', '') or ship_list[i][2]
 +
        local ship_suffix2 = ship_list[i + 1][2] and ship_list[i + 1][2]:gsub('/', '') or ship_list[i + 1][2]
 +
        local ship_suffix3 = ship_list[i + 2][2] and ship_list[i + 2][2]:gsub('/', '') or ship_list[i + 2][2]
 
         local ships = {
 
         local ships = {
             ship1 = Ship(ship_list[i][1], ship_list[i][2]),
+
             ship1 = Ship(ship_list[i][1], ship_suffix1),
             ship2 = Ship(ship_list[i + 1][1], ship_list[i + 1][2]),
+
             ship2 = Ship(ship_list[i + 1][1], ship_suffix2),
             ship3 = Ship(ship_list[i + 2][1], ship_list[i + 2][2]),
+
             ship3 = Ship(ship_list[i + 2][1], ship_suffix3),
 
         }
 
         }
 
          
 
          
 
         for a = 1, 3 do
 
         for a = 1, 3 do
 
             local ship = ships["ship" .. a]
 
             local ship = ships["ship" .. a]
             local ship_card = Formatting:format_image{ship:battle_card() or self._blank_battle_card, link = ship:link(), caption = ship:name(), align = "center"}
+
            self._elos = Functions.add_to_elos_ship(self._elos, ship_list[i], self._args["use_los"] or false)
 +
            local ship_type = Formatting:format_ship_code(ship:type())
 +
            self._counts[table_name][ship_type] = self._counts[table_name][ship_type] and self._counts[table_name][ship_type] + 1 or 1
 +
             local ship_card = Formatting:format_image{ship:battle_card() or self._blank_battle_card, link = ship:link(), caption = ship:name(), align = "center", size = "160x40px"}
 
             table.insert(self._rows, format{self._ship_image_template,
 
             table.insert(self._rows, format{self._ship_image_template,
                 position_image = Formatting:format_image{"Ship position " .. tostring(i + a - 1) .. " icon.png"},
+
                 position_image = Formatting:format_image{"Ship position " .. tostring(i + a - 1) .. " icon.png", link = ""},
 
                 ship_card = ship_card,
 
                 ship_card = ship_card,
 
             })
 
             })
Line 161: Line 168:     
function CombinedFleet:build_info_table()
 
function CombinedFleet:build_info_table()
 +
    local counts = { ["main"] = "", ["escort"] = "" }
 +
    for fleet, ship_types in pairs(self._counts) do
 +
        for ship_type, count in pairs(ship_types) do
 +
            counts[fleet] = counts[fleet] .. tostring(count) .. " " .. ship_type:gsub("^BC$", "FBB") .. " + "
 +
        end
 +
        counts[fleet] = mw.ustring.sub(counts[fleet], 1, -4)
 +
    end
 
     local information = {
 
     local information = {
 +
        {
 +
            ["label"] = "Main Fleet Comp",
 +
            ["value"] = counts["main"],
 +
        },
 +
        {
 +
            ["label"] = "Escort Fleet Comp",
 +
            ["value"] = counts["escort"],
 +
        },
 
         {
 
         {
 
             ["label"] = "Route Taken",
 
             ["label"] = "Route Taken",
             ["value"] = self._args["route"]
+
             ["value"] = self._args["route"],
 
         },
 
         },
 
         {
 
         {
Line 205: Line 227:  
     self:generate_id()
 
     self:generate_id()
 
      
 
      
 +
    table.insert(self._rows, [[<div style="display: table; margin: 0 auto;">]])
 
     self:insert_top_header()
 
     self:insert_top_header()
 
     self:build_table("main")
 
     self:build_table("main")
Line 212: Line 235:  
     self:build_info_table()
 
     self:build_info_table()
 
     self:insert_bot_header()
 
     self:insert_bot_header()
 +
    table.insert(self._rows, [[</div>]])
 
      
 
      
 
     return table.concat(self._rows, '\n')
 
     return table.concat(self._rows, '\n')
Bots, gkautomate
12,557

edits