- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Difference between revisions of "Module:ShipData"
Jump to navigation
Jump to search
com>Ckwng (Change remodel_level return) |
com>Ckwng (Refactor out formatting) |
||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
local BaseData = require("Module:BaseData") | local BaseData = require("Module:BaseData") | ||
local ShipData = BaseData() | local ShipData = BaseData() | ||
− | function ShipData:name( | + | function ShipData:name() |
− | if self._suffix | + | if self._suffix then |
− | return self:base_name() .. " " .. self | + | return self:base_name() .. " " .. self:suffix() |
else | else | ||
− | return self:base_name( | + | return self:base_name() |
end | end | ||
end | end | ||
− | function ShipData:base_name( | + | function ShipData:base_name() |
− | return | + | return self._name |
end | end | ||
− | function ShipData:link( | + | function ShipData:link() |
if self._suffix then | if self._suffix then | ||
− | return | + | return self:base_name(), self:name() |
else | else | ||
− | return | + | return self:name() |
end | end | ||
end | end | ||
− | function ShipData:japanese_name( | + | function ShipData:japanese_name() |
− | return | + | return self._japanese_name |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | function ShipData: | + | function ShipData:id() |
− | return | + | return self._id |
end | end | ||
− | function ShipData: | + | function ShipData:true_id() |
− | return self. | + | return self._true_id |
end | end | ||
− | function ShipData: | + | function ShipData:rarity() |
− | return | + | return self._rarity |
end | end | ||
− | function ShipData: | + | function ShipData:class() |
− | return | + | return self._class |
end | end | ||
− | function ShipData: | + | function ShipData:type() |
− | return self. | + | return self._type |
end | end | ||
− | function ShipData: | + | function ShipData:card() |
− | return | + | return self._card |
end | end | ||
− | function ShipData: | + | function ShipData:hp() |
− | return | + | return self._hp |
end | end | ||
− | function ShipData: | + | function ShipData:firepower() |
− | return self. | + | return self._firepower |
end | end | ||
− | function ShipData: | + | function ShipData:firepower_max() |
− | return | + | return self._firepower_max |
end | end | ||
− | function ShipData: | + | function ShipData:torpedo() |
− | return | + | return self._torpedo |
end | end | ||
− | function ShipData: | + | function ShipData:torpedo_max() |
− | return self. | + | return self._torpedo_max |
end | end | ||
− | function ShipData: | + | function ShipData:aa() |
− | return | + | return self._aa |
end | end | ||
− | function ShipData: | + | function ShipData:aa_max() |
− | return | + | return self._aa_max |
end | end | ||
− | function ShipData: | + | function ShipData:armor() |
− | return self. | + | return self._armor |
end | end | ||
− | function ShipData: | + | function ShipData:armor_max() |
− | return | + | return self._armor_max |
end | end | ||
− | function ShipData: | + | function ShipData:asw() |
− | return | + | return self._asw |
end | end | ||
− | function ShipData: | + | function ShipData:asw_max() |
− | return self. | + | return self._asw_max |
end | end | ||
− | function ShipData: | + | function ShipData:evasion() |
− | return | + | return self._evasion |
end | end | ||
− | function ShipData: | + | function ShipData:evasion_max() |
− | return | + | return self._evasion_max |
end | end | ||
− | function ShipData: | + | function ShipData:los() |
− | return self. | + | return self._los |
end | end | ||
− | function ShipData: | + | function ShipData:los_max() |
− | return | + | return self._los_max |
end | end | ||
− | function ShipData: | + | function ShipData:luck() |
− | return | + | return self._luck |
end | end | ||
− | function ShipData: | + | function ShipData:luck_max() |
− | return self._luck_max | + | return self._luck_max |
end | end | ||
Line 161: | Line 122: | ||
end | end | ||
− | function ShipData:build_time( | + | function ShipData:build_time() |
− | + | return self._build_time | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | function ShipData: | + | function ShipData:remodel_level() |
− | return | + | return self._remodel_level |
end | end | ||
− | function ShipData: | + | function ShipData:remodel_cost() |
− | return self | + | return {ammo = self._remodel_ammo, steel = self._remodel_steel} |
end | end | ||
− | function ShipData: | + | function ShipData:remodel_blueprint() |
− | + | return self._remodel_blueprint | |
− | |||
− | |||
− | |||
− | |||
end | end | ||
− | + | function ShipData:fuel() | |
− | + | return self._fuel | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | function ShipData:fuel( | ||
− | return | ||
end | end | ||
function ShipData:ammo(raw) | function ShipData:ammo(raw) | ||
− | return | + | return self._ammo |
end | end | ||
− | function ShipData: | + | function ShipData:slot(slot) |
local equipment_slot = self._equipment[slot] | local equipment_slot = self._equipment[slot] | ||
− | + | return equipment_slot.equipment, equipment_slot.size | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
Line 292: | Line 161: | ||
size = v["size"] | size = v["size"] | ||
if size == nil then | if size == nil then | ||
− | total_space = | + | total_space = nil |
break | break | ||
elseif size == false then | elseif size == false then | ||
Line 303: | Line 172: | ||
function ShipData:speed() | function ShipData:speed() | ||
− | return | + | return self._speed |
end | end | ||
function ShipData:range() | function ShipData:range() | ||
− | return | + | return self._range |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
end | end | ||
Revision as of 22:47, 12 February 2015
Documentation for this module may be created at Module:ShipData/doc
local BaseData = require("Module:BaseData")
local ShipData = BaseData()
function ShipData:name()
if self._suffix then
return self:base_name() .. " " .. self:suffix()
else
return self:base_name()
end
end
function ShipData:base_name()
return self._name
end
function ShipData:link()
if self._suffix then
return self:base_name(), self:name()
else
return self:name()
end
end
function ShipData:japanese_name()
return self._japanese_name
end
function ShipData:id()
return self._id
end
function ShipData:true_id()
return self._true_id
end
function ShipData:rarity()
return self._rarity
end
function ShipData:class()
return self._class
end
function ShipData:type()
return self._type
end
function ShipData:card()
return self._card
end
function ShipData:hp()
return self._hp
end
function ShipData:firepower()
return self._firepower
end
function ShipData:firepower_max()
return self._firepower_max
end
function ShipData:torpedo()
return self._torpedo
end
function ShipData:torpedo_max()
return self._torpedo_max
end
function ShipData:aa()
return self._aa
end
function ShipData:aa_max()
return self._aa_max
end
function ShipData:armor()
return self._armor
end
function ShipData:armor_max()
return self._armor_max
end
function ShipData:asw()
return self._asw
end
function ShipData:asw_max()
return self._asw_max
end
function ShipData:evasion()
return self._evasion
end
function ShipData:evasion_max()
return self._evasion_max
end
function ShipData:los()
return self._los
end
function ShipData:los_max()
return self._los_max
end
function ShipData:luck()
return self._luck
end
function ShipData:luck_max()
return self._luck_max
end
function ShipData:buildable()
return self._buildable
end
function ShipData:build_time()
return self._build_time
end
function ShipData:remodel_level()
return self._remodel_level
end
function ShipData:remodel_cost()
return {ammo = self._remodel_ammo, steel = self._remodel_steel}
end
function ShipData:remodel_blueprint()
return self._remodel_blueprint
end
function ShipData:fuel()
return self._fuel
end
function ShipData:ammo(raw)
return self._ammo
end
function ShipData:slot(slot)
local equipment_slot = self._equipment[slot]
return equipment_slot.equipment, equipment_slot.size
end
function ShipData:slots()
return #self._equipment
end
function ShipData:total_space()
local total_space = 0
local size
for _, v in ipairs(self._equipment) do
size = v["size"]
if size == nil then
total_space = nil
break
elseif size == false then
else
total_space = total_space + size
end
end
return total_space
end
function ShipData:speed()
return self._speed
end
function ShipData:range()
return self._range
end
function ShipData:create(ship)
ship = ship or {}
setmetatable(ship, ship)
ship.__index = self
return ship
end
ShipData.__call = ShipData.create
return ShipData