• 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
no edit summary
Line 127: Line 127:  
end
 
end
 
   
 
   
function NodeInfo:as(row)
+
function NodeInfo:create_as_string(as, as_complete)
    color = "initial"
+
     --[=[
    if row.tags.boss then
  −
        color = self._boss_battle_color
  −
    end
  −
    return { values = { as = row.as }, color = color }
  −
end
  −
  −
function NodeInfo:upcase(str)
  −
    str = str:gsub("(%s)(%l)", function(a, b) return a .. string.upper(b) end)
  −
    str = str:gsub("^(%l)", function(a) return string.upper(a) end)
  −
     return str
  −
end
  −
  −
function NodeInfo:insert_item(node, formation, basexp, fleet, as, tags, as_complete)
  −
--[=[
   
     -- Can give weird results when major contributors to air power are unknown
 
     -- Can give weird results when major contributors to air power are unknown
 
     -- [[Category:Todo]] : use tooltips with explanations instead
 
     -- [[Category:Todo]] : use tooltips with explanations instead
    local air_parity = (as_complete or as > 0) and string.format("%.1d", math.ceil((2./3.) * as)) or "??"
+
      local air_parity = (as_complete or as > 0) and string.format("%.1d", math.ceil((2./3.) * as)) or "??"
    local air_superiority = (as_complete or as > 0) and string.format("%.1d", math.ceil(as * (3 / 2))) or "??"
+
      local air_superiority = (as_complete or as > 0) and string.format("%.1d", math.ceil(as * (3 / 2))) or "??"
    local air_supremacy = (as_complete or as > 0) and tostring(as * 3) or "??"
+
      local air_supremacy = (as_complete or as > 0) and tostring(as * 3) or "??"
    local air_string = not as_complete and as > 0 and (air_parity .. "+/" .. air_superiority .. "+/" .. air_supremacy .. "+")
+
      local air_string = not as_complete and as > 0 and (air_parity .. "+/" .. air_superiority .. "+/" .. air_supremacy .. "+")
 
         or (air_parity .. "/" .. air_superiority .. "/" .. air_supremacy)
 
         or (air_parity .. "/" .. air_superiority .. "/" .. air_supremacy)
--]=]
+
    --]=]
 +
 
 
     local air_denial_string = "?"
 
     local air_denial_string = "?"
 
     local air_parity_string = "?"
 
     local air_parity_string = "?"
Line 166: Line 153:  
     end
 
     end
 
     local air_string = air_denial_string .. "/" .. air_parity_string .. "<br>" .. air_superiority_string .. "/" .. air_supremacy_string
 
     local air_string = air_denial_string .. "/" .. air_parity_string .. "<br>" .. air_superiority_string .. "/" .. air_supremacy_string
 +
    return air_string
 +
end
 +
 +
function NodeInfo:as(row)
 +
    color = "initial"
 +
    if row.tags.boss then
 +
        color = self._boss_battle_color
 +
    end
 +
    return { values = { as = row.as }, color = color }
 +
end
 +
 +
function NodeInfo:upcase(str)
 +
    str = str:gsub("(%s)(%l)", function(a, b) return a .. string.upper(b) end)
 +
    str = str:gsub("^(%l)", function(a) return string.upper(a) end)
 +
    return str
 +
end
 +
 +
function NodeInfo:insert_item(node, formation, basexp, fleet, as, tags, as_complete, aslb)
 +
    local as_string = self:create_as_string(as, as_complete)
 +
    local air_string =  as_string
 +
    if tags.showlb then
 +
      local aslb_string = self:create_as_string(aslb, as_complete)
 +
      air_string = "<span class=\"explain\" title=\"LBAS:" + aslb_string + "\">" + as_string + "</span>"
 +
    end
 
if basexp == 0 then
 
if basexp == 0 then
 
table.insert(self._items, {
 
table.insert(self._items, {
Line 199: Line 210:  
     local node, formation, basexp = nil, nil, 0
 
     local node, formation, basexp = nil, nil, 0
 
     local fleet = {}
 
     local fleet = {}
     local as_rating, as_complete = 0, true
+
     local as_rating, as_rating_lb, as_complete = 0, 0, true
 
   
 
   
 
     local tags = {}
 
     local tags = {}
Line 210: Line 221:  
             i = 0
 
             i = 0
 
             if mode == 7 then --We're at a break and have built a full row; time to insert it
 
             if mode == 7 then --We're at a break and have built a full row; time to insert it
                 self:insert_item(node, formation, basexp, table.concat(fleet, " "), as_rating, tags, as_complete)
+
                 self:insert_item(node, formation, basexp, table.concat(fleet, " "), as_rating, tags, as_complete, as_rating_lb)
 
             end
 
             end
 
             table.insert(self._items, "break")
 
             table.insert(self._items, "break")
             fleet, as_rating, as_complete = {}, 0, true
+
             fleet, as_rating, as_rating_lb, as_complete = {}, 0, 0, true
 
             tags = {}
 
             tags = {}
 
             mode = 1
 
             mode = 1
Line 277: Line 288:  
            mode = 7
 
            mode = 7
 
        else
 
        else
                i = i + 1
+
            i = i + 1
 
   
            --Fleets are of variable size, so we append onto a string until we hit the next node declaration
 
            --Fleets are of variable size, so we append onto a string until we hit the next node declaration
 
            local id = tonumber(item_key)
 
            local id = tonumber(item_key)
Line 306: Line 316:  
            local ship = EnemyShip(ship_name, ship_suffix)
 
            local ship = EnemyShip(ship_name, ship_suffix)
 
            local ship_air_power = ship:air_power(tags.raid)
 
            local ship_air_power = ship:air_power(tags.raid)
 +
            local ship_air_power_lb = ship:air_power(true)
 
             
 
             
 
            local ship_caption =
 
            local ship_caption =
Line 326: Line 337:  
            if ship_air_power then
 
            if ship_air_power then
 
                as_rating = as_rating + ship_air_power
 
                as_rating = as_rating + ship_air_power
 +
                as_rating_lb = as_rating_lb + ship_air_power_lb
 
            else
 
            else
 
                as_complete = false
 
                as_complete = false
Line 337: Line 349:  
     end
 
     end
 
     if mode == 7 then
 
     if mode == 7 then
         self:insert_item(node, formation, basexp, table.concat(fleet, " "), as_rating, tags, as_complete)
+
         self:insert_item(node, formation, basexp, table.concat(fleet, " "), as_rating, tags, as_complete, as_rating_lb)
 
     end
 
     end
 
end
 
end

Navigation menu