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

Development::Bots Forum for bots.

Reply
 
Thread Tools Display Modes
  #1  
Old 02-19-2015, 11:36 AM
Nibiuno
Hill Giant
 
Join Date: Mar 2010
Posts: 101
Default

Last bot crash issue is if you disband a bot from the group using the above fixes, then do a #bot camp on it after it's out of your group, the zone crashes.
Reply With Quote
  #2  
Old 02-20-2015, 12:57 PM
Nibiuno
Hill Giant
 
Join Date: Mar 2010
Posts: 101
Default

Fixed the zone crash issue when if you disband a single bot, it crashes. For some reason the RemoveBotFromGroup is causing it (or this function getting the tempBot value, idk). Commenting it out still lets the bot disband, just prevents the crashing, so I have no idea what its supposed to be doing.
Quote:
// Processes a group disband request from a Client for a Bot.
void Bot::ProcessBotGroupDisband(Client* c, std::string botName) {
if(c) {
Bot* tempBot = 0;

if(botName.empty())
tempBot = GetFirstBotInGroup(c->GetGroup());
else
tempBot = GetBotByBotClientOwnerAndBotName(c, botName);
// MOD ZEPHYR - stop bot disband
//RemoveBotFromGroup(tempBot, c->GetGroup());
// END MOD
}
}
Reply With Quote
  #3  
Old 02-24-2015, 01:44 PM
rencro
Hill Giant
 
Join Date: Sep 2008
Location: So. California
Posts: 219
Default

I dont see the #bot camp issue you are seeing, but I did notice before you had taken out big chunks of code to isolate issues, so here is my Bot::Death function completely as it is on my build from bot.cpp

Code:
bool Bot::Death(Mob *killerMob, int32 damage, uint16 spell_id, SkillUseTypes attack_skill) {
	if(!NPC::Death(killerMob, damage, spell_id, attack_skill))
		return false;

	Save();

	Mob *give_exp = hate_list.GetDamageTopOnHateList(this);
	Client *give_exp_client = nullptr;

	if(give_exp && give_exp->IsClient())
		give_exp_client = give_exp->CastToClient();

	bool IsLdonTreasure = (this->GetClass() == LDON_TREASURE);

	if(entity_list.GetCorpseByID(GetID()))
		entity_list.GetCorpseByID(GetID())->Depop();

	Group *g = GetGroup();
	if(g) {
		for(int i=0; i<MAX_GROUP_MEMBERS; i++) {
			if(g->members[i]) {
				if(g->members[i] == this) {
					// If the leader dies, make the next bot the leader
					// and reset all bots followid
					if(g->IsLeader(g->members[i])) {
						if(g->members[i+1]) {
							g->SetLeader(g->members[i+1]);
							g->members[i+1]->SetFollowID(g->members[i]->GetFollowID());
							for(int j=0; j<MAX_GROUP_MEMBERS; j++) {
								if(g->members[j] && (g->members[j] != g->members[i+1])) {
									g->members[j]->SetFollowID(g->members[i+1]->GetID());
								}
							}
						}
					}

					// delete from group data
					RemoveBotFromGroup(this, g);

					// if group members exist below this one, move
					// them all up one slot in the group list
					if(g->GroupCount() == 6) {
						for(int x=0; x<MAX_GROUP_MEMBERS; x++) {
							g->membername[x][0] = '\0';
							memset(g->membername[x], 0, 64);
							g->members[x] = nullptr;
						}
					}
					int j = i+1;
					for(; j<MAX_GROUP_MEMBERS; j++) {
						if(g->members[j]) {
//							Log.Out(Logs::General, Logs::Status, "group count is: %d", g->GroupCount());
							g->members[j-1] = g->members[j];
							strcpy(g->membername[j-1], g->members[j]->GetCleanName());
							g->membername[j][0] = '\0';
							memset(g->membername[j], 0, 64);
							g->members[j] = nullptr;
						}
					}
					// update the client group
					EQApplicationPacket* outapp = new EQApplicationPacket(OP_GroupUpdate, sizeof(GroupJoin_Struct));
					GroupJoin_Struct* gu = (GroupJoin_Struct*)outapp->pBuffer;
					gu->action = groupActLeave;
					strcpy(gu->membername, GetCleanName());
					if(g) {
						for(int k=0; k<MAX_GROUP_MEMBERS; k++) {
							if(g->members[k] && g->members[k]->IsClient())
								g->members[k]->CastToClient()->QueuePacket(outapp);
						}
					}
					safe_delete(outapp);

					// now that's done, lets see if all we have left is the client
					// and we can clean up the clients raid group and group
					/*if(GetBotRaidID()) {
						BotRaids* br = entity_list.GetBotRaidByMob(this);
						if(br) {
							if(this == br->botmaintank) {
								br->botmaintank = nullptr;
							}
							if(this == br->botsecondtank) {
								br->botsecondtank = nullptr;
							}
						}
						if(g->GroupCount() == 0) {
							uint32 gid = g->GetID();
							if(br) {
								br->RemoveEmptyBotGroup();
							}
							entity_list.RemoveGroup(gid);
						}
						if(br && (br->RaidBotGroupsCount() == 1)) {
							br->RemoveClientGroup(br->GetRaidBotLeader());
						}
						if(br && (br->RaidBotGroupsCount() == 0)) {
							br->DisbandBotRaid();
						}
					}*/
				}
			}
		}
	}

	if(GetInHealRotation()) {
		GetHealRotationLeader()->RemoveHealRotationMember(this);
	}

	entity_list.RemoveBot(this->GetID());

	return true;
}
Reply With Quote
Reply

Thread Tools
Display Modes

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 10:01 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