Line 11: |
Line 11: |
| _header_template = [[!# | | _header_template = [[!# |
| !Formation | | !Formation |
− | !Base EXP
| |
| !${node_type} | | !${node_type} |
| !AD/AP<br>AS/AS+]], | | !AD/AP<br>AS/AS+]], |
| _header_template_simple = [[!# | | _header_template_simple = [[!# |
| !colspan="3"|${node_type}]], | | !colspan="3"|${node_type}]], |
| + | _header_template_basexp = [[!# |
| + | !Enemy<br>Form. |
| + | !Base EXP |
| + | !${node_type} |
| + | !AD/AP<br>AS/AS+]], |
| _column_cell_templates = { | | _column_cell_templates = { |
| + | node = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: center; color: ${color}; background-color: ${bg_color};" |${values.node}]], |
| + | formation = [[| style="text-align: center; background-color: ${bg_color}; color: ${color};" |${values.formation}]], |
| + | fleet = [[| style="width: 490px; background-color: ${bg_color};" |${values.fleet}]], |
| + | as = [[| style="text-align: center; background-color: ${bg_color}; color: ${color};" |${values.as}]], |
| + | }, |
| + | _column_cell_templates_basexp = { |
| node = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: center; color: ${color}; background-color: ${bg_color};" |${values.node}]], | | node = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: center; color: ${color}; background-color: ${bg_color};" |${values.node}]], |
| formation = [[| style="text-align: center; background-color: ${bg_color}; color: ${color};" |${values.formation}]], | | formation = [[| style="text-align: center; background-color: ${bg_color}; color: ${color};" |${values.formation}]], |
Line 33: |
Line 43: |
| _collapser_end = [[</div>]], | | _collapser_end = [[</div>]], |
| _columns = { | | _columns = { |
| + | "node", |
| + | "formation", |
| + | "fleet", |
| + | "as", |
| + | }, |
| + | _columns_basexp = { |
| "node", | | "node", |
| "formation", | | "formation", |
Line 88: |
Line 104: |
| return { values = { formation = row.formation }, color = color } | | return { values = { formation = row.formation }, color = color } |
| end | | end |
− | | + | |
| function NodeInfo:basexp(row) | | function NodeInfo:basexp(row) |
| return { values = { basexp = row.basexp } } | | return { values = { basexp = row.basexp } } |
Line 136: |
Line 152: |
| end | | end |
| local air_string = air_denial_string .. "/" .. air_parity_string .. "<br>" .. air_superiority_string .. "/" .. air_supremacy_string | | local air_string = air_denial_string .. "/" .. air_parity_string .. "<br>" .. air_superiority_string .. "/" .. air_supremacy_string |
− | table.insert(self._items, {
| + | if self._is_basexp then |
− | node = node,
| + | table.insert(self._items, { |
− | formation = formation,
| + | node = node, |
− | basexp = basexp,
| + | formation = formation, |
− | fleet = fleet,
| + | basexp = basexp, |
− | as = air_string,
| + | fleet = fleet, |
− | tags = tags,
| + | as = air_string, |
− | })
| + | tags = tags, |
| + | }) |
| + | else |
| + | table.insert(self._items, { |
| + | node = node, |
| + | formation = formation, |
| + | fleet = fleet, |
| + | as = air_string, |
| + | tags = tags, |
| + | }) |
| + | end |
| end | | end |
| | | |
Line 163: |
Line 189: |
| local tags = {} | | local tags = {} |
| local resource | | local resource |
| + | self._is_basexp = false |
| + | |
| for index, item_key in ipairs(self._args) do | | for index, item_key in ipairs(self._args) do |
| if item_key == "-" then | | if item_key == "-" then |
Line 180: |
Line 208: |
| mode = 2 | | mode = 2 |
| elseif mode == 2 then | | elseif mode == 2 then |
− | self._node_type = string.lower(string.match(item_key, "(.-)/") or item_key)
| + | -- underscores should be exclusive to modifier specification during mode 2 |
| + | if mw.ustring.find(item_key, '_') then |
| + | -- capture modifiers here, then trim them off the node type |
| + | if mw.ustring.find(item_key, 'BaseEXP') then |
| + | self._is_basexp = true |
| + | end |
| + | local nodetypesolo = mw.ustring.sub(item_key, 1, mw.ustring.find(item_key, '_') - 1) |
| + | self._node_type = string.lower(string.match(nodetypesolo, "(.-)/") or nodetypesolo) |
| + | item_key = nodetypesolo; |
| + | else |
| + | self._node_type = string.lower(string.match(item_key, "(.-)/") or item_key) |
| + | end |
| 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 198: |
Line 237: |
| while mw.ustring.find(item_key, '/') do | | while mw.ustring.find(item_key, '/') do |
| local split = mw.ustring.find(item_key, '/') | | local split = mw.ustring.find(item_key, '/') |
− | tags[string.lower(mw.ustring.sub(item_key, 1, split - 1))] = true
| + | tags[string.lower(mw.ustring.sub(item_key, 1, split - 1))] = true |
| item_key = mw.ustring.sub(item_key, split + 1) | | item_key = mw.ustring.sub(item_key, split + 1) |
| end | | end |
Line 220: |
Line 259: |
| mode = 6 | | mode = 6 |
| else | | else |
− | if mode == 6 and tonumber(item_key) then | + | if mode == 6 and self._is_basexp then |
| basexp = item_key | | basexp = item_key |
| else | | else |
Line 233: |
Line 272: |
| ship_suffix = "" | | ship_suffix = "" |
| end | | end |
− | | + | |
| local ship = EnemyShip(ship_name, ship_suffix) | | local ship = EnemyShip(ship_name, ship_suffix) |
| local ship_air_power = ship:air_power(tags.raid) | | local ship_air_power = ship:air_power(tags.raid) |
− | | + | |
| local ship_caption = | | local ship_caption = |
| (ship:name() or "?") | | (ship:name() or "?") |
Line 242: |
Line 281: |
| .. (ship:armor() or "?") .. " Armor, " .. (ship:hp() or "?") .. " HP" | | .. (ship:armor() or "?") .. " Armor, " .. (ship:hp() or "?") .. " HP" |
| .. (ship_air_power ~= 0 and ", " .. (ship_air_power or "?") .. " AP" or "") | | .. (ship_air_power ~= 0 and ", " .. (ship_air_power or "?") .. " AP" or "") |
− | | + | |
| table.insert(fleet, ShipBattleCardKai:get{ | | table.insert(fleet, ShipBattleCardKai:get{ |
| ship = ship, | | ship = ship, |
Line 249: |
Line 288: |
| flagship = #fleet == 0 | | flagship = #fleet == 0 |
| }) | | }) |
− | | + | |
| if ship_air_power then | | if ship_air_power then |
| as_rating = as_rating + ship_air_power | | as_rating = as_rating + ship_air_power |
Line 274: |
Line 313: |
| row_values = item | | row_values = item |
| else | | else |
| + | local columnuse = nil |
| + | if self._is_basexp then |
| + | columnuse = self._columns |
| + | else |
| + | columnuse = self._columns_basexp |
| + | end |
| + | |
| row_values = {} | | row_values = {} |
− | for _, column in ipairs(self._columns) do | + | for _, column in ipairs(columnuse) do |
| row_values[column] = self[column](self, item) | | row_values[column] = self[column](self, item) |
| end | | end |
| if index > 1 then | | if index > 1 then |
− | for _, column in ipairs(self._columns) do | + | for _, column in ipairs(columnuse) do |
| for i = index - 1, 1, -1 do | | for i = index - 1, 1, -1 do |
| if column == "node" then | | if column == "node" then |
Line 297: |
Line 343: |
| end | | end |
| else | | else |
− | for _, column in ipairs(self._columns) do | + | for _, column in ipairs(columnuse) do |
| row_values[column].rowspan = 1 | | row_values[column].rowspan = 1 |
| row_values[column].colspan = 1 | | row_values[column].colspan = 1 |
Line 326: |
Line 372: |
| function NodeInfo:is_simple_node_type() | | function NodeInfo:is_simple_node_type() |
| return self._node_type == 'resource' or self._node_type == 'storm' or self._node_type == 'empty' or self._node_type == 'select' | | return self._node_type == 'resource' or self._node_type == 'storm' or self._node_type == 'empty' or self._node_type == 'select' |
| + | end |
| + | |
| + | function NodeInfo:is_basexp() |
| + | return self._is_basexp |
| end | | end |
| | | |
| function NodeInfo:create_header() | | function NodeInfo:create_header() |
− | local header_string = format{
| + | local header_string = nil |
− | self:is_simple_node_type() and self._header_template_simple or self._header_template,
| + | if self:is_simple_node_type() then |
− | node_type = self:format_node_type()
| + | header_string = format{ |
− | }
| + | self._header_template_simple, |
| + | node_type = self:format_node_type() |
| + | } |
| + | elseif self:is_basexp() then |
| + | header_string = format{ |
| + | self._header_template_basexp, |
| + | node_type = self:format_node_type() |
| + | } |
| + | else |
| + | header_string = format{ |
| + | self._header_template, |
| + | node_type = self:format_node_type() |
| + | } |
| + | end |
| self._header = header_string | | self._header = header_string |
| self._header_bottom = header_string | | self._header_bottom = header_string |
Line 385: |
Line 448: |
| bg_color = "initial" | | bg_color = "initial" |
| end | | end |
− | for _, column in ipairs(self._columns) do | + | if self._is_basexp then |
− | if row_values[column] then
| + | for _, column in ipairs(self._columns_basexp) do |
− | row_values[column].bg_color = bg_color
| + | if row_values[column] then |
− | end
| + | row_values[column].bg_color = bg_color |
− | if row_values[column] then
| + | end |
− | table.insert(self._rows, format(self._column_cell_templates[column] or self._cell, row_values[column]))
| + | if row_values[column] then |
| + | table.insert(self._rows, format(self._column_cell_templates_basexp[column] or self._cell, row_values[column])) |
| + | end |
| end | | end |
− | end
| + | else |
| + | for _, column in ipairs(self._columns) do |
| + | if row_values[column] then |
| + | row_values[column].bg_color = bg_color |
| + | end |
| + | if row_values[column] then |
| + | table.insert(self._rows, format(self._column_cell_templates[column] or self._cell, row_values[column])) |
| + | end |
| + | end |
| + | end |
| elseif mw.ustring.find(row_values, '/') then | | elseif mw.ustring.find(row_values, '/') then |
| --node/resource/amount/boss | | --node/resource/amount/boss |