• 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
Fixed nil/?? values from causing lua errors. Moved nil checks to function notNil(value).
Line 33: Line 33:  
local function getScaledStat(baseStat, maxStat, level)
 
local function getScaledStat(baseStat, maxStat, level)
 
   return math.floor((maxStat-baseStat) /99 * level + baseStat)
 
   return math.floor((maxStat-baseStat) /99 * level + baseStat)
 +
end
 +
local function notNil(value)
 +
  return value ~= nil and value ~= "" and value ~= "??"
 
end
 
end
   Line 161: Line 164:  
   -- Evasion & AA
 
   -- Evasion & AA
 
   local Evasioninfo = statLabel .. "EVA [[File:IcoEvasion.png|Evasion]]</th>" .. statBox
 
   local Evasioninfo = statLabel .. "EVA [[File:IcoEvasion.png|Evasion]]</th>" .. statBox
   if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
+
   if notNil(ship["evasion"][1]) and notNil(ship["evasion"][2]) then
    Evasioninfo = Evasioninfo .. formatTooltip(ship["evasion"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["evasion"][1], ship["evasion"][2], ship["remodellv"])}) .. "→"
+
    if notNil(ship["remodellv"]) then
 +
      Evasioninfo = Evasioninfo .. formatTooltip(ship["evasion"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["evasion"][1], ship["evasion"][2], ship["remodellv"])}) .. "→"
 +
    else
 +
      Evasioninfo = Evasioninfo .. ship["evasion"][1] .. "→"
 +
    end
 +
    Evasioninfo = Evasioninfo .. formatTooltip(ship["evasion"][2], U.format{MarriedMaxTemplate, value = getScaledStat(ship["evasion"][1], ship["evasion"][2], DataCaps.ship_level)}) .. "</td>"
 
   else
 
   else
    Evasioninfo = Evasioninfo .. ship["evasion"][1] .. "→"
+
  Evasioninfo = Evasioninfo .. ship["evasion"][1] .. "→" .. ship["evasion"][2]
 
   end
 
   end
  Evasioninfo = Evasioninfo .. formatTooltip(ship["evasion"][2], U.format{MarriedMaxTemplate, value = getScaledStat(ship["evasion"][1], ship["evasion"][2], DataCaps.ship_level)}) .. "</td>"
   
   local AAinfo = statLabel .. "AA [[File:IcoAA.png|Anti-Air]]</th>" .. statBox
 
   local AAinfo = statLabel .. "AA [[File:IcoAA.png|Anti-Air]]</th>" .. statBox
 
   if ship["aa"] == 0 then
 
   if ship["aa"] == 0 then
Line 180: Line 187:  
   if ship["asw"] == 0 then
 
   if ship["asw"] == 0 then
 
     ASWinfo = ASWinfo .. ship["asw"]
 
     ASWinfo = ASWinfo .. ship["asw"]
 +
  elseif notNil(ship["asw"][1]) and notNil(ship["asw"][2]) then
 +
    if notNil(ship["remodellv"])  then
 +
      ASWinfo = ASWinfo .. formatTooltip(ship["asw"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["asw"][1], ship["asw"][2], ship["remodellv"])}) .. "→"
 +
    else
 +
      ASWinfo = ASWinfo .. ship["asw"][1] .. "→"
 +
    end
 +
    local marriedASW = getScaledStat(ship["asw"][1], ship["asw"][2], DataCaps.ship_level)
 +
      ASWinfo = ASWinfo .. formatTooltip(ship["asw"][2], U.format{ASWModMaxTemplate, value = ship["asw"][2]+9} .. ". " .. U.format{ASWMarriedMaxTemplate, value = marriedASW, valueM = marriedASW+9} )
 
   else
 
   else
  if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
