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 134: |
Line 135: |
| local ship = ships["ship" .. a] | | local ship = ships["ship" .. a] |
| self._elos = Functions.add_to_elos_ship(self._elos, ship_list[i], self._args["use_los"] or false) | | 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"} | | 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, |
Line 162: |
Line 165: |
| | | |
| 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"], |
| }, | | }, |
| { | | { |