fix(Core/Groups): Create the group at first invite (#17869)

* cherry-pick commit (132538db1d)
* cherry-pick commit (250e8d998b)
* part https://github.com/azerothcore/azerothcore-wotlk/issues/11070

Co-authored-by: Treeston <14020072+Treeston@users.noreply.github.com>
This commit is contained in:
Kitzunu
2023-11-26 20:34:45 +01:00
committed by GitHub
parent 911f07c906
commit f440a7479f
3 changed files with 51 additions and 48 deletions

View File

@@ -2298,7 +2298,6 @@ bool Player::IsInSameGroupWith(Player const* p) const
}
///- If the player is invited, remove him. If the group if then only 1 person, disband the group.
/// \todo Shouldn't we also check if there is no other invitees before disbanding the group?
void Player::UninviteFromGroup()
{
Group* group = GetGroupInvite();
@@ -2307,14 +2306,17 @@ void Player::UninviteFromGroup()
group->RemoveInvite(this);
if (group->GetMembersCount() <= 1) // group has just 1 member => disband
if (group->IsCreated())
{
if (group->IsCreated())
if (group->GetMembersCount() <= 1) // group has just 1 member => disband
{
group->Disband(true);
group = nullptr; // gets deleted in disband
}
else
}
else
{
if (group->GetInviteeCount() <= 1)
{
group->RemoveAllInvites();
delete group;