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 92: |
Line 88: |
| 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 140: |
Line 136: |
| 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 |
− | if self._is_basexp then
| + | table.insert(self._items, { |
− | table.insert(self._items, {
| + | node = node, |
− | node = node,
| + | formation = formation, |
− | formation = formation,
| + | basexp = basexp, |
− | basexp = basexp,
| + | fleet = fleet, |
− | fleet = fleet,
| + | as = air_string, |
− | as = air_string,
| + | tags = tags, |
− | tags = tags,
| + | }) |
− | })
| |
− | else
| |
− | table.insert(self._items, {
| |
− | node = node,
| |
− | formation = formation,
| |
− | fleet = fleet,
| |
− | as = air_string,
| |
− | tags = tags,
| |
− | })
| |
− | end
| |
| end | | end |
| | | |
Line 177: |
Line 163: |
| 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 196: |
Line 180: |
| mode = 2 | | mode = 2 |
| elseif mode == 2 then | | elseif mode == 2 then |
− | -- underscores should be exclusive to modifier specification during mode 2
| + | self._node_type = string.lower(string.match(item_key, "(.-)/") or item_key) |
− | 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 225: |
Line 198: |
| 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 247: |
Line 220: |
| mode = 6 | | mode = 6 |
| else | | else |
− | if mode == 6 and self._is_basexp then | + | if mode == 6 and tonumber(item_key) then |
| basexp = item_key | | basexp = item_key |
| else | | else |
Line 260: |
Line 233: |
| 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 269: |
Line 242: |
| .. (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 276: |
Line 249: |
| 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 353: |
Line 326: |
| 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 = nil
| + | local header_string = format{ |
− | if self:is_simple_node_type() then
| + | self:is_simple_node_type() and self._header_template_simple or self._header_template, |
− | header_string = format{
| + | node_type = self:format_node_type() |
− | 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 |