Changes

Remodel reversion data now displayed. "Reversible to (remodel)" cell width will be fixed tomorrow (intended 100% width).
Line 421: Line 421:  
   return categories
 
   return categories
 
end
 
end
 +
 +
local function renderReversion(ship) --Copy paste mess by Chocolatecravinghobo. Shows information/cost for models that remodel/revert to a previous remodel
 +
  local reversionHeader = ""
 +
  local reversionStyle = ""
 +
  local reversionHeader =
 +
      '<th style="width: 75%; white-space: nowrap; {{border-radius|12px 12px 12px 12px}} background-color: #3baef5; color: #ffffff; vertical-align: baseline;"> Reversible to ' .. ship.reversionto .. "</th>"
 +
  local reversionStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
 +
  local RscHeader =
 +
    '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">'
 +
  local RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">'
 +
  -- Construction info
 +
  local reversionlvheader = ""
 +
  local reversionlvdata = ""
 +
  if ship["reversionlv"] ~= nil and ship["reversionlv"] ~= "" then
 +
    reversionlvheader = "Reversion Level"
 +
    reversionlvdata = ship["reversionlv"]
 +
  end
 +
  local reversioninfo = ""
 +
  if ship.reversionreq and ship.reversionreq ~= "" then
 +
    reversioninfo =
 +
      string.format(
 +
      "[[File:IcoSteel.png|18px|Steel]] %d [[File:IcoAmmo.png|18px|Ammo]] %d",
 +
      ship.reversionreq[1],
 +
      ship.reversionreq[2]
 +
    )
 +
    if ship.reversionbp then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format("[[File:Item Icon Remodel Blueprint.png|25px|Blueprint|link=Blueprints]] %d", ship.reversionbp)
 +
    end
 +
    if ship.reversioncatapult then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon Prototype Flight Deck Catapult.png|25px|Prototype Flight Deck Catapult|link=Prototype Flight Deck Catapult]] %d",
 +
            ship.reversioncatapult
 +
          )
 +
    end
 +
    if ship.reversionar then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format("[[File:Item Icon Action Report.png|25px|Action Report|link=Action Report]] %d", ship.reversionar)
 +
    end
 +
    if ship.reversiondevmat or ship.reversionconmat or ship.reversiongunmat or ship.reversionairmat then
 +
      reversioninfo = reversioninfo .. "<br>"
 +
    end
 +
    if ship.reversiondevmat then
 +
      reversioninfo =
 +
        reversioninfo .. " " .. string.format("[[File:IcoDevmat.png|18px|Development Material]] %d", ship.reversiondevmat)
 +
    end
 +
    if ship.reversionconmat then
 +
      reversioninfo =
 +
        reversioninfo .. " " .. string.format("[[File:IcoConmat.png|18px|Construction Material]] %d", ship.reversionconmat)
 +
    end
 +
    if ship.reversiongunmat then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Gun Mount Improvement Material.png|18px|New Model Gun Mount Improvement Material|link=New Model Gun Development Material]] %d",
 +
            ship.reversiongunmat
 +
          )
 +
    end
 +
    if ship.reversionairmat then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Aerial Armament Material.png|18px|New Model Aerial Armament Material|link=New Model Aviation Development Material]] %d",
 +
            ship.reversionairmat
 +
          )
 +
    end
 +
    if ship.reversionarmmat then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Armament Material.png|18px|New Model Armament Material|link=New Model Armament Material]] %d",
 +
            ship.reversionarmmat
 +
          )
 +
    end
 +
    if ship.reversionboiler then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model High Temperature High Pressure Boiler.png|18px|New Model High Temperature High Pressure Boiler|link=New Model High Temperature High Pressure Boiler]] %d",
 +
            ship.reversionboiler
 +
          )
 +
    end
 +
  end
 +
  -- Reversion
 +
  local row14 = ""
 +
  local row15 = ""
 +
  if ship.reversionlv ~= "" then
 +
    row14 = "<tr>" .. reversionHeader .. "</tr>"-- .. reversionStyle
 +
    row15 =
 +
    "<tr>" ..
 +
      RscHeader ..
 +
        reversionlvheader ..
 +
          "</th>" ..
 +
            RscData ..
 +
              reversionlvdata .. "</td>" .. RscHeader .. "Reversion Req</th>" .. RscData .. reversioninfo .. "</td></tr>"
 +
  end
 +
  return row14 .. row15
 +
end
 +
    
-- Converting to legacy data format
 
-- Converting to legacy data format
Line 499: Line 609:  
   data.remodelconmat = trueIsOne(ship._remodel_construction_material)
 
   data.remodelconmat = trueIsOne(ship._remodel_construction_material)
 
   data.remodelboiler = trueIsOne(ship._remodel_boiler)
 
   data.remodelboiler = trueIsOne(ship._remodel_boiler)
 +
 
 +
  data.reversible = trueIsOne(ship._reversible)
 +
  data.reversionto = ship:remodel_to() or ""
 +
  data.reversionto = data.reversionto:gsub("/", " ")
 +
  data.reversionlv = ship:remodel_to_level() or ""
 +
  data.reversionreq = not ship._remodel_to_steel and not ship._remodel_to_ammo and '' or {ship._remodel_to_steel or 0, ship._remodel_to_ammo or 0}
 +
  data.reversionbp = trueIsOne(ship._remodel_to_blueprint)
 +
  data.reversioncatapult = trueIsOne(ship._remodel_to_catapult)
 +
  data.reversiondevmat = trueIsOne(ship._remodel_to_development_material)
 +
  data.reversionconmat = trueIsOne(ship._remodel_to_construction_material)
 
   return data
 
   return data
 
end
 
end
Line 510: Line 630:  
           '<table style="width:100%">' ..
 
           '<table style="width:100%">' ..
 
             renderModernization(ship) ..
 
             renderModernization(ship) ..
               renderArtists(ship) .. "</table></td></tr></table></div>" .. renderCategories(ship)
+
               renderArtists(ship) ..
 +
            renderReversion(ship) .. "</table></td></tr></table></div>" .. renderCategories(ship)
 
end
 
end
  
advmod, cssedit, Interface administrators, janitor, Moderators, prechecked, Widget editors
7,369

edits