Skip to content

Commit

Permalink
Modify group invite behavior while creating group to be blizzlike
Browse files Browse the repository at this point in the history
- Leader can invite multiple people before the first invite is accepted
- Leader can cancel group formation by sending CMSG_GROUP_DISBAND (using
/run LeaveParty() or similar)

Signed-off-by: Ono <warlockbugs@users.noreply.github.com>
  • Loading branch information
Treeston authored and Warlockbugs committed Jun 14, 2017
1 parent fab25aa commit 2276c31
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/game/GroupHandler.cpp
Expand Up @@ -115,6 +115,8 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
Group* initiatorGroup = initiator->GetGroup();
if (initiatorGroup && initiatorGroup->isBGGroup())
initiatorGroup = initiator->GetOriginalGroup();
if (!initiatorGroup)
initiatorGroup = initiator->GetGroupInvite();

if (initiatorGroup && initiatorGroup->isRaidGroup() && !recipient->GetAllowLowLevelRaid() && (recipient->getLevel() < sWorld.getConfig(CONFIG_UINT32_MIN_LEVEL_FOR_RAID)))
{
Expand Down Expand Up @@ -149,7 +151,8 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
// not have permissions for invite
if (!initiatorGroup->IsLeader(initiator->GetObjectGuid()) && !initiatorGroup->IsAssistant(initiator->GetObjectGuid()))
{
SendPartyResult(PARTY_OP_INVITE, "", ERR_NOT_LEADER);
if (initiatorGroup->IsCreated())
SendPartyResult(PARTY_OP_INVITE, "", ERR_NOT_LEADER);
return;
}
// not have place
Expand Down Expand Up @@ -363,7 +366,8 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket& /*recv_data*/)
{
Player* player = GetPlayer();
Group* group = player->GetGroup();
if (!group)
Group* groupPending = player->GetGroupInvite();
if (!group && !groupPending)
return;

if (player->InBattleGround())
Expand All @@ -376,9 +380,17 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket& /*recv_data*/)
/********************/

// everything is fine, do it
SendPartyResult(PARTY_OP_LEAVE, player->GetName(), ERR_PARTY_RESULT_OK);

player->RemoveFromGroup();
if (group)
{
SendPartyResult(PARTY_OP_LEAVE, player->GetName(), ERR_PARTY_RESULT_OK);
player->RemoveFromGroup();
}
else if (groupPending && groupPending->GetLeaderGuid() == player->GetObjectGuid())
{
// pending group creation being cancelled
SendPartyResult(PARTY_OP_LEAVE, player->GetName(), ERR_PARTY_RESULT_OK);
groupPending->Disband();
}
}

void WorldSession::HandleMinimapPingOpcode(WorldPacket& recv_data)
Expand Down

0 comments on commit 2276c31

Please sign in to comment.