diff options
| author | Spp <spp@jorge.gr> | 2010-08-11 13:25:14 +0200 |
|---|---|---|
| committer | Spp <spp@jorge.gr> | 2010-08-11 13:25:14 +0200 |
| commit | 23c4b1be25797f73e477ecf4d238f6e360b50b5b (patch) | |
| tree | c719276ea8431d9c0c237a64092d701054128f79 /src/server/game/Server | |
| parent | ac4df5204b0697432dc17ea11377eed4e86b0120 (diff) | |
Dungeon Finder: minor improvements and code clean-ups
- Initialize all packet size properly
- Updated all function documentation
- Add placeholders to all LFG opcodes
- Use lowguids wherever is possible
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Server')
| -rw-r--r-- | src/server/game/Server/Protocol/Handlers/LFGHandler.cpp | 88 | ||||
| -rw-r--r-- | src/server/game/Server/Protocol/Opcodes.cpp | 10 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSession.cpp | 3 | ||||
| -rw-r--r-- | src/server/game/Server/WorldSession.h | 13 |
4 files changed, 89 insertions, 25 deletions
diff --git a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp index 0564c3cd400..6c9a86b83ea 100644 --- a/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LFGHandler.cpp @@ -63,25 +63,29 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data) void WorldSession::HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/) { sLog.outDebug("CMSG_LFG_LEAVE"); + Group *grp = GetPlayer()->GetGroup(); // Check cheating - only leader can leave the queue - if (Group *grp = GetPlayer()->GetGroup()) - { - if (grp->GetLeaderGUID() != GetPlayer()->GetGUID()) - return; - else - sLFGMgr.Leave(GetPlayer(), grp); - } - else + if (!grp || grp->GetLeaderGUID() == GetPlayer()->GetGUID()) sLFGMgr.Leave(GetPlayer()); } +void WorldSession::HandleLfgProposalResultOpcode(WorldPacket &recv_data) +{ + sLog.outDebug("CMSG_LFG_PROPOSAL_RESULT"); + + uint32 lfgGroupID; // Internal lfgGroupID + uint8 accept; // Accept to join? + recv_data >> lfgGroupID; + recv_data >> accept; +} + void WorldSession::HandleLfgSetRolesOpcode(WorldPacket &recv_data) { sLog.outDebug("CMSG_LFG_SET_ROLES"); uint8 roles; - recv_data >> roles; // Player Group Roles + recv_data >> roles; // Player Group Roles Group *grp = GetPlayer()->GetGroup(); if (!grp) @@ -100,6 +104,22 @@ void WorldSession::HandleSetLfgCommentOpcode(WorldPacket & recv_data) GetPlayer()->SetLfgComment(comment); } +void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket &recv_data) +{ + sLog.outDebug("CMSG_LFG_SET_BOOT_VOTE"); + + uint8 agree; // Agree to kick player + recv_data >> agree; +} + +void WorldSession::HandleLfgTeleportOpcode(WorldPacket &recv_data) +{ + sLog.outDebug("CMSG_LFG_TELEPORT"); + + bool out; + recv_data >> out; +} + void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data*/) { sLog.outDebug("CMSG_LFD_PLAYER_LOCK_INFO_REQUEST"); @@ -109,7 +129,22 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket &/*recv_data*/) { sLog.outDebug("CMSG_LFD_PARTY_LOCK_INFO_REQUEST"); - sLFGMgr.SendLfgPartyInfo(GetPlayer()); +} + +void WorldSession::HandleLfrSearchOpcode(WorldPacket &recv_data) +{ + sLog.outDebug("CMSG_SEARCH_LFG_JOIN"); + + uint32 entry; // Raid id to search + recv_data >> entry; +} + +void WorldSession::HandleLfrLeaveOpcode(WorldPacket &recv_data) +{ + sLog.outDebug("CMSG_SEARCH_LFG_LEAVE"); + + uint32 dungeonId; // Raid id queue to leave + recv_data >> dungeonId; } void WorldSession::SendLfgUpdatePlayer(uint8 updateType) @@ -207,7 +242,7 @@ void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles) { sLog.outDebug("SMSG_LFG_ROLE_CHOSEN"); - WorldPacket data(SMSG_LFG_ROLE_CHOSEN); + WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4); data << uint64(guid); // Guid data << uint8(roles > 0); // Ready data << uint32(roles); // Roles @@ -221,7 +256,7 @@ void WorldSession::SendLfgJoinResult(uint8 checkResult, uint8 checkValue) sLog.outDebug("SMSG_LFG_JOIN_RESULT"); - WorldPacket data(SMSG_LFG_JOIN_RESULT); + WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4); data << uint32(checkResult); // Check Result data << uint32(checkValue); // Check Value SendPacket(&data); @@ -230,7 +265,7 @@ void WorldSession::SendLfgJoinResult(uint8 checkResult, uint8 checkValue) void WorldSession::SendLfgQueueStatus(uint32 dungeon, int32 waitTime, int32 avgWaitTime, int32 waitTimeTanks, int32 waitTimeHealer, int32 waitTimeDps, uint32 queuedTime, uint8 tanks, uint8 healers, uint8 dps) { sLog.outDebug("SMSG_LFG_QUEUE_STATUS"); - WorldPacket data(SMSG_LFG_QUEUE_STATUS); + WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 +4 + 1 + 1 + 1 + 4); data << uint32(dungeon); // Dungeon data << uint32(avgWaitTime); // Average Wait time @@ -249,7 +284,32 @@ void WorldSession::SendLfgUpdateSearch(bool update) { sLog.outDebug("SMSG_LFG_UPDATE_SEARCH"); - WorldPacket data(SMSG_LFG_UPDATE_SEARCH); + WorldPacket data(SMSG_LFG_UPDATE_SEARCH, 1); data << uint8(update); // In Lfg Queue? SendPacket(&data); } + +void WorldSession::SendLfgDisabled() +{ + sLog.outDebug("SMSG_LFG_DISABLED"); + WorldPacket data(SMSG_LFG_DISABLED, 0); + SendPacket(&data); +} + +void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry) +{ + sLog.outDebug("SMSG_LFG_OFFER_CONTINUE"); + + WorldPacket data(SMSG_LFG_OFFER_CONTINUE, 4); + data << uint32(dungeonEntry); + SendPacket(&data); +} + +void WorldSession::SendLfgTeleportError(uint8 err) +{ + sLog.outDebug("SMSG_LFG_TELEPORT_DENIED"); + + WorldPacket data(SMSG_LFG_TELEPORT_DENIED, 4); + data << uint32(err); // Error + SendPacket(&data); +}
\ No newline at end of file diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 71927680624..c22148ab96b 100644 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -890,11 +890,11 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x35B*/ { "SMSG_ARENA_TEAM_STATS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x35C*/ { "CMSG_LFG_JOIN", STATUS_LOGGEDIN, &WorldSession::HandleLfgJoinOpcode }, /*0x35D*/ { "CMSG_LFG_LEAVE", STATUS_LOGGEDIN, &WorldSession::HandleLfgLeaveOpcode }, - /*0x35E*/ { "CMSG_SEARCH_LFG_JOIN", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, - /*0x35F*/ { "CMSG_SEARCH_LFG_LEAVE", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, + /*0x35E*/ { "CMSG_SEARCH_LFG_JOIN", STATUS_LOGGEDIN, &WorldSession::HandleLfrSearchOpcode }, + /*0x35F*/ { "CMSG_SEARCH_LFG_LEAVE", STATUS_LOGGEDIN, &WorldSession::HandleLfrLeaveOpcode }, /*0x360*/ { "SMSG_UPDATE_LFG_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x361*/ { "SMSG_LFG_PROPOSAL_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x362*/ { "CMSG_LFG_PROPOSAL_RESULT", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, + /*0x362*/ { "CMSG_LFG_PROPOSAL_RESULT", STATUS_LOGGEDIN, &WorldSession::HandleLfgProposalResultOpcode }, /*0x363*/ { "SMSG_LFG_ROLE_CHECK_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x364*/ { "SMSG_LFG_JOIN_RESULT", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x365*/ { "SMSG_LFG_QUEUE_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide }, @@ -904,11 +904,11 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x369*/ { "SMSG_LFG_UPDATE_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x36A*/ { "CMSG_LFG_SET_ROLES", STATUS_LOGGEDIN, &WorldSession::HandleLfgSetRolesOpcode }, /*0x36B*/ { "CMSG_LFG_SET_NEEDS", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, - /*0x36C*/ { "CMSG_LFG_SET_BOOT_VOTE", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, + /*0x36C*/ { "CMSG_LFG_SET_BOOT_VOTE", STATUS_LOGGEDIN, &WorldSession::HandleLfgSetBootVoteOpcode }, /*0x36D*/ { "SMSG_LFG_BOOT_PROPOSAL_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x36E*/ { "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST", STATUS_LOGGEDIN, &WorldSession::HandleLfgPlayerLockInfoRequestOpcode}, /*0x36F*/ { "SMSG_LFG_PLAYER_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x370*/ { "CMSG_LFG_TELEPORT", STATUS_LOGGEDIN, &WorldSession::Handle_NULL }, + /*0x370*/ { "CMSG_LFG_TELEPORT", STATUS_LOGGEDIN, &WorldSession::HandleLfgTeleportOpcode }, /*0x371*/ { "CMSG_LFD_PARTY_LOCK_INFO_REQUEST", STATUS_LOGGEDIN, &WorldSession::HandleLfgPartyLockInfoRequestOpcode}, /*0x372*/ { "SMSG_LFG_PARTY_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x373*/ { "SMSG_TITLE_EARNED", STATUS_NEVER, &WorldSession::Handle_ServerSide }, diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 695d3e23641..7e34afe09f8 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -47,8 +47,7 @@ /// WorldSession constructor WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale) : -LookingForGroup_auto_join(false), LookingForGroup_auto_add(false), m_muteTime(mute_time), -_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), +m_muteTime(mute_time), _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion), m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(sObjectMgr.GetIndexForLocale(locale)), _logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerRecentlyLogout(false), m_playerSave(false), m_latency(0), m_TutorialsChanged(false), m_timeOutTime(0) diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index 93d90cd9fe2..9c6dd70831f 100644 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -270,10 +270,6 @@ class WorldSession void SendNotInArenaTeamPacket(uint8 type); void SendPetitionShowList(uint64 guid); void SendSaveGuildEmblem(uint32 msg); - // Looking For Group - // TRUE values set by client sending CMSG_LFG_SET_AUTOJOIN and CMSG_LFM_CLEAR_AUTOFILL before player login - bool LookingForGroup_auto_join; - bool LookingForGroup_auto_add; void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data); @@ -705,12 +701,21 @@ class WorldSession void HandleLfgJoinOpcode(WorldPacket &recv_data); void HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/); void HandleLfgSetRolesOpcode(WorldPacket &recv_data); + void HandleLfgProposalResultOpcode(WorldPacket &recv_data); + void HandleLfgSetBootVoteOpcode(WorldPacket &recv_data); + void HandleLfgTeleportOpcode(WorldPacket &recv_data); + void HandleLfrSearchOpcode(WorldPacket &recv_data); + void HandleLfrLeaveOpcode(WorldPacket &recv_data); + void SendLfgUpdatePlayer(uint8 updateType); void SendLfgUpdateParty(uint8 updateType); void SendLfgRoleChosen(uint64 guid, uint8 roles); void SendLfgUpdateSearch(bool update); void SendLfgJoinResult(uint8 checkResult, uint8 checkValue); void SendLfgQueueStatus(uint32 dungeon, int32 waitTime, int32 avgWaitTime, int32 waitTimeTanks, int32 waitTimeHealer, int32 waitTimeDps, uint32 queuedTime, uint8 tanks, uint8 healers, uint8 dps); + void SendLfgDisabled(); + void SendLfgOfferContinue(uint32 dungeonEntry); + void SendLfgTeleportError(uint8 err); // Arena Team void HandleInspectArenaTeamsOpcode(WorldPacket& recv_data); |
