class u_PerkList extends Object;

// perk level related
struct PerkInfoStruct
{
  var class <KFVeterancyTypes> Perk;
  var array<byte> Index;
  var array<int> Value;
  var bool bSingleIndex;
};
var array<PerkInfoStruct> PerkInfo;


final static function PerkSwitch(KFPlayerController kfpc, int i, optional string level)
{
  local int j;

  // failsafe
  if (kfpc == none)
    return;

  // failsafe for perk index
  // tho we make sure we pass right values to here
  i = clamp(i,0,7);
  
  // what level we want
  // if we don't specify it force to 6
  if(level ~= "")
    j = 6;
  else
    j = clamp(int(level),0,6);

  // fix log spam in console
  // "you will become bla bla" x100
  kfpc.SelectedVeterancy = default.PerkInfo[i].Perk;
  kfpc.SaveConfig();
  // finally set the veterancy
  kfpc.selectVeterancy(default.PerkInfo[i].Perk, true);
  kfpc.SetSelectedVeterancy(default.PerkInfo[i].Perk);
  // set levels
  kfpc.serverInitializeSteamStatInt(default.PerkInfo[i].Index[0],default.PerkInfo[i].Value[j]);
  // if we have 2'nd index - use it!
  if(!default.PerkInfo[i].bSingleIndex)
    kfpc.serverInitializeSteamStatInt(default.PerkInfo[i].Index[1],default.PerkInfo[i].Value[j+7]);
  kfpc.serverSteamStatsAndAchievementsInitialized();
}


defaultproperties
{
  PerkInfo[0]=(Perk=class'KFMod.KFVetSharpshooter',Index=(3),Value=(0,30,100,700,2500,5500,8500),bSingleIndex=true)
  PerkInfo[1]=(Perk=class'KFMod.KFVetFieldMedic',Index=(0),Value=(0,200,750,4000,12000,25000,100000),bSingleIndex=true)
  PerkInfo[2]=(Perk=class'KFMod.KFVetBerserker',Index=(6),Value=(0,25000,100000,500000,1500000,3500000,5500000),bSingleIndex=true)
  PerkInfo[3]=(Perk=class'KFMod.KFVetCommando',Index=(5,4),Value=(0,25000,100000,500000,1500000,3500000,5500000,0,30,100,350,1200,2400,3600),bSingleIndex=false)
  PerkInfo[4]=(Perk=class'KFMod.KFVetDemolitions',Index=(21),Value=(0,25000,100000,500000,1500000,3500000,5500000),bSingleIndex=true)
  PerkInfo[5]=(Perk=class'KFMod.KFVetFirebug',Index=(7),Value=(0,25000,100000,500000,1500000,3500000,5500000),bSingleIndex=true)
  PerkInfo[6]=(Perk=class'KFMod.KFVetSupportSpec',Index=(2,1),Value=(0,25000,100000,500000,1500000,3500000,5500000,0,2000,7000,35000,120000,250000,370000),bSingleIndex=false)
  PerkInfo[7]=(Perk=class'KFMod.KFVeterancyTypes')
}