// This script is for testing events

this.Name = "TestEvents";
this.Parent = "LowLevel";

this.AutoAdd = false;
this.AlwaysRecieveEvents = this.AutoAdd;	// Recieve events even when not active. Normally events are only called when goal is active.

this.Initialize = function()
{
	this.RunTests = true;

	if ( this.RunTests == true )
	{
		//set to false if you want to select individual events below
		this.TestAll = false;

		//set to true to test individually
		this.TestWeaponFire = false;
		this.TestFeelPain = false;
		this.TestHealed = false;
		this.TestAmmo = false;
		this.TestRevived = false;
		this.TestDeath = false;
		this.TestKilled = false;
		this.TestSpectated = false;
		this.TestResetWeapons = false;
		this.TestGlobalChatMessage = false;
		this.TestTeamChatMessage = false;
		this.TestPrivateChatMessage = false;
		this.TestTeamVoice = false;
		this.TestPrivateVoice = false;
		this.TestSpawnEvent = false;
		this.TestChangeTeam = false;
		this.TestScriptMsg = false;
		this.TestDisconnected = false;
		this.TestChangeClass = false;
		this.TestWeaponChange = false;
	}
	else
	{
		this.Disable = true;
		return;
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.SPECTATED] = function(who)
{
	if ( this.TestAll == true || this.TestSpectated == true )
	{
		print( this.Bot.Name, " is being spectated by ", GetEntityName(who));
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.REVIVED] = function(whoDoneIt)
{
	if ( this.TestAll == true || this.TestRevived == true )
	{
		print( GetEntityName(whoDoneIt), " REVIVED ", this.Bot.Name );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.RESETWEAPONS] = function(weap)
{
	if ( this.TestAll == true || this.TestResetWeapons == true )
	{
		print( this.Bot.Name, " reset weapons ", weap );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.SPAWNED] = function()
{
	if ( this.TestAll == true || this.TestSpawnEvent == true )
	{
		print( this.Bot.Name, " spawned " );
	}
};

///////////////////////////////////////////////////////////////////////////////////

// untested
this.Events[EVENT.TEAM_VOICE] = function(whosaidit, id)
{
	if ( this.TestAll == true || this.TestTeamVoice == true )
	{
		print( this.Bot.Name, " heard ", GetEntityName(whosaidit), " use team voice macro ", id );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.PRIVATE_VOICE] = function(whosaidit, id)
{
	if ( this.TestAll == true || this.TestPrivateVoice == true )
	{
		print( this.Bot.Name, " heard private voice", Util.GetTableKey(VOICE,id),  "from ", GetEntName(whosaidit) );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.GLOBAL_CHAT_MSG] = function(whosaidit, whattheysaid)
{
	if ( this.TestAll == true || this.TestGlobalChatMessage == true )
	{
		print( this.Bot.Name, " heard ", GetEntityName(whosaidit), " say ",
			whattheysaid, " in global chat" );
	}
};


///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.TEAM_CHAT_MSG] = function(whosaidit, whattheysaid)
{
	if ( this.TestAll == true || this.TestTeamChatMessage == true )
	{
		print( this.Bot.Name, " heard ", GetEntityName(whosaidit), " say ",
			whattheysaid, " in a team chat message" );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.PRIV_CHAT_MSG] = function(whosaidit, whattheysaid)
{
	if ( this.TestAll == true || this.TestPrivateChatMessage == true )
	{
		print( this.Bot.Name, " heard ", GetEntityName(whosaidit), " say ",
			whattheysaid, " in a private chat message" );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.KILLEDSOMEONE] = function(victim, mod)
{
	if ( this.TestAll == true || this.TestKilled == true )
	{
		print( this.Bot.Name, " killed ", GetEntityName(victim), " with ", mod );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.DEATH] = function(attacker, mod)
{
	if ( this.TestAll == true || this.TestDeath == true )
	{
		print( this.Bot.Name, " was killed by ", GetEntityName(attacker), " with ", mod );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.HEALED] = function(whoDoneIt)
{
	if ( this.TestAll == true || this.TestHealed == true )
	{
		print( GetEntityName(whoDoneIt), " HEALED ", this.Bot.Name );
	}
};

///////////////////////////////////////////////////////////////////////////////////
this.Events[EVENT.AMMO_RECIEVED] = function(whoDoneIt)
{
	if ( this.TestAll == true || this.TestAmmo== true )
	{
		print( GetEntityName(whoDoneIt), " gave ammo to ", this.Bot.Name );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.FEEL_PAIN] = function(Inflictor, PreviousHealth, CurrentHealth)
{
	if ( this.TestAll == true || this.TestFeelPain == true )
	{
		print(GetEntityName(Inflictor), " HURT ", this.Bot.Name, " with ", PreviousHealth - CurrentHealth, " damage" );
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.WEAPON_FIRE] = function(weaponId, projectileEntity)
{
	if ( this.TestAll == true || this.TestWeaponFire == true )
	{
		print(this.Bot.Name, " WEAPON FIRE ", Util.WeaponName(weaponId), projectileEntity);
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.CHANGETEAM] = function(team)
{
	if ( this.TestAll == true || this.TestChangeTeam == true )
	{
		print(this.Bot.Name, " changed team to", Util.TeamName(team));
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.SCRIPTMSG] = function(msg, data1, data2, data3)
{
	if ( this.TestAll || this.TestScriptMsg )
	{
		print(this.Bot.Name, " script messsage", msg, data1, data2, data3);
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.DISCONNECTED] = function()
{
	if ( this.TestAll || this.TestDisconnected )
	{
		print(this.Bot.Name, " EVENT.DISCONNECTED");
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.CHANGECLASS] = function(newclass)
{
	if ( this.TestAll || this.TestChangeClass )
	{
		print(this.Bot.Name, " changed class to", Util.ClassName(newclass));
	}
};

///////////////////////////////////////////////////////////////////////////////////

this.Events[EVENT.WEAPON_CHANGE] = function(weapon)
{
	if ( this.TestAll || this.TestWeaponChange )
	{
		print(this.Bot.Name, " changed weapon", Util.WeaponName(weapon));
	}
};

///////////////////////////////////////////////////////////////////////////////////
