Core/Players: Remove player from group on faction change if two side interaction group is not allowed. (#28835)

This commit is contained in:
Gildor
2023-03-11 19:17:00 +01:00
committed by GitHub
parent 13fa60ab86
commit 3dda65c53a
2 changed files with 9 additions and 1 deletions

View File

@@ -27,6 +27,7 @@
#include "GameTime.h"
#include "GitRevision.h"
#include "Group.h"
#include "GroupMgr.h"
#include "Guild.h"
#include "GuildMgr.h"
#include "InstanceSaveMgr.h"
@@ -1673,6 +1674,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
Field* fields = result->Fetch();
uint32 atLoginFlags = fields[0].GetUInt16();
std::string knownTitlesStr = fields[1].GetString();
uint32 groupId = !fields[2].IsNull() ? fields[2].GetUInt32() : 0;
uint32 usedLoginFlag = (factionChangeInfo->FactionChange ? AT_LOGIN_CHANGE_FACTION : AT_LOGIN_CHANGE_RACE);
if (!(atLoginFlags & usedLoginFlag))
@@ -1881,6 +1883,12 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
Player::LeaveAllArenaTeams(factionChangeInfo->Guid);
}
if (groupId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
{
if (Group* group = sGroupMgr->GetGroupByDbStoreId(groupId))
group->RemoveMember(factionChangeInfo->Guid);
}
if (!HasPermission(rbac::RBAC_PERM_TWO_SIDE_ADD_FRIEND))
{
// Delete Friend List