Changes

Allow equipment argument that has no improvements
Line 62: Line 62:  
for _, item in ipairs(self._items) do
 
for _, item in ipairs(self._items) do
 
local products = item:improvement_products()
 
local products = item:improvement_products()
 +
if self._single_item then
 +
self._title_row = format{[[|+ ${icon}${name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link())}
 +
else
 +
self._custom_rows[item:name()] = format{[[! colspan="12" style="text-align: center; padding:5px 5px 5px 5px;" | ${icon}${name}: ${resources}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link()), resources = Formatting:format_resources(item:improvement_resources() or {devmat = false, screw = false})}
 +
table.insert(result, item:name())
 +
end
 
if products then
 
if products then
if self._single_item then
  −
self._title_row = format{[[|+ ${icon}${name}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link())}
  −
else
  −
self._custom_rows[item:name()] = format{[[! colspan="12" style="text-align: center; padding:5px 5px 5px 5px;" | ${icon}${name}: ${resources}]], icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())}, name = Formatting:format_link(item:link()), resources = Formatting:format_resources(item:improvement_resources() or {devmat = false, screw = false})}
  −
table.insert(result, item:name())
  −
end
   
for _, product in ipairs(products) do
 
for _, product in ipairs(products) do
 
local ships = item:improvement_ships(product)
 
local ships = item:improvement_ships(product)
Line 105: Line 105:  
table.insert(result, {item = item, product = product, stars = stars, ships = ships, ship_data = ship_data, availability = availability, resources = item:improvement_resources(false, product, stars), resources_x = item:improvement_resources(true, product, stars)})
 
table.insert(result, {item = item, product = product, stars = stars, ships = ships, ship_data = ship_data, availability = availability, resources = item:improvement_resources(false, product, stars), resources_x = item:improvement_resources(true, product, stars)})
 
end
 
end
 +
end
 +
else
 +
for _, stars in ipairs(self._improvement_brackets) do
 +
table.insert(result, {item = item, stars = stars})
 
end
 
end
 
end
 
end
Line 186: Line 190:  
local availability = {}
 
local availability = {}
 
local available = false
 
local available = false
for index, ship in ipairs(row_data.ships) do
+
if row_data.ships then
if row_data.availability[ship][day] then
+
for index, ship in ipairs(row_data.ships) do
available = true
+
if row_data.availability[ship][day] then
local ship_initial
+
available = true
if ship ~= true then
+
local ship_initial
ship_initial = mw.ustring.sub(row_data.ship_data[ship]:name(), 1, 1)
+
if ship ~= true then
 +
ship_initial = mw.ustring.sub(row_data.ship_data[ship]:name(), 1, 1)
 +
else
 +
ship_initial = "✓"
 +
end
 +
table.insert(availability, ship_initial)
 
else
 
else
ship_initial = ""
+
table.insert(availability, " ")
 
end
 
end
table.insert(availability, ship_initial)
  −
else
  −
table.insert(availability, " ")
   
end
 
end
 
end
 
end
Line 205: Line 211:  
function ImprovementTableKai:helper_ships(row_data)
 
function ImprovementTableKai:helper_ships(row_data)
 
local ships = {}
 
local ships = {}
for index, ship in ipairs(row_data.ships) do
+
if row_data.ships then
if ship ~= true then
+
for index, ship in ipairs(row_data.ships) do
table.insert(ships, Formatting:format_link(row_data.ship_data[ship]:link()))
+
if ship ~= true then
else
+
table.insert(ships, Formatting:format_link(row_data.ship_data[ship]:link()))
table.insert(ships, "Any")
+
else
 +
table.insert(ships, "Any")
 +
end
 
end
 
end
 
end
 
end
Anonymous user