Core/Dungeon Finder: Multiple changes
- Simplify lock status calculations by caching player locked dungeons - Fix incorrect Lfg State loading for groups - All reference variables that are supposed not to be modified are declared as const - Use full group guids in rolechecks - Add some debug msgs - Fix some warnings --HG-- branch : trunk
This commit is contained in:
@@ -24,39 +24,27 @@
|
||||
#include "ObjectMgr.h"
|
||||
|
||||
|
||||
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet* lockSet)
|
||||
void BuildPlayerLockDungeonBlock(WorldPacket& data, const LfgLockMap& lock)
|
||||
{
|
||||
if (!lockSet)
|
||||
data << uint32(lock.size()); // Size of lock dungeons
|
||||
for (LfgLockMap::const_iterator it = lock.begin(); it != lock.end(); ++it)
|
||||
{
|
||||
data << uint8(0);
|
||||
return;
|
||||
}
|
||||
|
||||
data << uint32(lockSet->size()); // Size of lock dungeons
|
||||
for (LfgLockStatusSet::const_iterator it = lockSet->begin(); it != lockSet->end(); ++it)
|
||||
{
|
||||
data << uint32((*it)->dungeon); // Dungeon entry + type
|
||||
data << uint32((*it)->lockstatus); // Lock status
|
||||
data << uint32(it->first); // Dungeon entry (id + type)
|
||||
data << uint32(it->second); // Lock status
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap* lockMap)
|
||||
void BuildPartyLockDungeonBlock(WorldPacket& data, const LfgLockPartyMap& lockMap)
|
||||
{
|
||||
if (!lockMap)
|
||||
data << uint8(lockMap.size());
|
||||
for (LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
|
||||
{
|
||||
data << uint8(0);
|
||||
return;
|
||||
}
|
||||
|
||||
data << uint8(lockMap->size());
|
||||
for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it)
|
||||
{
|
||||
data << uint64(MAKE_NEW_GUID(it->first, 0, HIGHGUID_PLAYER)); // Player guid
|
||||
data << uint64(it->first); // Player guid
|
||||
BuildPlayerLockDungeonBlock(data, it->second);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleLfgJoinOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
if (!sWorld.getBoolConfig(CONFIG_DUNGEON_FINDER_ENABLE) ||
|
||||
(GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->GetLeaderGUID() != GetPlayer()->GetGUID()))
|
||||
@@ -70,7 +58,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data)
|
||||
uint32 roles;
|
||||
|
||||
recv_data >> roles;
|
||||
recv_data.read_skip<uint16>(); // uint8 (always 0) - uint8 (always 0)
|
||||
recv_data.read_skip<uint16>(); // uint8 (always 0) - uint8 (always 0)
|
||||
recv_data >> numDungeons;
|
||||
if (!numDungeons)
|
||||
{
|
||||
@@ -83,18 +71,18 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data)
|
||||
for (int8 i = 0 ; i < numDungeons; ++i)
|
||||
{
|
||||
recv_data >> dungeon;
|
||||
newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry
|
||||
newDungeons.insert((dungeon & 0x00FFFFFF)); // remove the type from the dungeon entry
|
||||
}
|
||||
|
||||
recv_data.read_skip<uint32>(); // for 0..uint8 (always 3) { uint8 (always 0) }
|
||||
recv_data.read_skip<uint32>(); // for 0..uint8 (always 3) { uint8 (always 0) }
|
||||
|
||||
std::string comment;
|
||||
recv_data >> comment;
|
||||
sLog.outDebug("CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str());
|
||||
sLFGMgr.Join(GetPlayer(), LfgRoles(roles), newDungeons, comment);
|
||||
sLFGMgr.Join(GetPlayer(), uint8(roles), newDungeons, comment);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
Group* grp = GetPlayer()->GetGroup();
|
||||
|
||||
@@ -105,10 +93,10 @@ void WorldSession::HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/)
|
||||
sLFGMgr.Leave(GetPlayer(), grp);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgProposalResultOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 lfgGroupID; // Internal lfgGroupID
|
||||
bool accept; // Accept to join?
|
||||
uint32 lfgGroupID; // Internal lfgGroupID
|
||||
bool accept; // Accept to join?
|
||||
recv_data >> lfgGroupID;
|
||||
recv_data >> accept;
|
||||
|
||||
@@ -116,10 +104,10 @@ void WorldSession::HandleLfgProposalResultOpcode(WorldPacket &recv_data)
|
||||
sLFGMgr.UpdateProposal(lfgGroupID, GetPlayer()->GetGUID(), accept);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgSetRolesOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint8 roles;
|
||||
recv_data >> roles; // Player Group Roles
|
||||
recv_data >> roles; // Player Group Roles
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
Group* grp = GetPlayer()->GetGroup();
|
||||
if (!grp)
|
||||
@@ -128,10 +116,10 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket &recv_data)
|
||||
return;
|
||||
}
|
||||
sLog.outDebug("CMSG_LFG_SET_ROLES [" UI64FMTD "] Roles: %u", guid, roles);
|
||||
sLFGMgr.UpdateRoleCheck(grp, GetPlayer(), LfgRoles(roles));
|
||||
sLFGMgr.UpdateRoleCheck(grp, GetPlayer());
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgSetCommentOpcode(WorldPacket & recv_data)
|
||||
void WorldSession::HandleLfgSetCommentOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
std::string comment;
|
||||
recv_data >> comment;
|
||||
@@ -141,16 +129,16 @@ void WorldSession::HandleLfgSetCommentOpcode(WorldPacket & recv_data)
|
||||
sLFGMgr.SetComment(guid, comment);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
bool agree; // Agree to kick player
|
||||
bool agree; // Agree to kick player
|
||||
recv_data >> agree;
|
||||
|
||||
sLog.outDebug("CMSG_LFG_SET_BOOT_VOTE [" UI64FMTD "] agree: %u", GetPlayer()->GetGUID(), agree ? 1 : 0);
|
||||
sLFGMgr.UpdateBoot(GetPlayer(), agree);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgTeleportOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
bool out;
|
||||
recv_data >> out;
|
||||
@@ -159,10 +147,12 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket &recv_data)
|
||||
sLFGMgr.TeleportPlayer(GetPlayer(), out, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data*/)
|
||||
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
sLog.outDebug("CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
sLog.outDebug("CMSG_LFD_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);
|
||||
|
||||
// Get Random dungeons that can be done at a certain level and expansion
|
||||
// FIXME - Should return seasonals (when not disabled)
|
||||
LfgDungeonSet randomDungeons;
|
||||
uint8 level = GetPlayer()->getLevel();
|
||||
@@ -170,113 +160,125 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data
|
||||
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
|
||||
{
|
||||
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i);
|
||||
if (dungeon && dungeon->type == LFG_TYPE_RANDOM && dungeon && dungeon->expansion <= expansion &&
|
||||
if (dungeon && dungeon->type == LFG_TYPE_RANDOM && dungeon->expansion <= expansion &&
|
||||
dungeon->minlevel <= level && level <= dungeon->maxlevel)
|
||||
randomDungeons.insert(dungeon->Entry());
|
||||
}
|
||||
|
||||
LfgLockStatusSet* lockSet = sLFGMgr.GetPlayerLockStatusDungeons(GetPlayer());
|
||||
// Get player locked Dungeons
|
||||
LfgLockMap lock = sLFGMgr.GetLockedDungeons(guid);
|
||||
uint32 rsize = uint32(randomDungeons.size());
|
||||
uint32 lsize = lockSet ? uint32(lockSet->size()) : 0;
|
||||
uint32 lsize = uint32(lock.size());
|
||||
|
||||
sLog.outDebug("SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
sLog.outDebug("SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid);
|
||||
WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));
|
||||
if (!randomDungeons.size())
|
||||
data << uint8(0);
|
||||
else
|
||||
|
||||
data << uint8(randomDungeons.size()); // Random Dungeon count
|
||||
for (LfgDungeonSet::const_iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
|
||||
{
|
||||
LfgReward const* reward = NULL;
|
||||
data << uint32(*it); // Dungeon Entry (id + type)
|
||||
LfgReward const* reward = sLFGMgr.GetRandomDungeonReward(*it, level);
|
||||
Quest const* qRew = NULL;
|
||||
uint8 done = 0;
|
||||
|
||||
data << uint8(randomDungeons.size()); // Random Dungeon count
|
||||
for (LfgDungeonSet::iterator it = randomDungeons.begin(); it != randomDungeons.end(); ++it)
|
||||
if (reward)
|
||||
{
|
||||
data << uint32(*it); // Entry
|
||||
reward = sLFGMgr.GetRandomDungeonReward(*it, level);
|
||||
qRew = NULL;
|
||||
if (reward)
|
||||
{
|
||||
qRew = sObjectMgr.GetQuestTemplate(reward->reward[0].questId);
|
||||
if (qRew)
|
||||
{
|
||||
done = !GetPlayer()->CanRewardQuest(qRew,false);
|
||||
if (done)
|
||||
qRew = sObjectMgr.GetQuestTemplate(reward->reward[1].questId);
|
||||
}
|
||||
|
||||
}
|
||||
qRew = sObjectMgr.GetQuestTemplate(reward->reward[0].questId);
|
||||
if (qRew)
|
||||
{
|
||||
data << uint8(done);
|
||||
data << uint32(qRew->GetRewOrReqMoney());
|
||||
data << uint32(qRew->XPValue(GetPlayer()));
|
||||
data << uint32(reward->reward[done].variableMoney);
|
||||
data << uint32(reward->reward[done].variableXP);
|
||||
data << uint8(qRew->GetRewItemsCount());
|
||||
if (qRew->GetRewItemsCount())
|
||||
{
|
||||
ItemPrototype const* iProto = NULL;
|
||||
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
|
||||
{
|
||||
if (!qRew->RewItemId[i])
|
||||
continue;
|
||||
|
||||
iProto = ObjectMgr::GetItemPrototype(qRew->RewItemId[i]);
|
||||
|
||||
data << uint32(qRew->RewItemId[i]);
|
||||
data << uint32(iProto ? iProto->DisplayInfoID : 0);
|
||||
data << uint32(qRew->RewItemCount[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint8(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint8(0);
|
||||
done = !GetPlayer()->CanRewardQuest(qRew, false);
|
||||
if (done)
|
||||
qRew = sObjectMgr.GetQuestTemplate(reward->reward[1].questId);
|
||||
}
|
||||
}
|
||||
if (qRew)
|
||||
{
|
||||
data << uint8(done);
|
||||
data << uint32(qRew->GetRewOrReqMoney());
|
||||
data << uint32(qRew->XPValue(GetPlayer()));
|
||||
data << uint32(reward->reward[done].variableMoney);
|
||||
data << uint32(reward->reward[done].variableXP);
|
||||
data << uint8(qRew->GetRewItemsCount());
|
||||
if (qRew->GetRewItemsCount())
|
||||
{
|
||||
ItemPrototype const* iProto = NULL;
|
||||
for (uint8 i = 0; i < QUEST_REWARDS_COUNT; ++i)
|
||||
{
|
||||
if (!qRew->RewItemId[i])
|
||||
continue;
|
||||
|
||||
iProto = ObjectMgr::GetItemPrototype(qRew->RewItemId[i]);
|
||||
|
||||
data << uint32(qRew->RewItemId[i]);
|
||||
data << uint32(iProto ? iProto->DisplayInfoID : 0);
|
||||
data << uint32(qRew->RewItemCount[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint8(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint32(0);
|
||||
data << uint8(0);
|
||||
}
|
||||
}
|
||||
BuildPlayerLockDungeonBlock(data, lockSet);
|
||||
BuildPlayerLockDungeonBlock(data, lock);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket & /*recv_data*/)
|
||||
void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recv_data*/)
|
||||
{
|
||||
sLog.outDebug("CMSG_LFD_PARTY_LOCK_INFO_REQUEST [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
if (LfgLockStatusMap* lockMap = sLFGMgr.GetPartyLockStatusDungeons(GetPlayer()))
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
sLog.outDebug("CMSG_LFD_PARTY_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);
|
||||
|
||||
Group* grp = GetPlayer()->GetGroup();
|
||||
if (!grp)
|
||||
return;
|
||||
|
||||
// Get the locked dungeons of the other party members
|
||||
LfgLockPartyMap lockMap;
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||
{
|
||||
uint32 size = 0;
|
||||
for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it)
|
||||
size += 8 + 4 + it->second->size() * (4 + 4);
|
||||
sLog.outDebug("SMSG_LFG_PARTY_INFO [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size);
|
||||
BuildPartyLockDungeonBlock(data, lockMap);
|
||||
SendPacket(&data);
|
||||
Player* plrg = itr->getSource();
|
||||
if (!plrg)
|
||||
continue;
|
||||
|
||||
uint64 pguid = plrg->GetGUID();
|
||||
if (pguid == guid)
|
||||
continue;
|
||||
|
||||
lockMap[pguid] = sLFGMgr.GetLockedDungeons(pguid);
|
||||
}
|
||||
|
||||
uint32 size = 0;
|
||||
for (LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
|
||||
size += 8 + 4 + uint32(it->second.size()) * (4 + 4);
|
||||
|
||||
sLog.outDebug("SMSG_LFG_PARTY_INFO [" UI64FMTD "]", guid);
|
||||
WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size);
|
||||
BuildPartyLockDungeonBlock(data, lockMap);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfrSearchOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleLfrSearchOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 entry; // Raid id to search
|
||||
uint32 entry; // Raid id to search
|
||||
recv_data >> entry;
|
||||
sLog.outDebug("CMSG_SEARCH_LFG_JOIN [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), entry);
|
||||
//SendLfrUpdateListOpcode(entry);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfrLeaveOpcode(WorldPacket &recv_data)
|
||||
void WorldSession::HandleLfrLeaveOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint32 dungeonId; // Raid id queue to leave
|
||||
uint32 dungeonId; // Raid id queue to leave
|
||||
recv_data >> dungeonId;
|
||||
sLog.outDebug("CMSG_SEARCH_LFG_LEAVE [" UI64FMTD "] dungeonId: %u", GetPlayer()->GetGUID(), dungeonId);
|
||||
//sLFGMgr.LeaveLfr(GetPlayer(), dungeonId);
|
||||
}
|
||||
|
||||
void WorldSession::SendLfgUpdatePlayer(LfgUpdateData updateData)
|
||||
void WorldSession::SendLfgUpdatePlayer(const LfgUpdateData& updateData)
|
||||
{
|
||||
bool queued = false;
|
||||
bool extrainfo = false;
|
||||
@@ -297,17 +299,17 @@ void WorldSession::SendLfgUpdatePlayer(LfgUpdateData updateData)
|
||||
}
|
||||
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
uint8 size = updateData.dungeons ? updateData.dungeons->size() : 0;
|
||||
uint8 size = updateData.dungeons ? uint8(updateData.dungeons->size()) : 0;
|
||||
|
||||
sLog.outDebug("SMSG_LFG_UPDATE_PLAYER [" UI64FMTD "] updatetype: %u", guid, updateData.updateType);
|
||||
WorldPacket data(SMSG_LFG_UPDATE_PLAYER, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
|
||||
data << uint8(updateData.updateType); // Lfg Update type
|
||||
data << uint8(extrainfo); // Extra info
|
||||
data << uint8(updateData.updateType); // Lfg Update type
|
||||
data << uint8(extrainfo); // Extra info
|
||||
if (extrainfo)
|
||||
{
|
||||
data << uint8(queued); // Join the queue
|
||||
data << uint8(0); // unk - Always 0
|
||||
data << uint8(0); // unk - Always 0
|
||||
data << uint8(queued); // Join the queue
|
||||
data << uint8(0); // unk - Always 0
|
||||
data << uint8(0); // unk - Always 0
|
||||
|
||||
data << uint8(size);
|
||||
if (size)
|
||||
@@ -318,7 +320,7 @@ void WorldSession::SendLfgUpdatePlayer(LfgUpdateData updateData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendLfgUpdateParty(LfgUpdateData updateData)
|
||||
void WorldSession::SendLfgUpdateParty(const LfgUpdateData& updateData)
|
||||
{
|
||||
bool join = false;
|
||||
bool extrainfo = false;
|
||||
@@ -347,20 +349,20 @@ void WorldSession::SendLfgUpdateParty(LfgUpdateData updateData)
|
||||
}
|
||||
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
uint8 size = updateData.dungeons ? updateData.dungeons->size() : 0;
|
||||
uint8 size = updateData.dungeons ? uint8(updateData.dungeons->size()) : 0;
|
||||
|
||||
sLog.outDebug("SMSG_LFG_UPDATE_PARTY [" UI64FMTD "] updatetype: %u", guid, updateData.updateType);
|
||||
WorldPacket data(SMSG_LFG_UPDATE_PARTY, 1 + 1 + (extrainfo ? 1 : 0) * (1 + 1 + 1 + 1 + 1 + size * 4 + updateData.comment.length()));
|
||||
data << uint8(updateData.updateType); // Lfg Update type
|
||||
data << uint8(extrainfo); // Extra info
|
||||
data << uint8(updateData.updateType); // Lfg Update type
|
||||
data << uint8(extrainfo); // Extra info
|
||||
if (extrainfo)
|
||||
{
|
||||
data << uint8(join); // LFG Join
|
||||
data << uint8(queued); // Join the queue
|
||||
data << uint8(0); // unk - Always 0
|
||||
data << uint8(0); // unk - Always 0
|
||||
data << uint8(join); // LFG Join
|
||||
data << uint8(queued); // Join the queue
|
||||
data << uint8(0); // unk - Always 0
|
||||
data << uint8(0); // unk - Always 0
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
data << uint8(0); // unk - Always 0
|
||||
data << uint8(0); // unk - Always 0
|
||||
|
||||
data << uint8(size);
|
||||
if (size)
|
||||
@@ -376,13 +378,13 @@ void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
|
||||
sLog.outDebug("SMSG_LFG_ROLE_CHOSEN [" UI64FMTD "] guid: [" UI64FMTD "] roles: %u", GetPlayer()->GetGUID(), guid, roles);
|
||||
|
||||
WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4);
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendLfgRoleCheckUpdate(LfgRoleCheck* pRoleCheck)
|
||||
void WorldSession::SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck)
|
||||
{
|
||||
ASSERT(pRoleCheck);
|
||||
LfgDungeonSet dungeons;
|
||||
@@ -394,12 +396,9 @@ void WorldSession::SendLfgRoleCheckUpdate(LfgRoleCheck* pRoleCheck)
|
||||
sLog.outDebug("SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
|
||||
|
||||
Player* plr;
|
||||
uint8 roles;
|
||||
|
||||
data << uint32(pRoleCheck->state); // Check result
|
||||
data << uint32(pRoleCheck->state); // Check result
|
||||
data << uint8(pRoleCheck->state == LFG_ROLECHECK_INITIALITING);
|
||||
data << uint8(dungeons.size()); // Number of dungeons
|
||||
data << uint8(dungeons.size()); // Number of dungeons
|
||||
if (dungeons.size())
|
||||
{
|
||||
for (LfgDungeonSet::iterator it = dungeons.begin(); it != dungeons.end(); ++it)
|
||||
@@ -409,49 +408,46 @@ void WorldSession::SendLfgRoleCheckUpdate(LfgRoleCheck* pRoleCheck)
|
||||
}
|
||||
}
|
||||
|
||||
data << uint8(pRoleCheck->roles.size()); // Players in group
|
||||
data << uint8(pRoleCheck->roles.size()); // Players in group
|
||||
if (pRoleCheck->roles.size())
|
||||
{
|
||||
// Leader info MUST be sent 1st :S
|
||||
roles = pRoleCheck->roles[pRoleCheck->leader];
|
||||
uint64 guid = MAKE_NEW_GUID(pRoleCheck->leader, 0, HIGHGUID_PLAYER);
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
plr = sObjectMgr.GetPlayer(guid);
|
||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||
uint64 guid = pRoleCheck->leader;
|
||||
uint8 roles = pRoleCheck->roles.find(guid)->second;
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
Player* plr = sObjectMgr.GetPlayer(guid);
|
||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||
|
||||
for (LfgRolesMap::const_iterator itPlayers = pRoleCheck->roles.begin(); itPlayers != pRoleCheck->roles.end(); ++itPlayers)
|
||||
for (LfgRolesMap::const_iterator it = pRoleCheck->roles.begin(); it != pRoleCheck->roles.end(); ++it)
|
||||
{
|
||||
if (itPlayers->first == pRoleCheck->leader)
|
||||
if (it->first == pRoleCheck->leader)
|
||||
continue;
|
||||
|
||||
roles = itPlayers->second;
|
||||
guid = MAKE_NEW_GUID(itPlayers->first, 0, HIGHGUID_PLAYER);
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
guid = it->first;
|
||||
roles = it->second;
|
||||
data << uint64(guid); // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
plr = sObjectMgr.GetPlayer(guid);
|
||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||
}
|
||||
}
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendLfgJoinResult(LfgJoinResultData& joinData)
|
||||
void WorldSession::SendLfgJoinResult(const LfgJoinResultData& joinData)
|
||||
{
|
||||
uint32 size = 0;
|
||||
if (joinData.lockmap)
|
||||
{
|
||||
for (LfgLockStatusMap::const_iterator it = joinData.lockmap->begin(); it != joinData.lockmap->end(); ++it)
|
||||
size += 8 + 4 + it->second->size() * (4 + 4);
|
||||
}
|
||||
for (LfgLockPartyMap::const_iterator it = joinData.lockmap.begin(); it != joinData.lockmap.end(); ++it)
|
||||
size += 8 + 4 + uint32(it->second.size()) * (4 + 4);
|
||||
|
||||
sLog.outDebug("SMSG_LFG_JOIN_RESULT [" UI64FMTD "] checkResult: %u checkValue: %u", GetPlayer()->GetGUID(), joinData.result, joinData.state);
|
||||
WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size);
|
||||
data << uint32(joinData.result); // Check Result
|
||||
data << uint32(joinData.state); // Check Value
|
||||
if (joinData.lockmap)
|
||||
data << uint32(joinData.result); // Check Result
|
||||
data << uint32(joinData.state); // Check Value
|
||||
if (!joinData.lockmap.empty())
|
||||
BuildPartyLockDungeonBlock(data, joinData.lockmap);
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -461,16 +457,16 @@ void WorldSession::SendLfgQueueStatus(uint32 dungeon, int32 waitTime, int32 avgW
|
||||
sLog.outDebug("SMSG_LFG_QUEUE_STATUS [" UI64FMTD "] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u", GetPlayer()->GetGUID(), dungeon, waitTime, avgWaitTime, waitTimeTanks, waitTimeHealer, waitTimeDps, queuedTime, tanks, healers, dps);
|
||||
|
||||
WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 +4 + 1 + 1 + 1 + 4);
|
||||
data << uint32(dungeon); // Dungeon
|
||||
data << int32(avgWaitTime); // Average Wait time
|
||||
data << int32(waitTime); // Wait Time
|
||||
data << int32(waitTimeTanks); // Wait Tanks
|
||||
data << int32(waitTimeHealer); // Wait Healers
|
||||
data << int32(waitTimeDps); // Wait Dps
|
||||
data << uint8(tanks); // Tanks needed
|
||||
data << uint8(healers); // Healers needed
|
||||
data << uint8(dps); // Dps needed
|
||||
data << uint32(queuedTime); // Player wait time in queue
|
||||
data << uint32(dungeon); // Dungeon
|
||||
data << int32(avgWaitTime); // Average Wait time
|
||||
data << int32(waitTime); // Wait Time
|
||||
data << int32(waitTimeTanks); // Wait Tanks
|
||||
data << int32(waitTimeHealer); // Wait Healers
|
||||
data << int32(waitTimeDps); // Wait Dps
|
||||
data << uint8(tanks); // Tanks needed
|
||||
data << uint8(healers); // Healers needed
|
||||
data << uint8(dps); // Dps needed
|
||||
data << uint32(queuedTime); // Player wait time in queue
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -479,12 +475,12 @@ void WorldSession::SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntr
|
||||
if (!rdungeonEntry || !sdungeonEntry || !qRew)
|
||||
return;
|
||||
|
||||
uint8 itemNum = qRew ? qRew->GetRewItemsCount() : 0;
|
||||
uint8 itemNum = uint8(qRew ? qRew->GetRewItemsCount() : 0);
|
||||
|
||||
sLog.outDebug("SMSG_LFG_PLAYER_REWARD [" UI64FMTD "] rdungeonEntry: %u - sdungeonEntry: %u - done: %u", GetPlayer()->GetGUID(), rdungeonEntry, sdungeonEntry, done);
|
||||
WorldPacket data(SMSG_LFG_PLAYER_REWARD, 4 + 4 + 1 + 4 + 4 + 4 + 4 + 4 + 1 + itemNum * (4 + 4 + 4));
|
||||
data << uint32(rdungeonEntry); // Random Dungeon Finished
|
||||
data << uint32(sdungeonEntry); // Dungeon Finished
|
||||
data << uint32(rdungeonEntry); // Random Dungeon Finished
|
||||
data << uint32(sdungeonEntry); // Dungeon Finished
|
||||
data << uint8(done);
|
||||
data << uint32(1);
|
||||
data << uint32(qRew->GetRewOrReqMoney());
|
||||
@@ -510,9 +506,10 @@ void WorldSession::SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntr
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendLfgBootPlayer(LfgPlayerBoot* pBoot)
|
||||
void WorldSession::SendLfgBootPlayer(const LfgPlayerBoot* pBoot)
|
||||
{
|
||||
int8 playerVote = pBoot->votes[GetPlayer()->GetGUIDLow()];
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
LfgAnswer playerVote = pBoot->votes.find(guid)->second;
|
||||
uint8 votesNum = 0;
|
||||
uint8 agreeNum = 0;
|
||||
uint32 secsleft = uint8((pBoot->cancelTime - time(NULL)) / 1000);
|
||||
@@ -526,30 +523,28 @@ void WorldSession::SendLfgBootPlayer(LfgPlayerBoot* pBoot)
|
||||
}
|
||||
}
|
||||
sLog.outDebug("SMSG_LFG_BOOT_PLAYER [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s",
|
||||
GetPlayer()->GetGUID(), uint8(pBoot->inProgress), uint8(playerVote != LFG_ANSWER_PENDING), uint8(playerVote == LFG_ANSWER_AGREE), pBoot->victim, votesNum, agreeNum, secsleft, pBoot->votedNeeded, pBoot->reason.c_str());
|
||||
guid, uint8(pBoot->inProgress), uint8(playerVote != LFG_ANSWER_PENDING), uint8(playerVote == LFG_ANSWER_AGREE), pBoot->victim, votesNum, agreeNum, secsleft, pBoot->votedNeeded, pBoot->reason.c_str());
|
||||
WorldPacket data(SMSG_LFG_BOOT_PLAYER, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + pBoot->reason.length());
|
||||
data << uint8(pBoot->inProgress); // Vote in progress
|
||||
data << uint8(playerVote != LFG_ANSWER_PENDING); // Did Vote
|
||||
data << uint8(playerVote == LFG_ANSWER_AGREE); // Agree
|
||||
data << uint64(pBoot->victim); // Victim GUID
|
||||
data << uint32(votesNum); // Total Votes
|
||||
data << uint32(agreeNum); // Agree Count
|
||||
data << uint32(secsleft); // Time Left
|
||||
data << uint32(pBoot->votedNeeded); // Needed Votes
|
||||
data << pBoot->reason.c_str(); // Kick reason
|
||||
data << uint8(pBoot->inProgress); // Vote in progress
|
||||
data << uint8(playerVote != LFG_ANSWER_PENDING); // Did Vote
|
||||
data << uint8(playerVote == LFG_ANSWER_AGREE); // Agree
|
||||
data << uint64(pBoot->victim); // Victim GUID
|
||||
data << uint32(votesNum); // Total Votes
|
||||
data << uint32(agreeNum); // Agree Count
|
||||
data << uint32(secsleft); // Time Left
|
||||
data << uint32(pBoot->votedNeeded); // Needed Votes
|
||||
data << pBoot->reason.c_str(); // Kick reason
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal* pProp)
|
||||
void WorldSession::SendLfgUpdateProposal(uint32 proposalId, const LfgProposal* pProp)
|
||||
{
|
||||
if (!pProp)
|
||||
return;
|
||||
|
||||
uint32 pLogGuid = GetPlayer()->GetGUIDLow();
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
|
||||
LfgProposalPlayerMap::const_iterator itPlayer = pProp->players.find(pLogGuid);
|
||||
if (itPlayer == pProp->players.end()) // Player MUST be in the proposal
|
||||
LfgProposalPlayerMap::const_iterator itPlayer = pProp->players.find(guid);
|
||||
if (itPlayer == pProp->players.end()) // Player MUST be in the proposal
|
||||
return;
|
||||
|
||||
LfgProposalPlayer* ppPlayer = itPlayer->second;
|
||||
@@ -569,7 +564,7 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal* pProp)
|
||||
sLog.outDebug("SMSG_LFG_PROPOSAL_UPDATE [" UI64FMTD "] state: %u", GetPlayer()->GetGUID(), pProp->state);
|
||||
WorldPacket data(SMSG_LFG_PROPOSAL_UPDATE, 4 + 1 + 4 + 4 + 1 + 1 + pProp->players.size() * (4 + 1 + 1 + 1 + 1 +1));
|
||||
|
||||
if (!isContinue) // Only show proposal dungeon if it's continue
|
||||
if (!isContinue) // Only show proposal dungeon if it's continue
|
||||
{
|
||||
LfgDungeonSet playerDungeons = sLFGMgr.GetSelectedDungeons(guid);
|
||||
if (playerDungeons.size())
|
||||
@@ -577,22 +572,22 @@ void WorldSession::SendLfgUpdateProposal(uint32 proposalId, LfgProposal* pProp)
|
||||
}
|
||||
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
|
||||
dungeonId = dungeon->Entry();
|
||||
data << uint32(dungeonId); // Dungeon
|
||||
data << uint8(pProp->state); // Result state
|
||||
data << uint32(proposalId); // Internal Proposal ID
|
||||
data << uint32(0); // Bosses killed - FIXME
|
||||
data << uint8(isSameDungeon); // Silent (show client window)
|
||||
data << uint8(pProp->players.size()); // Group size
|
||||
data << uint32(dungeonId); // Dungeon
|
||||
data << uint8(pProp->state); // Result state
|
||||
data << uint32(proposalId); // Internal Proposal ID
|
||||
data << uint32(0); // Bosses killed - FIXME
|
||||
data << uint8(isSameDungeon); // Silent (show client window)
|
||||
data << uint8(pProp->players.size()); // Group size
|
||||
|
||||
for (itPlayer = pProp->players.begin(); itPlayer != pProp->players.end(); ++itPlayer)
|
||||
{
|
||||
ppPlayer = itPlayer->second;
|
||||
data << uint32(ppPlayer->role); // Role
|
||||
data << uint8(itPlayer->first == pLogGuid); // Self player
|
||||
if (!ppPlayer->groupLowGuid) // Player not it a group
|
||||
data << uint32(ppPlayer->role); // Role
|
||||
data << uint8(itPlayer->first == guid); // Self player
|
||||
if (!ppPlayer->groupLowGuid) // Player not it a group
|
||||
{
|
||||
data << uint8(0); // Not in dungeon
|
||||
data << uint8(0); // Not same group
|
||||
data << uint8(0); // Not in dungeon
|
||||
data << uint8(0); // Not same group
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -609,7 +604,7 @@ void WorldSession::SendLfgUpdateSearch(bool update)
|
||||
{
|
||||
sLog.outDebug("SMSG_LFG_UPDATE_SEARCH [" UI64FMTD "] update: %u", GetPlayer()->GetGUID(), update ? 1 : 0);
|
||||
WorldPacket data(SMSG_LFG_UPDATE_SEARCH, 1);
|
||||
data << uint8(update); // In Lfg Queue?
|
||||
data << uint8(update); // In Lfg Queue?
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -632,7 +627,7 @@ void WorldSession::SendLfgTeleportError(uint8 err)
|
||||
{
|
||||
sLog.outDebug("SMSG_LFG_TELEPORT_DENIED [" UI64FMTD "] reason: %u", GetPlayer()->GetGUID(), err);
|
||||
WorldPacket data(SMSG_LFG_TELEPORT_DENIED, 4);
|
||||
data << uint32(err); // Error
|
||||
data << uint32(err); // Error
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
||||
@@ -768,16 +768,16 @@ class WorldSession
|
||||
void HandleLfrSearchOpcode(WorldPacket &recv_data);
|
||||
void HandleLfrLeaveOpcode(WorldPacket &recv_data);
|
||||
|
||||
void SendLfgUpdatePlayer(LfgUpdateData updateData);
|
||||
void SendLfgUpdateParty(LfgUpdateData updateData);
|
||||
void SendLfgUpdatePlayer(const LfgUpdateData& updateData);
|
||||
void SendLfgUpdateParty(const LfgUpdateData& updateData);
|
||||
void SendLfgRoleChosen(uint64 guid, uint8 roles);
|
||||
void SendLfgRoleCheckUpdate(LfgRoleCheck *pRoleCheck);
|
||||
void SendLfgRoleCheckUpdate(const LfgRoleCheck *pRoleCheck);
|
||||
void SendLfgUpdateSearch(bool update);
|
||||
void SendLfgJoinResult(LfgJoinResultData& joinData);
|
||||
void SendLfgJoinResult(const LfgJoinResultData& joinData);
|
||||
void SendLfgQueueStatus(uint32 dungeon, int32 waitTime, int32 avgWaitTime, int32 waitTimeTanks, int32 waitTimeHealer, int32 waitTimeDps, uint32 queuedTime, uint8 tanks, uint8 healers, uint8 dps);
|
||||
void SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntry, uint8 done, const LfgReward *reward, const Quest *qRew);
|
||||
void SendLfgBootPlayer(LfgPlayerBoot *pBoot);
|
||||
void SendLfgUpdateProposal(uint32 proposalId, LfgProposal *pProp);
|
||||
void SendLfgBootPlayer(const LfgPlayerBoot *pBoot);
|
||||
void SendLfgUpdateProposal(uint32 proposalId, const LfgProposal *pProp);
|
||||
void SendLfgDisabled();
|
||||
void SendLfgOfferContinue(uint32 dungeonEntry);
|
||||
void SendLfgTeleportError(uint8 err);
|
||||
|
||||
Reference in New Issue
Block a user