Core/Groups: Fix setting the group roles and Role Check feature

This commit is contained in:
horn
2014-09-05 16:38:49 +02:00
parent a91e0eed80
commit cd2f8412e5
3 changed files with 46 additions and 4 deletions

View File

@@ -582,8 +582,12 @@ void WorldSession::HandleGroupSetRolesOpcode(WorldPacket& recvData)
data.WriteByteSeq(guid1[1]);
data << uint32(0); // Old Role
if (GetPlayer()->GetGroup())
GetPlayer()->GetGroup()->BroadcastPacket(&data, false);
if (Group* group = GetPlayer()->GetGroup())
{
/// @todo probably should be sent only if (oldRole != newRole)
group->BroadcastPacket(&data, false);
group->SetLfgRoles(guid2, newRole);
}
else
SendPacket(&data);
}
@@ -1392,3 +1396,40 @@ void WorldSession::HandleOptOutOfLootOpcode(WorldPacket& recvData)
GetPlayer()->SetPassOnGroupLoot(passOnLoot != 0);
}
void WorldSession::HandleRolePollBeginOpcode(WorldPacket& recvData)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_ROLE_POLL_BEGIN");
Group* group = GetPlayer()->GetGroup();
if (!group)
return;
if (recvData.empty())
{
if (!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
return;
ObjectGuid guid = GetPlayer()->GetGUID();
WorldPacket data(SMSG_ROLE_POLL_BEGIN, 8);
data.WriteBit(guid[1]);
data.WriteBit(guid[5]);
data.WriteBit(guid[7]);
data.WriteBit(guid[3]);
data.WriteBit(guid[2]);
data.WriteBit(guid[4]);
data.WriteBit(guid[0]);
data.WriteBit(guid[6]);
data.WriteByteSeq(guid[4]);
data.WriteByteSeq(guid[7]);
data.WriteByteSeq(guid[0]);
data.WriteByteSeq(guid[5]);
data.WriteByteSeq(guid[1]);
data.WriteByteSeq(guid[6]);
data.WriteByteSeq(guid[2]);
data.WriteByteSeq(guid[3]);
GetPlayer()->GetGroup()->BroadcastPacket(&data, true);
}
}

View File

@@ -469,7 +469,7 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER(CMSG_RESET_INSTANCES, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleResetInstancesOpcode );
DEFINE_OPCODE_HANDLER(CMSG_RESURRECT_RESPONSE, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleResurrectResponseOpcode );
DEFINE_OPCODE_HANDLER(CMSG_RETURN_TO_GRAVEYARD, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleReturnToGraveyard );
DEFINE_OPCODE_HANDLER(CMSG_ROLE_POLL_BEGIN, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
DEFINE_OPCODE_HANDLER(CMSG_ROLE_POLL_BEGIN, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleRolePollBeginOpcode );
DEFINE_OPCODE_HANDLER(CMSG_SAVE_CUF_PROFILES, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleSaveCUFProfiles );
DEFINE_OPCODE_HANDLER(CMSG_SELF_RES, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSelfResOpcode );
DEFINE_OPCODE_HANDLER(CMSG_SELL_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleSellItemOpcode );
@@ -1147,7 +1147,7 @@ void OpcodeTable::Initialize()
DEFINE_OPCODE_HANDLER(SMSG_RESURRECT_FAILED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_RESURRECT_REQUEST, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_RESYNC_RUNES, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_ROLE_POLL_BEGIN, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_ROLE_POLL_BEGIN, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_RWHOIS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_SELL_ITEM, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_SEND_MAIL_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );

View File

@@ -560,6 +560,7 @@ class WorldSession
void HandleGroupSwapSubGroupOpcode(WorldPacket& recvData);
void HandleGroupAssistantLeaderOpcode(WorldPacket& recvData);
void HandlePartyAssignmentOpcode(WorldPacket& recvData);
void HandleRolePollBeginOpcode(WorldPacket& recvData);
void HandlePetitionBuyOpcode(WorldPacket& recvData);
void HandlePetitionShowSignOpcode(WorldPacket& recvData);