• 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
Implement availability and impl date
Line 28: Line 28:  
     _artist_header = "[[Glossary#List of Vessels by Artist|Artist]]",
 
     _artist_header = "[[Glossary#List of Vessels by Artist|Artist]]",
 
     _class_template = "[[:Category:${ship_class}|]]",
 
     _class_template = "[[:Category:${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}",
 +
    _quarters = {
 +
    [1] = "Winter",
 +
    [4] = "Spring",
 +
    [7] = "Summer",
 +
    [10] = "Fall",
 +
},
 +
_difficulties = {
 +
[0] = "All",
 +
[1] = "Easy",
 +
[2] = "Medium",
 +
[3] = "Hard",
 +
},
 
_fields = {
 
_fields = {
 
    "name",
 
    "name",
Line 65: Line 87:     
function ShipMetaKai:availability()
 
function ShipMetaKai:availability()
     return
+
     local availability = self._ship:availability()
 +
    local result = {}
 +
    for _, method in ipairs(availability) do
 +
        if method == "buildable" then
 +
            local details = {}
 +
            if availability.buildable.normal then
 +
                table.insert(details, self._normal_construction_label)
 +
            end
 +
            if availability.buildable.lsc then
 +
                table.insert(details, self._large_ship_construction_label)
 +
            end
 +
            if #details > 0 then
 +
            details = format{self._details_template, details = table.concat(details, ", ")}
 +
            else
 +
            details = ""
 +
            end
 +
            table.insert(result, self._buildable_label .. details)
 +
        elseif method == "drop" then
 +
        local details = {}
 +
        if availability.drop then
 +
        for _, node in availability.drop do
 +
        local node_name = format{self._node_name_template, world = node[1], map = node[2], node = node[3]}
 +
if #node == 4 then
 +
node_name = node_name .. format{self._node_formation_template, formation = node[4]}
 +
end
 +
        table.insert(details, node_name)
 +
        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 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 availability.drop do
 +
        local node_name = format{self._event_node_name_template, year = node[1], quarter = self._quarters[node[2]], map = node[3], node = node[4]}
 +
if #node == 5 then
 +
node_name = node_name .. format{self._node_formation_template, formation = node[5]}
 +
end
 +
        table.insert(details, node_name)
 +
        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/>")
 
end
 
end
    
function ShipMetaKai:implementation_date()
 
function ShipMetaKai:implementation_date()
     return
+
     local implementation_date = self._ship:implementation_date()
 +
    self._vars.implementation_date = format{self._date_template, year = implementation_date[1], month = implementation_date[2], day = implementation_date[3]}
 
end
 
end
  
Anonymous user

Navigation menu