mirror of
https://github.com/mangosfour/server.git
synced 2025-12-19 13:37:01 +00:00
[12077] Send SMSG_GROUP_INVITE also when the invite fails due to the invitee already being in a group
Signed-off-by: stfx <stfx@hotmail.de>
This commit is contained in:
parent
e81b605caa
commit
4bf5c3d701
3 changed files with 31 additions and 14 deletions
|
|
@ -51,6 +51,20 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string&
|
|||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendGroupInvite(Player* player, bool alreadyInGroup /*= false*/)
|
||||
{
|
||||
WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size
|
||||
data << uint8(alreadyInGroup ? 0 : 1); // invited/already in group flag
|
||||
data << GetPlayer()->GetName(); // max len 48
|
||||
data << uint32(0); // unk
|
||||
data << uint8(0); // count
|
||||
// for(int i = 0; i < count; ++i)
|
||||
// data << uint32(0);
|
||||
data << uint32(0); // unk
|
||||
|
||||
player->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
std::string membername;
|
||||
|
|
@ -105,13 +119,25 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
|
|||
return;
|
||||
}
|
||||
|
||||
// player already invited
|
||||
if (player->GetGroupInvite())
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_ALREADY_IN_GROUP_S);
|
||||
return;
|
||||
}
|
||||
|
||||
Group* group2 = player->GetGroup();
|
||||
if (group2 && group2->isBGGroup())
|
||||
group2 = player->GetOriginalGroup();
|
||||
// player already in another group or invited
|
||||
if (group2 || player->GetGroupInvite())
|
||||
|
||||
// player already in another group
|
||||
if (group2)
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_ALREADY_IN_GROUP_S);
|
||||
|
||||
// tell the player that they were invited but it failed as they were already in a group
|
||||
SendGroupInvite(player, true);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -158,17 +184,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
|
|||
}
|
||||
}
|
||||
|
||||
// ok, we do it
|
||||
WorldPacket data(SMSG_GROUP_INVITE, 10); // guess size
|
||||
data << uint8(1); // invited/already in group flag
|
||||
data << GetPlayer()->GetName(); // max len 48
|
||||
data << uint32(0); // unk
|
||||
data << uint8(0); // count
|
||||
// for(int i = 0; i < count; ++i)
|
||||
// data << uint32(0);
|
||||
data << uint32(0); // unk
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
SendGroupInvite(player);
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue