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
This commit is contained in:
Spp
2010-08-11 13:25:14 +02:00
parent ac4df5204b
commit 23c4b1be25
6 changed files with 231 additions and 170 deletions
@@ -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);
}
+5 -5
View File
@@ -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 },