- 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
Line 25:
Line 25:
− _voice_actor_header = "[[Glossary#List of Vessels by Japanese Voice Actresses|Seiyuu]]",+
− _artist_header = "[[Glossary#List of Vessels by Artist|Artist]]",+
− _class_template = "[[:Category:${ship_class}|${ship_class}]]",+
− _normal_construction_label = "Normal",+
− _large_ship_construction_label = "LSC",+
− _buildable_label = "Construction",+
− _drop_label = "Drop",+
− _details_template = " (${details})",+
− _event_reward_label = "Event Reward",+
− _event_drop_label = "Event Drop",+
− _node_name_template = "${world}-${map}-${node}",+
− _node_formation_template = "-${formation}",+
− _event_node_name_template = "${year} ${quarter} E-${map}-${node}",+
− _date_template = "${year}-${month}-${day}",+
− _all_nodes_symbol = "*",+
− _quarters = {+
− [1] = "Winter",+
− [4] = "Spring",+
− [7] = "Summer",+
− [10] = "Fall",+
Line 53:
Line 53:
− "name",+
− "class",+
− "voice_actor",+
− "artist",+
− "availability",+
− "implementation_date",+
Line 69:
Line 69:
− self._vars.name = Formatting:format_stat(self._ship:name())+
− self._vars.japanese_name = tostring(Formatting:japanese_text(Formatting:format_stat(self._ship:japanese_name())))+
− local ship_class = self._ship:class()+
− if ship_class then+
− self._vars.class = format{self._class_template, ship_class = ship_class:name()}+
− end+
− self._vars.voice_actor = Formatting:format_stat(self._ship:voice_actor())+
− self._vars.artist = Formatting:format_stat(self._ship:artist())+
− local availability = self._ship:availability()+
− local result = {}+
− local buildable = false+
− if self._ship:buildable() then+
− buildable = {self._normal_construction_label}+
− end+
− if self._ship:buildable_lsc() then+
− buildable = buildable or {}+
− table.insert(buildable, self._large_ship_construction_label)+
− end+
− if buildable then+
− table.insert(result, self._buildable_label .. format{self._details_template, details = table.concat(buildable, ", ")})+
− end+
− for _, method in ipairs(availability) do+
− if method == "drop" then+
− local details = {}+
− if availability.drop then+
− for _, drop in ipairs(availability.drop) do+
− local nodes, complex+
− if type(drop[3]) == "table" then+
− nodes = drop[3]+
− elseif drop[3] == true then+
− nodes = {self._all_nodes_symbol}+
− else+
− nodes = {drop[3]}+
− end+
− for _, node in ipairs(nodes) do+
− local node_name = format{self._node_name_template, world = drop[1], map = drop[2], node = node}+
− if #drop == 4 then+
− node_name = node_name .. format{self._node_formation_template, formation = complex and drop[4][node] or drop[4]}+
− end+
− table.insert(details, node_name)+
− end+
− end+
− end+
− if #details > 0 then+
− details = format{self._details_template, details = table.concat(details, ", ")}+
− else+
− details = ""+
− end+
− table.insert(result, self._drop_label .. details)+
− elseif method == "event_reward" then+
− local details = {}+
− if availability.event_reward then+
− for _, map in ipairs(availability.event_reward) do+
− local map_name = format{self._map_name_template, year = map[1], quarter = self._quarters[node[2]], map = map[3]}+
− if #map == 4 then+
− map_name = map_name .. format{self._details_template, details = self._difficulties[map[4]]}+
− end+
− table.insert(details, map_name)+
− end+
− end+
− if #details > 0 then+
− details = format{self._details_template, details = table.concat(details, ", ")}+
− else+
− details = ""+
− end+
− table.insert(result, self._event_reward_label .. details)+
− elseif method == "event_drop" then+
− local details = {}+
− if availability.event_drop then+
− for _, node in ipairs(availability.event_drop) do+
− local nodes, complex+
− if type(drop[4]) == "table" then+
− nodes = drop[4]+
− elseif drop[4] == true then+
− nodes = {self._all_nodes_symbol}+
− else+
− nodes = {drop[4]}+
− end+
− for _, node in ipairs(nodes) do+
− local node_name = format{self._event_node_name_template, year = node[1], quarter = self._quarters[node[2]], map = node[3], node = node}+
− if #drop == 5 then+
− node_name = node_name .. format{self._node_formation_template, formation = complex and drop[5][node] or drop[5]}+
− end+
− table.insert(details, node_name)+
− end+
− end+
− end+
− if #details > 0 then+
− details = format{self._details_template, details = table.concat(details, ", ")}+
− else+
− details = ""+
− end+
− table.insert(result, self._event_drop_label .. details)+
− end+
− end+
− self._vars.availability = table.concat(result, "<br/>")+
+
+
+
+
+
+
+
+
− local implementation_date = self._ship:implementation_date()+
− if implementation_date then+
− self._vars.implementation_date = format{self._date_template, year = implementation_date[1], month = implementation_date[2], day = implementation_date[3]}+
− else+
− self._vars.implementation_date = "??"+
− end+
no edit summary
|${implementation_date}
|${implementation_date}
|}]],
|}]],
_voice_actor_header = "[[Glossary#List of Vessels by Japanese Voice Actresses|Seiyuu]]",
_artist_header = "[[Glossary#List of Vessels by Artist|Artist]]",
_class_template = "[[:Category:${ship_class}|${ship_class}]]",
_normal_construction_label = "Normal",
_large_ship_construction_label = "LSC",
_buildable_label = "Construction",
_drop_label = "Drop",
_details_template = " (${details})",
_event_reward_label = "Event Reward",
_event_drop_label = "Event Drop",
_node_name_template = "${world}-${map}-${node}",
_node_formation_template = "-${formation}",
_event_node_name_template = "${year} ${quarter} E-${map}-${node}",
_date_template = "${year}-${month}-${day}",
_all_nodes_symbol = "*",
_quarters = {
[1] = "Winter",
[4] = "Spring",
[7] = "Summer",
[10] = "Fall",
},
},
_difficulties = {
_difficulties = {
},
},
_fields = {
_fields = {
"name",
"class",
"voice_actor",
"artist",
"availability",
"implementation_date",
},
},
}
}
function ShipMetaKai:name()
function ShipMetaKai:name()
self._vars.name = Formatting:format_stat(self._ship:name())
self._vars.japanese_name = tostring(Formatting:japanese_text(Formatting:format_stat(self._ship:japanese_name())))
end
end
function ShipMetaKai:class()
function ShipMetaKai:class()
local ship_class = self._ship:class()
if ship_class then
self._vars.class = format{self._class_template, ship_class = ship_class:name()}
end
end
end
function ShipMetaKai:voice_actor()
function ShipMetaKai:voice_actor()
self._vars.voice_actor = Formatting:format_stat(self._ship:voice_actor())
end
end
function ShipMetaKai:artist()
function ShipMetaKai:artist()
self._vars.artist = Formatting:format_stat(self._ship:artist())
end
end
function ShipMetaKai:availability()
function ShipMetaKai:availability()
local availability = self._ship:availability()
local result = {}
local buildable = false
if self._ship:buildable() then
buildable = {self._normal_construction_label}
end
if self._ship:buildable_lsc() then
buildable = buildable or {}
table.insert(buildable, self._large_ship_construction_label)
end
if buildable then
table.insert(result, self._buildable_label .. format{self._details_template, details = table.concat(buildable, ", ")})
end
for _, method in ipairs(availability) do
if method == "drop" then
local details = {}
if availability.drop then
for _, drop in ipairs(availability.drop) do
local nodes, complex
if type(drop[3]) == "table" then
nodes = drop[3]
elseif drop[3] == true then
nodes = {self._all_nodes_symbol}
else
nodes = {drop[3]}
end
for _, node in ipairs(nodes) do
local node_name = format{self._node_name_template, world = drop[1], map = drop[2], node = node}
if #drop == 4 then
node_name = node_name .. format{self._node_formation_template, formation = complex and drop[4][node] or drop[4]}
end
table.insert(details, node_name)
end
end
end
if #details > 0 then
details = format{self._details_template, details = table.concat(details, ", ")}
if #details > self._max_drops_before_collapsible then
table.insert(result, tostring(mw.html.create("div"):addClass("mw-collapsible"):addClass("mw-collapsed"):wikitext(self._drop_label):tag("div"):addClass("mw-collapsible-content"):wikitext(details)))
else
table.insert(result, self._drop_label .. details)
end
else
table.insert(result, self._drop_label)
end
elseif method == "event_reward" then
local details = {}
if availability.event_reward then
for _, map in ipairs(availability.event_reward) do
local map_name = format{self._map_name_template, year = map[1], quarter = self._quarters[node[2]], map = map[3]}
if #map == 4 then
map_name = map_name .. format{self._details_template, details = self._difficulties[map[4]]}
end
table.insert(details, map_name)
end
end
if #details > 0 then
details = format{self._details_template, details = table.concat(details, ", ")}
else
details = ""
end
table.insert(result, self._event_reward_label .. details)
elseif method == "event_drop" then
local details = {}
if availability.event_drop then
for _, node in ipairs(availability.event_drop) do
local nodes, complex
if type(drop[4]) == "table" then
nodes = drop[4]
elseif drop[4] == true then
nodes = {self._all_nodes_symbol}
else
nodes = {drop[4]}
end
for _, node in ipairs(nodes) do
local node_name = format{self._event_node_name_template, year = node[1], quarter = self._quarters[node[2]], map = node[3], node = node}
if #drop == 5 then
node_name = node_name .. format{self._node_formation_template, formation = complex and drop[5][node] or drop[5]}
end
table.insert(details, node_name)
end
end
end
if #details > 0 then
details = format{self._details_template, details = table.concat(details, ", ")}
if #details > self._max_drops_before_collapsible then
table.insert(result, tostring(mw.html.create("div"):addClass("mw-collapsible"):addClass("mw-collapsed"):wikitext(self._event_drop_label):tag("div"):addClass("mw-collapsible-content"):wikitext(details)))
else
table.insert(result, self._event_drop_label .. details)
end
else
table.insert(result, self._event_drop_label)
end
end
end
self._vars.availability = table.concat(result, "<br/>")
end
end
function ShipMetaKai:implementation_date()
function ShipMetaKai:implementation_date()
local implementation_date = self._ship:implementation_date()
if implementation_date then
self._vars.implementation_date = format{self._date_template, year = implementation_date[1], month = implementation_date[2], day = implementation_date[3]}
else
self._vars.implementation_date = "??"
end
end
end