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

77 lines
1.9 KiB
Ucode
Raw Normal View History

2017-10-20 02:00:49 +00:00
class ExtHUD_PlayerStatus extends KFGFxHUD_PlayerStatus;
var ExtPlayerController ExPC;
var class<Ext_PerkBase> ExLastPerkClass;
var string CurPerkPath;
function InitializeHUD()
{
Super.InitializeHUD();
ExPC = ExtPlayerController(MyPC);
}
function UpdatePerk()
{
local int CurrentPerkLevel,CurrentPerkEXP;
local Ext_PerkBase CurrentPerk;
2020-11-28 19:53:57 +00:00
local GFxObject PerkIconObject;
2017-10-20 02:00:49 +00:00
2020-11-28 20:12:58 +00:00
if (ExPC == none || ExPC.ActivePerkManager==None || ExPC.ActivePerkManager.CurrentPerk==None)
2017-10-20 02:00:49 +00:00
return;
CurrentPerk = ExPC.ActivePerkManager.CurrentPerk;
CurrentPerkLevel = CurrentPerk.CurrentLevel;
CurrentPerkEXP = CurrentPerk.CurrentEXP;
2023-05-14 02:49:12 +00:00
2017-10-20 02:00:49 +00:00
// Update the perk class.
2020-11-28 20:12:58 +00:00
if ((ExLastPerkClass != CurrentPerk.Class) || (LastPerkLevel != CurrentPerkLevel))
2017-10-20 02:00:49 +00:00
{
CurPerkPath = CurrentPerk.GetPerkIconPath(CurrentPerkLevel);
2023-05-14 02:49:12 +00:00
2020-01-09 11:05:13 +00:00
PerkIconObject = CreateObject("Object");
PerkIconObject.SetString("perkIcon", CurPerkPath);
SetObject("playerPerkIcon", PerkIconObject);
2023-05-14 02:49:12 +00:00
2020-11-28 20:04:55 +00:00
SetInt("playerPerkXPPercent", CurrentPerk.GetProgressPercent() * 100.f);
2020-11-28 20:12:58 +00:00
if (LastPerkLevel != CurrentPerkLevel && ExLastPerkClass==CurrentPerk.Class)
2017-10-20 02:00:49 +00:00
{
SetBool("bLevelUp", true);
ShowXPBark(CurrentPerkEXP-LastEXPValue,CurPerkPath,true);
}
ExLastPerkClass = CurrentPerk.class;
SetInt("playerPerkLevel" , CurrentPerkLevel);
LastPerkLevel = CurrentPerkLevel;
LastEXPValue = CurrentPerkEXP;
}
2020-11-28 20:12:58 +00:00
else if (LastEXPValue!=CurrentPerkEXP)
2017-10-20 02:00:49 +00:00
{
SetBool("bLevelUp", false);
2020-11-28 20:04:55 +00:00
SetInt("playerPerkXPPercent", CurrentPerk.GetProgressPercent() * 100.f);
2017-10-20 02:00:49 +00:00
ShowXPBark(CurrentPerkEXP-LastEXPValue,CurPerkPath,true);
LastEXPValue = CurrentPerkEXP;
}
}
2020-11-28 21:54:57 +00:00
2020-11-28 20:04:55 +00:00
function ShowXPBark(int DeltaXP, string IconPath, bool bIsCurrentPerk)
2017-10-20 02:00:49 +00:00
{
ActionScriptVoid("showXPBark");
}
function UpdateHealth()
{
2020-11-28 20:12:58 +00:00
if (MyPC.Pawn == none)
2017-10-20 02:00:49 +00:00
{
LastHealth = 0;
SetInt("playerHealth" , LastHealth);
}
2020-11-28 20:12:58 +00:00
else if (LastHealth != MyPC.Pawn.Health)
2017-10-20 02:00:49 +00:00
{
LastHealth = MyPC.Pawn.Health;
SetInt("playerHealth" , LastHealth);
}
}
defaultproperties
{
}