• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
m
Fix all problems.
Line 2: Line 2:  
local Equipment = require('Module:Equipment')
 
local Equipment = require('Module:Equipment')
 
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
   
local format = require('Module:StringInterpolation').format
 
local format = require('Module:StringInterpolation').format
   Line 12: Line 11:  
     | style="background: lightskyblue;" |Equipment
 
     | style="background: lightskyblue;" |Equipment
 
     |-
 
     |-
     | rowspan="4" style="background: whitesmoke;" |${ship_card(1)}
+
     | rowspan="4" style="background: whitesmoke;" |${ship_card1}
     ${slot_equipment(1)}
+
     ${ship_equips1}
     | rowspan="4" style="background: whitesmoke;" |${ship_card(4)}
+
     | rowspan="4" style="background: whitesmoke;" |${ship_card4}
     ${slot_equipment(4)}
+
     ${ship_equips4}
 
     |-
 
     |-
     | rowspan="4" style="background: whitesmoke;" |${ship_card(2)}
+
     | rowspan="4" style="background: whitesmoke;" |${ship_card2}
     ${slot_equipment(2)}
+
     ${ship_equips2}
     | rowspan="4" style="background: whitesmoke;" |${ship_card(5)}
+
     | rowspan="4" style="background: whitesmoke;" |${ship_card5}
     ${slot_equipment(5)}
+
     ${ship_equips5}
 
     |-
 
     |-
     | rowspan="4" style="background: whitesmoke;" |${ship_card(3)}
+
     | rowspan="4" style="background: whitesmoke;" |${ship_card3}
     ${slot_equipment(3)}
+
     ${ship_equips3}
     | rowspan="4" style="background: whitesmoke;" |${ship_card(6)}
+
     | rowspan="4" style="background: whitesmoke;" |${ship_card6}
     ${slot_equipment(6)}
+
     ${ship_equips6}
 
     |}]],
 
     |}]],
 
     _slot_template = [[|-
 
     _slot_template = [[|-
Line 33: Line 32:  
}
 
}
   −
function NanaminFleet:ship_card(ships, fleet_slot)
+
function NanaminFleet:ship_card(ship)
     return Formatting:format_image(ships[fleet_slot]:card())
+
     return ""
 +
    --return Formatting:format_image(ship:card())
 
end
 
end
   −
function NanaminFleet:slot_equipment(ships, fleet_slot)
+
function NanaminFleet:slot_equipment(ship)
 
     local slots = {}
 
     local slots = {}
 
     local ship_slot_count = ship:slots()
 
     local ship_slot_count = ship:slots()
 
     for i = 1, 4 do
 
     for i = 1, 4 do
 +
        local equip, plane_count, icon, equip_type
 
         if i > ship_slot_count then
 
         if i > ship_slot_count then
 
             equip, plane_count, icon, equip_type = "- Locked -", "-", 0, false
 
             equip, plane_count, icon, equip_type = "- Locked -", "-", 0, false
 
         else
 
         else
            local equip, plane_count, icon, equip_type
+
             equip, plane_count = ship:slot(i)
             equip, plane_count = ships[fleet_slot]:slot(i)
+
             equip = Equipment:create(ship.equip[i].name)
             equip = ships[fleet_slot].equip[i].name
   
             if equip then
 
             if equip then
 
                 icon = equip:icon()
 
                 icon = equip:icon()
                 equip_type = equip:type()
+
                 equip_type = false
 
                 equip = Formatting:format_link(equip:link())
 
                 equip = Formatting:format_link(equip:link())
 
             else
 
             else
Line 70: Line 70:  
function NanaminFleet:Infobox(args)
 
function NanaminFleet:Infobox(args)
 
     local ships = {}
 
     local ships = {}
 +
    local vars = {}
 
     for i = 1, 6 do
 
     for i = 1, 6 do
 
         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
+
       
         ships[i]["equip"] = {}
+
         --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
 
         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
 +
       
 +
        vars["ship_card" .. i] = self:ship_card(ships[i])
 +
        vars["ship_equips" .. i] = self:slot_equipment(ships[i])
 
     end
 
     end
     mw.log("Hello")
+
 
     return format(self._template)
+
     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
 
end
    
return NanaminFleet
 
return NanaminFleet
48

edits

Navigation menu