Changes

Fix multiple bugs
Line 47: Line 47:  
_produced_equipment_label = "Produces: 1x ${icon}${name}",
 
_produced_equipment_label = "Produces: 1x ${icon}${name}",
 
_equipment_item = "${count}x ${icon}${name}",
 
_equipment_item = "${count}x ${icon}${name}",
 +
_material_cell_content = "${normal}/${slider}",
 
_unavailable_color = "#f99",
 
_unavailable_color = "#f99",
 
_available_color = "#aaebaa",
 
_available_color = "#aaebaa",
Line 61: Line 62:  
if products then
 
if products then
 
if self._single_item then
 
if self._single_item then
self._title_row = format{[[|+ ${icon}{$name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(equipment:icon())}, name = Formatting:format_link(equipment:link())}
+
self._title_row = format{[[|+ ${icon}{$name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link())}
 
else
 
else
self._custom_rows[item:name()] = format{[[| colspan="12" style="text-align: center; padding:5px 5px 5px 5px;" | ${icon}${name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(equipment:icon())}, name = Formatting:format_link(equipment:link())}
+
self._custom_rows[item:name()] = format{[[| colspan="12" style="text-align: center; padding:5px 5px 5px 5px;" | ${icon}${name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link())}
 
table.insert(result, item:name())
 
table.insert(result, item:name())
 
end
 
end
Line 70: Line 71:  
local availability = {}
 
local availability = {}
 
for _, ship in ipairs(ships) do
 
for _, ship in ipairs(ships) do
table.insert(availability, item:improvement_availability(product, ship))
+
availability[ship] = item:improvement_availability(product, ship)
 
end
 
end
 
for _, stars in ipairs(self._improvement_brackets) do
 
for _, stars in ipairs(self._improvement_brackets) do
Line 78: Line 79:  
end
 
end
 
end
 
end
 +
self._items = result
 
end
 
end
   Line 84: Line 86:  
if row_data.resources then
 
if row_data.resources then
 
local result = {}
 
local result = {}
local consumed_equipment_table = row_data.resources.equipment
+
local consumed_equipment_table = row_data.resources.equipment or {}
 
local consumed_equipment = {}
 
local consumed_equipment = {}
 
for equip, count in pairs(consumed_equipment_table) do
 
for equip, count in pairs(consumed_equipment_table) do
Line 167: Line 169:  
local ships = {}
 
local ships = {}
 
for index, ship in ipairs(row_data.ships) do
 
for index, ship in ipairs(row_data.ships) do
table.insert(ships, Formatting:format_link(ship:link()))
+
if ship ~= true then
 +
table.insert(ships, Formatting:format_link(Ship(ship):link()))
 +
else
 +
table.insert(ships, "Any")
 +
end
 
end
 
end
 
return {values = {value = table.concat(ships, "<br />")}, bg_color = self._transparent, text_align = self._center_align}
 
return {values = {value = table.concat(ships, "<br />")}, bg_color = self._transparent, text_align = self._center_align}
Anonymous user