• 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:EquipmentData"

From Kancolle Wiki
Jump to navigation Jump to search
com>Ckwng
m
com>Ckwng
(Equipment rarities are so messed up...)
Line 28: Line 28:
 
function EquipmentData:rarity(raw)
 
function EquipmentData:rarity(raw)
 
return self:format_rarity(self._rarity, raw)
 
return self:format_rarity(self._rarity, raw)
 +
end
 +
 +
function EquipmentData:stars()
 +
return self._stars or self:rarity(true)
 +
end
 +
 +
function EquipmentData:back()
 +
return self._back or self:stars()
 
end
 
end
  
Line 185: Line 193:
 
[3] = "S Holo",
 
[3] = "S Holo",
 
[4] = "SS Holo",
 
[4] = "SS Holo",
 +
[5] = "SS Holo",
 
})
 
})
  

Revision as of 06:20, 28 December 2014

Documentation for this module may be created at Module:EquipmentData/doc

local BaseData = require("Module:BaseData")
local EquipmentData = BaseData()

function EquipmentData:name(raw)
	return self:format_stat(self._name, raw)
end

function EquipmentData:link(raw)
	if self._page then
		return mw.ustring.format(self._aliased_link, self._page, self:name())
	else
		return mw.ustring.format(self._simple_link, self:name())
	end
end

function EquipmentData:id(raw)
	return self:format_stat(self._id, raw)
end

function EquipmentData:japanese_name(raw)
	return self:format_stat(self._japanese_name, raw)
end

function EquipmentData:type(raw)
	return self:format_type(self._type, raw)
end

function EquipmentData:rarity(raw)
	return self:format_rarity(self._rarity, raw)
end

function EquipmentData:stars()
	return self._stars or self:rarity(true)
end

function EquipmentData:back()
	return self._back or self:stars()
end

function EquipmentData:card(raw)
	return self:format_image(self._card, nil, raw)
end

function EquipmentData:icon(raw)
	return self:format_image(self:format_icon(self._icon, raw), nil, raw)
end

function EquipmentData:firepower(raw)
	return self:format_stat(self._firepower, raw)
end

function EquipmentData:bombing(raw)
	return self:format_stat(self._bombing, raw)
end

function EquipmentData:torpedo(raw)
	return self:format_stat(self._torpedo, raw)
end

function EquipmentData:aa(raw)
	return self:format_stat(self._aa, raw)
end

function EquipmentData:armor(raw)
	return self:format_stat(self._armor, raw)
end

function EquipmentData:asw(raw)
	return self:format_stat(self._asw, raw)
end

function EquipmentData:shelling_accuracy(raw)
	return self:format_stat(self._shelling_accuracy, raw)
end

function EquipmentData:torpedo_accuracy(raw)
	return self:format_stat(self._torpedo_accuracy, raw)
end

function EquipmentData:los(raw)
	return self:format_stat(self._los, raw)
end

function EquipmentData:speed(raw)
	return self:format_speed(self._speed, raw)
end

function EquipmentData:luck(raw)
	return self:format_stat(self._luck, raw)
end

function EquipmentData:range(raw)
	return self:format_range(self._range, raw)
end

function EquipmentData:scrap_fuel(raw)
	return self:format_stat(self._scrap_fuel, raw)
end

function EquipmentData:scrap_ammo(raw)
	return self:format_stat(self._scrap_ammo, raw)
end

function EquipmentData:scrap_steel(raw)
	return self:format_stat(self._scrap_steel, raw)
end

function EquipmentData:scrap_bauxite(raw)
	return self:format_stat(self._scrap_bauxite, raw)
end

function EquipmentData:upgradable(raw)
	return not not self._upgradable
end

EquipmentData.format_type = EquipmentData:create_formatter({
	[1] = "Small Caliber Main Gun",
	[2] = "Medium Caliber Main Gun",
	[3] = "Large Caliber Main Gun",
	[4] = "Secondary Gun",
	[5] = "Torpedo",
	[6] = "Carrier-based Fighter Aircraft",
	[7] = "Carrier-based Dive Bomber",
	[8] = "Carrier-based Torpedo Bomber",
	[9] = "Carrier-based Reconnaissance Aircraft",
	[10] = "Reconnaissance Seaplane",
	[11] = "Seaplane Bomber",
	[12] = "Small Radar",
	[13] = "Large Radar",
	[14] = "Sonar",
	[15] = "Depth Charge",
	[16] = "Extra Armor",
	[17] = "Engine Improvement",
	[18] = "Anti-Aircraft Shell",
	[19] = "Armor Piercing Shell",
	[20] = "VT Fuze",
	[21] = "Anti-Aircraft Machine Gun",
	[22] = "Midget Submarine",
	[23] = "Damage Control Personnel",
	[24] = "Landing Craft",
	[25] = "Autogyro",
	[26] = "Anti-submarine Patrol Aircraft",
	[27] = "Extra Armor (Medium)",
	[28] = "Extra Armor (Large)",
	[29] = "Searchlight",
	[30] = "Supply Transport Container",
	[31] = "Ship Repair Facility",
	[32] = "Submarine Torpedo",
	[33] = "Star Shell",
	[34] = "Command Facility",
	[35] = "Aviation Personnel",
	[36] = "Anti-Aircraft Fire Director",
	})

EquipmentData.format_icon = EquipmentData:create_formatter({
	[false] = "Xx_c.png",
	[1] = "RedGunLight.png",
	[2] = "RedGunMedium.png",
	[3] = "RedGunHeavy.png",
	[4] = "YellowGun.png",
	[5] = "Torpedo.png",
	[6] = "GreenPlane.png",
	[7] = "RedPlane.png",
	[8] = "BluePlane.png",
	[9] = "YellowPlane.png",
	[10] = "Seaplane.png",
	[11] = "Radar.png",
	[12] = "GreenAmmo.png",
	[13] = "RedAmmo.png",
	[14] = "EmergencyRepair.png",
	[15] = "GreenGunMG.png",
	[16] = "GreenGunDP.png",
	[17] = "DepthCharge.png",
	[18] = "Sonar.png",
	[19] = "Turbine.png",
	[20] = "LandingCraft.png",
	[21] = "Heli.png",
	[22] = "Subplane.png",
	[23] = "Expansion Bulge (Medium).png",
	[24] = "Searchlight.png",
	[25] = "Drum.png",
	[26] = "Facility.png",
	[27] = "FlareIcon.png",
	[28] = "Cf_c.png",
	[29] = "Ap_c.png",
	[30] = "Aafd_c.png",
	})

EquipmentData.format_rarity = EquipmentData:create_formatter({
	[0] = "Common",
	[1] = "Rare",
	[2] = "Holo",
	[3] = "S Holo",
	[4] = "SS Holo",
	[5] = "SS Holo",
	})

function EquipmentData:create(equip)
	equip = equip or {}
	setmetatable(equip, equip)
	equip.__index = self
	return equip
end

EquipmentData.__call = EquipmentData.create

return EquipmentData