| Line 208: |
Line 208: |
| | 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 |
| | + | i = 0 |
| | if mode == 7 then --We're at a break and have built a full row; time to insert it | | if mode == 7 then --We're at a break and have built a full row; time to insert it |
| | self:insert_item(node, formation, basexp, table.concat(fleet, " "), as_rating, tags, as_complete) | | self:insert_item(node, formation, basexp, table.concat(fleet, " "), as_rating, tags, as_complete) |
| | end | | end |
| − |
| |
| | table.insert(self._items, "break") | | table.insert(self._items, "break") |
| | fleet, as_rating, as_complete = {}, 0, true | | fleet, as_rating, as_complete = {}, 0, true |
| Line 218: |
Line 218: |
| | else | | else |
| | if mode == 1 then | | if mode == 1 then |
| | + | i = 0 |
| | --First item should always be the node | | --First item should always be the node |
| | node = item_key | | node = item_key |
| | mode = 2 | | mode = 2 |
| | elseif mode == 2 then | | elseif mode == 2 then |
| | + | i = 0 |
| | self._node_type = string.lower(string.match(item_key, "(.-)/") or item_key) | | 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 |
| Line 251: |
Line 253: |
| | end | | end |
| | elseif mode == 3 then | | elseif mode == 3 then |
| | + | i = 0 |
| | resource = self:upcase(item_key) | | resource = self:upcase(item_key) |
| | mode = 4 | | mode = 4 |
| | elseif mode == 4 then | | elseif mode == 4 then |
| | + | i = 0 |
| | local amount = item_key | | local amount = item_key |
| | if tags["storm"] and mw.ustring.sub(amount, 1, 1) ~= "-" then | | if tags["storm"] and mw.ustring.sub(amount, 1, 1) ~= "-" then |
| Line 263: |
Line 267: |
| | mode = 1 | | mode = 1 |
| | elseif mode == 5 then | | elseif mode == 5 then |
| | + | i = 0 |
| | formation = self:upcase(item_key) | | formation = self:upcase(item_key) |
| | mode = 6 | | mode = 6 |
| Line 268: |
Line 273: |
| | -- Only add basexp to the list of values if included as a tag | | -- Only add basexp to the list of values if included as a tag |
| | if mode == 6 and tags.basexp then | | if mode == 6 and tags.basexp then |
| | + | i = 0 |
| | basexp = item_key | | basexp = item_key |
| | mode = 7 | | mode = 7 |
| | else | | else |
| − | if mode == 7 then
| + | i = i + 1 |
| − | i = i + 1
| + | |
| − | else
| |
| − | i = 1
| |
| − | end
| |
| − |
| |
| | --Fleets are of variable size, so we append onto a string until we hit the next node declaration | | --Fleets are of variable size, so we append onto a string until we hit the next node declaration |
| | local id = tonumber(item_key) | | local id = tonumber(item_key) |
| Line 318: |
Line 320: |
| | }) | | }) |
| | | | |
| − | if i > 0 and i % 6 == 0 then | + | if i % 6 == 0 then |
| | table.insert(fleet, "<br>") | | table.insert(fleet, "<br>") |
| | end | | end |
| − |
| + | |
| | if ship_air_power then | | if ship_air_power then |
| | as_rating = as_rating + ship_air_power | | as_rating = as_rating + ship_air_power |