Changes

no edit summary
Line 10: Line 10:  
! rowspan=2 style="width:30px;" | ⇒
 
! rowspan=2 style="width:30px;" | ⇒
 
! colspan=3 | After Remodel
 
! colspan=3 | After Remodel
! colspan=11 | Required Resources
+
! colspan=12 | Required Resources
 
|-
 
|-
 
! style="width: 50px;" | No.
 
! style="width: 50px;" | No.
Line 29: Line 29:  
! style="width: 30px;" | ${gunmat}
 
! style="width: 30px;" | ${gunmat}
 
! style="width: 30px;" | ${airmat}
 
! style="width: 30px;" | ${airmat}
! style="width: 30px;" | ${armament}]],
+
! style="width: 30px;" | ${armament}
 +
! style="width: 30px;" | ${overseas}]],
 
_header_template_bottom = [[! style="width: 50px;" | No.
 
_header_template_bottom = [[! style="width: 50px;" | No.
 
! style="width: 100px;" | Name
 
! style="width: 100px;" | Name
Line 49: Line 50:  
! style="width: 30px;" | ${airmat}
 
! style="width: 30px;" | ${airmat}
 
! style="width: 30px;" | ${armament}
 
! style="width: 30px;" | ${armament}
 +
! style="width: 30px;" | ${overseas}
 
|-
 
|-
 
! colspan=4 | Before Remodel
 
! colspan=4 | Before Remodel
 
! colspan=3 | After Remodel
 
! colspan=3 | After Remodel
! colspan=11 | Required Resources]],
+
! colspan=12 | Required Resources]],
 
_columns = {
 
_columns = {
 
"id",
 
"id",
Line 73: Line 75:  
"airmat",
 
"airmat",
 
"armament",
 
"armament",
 +
"overseas",
 
},
 
},
 
_empty_cell = [[| style="text-align: center; vertical-align: middle;" | -]],
 
_empty_cell = [[| style="text-align: center; vertical-align: middle;" | -]],
Line 103: Line 106:  
function ShipRemodelListKai:remodel_level(ship)
 
function ShipRemodelListKai:remodel_level(ship)
 
self._remodel_to = ship:remodel_to()
 
self._remodel_to = ship:remodel_to()
 +
self._remodel_is_reversion = false
 
local remodel_level = false
 
local remodel_level = false
 
if self._remodel_to then
 
if self._remodel_to then
if self._remodel_to == ship:remodel_from() then
+
if self._remodel_to == ship:remodel_from() or ship:remodel_from() and self._remodel_to == Ship(ship:remodel_from()):remodel_from() then
 
self._remodel_is_reversion = true
 
self._remodel_is_reversion = true
 
else
 
else
Line 152: Line 156:  
end
 
end
   −
function ShipRemodelListKai:get_remodel_item_count(ship, item)
+
local function format_remodel_item(item, value)
 +
local special_items = {
 +
blueprint = "blueprint_item",
 +
catapult = "prototype_deck_catapult_item",
 +
report = "report_item",
 +
gunmat = "new_model_gun_mount_improvement_material_item",
 +
airmat = "new_model_aerial_armament_material_item",
 +
armament = "new_model_armament_material_item",
 +
overseas = "latest_overseas_warship_technology_item",
 +
}
 +
value = special_items[item] and Formatting:format_item_requirement(special_items[item], value, true) or value
 +
value = value == true and 1 or value
 +
return value
 +
end
 +
 
 +
function ShipRemodelListKai:remodel_item(ship, item)
 
local value = self._remodel_to == nil and self._question_marks
 
local value = self._remodel_to == nil and self._question_marks
or self._remodel_is_reversion and ship:all_remodel_to_cost()[item]
+
or self._remodel_is_reversion and format_remodel_item(item, ship:all_remodel_to_cost()[item])
or self._remodel_to and self._remodel_to:all_remodel_cost()[item]
+
or self._remodel_to and format_remodel_item(item, self._remodel_to:all_remodel_cost()[item])
 
