KF2-Server-Extension/ServerExt/Classes/ExtPerksContainer_Selection.uc

49 lines
1.4 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
class ExtPerksContainer_Selection extends KFGFxPerksContainer_Selection;
function UpdatePerkSelection(byte SelectedPerkIndex)
{
local int i;
local GFxObject DataProvider;
local GFxObject TempObj;
local ExtPlayerController KFPC;
local Ext_PerkBase PerkClass;
2020-11-28 20:04:55 +00:00
KFPC = ExtPlayerController(GetPC());
2017-10-20 02:00:49 +00:00
2020-11-28 20:04:55 +00:00
if (KFPC!=none && KFPC.ActivePerkManager!=None)
2017-10-20 02:00:49 +00:00
{
DataProvider = CreateArray();
for (i = 0; i < KFPC.ActivePerkManager.UserPerks.Length; i++)
{
PerkClass = KFPC.ActivePerkManager.UserPerks[i];
2020-11-28 20:04:55 +00:00
TempObj = CreateObject("Object");
TempObj.SetInt("PerkLevel", PerkClass.CurrentLevel);
TempObj.SetString("Title", PerkClass.PerkName);
TempObj.SetString("iconSource", PerkClass.GetPerkIconPath(PerkClass.CurrentLevel));
2017-10-20 02:00:49 +00:00
TempObj.SetBool("bTierUnlocked", true);
2020-11-28 20:04:55 +00:00
DataProvider.SetElementObject(i, TempObj);
2017-10-20 02:00:49 +00:00
}
2020-11-28 20:04:55 +00:00
SetObject("perkData", DataProvider);
2017-10-20 02:00:49 +00:00
SetInt("SelectedIndex", SelectedPerkIndex);
UpdatePendingPerkInfo(SelectedPerkIndex);
2020-11-28 19:53:57 +00:00
}
2017-10-20 02:00:49 +00:00
}
function UpdatePendingPerkInfo(byte SelectedPerkIndex)
{
local ExtPlayerController KFPC;
local Ext_PerkBase PerkClass;
2020-11-28 20:04:55 +00:00
KFPC = ExtPlayerController(GetPC());
2020-11-28 20:12:58 +00:00
if (KFPC != none)
2017-10-20 02:00:49 +00:00
{
PerkClass = KFPC.ActivePerkManager.UserPerks[SelectedPerkIndex];
SetPendingPerkChanges(PerkClass.PerkName, PerkClass.GetPerkIconPath(PerkClass.CurrentLevel), "Perk changes will be applied when you die.");
}
}
function SavePerk(int PerkID);