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

From Kancolle Wiki
Jump to navigation Jump to search
m
Line 4: Line 4:
  
 
local seiyuus = {
 
local seiyuus = {
 +
    type = "seiyuus",
 +
    index = { "Bridcut Sarah Emi", "Endou Aya", "Fujita Saki", "Hayami Saori", "Hayasaka Kozue", "Hidaka Rina", "Horie Yui", "Iguchi Yuka", "Ise Mariya", "Ishigami Shizuka", "Kanemoto Hisako", "Kawasumi Ayako", "Kayano Ai", "Kitou Akari", "Kobayashi Motoko", "Komatsu Mana", "Komatsu Mikako", "Kuno Misaki", "Misato", "Miyagawa Wakana", "Nakajima Megumi", "Nomizu Iori", "Noto Mamiko", "Ogura Yui", "Ootsubo Yuka", "Ozawa Ari", "Sakura Ayane", "Suzaki Aya", "Taketatsu Ayana", "Taneda Risa", "Tanibe Yumi", "Touyama Nao", "Uesaka Sumire", "Yamada Yuki" },
 
     ["Bridcut Sarah Emi"] = {
 
     ["Bridcut Sarah Emi"] = {
 
         url = "http://myanimelist.net/people/19371/Sarah_Emi_Bridcut",
 
         url = "http://myanimelist.net/people/19371/Sarah_Emi_Bridcut",
Line 143: Line 145:
  
 
local types = {
 
local types = {
 +
    type = "types",
 +
    index = { "Destroyers", "Light Cruisers", "Heavy Cruisers", "Battleships", "Light Carriers", "Standard Carriers", "Submarines", "Auxiliaries" },
 
     ["Destroyers"] = {
 
     ["Destroyers"] = {
 
         ships = { "Akatsuki", "Akebono", "Akigumo", "Akizuki", "Amatsukaze", "Arare", "Arashi", "Arashio", "Asagumo", "Asashimo", "Asashio", "Ayanami", "Fubuki", "Fumizuki", "Hagikaze", "Hamakaze", "Harusame", "Hatsuharu", "Hatsukaze", "Hatsushimo", "Hatsuyuki", "Hayashimo", "Hibiki", "Ikazuchi", "Inazuma", "Isokaze", "Isonami", "Kagerou", "Kasumi", "Kawakaze", "Kazagumo", "Kikuzuki", "Kisaragi", "Kiyoshimo", "Kuroshio", "Libeccio", "Maikaze", "Makigumo", "Michishio", "Mikazuki", "Miyuki", "Mochizuki", "Murakumo", "Murasame", "Mutsuki", "Naganami", "Nagatsuki", "Nenohi", "Nowaki", "Oboro", "Ooshio", "Samidare", "Satsuki", "Sazanami", "Shigure", "Shikinami", "Shimakaze", "Shiranui", "Shiratsuyu", "Shirayuki", "Suzukaze", "Takanami", "Tanikaze", "Teruzuki", "Tokitsukaze", "Umikaze", "Urakaze", "Ushio", "Uzuki", "Wakaba", "Yamagumo", "Yayoi", "Yukikaze", "Yuudachi", "Yuugumo", "Z1", "Z3" }
 
         ships = { "Akatsuki", "Akebono", "Akigumo", "Akizuki", "Amatsukaze", "Arare", "Arashi", "Arashio", "Asagumo", "Asashimo", "Asashio", "Ayanami", "Fubuki", "Fumizuki", "Hagikaze", "Hamakaze", "Harusame", "Hatsuharu", "Hatsukaze", "Hatsushimo", "Hatsuyuki", "Hayashimo", "Hibiki", "Ikazuchi", "Inazuma", "Isokaze", "Isonami", "Kagerou", "Kasumi", "Kawakaze", "Kazagumo", "Kikuzuki", "Kisaragi", "Kiyoshimo", "Kuroshio", "Libeccio", "Maikaze", "Makigumo", "Michishio", "Mikazuki", "Miyuki", "Mochizuki", "Murakumo", "Murasame", "Mutsuki", "Naganami", "Nagatsuki", "Nenohi", "Nowaki", "Oboro", "Ooshio", "Samidare", "Satsuki", "Sazanami", "Shigure", "Shikinami", "Shimakaze", "Shiranui", "Shiratsuyu", "Shirayuki", "Suzukaze", "Takanami", "Tanikaze", "Teruzuki", "Tokitsukaze", "Umikaze", "Urakaze", "Ushio", "Uzuki", "Wakaba", "Yamagumo", "Yayoi", "Yukikaze", "Yuudachi", "Yuugumo", "Z1", "Z3" }
Line 171: Line 175:
 
local Seasonal = {}
 
local Seasonal = {}
  
function gen(args, tbl, type, format)
+
function gen(args, tbl, format)
 
     local result = ""
 
     local result = ""
 
     local i = 0
 
     local i = 0
 
     local n = 0
 
     local n = 0
     for k, data in pairs(tbl) do
+
     for _, k in ipairs(tbl.index) do
 +
        local data = tbl[k]
 
         local ships = Utils.filter(data.ships, function(ship) return Utils.find(args, ship) end)
 
         local ships = Utils.filter(data.ships, function(ship) return Utils.find(args, ship) end)
 
         if #ships > 0 then
 
         if #ships > 0 then
Line 183: Line 188:
 
             if data.url then
 
             if data.url then
 
                 result = result .. string.format("|-\n|[%s %s]\n|%s\n", data.url, k, ships_str)
 
                 result = result .. string.format("|-\n|[%s %s]\n|%s\n", data.url, k, ships_str)
             elseif type == "types" then
+
             elseif tbl.type == "types" then
 
                 result = result .. string.format("|-\n|[[#%s|%s]] (%s)\n|%s\n", args[k] or k, k, #ships, ships_str)
 
                 result = result .. string.format("|-\n|[[#%s|%s]] (%s)\n|%s\n", args[k] or k, k, #ships, ships_str)
 
             else
 
             else
Line 196: Line 201:
 
     local args = getArgs{frame = frame:getParent()}
 
     local args = getArgs{frame = frame:getParent()}
 
     return
 
     return
         gen(args, types, "types", function(r, i, n) return string.format([===[{| class="mw-collapsible mw-collapsed wikitable typography-xl-optout" style="width:100%%"
+
         gen(args, types, function(r, i, n) return string.format([===[{| class="mw-collapsible mw-collapsed wikitable typography-xl-optout" style="width:100%%"
 
|-
 
|-
 
!width=20%%|Class
 
!width=20%%|Class
Line 202: Line 207:
 
]===], n) .. r .. "|}" end)
 
]===], n) .. r .. "|}" end)
 
         .. "\n" ..
 
         .. "\n" ..
         gen(args, seiyuus, "seiyuus", function(r, i, n) return string.format([===[{| class="mw-collapsible mw-collapsed wikitable typography-xl-optout" style="width:100%%"
+
         gen(args, seiyuus, function(r, i, n) return string.format([===[{| class="mw-collapsible mw-collapsed wikitable typography-xl-optout" style="width:100%%"
 
|-
 
|-
 
!width=20%%|[[Glossary#List_of_Vessels_by_Seiyuu|Seiyuu]] (%s)
 
!width=20%%|[[Glossary#List_of_Vessels_by_Seiyuu|Seiyuu]] (%s)
Line 209: Line 214:
  
 
end
 
end
 +
 
return Seasonal
 
return Seasonal

Revision as of 08:08, 15 January 2016

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

local Utils = require('Module:Utils')
local getArgs = require('Module:GetArgs')
local Ship = require('Module:Ship')

local seiyuus = {
    type = "seiyuus",
    index = { "Bridcut Sarah Emi", "Endou Aya", "Fujita Saki", "Hayami Saori", "Hayasaka Kozue", "Hidaka Rina", "Horie Yui", "Iguchi Yuka", "Ise Mariya", "Ishigami Shizuka", "Kanemoto Hisako", "Kawasumi Ayako", "Kayano Ai", "Kitou Akari", "Kobayashi Motoko", "Komatsu Mana", "Komatsu Mikako", "Kuno Misaki", "Misato", "Miyagawa Wakana", "Nakajima Megumi", "Nomizu Iori", "Noto Mamiko", "Ogura Yui", "Ootsubo Yuka", "Ozawa Ari", "Sakura Ayane", "Suzaki Aya", "Taketatsu Ayana", "Taneda Risa", "Tanibe Yumi", "Touyama Nao", "Uesaka Sumire", "Yamada Yuki" },
    ["Bridcut Sarah Emi"] = {
        url = "http://myanimelist.net/people/19371/Sarah_Emi_Bridcut",
        ships = {"Hatsukaze", "Kumano", "Maikaze", "Suzuya", "Yuubari", },
    },
    ["Endou Aya"] = {
        url = "http://myanimelist.net/people/54/Aya_Endou",
        ships = {"Bismarck", "Z1", "Z3", },
    },
    ["Fujita Saki"] = {
        url = "http://myanimelist.net/people/504",
        ships = {"Akagi", "Fusou", "Kagerou", "Kuroshio", "Shiranui", "Tokitsukaze", "Yamashiro", "Yukikaze", },
    },
    ["Hayami Saori"] = {
        url = "http://myanimelist.net/people/869/Saori_Hayami",
        ships = {"Graf Zeppelin", "Hagikaze", },
    },
    ["Hayasaka Kozue"] = {
        url = null,
        ships = {"Akebono", "Oboro", "Sazanami", "Ushio", },
    },
    ["Hidaka Rina"] = {
        url = "http://myanimelist.net/people/5250/Rina_Hidaka",
        ships = {"Fumizuki", "Kikuzuki", "Kisaragi", "Mikazuki", "Mochizuki", "Mutsuki", "Nagatsuki", "Ryuujou", "Satsuki", "Uzuki", "Yayoi", },
    },
    ["Horie Yui"] = {
        url = "http://myanimelist.net/people/28/Yui_Horie",
        ships = {"Amagi", "Asagumo", "Yamagumo", },
    },
    ["Iguchi Yuka"] = {
        url = "http://myanimelist.net/people/885/Yuka_Iguchi",
        ships = {"Chikuma", "Isuzu", "Kaga", "Nagara", "Natori", "Tatsuta", "Tenryuu", "Tone", },
    },
    ["Ise Mariya"] = {
        url = "http://myanimelist.net/people/655/Mariya_Ise",
        ships = {"I-401", },
    },
    ["Ishigami Shizuka"] = {
        url = "http://myanimelist.net/people/28755/Shizuka_Ishigami",
        ships = {"Kawakaze", "Mizuho", "Umikaze", },
    },
    ["Kanemoto Hisako"] = {
        url = "http://myanimelist.net/people/8555/Hisako_Kanemoto",
        ships = {"Harusame", "Hayashimo", "Kiyoshimo", },
    },
    ["Kawasumi Ayako"] = {
        url = "http://myanimelist.net/people/13/Ayako_Kawasumi",
        ships = {"Isokaze", "Ooyodo", "Unryuu", },
    },
    ["Kayano Ai"] = {
        url = "http://myanimelist.net/people/10765/",
        ships = {"Arashi", "Asashimo", "Kashima", "Katori", "Katsuragi", "Ro-500", "U-511", },
    },
    ["Kitou Akari"] = {
        url = "https://ja.wikipedia.org/wiki/%E9%AC%BC%E9%A0%AD%E6%98%8E%E9%87%8C",
        ships = {"Kazagumo", "Libeccio", },
    },
    ["Kobayashi Motoko"] = {
        url = "http://myanimelist.net/people/12285/Motoko_Kobayashi",
        ships = {"Hatsuharu", "Hatsushimo", "Nenohi", "Wakaba", },
    },
    ["Komatsu Mana"] = {
        url = "http://myanimelist.net/people/12941/Mana_Komatsu",
        ships = {"Hamakaze", "Tanikaze", "Urakaze", "Zuihou", },
    },
    ["Komatsu Mikako"] = {
        url = "http://myanimelist.net/people/10071/Komatsu_Mikako",
        ships = {"Akitsushima", "Teruzuki", },
    },
    ["Kuno Misaki"] = {
        url = "http://myanimelist.net/people/11641/Misaki_Kuno",
        ships = {"Littorio", "Roma", "Takanami", },
    },
    ["Misato"] = {
        url = "http://myanimelist.net/people/12759/Misato",
        ships = {"I-19", "I-8", "Musashi", },
    },
    ["Miyagawa Wakana"] = {
        url = "http://www.animenewsnetwork.com.au/encyclopedia/people.php?id=98235",
        ships = {"Arare", "Arashio", "Asashio", "Chitose", "Chiyoda", "Kasumi", "Michishio", "Ooshio", },
    },
    ["Nakajima Megumi"] = {
        url = "http://myanimelist.net/people/1105/Megumi_Nakajima",
        ships = {"I-168", "I-58", "Kinugasa", "Mikuma", },
    },
    ["Nomizu Iori"] = {
        url = "http://myanimelist.net/people/8956/Iori_Nomizu",
        ships = {"Abukuma", "Hayasui", "Kinu", "Shoukaku", "Zuikaku", },
    },
    ["Noto Mamiko"] = {
        url = "http://myanimelist.net/people/40/Mamiko_Noto",
        ships = {"Akitsu Maru", "Maruyu", "Taihou", },
    },
    ["Ogura Yui"] = {
        url = "http://myanimelist.net/people/10981/Yui_Ogura",
        ships = {"Amatsukaze", "Ryuuhou", "Taigei", },
    },
    ["Ootsubo Yuka"] = {
        url = "http://myanimelist.net/people/12452/Yuka_Ootsubo",
        ships = {"Furutaka", "Hiyou", "Hyuuga", "Ise", "Junyou", "Kako", "Kitakami", "Ooi", },
    },
    ["Ozawa Ari"] = {
        url = "http://myanimelist.net/people/27395/Ari_Ozawa",
        ships = {"Akizuki", "Nowaki", "Prinz Eugen", },
    },
    ["Sakura Ayane"] = {
        url = "http://myanimelist.net/people/11622/Ayane_Sakura",
        ships = {"Jintsuu", "Kiso", "Kuma", "Mutsu", "Nagato", "Naka", "Sendai", "Shimakaze", "Tama", },
    },
    ["Suzaki Aya"] = {
        url = "http://myanimelist.net/people/19834/Aya_Suzaki",
        ships = {"Akatsuki", "Aoba", "Hibiki", "Houshou", "Ikazuchi", "Inazuma", "Mogami", },
    },
    ["Taketatsu Ayana"] = {
        url = "http://myanimelist.net/people/6996/Ayana_Taketatsu",
        ships = {"Akigumo", "Makigumo", "Naganami", "Yamato", "Yuugumo", },
    },
    ["Taneda Risa"] = {
        url = "http://myanimelist.net/people/16135/Risa_Taneda",
        ships = {"Akashi", "Ashigara", "Haguro", "Myoukou", "Nachi", "Samidare", "Shouhou", "Suzukaze", },
    },
    ["Tanibe Yumi"] = {
        url = "http://myanimelist.net/people/35951",
        ships = {"Murasame", "Shigure", "Shiratsuyu", "Yura", "Yuudachi", },
    },
    ["Touyama Nao"] = {
        url = "http://myanimelist.net/people/11184/Nao_Touyama",
        ships = {"Atago", "Ayanami", "Choukai", "Haruna", "Hiei", "Kirishima", "Kongou", "Maya", "Shikinami", "Takao", },
    },
    ["Uesaka Sumire"] = {
        url = "http://myanimelist.net/people/14441/Sumire_Uesaka",
        ships = {"Fubuki", "Hatsuyuki", "Hiryuu", "Isonami", "Miyuki", "Murakumo", "Shirayuki", "Souryuu", },
    },
    ["Yamada Yuki"] = {
        url = "http://myanimelist.net/people/28053/Yuki_Yamada",
        ships = {"Agano", "Noshiro", "Sakawa", "Yahagi", },
    },
}

local types = {
    type = "types",
    index = { "Destroyers", "Light Cruisers", "Heavy Cruisers", "Battleships", "Light Carriers", "Standard Carriers", "Submarines", "Auxiliaries" },
    ["Destroyers"] = {
        ships = { "Akatsuki", "Akebono", "Akigumo", "Akizuki", "Amatsukaze", "Arare", "Arashi", "Arashio", "Asagumo", "Asashimo", "Asashio", "Ayanami", "Fubuki", "Fumizuki", "Hagikaze", "Hamakaze", "Harusame", "Hatsuharu", "Hatsukaze", "Hatsushimo", "Hatsuyuki", "Hayashimo", "Hibiki", "Ikazuchi", "Inazuma", "Isokaze", "Isonami", "Kagerou", "Kasumi", "Kawakaze", "Kazagumo", "Kikuzuki", "Kisaragi", "Kiyoshimo", "Kuroshio", "Libeccio", "Maikaze", "Makigumo", "Michishio", "Mikazuki", "Miyuki", "Mochizuki", "Murakumo", "Murasame", "Mutsuki", "Naganami", "Nagatsuki", "Nenohi", "Nowaki", "Oboro", "Ooshio", "Samidare", "Satsuki", "Sazanami", "Shigure", "Shikinami", "Shimakaze", "Shiranui", "Shiratsuyu", "Shirayuki", "Suzukaze", "Takanami", "Tanikaze", "Teruzuki", "Tokitsukaze", "Umikaze", "Urakaze", "Ushio", "Uzuki", "Wakaba", "Yamagumo", "Yayoi", "Yukikaze", "Yuudachi", "Yuugumo", "Z1", "Z3" }
    },
    ["Light Cruisers"] = {
        ships = { "Abukuma", "Agano", "Isuzu", "Jintsuu", "Katori", "Kinu", "Kiso", "Kitakami", "Kuma", "Nagara", "Naka", "Natori", "Noshiro", "Ooi", "Ooyodo", "Sakawa", "Sendai", "Tama", "Tatsuta", "Tenryuu", "Yahagi", "Yura", "Yuubari" }
    },
    ["Heavy Cruisers"] = {
        ships = { "Aoba", "Ashigara", "Atago", "Chikuma", "Choukai", "Furutaka", "Haguro", "Kako", "Kinugasa", "Kumano", "Maya", "Mikuma", "Mogami", "Myoukou", "Nachi", "Prinz Eugen", "Suzuya", "Takao", "Tone" }
    },
    ["Battleships"] = {
        ships = { "Bismarck", "Fusou", "Haruna", "Hiei", "Hyuuga", "Ise", "Kirishima", "Kongou", "Littorio", "Musashi", "Mutsu", "Nagato", "Roma", "Yamashiro", "Yamato" }
    },
    ["Light Carriers"] = {
        ships = { "Chitose", "Chiyoda", "Hiyou", "Houshou", "Jun'you", "Ryuuhou", "Ryuujou", "Shouhou", "Zuihou" }
    },
    ["Standard Carriers"] = {
        ships = { "Akagi", "Amagi", "Graf Zeppelin", "Hiryuu", "Kaga", "Katsuragi", "Shoukaku", "Souryuu", "Taihou", "Unryuu", "Zuikaku" }
    },
    ["Submarines"] = {
        ships = { "I-168", "I-19", "I-401", "I-58", "I-8", "Maruyu", "U-511" }
    },
    ["Auxiliaries"] = {
        ships = { "Akashi", "Akitsu Maru", "Akitsushima", "Hayasui", "Kashima", "Katori", "Mizuho", "Taigei" }
    },
}

local Seasonal = {}

function gen(args, tbl, format)
    local result = ""
    local i = 0
    local n = 0
    for _, k in ipairs(tbl.index) do
        local data = tbl[k]
        local ships = Utils.filter(data.ships, function(ship) return Utils.find(args, ship) end)
        if #ships > 0 then
            i = i + 1
            n = n + #ships
            local ships_str = table.concat(Utils.map(ships, function(ship) return string.format("[[#%s|%s]]", ship, ship) end), ", ")
            if data.url then
                result = result .. string.format("|-\n|[%s %s]\n|%s\n", data.url, k, ships_str)
            elseif tbl.type == "types" then
                result = result .. string.format("|-\n|[[#%s|%s]] (%s)\n|%s\n", args[k] or k, k, #ships, ships_str)
            else
                result = result .. string.format("|-\n|%s\n|%s\n", k, ships_str)
            end
        end
    end
    return format(result, i, n)
end

function Seasonal.toc(frame)
    local args = getArgs{frame = frame:getParent()}
    return
        gen(args, types, function(r, i, n) return string.format([===[{| class="mw-collapsible mw-collapsed wikitable typography-xl-optout" style="width:100%%"
|-
!width=20%%|Class
!Ship girls (%s)
]===], n) .. r .. "|}" end)
        .. "\n" ..
        gen(args, seiyuus, function(r, i, n) return string.format([===[{| class="mw-collapsible mw-collapsed wikitable typography-xl-optout" style="width:100%%"
|-
!width=20%%|[[Glossary#List_of_Vessels_by_Seiyuu|Seiyuu]] (%s)
!
]===], i) .. r .. "|}" end)

end

return Seasonal