diff --git a/src/game/GroupHandler.cpp b/src/game/GroupHandler.cpp index 6519d6746..bb16b9fd4 100644 --- a/src/game/GroupHandler.cpp +++ b/src/game/GroupHandler.cpp @@ -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); } diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index c8e373763..0aa2c0e0d 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -248,6 +248,7 @@ class MANGOS_DLL_SPEC WorldSession void SendLfgJoinResult(LfgJoinResult result); void SendLfgUpdate(bool isGroup, LfgUpdateType updateType, uint32 id); void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res); + void SendGroupInvite(Player* player, bool alreadyInGroup = false); void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2, 3); void SendSetPhaseShift(uint32 phaseShift); void SendQueryTimeResponse(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index c74503795..4daf15240 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12076" + #define REVISION_NR "12077" #endif // __REVISION_NR_H__