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

77 lines
1.9 KiB
Ucode
Raw Normal View History

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