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}]], | | node = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: center; color: ${color}; background-color: ${bg_color};" |${values.node}]], |
Line 88: |
Line 92: |
| 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 140: |
| 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 177: |
| 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 196: |
| 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 225: |
| 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 247: |
| 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 260: |
| 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 269: |
| .. (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 276: |
| 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 326: |
Line 353: |
| 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 |