[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:
Silinoron 2012-07-23 20:30:00 +02:00 committed by stfx
parent e81b605caa
commit 4bf5c3d701
3 changed files with 31 additions and 14 deletions

View file

@ -51,6 +51,20 @@ void WorldSession::SendPartyResult(PartyOperation operation, const std::string&
SendPacket(&data); 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) void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
{ {
std::string membername; std::string membername;
@ -105,13 +119,25 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
return; return;
} }
// player already invited
if (player->GetGroupInvite())
{
SendPartyResult(PARTY_OP_INVITE, membername, ERR_ALREADY_IN_GROUP_S);
return;
}
Group* group2 = player->GetGroup(); Group* group2 = player->GetGroup();
if (group2 && group2->isBGGroup()) if (group2 && group2->isBGGroup())
group2 = player->GetOriginalGroup(); 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); 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; return;
} }
@ -158,17 +184,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recv_data)
} }
} }
// ok, we do it SendGroupInvite(player);
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);
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK); SendPartyResult(PARTY_OP_INVITE, membername, ERR_PARTY_RESULT_OK);
} }

View file

@ -248,6 +248,7 @@ class MANGOS_DLL_SPEC WorldSession
void SendLfgJoinResult(LfgJoinResult result); void SendLfgJoinResult(LfgJoinResult result);
void SendLfgUpdate(bool isGroup, LfgUpdateType updateType, uint32 id); void SendLfgUpdate(bool isGroup, LfgUpdateType updateType, uint32 id);
void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res); 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 SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2, 3);
void SendSetPhaseShift(uint32 phaseShift); void SendSetPhaseShift(uint32 phaseShift);
void SendQueryTimeResponse(); void SendQueryTimeResponse();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "12076" #define REVISION_NR "12077"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__