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

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