- Welcome to the Kancolle Wiki!
- If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord
Module:NanaminFleet
Jump to navigation
Jump to search
Documentation for this module may be created at Module:NanaminFleet/doc
local Ship = require('Module:Ship')
local Equipment = require('Module:Equipment')
local Formatting = require('Module:Formatting')
local format = require('Module:StringInterpolation').format
local NanaminFleet = {
_template = [[{| class="mw-collapsible mw-collapsed"
| style="background: lightskyblue;" |Ship
| style="background: lightskyblue;" |Equipment
| style="background: lightskyblue;" |Ship
| style="background: lightskyblue;" |Equipment
|-
| rowspan="4" style="background: whitesmoke;" |${ship_card1}
${ship_equips1}
| rowspan="4" style="background: whitesmoke;" |${ship_card4}
${ship_equips4}
|-
| rowspan="4" style="background: whitesmoke;" |${ship_card2}
${ship_equips2}
| rowspan="4" style="background: whitesmoke;" |${ship_card5}
${ship_equips5}
|-
| rowspan="4" style="background: whitesmoke;" |${ship_card3}
${ship_equips3}
| rowspan="4" style="background: whitesmoke;" |${ship_card6}
${ship_equips6}
|}]],
_slot_template = [[|-
| style="background: whitesmoke;" |${icon} ${equip}
| style="background: whitesmoke;" |${plane_count}
]]
}
function NanaminFleet:ship_card(ship)
return ""
--return Formatting:format_image(ship:card())
end
function NanaminFleet:slot_equipment(ship)
local slots = {}
local ship_slot_count = ship:slots()
for i = 1, 4 do
local equip, plane_count, icon, equip_type
if i > ship_slot_count then
equip, plane_count, icon, equip_type = "- Locked -", "-", 0, false
else
equip, plane_count = ship:slot(i)
equip = Equipment:create(ship.equip[i].name)
if equip then
icon = equip:icon()
equip_type = false
equip = Formatting:format_link(equip:link())
else
icon = false
equip_type = false
equip = "- Unequipped -"
plane_count = 0
end
icon = Formatting:format_image{Formatting:format_equipment_icon(icon), caption = Formatting:format_equipment_type(equip_type)}
end
table.insert(slots, format{self._slot_template,
icon = icon,
equip = equip,
plane_count = plane_count
})
end
return table.concat(slots)
end
function NanaminFleet:Infobox(args)
local ships = {}
local vars = {}
for i = 1, 6 do
ships[i] = Ship(args["ship" .. tostring(i)], args["ship" .. tostring(i) .. "_remodel"])
--Get the equips categorized under each ship specifically so the ship number doesn't have to be passed.
ships[i].equip = {}
for a = 1, 4 do
ships[i].equip[a] = args["ship" .. tostring(i) .. "_equip" .. tostring(a)]
end
vars["ship_card" .. i] = self:ship_card(ships[i])
vars["ship_equips" .. i] = self:slot_equipment(ships[i])
end
mw.log(format(self._template, vars))
return format(self._template, vars)
end
function test(frame)
args = {
ship1 = "Haruna",
ship1_remodal = "Kai Ni",
ship1_equip1 = {name = "35.6cm Twin Gun Mount"},
ship1_equip2 = {name = "35.6cm Twin Gun Mount"},
ship1_equip3 = {name = "35.6cm Twin Gun Mount"},
ship1_equip4 = {name = "35.6cm Twin Gun Mount"},
ship2 = "Haruna",
ship2_remodal = "Kai Ni",
ship2_equip1 = {name = "35.6cm Twin Gun Mount"},
ship2_equip2 = {name = "35.6cm Twin Gun Mount"},
ship2_equip3 = {name = "35.6cm Twin Gun Mount"},
ship2_equip4 = {name = "35.6cm Twin Gun Mount"},
ship3 = "Haruna",
ship3_remodal = "Kai Ni",
ship3_equip1 = {name = "35.6cm Twin Gun Mount"},
ship3_equip2 = {name = "35.6cm Twin Gun Mount"},
ship3_equip3 = {name = "35.6cm Twin Gun Mount"},
ship3_equip4 = {name = "35.6cm Twin Gun Mount"},
ship4 = "Haruna",
ship4_remodal = "Kai Ni",
ship4_equip1 = {name = "35.6cm Twin Gun Mount"},
ship4_equip2 = {name = "35.6cm Twin Gun Mount"},
ship4_equip3 = {name = "35.6cm Twin Gun Mount"},
ship4_equip4 = {name = "35.6cm Twin Gun Mount"},
ship5 = "Haruna",
ship5_remodal = "Kai Ni",
ship5_equip1 = {name = "35.6cm Twin Gun Mount"},
ship5_equip2 = {name = "35.6cm Twin Gun Mount"},
ship5_equip3 = {name = "35.6cm Twin Gun Mount"},
ship5_equip4 = {name = "35.6cm Twin Gun Mount"},
ship6 = "Haruna",
ship6_remodal = "Kai Ni",
ship6_equip1 = {name = "35.6cm Twin Gun Mount"},
ship6_equip2 = {name = "35.6cm Twin Gun Mount"},
ship6_equip3 = {name = "35.6cm Twin Gun Mount"},
ship6_equip4 = {name = "35.6cm Twin Gun Mount"}
}
NanaminFleet:Infobox(args)
end
return NanaminFleet