ScriptName footprintsRefCountScript Extends Quest

GlobalVariable Property fp_FootprintsRefCount Auto
GlobalVariable Property fp_FootprintsNPCLimit Auto

GlobalVariable Property fp_FootprintsFXCount Auto
GlobalVariable Property fp_FootprintsFXLimit Auto

int refCount = 0
int fxCount = 0


Event OnInit()
	RegisterForSingleUpdate( 1.0 )
EndEvent

Event OnUpdate()
	;Debug.Trace( "footprintsRefCountScript - Updating..." )
	fp_FootprintsRefCount.SetValue( refCount )
	fp_FootprintsFXCount.SetValue( fxCount )

	RegisterForSingleUpdate( 1.0 )
EndEvent

; Ref Counting

bool Function RefCountLimitReached()
	return !(refCount < fp_FootprintsNPCLimit.GetValue())
EndFunction

int Function GetRefCount()
	return refCount
EndFunction

bool Function IncrementRefCount()
	;Debug.Trace( "footprintsRefCountScript - Incrementing..." )
	If ( refCount < fp_FootprintsNPCLimit.GetValue() )
		refCount += 1
		return True
	EndIf

	return False
EndFunction

Function DecrementRefCount()
	;Debug.Trace( "footprintsRefCountScript - Decrementing..." )
	If ( refCount > 0 )
		refCount -= 1
	Else
		Debug.Trace( "footprintsRefCountScript - ERROR: Negative Ref Count Attempted", 2 )
	EndIf
EndFunction

; FX Counting

bool Function FXCountLimitReached()
	return !(fxCount < fp_FootprintsFXLimit.GetValue())
EndFunction

int Function GetFXCount()
	return fxCount
EndFunction

bool Function IncrementFXCount()
	;Debug.Trace( "footprintsRefCountScript - Incrementing..." )
	If ( fxCount < fp_FootprintsFXLimit.GetValue() )
		fxCount += 1
		return True
	EndIf

	return False
EndFunction

Function DecrementFXCount()
	;Debug.Trace( "footprintsRefCountScript - Decrementing..." )
	If ( fxCount > 0 )
		fxCount -= 1
	Else
		Debug.Trace( "footprintsRefCountScript - ERROR: Negative FX Count Attempted", 2 )
	EndIf
EndFunction
