/*
==================
BotMatchMessage
==================
*/
int BotMatchMessage(bot_state_t *bs, char *message) {
	bot_match_t match;

	match.type = 0;
	//if it is an unknown message
	if (!trap_BotFindMatch(message, &match, MTCONTEXT_MISC|MTCONTEXT_INITIALTEAMCHAT )) {
		if(bot_developer.integer & AIDBG_CHAT ){
			G_Printf("^2no match for ^1%s\n", message);
		}
		return qfalse;
	}

	if(bot_developer.integer & AIDBG_CHAT){
		G_Printf("^6match %d for^1 %s\n", match.type, message);
	}

	//react to the found message
	switch(match.type)
	{
		case MSG_WRONGWALL:{
			BotMatch_WrongWall(bs, &match);
			break;
		}
		//case MSG_GOFORBALLOON:{				//someone calling for company
		//	BotMatch_GoForBalloon(bs, &match);
		//	break;
		//}
		case MSG_DROPCART:{
			BotMatch_DropCart(bs, &match);
			break;
		}
		case MSG_GETITEM:{
			BotMatch_GetItem(bs, &match);
			break;
		}
		case MSG_ENTERGAME:{			//someone entered the game
			BotMatch_EnterGame(bs, &match);
			break;
		}
		case MSG_CATCHME:{
			BotMatch_CatchMe(bs, &match);
			break;
		}
		default:{
			if(bot_developer.integer)
				BotAI_Print(PRT_MESSAGE, "unknown match type %d\n",match.type);
			break;
		}
	}
	return qtrue;
}
Example #2
0
/*
=======================================================================================================================================
BotMatchMessage
=======================================================================================================================================
*/
int BotMatchMessage(bot_state_t *bs, char *message) {
	bot_match_t match;

	match.type = 0;
	// if it is an unknown message
	if (!trap_BotFindMatch(message, &match, MTCONTEXT_ENTERGAME
							|MTCONTEXT_INITIALTEAMCHAT
							|MTCONTEXT_CTF)) {
		return qfalse;
	}
	// react to the found message
	switch (match.type) {
	case MSG_HELP:                     // someone calling for help
	case MSG_ACCOMPANY:                // someone calling for company
	{
		BotMatch_HelpAccompany(bs, &match);
		break;
	}

	case MSG_DEFENDKEYAREA:            // teamplay defend a key area
	{
		BotMatch_DefendKeyArea(bs, &match);
		break;
	}

	case MSG_CAMP:                     // camp somewhere
	{
		BotMatch_Camp(bs, &match);
		break;
	}

	case MSG_PATROL:                   // patrol between several key areas
	{
		BotMatch_Patrol(bs, &match);
		break;
	}
#ifdef CTF
	case MSG_GETFLAG:                  // ctf get the enemy flag
	{
		BotMatch_GetFlag(bs, &match);
		break;
	}

	case MSG_RUSHBASE:                 // ctf rush to the base
	{
		BotMatch_RushBase(bs, &match);
		break;
	}

	case MSG_RETURNFLAG:
	{
		BotMatch_ReturnFlag(bs, &match);
		break;
	}
#endif // CTF
	case MSG_GETITEM:
	{
		BotMatch_GetItem(bs, &match);
		break;
	}

	case MSG_JOINSUBTEAM:              // join a sub team
	{
		BotMatch_JoinSubteam(bs, &match);
		break;
	}

	case MSG_LEAVESUBTEAM:             // leave a sub team
	{
		BotMatch_LeaveSubteam(bs, &match);
		break;
	}

	case MSG_WHICHTEAM:
	{
		BotMatch_WhichTeam(bs, &match);
		break;
	}

	case MSG_CHECKPOINT:               // remember a check point
	{
		BotMatch_CheckPoint(bs, &match);
		break;
	}

	case MSG_CREATENEWFORMATION:       // start the creation of a new formation
	{
		trap_EA_SayTeam(bs->client, "the part of my brain to create formations has been damaged");
		break;
	}

	case MSG_FORMATIONPOSITION:        // tell someone his / her position in the formation
	{
		trap_EA_SayTeam(bs->client, "the part of my brain to create formations has been damaged");
		break;
	}

	case MSG_FORMATIONSPACE:           // set the formation space
	{
		BotMatch_FormationSpace(bs, &match);
		break;
	}

	case MSG_DOFORMATION:              // form a certain formation
	{
		break;
	}

	case MSG_DISMISS:                  // dismiss someone
	{
		BotMatch_Dismiss(bs, &match);
		break;
	}

	case MSG_STARTTEAMLEADERSHIP:      // someone will become the team leader
	{
		BotMatch_StartTeamLeaderShip(bs, &match);
		break;
	}

	case MSG_STOPTEAMLEADERSHIP:       // someone will stop being the team leader
	{
		BotMatch_StopTeamLeaderShip(bs, &match);
		break;
	}

	case MSG_WHOISTEAMLAEDER:
	{
		BotMatch_WhoIsTeamLeader(bs, &match);
		break;
	}

	case MSG_WHATAREYOUDOING:          // ask a bot what he / she is doing
	{
		BotMatch_WhatAreYouDoing(bs, &match);
		break;
	}

	case MSG_WHATISMYCOMMAND:
	{
		BotMatch_WhatIsMyCommand(bs, &match);
		break;
	}

	case MSG_WHEREAREYOU:
	{
		BotMatch_WhereAreYou(bs, &match);
		break;
	}

	case MSG_LEADTHEWAY:
	{
		BotMatch_LeadTheWay(bs, &match);
		break;
	}

	case MSG_KILL:
	{
		BotMatch_Kill(bs, &match);
		break;
	}

	case MSG_ENTERGAME:                // someone entered the game
	{
		// NOTE: eliza chats will catch this
		// BotMatchVariable(&match, NETNAME, netname);
		// Com_sprintf(buf, sizeof(buf), "heya %s", netname);
		// EA_Say(bs->client, buf);
		break;
	}

	case MSG_CTF:
	{
		BotMatch_CTF(bs, &match);
		break;
	}

	case MSG_WAIT:
	{
		break;
	}

	default:
	{
		BotAI_Print(PRT_MESSAGE, "unknown match type\n");
		break;
	}
	}

	return qtrue;
}