Line 19: |
Line 19: |
| _empty_node_template = [[| style="text-align: center;" |${values.node} | | _empty_node_template = [[| style="text-align: center;" |${values.node} |
| | colspan="3" style="text-align: center;" |Must be my imagination (battle avoided)]], | | | colspan="3" style="text-align: center;" |Must be my imagination (battle avoided)]], |
− | _resource_node_template = [[| style="text-align: center; background-color: ${values.bg_color};" |${values.node} | + | _resource_node_template = [[| style="text-align: center; background-color: ${values.bg_color}; color: ${values.color};" |${values.node} |
− | | style="text-align: center; background-color: ${values.bg_color};" |${values.node_type} | + | | style="text-align: center; background-color: ${values.bg_color}; color: ${values.color};" |${values.node_type} |
− | | colspan="2" style="text-align: center; background-color: ${values.bg_color};" |${values.text}]], | + | | colspan="2" style="text-align: center; background-color: ${values.bg_color}; color: ${values.color};" |${values.text}]], |
| _columns = { | | _columns = { |
| "node", | | "node", |
Line 152: |
Line 152: |
| amount = "-" .. amount | | amount = "-" .. amount |
| end | | end |
− | local string = node .. "/" .. resource .. "/" .. amount | + | local boss = tags["boss"] and "true" or "false" |
| + | local string = node .. "/" .. resource .. "/" .. amount .. "/" .. boss |
| table.insert(self._items, string) | | table.insert(self._items, string) |
| mode = 1 | | mode = 1 |
Line 269: |
Line 270: |
| end | | end |
| end | | end |
− | elseif mw.ustring.find(row_values, '/') then
| + | elseif mw.ustring.find(row_values, '/') then |
− | local split = mw.ustring.find(row_values, '/')
| + | --node/resource/amount/boss |
− | local node = mw.ustring.sub(row_values, 1, split - 1)
| + | local values = {} |
− | local resource = mw.ustring.sub(row_values, split + 1)
| + | while mw.ustring.find(row_values, '/') do |
− | if resource == "empty" then | + | local split = mw.ustring.find(row_values, '/') |
− | table.insert(self._rows, format{self._empty_node_template, values = { node = node } }) | + | if split then |
| + | table.insert(values, mw.ustring.sub(row_values, 1, split - 1)) |
| + | row_values = mw.ustring.sub(row_values, split + 1) |
| + | end |
| + | end |
| + | table.insert(values, row_values) |
| + | if values[2] == "empty" then |
| + | table.insert(self._rows, format{self._empty_node_template, values = { node = values[1] } }) |
| else | | else |
− | split = mw.ustring.find(resource, '/')
| + | local resource = Formatting:format_image{mw.ustring.sub(values[2], 1, split - 1) .. ".png", caption = mw.ustring.sub(resource, 1, split - 1), size = "22x22px"} |
− | local amount = mw.ustring.sub(resource, split + 1) | + | local text, node_type, bg_color = self:process_resource_node(resource, values[3]) |
− | resource = Formatting:format_image{mw.ustring.sub(resource, 1, split - 1) .. ".png", caption = mw.ustring.sub(resource, 1, split - 1), size = "22x22px"}
| + | local color = "initial" |
− | local text, node_type, bg_color = self:process_resource_node(resource, amount) | + | if values[4] == "true" then |
| + | color = self._boss_battle_color |
| + | end |
| table.insert(self._rows, format{self._resource_node_template, values = { | | table.insert(self._rows, format{self._resource_node_template, values = { |
| node = node, | | node = node, |
| text = text, | | text = text, |
| node_type = node_type, | | node_type = node_type, |
| + | color = color, |
| bg_color = bg_color, | | bg_color = bg_color, |
| }}) | | }}) |