- 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:NanaminFleet"
Jump to navigation
Jump to search
m |
m |
||
Line 73: | Line 73: | ||
ships[i] = Ship(args["ship" .. tostring(i)], args["ship" .. tostring(i) .. "_remodel"]) | ships[i] = Ship(args["ship" .. tostring(i)], args["ship" .. tostring(i) .. "_remodel"]) | ||
--Also get all the equips for the ship | --Also get all the equips for the ship | ||
− | ships[i] | + | ships[i]["equip"] = {} |
for a = 1, 4 do | for a = 1, 4 do | ||
ships[i].equip[a] = args["ship" .. tostring(i) .. "_equip" .. tostring(a)] | ships[i].equip[a] = args["ship" .. tostring(i) .. "_equip" .. tostring(a)] | ||
end | end | ||
end | end | ||
+ | mw.log("Hello") | ||
return format(self._template) | return format(self._template) | ||
end | end | ||
return NanaminFleet | return NanaminFleet |
Revision as of 05:56, 6 April 2015
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_card(1)}
${slot_equipment(1)}
| rowspan="4" style="background: whitesmoke;" |${ship_card(4)}
${slot_equipment(4)}
|-
| rowspan="4" style="background: whitesmoke;" |${ship_card(2)}
${slot_equipment(2)}
| rowspan="4" style="background: whitesmoke;" |${ship_card(5)}
${slot_equipment(5)}
|-
| rowspan="4" style="background: whitesmoke;" |${ship_card(3)}
${slot_equipment(3)}
| rowspan="4" style="background: whitesmoke;" |${ship_card(6)}
${slot_equipment(6)}
|}]],
_slot_template = [[|-
| style="background: whitesmoke;" |${icon} ${equip}
| style="background: whitesmoke;" |${plane_count}
]]
}
function NanaminFleet:ship_card(ships, fleet_slot)
return Formatting:format_image(ships[fleet_slot]:card())
end
function NanaminFleet:slot_equipment(ships, fleet_slot)
local slots = {}
local ship_slot_count = ship:slots()
for i = 1, 4 do
if i > ship_slot_count then
equip, plane_count, icon, equip_type = "- Locked -", "-", 0, false
else
local equip, plane_count, icon, equip_type
equip, plane_count = ships[fleet_slot]:slot(i)
equip = ships[fleet_slot].equip[i].name
if equip then
icon = equip:icon()
equip_type = equip:type()
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 = {}
for i = 1, 6 do
ships[i] = Ship(args["ship" .. tostring(i)], args["ship" .. tostring(i) .. "_remodel"])
--Also get all the equips for the ship
ships[i]["equip"] = {}
for a = 1, 4 do
ships[i].equip[a] = args["ship" .. tostring(i) .. "_equip" .. tostring(a)]
end
end
mw.log("Hello")
return format(self._template)
end
return NanaminFleet