Line 18: |
Line 18: |
| _collapse_div_end = [[</div>]], | | _collapse_div_end = [[</div>]], |
| | | |
− | _table_start = [[{|]], | + | _table_start = [[<table class="nanaminfleetkai">]], |
− | _table_end = [[|}]], | + | _table_end = [[</table>]], |
− | _row_starter = "|-", | + | _row_starter = [[</tr><tr>]], |
− | _added_cell_template = [[| colspan="6" style="background: ${bg_color}; text-align: center; font-weight: bold;" |${content}]], | + | _added_cell_template = [[<td colspan="6" style="background-color:${bg_color};">'''${content}'''</td>]], |
− | _ship_template = [[| rowspan="4" style="background: ${bg_color};" |${ship_card}]], | + | _ship_template = [[<td rowspan="4">${ship_card}</td>]], |
− | _ship_text_template = [[| rowspan="4" style="background: ${bg_color}; text-align: center; width: 165px;" |${ship_name}]],
| + | _equip_template = [[<td>${equip_icon}</td><td style="${style}">${equip_link}</td>]], |
− | _equip_template = [[| style="background-color: ${icon_bg_color}; width: 15px;" |${equip_icon} | + | _blank_entry = [[<td style="display:none;"></td>]], |
− | | style="background-color: ${equip_bg_color}; width: 175px; text-align: center;" |${equip_link}]],
| |
− | _equip_text_template = [[| style="background-color: ${icon_bg_color}; width: 15px; text-align: center;" | - | |
− | | style="background-color: ${equip_bg_color}; width: 175px; text-align: center;" |${equip_link}]],
| |
| | | |
| _header_bg = "#98D2F0", | | _header_bg = "#98D2F0", |
− | _ship_card_bg = "transparent",
| |
− | _equip_icon_bg = "#8DCDEE",
| |
− | _equip_bg = "#E4F3FB",
| |
| _equip_locked_bg = "#CDDBE2", | | _equip_locked_bg = "#CDDBE2", |
| _extra_cells_bg = "#98D2F0", | | _extra_cells_bg = "#98D2F0", |
Line 110: |
Line 104: |
| function NanaminFleetKai:insert_ship_row(ship) | | function NanaminFleetKai:insert_ship_row(ship) |
| local ship_card | | local ship_card |
− | if ship and ship:name() then | + | if self._args["text_only"] then |
| + | ship_card = ship and ship:name() or "Invalid Ship Name" |
| + | elseif ship and ship:name() then |
| ship_card = ShipCardKai:card{ship = ship, size = self._size, link = ship:link(), caption = ship:name()} | | ship_card = ShipCardKai:card{ship = ship, size = self._size, link = ship:link(), caption = ship:name()} |
| else | | else |
| ship_card = Formatting:format_image{self._blank, size = self._size} | | ship_card = Formatting:format_image{self._blank, size = self._size} |
| end | | end |
− | if self._args["text_only"] then | + | table.insert(self._rows, format{self._ship_template, ship_card = ship_card}) |
− | table.insert(self._rows, format{self._ship_text_template,
| |
− | bg_color = self._equip_bg,
| |
− | ship_name = ship:name() or "No Name Given",
| |
− | })
| |
− | else
| |
− | table.insert(self._rows, format{self._ship_template,
| |
− | bg_color = self._ship_card_bg,
| |
− | ship_card = ship_card,
| |
− | })
| |
− | end
| |
| end | | end |
| | | |
| function NanaminFleetKai:insert_equip_row(ship, entry, slot) | | function NanaminFleetKai:insert_equip_row(ship, entry, slot) |
| local slots = ship and ship:slots() or 0 | | local slots = ship and ship:slots() or 0 |
− | local equip_icon, equip_bg_color, equip_link | + | local equip_icon, equip_link, style |
| if slot > slots then | | if slot > slots then |
− | equip_icon = ""
| |
− | equip_bg_color = self._equip_locked_bg
| |
| equip_link = "- Locked -" | | equip_link = "- Locked -" |
| + | style = "background-color:" .. self._equip_locked_bg .. ";" |
| elseif entry[slot + 3] == nil then | | elseif entry[slot + 3] == nil then |
− | equip_icon = ""
| |
− | equip_bg_color = self._equip_locked_bg
| |
| equip_link = "- Unequipped -" | | equip_link = "- Unequipped -" |
| + | style = "background-color:" .. self._equip_locked_bg .. ";" |
| else | | else |
| local equip = Equipment(Functions.process_legacy_name(entry[slot + 3])) | | local equip = Equipment(Functions.process_legacy_name(entry[slot + 3])) |
| self:process_equipment(equip, select(2, ship:slot(slot))) | | self:process_equipment(equip, select(2, ship:slot(slot))) |
− | equip_icon = Formatting:format_image{ Formatting:format_equipment_icon(equip:icon()), size = "22x22px", link = "" } | + | if self._args["text_only"] then |
− | equip_bg_color = self._equip_bg
| + | equip_link = equip:name() |
− | equip_link = Formatting:format_link(equip:link())
| + | else |
− | end
| + | equip_icon = Formatting:format_image{ Formatting:format_equipment_icon(equip:icon()), size = "22x22px", link = "" } |
− | if self._args["text_only"] then
| + | equip_link = Formatting:format_link(equip:link()) |
− | table.insert(self._rows, format{self._equip_text_template,
| + | end |
− | icon_bg_color = self._equip_icon_bg,
| |
− | equip_bg_color = equip_bg_color,
| |
− | equip_link = equip_link,
| |
− | })
| |
− | else
| |
− | table.insert(self._rows, format{self._equip_template,
| |
− | icon_bg_color = self._equip_icon_bg,
| |
− | equip_icon = equip_icon,
| |
− | equip_bg_color = equip_bg_color,
| |
− | equip_link = equip_link,
| |
− | })
| |
| end | | end |
| + | table.insert(self._rows, format{self._equip_template, |
| + | equip_icon = equip_icon or "", |
| + | style = style or "", |
| + | equip_link = equip_link, |
| + | }) |
| end | | end |
| | | |
Line 196: |
Line 174: |
| for j = 2, 4 do | | for j = 2, 4 do |
| table.insert(self._rows, self._row_starter) | | table.insert(self._rows, self._row_starter) |
| + | table.insert(self._rows, self._blank_entry) |
| self:insert_equip_row(ship1, self._items[i], j) | | self:insert_equip_row(ship1, self._items[i], j) |
| if self._items[i + 1] then | | if self._items[i + 1] then |
| + | table.insert(self._rows, self._blank_entry) |
| self:insert_equip_row(ship2, self._items[i + 1], j) | | self:insert_equip_row(ship2, self._items[i + 1], j) |
| else | | else |
| + | table.insert(self._rows, self._blank_entry) |
| self:insert_equip_row(nil, nil, 1) | | self:insert_equip_row(nil, nil, 1) |
| end | | end |
Line 253: |
Line 234: |
| table.insert(self._rows, format{self._collapse_div_start, id = self._id}) | | table.insert(self._rows, format{self._collapse_div_start, id = self._id}) |
| table.insert(self._rows, self._table_start) | | table.insert(self._rows, self._table_start) |
| + | table.insert(self._rows, "<tr>") |
| self:build_table() | | self:build_table() |
| self:add_extras() | | self:add_extras() |
| + | table.insert(self._rows, "</tr>") |
| table.insert(self._rows, self._table_end) | | table.insert(self._rows, self._table_end) |
| table.insert(self._rows, self._collapse_div_end) | | table.insert(self._rows, self._collapse_div_end) |