return {values = {value = value or self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
return {values = {value = value or self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
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)
return self:get_remodel_item_count(ship, 'ammo')
+
return self:remodel_item(ship, 'ammo')
 
end
 
end
    
function ShipRemodelListKai:steel(ship)
 
function ShipRemodelListKai:steel(ship)
return self:get_remodel_item_count(ship, 'steel')
+
return self:remodel_item(ship, 'steel')
 
end
 
end
    
function ShipRemodelListKai:devmat(ship)
 
function ShipRemodelListKai:devmat(ship)
return self:get_remodel_item_count(ship, 'devmat')
+
return self:remodel_item(ship, 'devmat')
 
end
 
end
    
function ShipRemodelListKai:conmat(ship)
 
function ShipRemodelListKai:conmat(ship)
return self:get_remodel_item_count(ship, 'conmat')
+
return self:remodel_item(ship, 'conmat')
 
end
 
end
    
function ShipRemodelListKai:screw(ship)
 
function ShipRemodelListKai:screw(ship)
return self:get_remodel_item_count(ship, 'screw')
+
return self:remodel_item(ship, 'screw')
 
end
 
end
    
function ShipRemodelListKai:blueprint(ship)
 
function ShipRemodelListKai:blueprint(ship)
return self:get_remodel_item_count(ship, 'blueprint')
+
return self:remodel_item(ship, 'blueprint')
 
end
 
end
    
function ShipRemodelListKai:catapult(ship)
 
function ShipRemodelListKai:catapult(ship)
return self:get_remodel_item_count(ship, 'catapult')
+
return self:remodel_item(ship, 'catapult')
 
end
 
end
    
function ShipRemodelListKai:report(ship)
 
function ShipRemodelListKai:report(ship)
return self:get_remodel_item_count(ship, 'report')
+
return self:remodel_item(ship, 'report')
 
end
 
end
    
function ShipRemodelListKai:gunmat(ship)
 
function ShipRemodelListKai:gunmat(ship)
return self:get_remodel_item_count(ship, 'gunmat')
+
return self:remodel_item(ship, 'gunmat')
 
end
 
end
    
function ShipRemodelListKai:airmat(ship)
 
function ShipRemodelListKai:airmat(ship)
return self:get_remodel_item_count(ship, 'airmat')
+
return self:remodel_item(ship, 'airmat')
 
end
 
end
    
function ShipRemodelListKai:armament(ship)
 
function ShipRemodelListKai:armament(ship)
return self:get_remodel_item_count(ship, 'armament')
+
return self:remodel_item(ship, 'armament')
 +
end
 +
 
 +
function ShipRemodelListKai:overseas(ship)
 +
return self:remodel_item(ship, 'overseas')
 
end
 
end
   Line 219: Line 235:  
steel = ResourceIcons.steel,
 
steel = ResourceIcons.steel,
 
devmat = ResourceIcons.devmat,
 
devmat = ResourceIcons.devmat,
conmat = ResourceIcons.conmat,
+
conmat = ResourceIcons.instant_construction,
 
screw = ResourceIcons.screw,
 
screw = ResourceIcons.screw,
 
blueprint = ResourceIcons.blueprint,
 
blueprint = ResourceIcons.blueprint,
Line 227: Line 243:  
airmat = ResourceIcons.new_model_aerial_armament_material,
 
airmat = ResourceIcons.new_model_aerial_armament_material,
 
armament = ResourceIcons.new_model_armament_material,
 
armament = ResourceIcons.new_model_armament_material,
 +
overseas = ResourceIcons.latest_overseas_warship_technology,
 
}
 
}
 
for key, value in pairs(header_icons) do
 
for key, value in pairs(header_icons) do
Line 234: Line 251:  
self._header = format(self._header_template, header_icons)
 
self._header = format(self._header_template, header_icons)
 
self._header_bottom = format(self._header_template_bottom, header_icons)
 
self._header_bottom = format(self._header_template_bottom, header_icons)
 +
end
 +
 +
function ShipRemodelListKai:test()
 +
mw.log(ShipRemodelListKai:Table({iterator = 'shipsByType', type = '6', sort = '_class', listBase = 'true'}))
 
end
 
end
    
return ShipRemodelListKai
 
return ShipRemodelListKai
cssedit, gkautomate
7,064

edits