Changes

no edit summary
Line 3: Line 3:  
local Ship
 
local Ship
 
local ShipClass = require('Module:ShipClass')
 
local ShipClass = require('Module:ShipClass')
 +
local dropData
 +
local sortIds = require("Module:DropList/Sort")
    
local BaseData = require("Module:BaseData")
 
local BaseData = require("Module:BaseData")
Line 130: Line 132:  
function ShipData:true_id()
 
function ShipData:true_id()
 
return self._true_id
 
return self._true_id
 +
end
 +
 +
function ShipData:sort_id()
 +
return sortIds[self._api_id] or 0
 
end
 
end
   Line 154: Line 160:  
function ShipData:type()
 
function ShipData:type()
 
return self._type
 
return self._type
 +
end
 +
 +
function ShipData:code()
 +
return Formatting:format_ship_code(self._type)
 +
end
 +
 +
function ShipData:formatted_type()
 +
return Formatting:format_ship_type(self._type)
 +
end
 +
 +
function ShipData:is_battleship()
 +
return self._type == 8 or self._type == 9 or self._type == 10 or self._type == 12
 +
end
 +
 +
function ShipData:is_carrier()
 +
return self._type == 7 or self._type == 11 or self._type == 18
 +
end
 +
 +
function ShipData:is_auxiliary()
 +
return self._type == 22 or self._type == 16 or self._type == 17 or self._type == 19 or self._type == 20
 +
end
 +
 +
function ShipData:is_submarine()
 +
return self._type == 13 or self._type == 14
 +
end
 +
 +
function ShipData:is_CL()
 +
return self._type == 3 or self._type == 4 or self._type == 21
 +
end
 +
 +
function ShipData:is_CA()
 +
return self._type == 5 or self._type == 6
 
end
 
end
   Line 494: Line 532:  
function ShipData:buildable_lsc()
 
function ShipData:buildable_lsc()
 
return self._buildable_lsc
 
return self._buildable_lsc
 +
end
 +
 +
function ShipData:buildable_or()
 +
return self._buildable or self._buildable_lsc
 +
end
 +
 +
function ShipData:buildable_and()
 +
return self._buildable and self._buildable_lsc
 
end
 
end
    
function ShipData:build_time()
 
function ShipData:build_time()
 
return self._build_time
 
return self._build_time
 +
end
 +
 +
local function prepareDropData()
 +
if not dropData then
 +
dropData = require('Module:Data/ShipDrop')
 +
end
 +
end
 +
 +
function ShipData:dropable()
 +
prepareDropData()
 +
return dropData[self._name] and true or false
 
end
 
end
   Line 520: Line 577:  
    devmat = self._remodel_development_material,
 
    devmat = self._remodel_development_material,
 
    conmat = self._remodel_construction_material or false,
 
    conmat = self._remodel_construction_material or false,
    screw = false
+
    screw = self._remodel_screw or false,
 
     }
 
     }
 
end
 
end
Line 542: Line 599:  
function ShipData:remodel_airmat()
 
function ShipData:remodel_airmat()
 
return self._remodel_airmat
 
return self._remodel_airmat
 +
end
 +
 +
function ShipData:remodel_armament()
 +
return self._remodel_armament
 
end
 
end
   Line 550: Line 611:  
function ShipData:remodel_construction_material()
 
function ShipData:remodel_construction_material()
 
return self._remodel_construction_material
 
return self._remodel_construction_material
 +
end
 +
 +
function ShipData:remodel_screw()
 +
return self._remodel_screw
 
end
 
end
   Line 564: Line 629:  
    devmat = self._remodel_to_development_material,
 
    devmat = self._remodel_to_development_material,
 
    conmat = self._remodel_to_construction_material or false,
 
    conmat = self._remodel_to_construction_material or false,
    screw = false
+
    screw = self._remodel_to_screw or false,
 
     }
 
     }
 
end
 
end
Line 620: Line 685:  
if type(equipment_slot.equipment) == "string" then
 
if type(equipment_slot.equipment) == "string" then
 
self:_prepare_Equipment()
 
self:_prepare_Equipment()
equipment_slot.equipment = Equipment(equipment_slot.equipment)
+
equipment_slot.equipment = Equipment(equipment_slot.equipment, self._enemy)
 
end
 
end
 
return equipment_slot.equipment, equipment_slot.size, equipment_slot.estimation, equipment_slot.stars
 
return equipment_slot.equipment, equipment_slot.size, equipment_slot.estimation, equipment_slot.stars
Line 660: Line 725:  
function ShipData:speed()
 
function ShipData:speed()
 
return self._speed
 
return self._speed
 +
end
 +
 +
function ShipData:formatted_speed()
 +
return Formatting:format_speed(self._speed)
 
end
 
end
    
function ShipData:range()
 
function ShipData:range()
 
return self._range
 
return self._range
 +
end
 +
 +
function ShipData:formatted_range()
 +
return Formatting:format_range(self._range)
 
end
 
end
   Line 739: Line 812:  
function ShipData:night_bombing()
 
function ShipData:night_bombing()
 
return self._night_bombing
 
return self._night_bombing
 +
end
 +
 +
function ShipData:night_aviation_personnel()
 +
return self._night_aviation_personnel
 
end
 
end
   Line 795: Line 872:  
end
 
end
   −
--The implementation date for this ship. A 3-tuple of year, month, day (JST) as a table, or nil if unknown.
  −
--EXPERIMENTAL, DO NOT USE. Spec for this feature may rapidly change.
   
function ShipData:implementation_date()
 
function ShipData:implementation_date()
 
if self._implementation_date ~= nil then
 
if self._implementation_date ~= nil then
Line 805: Line 880:  
end
 
end
 
     return self._implementation_date
 
     return self._implementation_date
 +
end
 +
 +
function ShipData:implementation_date_string()
 +
local date = self:implementation_date()
 +
    return not date and "??" or string.format("%s/%s/%s", date[1], date[2] < 10 and "0" .. date[2] or date[2], date[3] < 10 and "0" .. date[3] or date[3])
 
end
 
end
  
cssedit, gkautomate
7,064

edits