Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Bots

Development::Bots Forum for bots.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 07-24-2009, 12:12 PM
RichardoX
Hill Giant
 
Join Date: Dec 2004
Location: in your closet....
Posts: 169
Default

Well, I am trying to construct this into a perl command. I found the 'join group' code for the bot.

Code:
bool Bot::AddBotToGroup(Bot* bot, Group* group) {
	bool Result = false;

	int i = 0;

	if(bot && group) {
		//Let's see if the bot is already in the group
		for(i = 0; i < MAX_GROUP_MEMBERS; i++) {
			if(group->members[i] && !strcasecmp(group->members[i]->GetCleanName(), bot->GetCleanName()))
				return false;
		}

		// Put the bot in the group
		for(i = 0; i < MAX_GROUP_MEMBERS; i++) {
			if(group->members[i] == NULL) {
				group->members[i] = bot;
				break;
			}
		}
		
		// We copy the bot name in the group at the slot of the bot
		strcpy(group->membername[i], bot->GetCleanName());
		bot->SetGrouped(true);

		//build the template join packet
		EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
		GroupJoin_Struct* gj = (GroupJoin_Struct*) outapp->pBuffer;	
		strcpy(gj->membername, bot->GetCleanName());
		gj->action = groupActJoin;
	
		int z = 1;
		for(i=0; i < MAX_GROUP_MEMBERS; i++) {
			if(group->members[i] && group->members[i]->IsClient()) {
				if(group->IsLeader(group->members[i])) {
					strcpy(gj->yourname, group->members[i]->GetName());
					strcpy(group->members[i]->CastToClient()->GetPP().groupMembers[0], group->members[i]->GetName());
					group->members[i]->CastToClient()->QueuePacket(outapp);
				}
				else {
					strcpy(group->members[i]->CastToClient()->GetPP().groupMembers[0+z], group->members[i]->GetName());
					group->members[i]->CastToClient()->QueuePacket(outapp);
				}
			}
			z++;
		}

		safe_delete(outapp);

		// Need to send this only once when a group is formed with a bot so the client knows it is also the group leader
		if(group->GroupCount() == 2) {
			Mob *TempLeader = group->GetLeader();
			group->SendUpdate(groupActUpdate, TempLeader);
		}

		Result = true;
	}

	return Result;
}

Before I do this however, I need to find a way to remove ownership checks. It will error out if I try to just put the bot in anyone's group. Im trying to find it but I'm not having the best of luck.
__________________
a hill giant slashes YOU for 25 points of damage!
You have been slain!
LOADING, PLEASE WAIT...
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 06:13 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3