• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
no edit summary
Line 1: Line 1:  +
local U = require("Module:Core")
 
local BaseData = require("Module:BaseData")
 
local BaseData = require("Module:BaseData")
 
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
Line 47: Line 48:  
--Returns the equipment's id.
 
--Returns the equipment's id.
 
function EquipmentData:id()
 
function EquipmentData:id()
return self._id
+
return self._is_enemy and self._id and self._id < 1501 and self._id + 1000 or self._id
 
end
 
end
   Line 254: Line 255:  
local api_id = self:api_id()
 
local api_id = self:api_id()
 
if api_id then
 
if api_id then
    if api_id > 500 then
  −
        local equipment_type = self:type()
  −
        if equipment_type < 6
  −
            or (equipment_type > 11 and equipment_type ~= 25 and equipment_type ~= 26 and equipment_type ~= 41
  −
            and equipment_type ~= 45 and equipment_type ~= 47 and equipment_type ~= 48 and equipment_type ~= 94) then
  −
        Equipment = Equipment or require(self._constructor_module)
  −
        EquipmentFrom = EquipmentFrom or require("Module:Collection/EquipmentByApiId")
  −
        return Equipment(EquipmentFrom[api_id - 500]):cg()
  −
    end
  −
    end
   
return Formatting:equipment_cg(api_id, self:asset_name())
 
return Formatting:equipment_cg(api_id, self:asset_name())
 
end
 
end
Line 402: Line 393:     
function EquipmentData:is_lbas_plane()
 
function EquipmentData:is_lbas_plane()
local eq_type = self:type()
+
self:_load_compatibility()
return eq_type == 6 -- Carrier-based Fighter Aircraft
+
return EquipmentCompatibility.AirBase[self:type()] or false
or eq_type == 7 -- Carrier-based Dive Bomber
+
-- local eq_type = self:type()
or eq_type == 8 -- Carrier-based Torpedo Bomber
+
-- return eq_type == 6 -- Carrier-based Fighter Aircraft
or eq_type == 9 -- Carrier-based Reconnaissance Aircraft
+
-- or eq_type == 7 -- Carrier-based Dive Bomber
or eq_type == 10 -- Reconnaissance Seaplane
+
-- or eq_type == 8 -- Carrier-based Torpedo Bomber
or eq_type == 11 -- Seaplane Bomber
+
-- or eq_type == 9 -- Carrier-based Reconnaissance Aircraft
or eq_type == 41 -- Large Flying Boat
+
-- or eq_type == 10 -- Reconnaissance Seaplane
or eq_type == 45 -- Seaplane Fighter
+
-- or eq_type == 11 -- Seaplane Bomber
or eq_type == 47 -- Land-based Attack Aircraft
+
-- or eq_type == 25 -- Rotorcraft
or eq_type == 48 -- Land-based Fighter
+
-- or eq_type == 26 -- Anti-submarine Patrol Aircraft
or eq_type == 49 -- Land-based Reconnaissance Aircraft
+
-- or eq_type == 41 -- Large Flying Boat
or eq_type == 56 -- Jet-powered Fighter Aircraft
+
-- or eq_type == 45 -- Seaplane Fighter
or eq_type == 57 -- Jet-powered Fighter-Bomber
+
-- or eq_type == 47 -- Land-based Attack Aircraft
or eq_type == 58 -- Jet-powered Attack Aircraft
+
-- or eq_type == 48 -- Land-based Fighter
or eq_type == 59 -- Jet-powered Recon Aircraft
+
-- or eq_type == 49 -- Land-based Reconnaissance Aircraft
or eq_type == 94 -- Carrier-based Reconnaissance Aircraft (II)
+
-- or eq_type == 53 -- Large Land-based Aircraft
 +
-- or eq_type == 56 -- Jet-powered Fighter Aircraft
 +
-- or eq_type == 57 -- Jet-powered Fighter-Bomber
 +
-- or eq_type == 58 -- Jet-powered Attack Aircraft
 +
-- or eq_type == 59 -- Jet-powered Recon Aircraft
 +
-- or eq_type == 94 -- Carrier-based Reconnaissance Aircraft (II)
 
end
 
end
   Line 433: Line 429:  
return eq_type == 3 -- Large Caliber Main Gun
 
return eq_type == 3 -- Large Caliber Main Gun
 
or eq_type == 38 -- Large Caliber Main Gun (II)
 
or eq_type == 38 -- Large Caliber Main Gun (II)
 +
end
 +
 +
function EquipmentData:is_main_gun()
 +
local eq_type = self:type()
 +
return eq_type == 1 -- Small Caliber Main Guns
 +
or eq_type == 2 -- Medium Caliber Main Guns
 +
or eq_type == 3 -- Large Caliber Main Guns
 +
or eq_type == 38 -- Large Caliber Main Guns (II)
 
end
 
end
   Line 441: Line 445:  
function EquipmentData:is_not_aafd()
 
function EquipmentData:is_not_aafd()
 
return not (self:is_aafd())
 
return not (self:is_aafd())
 +
end
 +
 +
function EquipmentData:is_fighter_aircraft()
 +
local eq_type = self:type()
 +
return eq_type == 6 -- Carrier-based Fighter Aircraft
 +
or eq_type == 45 -- Seaplane Fighter
 +
or eq_type == 48 -- Land-based Fighter
 +
or eq_type == 56 -- Jet-powered Fighter Aircraft
 +
end
 +
 +
function EquipmentData:is_bomber_aircraft()
 +
local eq_type = self:type()
 +
or eq_type == 7 -- Carrier-based Dive Bomber
 +
or eq_type == 8 -- Carrier-based Torpedo Bomber
 +
or eq_type == 11 -- Seaplane Bomber
 +
-- or eq_type == 25 -- Rotorcraft
 +
or eq_type == 26 -- Anti-submarine Patrol Aircraft
 +
or eq_type == 47 -- Land-based Attack Aircraft
 +
or eq_type == 53 -- Large Land-based Aircraft
 +
or eq_type == 57 -- Jet-powered Fighter-Bomber
 +
or eq_type == 58 -- Jet-powered Attack Aircraft
 +
end
 +
 +
function EquipmentData:is_reconnaissance_aircraft()
 +
local eq_type = self:type()
 +
return eq_type == 9 -- Carrier-based Reconnaissance Aircraft
 +
or eq_type == 10 -- Reconnaissance Seaplanes
 +
or eq_type == 49 -- Land-based Reconnaissance Aircraft
 +
or eq_type == 94 -- Carrier-based Reconnaissance Aircraft (II)
 
end
 
end
   Line 641: Line 674:  
local function convert_compatibility(compatibility_table, equipment_type, name)
 
local function convert_compatibility(compatibility_table, equipment_type, name)
 
local value = compatibility_table[name] or compatibility_table[equipment_type]
 
local value = compatibility_table[name] or compatibility_table[equipment_type]
return value == true and 1 or type(value) == 'string' and {value = 2, note = value, code = value} or 0
+
return value == true and 1 or type(value) == 'string' and {value = U.startsWith(value, 'Only') and 2 or 3, note = value, code = value} or 0
 
end
 
end
  
cssedit, gkautomate
6,926

edits

Navigation menu