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:
@@ -20,6 +20,7 @@
|
|||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "Group.h"
|
#include "Group.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
#include "SocialMgr.h"
|
||||||
#include "LFGMgr.h"
|
#include "LFGMgr.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
#include "WorldPacket.h"
|
#include "WorldPacket.h"
|
||||||
@@ -54,6 +55,9 @@ LFGMgr::~LFGMgr()
|
|||||||
delete it->second;
|
delete it->second;
|
||||||
m_RoleChecks.clear();
|
m_RoleChecks.clear();
|
||||||
|
|
||||||
|
for (LfgDungeonMap::iterator it = m_CachedDungeonMap.begin(); it != m_CachedDungeonMap.end(); ++it)
|
||||||
|
delete it->second;
|
||||||
|
m_CachedDungeonMap.clear();
|
||||||
m_QueueInfoMap.clear();
|
m_QueueInfoMap.clear();
|
||||||
m_currentQueue.clear();
|
m_currentQueue.clear();
|
||||||
m_newToQueue.clear();
|
m_newToQueue.clear();
|
||||||
@@ -188,18 +192,13 @@ void LFGMgr::InitLFG()
|
|||||||
m_RewardDoneList.push_back(reward);
|
m_RewardDoneList.push_back(reward);
|
||||||
}
|
}
|
||||||
// Initialize dungeonMap
|
// Initialize dungeonMap
|
||||||
m_DungeonsMap[LFG_ALL_DUNGEONS] = GetAllDungeons();
|
GetAllDungeons();
|
||||||
m_DungeonsMap[LFG_RANDOM_CLASSIC] = GetDungeonsByRandom(LFG_RANDOM_CLASSIC);
|
|
||||||
m_DungeonsMap[LFG_RANDOM_BC_NORMAL] = GetDungeonsByRandom(LFG_RANDOM_BC_NORMAL);
|
|
||||||
m_DungeonsMap[LFG_RANDOM_BC_HEROIC] = GetDungeonsByRandom(LFG_RANDOM_BC_HEROIC);
|
|
||||||
m_DungeonsMap[LFG_RANDOM_LK_NORMAL] = GetDungeonsByRandom(LFG_RANDOM_LK_NORMAL);
|
|
||||||
m_DungeonsMap[LFG_RANDOM_LK_HEROIC] = GetDungeonsByRandom(LFG_RANDOM_LK_HEROIC);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the player to lfg queue
|
/// Adds the player/group to lfg queue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plr">Player</param>
|
/// <param name="Player *">Player</param>
|
||||||
void LFGMgr::Join(Player *plr)
|
void LFGMgr::Join(Player *plr)
|
||||||
{
|
{
|
||||||
Group *grp = plr->GetGroup();
|
Group *grp = plr->GetGroup();
|
||||||
@@ -609,7 +608,6 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag /*= true
|
|||||||
return tank == LFG_TANKS_NEEDED && healer == LFG_HEALERS_NEEDED && damage == LFG_DPS_NEEDED;
|
return tank == LFG_TANKS_NEEDED && healer == LFG_HEALERS_NEEDED && damage == LFG_DPS_NEEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------//
|
// --------------------------------------------------------------------------//
|
||||||
// Packet Functions
|
// Packet Functions
|
||||||
// --------------------------------------------------------------------------//
|
// --------------------------------------------------------------------------//
|
||||||
@@ -617,9 +615,8 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag /*= true
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build lfgRolecheck packet
|
/// Build lfgRolecheck packet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data">WorldPacket</param>
|
/// <param name="WorldPacket &">WorldPacket</param>
|
||||||
/// <param name="plr">Player</param>
|
/// <param name="LfgRoleCheck *">RoleCheck info</param>
|
||||||
/// <param name="status">Player status in LFG system</param>
|
|
||||||
void LFGMgr::BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck)
|
void LFGMgr::BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck)
|
||||||
{
|
{
|
||||||
ASSERT(pRoleCheck);
|
ASSERT(pRoleCheck);
|
||||||
@@ -640,14 +637,12 @@ void LFGMgr::BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck)
|
|||||||
data << uint8(pRoleCheck->roles.size()); // Players in group
|
data << uint8(pRoleCheck->roles.size()); // Players in group
|
||||||
// Leader info MUST be sent 1st :S
|
// Leader info MUST be sent 1st :S
|
||||||
roles = pRoleCheck->roles[pRoleCheck->leader];
|
roles = pRoleCheck->roles[pRoleCheck->leader];
|
||||||
data << uint64(pRoleCheck->leader); // Guid
|
uint64 guid = MAKE_NEW_GUID(pRoleCheck->leader, 0, HIGHGUID_PLAYER);
|
||||||
|
data << uint64(guid); // Guid
|
||||||
data << uint8(roles > 0); // Ready
|
data << uint8(roles > 0); // Ready
|
||||||
data << uint32(roles); // Roles
|
data << uint32(roles); // Roles
|
||||||
plr = sObjectMgr.GetPlayer(pRoleCheck->leader);
|
plr = sObjectMgr.GetPlayer(guid);
|
||||||
if (plr)
|
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||||
data << uint8(plr->getLevel()); // Level
|
|
||||||
else
|
|
||||||
data << uint8(0);
|
|
||||||
|
|
||||||
for (LfgRolesMap::const_iterator itPlayers = pRoleCheck->roles.begin(); itPlayers != pRoleCheck->roles.end(); ++itPlayers)
|
for (LfgRolesMap::const_iterator itPlayers = pRoleCheck->roles.begin(); itPlayers != pRoleCheck->roles.end(); ++itPlayers)
|
||||||
{
|
{
|
||||||
@@ -655,43 +650,58 @@ void LFGMgr::BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
roles = itPlayers->second;
|
roles = itPlayers->second;
|
||||||
data << uint64(itPlayers->first); // Guid
|
guid = MAKE_NEW_GUID(itPlayers->first, 0, HIGHGUID_PLAYER);
|
||||||
|
data << uint64(guid); // Guid
|
||||||
data << uint8(roles > 0); // Ready
|
data << uint8(roles > 0); // Ready
|
||||||
data << uint32(roles); // Roles
|
data << uint32(roles); // Roles
|
||||||
plr = sObjectMgr.GetPlayer(pRoleCheck->leader);
|
plr = sObjectMgr.GetPlayer(guid);
|
||||||
if (plr)
|
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||||
data << uint8(plr->getLevel()); // Level
|
|
||||||
else
|
|
||||||
data << uint8(0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build and Send LFG lock player info and reward
|
/// Build and Send LFG lock player info and reward
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plr">Player</param>
|
/// <param name="Player *">Player</param>
|
||||||
void LFGMgr::SendLfgPlayerInfo(Player *plr)
|
void LFGMgr::SendLfgPlayerInfo(Player *plr)
|
||||||
{
|
{
|
||||||
uint32 rsize = 0;
|
uint32 rsize = 0;
|
||||||
uint32 lsize = 0;
|
uint32 lsize = 0;
|
||||||
|
bool done;
|
||||||
LfgDungeonSet *randomlist = GetRandomDungeons(plr->getLevel(), plr->GetSession()->Expansion());
|
LfgDungeonSet *randomlist = GetRandomDungeons(plr->getLevel(), plr->GetSession()->Expansion());
|
||||||
LfgLockStatusSet *lockSet = GetPlayerLockStatusDungeons(plr, m_DungeonsMap[LFG_ALL_DUNGEONS]);
|
LfgLockStatusSet *lockSet = GetPlayerLockStatusDungeons(plr, GetAllDungeons());
|
||||||
|
|
||||||
if (randomlist)
|
if (randomlist)
|
||||||
rsize = randomlist->size();
|
rsize = randomlist->size();
|
||||||
|
|
||||||
if (lockSet)
|
if (lockSet)
|
||||||
lsize = lockSet->size();
|
lsize = lockSet->size();
|
||||||
|
|
||||||
sLog.outDebug("SMSG_LFG_PLAYER_INFO");
|
sLog.outDebug("SMSG_LFG_PLAYER_INFO");
|
||||||
WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (4 + 4));
|
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 (!randomlist)
|
if (!randomlist)
|
||||||
data << uint8(0);
|
data << uint8(0);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
LfgReward *reward;
|
||||||
data << uint8(randomlist->size()); // Random Dungeon count
|
data << uint8(randomlist->size()); // Random Dungeon count
|
||||||
for (LfgDungeonSet::iterator it = randomlist->begin(); it != randomlist->end(); ++it)
|
for (LfgDungeonSet::iterator it = randomlist->begin(); it != randomlist->end(); ++it)
|
||||||
{
|
{
|
||||||
|
done = plr->isLfgDungeonDone(*it);
|
||||||
|
reward = GetRandomDungeonReward(*it, done, plr->getLevel());
|
||||||
data << uint32(*it); // Entry
|
data << uint32(*it); // Entry
|
||||||
BuildRewardBlock(data, *it, plr);
|
data << uint8(done);
|
||||||
|
data << uint32(reward->baseMoney);
|
||||||
|
data << uint32(reward->baseXP);
|
||||||
|
data << uint32(reward->variableMoney);
|
||||||
|
data << uint32(reward->variableXP);
|
||||||
|
data << uint8(reward->itemId != 0);
|
||||||
|
if (reward->itemId)
|
||||||
|
{
|
||||||
|
data << uint32(reward->itemId);
|
||||||
|
data << uint32(reward->displayId);
|
||||||
|
data << uint32(reward->stackCount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
randomlist->clear();
|
randomlist->clear();
|
||||||
delete randomlist;
|
delete randomlist;
|
||||||
@@ -703,10 +713,10 @@ void LFGMgr::SendLfgPlayerInfo(Player *plr)
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build and Send LFG lock party info and reward
|
/// Build and Send LFG lock party info and reward
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plr">Player</param>
|
/// <param name="Player *">Player</param>
|
||||||
void LFGMgr::SendLfgPartyInfo(Player *plr)
|
void LFGMgr::SendLfgPartyInfo(Player *plr)
|
||||||
{
|
{
|
||||||
if (LfgLockStatusMap *lockMap = GetPartyLockStatusDungeons(plr, m_DungeonsMap[LFG_ALL_DUNGEONS]))
|
if (LfgLockStatusMap *lockMap = GetPartyLockStatusDungeons(plr, GetAllDungeons()))
|
||||||
{
|
{
|
||||||
uint32 size = 0;
|
uint32 size = 0;
|
||||||
for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it)
|
for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it)
|
||||||
@@ -718,41 +728,11 @@ void LFGMgr::SendLfgPartyInfo(Player *plr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Build Reward packet structure for a given dungeon
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data">WorldPacket</param>
|
|
||||||
/// <param name="dungeon">Dungeon entry</param>
|
|
||||||
/// <param name="plr">Player</param>
|
|
||||||
void LFGMgr::BuildRewardBlock(WorldPacket &data, uint32 dungeon, Player *plr)
|
|
||||||
{
|
|
||||||
bool done = plr->isLfgDungeonDone(dungeon);
|
|
||||||
LfgReward *reward = GetRandomDungeonReward(dungeon, done, plr->getLevel());
|
|
||||||
|
|
||||||
if (!reward)
|
|
||||||
return;
|
|
||||||
|
|
||||||
data << uint8(done);
|
|
||||||
if (data.GetOpcode() == SMSG_LFG_PLAYER_REWARD)
|
|
||||||
data << uint32(reward->strangers);
|
|
||||||
data << uint32(reward->baseMoney);
|
|
||||||
data << uint32(reward->baseXP);
|
|
||||||
data << uint32(reward->variableMoney);
|
|
||||||
data << uint32(reward->variableXP);
|
|
||||||
data << uint8(reward->itemId != 0);
|
|
||||||
if (reward->itemId)
|
|
||||||
{
|
|
||||||
data << uint32(reward->itemId);
|
|
||||||
data << uint32(reward->displayId);
|
|
||||||
data << uint32(reward->stackCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build Party Dungeon lock status packet
|
/// Build Party Dungeon lock status packet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data">WorldPacket</param>
|
/// <param name="WorldPacket &">WorldPacket</param>
|
||||||
/// <param name="lock">lock status map</param>
|
/// <param name="LfgLockStatusMap *">lock status map</param>
|
||||||
void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap)
|
void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap)
|
||||||
{
|
{
|
||||||
ASSERT(lockMap);
|
ASSERT(lockMap);
|
||||||
@@ -760,15 +740,13 @@ void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *loc
|
|||||||
data << uint8(lockMap->size());
|
data << uint8(lockMap->size());
|
||||||
|
|
||||||
LfgLockStatusSet *lockSet;
|
LfgLockStatusSet *lockSet;
|
||||||
uint64 guid;
|
|
||||||
for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it)
|
for (LfgLockStatusMap::const_iterator it = lockMap->begin(); it != lockMap->end(); ++it)
|
||||||
{
|
{
|
||||||
guid = it->first;
|
|
||||||
lockSet = it->second;
|
lockSet = it->second;
|
||||||
if (!lockSet)
|
if (!lockSet)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
data << uint64(guid); // Player guid
|
data << uint64(MAKE_NEW_GUID(it->first, 0, HIGHGUID_PLAYER)); // Player guid
|
||||||
BuildPlayerLockDungeonBlock(data, lockSet);
|
BuildPlayerLockDungeonBlock(data, lockSet);
|
||||||
}
|
}
|
||||||
lockMap->clear();
|
lockMap->clear();
|
||||||
@@ -778,8 +756,8 @@ void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *loc
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Build Player Dungeon lock status packet
|
/// Build Player Dungeon lock status packet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data">WorldPacket</param>
|
/// <param name="WorldPacket &">WorldPacket</param>
|
||||||
/// <param name="lock">lock status list</param>
|
/// <param name="LfgLockStatusSet *">lock status list</param>
|
||||||
void LFGMgr::BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet)
|
void LFGMgr::BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet)
|
||||||
{
|
{
|
||||||
ASSERT(lockSet);
|
ASSERT(lockSet);
|
||||||
@@ -794,40 +772,28 @@ void LFGMgr::BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lo
|
|||||||
delete lockSet;
|
delete lockSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------//
|
// --------------------------------------------------------------------------//
|
||||||
// Auxiliar Functions
|
// Auxiliar Functions
|
||||||
// --------------------------------------------------------------------------//
|
// --------------------------------------------------------------------------//
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all Group members list of dungeons that can't be done and reason
|
/// Given a group get the dungeons that can't be done and reason
|
||||||
/// leader excluded as the list given is he list he can do
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="grp">Group</param>
|
/// <param name="PlayerSet *">Players to check lock status</param>
|
||||||
/// <param name="dungeons">Dungeons to check</param>
|
/// <param name="LfgDungeonSet *">Dungeons to check</param>
|
||||||
/// <returns>LfgLockStatusMap*</returns>
|
/// <returns>LfgLockStatusMap*</returns>
|
||||||
LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons)
|
LfgLockStatusMap* LFGMgr::GetGroupLockStatusDungeons(PlayerSet *pPlayers, LfgDungeonSet *dungeons)
|
||||||
{
|
{
|
||||||
ASSERT(plr);
|
ASSERT(pPlayers);
|
||||||
ASSERT(dungeons);
|
ASSERT(dungeons);
|
||||||
Group *grp = plr->GetGroup();
|
|
||||||
if (!grp)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
Player *plrg;
|
|
||||||
LfgLockStatusSet *dungeonSet = NULL;
|
LfgLockStatusSet *dungeonSet = NULL;
|
||||||
LfgLockStatusMap *dungeonMap = new LfgLockStatusMap();
|
LfgLockStatusMap *dungeonMap = new LfgLockStatusMap();
|
||||||
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
for (PlayerSet::const_iterator itr = pPlayers->begin(); itr != pPlayers->end(); ++itr)
|
||||||
{
|
{
|
||||||
plrg = itr->getSource();
|
dungeonSet = GetPlayerLockStatusDungeons(*itr, dungeons);
|
||||||
if (!plrg || plrg == plr)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
dungeonSet = GetPlayerLockStatusDungeons(plrg, dungeons);
|
|
||||||
if (dungeonSet)
|
if (dungeonSet)
|
||||||
(*dungeonMap)[plrg->GetGUID()] = dungeonSet;
|
(*dungeonMap)[(*itr)->GetGUID()] = dungeonSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dungeonMap->size())
|
if (!dungeonMap->size())
|
||||||
@@ -838,11 +804,40 @@ LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet
|
|||||||
return dungeonMap;
|
return dungeonMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get all Group members list of dungeons that can't be done and reason
|
||||||
|
/// leader excluded as the list given is he list he can do
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="Player *">Player to get Party Lock info</param>
|
||||||
|
/// <param name="LfgDungeonSet *">Dungeons to check</param>
|
||||||
|
/// <returns>LfgLockStatusMap*</returns>
|
||||||
|
LfgLockStatusMap* LFGMgr::GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons)
|
||||||
|
{
|
||||||
|
ASSERT(plr);
|
||||||
|
ASSERT(dungeons);
|
||||||
|
Group *grp = plr->GetGroup();
|
||||||
|
if (!grp)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
PlayerSet *pPlayers = new PlayerSet();
|
||||||
|
Player *plrg;
|
||||||
|
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
|
{
|
||||||
|
plrg = itr->getSource();
|
||||||
|
if (plrg && plrg != plr)
|
||||||
|
pPlayers->insert(plrg);
|
||||||
|
}
|
||||||
|
LfgLockStatusMap *dungeonMap = GetGroupLockStatusDungeons(pPlayers, dungeons);
|
||||||
|
pPlayers->clear();
|
||||||
|
delete pPlayers;
|
||||||
|
return dungeonMap;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get list of dungeons player can't do and reasons
|
/// Get list of dungeons player can't do and reasons
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="plr">Player</param>
|
/// <param name="Player *">Player to check lock status</param>
|
||||||
/// <param name="dungeons">Dungeons to check</param>
|
/// <param name="LfgDungeonSet *">Dungeons to check</param>
|
||||||
/// <returns>LfgLockStatusSet*</returns>
|
/// <returns>LfgLockStatusSet*</returns>
|
||||||
LfgLockStatusSet* LFGMgr::GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons)
|
LfgLockStatusSet* LFGMgr::GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons)
|
||||||
{
|
{
|
||||||
@@ -906,58 +901,55 @@ LfgLockStatusSet* LFGMgr::GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet
|
|||||||
/// <returns>LfgDungeonSet*</returns>
|
/// <returns>LfgDungeonSet*</returns>
|
||||||
LfgDungeonSet* LFGMgr::GetAllDungeons()
|
LfgDungeonSet* LFGMgr::GetAllDungeons()
|
||||||
{
|
{
|
||||||
LfgDungeonSet *dungeons = new LfgDungeonSet();
|
LfgDungeonSet *alldungeons = m_CachedDungeonMap[0];
|
||||||
|
|
||||||
|
if (alldungeons)
|
||||||
|
return alldungeons;
|
||||||
|
|
||||||
|
LfgDungeonSet *dungeons;
|
||||||
LFGDungeonEntry const *dungeon;
|
LFGDungeonEntry const *dungeon;
|
||||||
|
|
||||||
|
alldungeons = new LfgDungeonSet();
|
||||||
|
m_CachedDungeonMap[0] = alldungeons;
|
||||||
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
|
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
|
||||||
{
|
{
|
||||||
dungeon = sLFGDungeonStore.LookupEntry(i);
|
dungeon = sLFGDungeonStore.LookupEntry(i);
|
||||||
if (!dungeon || dungeon->type == LFG_TYPE_ZONE)
|
if (!dungeon || dungeon->type == LFG_TYPE_ZONE)
|
||||||
continue;
|
continue;
|
||||||
dungeons->insert(dungeon->ID);
|
dungeons = m_CachedDungeonMap[dungeon->grouptype];
|
||||||
}
|
if (!dungeons)
|
||||||
if (!dungeons->size())
|
|
||||||
{
|
{
|
||||||
delete dungeons;
|
dungeons = new LfgDungeonSet();
|
||||||
return NULL;
|
m_CachedDungeonMap[dungeon->grouptype] = dungeons;
|
||||||
}
|
}
|
||||||
else
|
if (dungeon->type != LFG_TYPE_RANDOM)
|
||||||
return dungeons;
|
dungeons->insert(dungeon->ID);
|
||||||
|
alldungeons->insert(dungeon->ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return alldungeons;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the dungeon list that can be done given a random dungeon entry.
|
/// Get the dungeon list that can be done given a random dungeon entry.
|
||||||
|
/// Special case: randomdungeon == 0 then will return all dungeons
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="randomdungeon">Random dungeon entry</param>
|
/// <param name="uint32">Random dungeon entry</param>
|
||||||
/// <returns>LfgDungeonSet*</returns>
|
/// <returns>LfgDungeonSet*</returns>
|
||||||
LfgDungeonSet* LFGMgr::GetDungeonsByRandom(uint32 randomdungeon)
|
LfgDungeonSet* LFGMgr::GetDungeonsByRandom(uint32 randomdungeon)
|
||||||
{
|
{
|
||||||
LFGDungeonEntry const *dungeon = sLFGDungeonStore.LookupEntry(randomdungeon);
|
uint8 groupType = 0;
|
||||||
if (!dungeon)
|
if (LFGDungeonEntry const *dungeon = sLFGDungeonStore.LookupEntry(randomdungeon))
|
||||||
return NULL;
|
groupType = dungeon->grouptype;
|
||||||
|
|
||||||
uint32 grouptype = dungeon->grouptype;
|
return m_CachedDungeonMap[groupType];
|
||||||
LfgDungeonSet *random = new LfgDungeonSet();
|
|
||||||
for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i)
|
|
||||||
{
|
|
||||||
dungeon = sLFGDungeonStore.LookupEntry(i);
|
|
||||||
if (!dungeon || dungeon->type == LFG_TYPE_RANDOM || dungeon->grouptype != grouptype)
|
|
||||||
continue;
|
|
||||||
random->insert(dungeon->ID);
|
|
||||||
}
|
|
||||||
if (!random->size())
|
|
||||||
{
|
|
||||||
delete random;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return random;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the random dungeon list that can be done at a certain level and expansion.
|
/// Get the random dungeon list that can be done at a certain level and expansion.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level">Player level</param>
|
/// <param name="uint8">Player level</param>
|
||||||
/// <param name="expansion">Player account expansion</param>
|
/// <param name="uint8">Player account expansion</param>
|
||||||
/// <returns>LfgDungeonSet*</returns>
|
/// <returns>LfgDungeonSet*</returns>
|
||||||
LfgDungeonSet* LFGMgr::GetRandomDungeons(uint8 level, uint8 expansion)
|
LfgDungeonSet* LFGMgr::GetRandomDungeons(uint8 level, uint8 expansion)
|
||||||
{
|
{
|
||||||
@@ -974,11 +966,12 @@ LfgDungeonSet* LFGMgr::GetRandomDungeons(uint8 level, uint8 expansion)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the reward of a given random dungeon
|
/// Get the reward of a given random dungeon at a certain level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dungeon">random dungeon id</param>
|
/// <param name="uint32">random dungeon id</param>
|
||||||
/// <param name="done">Dungeon previously done</param>
|
/// <param name="bool">Dungeon previously done</param>
|
||||||
/// <returns></returns>
|
/// <param name="uint8">Player level</param>
|
||||||
|
/// <returns>LfgReward*</returns>
|
||||||
LfgReward* LFGMgr::GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level)
|
LfgReward* LFGMgr::GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level)
|
||||||
{
|
{
|
||||||
uint8 index = 0;
|
uint8 index = 0;
|
||||||
@@ -1022,7 +1015,7 @@ LfgReward* LFGMgr::GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Given a Dungeon id returns the dungeon Group Type
|
/// Given a Dungeon id returns the dungeon Group Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dungeonId">Dungeon id</param>
|
/// <param name="uint32">Dungeon id</param>
|
||||||
/// <returns>uint8: GroupType</returns>
|
/// <returns>uint8: GroupType</returns>
|
||||||
uint8 LFGMgr::GetDungeonGroupType(uint32 dungeonId)
|
uint8 LFGMgr::GetDungeonGroupType(uint32 dungeonId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ enum LfgType
|
|||||||
|
|
||||||
enum LfgGroupType
|
enum LfgGroupType
|
||||||
{
|
{
|
||||||
|
LFG_GROUPTYPE_ALL = 0, // Internal use, represents all groups.
|
||||||
LFG_GROUPTYPE_CLASSIC = 1,
|
LFG_GROUPTYPE_CLASSIC = 1,
|
||||||
LFG_GROUPTYPE_BC_NORMAL = 2,
|
LFG_GROUPTYPE_BC_NORMAL = 2,
|
||||||
LFG_GROUPTYPE_BC_HEROIC = 3,
|
LFG_GROUPTYPE_BC_HEROIC = 3,
|
||||||
@@ -107,6 +108,7 @@ enum LfgRoleCheckResult
|
|||||||
LFG_ROLECHECK_NO_ROLE = 6, // Someone selected no role
|
LFG_ROLECHECK_NO_ROLE = 6, // Someone selected no role
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO: Remove me, will not be needed when Reward moved to quest system
|
||||||
enum LfgRandomDungeonEntries
|
enum LfgRandomDungeonEntries
|
||||||
{
|
{
|
||||||
LFG_ALL_DUNGEONS = 0,
|
LFG_ALL_DUNGEONS = 0,
|
||||||
@@ -182,15 +184,10 @@ struct LfgReward
|
|||||||
uint32 stackCount;
|
uint32 stackCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::set<LfgLockStatus*> LfgLockStatusSet;
|
typedef std::map<uint32, uint8> LfgRolesMap;
|
||||||
typedef std::vector<LfgReward*> LfgRewardList;
|
typedef std::map<uint32, int8> LfgAnswerMap;
|
||||||
typedef std::map<uint64, LfgLockStatusSet*> LfgLockStatusMap;
|
|
||||||
typedef std::map<uint32, LfgDungeonSet*> LfgDungeonMap;
|
|
||||||
|
|
||||||
typedef std::map<uint64, int8> LfgAnswerMap;
|
|
||||||
typedef std::list<uint64> LfgGuidList;
|
typedef std::list<uint64> LfgGuidList;
|
||||||
typedef std::map<uint64, uint8> LfgRolesMap;
|
typedef std::map<uint32, LfgDungeonSet*> LfgDungeonMap;
|
||||||
typedef std::set<uint64> LfgGuidSet;
|
|
||||||
|
|
||||||
// Stores player or group queue info
|
// Stores player or group queue info
|
||||||
struct LfgQueueInfo
|
struct LfgQueueInfo
|
||||||
@@ -211,56 +208,63 @@ struct LfgRoleCheck
|
|||||||
LfgRolesMap roles;
|
LfgRolesMap roles;
|
||||||
LfgRoleCheckResult result;
|
LfgRoleCheckResult result;
|
||||||
LfgDungeonSet dungeons;
|
LfgDungeonSet dungeons;
|
||||||
uint64 leader;
|
uint32 leader;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::set<Player*> PlayerSet;
|
||||||
|
typedef std::set<LfgLockStatus*> LfgLockStatusSet;
|
||||||
|
typedef std::vector<LfgReward*> LfgRewardList;
|
||||||
|
typedef std::map<uint32, LfgReward*> LfgRewardMap;
|
||||||
|
typedef std::map<uint32, LfgLockStatusSet*> LfgLockStatusMap;
|
||||||
typedef std::map<uint64, LfgQueueInfo*> LfgQueueInfoMap;
|
typedef std::map<uint64, LfgQueueInfo*> LfgQueueInfoMap;
|
||||||
typedef std::map<uint32, LfgRoleCheck*> LfgRoleCheckMap;
|
typedef std::map<uint32, LfgRoleCheck*> LfgRoleCheckMap;
|
||||||
|
typedef std::list<Player *> LfgPlayerList;
|
||||||
|
|
||||||
class LFGMgr
|
class LFGMgr
|
||||||
{
|
{
|
||||||
friend class ACE_Singleton<LFGMgr, ACE_Null_Mutex>;
|
friend class ACE_Singleton<LFGMgr, ACE_Null_Mutex>;
|
||||||
LFGMgr();
|
|
||||||
public:
|
public:
|
||||||
|
LFGMgr();
|
||||||
~LFGMgr();
|
~LFGMgr();
|
||||||
|
|
||||||
void InitLFG();
|
void InitLFG();
|
||||||
void SendLfgPlayerInfo(Player *plr);
|
|
||||||
void SendLfgPartyInfo(Player *plr);
|
|
||||||
void Join(Player *plr);
|
void Join(Player *plr);
|
||||||
void Leave(Player *plr, Group *grp = NULL);
|
void Leave(Player *plr, Group *grp = NULL);
|
||||||
void UpdateRoleCheck(Group *grp, Player *plr = NULL);
|
void UpdateRoleCheck(Group *grp, Player *plr = NULL);
|
||||||
void Update(uint32 diff);
|
void Update(uint32 diff);
|
||||||
|
|
||||||
|
void SendLfgPlayerInfo(Player *plr);
|
||||||
|
void SendLfgPartyInfo(Player *plr);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck);
|
void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck);
|
||||||
void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr);
|
void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr);
|
||||||
void BuildRewardBlock(WorldPacket &data, uint32 dungeon, Player *plr);
|
|
||||||
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet);
|
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet);
|
||||||
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap);
|
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap);
|
||||||
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
|
||||||
|
|
||||||
void AddToQueue(uint64 guid, LfgRolesMap *roles, LfgDungeonSet *dungeons);
|
void AddToQueue(uint64 guid, LfgRolesMap *roles, LfgDungeonSet *dungeons);
|
||||||
bool RemoveFromQueue(uint64 guid);
|
bool RemoveFromQueue(uint64 guid);
|
||||||
bool isRandomDungeon(uint32 dungeonId);
|
bool isRandomDungeon(uint32 dungeonId);
|
||||||
|
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
||||||
|
|
||||||
|
LfgLockStatusMap* GetGroupLockStatusDungeons(PlayerSet *pPlayers, LfgDungeonSet *dungeons);
|
||||||
LfgLockStatusMap* GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
LfgLockStatusMap* GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
||||||
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
||||||
LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion);
|
|
||||||
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
|
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
|
||||||
|
LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion);
|
||||||
LfgDungeonSet* GetAllDungeons();
|
LfgDungeonSet* GetAllDungeons();
|
||||||
LfgReward* GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level);
|
LfgReward* GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level);
|
||||||
uint8 GetDungeonGroupType(uint32 dungeon);
|
uint8 GetDungeonGroupType(uint32 dungeon);
|
||||||
|
|
||||||
LfgRewardList m_RewardList;
|
LfgRewardList m_RewardList; // TODO: Change it to list of quests
|
||||||
LfgRewardList m_RewardDoneList;
|
LfgRewardList m_RewardDoneList; // TODO: Change it to list of quests
|
||||||
LfgDungeonMap m_DungeonsMap;
|
LfgDungeonMap m_CachedDungeonMap; // Stores all dungeons by groupType
|
||||||
LfgQueueInfoMap m_QueueInfoMap; // Queued groups
|
LfgQueueInfoMap m_QueueInfoMap; // Queued groups
|
||||||
LfgGuidList m_currentQueue; // Ordered list. Used to find groups
|
LfgGuidList m_currentQueue; // Ordered list. Used to find groups
|
||||||
LfgGuidList m_newToQueue; // New groups to add to queue;
|
LfgGuidList m_newToQueue; // New groups to add to queue;
|
||||||
|
|
||||||
LfgRoleCheckMap m_RoleChecks; // Current Role checks
|
LfgRoleCheckMap m_RoleChecks; // Current Role checks
|
||||||
uint32 m_QueueTimer; // used to check interval of update
|
uint32 m_QueueTimer; // used to check interval of update
|
||||||
|
uint32 m_lfgProposalId; // used as internal counter for proposals
|
||||||
int32 m_avgWaitTime;
|
int32 m_avgWaitTime;
|
||||||
int32 m_waitTimeTanks;
|
int32 m_waitTimeTanks;
|
||||||
int32 m_waitTimeHealer;
|
int32 m_waitTimeHealer;
|
||||||
|
|||||||
@@ -63,19 +63,23 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data)
|
|||||||
void WorldSession::HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/)
|
void WorldSession::HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/)
|
||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_LFG_LEAVE");
|
sLog.outDebug("CMSG_LFG_LEAVE");
|
||||||
|
Group *grp = GetPlayer()->GetGroup();
|
||||||
|
|
||||||
// Check cheating - only leader can leave the queue
|
// Check cheating - only leader can leave the queue
|
||||||
if (Group *grp = GetPlayer()->GetGroup())
|
if (!grp || grp->GetLeaderGUID() == GetPlayer()->GetGUID())
|
||||||
{
|
|
||||||
if (grp->GetLeaderGUID() != GetPlayer()->GetGUID())
|
|
||||||
return;
|
|
||||||
else
|
|
||||||
sLFGMgr.Leave(GetPlayer(), grp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
sLFGMgr.Leave(GetPlayer());
|
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)
|
void WorldSession::HandleLfgSetRolesOpcode(WorldPacket &recv_data)
|
||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_LFG_SET_ROLES");
|
sLog.outDebug("CMSG_LFG_SET_ROLES");
|
||||||
@@ -100,6 +104,22 @@ void WorldSession::HandleSetLfgCommentOpcode(WorldPacket & recv_data)
|
|||||||
GetPlayer()->SetLfgComment(comment);
|
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*/)
|
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data*/)
|
||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_LFD_PLAYER_LOCK_INFO_REQUEST");
|
sLog.outDebug("CMSG_LFD_PLAYER_LOCK_INFO_REQUEST");
|
||||||
@@ -109,7 +129,22 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data
|
|||||||
void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket &/*recv_data*/)
|
void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket &/*recv_data*/)
|
||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_LFD_PARTY_LOCK_INFO_REQUEST");
|
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)
|
void WorldSession::SendLfgUpdatePlayer(uint8 updateType)
|
||||||
@@ -207,7 +242,7 @@ void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
|
|||||||
{
|
{
|
||||||
sLog.outDebug("SMSG_LFG_ROLE_CHOSEN");
|
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 << uint64(guid); // Guid
|
||||||
data << uint8(roles > 0); // Ready
|
data << uint8(roles > 0); // Ready
|
||||||
data << uint32(roles); // Roles
|
data << uint32(roles); // Roles
|
||||||
@@ -221,7 +256,7 @@ void WorldSession::SendLfgJoinResult(uint8 checkResult, uint8 checkValue)
|
|||||||
|
|
||||||
sLog.outDebug("SMSG_LFG_JOIN_RESULT");
|
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(checkResult); // Check Result
|
||||||
data << uint32(checkValue); // Check Value
|
data << uint32(checkValue); // Check Value
|
||||||
SendPacket(&data);
|
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)
|
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");
|
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(dungeon); // Dungeon
|
||||||
data << uint32(avgWaitTime); // Average Wait time
|
data << uint32(avgWaitTime); // Average Wait time
|
||||||
@@ -249,7 +284,32 @@ void WorldSession::SendLfgUpdateSearch(bool update)
|
|||||||
{
|
{
|
||||||
sLog.outDebug("SMSG_LFG_UPDATE_SEARCH");
|
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?
|
data << uint8(update); // In Lfg Queue?
|
||||||
SendPacket(&data);
|
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);
|
||||||
|
}
|
||||||
@@ -890,11 +890,11 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
|
|||||||
/*0x35B*/ { "SMSG_ARENA_TEAM_STATS", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
/*0x35B*/ { "SMSG_ARENA_TEAM_STATS", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||||
/*0x35C*/ { "CMSG_LFG_JOIN", STATUS_LOGGEDIN, &WorldSession::HandleLfgJoinOpcode },
|
/*0x35C*/ { "CMSG_LFG_JOIN", STATUS_LOGGEDIN, &WorldSession::HandleLfgJoinOpcode },
|
||||||
/*0x35D*/ { "CMSG_LFG_LEAVE", STATUS_LOGGEDIN, &WorldSession::HandleLfgLeaveOpcode },
|
/*0x35D*/ { "CMSG_LFG_LEAVE", STATUS_LOGGEDIN, &WorldSession::HandleLfgLeaveOpcode },
|
||||||
/*0x35E*/ { "CMSG_SEARCH_LFG_JOIN", STATUS_LOGGEDIN, &WorldSession::Handle_NULL },
|
/*0x35E*/ { "CMSG_SEARCH_LFG_JOIN", STATUS_LOGGEDIN, &WorldSession::HandleLfrSearchOpcode },
|
||||||
/*0x35F*/ { "CMSG_SEARCH_LFG_LEAVE", STATUS_LOGGEDIN, &WorldSession::Handle_NULL },
|
/*0x35F*/ { "CMSG_SEARCH_LFG_LEAVE", STATUS_LOGGEDIN, &WorldSession::HandleLfrLeaveOpcode },
|
||||||
/*0x360*/ { "SMSG_UPDATE_LFG_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
/*0x360*/ { "SMSG_UPDATE_LFG_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||||
/*0x361*/ { "SMSG_LFG_PROPOSAL_UPDATE", 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 },
|
/*0x363*/ { "SMSG_LFG_ROLE_CHECK_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||||
/*0x364*/ { "SMSG_LFG_JOIN_RESULT", 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 },
|
/*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 },
|
/*0x369*/ { "SMSG_LFG_UPDATE_LIST", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||||
/*0x36A*/ { "CMSG_LFG_SET_ROLES", STATUS_LOGGEDIN, &WorldSession::HandleLfgSetRolesOpcode },
|
/*0x36A*/ { "CMSG_LFG_SET_ROLES", STATUS_LOGGEDIN, &WorldSession::HandleLfgSetRolesOpcode },
|
||||||
/*0x36B*/ { "CMSG_LFG_SET_NEEDS", STATUS_LOGGEDIN, &WorldSession::Handle_NULL },
|
/*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 },
|
/*0x36D*/ { "SMSG_LFG_BOOT_PROPOSAL_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||||
/*0x36E*/ { "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST", STATUS_LOGGEDIN, &WorldSession::HandleLfgPlayerLockInfoRequestOpcode},
|
/*0x36E*/ { "CMSG_LFD_PLAYER_LOCK_INFO_REQUEST", STATUS_LOGGEDIN, &WorldSession::HandleLfgPlayerLockInfoRequestOpcode},
|
||||||
/*0x36F*/ { "SMSG_LFG_PLAYER_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
/*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},
|
/*0x371*/ { "CMSG_LFD_PARTY_LOCK_INFO_REQUEST", STATUS_LOGGEDIN, &WorldSession::HandleLfgPartyLockInfoRequestOpcode},
|
||||||
/*0x372*/ { "SMSG_LFG_PARTY_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
/*0x372*/ { "SMSG_LFG_PARTY_INFO", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||||
/*0x373*/ { "SMSG_TITLE_EARNED", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
/*0x373*/ { "SMSG_TITLE_EARNED", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||||
|
|||||||
@@ -47,8 +47,7 @@
|
|||||||
|
|
||||||
/// WorldSession constructor
|
/// WorldSession constructor
|
||||||
WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale) :
|
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),
|
m_muteTime(mute_time), _player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion),
|
||||||
_player(NULL), m_Socket(sock),_security(sec), _accountId(id), m_expansion(expansion),
|
|
||||||
m_sessionDbcLocale(sWorld.GetAvailableDbcLocale(locale)), m_sessionDbLocaleIndex(sObjectMgr.GetIndexForLocale(locale)),
|
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),
|
_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)
|
m_latency(0), m_TutorialsChanged(false), m_timeOutTime(0)
|
||||||
|
|||||||
@@ -270,10 +270,6 @@ class WorldSession
|
|||||||
void SendNotInArenaTeamPacket(uint8 type);
|
void SendNotInArenaTeamPacket(uint8 type);
|
||||||
void SendPetitionShowList(uint64 guid);
|
void SendPetitionShowList(uint64 guid);
|
||||||
void SendSaveGuildEmblem(uint32 msg);
|
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);
|
void BuildPartyMemberStatsChangedPacket(Player *player, WorldPacket *data);
|
||||||
|
|
||||||
@@ -705,12 +701,21 @@ class WorldSession
|
|||||||
void HandleLfgJoinOpcode(WorldPacket &recv_data);
|
void HandleLfgJoinOpcode(WorldPacket &recv_data);
|
||||||
void HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/);
|
void HandleLfgLeaveOpcode(WorldPacket & /*recv_data*/);
|
||||||
void HandleLfgSetRolesOpcode(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 SendLfgUpdatePlayer(uint8 updateType);
|
||||||
void SendLfgUpdateParty(uint8 updateType);
|
void SendLfgUpdateParty(uint8 updateType);
|
||||||
void SendLfgRoleChosen(uint64 guid, uint8 roles);
|
void SendLfgRoleChosen(uint64 guid, uint8 roles);
|
||||||
void SendLfgUpdateSearch(bool update);
|
void SendLfgUpdateSearch(bool update);
|
||||||
void SendLfgJoinResult(uint8 checkResult, uint8 checkValue);
|
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 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
|
// Arena Team
|
||||||
void HandleInspectArenaTeamsOpcode(WorldPacket& recv_data);
|
void HandleInspectArenaTeamsOpcode(WorldPacket& recv_data);
|
||||||
|
|||||||
Reference in New Issue
Block a user