Changes

Support abbreviated drop structure
Line 39: Line 39:  
     _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 = "*",
 
     _quarters = {
 
     _quarters = {
 
     [1] = "Winter",
 
     [1] = "Winter",
Line 105: Line 106:  
         local details = {}
 
         local details = {}
 
         if availability.drop then
 
         if availability.drop then
         for _, node in ipairs(availability.drop) do
+
         for _, drop in ipairs(availability.drop) do
        local node_name = format{self._node_name_template, world = node[1], map = node[2], node = node[3]}
+
            local nodes, complex
if #node == 4 then
+
            if type(drop[3]) == "table" then
node_name = node_name .. format{self._node_formation_template, formation = node[4]}
+
                nodes = drop[3]
end
+
            elseif drop[3] == true then
        table.insert(details, node_name)
+
                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
 
         end
 
         end
Line 139: Line 150:  
         local details = {}
 
         local details = {}
 
         if availability.event_drop then
 
         if availability.event_drop then
         for _, node in ipairs(availability.drop) do
+
         for _, node in ipairs(availability.event_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]}
+
            local nodes, complex
if #node == 5 then
+
            if type(drop[4]) == "table" then
node_name = node_name .. format{self._node_formation_template, formation = node[5]}
+
                nodes = drop[4]
end
+
            elseif drop[4] == true then
        table.insert(details, node_name)
+
                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
 
         end
 
         end
Anonymous user