class stub_LobbyMenu extends LobbyMenu;


// remove video box
function DrawPerk(Canvas Canvas)
{
  local float X, Y, Width, Height;
  local int CurIndex, LevelIndex;
  local float TempX, TempY;
  local float TempWidth, TempHeight;
  local float IconSize, ProgressBarWidth, PerkProgress;
  local string PerkName, PerkLevelString;

  DrawPortrait();

  // remove video background box
  if (AdBackground != none)
  {
    AdBackground.WinWidth = 0;
    AdBackground.WinHeight = 0;
  }

  // and remove all video ad related code

  if ( KFPlayerController(PlayerOwner()) == none || KFPlayerController(PlayerOwner()).SelectedVeterancy == none ||
     KFSteamStatsAndAchievements(PlayerOwner().SteamStatsAndAchievements) == none )
  {
    return;
  }
  // WTF is this else? TWI??!
  else

  CurIndex = KFPlayerController(PlayerOwner()).SelectedVeterancy.default.PerkIndex;
  LevelIndex = KFSteamStatsAndAchievements(PlayerOwner().SteamStatsAndAchievements).PerkHighestLevelAvailable(CurIndex);
  PerkName =  KFPlayerController(PlayerOwner()).SelectedVeterancy.default.VeterancyName;
  PerkLevelString = LvAbbrString @ LevelIndex;
  PerkProgress = KFSteamStatsAndAchievements(PlayerOwner().SteamStatsAndAchievements).GetPerkProgress(CurIndex);

  // Get the position size etc in pixels
  X = i_BGPerk.ActualLeft() + 5;
  Y = i_BGPerk.ActualTop() + 30;

  Width = i_BGPerk.ActualWidth() - 10;
  Height = i_BGPerk.ActualHeight() - 37;

  // Offset for the Background
  TempX = X;
  TempY = Y + ItemSpacing / 2.0;

  // Initialize the Canvas
  Canvas.Style = 1;
  Canvas.Font = class'ROHUD'.Static.GetSmallMenuFont(Canvas);
  Canvas.SetDrawColor(255, 255, 255, 255);

  // Draw Item Background
  Canvas.SetPos(TempX, TempY);
  // Canvas.DrawTileStretched(ItemBackground, Width, Height);

  IconSize = Height - ItemSpacing;

  // Draw Item Background
  Canvas.DrawTileStretched(PerkBackground, IconSize, IconSize);
  Canvas.SetPos(TempX + IconSize - 1.0, Y + 7.0);
  Canvas.DrawTileStretched(InfoBackground, Width - IconSize, Height - ItemSpacing - 14);

  IconSize -= IconBorder * 2.0 * Height;

  // Draw Icon
  Canvas.SetPos(TempX + IconBorder * Height, TempY + IconBorder * Height);
  Canvas.DrawTile(class'KFGameType'.default.LoadedSkills[CurIndex].default.OnHUDIcon, IconSize, IconSize, 0, 0, 256, 256);

  TempX += IconSize + (IconToInfoSpacing * Width);
  TempY += TextTopOffset * Height + ItemBorder * Height;

  ProgressBarWidth = Width - (TempX - X) - (IconToInfoSpacing * Width);

  // Select Text Color
  Canvas.SetDrawColor(0, 0, 0, 255);

  // Draw the Perk's Level name
  Canvas.StrLen(PerkName, TempWidth, TempHeight);
  Canvas.SetPos(TempX, TempY);
  Canvas.DrawText(PerkName);

  // Draw the Perk's Level
  if ( PerkLevelString != "" )
  {
    Canvas.StrLen(PerkLevelString, TempWidth, TempHeight);
    Canvas.SetPos(TempX + ProgressBarWidth - TempWidth, TempY);
    Canvas.DrawText(PerkLevelString);
  }

  TempY += TempHeight + (0.04 * Height);

  // Draw Progress Bar
  Canvas.SetDrawColor(255, 255, 255, 255);
  Canvas.SetPos(TempX, TempY);
  Canvas.DrawTileStretched(ProgressBarBackground, ProgressBarWidth, ProgressBarHeight * Height);
  Canvas.SetPos(TempX + 3.0, TempY + 3.0);
  Canvas.DrawTileStretched(ProgressBarForeground, (ProgressBarWidth - 6.0) * PerkProgress, (ProgressBarHeight * Height) - 6.0);

  if ( PlayerOwner().SteamStatsAndAchievements.bUsedCheats )
  {
    if ( CurrentVeterancyLevel != 255 )
    {
      lb_PerkEffects.SetContent(PerksDisabledString);
      CurrentVeterancyLevel = 255;
    }
  }
  else if ( CurrentVeterancy != KFPlayerController(PlayerOwner()).SelectedVeterancy || CurrentVeterancyLevel != LevelIndex )
  {
    lb_PerkEffects.SetContent(KFPlayerController(PlayerOwner()).SelectedVeterancy.default.LevelEffects[LevelIndex]);
    CurrentVeterancy = KFPlayerController(PlayerOwner()).SelectedVeterancy;
    CurrentVeterancyLevel = LevelIndex;
  }
}