[Bug Fix] Fix for OOZ Group updates when removing/inviting Bots (#3159)

* [Bug Fix] Fix for Cross Zone Group updates with Bots when disbanding/joining groups.

* check for nullptr
This commit is contained in:
Aeadoin 2023-03-30 08:31:50 -04:00 committed by GitHub
parent 6960a1a682
commit e4ff76dceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 8 deletions

View File

@ -3837,6 +3837,7 @@ bool Bot::RemoveBotFromGroup(Bot* bot, Group* group) {
if (!group->IsLeader(bot)) {
bot->SetFollowID(0);
if (group->DelMember(bot)) {
group->DelMemberOOZ(bot->GetName());
database.SetGroupID(bot->GetCleanName(), 0, bot->GetBotID());
if (group->GroupCount() < 1) {
group->DisbandGroup();
@ -3859,8 +3860,12 @@ bool Bot::RemoveBotFromGroup(Bot* bot, Group* group) {
}
bool Bot::AddBotToGroup(Bot* bot, Group* group) {
bool Result = false;
if (bot && group && group->AddMember(bot)) {
bool result = false;
if (!group || group->GroupCount() >= MAX_GROUP_MEMBERS) {
return result;
}
if (bot && group->AddMember(bot)) {
if (group->GetLeader()) {
bot->SetFollowID(group->GetLeader()->GetID());
// Need to send this only once when a group is formed with a bot so the client knows it is also the group leader
@ -3871,9 +3876,10 @@ bool Bot::AddBotToGroup(Bot* bot, Group* group) {
}
}
group->VerifyGroup();
Result = true;
group->SendGroupJoinOOZ(bot);
result = true;
}
return Result;
return result;
}
// Completes a trade with a client bot owner
@ -6869,8 +6875,9 @@ void Bot::ProcessBotGroupInvite(Client* c, std::string const& botName) {
delete g;
}
} else {
AddBotToGroup(invitedBot, c->GetGroup());
database.SetGroupID(invitedBot->GetCleanName(), c->GetGroup()->GetID(), invitedBot->GetBotID());
if (AddBotToGroup(invitedBot, c->GetGroup())) {
database.SetGroupID(invitedBot->GetCleanName(), c->GetGroup()->GetID(), invitedBot->GetBotID());
}
}
if (c->HasRaid() && c->HasGroup()) {
Raid* raid = entity_list.GetRaidByClient(c);

View File

@ -188,6 +188,10 @@ void Bot::ProcessRaidInvite(Mob* invitee, Client* invitor, bool group_invite) {
Raid* raid = entity_list.GetRaidByClient(invitor);
if (raid && raid->RaidCount() >= MAX_RAID_MEMBERS) {
invitor->MessageString(Chat::Red, RAID_IS_FULL);
return;
}
Bot::CreateBotRaid(invitee, invitor, group_invite, raid);
}

View File

@ -4162,7 +4162,7 @@ bool Client::GroupFollow(Client* inviter) {
if (iraid == raid) {
//both in same raid
uint32 ngid = raid->GetGroup(inviter->GetName());
if (raid->GroupCount(ngid) < 6) {
if (raid->GroupCount(ngid) < MAX_GROUP_MEMBERS) {
raid->MoveMember(GetName(), ngid);
raid->SendGroupDisband(this);
raid->GroupUpdate(ngid);
@ -4183,7 +4183,7 @@ bool Client::GroupFollow(Client* inviter) {
if (!GetXTargetAutoMgr()->empty())
SetDirtyAutoHaters();
if (raid->GroupCount(groupToUse) < 6)
if (raid->GroupCount(groupToUse) < MAX_GROUP_MEMBERS)
{
raid->SendRaidCreate(this);
raid->SendMakeLeaderPacketTo(raid->leadername, this);

View File

@ -358,6 +358,7 @@
#define WHOALL_NO_RESULTS 5029 //There are no players in EverQuest that match those who filters.
#define TELL_QUEUED_MESSAGE 5045 //You told %1 '%T2. %3'
#define TOLD_NOT_ONLINE 5046 //%1 is not online at this time.
#define RAID_IS_FULL 5048 //The raid is full.
#define ZONING_NO_EXPANSION 5052 //The zone that you are attempting to enter is part of an expansion that you do not yet own. You may need to return to the Login screen and enter an account key for that expansion. If you have received this message in error, please /petition or send an email to EQAccounts@soe.sony.com
#define PETITION_NO_DELETE 5053 //You do not have a petition in the queue.
#define PETITION_DELETED 5054 //Your petition was successfully deleted.
@ -460,6 +461,7 @@
#define NO_ABILITY_OUT_OF_COMBAT 9194 //You can not use this ability while out of combat.
#define LESSER_SPELL_VERSION 11004 //%1 is a lesser version of %2 and cannot be scribed
#define AE_RAMPAGE 11015 //%1 goes on a WILD RAMPAGE!
#define GROUP_IS_FULL 12000 //You cannot join that group, it is full.
#define FACE_ACCEPTED 12028 //Facial features accepted.
#define TRACKING_BEGIN 12040 //You begin tracking %1.
#define SPELL_LEVEL_TO_LOW 12048 //You will have to achieve level %1 before you can scribe the %2.