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

51 lines
1.4 KiB
Ucode
Raw Normal View History

2017-10-19 21:00:49 -05:00
class ExtPerksContainer_Selection extends KFGFxPerksContainer_Selection;
var localized string PerkChangeWarning;
2017-10-19 21:00:49 -05:00
function UpdatePerkSelection(byte SelectedPerkIndex)
{
2023-05-14 06:01:17 +03:00
local int i;
2017-10-19 21:00:49 -05:00
local GFxObject DataProvider;
local GFxObject TempObj;
local ExtPlayerController KFPC;
2023-05-14 05:49:12 +03:00
local Ext_PerkBase PerkClass;
2017-10-19 21:00:49 -05:00
2020-11-28 23:04:55 +03:00
KFPC = ExtPlayerController(GetPC());
2017-10-19 21:00:49 -05:00
2020-11-28 23:04:55 +03:00
if (KFPC!=none && KFPC.ActivePerkManager!=None)
2017-10-19 21:00:49 -05:00
{
2023-05-14 06:01:17 +03:00
DataProvider = CreateArray();
2017-10-19 21:00:49 -05:00
for (i = 0; i < KFPC.ActivePerkManager.UserPerks.Length; i++)
{
PerkClass = KFPC.ActivePerkManager.UserPerks[i];
2020-11-28 23:04:55 +03:00
TempObj = CreateObject("Object");
TempObj.SetInt("PerkLevel", PerkClass.CurrentLevel);
2023-05-14 05:49:12 +03:00
TempObj.SetString("Title", PerkClass.PerkName);
2020-11-28 23:04:55 +03:00
TempObj.SetString("iconSource", PerkClass.GetPerkIconPath(PerkClass.CurrentLevel));
2017-10-19 21:00:49 -05:00
TempObj.SetBool("bTierUnlocked", true);
2023-05-14 05:49:12 +03:00
2020-11-28 23:04:55 +03:00
DataProvider.SetElementObject(i, TempObj);
2023-05-14 05:49:12 +03:00
}
2020-11-28 23:04:55 +03:00
SetObject("perkData", DataProvider);
2017-10-19 21:00:49 -05:00
SetInt("SelectedIndex", SelectedPerkIndex);
UpdatePendingPerkInfo(SelectedPerkIndex);
2020-11-28 22:53:57 +03:00
}
2017-10-19 21:00:49 -05:00
}
function UpdatePendingPerkInfo(byte SelectedPerkIndex)
{
local ExtPlayerController KFPC;
local Ext_PerkBase PerkClass;
2020-11-28 23:04:55 +03:00
KFPC = ExtPlayerController(GetPC());
2020-11-28 23:12:58 +03:00
if (KFPC != none)
2017-10-19 21:00:49 -05:00
{
PerkClass = KFPC.ActivePerkManager.UserPerks[SelectedPerkIndex];
SetPendingPerkChanges(PerkClass.PerkName, PerkClass.GetPerkIconPath(PerkClass.CurrentLevel), PerkChangeWarning);
2017-10-19 21:00:49 -05:00
}
}
function SavePerk(int PerkID);