- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Changes
Jump to navigation
Jump to search
Line 44:
Line 44:
+
+
+
+
Line 60:
Line 64:
− +
− +
− 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+
− for _, product in ipairs(products) do+
− local ships = item:improvement_ships(product)+
− local availability = {}+
− local ship_data = {}+
− for _, ship in ipairs(ships) do+
− availability[ship] = item:improvement_availability(product, ship)+
− if type(ship) == "string" then+
− ship_data[ship] = Ship(ship)+
+
+
+
+
+
+
+
+
+
+
+
+
− end+
− local ships_to_skip = {[true] = true}+
− local indexes_to_delete = {}+
− for index, ship in ipairs(ships) do+
− if not ships_to_skip[ship] then+
− local remodel_from = ship_data[ship]:remodel_from()+
− if ship_data[remodel_from] then+
− local identical = true+
− for day, possible in pairs(availability[ship]) do+
− if availability[remodel_from][day] ~= possible then+
− +
+
+
+
+
− end
− if identical then
− ships_to_skip[ship] = true
− table.insert(indexes_to_delete, index)
+
+
+
+
+
+
+
− table.sort(indexes_to_delete, function(a,b) return a > b end)+
− for _, index in ipairs(indexes_to_delete) do
− table.remove(ships, index)
− end
− +
− end
− else
− for _, stars in ipairs(self._improvement_brackets) do
− table.insert(result, {item = item, stars = stars})
Add edit links
10
10
},
},
_caption_template = [[|+ style="position: relative;" | ${icon}${name}<span style="position: absolute; right: 5px;">${edit_link}</span>]],
_name_custom_row_template = [[! colspan="12" style="text-align: center; padding:5px 5px 5px 5px;" | ${icon}${name}: ${resources}<span style="position: absolute; right: 5px;">${edit_link}</span>]],
_edit_link_text = "Edit",
_equipment_data_documentation = "Template:EquipmentDataDocumentation/EditIntro",
_basic_resources_label = "Improvement Cost: ",
_basic_resources_label = "Improvement Cost: ",
_consumed_equipment_label = "<small>Consumes: ${list}</small>",
_consumed_equipment_label = "<small>Consumes: ${list}</small>",
self._single_item = true
self._single_item = true
end
end
for _, item in ipairs(self._items) do
for item_index, item in ipairs(self._items) do
local products = item:improvement_products()
if type(item) ~= "string" then
local products = item:improvement_products()
local edit_link = Formatting:format_edit_link(Equipment:get_module(self._args[item_index]), self._edit_link_text, self._equipment_data_documentation)
if self._single_item then
self._title_row = format{self._caption_template,
icon = Formatting:format_image{Formatting:format_equipment_icon(item:icon())},
name = Formatting:format_link(item:link()),
edit_link = edit_link,
}
else
self._custom_rows[item:name()] = format{self._name_custom_row_template,
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}),
edit_link = edit_link,
}
table.insert(result, item:name())
end
if products then
for _, product in ipairs(products) do
local ships = item:improvement_ships(product)
local availability = {}
local ship_data = {}
for _, ship in ipairs(ships) do
availability[ship] = item:improvement_availability(product, ship)
if type(ship) == "string" then
ship_data[ship] = Ship(ship)
end
end
end
local ships_to_skip = {[true] = true}
local indexes_to_delete = {}
for index, ship in ipairs(ships) do
if not ships_to_skip[ship] then
local remodel_from = ship_data[ship]:remodel_from()
if ship_data[remodel_from] then
local identical = true
for day, possible in pairs(availability[ship]) do
if availability[remodel_from][day] ~= possible then
identical = false
identical = false
end
end
if identical then
ships_to_skip[ship] = true
table.insert(indexes_to_delete, index)
end
end
end
end
end
end
end
table.sort(indexes_to_delete, function(a,b) return a > b end)
for _, index in ipairs(indexes_to_delete) do
table.remove(ships, index)
end
for _, stars in ipairs(self._improvement_brackets) do
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
end
else
for _, stars in ipairs(self._improvement_brackets) do
for _, stars in ipairs(self._improvement_brackets) do
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, stars = stars})
end
end
end
end
end
end