Changes

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