Changes

no edit summary
Line 15: Line 15:  
<b>Effects: ${effects}</b>
 
<b>Effects: ${effects}</b>
   −
'''Scrap value: ${scrap}'''
+
'''Scrap value: ${scrap}'''${alternative_names}
 
|-  
 
|-  
 
| colspan="2" style="text-align: center;" | ${card}
 
| colspan="2" style="text-align: center;" | ${card}
Line 25: Line 25:  
_compatibility_cell = [[| style="width: 200px; text-align: center; background-color: ${bg_color};" | ${label}]],
 
_compatibility_cell = [[| style="width: 200px; text-align: center; background-color: ${bg_color};" | ${label}]],
 
_localized_name_template = "<p>''${localized_name}''</p>",
 
_localized_name_template = "<p>''${localized_name}''</p>",
 +
_alternative_names_template = [[
 +
|-
 +
<div class="mw-collapsible mw-collapsed" style="background-color: lightgrey;">''Alternate names''<div class="mw-collapsible-content" style="background-color: whitesmoke;">
 +
${names}
 +
</div></div>]],
 +
_alternative_name_template = [[<p><div style="display: inline-block; vertical-align: middle;"><small>''${label}:''</small></div> <div style="display: inline-block; vertical-align: middle;"><small>''${name}<br />${japanese_name}''</small></div></p>]],
 +
_library_name_label = "Library name",
 +
_list_name_label = "List name",
 +
_comparison_name_label = "Comparison name",
 
_equipment_data_documentation = "Template:EquipmentDataDocumentation/EditIntro",
 
_equipment_data_documentation = "Template:EquipmentDataDocumentation/EditIntro",
 
_edit_link_text = "Edit",
 
_edit_link_text = "Edit",
Line 80: Line 89:  
end
 
end
 
return ""
 
return ""
 +
end
 +
 +
function EquipmentInfoKai:alternative_names(equipment)
 +
local alternative_names = {}
 +
local list_name = equipment:list_name()
 +
local library_name = equipment:library_name()
 +
local comparison_name = equipment:comparison_name()
 +
if list_name then
 +
local list_japanese_name = equipment:list_japanese_name()
 +
local list_reading = equipment:list_reading()
 +
if list_reading ~= false then
 +
list_japanese_name = Formatting:tooltip(Formatting:format_stat(list_japanese_name), Formatting:format_stat(list_reading))
 +
end
 +
local list_localized_name = equipment:list_localized_name()
 +
if list_localized_name then
 +
list_name = Formatting:tooltip(Formatting:format_stat(list_name), Formatting:format_stat(list_localized_name))
 +
else
 +
list_name = Formatting:format_stat(list_name)
 +
end
 +
table.insert(alternative_names, format{self._alternative_name_template, label = self._list_name_label, name = list_name, japanese_name = list_japanese_name})
 +
end
 +
if library_name then
 +
local library_japanese_name = equipment:library_japanese_name()
 +
local library_reading = equipment:library_reading()
 +
if library_reading ~= false then
 +
library_japanese_name = Formatting:tooltip(Formatting:format_stat(library_japanese_name), Formatting:format_stat(library_reading))
 +
end
 +
local library_localized_name = equipment:library_localized_name()
 +
if library_localized_name then
 +
library_name = Formatting:tooltip(Formatting:format_stat(library_name), Formatting:format_stat(library_localized_name))
 +
else
 +
library_name = Formatting:format_stat(library_name)
 +
end
 +
table.insert(alternative_names, format{self._alternative_name_template, label = self._library_name_label, name = library_name, japanese_name = library_japanese_name})
 +
end
 +
if comparison_name then
 +
local comparison_japanese_name = equipment:comparison_japanese_name()
 +
local comparison_reading = equipment:comparison_reading()
 +
if comparison_reading ~= false then
 +
comparison_japanese_name = Formatting:tooltip(Formatting:format_stat(comparison_japanese_name), Formatting:format_stat(comparison_reading))
 +
end
 +
local comparison_localized_name = equipment:comparison_localized_name()
 +
if comparison_localized_name then
 +
comparison_name = Formatting:tooltip(Formatting:format_stat(comparison_name), Formatting:format_stat(comparison_localized_name))
 +
else
 +
comparison_name = Formatting:format_stat(comparison_name)
 +
end
 +
table.insert(alternative_names, format{self._alternative_name_template, label = self._comparison_name_label, name = comparison_name, japanese_name = comparison_japanese_name})
 +
end
 +
if #alternative_names == 0 then
 +
return ""
 +
end
 +
return format{self._alternative_names_template, names = table.concat(alternative_names, "/n")}
 
end
 
end
   Line 167: Line 229:  
name = self:name(equipment),  
 
name = self:name(equipment),  
 
localized_name = self:localized_name(equipment),
 
localized_name = self:localized_name(equipment),
 +
alternative_names = self:alternative_names(equipment),
 
id = self:id(equipment),
 
id = self:id(equipment),
 
japanese_name = self:japanese_name(equipment),
 
japanese_name = self:japanese_name(equipment),
Anonymous user