struct GameTimeUtils
{

	public static function CanPlayerTimeSkip( playerPuppet : PlayerPuppet ) : Bool
	{
		var psmBlackboard : IBlackboard;
		var timeSystem : TimeSystem;
		var blockTimeSkip : Bool;
		var tier : Int32;
		var variantData : Variant;
		var securityData : SecurityAreaData;
		var psmVehicle : Int32;
		blockTimeSkip = false;
		tier = playerPuppet.GetPlayerStateMachineBlackboard().GetInt( GetAllBlackboardDefs().PlayerStateMachine.HighLevel );
		psmBlackboard = playerPuppet.GetPlayerStateMachineBlackboard();
		variantData = psmBlackboard.GetVariant( GetAllBlackboardDefs().PlayerStateMachine.SecurityZoneData );
		if( variantData.IsValid() )
		{
			securityData = ( ( SecurityAreaData )variantData );
		}
		psmVehicle = psmBlackboard.GetInt( GetAllBlackboardDefs().PlayerStateMachine.Vehicle );
		blockTimeSkip = ( ( ( ( ( ( ( ( ( ( ( ( ( psmBlackboard.GetInt( GetAllBlackboardDefs().PlayerStateMachine.Combat ) == ( ( Int32 )( gamePSMCombat.InCombat ) ) ) || StatusEffectSystem.ObjectHasStatusEffectWithTag( playerPuppet, 'NoTimeSkip' ) ) || timeSystem.IsPausedState() ) || playerPuppet.IsMovingVertically() ) || ( psmBlackboard.GetInt( GetAllBlackboardDefs().PlayerStateMachine.Swimming ) == ( ( Int32 )( gamePSMSwimming.Diving ) ) ) ) || ( psmVehicle == ( ( Int32 )( gamePSMVehicle.Transition ) ) ) ) || ( ( psmVehicle == ( ( Int32 )( gamePSMVehicle.Driving ) ) ) && ( VehicleComponent.GetOwnerVehicleSpeed( playerPuppet.GetGame(), playerPuppet ) > 13.80000019 ) ) ) || ( ( tier >= ( ( Int32 )( gamePSMHighLevel.SceneTier3 ) ) ) && ( tier <= ( ( Int32 )( gamePSMHighLevel.SceneTier5 ) ) ) ) ) || ( securityData.securityAreaType > ESecurityAreaType.SAFE ) ) || GameInstance.GetPhoneManager( playerPuppet.GetGame() ).IsPhoneCallActive() ) || psmBlackboard.GetBool( GetAllBlackboardDefs().PlayerStateMachine.Carrying ) ) || psmBlackboard.GetBool( GetAllBlackboardDefs().PlayerStateMachine.IsInLoreAnimationScene ) ) || playerPuppet.GetPreventionSystem().IsChasingPlayer() ) || HubMenuUtility.IsPlayerHardwareDisabled( playerPuppet );
		return !( blockTimeSkip );
	}

	public static function IsTimeDisplayGlitched( playerPuppet : PlayerPuppet ) : Bool
	{
		var blockTimeSkip : Bool;
		blockTimeSkip = false;
		blockTimeSkip = StatusEffectSystem.ObjectHasStatusEffectWithTag( playerPuppet, 'NoTimeDisplay' );
		return blockTimeSkip;
	}

	public static function UpdateGameTimeText( timeSystem : TimeSystem, textWidgetRef : inkTextRef, textParamsRef : inkTextParams, optional addSeconds : Int32 )
	{
		var gameTime : GameTime;
		if( timeSystem == NULL )
		{
			return;
		}
		gameTime = timeSystem.GetGameTime();
		gameTime += addSeconds;
		SetGameTimeText( textWidgetRef, textParamsRef, gameTime );
	}

	public static function SetGameTimeText( textWidgetRef : inkTextRef, textParamsRef : inkTextParams, gameTime : GameTime )
	{
		if( textParamsRef == NULL )
		{
			textParamsRef = new inkTextParams;
			textParamsRef.AddNCGameTime( "VALUE", gameTime );
			inkTextRef.SetText( textWidgetRef, "{VALUE,time,short}", textParamsRef );
		}
		else
		{
			textParamsRef.UpdateTime( "VALUE", gameTime );
		}
	}

	public static function FastForwardPlayerState( player : GameObject )
	{
		var maxPassiveRegenValue : Float;
		var statPoolsSys : StatPoolsSystem;
		var statusEffectSys : StatusEffectSystem;
		var effects : array< StatusEffect >;
		var i : Int32;
		var remainingTime : Float;
		if( player )
		{
			statPoolsSys = GameInstance.GetStatPoolsSystem( player.GetGame() );
			if( statPoolsSys )
			{
				maxPassiveRegenValue = GameInstance.GetStatsSystem( player.GetGame() ).GetStatValue( player.GetEntityID(), gamedataStatType.HealthOutOfCombatRegenEndThreshold );
				if( statPoolsSys.GetStatPoolValue( player.GetEntityID(), gamedataStatPoolType.Health ) < maxPassiveRegenValue )
				{
					statPoolsSys.RequestSettingStatPoolValue( player.GetEntityID(), gamedataStatPoolType.Health, maxPassiveRegenValue, player );
				}
				statPoolsSys.RequestSettingStatPoolValue( player.GetEntityID(), gamedataStatPoolType.Stamina, 100.0, player );
			}
			statusEffectSys = GameInstance.GetStatusEffectSystem( player.GetGame() );
			statusEffectSys.GetAppliedEffects( player.GetEntityID(), effects );
			for( i = 0; i < effects.Size(); i += 1 )
			{
				remainingTime = effects[ i ].GetRemainingDuration();
				if( remainingTime > 0.0 )
				{
					statusEffectSys.RemoveStatusEffect( player.GetEntityID(), effects[ i ].GetRecord().GetID(), effects[ i ].GetStackCount() );
				}
			}
		}
	}

}