+
      ASWinfo = ASWinfo .. ship["asw"][1] .. "→" .. ship["asw"][2]
    ASWinfo = ASWinfo .. formatTooltip(ship["asw"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["asw"][1], ship["asw"][2], ship["remodellv"])}) .. "→"
  −
  else
  −
    ASWinfo = ASWinfo .. ship["asw"][1] .. "→"
  −
  end
  −
  local marriedASW = getScaledStat(ship["asw"][1], ship["asw"][2], DataCaps.ship_level)
  −
  ASWinfo = ASWinfo .. formatTooltip(ship["asw"][2], U.format{ASWModMaxTemplate, value = ship["asw"][2]+9} .. ". " .. U.format{ASWMarriedMaxTemplate, value = marriedASW, valueM = marriedASW+9} )
   
   end
 
   end
 
   local row8 = "<tr>" .. Planeinfo .. ASWinfo .. "</tr>"
 
   local row8 = "<tr>" .. Planeinfo .. ASWinfo .. "</tr>"
Line 193: Line 202:  
   local Speedinfo = statLabel .. "SPD [[File:IcoSpeed.png|Speed]]</th>" .. statBox .. ship["spd"] .. "</td>"
 
   local Speedinfo = statLabel .. "SPD [[File:IcoSpeed.png|Speed]]</th>" .. statBox .. ship["spd"] .. "</td>"
 
   local LOSinfo = statLabel .. "LOS [[File:IcoLOS.png|Line of Sight]]</th>" .. statBox
 
   local LOSinfo = statLabel .. "LOS [[File:IcoLOS.png|Line of Sight]]</th>" .. statBox
   if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
+
   if notNil(ship["los"][1]) and notNil(ship["los"][2]) then
    LOSinfo = LOSinfo .. formatTooltip(ship["los"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["los"][1], ship["los"][2], ship["remodellv"])}) .. "→"
+
    if notNil(ship["remodellv"]) then
 +
      LOSinfo = LOSinfo .. formatTooltip(ship["los"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["los"][1], ship["los"][2], ship["remodellv"])}) .. "→"
 +
    else
 +
      LOSinfo = LOSinfo .. ship["los"][1] .. "→"
 +
    end
 +
    LOSinfo = LOSinfo .. formatTooltip(ship["los"][2], U.format{MarriedMaxTemplate, value = getScaledStat(ship["los"][1], ship["los"][2], DataCaps.ship_level)}) .. "</td>"
 
   else
 
   else
    LOSinfo = LOSinfo .. ship["los"][1] .. "→"
+
  LOSinfo = LOSinfo .. ship["los"][1] .. "→" .. ship["los"][2]
 
   end
 
   end
  LOSinfo = LOSinfo .. formatTooltip(ship["los"][2], U.format{MarriedMaxTemplate, value = getScaledStat(ship["los"][1], ship["los"][2], DataCaps.ship_level)}) .. "</td>"
   
   local row9 = "<tr>" .. Speedinfo .. LOSinfo .. "</tr>"
 
   local row9 = "<tr>" .. Speedinfo .. LOSinfo .. "</tr>"
 
   -- Range & Luck
 
   -- Range & Luck
Line 284: Line 297:  
   local constrheader = ""
 
   local constrheader = ""
 
   local constrdata = ""
 
   local constrdata = ""
   if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
+
   if notNil(ship["remodellv"]) then
 
     constrheader = "Remodel Level"
 
     constrheader = "Remodel Level"
 
     constrdata = ship["remodellv"]
 
     constrdata = ship["remodellv"]
Line 478: Line 491:  
   local reversionlvheader = ""
 
   local reversionlvheader = ""
 
   local reversionlvdata = ""
 
   local reversionlvdata = ""
   if ship["reversionlv"] ~= nil and ship["reversionlv"] ~= "" then
+
   if notNil(ship["reversionlv"]) then
 
     reversionlvheader = "Reversion Level"
 
     reversionlvheader = "Reversion Level"
 
     reversionlvdata = ship["reversionlv"]
 
     reversionlvdata = ship["reversionlv"]
advmod, cssedit, Interface administrators, janitor, Moderators, prechecked, Widget editors
7,932

edits

Navigation menu