- 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 52:
Line 52:
+
Line 150:
Line 151:
+
+
+
+
+
+
+
+
+
− +
Line 162:
Line 172:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Line 254:
Line 318:
− +
− +
+
+
− +
Initial disambiguation implementation
_produced_equipment_label = "<b><small>Produces: 1x ${icon}${name}${stars}</small></b>",
_produced_equipment_label = "<b><small>Produces: 1x ${icon}${name}${stars}</small></b>",
_produced_equipment_stars_template = "★+${stars}",
_produced_equipment_stars_template = "★+${stars}",
_extended_initial_template = "${initial}<small>${extension}</small>",
_equipment_item = "${count}x ${icon}${name}",
_equipment_item = "${count}x ${icon}${name}",
_material_cell_content = "${normal}/${slider}",
_material_cell_content = "${normal}/${slider}",
table.remove(ships, index)
table.remove(ships, index)
end
end
local group = {}
for index, ship in ipairs(ships) do
if ship ~= true and ship ~= false then
table.insert(group, index)
end
end
local initials = self:create_initials(ships, ship_data, group)
for _, stars in ipairs(item:improvement_brackets(product)) do
for _, stars in ipairs(item:improvement_brackets(product)) do
table.insert(result, {item = item, product = product, stars = stars, ships = ships, ship_data = ship_data, ship_names = ship_names, 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, ship_names = ship_names, initials = initials, availability = availability, resources = item:improvement_resources(false, product, stars), resources_x = item:improvement_resources(true, product, stars)})
end
end
end
end
end
end
self._items = result
self._items = result
end
function ImprovementTableKai:create_initials(ships, ship_data, group, initials, place, force_significance)
place = place or 1
initials = initials or {}
local subgroup_index = 1
local forced_groups = {}
local new_initials = {}
local subgroups = {}
local previous_initial = nil
local max_place = 0
local significant = force_significance or place == 1
for _, ship_index in ipairs(group) do
local name = ship_data[ships[ship_index]]:name()
max_place = math.max(max_place, #name)
local initial = false
if #name >= place then
initial = mw.ustring.sub(name, place, place)
end
new_initials[ship_index] = initial
if previous_initial == nil then
previous_initial = initial
elseif initial ~= previous_initial then
previous_initial = initial
significant = true
subgroup_index = subgroup_index + 1
end
if initial == " " then
forced_groups[subgroup_index] = true
end
if not subgroups[subgroup_index] then
subgroups[subgroup_index] = {}
end
table.insert(subgroups[subgroup_index], ship_index)
end
if significant then
for _, ship_index in pairs(group) do
if not initials[ship_index] then
initials[ship_index] = new_initials[ship_index]
else
initials[ship_index] = initials[ship_index] .. new_initials[ship_index]
end
end
end
if place < max_place then
for subgroup_index, subgroup in ipairs(subgroups) do
if forced_groups[subgroup_index] then
initials = self:create_initials(ships, ship_data, subgroup, initials, place + 1, true)
elseif #subgroup > 1 then
initials = self:create_initials(ships, ship_data, subgroup, initials, place + 1)
end
end
end
return initials
end
end
ship_initial = "?"
ship_initial = "?"
else
else
if ship ~= true then
if ship == true then
ship_initial = mw.ustring.sub(row_data.ship_data[ship]:name(), 1, 1)
ship_initial = "✓"
elseif ship == false then
ship_initial = "_"
else
else
ship_initial = "✓"
ship_initial = row_data.initials[index]
end
end
bg_color = self._available_color
bg_color = self._available_color