Line 7: |
Line 7: |
| | | |
| local ShipRemodelListKai = BaseTable{ | | local ShipRemodelListKai = BaseTable{ |
− | _header_template = [[! colspan=6 | Before Remodel | + | _header_template = [[! colspan=4 | Before Remodel |
| ! rowspan=2 style="width:30px;" | ⇒ | | ! rowspan=2 style="width:30px;" | ⇒ |
| ! colspan=3 | After Remodel | | ! colspan=3 | After Remodel |
− | ! colspan=3 | Required Resources | + | ! colspan=11 | Required Resources |
| |- | | |- |
| ! style="width: 50px;" | No. | | ! style="width: 50px;" | No. |
Line 16: |
Line 16: |
| ! style="width: 30px;" | Type | | ! style="width: 30px;" | Type |
| ! style="width: 30px;" | Level | | ! style="width: 30px;" | Level |
− | ! style="width: 30px;" | ${blueprint}
| |
− | ! style="width: 30px;" | ${catapult}
| |
| ! style="width: 50px;" | No. | | ! style="width: 50px;" | No. |
| ! style="width: 100px;" | Name | | ! style="width: 100px;" | Name |
Line 23: |
Line 21: |
| ! style="width: 30px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo} | | ! style="width: 30px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo} |
| ! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightgrey;" | ${steel} | | ! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightgrey;" | ${steel} |
− | ! style="width: 30px;" | ${devmat}]], | + | ! style="width: 30px;" | ${devmat} |
| + | ! style="width: 30px;" | ${conmat} |
| + | ! style="width: 30px;" | ${screw} |
| + | ! style="width: 30px;" | ${blueprint} |
| + | ! style="width: 30px;" | ${catapult} |
| + | ! style="width: 30px;" | ${report} |
| + | ! style="width: 30px;" | ${gunmat} |
| + | ! style="width: 30px;" | ${airmat} |
| + | ! style="width: 30px;" | ${armament}]], |
| _header_template_bottom = [[! style="width: 50px;" | No. | | _header_template_bottom = [[! style="width: 50px;" | No. |
| ! style="width: 100px;" | Name | | ! style="width: 100px;" | Name |
| ! style="width: 30px;" | Type | | ! style="width: 30px;" | Type |
| ! style="width: 30px;" | Level | | ! style="width: 30px;" | Level |
− | ! style="width: 30px;" | ${blueprint}
| |
− | ! style="width: 30px;" | ${catapult}
| |
| ! rowspan=2 style="width:30px;" | ⇒ | | ! rowspan=2 style="width:30px;" | ⇒ |
| ! style="width: 50px;" | No. | | ! style="width: 50px;" | No. |
Line 37: |
Line 41: |
| ! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightgrey;" | ${steel} | | ! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightgrey;" | ${steel} |
| ! style="width: 30px;" | ${devmat} | | ! style="width: 30px;" | ${devmat} |
| + | ! style="width: 30px;" | ${conmat} |
| + | ! style="width: 30px;" | ${screw} |
| + | ! style="width: 30px;" | ${blueprint} |
| + | ! style="width: 30px;" | ${catapult} |
| + | ! style="width: 30px;" | ${report} |
| + | ! style="width: 30px;" | ${gunmat} |
| + | ! style="width: 30px;" | ${airmat} |
| + | ! style="width: 30px;" | ${armament} |
| |- | | |- |
− | ! colspan=6 | Before Remodel | + | ! colspan=4 | Before Remodel |
| ! colspan=3 | After Remodel | | ! colspan=3 | After Remodel |
− | ! colspan=3 | Required Resources]], | + | ! colspan=11 | Required Resources]], |
| _columns = { | | _columns = { |
| "id", | | "id", |
Line 46: |
Line 58: |
| "type", | | "type", |
| "remodel_level", | | "remodel_level", |
− | "remodel_blueprint",
| |
− | "remodel_catapult",
| |
| "arrow", | | "arrow", |
| "id_after", | | "id_after", |
Line 55: |
Line 65: |
| "steel", | | "steel", |
| "devmat", | | "devmat", |
| + | "conmat", |
| + | "screw", |
| + | "blueprint", |
| + | "catapult", |
| + | "report", |
| + | "gunmat", |
| + | "airmat", |
| + | "armament", |
| }, | | }, |
| _empty_cell = [[| style="text-align: center; vertical-align: middle;" | -]], | | _empty_cell = [[| style="text-align: center; vertical-align: middle;" | -]], |
Line 100: |
Line 118: |
| end | | end |
| return {values = {value = remodel_level == false and self._dash or Formatting:format_stat(remodel_level)}, bg_color = self._transparent, text_align = self._center_align} | | return {values = {value = remodel_level == false and self._dash or Formatting:format_stat(remodel_level)}, bg_color = self._transparent, text_align = self._center_align} |
− | end
| |
− |
| |
− | function ShipRemodelListKai:remodel_blueprint(ship)
| |
− | local value = self._dash
| |
− | if self._remodel_to then
| |
− | if self._remodel_is_reversion then
| |
− | value = Formatting:format_blueprint_requirement(ship:remodel_to_blueprint(), true)
| |
− | else
| |
− | value = Formatting:format_blueprint_requirement(self._remodel_to:remodel_blueprint(), true)
| |
− | end
| |
− | elseif self._remodel_to == nil then
| |
− | value = self._question_marks
| |
− | end
| |
− | return {values = {value = value}, bg_color = self._transparent, text_align = self._center_align}
| |
− | end
| |
− |
| |
− | function ShipRemodelListKai:remodel_catapult(ship)
| |
− | local value = self._dash
| |
− | if self._remodel_to then
| |
− | if self._remodel_is_reversion then
| |
− | value = Formatting:format_catapult_requirement(ship:remodel_to_catapult(), true)
| |
− | else
| |
− | value = Formatting:format_catapult_requirement(self._remodel_to:remodel_catapult(), true)
| |
− | end
| |
− | elseif self._remodel_to == nil then
| |
− | value = self._question_marks
| |
− | end
| |
− | return {values = {value = value}, bg_color = self._transparent, text_align = self._center_align}
| |
| end | | end |
| | | |
Line 161: |
Line 151: |
| return {values = {value = type_after}, bg_color = self._transparent, text_align = self._center_align} | | return {values = {value = type_after}, bg_color = self._transparent, text_align = self._center_align} |
| end | | end |
| + | |
| + | function ShipRemodelListKai:get_remodel_item_count(ship, item) |
| + | local value = self._remodel_to == nil and self._question_marks |
| + | or self._remodel_is_reversion and ship:remodel_to_cost()[item] |
| + | or self._remodel_to:remodel_cost()[item] |
| + | or self._dash |
| + | return {values = {value = value}, bg_color = self._transparent, text_align = self._center_align} |
| + | end |
| + | |
| + | -- TODO: fancy formatting |
| + | -- Formatting:format_blueprint_requirement(ship:remodel_to_blueprint(), true) |
| + | -- Formatting:format_blueprint_requirement(self._remodel_to:remodel_blueprint(), true) |
| + | -- Formatting:format_catapult_requirement(ship:remodel_to_catapult(), true) |
| + | -- Formatting:format_catapult_requirement(self._remodel_to:remodel_catapult(), true) |
| + | -- etc. |
| | | |
| function ShipRemodelListKai:ammo(ship) | | function ShipRemodelListKai:ammo(ship) |
− | local ammo = self._remodel_to == nil and self._question_marks or self._dash | + | return self:get_remodel_item_count(ship, 'ammo') |
− | if self._remodel_to then
| |
− | if self._remodel_is_reversion then
| |
− | ammo = ship:remodel_to_cost().ammo
| |
− | else
| |
− | ammo = self._remodel_to:remodel_cost().ammo
| |
− | end
| |
− | end
| |
− | return {values = {value = ammo or self._dash}, bg_color = self._transparent, text_align = self._center_align}
| |
| end | | end |
| | | |
| function ShipRemodelListKai:steel(ship) | | function ShipRemodelListKai:steel(ship) |
− | local steel = self._remodel_to == nil and self._question_marks or self._dash | + | return self:get_remodel_item_count(ship, 'steel') |
− | if self._remodel_to then
| |
− | if self._remodel_is_reversion then
| |
− | steel = ship:remodel_to_cost().steel
| |
− | else
| |
− | steel = self._remodel_to:remodel_cost().steel
| |
− | end
| |
− | end
| |
− | return {values = {value = steel or self._dash}, bg_color = self._transparent, text_align = self._center_align}
| |
| end | | end |
| | | |
| function ShipRemodelListKai:devmat(ship) | | function ShipRemodelListKai:devmat(ship) |
− | local devmat = self._remodel_to == nil and self._question_marks or self._dash | + | return self:get_remodel_item_count(ship, 'devmat') |
− | if self._remodel_to then | + | end |
− | if self._remodel_is_reversion then
| + | |
− | devmat = ship:remodel_to_cost().devmat
| + | function ShipRemodelListKai:conmat(ship) |
− | else
| + | return self:get_remodel_item_count(ship, 'conmat') |
− | devmat = self._remodel_to:remodel_cost().devmat
| + | end |
− | end
| + | |
− | end | + | function ShipRemodelListKai:screw(ship) |
− | return {values = {value = devmat or self._dash}, bg_color = self._transparent, text_align = self._center_align} | + | return self:get_remodel_item_count(ship, 'screw') |
| + | end |
| + | |
| + | function ShipRemodelListKai:blueprint(ship) |
| + | return self:get_remodel_item_count(ship, 'blueprint') |
| + | end |
| + | |
| + | function ShipRemodelListKai:catapult(ship) |
| + | return self:get_remodel_item_count(ship, 'catapult') |
| + | end |
| + | |
| + | function ShipRemodelListKai:report(ship) |
| + | return self:get_remodel_item_count(ship, 'report') |
| + | end |
| + | |
| + | function ShipRemodelListKai:gunmat(ship) |
| + | return self:get_remodel_item_count(ship, 'gunmat') |
| + | end |
| + | |
| + | function ShipRemodelListKai:airmat(ship) |
| + | return self:get_remodel_item_count(ship, 'airmat') |
| + | end |
| + | |
| + | function ShipRemodelListKai:armament(ship) |
| + | return self:get_remodel_item_count(ship, 'armament') |
| end | | end |
| | | |
Line 204: |
Line 217: |
| function ShipRemodelListKai:create_header() | | function ShipRemodelListKai:create_header() |
| local header_icons = { | | local header_icons = { |
− | blueprint = ResourceIcons.blueprint,
| |
− | catapult = ResourceIcons.prototype_deck_catapult_item,
| |
| ammo = ResourceIcons.ammo, | | ammo = ResourceIcons.ammo, |
| steel = ResourceIcons.steel, | | steel = ResourceIcons.steel, |
| devmat = ResourceIcons.devmat, | | devmat = ResourceIcons.devmat, |
| + | conmat = ResourceIcons.conmat, |
| + | screw = ResourceIcons.screw, |
| + | blueprint = ResourceIcons.blueprint, |
| + | catapult = ResourceIcons.prototype_deck_catapult, |
| + | report = ResourceIcons.report, |
| + | gunmat = ResourceIcons.new_model_gun_mount_improvement_material, |
| + | airmat = ResourceIcons.new_model_aerial_armament_material, |
| + | armament = ResourceIcons.new_model_armament_material, |
| } | | } |
| for key, value in pairs(header_icons) do | | for key, value in pairs(header_icons) do |
− | header_icons[key] = Formatting:format_image{value, caption = Formatting:format_resource_name(key), size = (key == "blueprint" or key == "catapult") and "24px" or nil} | + | local title = Formatting:format_resource_name(key) |
| + | header_icons[key] = Formatting:format_image{value, caption = title, link = title} |
| + | -- size = (key == "blueprint" or key == "catapult") and "24px" or nil} |
| end | | end |
| self._header = format(self._header_template, header_icons) | | self._header = format(self._header_template, header_icons) |