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

From Kancolle Wiki
Jump to navigation Jump to search
com>Ckwng
(Infobox module.)
 
com>Ckwng
(Why is the code disappearing on submit ;_;)
Line 1: Line 1:
 +
local Ship = require('Module:Ship')
 +
local format = require('Module:StringInterpolation').format
  
 +
local ShipInfoKai = {
 +
_rarity_map = {
 +
[0] = "whitesmoke",
 +
[1] = "cornflowerblue",
 +
[2] = "lightskyblue",
 +
[3] = "mediumturquoise",
 +
[4] = "silver",
 +
[5] = "gold",
 +
[6] = "violet",
 +
[7] = "violet",
 +
[8] = "violet",
 +
},
 +
_catbomb = "File:Catbomb.png|300px",
 +
_unbuilable = "''Unbuildable''",
 +
_remodel_level = "'''Remodel Level'''",
 +
_build_time = "'''Build Time'''",
 +
_id_1 = "%d",
 +
_id_2 = "%d (%d)",
 +
_stat_1 = "%d",
 +
_stat_2 = "%d (%d)",
 +
_slot_template = [[|-
 +
| align=center colspan="3" | ${equipment}
 +
| align=center | ${space}
 +
]],
 +
_template = [[{|style="border: 1px solid darkgray; width: 320px;"
 +
|-
 +
|colspan="4" style="text-align: center; background-color: ${name_bg_color};${name_extra_style}"|<p style="font-size:20px">'''${name}'''</p>
 +
<p style="font-size:15px">'''No.${id} ${japanese_name}'''</p>
 +
<p>'''${class} ${type}'''</p>
 +
|-
 +
| align=center colspan="4" | ${image}
 +
|-
 +
| colspan="4" style="text-align: center; background-color: LightSkyBlue;"|'''Statistics'''
 +
|-
 +
| style="width: 80px;" | {{HP}} HP
 +
| width="60px" | '''${hp}'''
 +
| style="width: 86px;" | {{Firepower}} Firepower
 +
| '''${firepower}'''
 +
|-
 +
| style="width: 80px;" | {{Armor}} Armor
 +
| width="60px" | '''${armor}'''
 +
| style="width: 86px;" | {{Torpedo}} Torpedo
 +
| '''${torpedo}'''
 +
|-
 +
| style="width: 86px;" | {{Evasion}} Evasion
 +
| width="60px" | '''${evasion}'''
 +
| style="width: 80px;" | {{AA}} AA
 +
| '''${aa}'''
 +
|-
 +
| style="width: 80px;" | {{Aircraft}} Aircraft
 +
| width="60px" | '''${aircraft}'''
 +
| style="width: 86px;" | {{ASW}} ASW
 +
| '''${asw}'''
 +
|-
 +
| style="width: 80px;" | {{Speed}} Speed
 +
| width="60px" | '''${speed}'''
 +
| style="width: 86px;" | {{LOS}} LOS
 +
| '''${los}'''
 +
|-
 +
| style="width: 80px;" | {{Range}} Range
 +
| width="60px" | '''${range}'''
 +
| style="width: 86px;" | {{Luck}} Luck
 +
| '''${luck}'''
 +
|-
 +
| colspan="3" style="text-align: center; background-color: LightSkyBlue;"|${build_remodel_header}
 +
| style="text-align: center; background-color: LightSkyBlue;" | '''Slots'''
 +
|-
 +
| colspan="3" style="text-align: center;"|${build_remodel_info}
 +
| align=center |${slots}
 +
|-
 +
| colspan="3" style="text-align: center; background-color: LightSkyBlue;"|'''Stock Equipment'''
 +
| style="text-align: center; background-color: LightSkyBlue;" | '''{{Aircraft}}Space'''
 +
|-
 +
${slot_details}<noinclude>
 +
Experimental template, do not use.
 +
{{Documentation}}
 +
</noinclude>]],
 +
}
 +
 +
function ShipInfoKai:top_bg_color(ship)
 +
return self._rarity_map[ship:rarity(true)]
 +
end
 +
 +
function ShipInfoKai:top_extra_style(ship)
 +
local rarity = ship:rarity(true)
 +
if rarity > 6 then
 +
return mw.ustring.format(" background-image: %s%s", rarity > 7 and "radial-gradient(circle farthest-corner at center, rgba(255, 0, 80, 0)0%, rgba(255, 60, 0, 0) 60%, rgba(255, 60, 0, 0.3) 100%), " or "", "radial-gradient(ellipse closest-side at center, violet 0%, violet 50%, rgba(238,130,238,0) 80%, transparent), linear-gradient(1deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(2deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(4deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(5deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(6deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(7deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(9deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(11deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(13deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(14deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(16deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(18deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(20deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(22deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(24deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(26deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(28deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(29deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(31deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(33deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(35deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(36deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(38deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(39deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(40deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(41deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(42deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(43deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(45deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(46deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(48deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(49deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(51deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(52deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(53deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(55deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(57deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(59deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(61deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(63deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(65deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(67deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(68deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(70deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(72deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(73deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(74deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(75deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(77deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(78deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(80deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(81deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(83deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(85deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(86deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(88deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(90deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(92deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(93deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(94deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(96deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(97deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(99deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(101deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(103deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(104deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(106deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(108deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(109deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(111deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(112deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(114deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(115deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(117deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(119deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(120deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(121deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(122deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(124deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(125deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(127deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(129deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(130deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(131deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(132deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(133deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(135deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(137deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(139deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(140deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(142deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(144deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(146deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(147deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(149deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(150deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(152deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(154deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(156deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(158deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(160deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(161deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(162deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(164deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(165deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(167deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(168deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(169deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(171deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(173deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(175deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(176deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(178deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(179deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent)")
 +
else
 +
return ""
 +
end
 +
end
 +
 +
function ShipInfoKai:id(ship)
 +
return mw.ustring.format(ship.has_true_id() and self._id_2 or self._id_1, ship:id(), ship:true_id())
 +
end
 +
 +
function ShipInfoKai:image(ship)
 +
return mw.ustring.format("[[File:%s]]", ship.card() or self._catbomb)
 +
end
 +
 +
function ShipInfoKai:hp(ship)
 +
return mw.ustring.format(self._stat_1, ship:hp())
 +
end
 +
function ShipInfoKai:firepower(ship)
 +
return mw.ustring.format(ship:has_firepower_max() and self._stat_2 or self._stat_1, ship:firepower(), ship:firepower_max())
 +
end
 +
 +
function ShipInfoKai:armor(ship)
 +
return mw.ustring.format(ship:has_armor_max() and self._stat_2 or self._stat_1, ship:armor(), ship:armor_max())
 +
end
 +
 +
function ShipInfoKai:torpedo(ship)
 +
return mw.ustring.format(ship:has_torpedo_max() and self._stat_2 or self._stat_1, ship:torpedo(), ship:torpedo_max())
 +
end
 +
 +
function ShipInfoKai:evasion(ship)
 +
return mw.ustring.format(ship:has_evasion_max() and self._stat_2 or self._stat_1, ship:evasion(), ship:evasion_max())
 +
end
 +
 +
function ShipInfoKai:aa(ship)
 +
return mw.ustring.format(ship:has_aa_max() and self._stat_2 or self._stat_1, ship:aa(), ship:aa_max())
 +
end
 +
 +
function ShipInfoKai:asw(ship)
 +
return mw.ustring.format(ship:has_asw_max() and self._stat_2 or self._stat_1, ship:asw(), ship:asw_max())
 +
end
 +
 +
function ShipInfoKai:los(ship)
 +
return mw.ustring.format(ship:has_los_max() and self._stat_2 or self._stat_1, ship:los(), ship:los_max())
 +
end
 +
 +
function ShipInfoKai:luck(ship)
 +
return mw.ustring.format(ship:has_luck_max() and self._stat_2 or self._stat_1, ship:luck(), ship:luck_max())
 +
end
 +
 +
function ShipInfoKai:build_remodel_header(ship)
 +
return ship:remodeled() and self._remodel_level or self._build_time
 +
end
 +
 +
function ShipInfoKai:build_remodel_info(ship)
 +
return ship:remodeled() and ship:remodel_level() or ship:buildable() and ship:build_time() or self._unbuildable
 +
end
 +
 +
function ShipInfoKai:slots(ship)
 +
return ship:slots()
 +
end
 +
 +
function ShipInfoKai:slot_details(ship)
 +
local slots = {}
 +
for i = 1, ship:slots() do
 +
slots:insert(format(self._slot_template, {equipment = ship:equipment(i), space = ship:space(i)}))
 +
end
 +
return slots:concat()
 +
end
 +
 +
function ShipInfoKai:Infobox(ship, model)
 +
local ship = Ship(ship, model)
 +
local vars = {}
 +
local rarity = ship.rarity(true) or 0
 +
vars.top_bg_color = self:top_bg_color(ship)
 +
vars.name = ship.name()
 +
vars.id = self:id(ship)
 +
vars.japanese_name = ship.japanese_name()
 +
vars.class = ship.class()
 +
vars.type = ship.type()
 +
vars.image = self:image(ship)
 +
vars.hp = self:hp(ship)
 +
vars.firepower = self:firepower(ship)
 +
vars.armor = self:armor(ship)
 +
vars.torpedo = self:torpedo(ship)
 +
vars.evasion = self:evasion(ship)
 +
vars.aa = self:aa(ship)
 +
vars.aircraft = ship:total_space()
 +
vars.asw = self:asw(ship)
 +
vars.speed = self:speed(ship)
 +
vars.los = self:los(ship)
 +
vars.range = self:range(ship)
 +
vars.luck = self:luck(ship)
 +
vars.build_remodel_header = self:build_remodel_header(ship)
 +
vars.build_remodel_info = self:build_remodel_info(ship)
 +
vars.slots = self:slots(ship)
 +
vars.slot_details = self:slot_details(ship)
 +
end
 +
 +
return ShipInfoKai

Revision as of 21:33, 10 December 2014

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

local Ship = require('Module:Ship')
local format = require('Module:StringInterpolation').format

local ShipInfoKai = {
	_rarity_map = {
		[0] = "whitesmoke",
		[1] = "cornflowerblue",
		[2] = "lightskyblue",
		[3] = "mediumturquoise",
		[4] = "silver",
		[5] = "gold",
		[6] = "violet",
		[7] = "violet",
		[8] = "violet",
	},
	_catbomb = "File:Catbomb.png|300px",
	_unbuilable = "''Unbuildable''",
	_remodel_level = "'''Remodel Level'''",
	_build_time = "'''Build Time'''",
	_id_1 = "%d",
	_id_2 = "%d (%d)",
	_stat_1 = "%d",
	_stat_2 = "%d (%d)",
	_slot_template = [[|-
| align=center colspan="3" | ${equipment}
| align=center | ${space}
]],
	_template = [[{|style="border: 1px solid darkgray; width: 320px;"
|-
|colspan="4" style="text-align: center; background-color: ${name_bg_color};${name_extra_style}"|<p style="font-size:20px">'''${name}'''</p>
<p style="font-size:15px">'''No.${id} ${japanese_name}'''</p>
<p>'''${class} ${type}'''</p>
|-
| align=center colspan="4" | ${image}
|-
| colspan="4" style="text-align: center; background-color: LightSkyBlue;"|'''Statistics'''
|-
| style="width: 80px;" | {{HP}} HP
| width="60px" | '''${hp}'''
| style="width: 86px;" | {{Firepower}} Firepower
| '''${firepower}'''
|-
| style="width: 80px;" | {{Armor}} Armor
| width="60px" | '''${armor}'''
| style="width: 86px;" | {{Torpedo}} Torpedo
| '''${torpedo}'''
|-
| style="width: 86px;" | {{Evasion}} Evasion
| width="60px" | '''${evasion}'''
| style="width: 80px;" | {{AA}} AA
| '''${aa}'''
|-
| style="width: 80px;" | {{Aircraft}} Aircraft
| width="60px" | '''${aircraft}'''
| style="width: 86px;" | {{ASW}} ASW
| '''${asw}'''
|-
| style="width: 80px;" | {{Speed}} Speed
| width="60px" | '''${speed}'''
| style="width: 86px;" | {{LOS}} LOS
| '''${los}'''
|-
| style="width: 80px;" | {{Range}} Range
| width="60px" | '''${range}'''
| style="width: 86px;" | {{Luck}} Luck
| '''${luck}'''
|-
| colspan="3" style="text-align: center; background-color: LightSkyBlue;"|${build_remodel_header}
| style="text-align: center; background-color: LightSkyBlue;" | '''Slots'''
|- 
| colspan="3" style="text-align: center;"|${build_remodel_info}
| align=center |${slots}
|-
| colspan="3" style="text-align: center; background-color: LightSkyBlue;"|'''Stock Equipment'''
| style="text-align: center; background-color: LightSkyBlue;" | '''{{Aircraft}}Space'''
|-
${slot_details}<noinclude>
Experimental template, do not use.
{{Documentation}}
</noinclude>]],
}

function ShipInfoKai:top_bg_color(ship)
	return self._rarity_map[ship:rarity(true)]
end

function ShipInfoKai:top_extra_style(ship)
	local rarity = ship:rarity(true)
	if rarity > 6 then
		return mw.ustring.format(" background-image: %s%s", rarity > 7 and "radial-gradient(circle farthest-corner at center, rgba(255, 0, 80, 0)0%, rgba(255, 60, 0, 0) 60%, rgba(255, 60, 0, 0.3) 100%), " or "", "radial-gradient(ellipse closest-side at center, violet 0%, violet 50%, rgba(238,130,238,0) 80%, transparent), linear-gradient(1deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(2deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(4deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(5deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(6deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(7deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(9deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(11deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(13deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(14deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(16deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(18deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(20deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(22deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(24deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(26deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(28deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(29deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(31deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(33deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(35deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(36deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(38deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(39deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(40deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(41deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(42deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(43deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(45deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(46deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(48deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(49deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(51deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(52deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(53deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(55deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(57deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(59deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(61deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(63deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(65deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(67deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(68deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(70deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(72deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(73deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(74deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(75deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(77deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(78deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(80deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(81deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(83deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(85deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(86deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(88deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(90deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(92deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(93deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(94deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(96deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(97deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(99deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(101deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(103deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(104deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(106deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(108deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(109deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(111deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(112deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(114deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(115deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(117deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(119deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(120deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(121deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(122deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(124deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(125deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(127deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(129deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(130deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(131deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(132deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(133deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(135deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(137deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(139deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(140deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(142deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(144deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(146deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(147deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(149deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(150deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(152deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(154deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(156deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(158deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(160deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(161deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(162deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(164deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(165deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(167deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(168deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(169deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(171deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(173deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(175deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(176deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(178deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent), linear-gradient(179deg, transparent, transparent 50%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.3) calc(50% + 1px), transparent calc(50% + 1px), transparent)")
	else
		return ""
	end
end

function ShipInfoKai:id(ship)
	return mw.ustring.format(ship.has_true_id() and self._id_2 or self._id_1, ship:id(), ship:true_id())
end

function ShipInfoKai:image(ship)
	return mw.ustring.format("[[File:%s]]", ship.card() or self._catbomb)
end

function ShipInfoKai:hp(ship)
	return mw.ustring.format(self._stat_1, ship:hp())
end
function ShipInfoKai:firepower(ship)
	return mw.ustring.format(ship:has_firepower_max() and self._stat_2 or self._stat_1, ship:firepower(), ship:firepower_max())
end

function ShipInfoKai:armor(ship)
	return mw.ustring.format(ship:has_armor_max() and self._stat_2 or self._stat_1, ship:armor(), ship:armor_max())
end

function ShipInfoKai:torpedo(ship)
	return mw.ustring.format(ship:has_torpedo_max() and self._stat_2 or self._stat_1, ship:torpedo(), ship:torpedo_max())
end

function ShipInfoKai:evasion(ship)
	return mw.ustring.format(ship:has_evasion_max() and self._stat_2 or self._stat_1, ship:evasion(), ship:evasion_max())
end

function ShipInfoKai:aa(ship)
	return mw.ustring.format(ship:has_aa_max() and self._stat_2 or self._stat_1, ship:aa(), ship:aa_max())
end

function ShipInfoKai:asw(ship)
	return mw.ustring.format(ship:has_asw_max() and self._stat_2 or self._stat_1, ship:asw(), ship:asw_max())
end

function ShipInfoKai:los(ship)
	return mw.ustring.format(ship:has_los_max() and self._stat_2 or self._stat_1, ship:los(), ship:los_max())
end	

function ShipInfoKai:luck(ship)
	return mw.ustring.format(ship:has_luck_max() and self._stat_2 or self._stat_1, ship:luck(), ship:luck_max())
end

function ShipInfoKai:build_remodel_header(ship)
	return ship:remodeled() and self._remodel_level or self._build_time
end

function ShipInfoKai:build_remodel_info(ship)
	return ship:remodeled() and ship:remodel_level() or ship:buildable() and ship:build_time() or self._unbuildable
end

function ShipInfoKai:slots(ship)
	return ship:slots()
end

function ShipInfoKai:slot_details(ship)
	local slots = {}
	for i = 1, ship:slots() do
		slots:insert(format(self._slot_template, {equipment = ship:equipment(i), space = ship:space(i)}))
	end
	return slots:concat()
end

function ShipInfoKai:Infobox(ship, model)
	local ship = Ship(ship, model)
	local vars = {}
	local rarity = ship.rarity(true) or 0
	vars.top_bg_color = self:top_bg_color(ship)
	vars.name = ship.name()
	vars.id = self:id(ship)
	vars.japanese_name = ship.japanese_name()
	vars.class = ship.class()
	vars.type = ship.type()
	vars.image = self:image(ship)
	vars.hp = self:hp(ship)
	vars.firepower = self:firepower(ship)
	vars.armor = self:armor(ship)
	vars.torpedo = self:torpedo(ship)
	vars.evasion = self:evasion(ship)
	vars.aa = self:aa(ship)
	vars.aircraft = ship:total_space()
	vars.asw = self:asw(ship)
	vars.speed = self:speed(ship)
	vars.los = self:los(ship)
	vars.range = self:range(ship)
	vars.luck = self:luck(ship)
	vars.build_remodel_header = self:build_remodel_header(ship)
	vars.build_remodel_info = self:build_remodel_info(ship)
	vars.slots = self:slots(ship)
	vars.slot_details = self:slot_details(ship)
end

return ShipInfoKai