Line 9: |
Line 9: |
| _item_class = EnemyShip, | | _item_class = EnemyShip, |
| _header_template = [[!# | | _header_template = [[!# |
− | !Form | + | !Formation |
− | !Fleet | + | !${node_type} |
| !AP/AS/AS+]], | | !AP/AS/AS+]], |
| _column_cell_templates = { | | _column_cell_templates = { |
Line 155: |
Line 155: |
| mode = 2 | | mode = 2 |
| elseif mode == 2 then | | elseif mode == 2 then |
| + | self._node_type = string.lower(string.match(item_key, "(.-)/") or item_key) |
| if mw.ustring.find(string.lower(item_key), "resource") or string.lower(item_key) == "storm" then | | if mw.ustring.find(string.lower(item_key), "resource") or string.lower(item_key) == "storm" then |
| local split = mw.ustring.find(item_key, '/') | | local split = mw.ustring.find(item_key, '/') |
Line 262: |
Line 263: |
| table.insert(self._data_rows, row_values) | | table.insert(self._data_rows, row_values) |
| end | | end |
| + | end |
| + | |
| + | function NodeInfo:format_node_type() |
| + | local node_types = { |
| + | Normal = 'Normal Battle Node', |
| + | Boss = 'Boss Battle Node', |
| + | Resource = 'Resource Node', |
| + | Storm = 'Maelstrom Node', |
| + | Empty = 'Empty Node', |
| + | Select = 'Selection Node', |
| + | Night = 'Night Battle Node', |
| + | Aerial = 'Aerial Battle Node', |
| + | Defense = 'Air Defense Node', |
| + | NightToDay = 'Night to Day Battle Node', |
| + | } |
| + | return self._args["comment"] or node_types[self._node_type] or "Fleet" |
| + | end |
| + | |
| + | function NodeInfo:create_header() |
| + | local header_string = format{self._header_template, node_type = self:format_node_type() } |
| + | self._header = header_string |
| + | self._header_bottom = header_string |
| + | end |
| + | |
| + | function NodeInfo:start_rows() |
| + | self._rows = {} |
| + | |
| + | if self._args["toggle_id"] then |
| + | table.insert(self._rows, format{self._collapser_template, |
| + | toggle_id = self._args["toggle_id"], |
| + | button_display = self._args["button_display"] or "Show/Hide Formation Table", |
| + | }) |
| + | end |
| + | |
| + | table.insert(self._rows, self._table_start) |
| + | table.insert(self._rows, self._header) |
| end | | end |
| | | |
Line 283: |
Line 320: |
| local text = action .. " " .. amount .. " " .. resource .. " " .. units | | local text = action .. " " .. amount .. " " .. resource .. " " .. units |
| return text, node_type, bg_color | | return text, node_type, bg_color |
− | end
| |
− |
| |
− | function NodeInfo:start_rows()
| |
− | self._rows = {}
| |
− |
| |
− | if self._args["toggle_id"] then
| |
− | table.insert(self._rows, format{self._collapser_template,
| |
− | toggle_id = self._args["toggle_id"],
| |
− | button_display = self._args["button_display"] or "Show/Hide Formation Table",
| |
− | })
| |
− | end
| |
− |
| |
− | table.insert(self._rows, self._table_start)
| |
− | table.insert(self._rows, self._header)
| |
| end | | end |
| | | |
Line 359: |
Line 382: |
| table.insert(self._rows, self._header_bottom or self._header) | | table.insert(self._rows, self._header_bottom or self._header) |
| table.insert(self._rows, self._table_end) | | table.insert(self._rows, self._table_end) |
− |
| |
| if self._args["toggle_id"] then | | if self._args["toggle_id"] then |
| table.insert(self._rows, self._collapser_end) | | table.insert(self._rows, self._collapser_end) |