Core/Dungeon Finder: Move all packet handling from Mgr to Handler (also minor cleanups)
--HG-- branch : trunk
This commit is contained in:
@@ -21,6 +21,9 @@
|
|||||||
#ifndef TRINITY_DISABLEMGR_H
|
#ifndef TRINITY_DISABLEMGR_H
|
||||||
#define TRINITY_DISABLEMGR_H
|
#define TRINITY_DISABLEMGR_H
|
||||||
|
|
||||||
|
#include <ace/Singleton.h>
|
||||||
|
class Unit;
|
||||||
|
|
||||||
enum DisableType
|
enum DisableType
|
||||||
{
|
{
|
||||||
DISABLE_TYPE_SPELL = 0,
|
DISABLE_TYPE_SPELL = 0,
|
||||||
|
|||||||
@@ -19,9 +19,6 @@
|
|||||||
#ifndef _LFG_H
|
#ifndef _LFG_H
|
||||||
#define _LFG_H
|
#define _LFG_H
|
||||||
|
|
||||||
#include "Define.h"
|
|
||||||
#include "Object.h"
|
|
||||||
|
|
||||||
enum LfgRoles
|
enum LfgRoles
|
||||||
{
|
{
|
||||||
ROLE_NONE = 0x00,
|
ROLE_NONE = 0x00,
|
||||||
|
|||||||
@@ -18,14 +18,15 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "Group.h"
|
|
||||||
#include "Player.h"
|
#include "DisableMgr.h"
|
||||||
|
#include "ObjectMgr.h"
|
||||||
|
#include "ProgressBar.h"
|
||||||
#include "SocialMgr.h"
|
#include "SocialMgr.h"
|
||||||
#include "LFGMgr.h"
|
#include "LFGMgr.h"
|
||||||
#include "ObjectMgr.h"
|
|
||||||
#include "DisableMgr.h"
|
#include "Group.h"
|
||||||
#include "WorldPacket.h"
|
#include "Player.h"
|
||||||
#include "ProgressBar.h"
|
|
||||||
|
|
||||||
// --- Debug
|
// --- Debug
|
||||||
void DungeonDebug(uint64 guid, LfgDungeonSet *dungeons, std::string from)
|
void DungeonDebug(uint64 guid, LfgDungeonSet *dungeons, std::string from)
|
||||||
@@ -304,16 +305,13 @@ void LFGMgr::Update(uint32 diff)
|
|||||||
continue;
|
continue;
|
||||||
pRoleCheck->result = LFG_ROLECHECK_MISSING_ROLE;
|
pRoleCheck->result = LFG_ROLECHECK_MISSING_ROLE;
|
||||||
|
|
||||||
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + pRoleCheck->dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
|
|
||||||
sLog.outDebug("SMSG_LFG_ROLE_CHECK_UPDATE");
|
|
||||||
BuildLfgRoleCheck(data, pRoleCheck);
|
|
||||||
Player *plr = NULL;
|
Player *plr = NULL;
|
||||||
for (LfgRolesMap::const_iterator itRoles = pRoleCheck->roles.begin(); itRoles != pRoleCheck->roles.end(); ++itRoles)
|
for (LfgRolesMap::const_iterator itRoles = pRoleCheck->roles.begin(); itRoles != pRoleCheck->roles.end(); ++itRoles)
|
||||||
{
|
{
|
||||||
plr = sObjectMgr.GetPlayer(itRoles->first);
|
plr = sObjectMgr.GetPlayer(itRoles->first);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
continue;
|
continue;
|
||||||
plr->GetSession()->SendPacket(&data);
|
plr->GetSession()->SendLfgRoleCheckUpdate(pRoleCheck);
|
||||||
plr->GetLfgDungeons()->clear();
|
plr->GetLfgDungeons()->clear();
|
||||||
plr->SetLfgRoles(ROLE_NONE);
|
plr->SetLfgRoles(ROLE_NONE);
|
||||||
|
|
||||||
@@ -645,7 +643,7 @@ void LFGMgr::Join(Player *plr)
|
|||||||
{
|
{
|
||||||
plr->GetLfgDungeons()->clear();
|
plr->GetLfgDungeons()->clear();
|
||||||
plr->SetLfgRoles(ROLE_NONE);
|
plr->SetLfgRoles(ROLE_NONE);
|
||||||
plr->GetSession()->SendLfgJoinResult(result, 0);
|
plr->GetSession()->SendLfgJoinResult(result);
|
||||||
plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_ROLECHECK_FAILED);
|
plr->GetSession()->SendLfgUpdateParty(LFG_UPDATETYPE_ROLECHECK_FAILED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -675,12 +673,13 @@ void LFGMgr::Join(Player *plr)
|
|||||||
|
|
||||||
// Expand random dungeons
|
// Expand random dungeons
|
||||||
LfgDungeonSet *dungeons = NULL;
|
LfgDungeonSet *dungeons = NULL;
|
||||||
|
LfgLockStatusMap *playersLockMap = NULL;
|
||||||
if (plr->GetLfgDungeons()->size() == 1 && isRandomDungeon(*plr->GetLfgDungeons()->begin()))
|
if (plr->GetLfgDungeons()->size() == 1 && isRandomDungeon(*plr->GetLfgDungeons()->begin()))
|
||||||
{
|
{
|
||||||
PlayerSet players;
|
PlayerSet players;
|
||||||
players.insert(plr);
|
players.insert(plr);
|
||||||
dungeons = GetDungeonsByRandom(*plr->GetLfgDungeons()->begin());
|
dungeons = GetDungeonsByRandom(*plr->GetLfgDungeons()->begin());
|
||||||
CheckCompatibleDungeons(dungeons, &players);
|
playersLockMap = CheckCompatibleDungeons(dungeons, &players);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dungeons = plr->GetLfgDungeons();
|
dungeons = plr->GetLfgDungeons();
|
||||||
@@ -691,7 +690,7 @@ void LFGMgr::Join(Player *plr)
|
|||||||
{
|
{
|
||||||
if (dungeons)
|
if (dungeons)
|
||||||
delete dungeons;
|
delete dungeons;
|
||||||
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_NOT_MEET_REQS, 0);
|
plr->GetSession()->SendLfgJoinResult(LFG_JOIN_NOT_MEET_REQS, 0, playersLockMap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -920,7 +919,8 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposalList *proposals)
|
|||||||
plr = sObjectMgr.GetPlayer(it->first);
|
plr = sObjectMgr.GetPlayer(it->first);
|
||||||
if (!plr)
|
if (!plr)
|
||||||
sLog.outDebug("LFGMgr::CheckCompatibility: (%s) Warning! %u offline!", strGuids.c_str(), it->first);
|
sLog.outDebug("LFGMgr::CheckCompatibility: (%s) Warning! %u offline!", strGuids.c_str(), it->first);
|
||||||
|
else
|
||||||
|
{
|
||||||
for (PlayerSet::const_iterator itPlayer = players.begin(); itPlayer != players.end() && plr; ++itPlayer)
|
for (PlayerSet::const_iterator itPlayer = players.begin(); itPlayer != players.end() && plr; ++itPlayer)
|
||||||
{
|
{
|
||||||
// Do not form a group with ignoring candidates
|
// Do not form a group with ignoring candidates
|
||||||
@@ -933,6 +933,7 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposalList *proposals)
|
|||||||
if (plr)
|
if (plr)
|
||||||
players.insert(plr);
|
players.insert(plr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// if we dont have the same ammount of players then we have self ignoring candidates or different faction groups
|
// if we dont have the same ammount of players then we have self ignoring candidates or different faction groups
|
||||||
// otherwise check if roles are compatible
|
// otherwise check if roles are compatible
|
||||||
@@ -1113,7 +1114,7 @@ void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
|
|||||||
if (Player *plr = sObjectMgr.GetPlayer(it->first))
|
if (Player *plr = sObjectMgr.GetPlayer(it->first))
|
||||||
players.insert(plr);
|
players.insert(plr);
|
||||||
|
|
||||||
playersLockMap = CheckCompatibleDungeons(dungeons, &players, true);
|
playersLockMap = CheckCompatibleDungeons(dungeons, &players);
|
||||||
DungeonDebug(plr->GetGUID(), dungeons, "UpdateRoleCheck");
|
DungeonDebug(plr->GetGUID(), dungeons, "UpdateRoleCheck");
|
||||||
|
|
||||||
pRoleCheck->dungeons.clear();
|
pRoleCheck->dungeons.clear();
|
||||||
@@ -1149,10 +1150,6 @@ void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
|
|||||||
pRoleCheck->result = LFG_ROLECHECK_ABORTED;
|
pRoleCheck->result = LFG_ROLECHECK_ABORTED;
|
||||||
|
|
||||||
WorldSession *session;
|
WorldSession *session;
|
||||||
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + pRoleCheck->dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
|
|
||||||
sLog.outDebug("SMSG_LFG_ROLE_CHECK_UPDATE");
|
|
||||||
BuildLfgRoleCheck(data, pRoleCheck);
|
|
||||||
|
|
||||||
Player *plrg = NULL;
|
Player *plrg = NULL;
|
||||||
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
|
||||||
{
|
{
|
||||||
@@ -1163,7 +1160,7 @@ void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
|
|||||||
session = plrg->GetSession();
|
session = plrg->GetSession();
|
||||||
if (!newRoleCheck && plr)
|
if (!newRoleCheck && plr)
|
||||||
session->SendLfgRoleChosen(plr->GetGUID(), plr->GetLfgRoles());
|
session->SendLfgRoleChosen(plr->GetGUID(), plr->GetLfgRoles());
|
||||||
session->SendPacket(&data);
|
session->SendLfgRoleCheckUpdate(pRoleCheck);
|
||||||
|
|
||||||
switch(pRoleCheck->result)
|
switch(pRoleCheck->result)
|
||||||
{
|
{
|
||||||
@@ -1175,17 +1172,7 @@ void LFGMgr::UpdateRoleCheck(Group *grp, Player *plr /* = NULL*/)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (grp->GetLeaderGUID() == plrg->GetGUID())
|
if (grp->GetLeaderGUID() == plrg->GetGUID())
|
||||||
{
|
session->SendLfgJoinResult(LFG_JOIN_PARTY_NOT_MEET_REQS, 0, playersLockMap);
|
||||||
uint32 size = 0;
|
|
||||||
for (LfgLockStatusMap::const_iterator it = playersLockMap->begin(); it != playersLockMap->end(); ++it)
|
|
||||||
size += 8 + 4 + it->second->size() * (4 + 4);
|
|
||||||
WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size);
|
|
||||||
sLog.outDebug("SMSG_LFG_JOIN_RESULT");
|
|
||||||
data << uint32(LFG_JOIN_PARTY_NOT_MEET_REQS); // Check Result
|
|
||||||
data << uint32(0); // Check Value (always 0 when PartyNotMeetReqs
|
|
||||||
BuildPartyLockDungeonBlock(data, playersLockMap);
|
|
||||||
session->SendPacket(&data);
|
|
||||||
}
|
|
||||||
session->SendLfgUpdateParty(LFG_UPDATETYPE_ROLECHECK_FAILED);
|
session->SendLfgUpdateParty(LFG_UPDATETYPE_ROLECHECK_FAILED);
|
||||||
plrg->GetLfgDungeons()->clear();
|
plrg->GetLfgDungeons()->clear();
|
||||||
plrg->SetLfgRoles(ROLE_NONE);
|
plrg->SetLfgRoles(ROLE_NONE);
|
||||||
@@ -1277,7 +1264,7 @@ LfgAnswer LFGMgr::GetCompatibles(std::string key)
|
|||||||
/// <param name="LfgLockStatusMap *">Used to return the lockStatusMap</param>
|
/// <param name="LfgLockStatusMap *">Used to return the lockStatusMap</param>
|
||||||
/// <param name="boot">Return lockMap or discard it</param>
|
/// <param name="boot">Return lockMap or discard it</param>
|
||||||
/// <returns>LfgLockStatusMap*</returns>
|
/// <returns>LfgLockStatusMap*</returns>
|
||||||
LfgLockStatusMap *LFGMgr::CheckCompatibleDungeons(LfgDungeonSet *dungeons, PlayerSet *players, bool returnLockMap /* = false */)
|
LfgLockStatusMap *LFGMgr::CheckCompatibleDungeons(LfgDungeonSet *dungeons, PlayerSet *players, bool returnLockMap /* = true */)
|
||||||
{
|
{
|
||||||
if (!dungeons)
|
if (!dungeons)
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1338,7 +1325,7 @@ LfgDungeonSet* LFGMgr::CheckCompatibleDungeons(LfgDungeonMap *dungeonsMap, Playe
|
|||||||
|
|
||||||
// if we have players remove restrictions
|
// if we have players remove restrictions
|
||||||
if (players && !players->empty())
|
if (players && !players->empty())
|
||||||
CheckCompatibleDungeons(compatibleDungeons, players);
|
CheckCompatibleDungeons(compatibleDungeons, players, false);
|
||||||
|
|
||||||
// Any compatible dungeon after checking restrictions?
|
// Any compatible dungeon after checking restrictions?
|
||||||
if (compatibleDungeons && !compatibleDungeons->size())
|
if (compatibleDungeons && !compatibleDungeons->size())
|
||||||
@@ -1868,109 +1855,6 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player *player)
|
|||||||
player->ModifyMoney(moneyRew);
|
player->ModifyMoney(moneyRew);
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------//
|
|
||||||
// Packet Functions
|
|
||||||
// --------------------------------------------------------------------------//
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Build lfgRolecheck packet
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="WorldPacket &">WorldPacket</param>
|
|
||||||
/// <param name="LfgRoleCheck *">RoleCheck info</param>
|
|
||||||
void LFGMgr::BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck)
|
|
||||||
{
|
|
||||||
ASSERT(pRoleCheck);
|
|
||||||
|
|
||||||
Player *plr;
|
|
||||||
uint8 roles;
|
|
||||||
|
|
||||||
data << uint32(pRoleCheck->result); // Check result
|
|
||||||
data << uint8(pRoleCheck->result == LFG_ROLECHECK_INITIALITING);
|
|
||||||
data << uint8(pRoleCheck->dungeons.size()); // Number of dungeons
|
|
||||||
LFGDungeonEntry const *dungeon;
|
|
||||||
for (LfgDungeonSet::iterator it = pRoleCheck->dungeons.begin(); it != pRoleCheck->dungeons.end(); ++it)
|
|
||||||
{
|
|
||||||
dungeon = sLFGDungeonStore.LookupEntry(*it); // not null - been checked at join time
|
|
||||||
if (!dungeon)
|
|
||||||
{
|
|
||||||
sLog.outError("LFGMgr::BuildLfgRoleCheck: Dungeon %u does not exist in dbcs", *it);
|
|
||||||
data << uint32(0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
data << uint32(dungeon->Entry()); // Dungeon
|
|
||||||
}
|
|
||||||
|
|
||||||
data << uint8(pRoleCheck->roles.size()); // Players in group
|
|
||||||
// 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
|
|
||||||
|
|
||||||
for (LfgRolesMap::const_iterator itPlayers = pRoleCheck->roles.begin(); itPlayers != pRoleCheck->roles.end(); ++itPlayers)
|
|
||||||
{
|
|
||||||
if (itPlayers->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
|
|
||||||
plr = sObjectMgr.GetPlayer(guid);
|
|
||||||
data << uint8(plr ? plr->getLevel() : 0); // Level
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Build Party Dungeon lock status packet
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="WorldPacket &">WorldPacket</param>
|
|
||||||
/// <param name="LfgLockStatusMap *">lock status map</param>
|
|
||||||
void LFGMgr::BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap)
|
|
||||||
{
|
|
||||||
if (!lockMap || !lockMap->size())
|
|
||||||
{
|
|
||||||
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
|
|
||||||
BuildPlayerLockDungeonBlock(data, it->second);
|
|
||||||
}
|
|
||||||
lockMap->clear();
|
|
||||||
delete lockMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Build Player Dungeon lock status packet
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="WorldPacket &">WorldPacket</param>
|
|
||||||
/// <param name="LfgLockStatusSet *">lock status list</param>
|
|
||||||
void LFGMgr::BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet)
|
|
||||||
{
|
|
||||||
if (!lockSet || !lockSet->size())
|
|
||||||
{
|
|
||||||
data << uint8(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
data << uint32(lockSet->size()); // Size of lock dungeons
|
|
||||||
for (LfgLockStatusSet::iterator it = lockSet->begin(); it != lockSet->end(); ++it)
|
|
||||||
{
|
|
||||||
data << uint32((*it)->dungeon); // Dungeon entry + type
|
|
||||||
data << uint32((*it)->lockstatus); // Lock status
|
|
||||||
delete (*it);
|
|
||||||
}
|
|
||||||
lockSet->clear();
|
|
||||||
delete lockSet;
|
|
||||||
}
|
|
||||||
|
|
||||||
// --------------------------------------------------------------------------//
|
// --------------------------------------------------------------------------//
|
||||||
// Auxiliar Functions
|
// Auxiliar Functions
|
||||||
// --------------------------------------------------------------------------//
|
// --------------------------------------------------------------------------//
|
||||||
|
|||||||
@@ -21,9 +21,11 @@
|
|||||||
|
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include <ace/Singleton.h>
|
#include <ace/Singleton.h>
|
||||||
#include "Group.h"
|
|
||||||
#include "LFG.h"
|
#include "LFG.h"
|
||||||
|
|
||||||
|
class Group;
|
||||||
|
class Player;
|
||||||
|
|
||||||
enum LFGenum
|
enum LFGenum
|
||||||
{
|
{
|
||||||
LFG_TIME_ROLECHECK = 2*MINUTE,
|
LFG_TIME_ROLECHECK = 2*MINUTE,
|
||||||
@@ -103,7 +105,7 @@ enum LfgJoinResult
|
|||||||
LFG_JOIN_OK = 0, // Joined (no client msg)
|
LFG_JOIN_OK = 0, // Joined (no client msg)
|
||||||
LFG_JOIN_FAILED = 1, // RoleCheck Failed
|
LFG_JOIN_FAILED = 1, // RoleCheck Failed
|
||||||
LFG_JOIN_GROUPFULL = 2, // Your group is full
|
LFG_JOIN_GROUPFULL = 2, // Your group is full
|
||||||
LFG_JOIN_UNK3 = 3, // No client reaction
|
//LFG_JOIN_UNK3 = 3, // No client reaction
|
||||||
LFG_JOIN_INTERNAL_ERROR = 4, // Internal LFG Error
|
LFG_JOIN_INTERNAL_ERROR = 4, // Internal LFG Error
|
||||||
LFG_JOIN_NOT_MEET_REQS = 5, // You do not meet the requirements for the chosen dungeons
|
LFG_JOIN_NOT_MEET_REQS = 5, // You do not meet the requirements for the chosen dungeons
|
||||||
LFG_JOIN_PARTY_NOT_MEET_REQS = 6, // One or more party members do not meet the requirements for the chosen dungeons
|
LFG_JOIN_PARTY_NOT_MEET_REQS = 6, // One or more party members do not meet the requirements for the chosen dungeons
|
||||||
@@ -118,7 +120,7 @@ enum LfgJoinResult
|
|||||||
LFG_JOIN_PARTY_RANDOM_COOLDOWN = 15, // One or more party members are on random dungeon cooldown
|
LFG_JOIN_PARTY_RANDOM_COOLDOWN = 15, // One or more party members are on random dungeon cooldown
|
||||||
LFG_JOIN_TOO_MUCH_MEMBERS = 16, // You can not enter dungeons with more that 5 party members
|
LFG_JOIN_TOO_MUCH_MEMBERS = 16, // You can not enter dungeons with more that 5 party members
|
||||||
LFG_JOIN_USING_BG_SYSTEM = 17, // You can not use the dungeon system while in BG or arenas
|
LFG_JOIN_USING_BG_SYSTEM = 17, // You can not use the dungeon system while in BG or arenas
|
||||||
LFG_JOIN_FAILED2 = 18, // RoleCheck Failed
|
//LFG_JOIN_FAILED2 = 18, // RoleCheck Failed
|
||||||
};
|
};
|
||||||
|
|
||||||
enum LfgRoleCheckResult
|
enum LfgRoleCheckResult
|
||||||
@@ -288,8 +290,6 @@ class LFGMgr
|
|||||||
LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion);
|
LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion);
|
||||||
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons = NULL, bool useEntry = true);
|
LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons = NULL, bool useEntry = true);
|
||||||
LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level);
|
LfgReward const* GetRandomDungeonReward(uint32 dungeon, uint8 level);
|
||||||
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet);
|
|
||||||
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Cleaner();
|
void Cleaner();
|
||||||
@@ -304,16 +304,12 @@ class LFGMgr
|
|||||||
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
||||||
bool CheckCompatibility(LfgGuidList check, LfgProposalList *proposals);
|
bool CheckCompatibility(LfgGuidList check, LfgProposalList *proposals);
|
||||||
LfgDungeonSet* CheckCompatibleDungeons(LfgDungeonMap *dungeonsMap, PlayerSet *players);
|
LfgDungeonSet* CheckCompatibleDungeons(LfgDungeonMap *dungeonsMap, PlayerSet *players);
|
||||||
LfgLockStatusMap *CheckCompatibleDungeons(LfgDungeonSet *dungeons, PlayerSet *players, bool returnLockMap = false);
|
LfgLockStatusMap *CheckCompatibleDungeons(LfgDungeonSet *dungeons, PlayerSet *players, bool returnLockMap = true);
|
||||||
void SetCompatibles(std::string concatenatedGuids, bool compatibles);
|
void SetCompatibles(std::string concatenatedGuids, bool compatibles);
|
||||||
LfgAnswer GetCompatibles(std::string concatenatedGuids);
|
LfgAnswer GetCompatibles(std::string concatenatedGuids);
|
||||||
void RemoveFromCompatibles(uint64 guid);
|
void RemoveFromCompatibles(uint64 guid);
|
||||||
std::string ConcatenateGuids(LfgGuidList check);
|
std::string ConcatenateGuids(LfgGuidList check);
|
||||||
|
|
||||||
void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck);
|
|
||||||
void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr);
|
|
||||||
void BuildBootPlayerBlock(WorldPacket &data, LfgPlayerBoot *pBoot, uint32 lowGuid);
|
|
||||||
|
|
||||||
LfgLockStatusMap* GetGroupLockStatusDungeons(PlayerSet *pPlayers, LfgDungeonSet *dungeons, bool useEntry = true);
|
LfgLockStatusMap* GetGroupLockStatusDungeons(PlayerSet *pPlayers, LfgDungeonSet *dungeons, bool useEntry = true);
|
||||||
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
|
LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon);
|
||||||
LfgDungeonSet* GetAllDungeons();
|
LfgDungeonSet* GetAllDungeons();
|
||||||
|
|||||||
@@ -23,6 +23,42 @@
|
|||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "ObjectMgr.h"
|
#include "ObjectMgr.h"
|
||||||
|
|
||||||
|
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet)
|
||||||
|
{
|
||||||
|
if (!lockSet || !lockSet->size())
|
||||||
|
{
|
||||||
|
data << uint8(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data << uint32(lockSet->size()); // Size of lock dungeons
|
||||||
|
for (LfgLockStatusSet::iterator it = lockSet->begin(); it != lockSet->end(); ++it)
|
||||||
|
{
|
||||||
|
data << uint32((*it)->dungeon); // Dungeon entry + type
|
||||||
|
data << uint32((*it)->lockstatus); // Lock status
|
||||||
|
delete (*it);
|
||||||
|
}
|
||||||
|
lockSet->clear();
|
||||||
|
delete lockSet;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap)
|
||||||
|
{
|
||||||
|
if (!lockMap || !lockMap->size())
|
||||||
|
{
|
||||||
|
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
|
||||||
|
BuildPlayerLockDungeonBlock(data, it->second);
|
||||||
|
}
|
||||||
|
lockMap->clear();
|
||||||
|
delete lockMap;
|
||||||
|
}
|
||||||
|
|
||||||
void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data)
|
void WorldSession::HandleLfgJoinOpcode(WorldPacket &recv_data)
|
||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_LFG_JOIN");
|
sLog.outDebug("CMSG_LFG_JOIN");
|
||||||
@@ -211,11 +247,11 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket &/*recv_data
|
|||||||
randomlist->clear();
|
randomlist->clear();
|
||||||
delete randomlist;
|
delete randomlist;
|
||||||
}
|
}
|
||||||
sLFGMgr.BuildPlayerLockDungeonBlock(data, lockSet);
|
BuildPlayerLockDungeonBlock(data, lockSet);
|
||||||
SendPacket(&data);
|
SendPacket(&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");
|
||||||
|
|
||||||
@@ -226,7 +262,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket &/*recv_data*
|
|||||||
size += 8 + 4 + it->second->size() * (4 + 4);
|
size += 8 + 4 + it->second->size() * (4 + 4);
|
||||||
sLog.outDebug("SMSG_LFG_PARTY_INFO");
|
sLog.outDebug("SMSG_LFG_PARTY_INFO");
|
||||||
WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size);
|
WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size);
|
||||||
sLFGMgr.BuildPartyLockDungeonBlock(data, lockMap);
|
BuildPartyLockDungeonBlock(data, lockMap);
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -351,15 +387,72 @@ void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
|
|||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendLfgJoinResult(uint8 checkResult, uint8 checkValue)
|
void WorldSession::SendLfgRoleCheckUpdate(LfgRoleCheck *pRoleCheck)
|
||||||
{
|
{
|
||||||
sLog.outDebug("SMSG_LFG_JOIN_RESULT");
|
ASSERT(pRoleCheck);
|
||||||
|
|
||||||
WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + checkResult == LFG_JOIN_PARTY_NOT_MEET_REQS ? 1 : 0);
|
sLog.outDebug("SMSG_LFG_ROLE_CHECK_UPDATE");
|
||||||
|
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + pRoleCheck->dungeons.size() * 4 + 1 + pRoleCheck->roles.size() * (8 + 1 + 4 + 1));
|
||||||
|
|
||||||
|
Player *plr;
|
||||||
|
uint8 roles;
|
||||||
|
|
||||||
|
data << uint32(pRoleCheck->result); // Check result
|
||||||
|
data << uint8(pRoleCheck->result == LFG_ROLECHECK_INITIALITING);
|
||||||
|
data << uint8(pRoleCheck->dungeons.size()); // Number of dungeons
|
||||||
|
LFGDungeonEntry const *dungeon;
|
||||||
|
for (LfgDungeonSet::iterator it = pRoleCheck->dungeons.begin(); it != pRoleCheck->dungeons.end(); ++it)
|
||||||
|
{
|
||||||
|
dungeon = sLFGDungeonStore.LookupEntry(*it);
|
||||||
|
if (!dungeon)
|
||||||
|
{
|
||||||
|
sLog.outError("BuildLfgRoleCheck: Dungeon %u does not exist in dbcs", *it);
|
||||||
|
data << uint32(0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
data << uint32(dungeon->Entry()); // Dungeon
|
||||||
|
}
|
||||||
|
|
||||||
|
data << uint8(pRoleCheck->roles.size()); // Players in group
|
||||||
|
// 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
|
||||||
|
|
||||||
|
for (LfgRolesMap::const_iterator itPlayers = pRoleCheck->roles.begin(); itPlayers != pRoleCheck->roles.end(); ++itPlayers)
|
||||||
|
{
|
||||||
|
if (itPlayers->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
|
||||||
|
plr = sObjectMgr.GetPlayer(guid);
|
||||||
|
data << uint8(plr ? plr->getLevel() : 0); // Level
|
||||||
|
}
|
||||||
|
SendPacket(&data);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WorldSession::SendLfgJoinResult(uint8 checkResult, uint8 checkValue /* = 0 */, LfgLockStatusMap *playersLockMap /* = NULL */)
|
||||||
|
{
|
||||||
|
uint32 size = 0;
|
||||||
|
if (playersLockMap)
|
||||||
|
{
|
||||||
|
for (LfgLockStatusMap::const_iterator it = playersLockMap->begin(); it != playersLockMap->end(); ++it)
|
||||||
|
size += 8 + 4 + it->second->size() * (4 + 4);
|
||||||
|
}
|
||||||
|
WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size);
|
||||||
|
sLog.outDebug("SMSG_LFG_JOIN_RESULT");
|
||||||
data << uint32(checkResult); // Check Result
|
data << uint32(checkResult); // Check Result
|
||||||
data << uint32(checkValue); // Check Value
|
data << uint32(checkValue); // Check Value
|
||||||
if (checkResult == LFG_JOIN_PARTY_NOT_MEET_REQS) // Should never happen - its handled in Mgr but just in case
|
if (playersLockMap)
|
||||||
data << uint8(0);
|
BuildPartyLockDungeonBlock(data, playersLockMap);
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,9 +51,12 @@ class CharacterHandler;
|
|||||||
class SpellCastTargets;
|
class SpellCastTargets;
|
||||||
struct AreaTableEntry;
|
struct AreaTableEntry;
|
||||||
struct GM_Ticket;
|
struct GM_Ticket;
|
||||||
|
struct LfgLockStatus;
|
||||||
struct LfgPlayerBoot;
|
struct LfgPlayerBoot;
|
||||||
struct LfgProposal;
|
struct LfgProposal;
|
||||||
struct LfgReward;
|
struct LfgReward;
|
||||||
|
struct LfgRoleCheck;
|
||||||
|
|
||||||
|
|
||||||
enum AccountDataType
|
enum AccountDataType
|
||||||
{
|
{
|
||||||
@@ -722,8 +725,9 @@ class WorldSession
|
|||||||
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 SendLfgRoleCheckUpdate(LfgRoleCheck *pRoleCheck);
|
||||||
void SendLfgUpdateSearch(bool update);
|
void SendLfgUpdateSearch(bool update);
|
||||||
void SendLfgJoinResult(uint8 checkResult, uint8 checkValue);
|
void SendLfgJoinResult(uint8 checkResult, uint8 checkValue = 0, std::map<uint32, std::set<LfgLockStatus*>*> *playersLockMap = NULL /* LfgLockStatusMap *playersLockMap = NULL */);
|
||||||
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 SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntry, uint8 done, const LfgReward *reward, const Quest *qRew);
|
void SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntry, uint8 done, const LfgReward *reward, const Quest *qRew);
|
||||||
void SendLfgBootPlayer(LfgPlayerBoot *pBoot);
|
void SendLfgBootPlayer(LfgPlayerBoot *pBoot);
|
||||||
|
|||||||
Reference in New Issue
Block a user