mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-26 15:16:24 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -9,9 +9,12 @@
|
||||
|
||||
#include "Common.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
@@ -93,68 +96,68 @@ namespace lfg
|
||||
typedef std::list<Lfg5Guids> Lfg5GuidsList;
|
||||
typedef std::set<uint32> LfgDungeonSet;
|
||||
typedef std::map<uint32, uint32> LfgLockMap;
|
||||
typedef std::map<uint64, LfgLockMap> LfgLockPartyMap;
|
||||
typedef std::set<uint64> LfgGuidSet;
|
||||
typedef std::list<uint64> LfgGuidList;
|
||||
typedef std::map<uint64, uint8> LfgRolesMap;
|
||||
typedef std::map<uint64, uint64> LfgGroupsMap;
|
||||
typedef std::map<ObjectGuid, LfgLockMap> LfgLockPartyMap;
|
||||
typedef GuidSet LfgGuidSet;
|
||||
typedef GuidList LfgGuidList;
|
||||
typedef std::map<ObjectGuid, uint8> LfgRolesMap;
|
||||
typedef std::map<ObjectGuid, ObjectGuid> LfgGroupsMap;
|
||||
|
||||
class Lfg5Guids
|
||||
{
|
||||
public:
|
||||
uint64 guid[5];
|
||||
std::array<ObjectGuid, 5> guids = { };
|
||||
LfgRolesMap* roles;
|
||||
Lfg5Guids()
|
||||
{
|
||||
memset(&guid, 0, 5 * 8);
|
||||
guids.fill(ObjectGuid::Empty);
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
Lfg5Guids(uint64 g)
|
||||
Lfg5Guids(ObjectGuid g)
|
||||
{
|
||||
memset(&guid, 0, 5 * 8);
|
||||
guid[0] = g;
|
||||
guids.fill(ObjectGuid::Empty);
|
||||
guids[0] = g;
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
guids = x.guids;
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x, bool /*copyRoles*/)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
guids = x.guids;
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
~Lfg5Guids() { delete roles; }
|
||||
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
|
||||
void clear() { memset(&guid, 0, 5 * 8); }
|
||||
bool empty() const { return guid[0] == 0; }
|
||||
uint64 front() const { return guid[0]; }
|
||||
void clear() { guids.fill(ObjectGuid::Empty); }
|
||||
bool empty() const { return guids[0] == ObjectGuid::Empty; }
|
||||
ObjectGuid front() const { return guids[0]; }
|
||||
|
||||
uint8 size() const
|
||||
{
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
else if (guid[3])
|
||||
else if (guids[3])
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
else if (guid[1])
|
||||
else if (guids[1])
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (guid[0])
|
||||
else if (guids[0])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -162,289 +165,289 @@ namespace lfg
|
||||
return 0;
|
||||
}
|
||||
|
||||
void insert(const uint64& g)
|
||||
void insert(const ObjectGuid& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == 0)
|
||||
if (!guids[0])
|
||||
{
|
||||
guid[0] = g;
|
||||
guids[0] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[0])
|
||||
if (g <= guids[0])
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guids[4] = guids[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
guids[3] = guids[2];
|
||||
}
|
||||
|
||||
if (guid[1])
|
||||
if (guids[1])
|
||||
{
|
||||
guid[2] = guid[1];
|
||||
guids[2] = guids[1];
|
||||
}
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
guids[1] = guids[0];
|
||||
guids[0] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[1] == 0)
|
||||
if (!guids[1])
|
||||
{
|
||||
guid[1] = g;
|
||||
guids[1] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[1])
|
||||
if (g <= guids[1])
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guids[4] = guids[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
guids[3] = guids[2];
|
||||
}
|
||||
|
||||
guid[2] = guid[1];
|
||||
guid[1] = g;
|
||||
guids[2] = guids[1];
|
||||
guids[1] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2] == 0)
|
||||
if (!guids[2])
|
||||
{
|
||||
guid[2] = g;
|
||||
guids[2] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[2])
|
||||
if (g <= guids[2])
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guids[4] = guids[3];
|
||||
}
|
||||
|
||||
guid[3] = guid[2];
|
||||
guid[2] = g;
|
||||
guids[3] = guids[2];
|
||||
guids[2] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == 0)
|
||||
if (!guids[3])
|
||||
{
|
||||
guid[3] = g;
|
||||
guids[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[3])
|
||||
if (g <= guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guid[3] = g;
|
||||
guids[4] = guids[3];
|
||||
guids[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = g;
|
||||
guids[4] = g;
|
||||
}
|
||||
|
||||
void force_insert_front(const uint64& g)
|
||||
void force_insert_front(const ObjectGuid& g)
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guids[4] = guids[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
guids[3] = guids[2];
|
||||
}
|
||||
|
||||
if (guid[1])
|
||||
if (guids[1])
|
||||
{
|
||||
guid[2] = guid[1];
|
||||
guids[2] = guids[1];
|
||||
}
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
guids[1] = guids[0];
|
||||
guids[0] = g;
|
||||
}
|
||||
|
||||
void remove(const uint64& g)
|
||||
void remove(const ObjectGuid& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == g)
|
||||
if (guids[0] == g)
|
||||
{
|
||||
if (guid[1])
|
||||
if (guids[1])
|
||||
{
|
||||
guid[0] = guid[1];
|
||||
guids[0] = guids[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[0] = 0;
|
||||
guids[0].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
guids[1] = guids[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
guids[1].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
guids[2] = guids[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
guids[2].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
guids[3] = guids[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
guids[3].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[1] == g)
|
||||
if (guids[1] == g)
|
||||
{
|
||||
if (guid[2])
|
||||
if (guids[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
guids[1] = guids[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
guids[1].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
guids[2] = guids[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
guids[2].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
guids[3] = guids[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
guids[3].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2] == g)
|
||||
if (guids[2] == g)
|
||||
{
|
||||
if (guid[3])
|
||||
if (guids[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
guids[2] = guids[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
guids[2].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
guids[3] = guids[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
guids[3].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == g)
|
||||
if (guids[3] == g)
|
||||
{
|
||||
if (guid[4])
|
||||
if (guids[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
guids[3] = guids[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
guids[3].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4] == g)
|
||||
if (guids[4] == g)
|
||||
{
|
||||
guid[4] = 0;
|
||||
guids[4].Clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool hasGuid(const uint64& g) const
|
||||
bool hasGuid(const ObjectGuid& g) const
|
||||
{
|
||||
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
|
||||
return g && (guids[0] == g || guids[1] == g || guids[2] == g || guids[3] == g || guids[4] == g);
|
||||
}
|
||||
|
||||
bool operator<(const Lfg5Guids& x) const
|
||||
{
|
||||
if (guid[0] <= x.guid[0])
|
||||
if (guids[0] <= x.guids[0])
|
||||
{
|
||||
if (guid[0] != x.guid[0])
|
||||
if (guids[0] != x.guids[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[1] <= x.guid[1])
|
||||
if (guids[1] <= x.guids[1])
|
||||
{
|
||||
if (guid[1] != x.guid[1])
|
||||
if (guids[1] != x.guids[1])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[2] <= x.guid[2])
|
||||
if (guids[2] <= x.guids[2])
|
||||
{
|
||||
if (guid[2] != x.guid[2])
|
||||
if (guids[2] != x.guids[2])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[3] <= x.guid[3])
|
||||
if (guids[3] <= x.guids[3])
|
||||
{
|
||||
if (guid[3] != x.guid[3])
|
||||
if (guids[3] != x.guids[3])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[4] <= x.guid[4])
|
||||
if (guids[4] <= x.guids[4])
|
||||
{
|
||||
return !(guid[4] == x.guid[4]);
|
||||
return !(guids[4] == x.guids[4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -456,12 +459,12 @@ namespace lfg
|
||||
|
||||
bool operator==(const Lfg5Guids& x) const
|
||||
{
|
||||
return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4];
|
||||
return guids[0] == x.guids[0] && guids[1] == x.guids[1] && guids[2] == x.guids[2] && guids[3] == x.guids[3] && guids[4] == x.guids[4];
|
||||
}
|
||||
|
||||
void operator=(const Lfg5Guids& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
guids = x.guids;
|
||||
delete roles;
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
@@ -469,7 +472,7 @@ namespace lfg
|
||||
std::string toString() const // for debugging
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0);
|
||||
o << guids[0].ToString().c_str() << "," << guids[1].ToString().c_str() << "," << guids[2].ToString().c_str() << "," << guids[3].ToString().c_str() << "," << guids[4].ToString().c_str() << ":" << (roles ? 1 : 0);
|
||||
return o.str();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace lfg
|
||||
{
|
||||
|
||||
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
|
||||
m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
|
||||
m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
|
||||
{ }
|
||||
|
||||
LfgGroupData::~LfgGroupData()
|
||||
@@ -44,12 +44,12 @@ namespace lfg
|
||||
m_State = m_OldState;
|
||||
}
|
||||
|
||||
void LfgGroupData::AddPlayer(uint64 guid)
|
||||
void LfgGroupData::AddPlayer(ObjectGuid guid)
|
||||
{
|
||||
m_Players.insert(guid);
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::RemovePlayer(uint64 guid)
|
||||
uint8 LfgGroupData::RemovePlayer(ObjectGuid guid)
|
||||
{
|
||||
LfgGuidSet::iterator it = m_Players.find(guid);
|
||||
if (it != m_Players.end())
|
||||
@@ -62,7 +62,7 @@ namespace lfg
|
||||
m_Players.clear();
|
||||
}
|
||||
|
||||
void LfgGroupData::SetLeader(uint64 guid)
|
||||
void LfgGroupData::SetLeader(ObjectGuid guid)
|
||||
{
|
||||
m_Leader = guid;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ namespace lfg
|
||||
return m_Players.size();
|
||||
}
|
||||
|
||||
uint64 LfgGroupData::GetLeader() const
|
||||
ObjectGuid LfgGroupData::GetLeader() const
|
||||
{
|
||||
return m_Leader;
|
||||
}
|
||||
|
||||
@@ -31,10 +31,10 @@ namespace lfg
|
||||
// General
|
||||
void SetState(LfgState state);
|
||||
void RestoreState();
|
||||
void AddPlayer(uint64 guid);
|
||||
uint8 RemovePlayer(uint64 guid);
|
||||
void AddPlayer(ObjectGuid guid);
|
||||
uint8 RemovePlayer(ObjectGuid guid);
|
||||
void RemoveAllPlayers();
|
||||
void SetLeader(uint64 guid);
|
||||
void SetLeader(ObjectGuid guid);
|
||||
|
||||
// Dungeon
|
||||
void SetDungeon(uint32 dungeon);
|
||||
@@ -47,7 +47,7 @@ namespace lfg
|
||||
LfgState GetOldState() const;
|
||||
LfgGuidSet const& GetPlayers() const;
|
||||
uint8 GetPlayerCount() const;
|
||||
uint64 GetLeader() const;
|
||||
ObjectGuid GetLeader() const;
|
||||
|
||||
// Dungeon
|
||||
uint32 GetDungeon(bool asId = true) const;
|
||||
@@ -59,7 +59,7 @@ namespace lfg
|
||||
// General
|
||||
LfgState m_State; ///< State if group in LFG
|
||||
LfgState m_OldState; ///< Old State
|
||||
uint64 m_Leader; ///< Leader GUID
|
||||
ObjectGuid m_Leader; ///< Leader GUID
|
||||
LfgGuidSet m_Players; ///< Players in group
|
||||
// Dungeon
|
||||
uint32 m_Dungeon; ///< Dungeon entry
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -137,13 +137,13 @@ namespace lfg
|
||||
|
||||
struct RBInternalInfo
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string comment;
|
||||
bool isGroupLeader;
|
||||
uint64 groupGuid;
|
||||
ObjectGuid groupGuid;
|
||||
uint8 roles;
|
||||
uint32 encounterMask;
|
||||
uint64 instanceGuid;
|
||||
ObjectGuid instanceGuid;
|
||||
|
||||
// additional character info parameters:
|
||||
uint8 _online;
|
||||
@@ -179,7 +179,7 @@ namespace lfg
|
||||
uint32 _expertiseRating;
|
||||
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid,
|
||||
RBInternalInfo(ObjectGuid guid, std::string const& comment, bool isGroupLeader, ObjectGuid groupGuid, uint8 roles, uint32 encounterMask, ObjectGuid instanceGuid,
|
||||
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
|
||||
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
|
||||
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
|
||||
@@ -242,13 +242,13 @@ namespace lfg
|
||||
typedef std::multimap<uint32, LfgReward const*> LfgRewardContainer;
|
||||
typedef std::pair<LfgRewardContainer::const_iterator, LfgRewardContainer::const_iterator> LfgRewardContainerBounds;
|
||||
typedef std::map<uint8, LfgDungeonSet> LfgCachedDungeonContainer;
|
||||
typedef std::map<uint64, LfgAnswer> LfgAnswerContainer;
|
||||
typedef std::map<uint64, LfgRoleCheck> LfgRoleCheckContainer;
|
||||
typedef std::map<ObjectGuid, LfgAnswer> LfgAnswerContainer;
|
||||
typedef std::map<ObjectGuid, LfgRoleCheck> LfgRoleCheckContainer;
|
||||
typedef std::map<uint32, LfgProposal> LfgProposalContainer;
|
||||
typedef std::map<uint64, LfgProposalPlayer> LfgProposalPlayerContainer;
|
||||
typedef std::map<uint64, LfgPlayerBoot> LfgPlayerBootContainer;
|
||||
typedef std::map<uint64, LfgGroupData> LfgGroupDataContainer;
|
||||
typedef std::map<uint64, LfgPlayerData> LfgPlayerDataContainer;
|
||||
typedef std::map<ObjectGuid, LfgProposalPlayer> LfgProposalPlayerContainer;
|
||||
typedef std::map<ObjectGuid, LfgPlayerBoot> LfgPlayerBootContainer;
|
||||
typedef std::map<ObjectGuid, LfgGroupData> LfgGroupDataContainer;
|
||||
typedef std::map<ObjectGuid, LfgPlayerData> LfgPlayerDataContainer;
|
||||
typedef std::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer;
|
||||
|
||||
// Data needed by SMSG_LFG_JOIN_RESULT
|
||||
@@ -320,24 +320,23 @@ namespace lfg
|
||||
/// Stores player data related to proposal to join
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING) { }
|
||||
uint8 role; ///< Proposed role
|
||||
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint64 group; ///< Original group guid. 0 if no original group
|
||||
ObjectGuid group; ///< Original group guid. 0 if no original group
|
||||
};
|
||||
|
||||
/// Stores group data related to proposal to join
|
||||
struct LfgProposal
|
||||
{
|
||||
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING),
|
||||
group(0), leader(0), cancelTime(0), encounters(0), isNew(true)
|
||||
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING), cancelTime(0), encounters(0), isNew(true)
|
||||
{ }
|
||||
|
||||
uint32 id; ///< Proposal Id
|
||||
uint32 dungeonId; ///< Dungeon to join
|
||||
LfgProposalState state; ///< State of the proposal
|
||||
uint64 group; ///< Proposal group (0 if new)
|
||||
uint64 leader; ///< Leader guid.
|
||||
ObjectGuid group; ///< Proposal group (0 if new)
|
||||
ObjectGuid leader; ///< Leader guid.
|
||||
time_t cancelTime; ///< Time when we will cancel this proposal
|
||||
uint32 encounters; ///< Dungeon Encounters
|
||||
bool isNew; ///< Determines if it's new group or not
|
||||
@@ -354,7 +353,7 @@ namespace lfg
|
||||
LfgRoleCheckState state; ///< State of the rolecheck
|
||||
LfgDungeonSet dungeons; ///< Dungeons group is applying for (expanded random dungeons)
|
||||
uint32 rDungeonId; ///< Random Dungeon Id.
|
||||
uint64 leader; ///< Leader of the group
|
||||
ObjectGuid leader; ///< Leader of the group
|
||||
};
|
||||
|
||||
/// Stores information of a current vote to kick someone from a group
|
||||
@@ -363,7 +362,7 @@ namespace lfg
|
||||
time_t cancelTime; ///< Time left to vote
|
||||
bool inProgress; ///< Vote in progress
|
||||
LfgAnswerContainer votes; ///< Player votes (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint64 victim; ///< Player guid to be kicked (can't vote)
|
||||
ObjectGuid victim; ///< Player guid to be kicked (can't vote)
|
||||
std::string reason; ///< kick reason
|
||||
};
|
||||
|
||||
@@ -401,14 +400,14 @@ namespace lfg
|
||||
~LFGMgr();
|
||||
|
||||
// pussywizard: RAIDBROWSER
|
||||
typedef std::unordered_map<uint32 /*playerGuidLow*/, RBEntryInfo> RBEntryInfoMap;
|
||||
typedef std::unordered_map<ObjectGuid /*playerGuid*/, RBEntryInfo> RBEntryInfoMap;
|
||||
typedef std::unordered_map<uint32 /*dungeonId*/, RBEntryInfoMap> RBStoreMap;
|
||||
RBStoreMap RaidBrowserStore[2]; // for 2 factions
|
||||
typedef std::unordered_map<uint32 /*playerGuidLow*/, uint32 /*dungeonId*/> RBSearchersMap;
|
||||
typedef std::unordered_map<ObjectGuid /*playerGuid*/, uint32 /*dungeonId*/> RBSearchersMap;
|
||||
RBSearchersMap RBSearchersStore[2]; // for 2 factions
|
||||
typedef std::unordered_map<uint32 /*dungeonId*/, WorldPacket> RBCacheMap;
|
||||
RBCacheMap RBCacheStore[2]; // for 2 factions
|
||||
typedef std::unordered_map<uint32 /*guidLow*/, RBInternalInfo> RBInternalInfoMap;
|
||||
typedef std::unordered_map<ObjectGuid /*guid*/, RBInternalInfo> RBInternalInfoMap;
|
||||
typedef std::unordered_map<uint32 /*dungeonId*/, RBInternalInfoMap> RBInternalInfoMapMap;
|
||||
RBInternalInfoMapMap RBInternalInfoStorePrev[2]; // for 2 factions
|
||||
RBInternalInfoMapMap RBInternalInfoStoreCurr[2]; // for 2 factions
|
||||
@@ -423,7 +422,7 @@ namespace lfg
|
||||
|
||||
// World.cpp
|
||||
/// Finish the dungeon for the given group. All check are performed using internal lfg data
|
||||
void FinishDungeon(uint64 gguid, uint32 dungeonId, const Map* currMap);
|
||||
void FinishDungeon(ObjectGuid gguid, uint32 dungeonId, const Map* currMap);
|
||||
/// Loads rewards for random dungeons
|
||||
void LoadRewards();
|
||||
/// Loads dungeons from dbc and adds teleport coords
|
||||
@@ -431,31 +430,31 @@ namespace lfg
|
||||
|
||||
// Multiple files
|
||||
/// Check if given guid applied for random dungeon
|
||||
bool selectedRandomLfgDungeon(uint64 guid);
|
||||
bool selectedRandomLfgDungeon(ObjectGuid guid);
|
||||
/// Check if given guid applied for given map and difficulty. Used to know
|
||||
bool inLfgDungeonMap(uint64 guid, uint32 map, Difficulty difficulty);
|
||||
bool inLfgDungeonMap(ObjectGuid guid, uint32 map, Difficulty difficulty);
|
||||
/// Get selected dungeons
|
||||
LfgDungeonSet const& GetSelectedDungeons(uint64 guid);
|
||||
LfgDungeonSet const& GetSelectedDungeons(ObjectGuid guid);
|
||||
/// Get current lfg state
|
||||
LfgState GetState(uint64 guid);
|
||||
LfgState GetState(ObjectGuid guid);
|
||||
/// Get current dungeon
|
||||
uint32 GetDungeon(uint64 guid, bool asId = true);
|
||||
uint32 GetDungeon(ObjectGuid guid, bool asId = true);
|
||||
/// Get the map id of the current dungeon
|
||||
uint32 GetDungeonMapId(uint64 guid);
|
||||
uint32 GetDungeonMapId(ObjectGuid guid);
|
||||
/// Get kicks left in current group
|
||||
uint8 GetKicksLeft(uint64 gguid);
|
||||
uint8 GetKicksLeft(ObjectGuid gguid);
|
||||
/// Load Lfg group info from DB
|
||||
void _LoadFromDB(Field* fields, uint64 guid);
|
||||
void _LoadFromDB(Field* fields, ObjectGuid guid);
|
||||
/// Initializes player data after loading group data from DB
|
||||
void SetupGroupMember(uint64 guid, uint64 gguid);
|
||||
void SetupGroupMember(ObjectGuid guid, ObjectGuid gguid);
|
||||
/// Return Lfg dungeon entry for given dungeon id
|
||||
uint32 GetLFGDungeonEntry(uint32 id);
|
||||
|
||||
// cs_lfg
|
||||
/// Get current player roles
|
||||
uint8 GetRoles(uint64 guid);
|
||||
uint8 GetRoles(ObjectGuid guid);
|
||||
/// Get current player comment (used for LFR)
|
||||
std::string const& GetComment(uint64 gguid);
|
||||
std::string const& GetComment(ObjectGuid gguid);
|
||||
/// Gets current lfg options
|
||||
uint32 GetOptions();
|
||||
/// Sets new lfg options
|
||||
@@ -467,33 +466,33 @@ namespace lfg
|
||||
|
||||
// LFGScripts
|
||||
/// Get leader of the group (using internal data)
|
||||
uint64 GetLeader(uint64 guid);
|
||||
ObjectGuid GetLeader(ObjectGuid guid);
|
||||
/// Initializes locked dungeons for given player (called at login or level change)
|
||||
void InitializeLockedDungeons(Player* player, uint8 level = 0);
|
||||
/// Sets player team
|
||||
void SetTeam(uint64 guid, TeamId teamId);
|
||||
void SetTeam(ObjectGuid guid, TeamId teamId);
|
||||
/// Sets player group
|
||||
void SetGroup(uint64 guid, uint64 group);
|
||||
void SetGroup(ObjectGuid guid, ObjectGuid group);
|
||||
/// Gets player group
|
||||
uint64 GetGroup(uint64 guid);
|
||||
ObjectGuid GetGroup(ObjectGuid guid);
|
||||
/// Sets the leader of the group
|
||||
void SetLeader(uint64 gguid, uint64 leader);
|
||||
void SetLeader(ObjectGuid gguid, ObjectGuid leader);
|
||||
/// Removes saved group data
|
||||
void RemoveGroupData(uint64 guid);
|
||||
void RemoveGroupData(ObjectGuid guid);
|
||||
/// Removes a player from a group
|
||||
uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid);
|
||||
uint8 RemovePlayerFromGroup(ObjectGuid gguid, ObjectGuid guid);
|
||||
/// Adds player to group
|
||||
void AddPlayerToGroup(uint64 gguid, uint64 guid);
|
||||
void AddPlayerToGroup(ObjectGuid gguid, ObjectGuid guid);
|
||||
/// Xinef: Set Random Players Count
|
||||
void SetRandomPlayersCount(uint64 guid, uint8 count);
|
||||
void SetRandomPlayersCount(ObjectGuid guid, uint8 count);
|
||||
/// Xinef: Get Random Players Count
|
||||
uint8 GetRandomPlayersCount(uint64 guid);
|
||||
uint8 GetRandomPlayersCount(ObjectGuid guid);
|
||||
|
||||
// LFGHandler
|
||||
/// Get locked dungeons
|
||||
LfgLockMap const& GetLockedDungeons(uint64 guid);
|
||||
LfgLockMap const& GetLockedDungeons(ObjectGuid guid);
|
||||
/// Returns current lfg status
|
||||
LfgUpdateData GetLfgStatus(uint64 guid);
|
||||
LfgUpdateData GetLfgStatus(ObjectGuid guid);
|
||||
/// Checks if Seasonal dungeon is active
|
||||
bool IsSeasonActive(uint32 dungeonId);
|
||||
/// Gets the random dungeon reward corresponding to given dungeon and player level
|
||||
@@ -503,26 +502,26 @@ namespace lfg
|
||||
/// Teleport a player to/from selected dungeon
|
||||
void TeleportPlayer(Player* player, bool out, bool fromOpcode = false);
|
||||
/// Inits new proposal to boot a player
|
||||
void InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string const& reason);
|
||||
void InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, std::string const& reason);
|
||||
/// Updates player boot proposal with new player answer
|
||||
void UpdateBoot(uint64 guid, bool accept);
|
||||
void UpdateBoot(ObjectGuid guid, bool accept);
|
||||
/// Updates proposal to join dungeon with player answer
|
||||
void UpdateProposal(uint32 proposalId, uint64 guid, bool accept);
|
||||
void UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept);
|
||||
/// Updates the role check with player answer
|
||||
void UpdateRoleCheck(uint64 gguid, uint64 guid = 0, uint8 roles = PLAYER_ROLE_NONE);
|
||||
void UpdateRoleCheck(ObjectGuid gguid, ObjectGuid guid = ObjectGuid::Empty, uint8 roles = PLAYER_ROLE_NONE);
|
||||
/// Sets player lfg roles
|
||||
void SetRoles(uint64 guid, uint8 roles);
|
||||
void SetRoles(ObjectGuid guid, uint8 roles);
|
||||
/// Sets player lfr comment
|
||||
void SetComment(uint64 guid, std::string const& comment);
|
||||
void SetComment(ObjectGuid guid, std::string const& comment);
|
||||
/// Join Lfg with selected roles, dungeons and comment
|
||||
void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment);
|
||||
/// Leaves lfg
|
||||
void LeaveLfg(uint64 guid);
|
||||
void LeaveLfg(ObjectGuid guid);
|
||||
/// pussywizard: cleans all queues' data
|
||||
void LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid = 0);
|
||||
void LeaveAllLfgQueues(ObjectGuid guid, bool allowgroup, ObjectGuid groupguid = ObjectGuid::Empty);
|
||||
/// pussywizard: Raid Browser
|
||||
void JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment);
|
||||
void LeaveRaidBrowser(uint64 guid);
|
||||
void LeaveRaidBrowser(ObjectGuid guid);
|
||||
void LfrSearchAdd(Player* p, uint32 dungeonId);
|
||||
void LfrSearchRemove(Player* p);
|
||||
void SendRaidBrowserCachedList(Player* player, uint32 dungeonId);
|
||||
@@ -536,11 +535,11 @@ namespace lfg
|
||||
|
||||
// LfgQueue
|
||||
/// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
|
||||
LfgState GetOldState(uint64 guid);
|
||||
LfgState GetOldState(ObjectGuid guid);
|
||||
/// Check if given group guid is lfg
|
||||
bool IsLfgGroup(uint64 guid);
|
||||
bool IsLfgGroup(ObjectGuid guid);
|
||||
/// Gets the player count of given group
|
||||
uint8 GetPlayerCount(uint64 guid);
|
||||
uint8 GetPlayerCount(ObjectGuid guid);
|
||||
/// Add a new Proposal
|
||||
uint32 AddProposal(LfgProposal& proposal);
|
||||
/// Checks if all players are queued
|
||||
@@ -548,22 +547,22 @@ namespace lfg
|
||||
/// Checks if given roles match, modifies given roles map with new roles
|
||||
static uint8 CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag = true);
|
||||
/// Checks if given players are ignoring each other
|
||||
static bool HasIgnore(uint64 guid1, uint64 guid2);
|
||||
static bool HasIgnore(ObjectGuid guid1, ObjectGuid guid2);
|
||||
/// Sends queue status to player
|
||||
static void SendLfgQueueStatus(uint64 guid, LfgQueueStatusData const& data);
|
||||
static void SendLfgQueueStatus(ObjectGuid guid, LfgQueueStatusData const& data);
|
||||
|
||||
private:
|
||||
TeamId GetTeam(uint64 guid);
|
||||
void RestoreState(uint64 guid, char const* debugMsg);
|
||||
void ClearState(uint64 guid, char const* debugMsg);
|
||||
void SetDungeon(uint64 guid, uint32 dungeon);
|
||||
void SetSelectedDungeons(uint64 guid, LfgDungeonSet const& dungeons);
|
||||
void SetLockedDungeons(uint64 guid, LfgLockMap const& lock);
|
||||
void DecreaseKicksLeft(uint64 guid);
|
||||
void SetState(uint64 guid, LfgState state);
|
||||
void SetCanOverrideRBState(uint64 guid, bool val);
|
||||
TeamId GetTeam(ObjectGuid guid);
|
||||
void RestoreState(ObjectGuid guid, char const* debugMsg);
|
||||
void ClearState(ObjectGuid guid, char const* debugMsg);
|
||||
void SetDungeon(ObjectGuid guid, uint32 dungeon);
|
||||
void SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons);
|
||||
void SetLockedDungeons(ObjectGuid guid, LfgLockMap const& lock);
|
||||
void DecreaseKicksLeft(ObjectGuid guid);
|
||||
void SetState(ObjectGuid guid, LfgState state);
|
||||
void SetCanOverrideRBState(ObjectGuid guid, bool val);
|
||||
void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
|
||||
void _SaveToDB(uint64 guid);
|
||||
void _SaveToDB(ObjectGuid guid);
|
||||
LFGDungeonData const* GetLFGDungeon(uint32 id);
|
||||
|
||||
// Proposals
|
||||
@@ -571,19 +570,19 @@ namespace lfg
|
||||
void MakeNewGroup(LfgProposal const& proposal);
|
||||
|
||||
// Generic
|
||||
LFGQueue& GetQueue(uint64 guid);
|
||||
LFGQueue& GetQueue(ObjectGuid guid);
|
||||
LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon);
|
||||
LfgType GetDungeonType(uint32 dungeon);
|
||||
|
||||
void SendLfgBootProposalUpdate(uint64 guid, LfgPlayerBoot const& boot);
|
||||
void SendLfgJoinResult(uint64 guid, LfgJoinResultData const& data);
|
||||
void SendLfgRoleChosen(uint64 guid, uint64 pguid, uint8 roles);
|
||||
void SendLfgRoleCheckUpdate(uint64 guid, LfgRoleCheck const& roleCheck);
|
||||
void SendLfgUpdateParty(uint64 guid, LfgUpdateData const& data);
|
||||
void SendLfgUpdatePlayer(uint64 guid, LfgUpdateData const& data);
|
||||
void SendLfgUpdateProposal(uint64 guid, LfgProposal const& proposal);
|
||||
void SendLfgBootProposalUpdate(ObjectGuid guid, LfgPlayerBoot const& boot);
|
||||
void SendLfgJoinResult(ObjectGuid guid, LfgJoinResultData const& data);
|
||||
void SendLfgRoleChosen(ObjectGuid guid, ObjectGuid pguid, uint8 roles);
|
||||
void SendLfgRoleCheckUpdate(ObjectGuid guid, LfgRoleCheck const& roleCheck);
|
||||
void SendLfgUpdateParty(ObjectGuid guid, LfgUpdateData const& data);
|
||||
void SendLfgUpdatePlayer(ObjectGuid guid, LfgUpdateData const& data);
|
||||
void SendLfgUpdateProposal(ObjectGuid guid, LfgProposal const& proposal);
|
||||
|
||||
LfgGuidSet const& GetPlayers(uint64 guid);
|
||||
LfgGuidSet const& GetPlayers(ObjectGuid guid);
|
||||
|
||||
// General variables
|
||||
uint32 m_lfgProposalId; ///< used as internal counter for proposals
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace lfg
|
||||
{
|
||||
|
||||
LfgPlayerData::LfgPlayerData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE), m_canOverrideRBState(false),
|
||||
m_TeamId(TEAM_ALLIANCE), m_Group(0), m_Roles(0), m_Comment("")
|
||||
m_TeamId(TEAM_ALLIANCE), m_Roles(0), m_Comment("")
|
||||
{}
|
||||
|
||||
LfgPlayerData::~LfgPlayerData()
|
||||
@@ -62,7 +62,7 @@ namespace lfg
|
||||
m_TeamId = teamId;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetGroup(uint64 group)
|
||||
void LfgPlayerData::SetGroup(ObjectGuid group)
|
||||
{
|
||||
m_Group = group;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ namespace lfg
|
||||
return m_TeamId;
|
||||
}
|
||||
|
||||
uint64 LfgPlayerData::GetGroup() const
|
||||
ObjectGuid LfgPlayerData::GetGroup() const
|
||||
{
|
||||
return m_Group;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace lfg
|
||||
void RestoreState();
|
||||
void SetLockedDungeons(LfgLockMap const& lock);
|
||||
void SetTeam(TeamId teamId);
|
||||
void SetGroup(uint64 group);
|
||||
void SetGroup(ObjectGuid group);
|
||||
void SetRandomPlayersCount(uint8 count);
|
||||
|
||||
// Queue
|
||||
@@ -40,7 +40,7 @@ namespace lfg
|
||||
LfgState GetOldState() const;
|
||||
LfgLockMap const& GetLockedDungeons() const;
|
||||
TeamId GetTeam() const;
|
||||
uint64 GetGroup() const;
|
||||
ObjectGuid GetGroup() const;
|
||||
uint8 GetRandomPlayersCount() const;
|
||||
void SetCanOverrideRBState(bool val) { m_canOverrideRBState = val; }
|
||||
bool CanOverrideRBState() const { return m_canOverrideRBState; }
|
||||
@@ -58,7 +58,7 @@ namespace lfg
|
||||
// Player
|
||||
LfgLockMap m_LockedDungeons; ///< Dungeons player can't do and reason
|
||||
TeamId m_TeamId; ///< Player team - determines the queue to join
|
||||
uint64 m_Group; ///< Original group of player when joined LFG
|
||||
ObjectGuid m_Group; ///< Original group of player when joined LFG
|
||||
uint8 m_randomPlayers; ///< Xinef: Amount of random players you raid with
|
||||
|
||||
// Queue
|
||||
|
||||
@@ -29,22 +29,22 @@
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
void LFGQueue::AddToQueue(uint64 guid, bool failedProposal)
|
||||
void LFGQueue::AddToQueue(ObjectGuid guid, bool failedProposal)
|
||||
{
|
||||
//LOG_INFO("server", "ADD AddToQueue: %u, failed proposal: %u", GUID_LOPART(guid), failedProposal ? 1 : 0);
|
||||
//LOG_INFO("server", "ADD AddToQueue: %s, failed proposal: %u", guid.ToString().c_str(), failedProposal ? 1 : 0);
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
|
||||
if (itQueue == QueueDataStore.end())
|
||||
{
|
||||
LOG_ERROR("server", "LFGQueue::AddToQueue: Queue data not found for [" UI64FMTD "]", guid);
|
||||
LOG_ERROR("server", "LFGQueue::AddToQueue: Queue data not found for [%s]", guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
//LOG_INFO("server", "AddToQueue success: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "AddToQueue success: %s", guid.ToString().c_str());
|
||||
AddToNewQueue(guid, failedProposal);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromQueue(uint64 guid, bool partial)
|
||||
void LFGQueue::RemoveFromQueue(ObjectGuid guid, bool partial)
|
||||
{
|
||||
//LOG_INFO("server", "REMOVE RemoveFromQueue: %u, partial: %u", GUID_LOPART(guid), partial ? 1 : 0);
|
||||
//LOG_INFO("server", "REMOVE RemoveFromQueue: %s, partial: %u", guid.ToString().c_str(), partial ? 1 : 0);
|
||||
RemoveFromNewQueue(guid);
|
||||
RemoveFromCompatibles(guid);
|
||||
|
||||
@@ -55,13 +55,13 @@ namespace lfg
|
||||
{
|
||||
if (itr->second.bestCompatible.hasGuid(guid))
|
||||
{
|
||||
//LOG_INFO("server", "CLEAR bestCompatible: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "CLEAR bestCompatible: %s, because of: %s", itr->second.bestCompatible.toString().c_str(), guid.ToString().c_str());
|
||||
itr->second.bestCompatible.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//LOG_INFO("server", "CLEAR bestCompatible SELF: %s, because of guid: %u", itr->second.bestCompatible.toString().c_str(), GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "CLEAR bestCompatible SELF: %s, because of: %s", itr->second.bestCompatible.toString().c_str(), guid.ToString().c_str());
|
||||
//itr->second.bestCompatible.clear(); // don't clear here, because UpdateQueueTimers will try to find with every diff update
|
||||
itDelete = itr;
|
||||
}
|
||||
@@ -70,45 +70,45 @@ namespace lfg
|
||||
// xinef: partial
|
||||
if (!partial && itDelete != QueueDataStore.end())
|
||||
{
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %u, itDelete: %u,%u,%u", GUID_LOPART(guid), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %s", guid.ToString().c_str());
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %s, itDelete: %u,%u,%u", guid.ToString().c_str(), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
|
||||
QueueDataStore.erase(itDelete);
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %u SUCCESS", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "ERASE QueueDataStore for: %s SUCCESS", guid.ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void LFGQueue::AddToNewQueue(uint64 guid, bool front)
|
||||
void LFGQueue::AddToNewQueue(ObjectGuid guid, bool front)
|
||||
{
|
||||
if (front)
|
||||
{
|
||||
//LOG_INFO("server", "ADD AddToNewQueue at FRONT: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "ADD AddToNewQueue at FRONT: %s", guid.ToString().c_str());
|
||||
restoredAfterProposal.push_back(guid);
|
||||
newToQueueStore.push_front(guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
//LOG_INFO("server", "ADD AddToNewQueue at the END: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "ADD AddToNewQueue at the END: %s", guid.ToString().c_str());
|
||||
newToQueueStore.push_back(guid);
|
||||
}
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromNewQueue(uint64 guid)
|
||||
void LFGQueue::RemoveFromNewQueue(ObjectGuid guid)
|
||||
{
|
||||
//LOG_INFO("server", "REMOVE RemoveFromNewQueue: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "REMOVE RemoveFromNewQueue: %s", guid.ToString().c_str());
|
||||
newToQueueStore.remove(guid);
|
||||
restoredAfterProposal.remove(guid);
|
||||
}
|
||||
|
||||
void LFGQueue::AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
|
||||
void LFGQueue::AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
|
||||
{
|
||||
//LOG_INFO("server", "JOINED AddQueueData: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "JOINED AddQueueData: %s", guid.ToString().c_str());
|
||||
QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
|
||||
AddToQueue(guid);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveQueueData(uint64 guid)
|
||||
void LFGQueue::RemoveQueueData(ObjectGuid guid)
|
||||
{
|
||||
//LOG_INFO("server", "LEFT RemoveQueueData: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "LEFT RemoveQueueData: %s", guid.ToString().c_str());
|
||||
LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
|
||||
if (it != QueueDataStore.end())
|
||||
QueueDataStore.erase(it);
|
||||
@@ -142,13 +142,13 @@ namespace lfg
|
||||
wt.time = int32((wt.time * old_number + waitTime) / wt.number);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromCompatibles(uint64 guid)
|
||||
void LFGQueue::RemoveFromCompatibles(ObjectGuid guid)
|
||||
{
|
||||
//LOG_INFO("server", "COMPATIBLES REMOVE for: %u", GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "COMPATIBLES REMOVE for: %s", guid.ToString().c_str());
|
||||
for (LfgCompatibleContainer::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it)
|
||||
if (it->hasGuid(guid))
|
||||
{
|
||||
//LOG_INFO("server", "Removed Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "Removed Compatible: %s, because of: %s", it->toString().c_str(), guid.ToString().c_str());
|
||||
it->clear(); // set to 0, this will be removed while iterating in FindNewGroups
|
||||
}
|
||||
for (LfgCompatibleContainer::iterator itr = CompatibleTempList.begin(); itr != CompatibleTempList.end(); )
|
||||
@@ -156,7 +156,7 @@ namespace lfg
|
||||
LfgCompatibleContainer::iterator it = itr++;
|
||||
if (it->hasGuid(guid))
|
||||
{
|
||||
//LOG_INFO("server", "Erased Temp Compatible: %s, because of guid: %u", it->toString().c_str(), GUID_LOPART(guid));
|
||||
//LOG_INFO("server", "Erased Temp Compatible: %s, because of: %s", it->toString().c_str(), guid.ToString().c_str());
|
||||
CompatibleTempList.erase(it);
|
||||
}
|
||||
}
|
||||
@@ -175,9 +175,9 @@ namespace lfg
|
||||
if (!newToQueueStore.empty())
|
||||
{
|
||||
++newGroupsProcessed;
|
||||
uint64 newGuid = newToQueueStore.front();
|
||||
ObjectGuid newGuid = newToQueueStore.front();
|
||||
bool pushCompatiblesToFront = (std::find(restoredAfterProposal.begin(), restoredAfterProposal.end(), newGuid) != restoredAfterProposal.end());
|
||||
//LOG_INFO("server", "newToQueueStore guid: %u, front: %u", GUID_LOPART(newGuid), pushCompatiblesToFront ? 1 : 0);
|
||||
//LOG_INFO("server", "newToQueueStore: %s, front: %u", newGuid.ToString().c_str(), pushCompatiblesToFront ? 1 : 0);
|
||||
RemoveFromNewQueue(newGuid);
|
||||
|
||||
FindNewGroups(newGuid);
|
||||
@@ -190,14 +190,14 @@ namespace lfg
|
||||
return newGroupsProcessed;
|
||||
}
|
||||
|
||||
LfgCompatibility LFGQueue::FindNewGroups(const uint64& newGuid)
|
||||
LfgCompatibility LFGQueue::FindNewGroups(const ObjectGuid& newGuid)
|
||||
{
|
||||
// each combination of dps+heal+tank (tank*8 + heal+4 + dps) has a value assigned 0..15
|
||||
// first 16 bits of the mask are for marking if such combination was found once, second 16 bits for marking second occurence of that combination, etc
|
||||
uint64 foundMask = 0;
|
||||
uint32 foundCount = 0;
|
||||
|
||||
//LOG_INFO("server", "FIND NEW GROUPS for: %u", GUID_LOPART(newGuid));
|
||||
//LOG_INFO("server", "FIND NEW GROUPS for: %s", newGuid.ToString().c_str());
|
||||
|
||||
// we have to take into account that FindNewGroups is called every X minutes if number of compatibles is low!
|
||||
// build set of already present compatibles for this guid
|
||||
@@ -239,9 +239,9 @@ namespace lfg
|
||||
return selfCompatibility;
|
||||
}
|
||||
|
||||
LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles)
|
||||
LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const ObjectGuid& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles)
|
||||
{
|
||||
//LOG_INFO("server", "CHECK CheckCompatibility: %s, new guid: %u", checkWith.toString().c_str(), GUID_LOPART(newGuid));
|
||||
//LOG_INFO("server", "CHECK CheckCompatibility: %s, new guid: %s", checkWith.toString().c_str(), newGuid.ToString().c_str());
|
||||
Lfg5Guids check(checkWith, false); // here newGuid is at front
|
||||
Lfg5Guids strGuids(checkWith, false); // here guids are sorted
|
||||
check.force_insert_front(newGuid);
|
||||
@@ -258,22 +258,23 @@ namespace lfg
|
||||
// Check if more than one LFG group and number of players joining
|
||||
uint8 numPlayers = 0;
|
||||
uint8 numLfgGroups = 0;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint64 addToFoundMask = 0;
|
||||
|
||||
for (uint8 i = 0; i < 5 && (guid = check.guid[i]) != 0 && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++i)
|
||||
for (uint8 i = 0; i < 5 && !(guid = check.guids[i]).IsEmpty() && numLfgGroups < 2 && numPlayers <= MAXGROUPSIZE; ++i)
|
||||
{
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
|
||||
if (itQueue == QueueDataStore.end())
|
||||
{
|
||||
LOG_ERROR("server", "LFGQueue::CheckCompatibility: [" UI64FMTD "] is not queued but listed as queued!", guid);
|
||||
LOG_ERROR("server", "LFGQueue::CheckCompatibility: [%s] is not queued but listed as queued!", guid.ToString().c_str());
|
||||
RemoveFromQueue(guid);
|
||||
return LFG_COMPATIBILITY_PENDING;
|
||||
}
|
||||
|
||||
// Store group so we don't need to call Mgr to get it later (if it's player group will be 0 otherwise would have joined as group)
|
||||
for (LfgRolesMap::const_iterator it2 = itQueue->second.roles.begin(); it2 != itQueue->second.roles.end(); ++it2)
|
||||
proposalGroups[it2->first] = IS_GROUP_GUID(itQueue->first) ? itQueue->first : 0;
|
||||
proposalGroups[it2->first] = itQueue->first.IsGroup() ? itQueue->first : ObjectGuid::Empty;
|
||||
;
|
||||
|
||||
numPlayers += itQueue->second.roles.size();
|
||||
|
||||
@@ -309,9 +310,9 @@ namespace lfg
|
||||
// If it's single group no need to check for duplicate players, ignores, bad roles or bad dungeons as it's been checked before joining
|
||||
if (check.size() > 1)
|
||||
{
|
||||
for (uint8 i = 0; i < 5 && check.guid[i]; ++i)
|
||||
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)
|
||||
{
|
||||
const LfgRolesMap& roles = QueueDataStore[check.guid[i]].roles;
|
||||
const LfgRolesMap& roles = QueueDataStore[check.guids[i]].roles;
|
||||
for (LfgRolesMap::const_iterator itRoles = roles.begin(); itRoles != roles.end(); ++itRoles)
|
||||
{
|
||||
LfgRolesMap::const_iterator itPlayer;
|
||||
@@ -320,7 +321,7 @@ namespace lfg
|
||||
if (itRoles->first == itPlayer->first)
|
||||
{
|
||||
// pussywizard: LFG ZOMG! this means that this player was in two different LfgQueueData (in QueueDataStore), and at least one of them is a group guid, because we do checks so there aren't 2 same guids in current CHECK
|
||||
//LOG_ERROR("server", "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [" UI64FMTD "]", itRoles->first);
|
||||
//LOG_ERROR("server", "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [%s]", itRoles->first.ToString().c_str());
|
||||
break;
|
||||
}
|
||||
else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
|
||||
@@ -365,10 +366,10 @@ namespace lfg
|
||||
addToFoundMask |= (((uint64)1) << (roleCheckResult - 1));
|
||||
|
||||
proposalDungeons = QueueDataStore[check.front()].dungeons;
|
||||
for (uint8 i = 1; i < 5 && check.guid[i]; ++i)
|
||||
for (uint8 i = 1; i < 5 && check.guids[i]; ++i)
|
||||
{
|
||||
LfgDungeonSet temporal;
|
||||
LfgDungeonSet& dungeons = QueueDataStore[check.guid[i]].dungeons;
|
||||
LfgDungeonSet& dungeons = QueueDataStore[check.guids[i]].dungeons;
|
||||
std::set_intersection(proposalDungeons.begin(), proposalDungeons.end(), dungeons.begin(), dungeons.end(), std::inserter(temporal, temporal.begin()));
|
||||
proposalDungeons = temporal;
|
||||
}
|
||||
@@ -378,7 +379,7 @@ namespace lfg
|
||||
}
|
||||
else
|
||||
{
|
||||
uint64 gguid = check.front();
|
||||
ObjectGuid gguid = check.front();
|
||||
const LfgQueueData& queue = QueueDataStore[gguid];
|
||||
proposalDungeons = queue.dungeons;
|
||||
proposalRoles = queue.roles;
|
||||
@@ -389,9 +390,9 @@ namespace lfg
|
||||
if (numPlayers != MAXGROUPSIZE)
|
||||
{
|
||||
strGuids.addRoles(proposalRoles);
|
||||
for (uint8 i = 0; i < 5 && check.guid[i]; ++i)
|
||||
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)
|
||||
{
|
||||
LfgQueueDataContainer::iterator itr = QueueDataStore.find(check.guid[i]);
|
||||
LfgQueueDataContainer::iterator itr = QueueDataStore.find(check.guids[i]);
|
||||
if (!itr->second.bestCompatible.empty()) // update if groups don't have it empty (for empty it will be generated in UpdateQueueTimers)
|
||||
UpdateBestCompatibleInQueue(itr, strGuids);
|
||||
}
|
||||
@@ -401,7 +402,7 @@ namespace lfg
|
||||
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
|
||||
}
|
||||
|
||||
uint64 gguid = check.front();
|
||||
ObjectGuid gguid = check.front();
|
||||
proposal.queues = strGuids;
|
||||
proposal.isNew = numLfgGroups != 1 || sLFGMgr->GetOldState(gguid) != LFG_STATE_DUNGEON;
|
||||
|
||||
@@ -411,7 +412,7 @@ namespace lfg
|
||||
// Create a new proposal
|
||||
proposal.cancelTime = time(nullptr) + LFG_TIME_PROPOSAL;
|
||||
proposal.state = LFG_PROPOSAL_INITIATING;
|
||||
proposal.leader = 0;
|
||||
proposal.leader.Clear();
|
||||
proposal.dungeonId = acore::Containers::SelectRandomContainerElement(proposalDungeons);
|
||||
|
||||
bool leader = false;
|
||||
@@ -435,8 +436,8 @@ namespace lfg
|
||||
data.accept = LFG_ANSWER_AGREE;
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < 5 && proposal.queues.guid[i]; ++i)
|
||||
RemoveFromQueue(proposal.queues.guid[i], true);
|
||||
for (uint8 i = 0; i < 5 && proposal.queues.guids[i]; ++i)
|
||||
RemoveFromQueue(proposal.queues.guids[i], true);
|
||||
|
||||
sLFGMgr->AddProposal(proposal);
|
||||
|
||||
@@ -473,7 +474,7 @@ namespace lfg
|
||||
{
|
||||
if (currTime - itQueue->second.joinTime > 2 * HOUR)
|
||||
{
|
||||
uint64 guid = itQueue->first;
|
||||
ObjectGuid guid = itQueue->first;
|
||||
QueueDataStore.erase(itQueue++);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true);
|
||||
continue;
|
||||
@@ -537,13 +538,13 @@ namespace lfg
|
||||
LfgQueueStatusData queueData(dungeonId, waitTime, wtAvg, wtTank, wtHealer, wtDps, queuedTime, queueinfo.tanks, queueinfo.healers, queueinfo.dps);
|
||||
for (LfgRolesMap::const_iterator itPlayer = queueinfo.roles.begin(); itPlayer != queueinfo.roles.end(); ++itPlayer)
|
||||
{
|
||||
uint64 pguid = itPlayer->first;
|
||||
ObjectGuid pguid = itPlayer->first;
|
||||
LFGMgr::SendLfgQueueStatus(pguid, queueData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
time_t LFGQueue::GetJoinTime(uint64 guid)
|
||||
time_t LFGQueue::GetJoinTime(ObjectGuid guid)
|
||||
{
|
||||
return QueueDataStore[guid].joinTime;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace lfg
|
||||
};
|
||||
|
||||
typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
|
||||
typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer;
|
||||
typedef std::map<ObjectGuid, LfgQueueData> LfgQueueDataContainer;
|
||||
typedef std::list<Lfg5Guids> LfgCompatibleContainer;
|
||||
|
||||
/**
|
||||
@@ -65,10 +65,10 @@ namespace lfg
|
||||
{
|
||||
public:
|
||||
// Add/Remove from queue
|
||||
void AddToQueue(uint64 guid, bool failedProposal = false);
|
||||
void RemoveFromQueue(uint64 guid, bool partial = false); // xinef: partial remove, dont delete data from list!
|
||||
void AddQueueData(uint64 guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
|
||||
void RemoveQueueData(uint64 guid);
|
||||
void AddToQueue(ObjectGuid guid, bool failedProposal = false);
|
||||
void RemoveFromQueue(ObjectGuid guid, bool partial = false); // xinef: partial remove, dont delete data from list!
|
||||
void AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap);
|
||||
void RemoveQueueData(ObjectGuid guid);
|
||||
|
||||
// Update Timers (when proposal success)
|
||||
void UpdateWaitTimeAvg(int32 waitTime, uint32 dungeonId);
|
||||
@@ -78,7 +78,7 @@ namespace lfg
|
||||
|
||||
// Update Queue timers
|
||||
void UpdateQueueTimers(uint32 diff);
|
||||
time_t GetJoinTime(uint64 guid);
|
||||
time_t GetJoinTime(ObjectGuid guid);
|
||||
|
||||
// Find new group
|
||||
uint8 FindGroups();
|
||||
@@ -86,17 +86,17 @@ namespace lfg
|
||||
private:
|
||||
void SetQueueUpdateData(std::string const& strGuids, LfgRolesMap const& proposalRoles);
|
||||
|
||||
void AddToNewQueue(uint64 guid, bool front);
|
||||
void RemoveFromNewQueue(uint64 guid);
|
||||
void AddToNewQueue(ObjectGuid guid, bool front);
|
||||
void RemoveFromNewQueue(ObjectGuid guid);
|
||||
|
||||
void RemoveFromCompatibles(uint64 guid);
|
||||
void RemoveFromCompatibles(ObjectGuid guid);
|
||||
void AddToCompatibles(Lfg5Guids const& key);
|
||||
|
||||
uint32 FindBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue);
|
||||
void UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key);
|
||||
|
||||
LfgCompatibility FindNewGroups(const uint64& newGuid);
|
||||
LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const uint64& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles);
|
||||
LfgCompatibility FindNewGroups(const ObjectGuid& newGuid);
|
||||
LfgCompatibility CheckCompatibility(Lfg5Guids const& checkWith, const ObjectGuid& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles);
|
||||
|
||||
// Queue
|
||||
uint32 m_QueueStatusTimer; ///< used to check interval of sending queue status
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace lfg
|
||||
{
|
||||
player->GetSession()->SendLfgLfrList(false);
|
||||
sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true, player->GetGroup() ? player->GetGroup()->GetGUID() : 0);
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true, player->GetGroup() ? player->GetGroup()->GetGUID() : ObjectGuid::Empty);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
@@ -59,16 +59,16 @@ namespace lfg
|
||||
return;
|
||||
|
||||
// Temporal: Trying to determine when group data and LFG data gets desynched
|
||||
uint64 guid = player->GetGUID();
|
||||
uint64 gguid = sLFGMgr->GetGroup(guid);
|
||||
ObjectGuid guid = player->GetGUID();
|
||||
ObjectGuid gguid = sLFGMgr->GetGroup(guid);
|
||||
|
||||
if (Group const* group = player->GetGroup())
|
||||
{
|
||||
uint64 gguid2 = group->GetGUID();
|
||||
ObjectGuid gguid2 = group->GetGUID();
|
||||
if (gguid != gguid2)
|
||||
{
|
||||
//LOG_ERROR("server", "%s on group %u but LFG has group %u saved... Fixing.",
|
||||
// player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
|
||||
//LOG_ERROR("server", "%s on group %s but LFG has group %s saved... Fixing.",
|
||||
// player->GetSession()->GetPlayerInfo().c_str(), gguid2.ToString().c_str(), gguid.ToString().c_str());
|
||||
sLFGMgr->SetupGroupMember(guid, group->GetGUID());
|
||||
}
|
||||
}
|
||||
@@ -103,7 +103,8 @@ namespace lfg
|
||||
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
|
||||
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, 0.0f);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player %s (%u) is in LFG dungeon map but does not have a valid group! Teleporting to homebind.", player->GetName().c_str(), player->GetGUIDLow());
|
||||
LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player %s (%s) is in LFG dungeon map but does not have a valid group! Teleporting to homebind.",
|
||||
player->GetName().c_str(), player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -130,18 +131,18 @@ namespace lfg
|
||||
{
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
|
||||
void LFGGroupScript::OnAddMember(Group* group, ObjectGuid guid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
ObjectGuid leader = group->GetLeaderGUID();
|
||||
|
||||
if (leader == guid)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
|
||||
#endif
|
||||
sLFGMgr->SetLeader(gguid, guid);
|
||||
}
|
||||
@@ -150,7 +151,8 @@ namespace lfg
|
||||
LfgState gstate = sLFGMgr->GetState(gguid);
|
||||
LfgState state = sLFGMgr->GetState(guid);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s] gstate: %u, state: %u",
|
||||
gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str(), gstate, state);
|
||||
#endif
|
||||
|
||||
if (state == LFG_STATE_QUEUED)
|
||||
@@ -174,7 +176,7 @@ namespace lfg
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
|
||||
void LFGGroupScript::OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(kicker);
|
||||
@@ -183,9 +185,10 @@ namespace lfg
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [%s]: remove [%s] Method: %d Kicker: [%s] Reason: %s",
|
||||
gguid.ToString().c_str(), guid.ToString().c_str(), method, kicker.ToString().c_str(), (reason ? reason : ""));
|
||||
#endif
|
||||
|
||||
bool isLFG = group->isLFGGroup();
|
||||
@@ -195,14 +198,14 @@ namespace lfg
|
||||
if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT)
|
||||
{
|
||||
// LfgData: Remove player from group
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
sLFGMgr->SetGroup(guid, ObjectGuid::Empty);
|
||||
sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
return;
|
||||
}
|
||||
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true, gguid);
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
sLFGMgr->SetGroup(guid, ObjectGuid::Empty);
|
||||
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
@@ -214,7 +217,7 @@ namespace lfg
|
||||
if (!isLFG)
|
||||
return;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* player = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
{
|
||||
// xinef: fixed dungeon deserter
|
||||
if (method != GROUP_REMOVEMETHOD_KICK_LFG && state != LFG_STATE_FINISHED_DUNGEON &&
|
||||
@@ -235,7 +238,7 @@ namespace lfg
|
||||
}
|
||||
|
||||
if (state != LFG_STATE_FINISHED_DUNGEON) // Need more players to finish the dungeon
|
||||
if (Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(sLFGMgr->GetLeader(gguid)))
|
||||
if (Player* leader = ObjectAccessor::FindConnectedPlayer(sLFGMgr->GetLeader(gguid)))
|
||||
leader->GetSession()->SendLfgOfferContinue(sLFGMgr->GetDungeon(gguid, false));
|
||||
}
|
||||
|
||||
@@ -244,9 +247,9 @@ namespace lfg
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnDisband [%s]", gguid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
@@ -256,15 +259,16 @@ namespace lfg
|
||||
sLFGMgr->RemoveGroupData(gguid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
|
||||
void LFGGroupScript::OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [%s]: old [%s] new [%s]",
|
||||
gguid.ToString().c_str(), newLeaderGuid.ToString().c_str(), oldLeaderGuid.ToString().c_str());
|
||||
#endif
|
||||
sLFGMgr->SetLeader(gguid, newLeaderGuid);
|
||||
|
||||
@@ -273,7 +277,7 @@ namespace lfg
|
||||
sLFGMgr->LeaveLfg(oldLeaderGuid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
|
||||
void LFGGroupScript::OnInviteMember(Group* group, ObjectGuid guid)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(guid);
|
||||
@@ -281,10 +285,10 @@ namespace lfg
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
ObjectGuid leader = group->GetLeaderGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [%s]: invite [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
|
||||
#endif
|
||||
// No gguid == new group being formed
|
||||
// No leader == after group creation first invite is new leader
|
||||
|
||||
@@ -37,11 +37,11 @@ namespace lfg
|
||||
LFGGroupScript();
|
||||
|
||||
// Group Hooks
|
||||
void OnAddMember(Group* group, uint64 guid) override;
|
||||
void OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason) override;
|
||||
void OnAddMember(Group* group, ObjectGuid guid) override;
|
||||
void OnRemoveMember(Group* group, ObjectGuid guid, RemoveMethod method, ObjectGuid kicker, char const* reason) override;
|
||||
void OnDisband(Group* group) override;
|
||||
void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid) override;
|
||||
void OnInviteMember(Group* group, uint64 guid) override;
|
||||
void OnChangeLeader(Group* group, ObjectGuid newLeaderGuid, ObjectGuid oldLeaderGuid) override;
|
||||
void OnInviteMember(Group* group, ObjectGuid guid) override;
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
Reference in New Issue
Block a user