Line 6: |
Line 6: |
| local Tabber = require('Module:Tabber') | | local Tabber = require('Module:Tabber') |
| | | |
− | local U = require('Module:Utils') | + | local U = require('Module:Core') |
| local format = U.format | | local format = U.format |
| | | |
| local EquipmentInfoKai = BaseData{ | | local EquipmentInfoKai = BaseData{ |
− | _template = [[{|class="${table_class}" id="${table_id}" style="border: 1px solid darkgray; width: 380px; background-color: #fafafa;${float}" | + | _template = [[{|class="${table_class}" id="${table_id}" style="border: 1px solid darkgray; width: 360px; background-color: #fafafa;" |
| |- | | |- |
− | | colspan="2" style="position: relative; padding: 10px 40px; text-align: center; background-color: ${back};${extra_style};" title="${rarity}" | <div style="position: absolute; right: 5px;">${edit_link}</div> | + | | colspan="2" id="kc-eq-namecard" style="position: relative; padding: 10px 40px; text-align: center; background-color: ${back};${extra_style};" title="${rarity}" | <div id="kc-eq-edit-link" style="position: absolute; right: 5px;">${edit_link}</div> |
− | <div style="font-size: 20px;">'''${name}'''</div><div>${localized_name}</div> | + | <div id="kc-eq-en-name" style="font-size: 20px; margin:0 0 4px 0;">'''${name}'''</div> |
− | <div>'''No.${id} ${japanese_name}'''</div> | + | ${localized_name} |
| + | <div id="kc-eq-jp-entry" style="margin:4px 0 0 0;">'''No.${id} ${japanese_name}'''</div> |
| |- | | |- |
− | | colspan="2" style="text-align: center; background-color: whitesmoke;" | | + | | colspan="2" id="kc-eq-statscard" style="text-align: center; background-color: whitesmoke;" | |
− | <div>${icon} <b>${eq_type}</b>${eq_group}<br /> | + | <div id="kc-eq-category" style="margin:0 0 4px 0;">${icon} <b>${eq_type}</b>${eq_group}</div> |
− | <b>Effects: ${effects}</b>${flight_stats}</div> | + | <div id="kc-eq-effects" style="margin:4px 0;"><b>Effects: ${effects}</b></div> |
− | <p>'''Scrap value: ${scrap}''' (${buildable})</p>${alternative_names}
| + | ${flight_stats} |
− | |-
| + | <div id="kc-eq-scrap" style="margin:4px 0 0 0;">'''Scrap value: ${scrap}''' (${buildable})</div> |
− | | colspan="2" style="text-align: center;" | ${card}
| + | ${alternative_names} |
| |- | | |- |
− | | colspan="2" style="text-align: center; background-color: LightSkyBlue;" | '''Refittable Class''' | + | | colspan="2" id="kc-eq-pictures" style="text-align: center;" | ${card} |
| + | |- |
| + | | colspan="2" id="kc-eq-fits" style="text-align: center; background-color: LightSkyBlue;" | '''Refittable Ship Types''' |
| ${compatibility_details}${bonus_details} | | ${compatibility_details}${bonus_details} |
| |}]], | | |}]], |
− | _bonus_header = [[|- | + | _bonus_header = [=[|- |
− | | colspan="2" style="text-align: center; background-color: LightSkyBlue;" | '''Bonus''']], | + | | colspan="2" id="kc-eq-bonus" style="text-align: center; background-color: LightSkyBlue;" | '''Bonus'''${category}]=], |
| _bonus_row = [=[|- | | _bonus_row = [=[|- |
| | style="width: 190px; text-align: center;" | ${text} | | | style="width: 190px; text-align: center;" | ${text} |
Line 41: |
Line 44: |
| _row_starter = "|-", | | _row_starter = "|-", |
| _compatibility_cell = [[| style="width: 190px; text-align: center; background-color: ${bg_color};" | ${label}]], | | _compatibility_cell = [[| style="width: 190px; text-align: center; background-color: ${bg_color};" | ${label}]], |
− | _localized_name_template = "<p>''${localized_name}''</p>", | + | _lbas_compatibility_row = [=[|- |
− | _flight_stats_template = [[<br/><b>Combat Radius: ${combat_radius}</b> (Deployment Cost: ${deployment_cost})]], | + | | colspan="2" style="text-align: center; background-color: LightSkyBlue;" | '''[[LBAS]] Plane''']=], |
| + | _localized_name_template = [[<div id="kc-eq-local-name" style="margin:4px 0;">${localized_name}</div>]], |
| + | _flight_stats_template = [[<div id="kc-eq-flights"><b>Combat Radius: ${combat_radius}</b> (Deployment Cost: ${deployment_cost})</div>]], |
| _alternative_names_template = [[ | | _alternative_names_template = [[ |
| |- | | |- |
− | | colspan="2" style="text-align: center; padding: 0px;" | <div class="mw-collapsible mw-collapsed" style="background-color: lightgrey; margin: 0px;">''Alternate names''<div class="mw-collapsible-content" style="background-color: whitesmoke;"> | + | | colspan="2" id="kc-eq-altnames" style="text-align: center; padding: 0px;" | <div class="mw-collapsible mw-collapsed" style="background-color: lightgrey; margin: 0px;">''Alternate names''<div class="mw-collapsible-content" style="background-color: whitesmoke;"> |
| ${names} | | ${names} |
| </div></div>]], | | </div></div>]], |
Line 53: |
Line 58: |
| _eq_group_template = " (${eq_group})", | | _eq_group_template = " (${eq_group})", |
| _fit_group_tooltip = "Fit group based on experimental findings", | | _fit_group_tooltip = "Fit group based on experimental findings", |
− | _concentrated_label = "Concentrated", | + | --_concentrated_label = "Concentrated", |
| _air_radar_label = "Air Radar", | | _air_radar_label = "Air Radar", |
| _high_angle_label = "High-angle", | | _high_angle_label = "High-angle", |
− | _plus_fire_director_label = " + Fire Director", | + | --_plus_fire_director_label = " + Fire Director", |
− | _library_name_label = "Library name", | + | _card_name_label = "Card name", |
| _list_name_label = "List name", | | _list_name_label = "List name", |
| _comparison_name_label = "Comparison name", | | _comparison_name_label = "Comparison name", |
Line 66: |
Line 71: |
| _buildable = "'''Buildable'''", | | _buildable = "'''Buildable'''", |
| _unbuildable = "''Unbuildable''", | | _unbuildable = "''Unbuildable''", |
− | _float_style_template = "float: ${float};",
| |
| _shown_ship_types = { | | _shown_ship_types = { |
− | 1, 2, | + | 8, 9, |
| + | 10, 11, |
| + | 18, 7, |
| + | 5, 6, |
| 3, 4, | | 3, 4, |
− | 5, 21, | + | 21, 2, |
− | 6, 8,
| + | 1, 13, |
− | 9, 10, | + | 14, 16, |
− | 7, 11, | + | 22, 20, |
− | 18, 16,
| |
− | 13, 14, | |
− | 20, 22,
| |
| 19, 17 | | 19, 17 |
| }, | | }, |
Line 143: |
Line 147: |
| local alternative_names = {} | | local alternative_names = {} |
| local list_name = self._equipment:list_name() | | local list_name = self._equipment:list_name() |
− | local library_name = self._equipment:library_name() | + | local card_name = self._equipment:card_name() |
| local comparison_name = self._equipment:comparison_name() | | local comparison_name = self._equipment:comparison_name() |
| local battle_name = self._equipment:battle_name() | | local battle_name = self._equipment:battle_name() |
Line 160: |
Line 164: |
| table.insert(alternative_names, format{self._alternative_name_template, label = self._list_name_label, name = list_name, japanese_name = list_japanese_name}) | | table.insert(alternative_names, format{self._alternative_name_template, label = self._list_name_label, name = list_name, japanese_name = list_japanese_name}) |
| end | | end |
− | if library_name then | + | if card_name then |
− | local library_japanese_name = self._equipment:library_japanese_name() | + | local card_japanese_name = self._equipment:card_japanese_name() |
− | local library_reading = self._equipment:library_reading() | + | local card_reading = self._equipment:card_reading() |
− | if library_reading ~= false then | + | if card_reading ~= false then |
− | library_japanese_name = tostring(Formatting:japanese_text(Formatting:format_stat(library_japanese_name), Formatting:format_stat(library_reading))) | + | card_japanese_name = tostring(Formatting:japanese_text(Formatting:format_stat(card_japanese_name), Formatting:format_stat(card_reading))) |
| end | | end |
− | local library_localized_name = self._equipment:library_localized_name() | + | local card_localized_name = self._equipment:card_localized_name() |
− | if library_localized_name then | + | if card_localized_name then |
− | library_name = Formatting:tooltip(Formatting:format_stat(library_name), Formatting:format_stat(library_localized_name)) | + | card_name = Formatting:tooltip(Formatting:format_stat(card_name), Formatting:format_stat(card_localized_name)) |
| else | | else |
− | library_name = Formatting:format_stat(library_name) | + | card_name = Formatting:format_stat(card_name) |
| end | | end |
− | table.insert(alternative_names, format{self._alternative_name_template, label = self._library_name_label, name = library_name, japanese_name = library_japanese_name}) | + | table.insert(alternative_names, format{self._alternative_name_template, label = self._card_name_label, name = card_name, japanese_name = card_japanese_name}) |
| end | | end |
| if comparison_name then | | if comparison_name then |
Line 223: |
Line 227: |
| function EquipmentInfoKai:eq_type() | | function EquipmentInfoKai:eq_type() |
| local eq_type = self._equipment:type() | | local eq_type = self._equipment:type() |
− | self._vars.eq_type = Formatting:format_equipment_types(self._equipment) | + | self._vars.eq_type = Formatting:format_equipment_type(self._equipment:type()) |
| local album_type = self._equipment:album_type() | | local album_type = self._equipment:album_type() |
| if album_type then | | if album_type then |
Line 231: |
Line 235: |
| if eq_type == 3 or eq_type == 38 then | | if eq_type == 3 or eq_type == 38 then |
| self._vars.eq_group = format{self._eq_group_template, eq_group = Formatting:tooltip(Formatting:format_stat(self._equipment:gun_fit_group()), self._fit_group_tooltip)} | | self._vars.eq_group = format{self._eq_group_template, eq_group = Formatting:tooltip(Formatting:format_stat(self._equipment:gun_fit_group()), self._fit_group_tooltip)} |
− | elseif eq_type == 21 then | + | --elseif eq_type == 21 then |
− | local aa = self._equipment:aa()
| + | -- local aa = self._equipment:aa() |
− | if aa and aa >= 9 then
| + | -- if aa and aa >= 9 then |
− | self._vars.eq_group = format{self._eq_group_template, eq_group = self._concentrated_label}
| + | -- self._vars.eq_group = format{self._eq_group_template, eq_group = self._concentrated_label} |
− | end
| + | -- end |
| elseif eq_type == 12 or eq_type == 13 or eq_type == 93 then | | elseif eq_type == 12 or eq_type == 13 or eq_type == 93 then |
| local aa = self._equipment:aa() | | local aa = self._equipment:aa() |
Line 242: |
Line 246: |
| end | | end |
| else | | else |
− | local icon = self._equipment:icon() | + | --local icon = self._equipment:icon() |
− | if icon and icon == 16 then | + | --if icon and icon == 16 then |
− | local aa = self._equipment:aa()
| + | -- local aa = self._equipment:aa() |
− | local eq_group = self._high_angle_label
| + | -- local eq_group = self._high_angle_label |
− | if aa and aa >= 8 then
| + | -- if aa and aa >= 8 then |
− | eq_group = eq_group .. self._plus_fire_director_label
| + | -- eq_group = eq_group .. self._plus_fire_director_label |
− | end
| + | -- end |
− | self._vars.eq_group = format{self._eq_group_template, eq_group = eq_group}
| + | -- self._vars.eq_group = format{self._eq_group_template, eq_group = eq_group} |
− | end | + | --end |
| end | | end |
| end | | end |
Line 299: |
Line 303: |
| caption = table.concat(card_caption) | | caption = table.concat(card_caption) |
| end | | end |
− | tabber:add_tab("Card", EquipmentCardKai:get{equip = self._equipment, caption = caption}) | + | tabber:add_tab("Card", EquipmentCardKai:get{equip = self._equipment, caption = caption, size = "350px", align = "center"}) |
− | tabber:add_tab("Fairy", EquipmentGraphicKai:get{equip = self._equipment, fairy = "only"}) | + | tabber:add_tab("Fairy", EquipmentGraphicKai:get{equip = self._equipment, fairy = "only", size = "350px", align = "center"}) |
− | tabber:add_tab("Equipment", EquipmentGraphicKai:get{equip = self._equipment}) | + | tabber:add_tab("Equipment", EquipmentGraphicKai:get{equip = self._equipment, size = "350px", align = "center"}) |
− | tabber:add_tab("Combination", EquipmentGraphicKai:get{equip = self._equipment, fairy = true}) | + | tabber:add_tab("Combination", EquipmentGraphicKai:get{equip = self._equipment, fairy = true, size = "350px", align = "center"}) |
| self._vars.card = tostring(tabber) | | self._vars.card = tostring(tabber) |
| end | | end |
Line 324: |
Line 328: |
| table.insert(result, format{self._compatibility_cell, bg_color = Formatting:format_equipment_compatibility(compatibility), label = ship_label}) | | table.insert(result, format{self._compatibility_cell, bg_color = Formatting:format_equipment_compatibility(compatibility), label = ship_label}) |
| --table.insert(result, format{self._compatibility_cell, bg_color = Formatting:format_equipment_compatibility_color(compatibility), label = ship_label}) | | --table.insert(result, format{self._compatibility_cell, bg_color = Formatting:format_equipment_compatibility_color(compatibility), label = ship_label}) |
| + | end |
| + | if self._equipment:is_lbas_plane() then |
| + | table.insert(result, self._lbas_compatibility_row) |
| end | | end |
| self._vars.compatibility_details = table.concat(result, "\n") | | self._vars.compatibility_details = table.concat(result, "\n") |
Line 330: |
Line 337: |
| local function format_bonus_text(desc) | | local function format_bonus_text(desc) |
| local with_formats = { | | local with_formats = { |
− | ["Radar"] = "[[File:Radar.png|link=Radar]]", | + | ["Radar"] = "[[File:Radar.png|link=Radar|Radar with accuracy ≥ 3]]", |
| + | ["SRadar"] = "[[File:Radar.png|link=Radar|Surface Radar with accuracy ≥ 3]]", |
| + | ["ARadar"] = "[[File:Radar.png|link=Radar|Air Radar with accuracy ≥ 3]]", |
| + | ["53Torpedo"] = "[[File:Torpedo.png|link=53cm Twin Torpedo Mount|53cm Twin Torpedo Mount]]", |
| + | ["61Torpedo"] = "[[File:Torpedo.png|link=Category:Equipment fits with 12.7cm Single High-angle Gun Mount (Late Model)|Fits with 61cm Triple Torpedo Mount and 61cm Triple (Oxygen) Torpedo Mount only]]", |
| } | | } |
| local with = desc._with and with_formats[desc._with] and " " .. with_formats[desc._with] or "" | | local with = desc._with and with_formats[desc._with] and " " .. with_formats[desc._with] or "" |
− | local count = desc._count and " ×" .. desc._count or "" | + | local count = desc._count and " " .. Formatting:tooltip("×" .. desc._count, "amount of equipment") or "" |
| local text = desc._ship and | | local text = desc._ship and |
| string.format("[[%s]]%s", desc._ship, count) or | | string.format("[[%s]]%s", desc._ship, count) or |
Line 356: |
Line 367: |
| | | |
| function EquipmentInfoKai:bonus_details() | | function EquipmentInfoKai:bonus_details() |
− | local result = { self._bonus_header } | + | --[=[ |
| + | local result = { format{self._bonus_header, category = U.category("Equipment with stat bonuses") } } |
| for _, ship in ipairs(U.isort(U.keys(self._equipment._bonus or {}))) do | | for _, ship in ipairs(U.isort(U.keys(self._equipment._bonus or {}))) do |
| local s = self._equipment._bonus[ship] or {} | | local s = self._equipment._bonus[ship] or {} |
Line 405: |
Line 417: |
| prevText = text | | prevText = text |
| end | | end |
− | self._vars.bonus_details = #result > 1 and ("\n" .. table.concat(result, "\n")) or "" | + | ]=]-- |
| + | self._vars.bonus_details = "" -- #result > 1 and ("\n" .. table.concat(result, "\n")) or "" |
| end | | end |
| | | |
Line 427: |
Line 440: |
| | | |
| function EquipmentInfoKai:create_item() | | function EquipmentInfoKai:create_item() |
− | if self._args.name then | + | self._equipment = Equipment(self._args[1], self._enemy) |
− | self._equipment = Equipment(self._args.name, self._args.model)
| |
− | else
| |
− | self._equipment = Equipment(self._args[1])
| |
− | end
| |
| end | | end |
| | | |
Line 451: |
Line 460: |
| self._vars.table_class = table.concat(table_classes, " ") | | self._vars.table_class = table.concat(table_classes, " ") |
| self._vars.table_id = collapsible and collapsible ~= "true" and ("mw-customcollapsible-" .. collapsible) or "" | | self._vars.table_id = collapsible and collapsible ~= "true" and ("mw-customcollapsible-" .. collapsible) or "" |
− | self._vars.float = self._args.float and format{self._float_style_template, float = self._args.float} or "" | + | -- self._vars.float = self._args.float and "" or self._float_style_template |
| end | | end |
| | | |