Changes

Fix icons and last equip slot
Line 1: Line 1:  
local Ship = require('Module:Ship')
 
local Ship = require('Module:Ship')
 +
local StatIcons = require('Module:StatIcons')
 
local format = require('Module:StringInterpolation').format
 
local format = require('Module:StringInterpolation').format
   Line 26: Line 27:  
| align=center | ${space}
 
| align=center | ${space}
 
]],
 
]],
 +
_image_template = "[[File:%s]]",
 
_template = [[{|style="border: 1px solid darkgray; width: 320px;"
 
_template = [[{|style="border: 1px solid darkgray; width: 320px;"
 
|-
 
|-
Line 36: Line 38:  
| colspan="4" style="text-align: center; background-color: LightSkyBlue;"|'''Statistics'''
 
| colspan="4" style="text-align: center; background-color: LightSkyBlue;"|'''Statistics'''
 
|-
 
|-
| style="width: 80px;" | {{HP}} HP
+
| style="width: 80px;" | ${hp_icon} HP
 
| width="60px" | '''${hp}'''
 
| width="60px" | '''${hp}'''
| style="width: 86px;" | {{Firepower}} Firepower
+
| style="width: 86px;" | ${firepower_icon} Firepower
 
| '''${firepower}'''
 
| '''${firepower}'''
 
|-
 
|-
| style="width: 80px;" | {{Armor}} Armor
+
| style="width: 80px;" | ${armor_icon} Armor
 
| width="60px" | '''${armor}'''
 
| width="60px" | '''${armor}'''
| style="width: 86px;" | {{Torpedo}} Torpedo
+
| style="width: 86px;" | ${torpedo_icon} Torpedo
 
| '''${torpedo}'''
 
| '''${torpedo}'''
 
|-
 
|-
| style="width: 86px;" | {{Evasion}} Evasion
+
| style="width: 86px;" | ${evasion_icon} Evasion
 
| width="60px" | '''${evasion}'''
 
| width="60px" | '''${evasion}'''
| style="width: 80px;" | {{AA}} AA
+
| style="width: 80px;" | ${aa_icon} AA
 
| '''${aa}'''
 
| '''${aa}'''
 
|-
 
|-
| style="width: 80px;" | {{Aircraft}} Aircraft
+
| style="width: 80px;" | ${aircraft_icon} Aircraft
 
| width="60px" | '''${aircraft}'''
 
| width="60px" | '''${aircraft}'''
| style="width: 86px;" | {{ASW}} ASW
+
| style="width: 86px;" | ${asw_icon} ASW
 
| '''${asw}'''
 
| '''${asw}'''
 
|-
 
|-
| style="width: 80px;" | {{Speed}} Speed
+
| style="width: 80px;" | ${speed_icon} Speed
 
| width="60px" | '''${speed}'''
 
| width="60px" | '''${speed}'''
| style="width: 86px;" | {{LOS}} LOS
+
| style="width: 86px;" | ${los_icon} LOS
 
| '''${los}'''
 
| '''${los}'''
 
|-
 
|-
| style="width: 80px;" | {{Range}} Range
+
| style="width: 80px;" | ${range_icon} Range
 
| width="60px" | '''${range}'''
 
| width="60px" | '''${range}'''
| style="width: 86px;" | {{Luck}} Luck
+
| style="width: 86px;" | ${luck_icon} Luck
 
| '''${luck}'''
 
| '''${luck}'''
 
|-
 
|-
Line 75: Line 77:  
| style="text-align: center; background-color: LightSkyBlue;" | '''{{Aircraft}}Space'''
 
| style="text-align: center; background-color: LightSkyBlue;" | '''{{Aircraft}}Space'''
 
|-
 
|-
${slot_details}<noinclude>
+
${slot_details}]],
Experimental template, do not use.
  −
{{Documentation}}
  −
</noinclude>]],
   
}
 
}
   Line 99: Line 98:     
function ShipInfoKai:image(ship)
 
function ShipInfoKai:image(ship)
return mw.ustring.format("[[File:%s]]", ship:card(true) or self._catbomb)
+
return mw.ustring.format(self._image_template, ship:card(true) or self._catbomb)
 
end
 
end
   Line 168: Line 167:  
function ShipInfoKai:Infobox(name, model)
 
function ShipInfoKai:Infobox(name, model)
 
local ship = Ship(name, model)
 
local ship = Ship(name, model)
local vars = {}
+
local vars = {
 +
hp_icon = StatIcons.hp,
 +
firepower_icon = StatIcons.firepower,
 +
armor_icon = StatIcons.armor,
 +
torpedo_icon = StatIcons.torpedo,
 +
evasion_icon = StatIcons.evasion,
 +
aa_icon = StatIcons.aa,
 +
aircraft_icon = StatIcons.aircraft,
 +
asw_icon = StatIcons.asw,
 +
speed_icon = StatIcons.speed,
 +
los_icon = StatIcons.los,
 +
range_icon = StatIcons.range,
 +
luck_icon = StatIcons.luck,
 +
}
 +
for k,v in pairs(vars) do
 +
vars[k] = mw.ustring.format(self._image_template, v)
 +
end
 
local rarity = ship:rarity(true) or 0
 
local rarity = ship:rarity(true) or 0
 
vars.top_bg_color = self:top_bg_color(ship)
 
vars.top_bg_color = self:top_bg_color(ship)
Anonymous user