mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-25 14:46:24 +00:00
refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
@@ -65,30 +65,30 @@ namespace lfg
|
||||
int32 entry = LANG_LFG_ERROR;
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
entry = LANG_LFG_STATE_NONE;
|
||||
break;
|
||||
case LFG_STATE_ROLECHECK:
|
||||
entry = LANG_LFG_STATE_ROLECHECK;
|
||||
break;
|
||||
case LFG_STATE_QUEUED:
|
||||
entry = LANG_LFG_STATE_QUEUED;
|
||||
break;
|
||||
case LFG_STATE_PROPOSAL:
|
||||
entry = LANG_LFG_STATE_PROPOSAL;
|
||||
break;
|
||||
case LFG_STATE_DUNGEON:
|
||||
entry = LANG_LFG_STATE_DUNGEON;
|
||||
break;
|
||||
case LFG_STATE_BOOT:
|
||||
entry = LANG_LFG_STATE_BOOT;
|
||||
break;
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
entry = LANG_LFG_STATE_FINISHED_DUNGEON;
|
||||
break;
|
||||
case LFG_STATE_RAIDBROWSER:
|
||||
entry = LANG_LFG_STATE_RAIDBROWSER;
|
||||
break;
|
||||
case LFG_STATE_NONE:
|
||||
entry = LANG_LFG_STATE_NONE;
|
||||
break;
|
||||
case LFG_STATE_ROLECHECK:
|
||||
entry = LANG_LFG_STATE_ROLECHECK;
|
||||
break;
|
||||
case LFG_STATE_QUEUED:
|
||||
entry = LANG_LFG_STATE_QUEUED;
|
||||
break;
|
||||
case LFG_STATE_PROPOSAL:
|
||||
entry = LANG_LFG_STATE_PROPOSAL;
|
||||
break;
|
||||
case LFG_STATE_DUNGEON:
|
||||
entry = LANG_LFG_STATE_DUNGEON;
|
||||
break;
|
||||
case LFG_STATE_BOOT:
|
||||
entry = LANG_LFG_STATE_BOOT;
|
||||
break;
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
entry = LANG_LFG_STATE_FINISHED_DUNGEON;
|
||||
break;
|
||||
case LFG_STATE_RAIDBROWSER:
|
||||
entry = LANG_LFG_STATE_RAIDBROWSER;
|
||||
break;
|
||||
}
|
||||
|
||||
return std::string(sObjectMgr->GetAcoreStringForDBCLocale(entry));
|
||||
|
||||
@@ -15,163 +15,246 @@
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
enum LFGEnum
|
||||
{
|
||||
LFG_TANKS_NEEDED = 1,
|
||||
LFG_HEALERS_NEEDED = 1,
|
||||
LFG_DPS_NEEDED = 3
|
||||
};
|
||||
|
||||
enum LfgRoles
|
||||
{
|
||||
PLAYER_ROLE_NONE = 0x00,
|
||||
PLAYER_ROLE_LEADER = 0x01,
|
||||
PLAYER_ROLE_TANK = 0x02,
|
||||
PLAYER_ROLE_HEALER = 0x04,
|
||||
PLAYER_ROLE_DAMAGE = 0x08
|
||||
};
|
||||
|
||||
enum LfgUpdateType
|
||||
{
|
||||
LFG_UPDATETYPE_DEFAULT = 0, // Internal Use
|
||||
LFG_UPDATETYPE_LEADER_UNK1 = 1, // FIXME: At group leave
|
||||
LFG_UPDATETYPE_LEAVE_RAIDBROWSER = 2,
|
||||
LFG_UPDATETYPE_JOIN_RAIDBROWSER = 3,
|
||||
LFG_UPDATETYPE_ROLECHECK_ABORTED = 4,
|
||||
LFG_UPDATETYPE_JOIN_QUEUE = 5,
|
||||
LFG_UPDATETYPE_ROLECHECK_FAILED = 6,
|
||||
LFG_UPDATETYPE_REMOVED_FROM_QUEUE = 7,
|
||||
LFG_UPDATETYPE_PROPOSAL_FAILED = 8,
|
||||
LFG_UPDATETYPE_PROPOSAL_DECLINED = 9,
|
||||
LFG_UPDATETYPE_GROUP_FOUND = 10,
|
||||
LFG_UPDATETYPE_ADDED_TO_QUEUE = 12,
|
||||
LFG_UPDATETYPE_PROPOSAL_BEGIN = 13,
|
||||
LFG_UPDATETYPE_UPDATE_STATUS = 14,
|
||||
LFG_UPDATETYPE_GROUP_MEMBER_OFFLINE = 15,
|
||||
LFG_UPDATETYPE_GROUP_DISBAND_UNK16 = 16, // FIXME: Sometimes at group disband
|
||||
};
|
||||
|
||||
enum LfgState
|
||||
{
|
||||
LFG_STATE_NONE, // Not using LFG / LFR
|
||||
LFG_STATE_ROLECHECK, // Rolecheck active
|
||||
LFG_STATE_QUEUED, // Queued
|
||||
LFG_STATE_PROPOSAL, // Proposal active
|
||||
LFG_STATE_BOOT, // Vote kick active
|
||||
LFG_STATE_DUNGEON, // In LFG Group, in a Dungeon
|
||||
LFG_STATE_FINISHED_DUNGEON, // In LFG Group, in a finished Dungeon
|
||||
LFG_STATE_RAIDBROWSER // Using Raid finder
|
||||
};
|
||||
|
||||
/// Instance lock types
|
||||
enum LfgLockStatusType
|
||||
{
|
||||
LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION = 1,
|
||||
LFG_LOCKSTATUS_TOO_LOW_LEVEL = 2,
|
||||
LFG_LOCKSTATUS_TOO_HIGH_LEVEL = 3,
|
||||
LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE = 4,
|
||||
LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE = 5,
|
||||
LFG_LOCKSTATUS_RAID_LOCKED = 6,
|
||||
LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL = 1001,
|
||||
LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL = 1002,
|
||||
LFG_LOCKSTATUS_QUEST_NOT_COMPLETED = 1022,
|
||||
LFG_LOCKSTATUS_MISSING_ITEM = 1025,
|
||||
LFG_LOCKSTATUS_NOT_IN_SEASON = 1031,
|
||||
LFG_LOCKSTATUS_MISSING_ACHIEVEMENT = 1034
|
||||
};
|
||||
|
||||
/// Answer state (Also used to check compatibilites)
|
||||
enum LfgAnswer
|
||||
{
|
||||
LFG_ANSWER_PENDING = -1,
|
||||
LFG_ANSWER_DENY = 0,
|
||||
LFG_ANSWER_AGREE = 1
|
||||
};
|
||||
|
||||
class Lfg5Guids;
|
||||
|
||||
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;
|
||||
|
||||
class Lfg5Guids
|
||||
{
|
||||
public:
|
||||
uint64 guid[5];
|
||||
LfgRolesMap* roles;
|
||||
Lfg5Guids()
|
||||
enum LFGEnum
|
||||
{
|
||||
memset(&guid, 0, 5*8);
|
||||
roles = nullptr;
|
||||
}
|
||||
LFG_TANKS_NEEDED = 1,
|
||||
LFG_HEALERS_NEEDED = 1,
|
||||
LFG_DPS_NEEDED = 3
|
||||
};
|
||||
|
||||
Lfg5Guids(uint64 g)
|
||||
enum LfgRoles
|
||||
{
|
||||
memset(&guid, 0, 5*8);
|
||||
guid[0] = g;
|
||||
roles = nullptr;
|
||||
}
|
||||
PLAYER_ROLE_NONE = 0x00,
|
||||
PLAYER_ROLE_LEADER = 0x01,
|
||||
PLAYER_ROLE_TANK = 0x02,
|
||||
PLAYER_ROLE_HEALER = 0x04,
|
||||
PLAYER_ROLE_DAMAGE = 0x08
|
||||
};
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x)
|
||||
enum LfgUpdateType
|
||||
{
|
||||
memcpy(guid, x.guid, 5*8);
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
LFG_UPDATETYPE_DEFAULT = 0, // Internal Use
|
||||
LFG_UPDATETYPE_LEADER_UNK1 = 1, // FIXME: At group leave
|
||||
LFG_UPDATETYPE_LEAVE_RAIDBROWSER = 2,
|
||||
LFG_UPDATETYPE_JOIN_RAIDBROWSER = 3,
|
||||
LFG_UPDATETYPE_ROLECHECK_ABORTED = 4,
|
||||
LFG_UPDATETYPE_JOIN_QUEUE = 5,
|
||||
LFG_UPDATETYPE_ROLECHECK_FAILED = 6,
|
||||
LFG_UPDATETYPE_REMOVED_FROM_QUEUE = 7,
|
||||
LFG_UPDATETYPE_PROPOSAL_FAILED = 8,
|
||||
LFG_UPDATETYPE_PROPOSAL_DECLINED = 9,
|
||||
LFG_UPDATETYPE_GROUP_FOUND = 10,
|
||||
LFG_UPDATETYPE_ADDED_TO_QUEUE = 12,
|
||||
LFG_UPDATETYPE_PROPOSAL_BEGIN = 13,
|
||||
LFG_UPDATETYPE_UPDATE_STATUS = 14,
|
||||
LFG_UPDATETYPE_GROUP_MEMBER_OFFLINE = 15,
|
||||
LFG_UPDATETYPE_GROUP_DISBAND_UNK16 = 16, // FIXME: Sometimes at group disband
|
||||
};
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x, bool /*copyRoles*/)
|
||||
enum LfgState
|
||||
{
|
||||
memcpy(guid, x.guid, 5*8);
|
||||
roles = nullptr;
|
||||
}
|
||||
LFG_STATE_NONE, // Not using LFG / LFR
|
||||
LFG_STATE_ROLECHECK, // Rolecheck active
|
||||
LFG_STATE_QUEUED, // Queued
|
||||
LFG_STATE_PROPOSAL, // Proposal active
|
||||
LFG_STATE_BOOT, // Vote kick active
|
||||
LFG_STATE_DUNGEON, // In LFG Group, in a Dungeon
|
||||
LFG_STATE_FINISHED_DUNGEON, // In LFG Group, in a finished Dungeon
|
||||
LFG_STATE_RAIDBROWSER // Using Raid finder
|
||||
};
|
||||
|
||||
~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]; }
|
||||
|
||||
uint8 size() const
|
||||
/// Instance lock types
|
||||
enum LfgLockStatusType
|
||||
{
|
||||
if (guid[2])
|
||||
LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION = 1,
|
||||
LFG_LOCKSTATUS_TOO_LOW_LEVEL = 2,
|
||||
LFG_LOCKSTATUS_TOO_HIGH_LEVEL = 3,
|
||||
LFG_LOCKSTATUS_TOO_LOW_GEAR_SCORE = 4,
|
||||
LFG_LOCKSTATUS_TOO_HIGH_GEAR_SCORE = 5,
|
||||
LFG_LOCKSTATUS_RAID_LOCKED = 6,
|
||||
LFG_LOCKSTATUS_ATTUNEMENT_TOO_LOW_LEVEL = 1001,
|
||||
LFG_LOCKSTATUS_ATTUNEMENT_TOO_HIGH_LEVEL = 1002,
|
||||
LFG_LOCKSTATUS_QUEST_NOT_COMPLETED = 1022,
|
||||
LFG_LOCKSTATUS_MISSING_ITEM = 1025,
|
||||
LFG_LOCKSTATUS_NOT_IN_SEASON = 1031,
|
||||
LFG_LOCKSTATUS_MISSING_ACHIEVEMENT = 1034
|
||||
};
|
||||
|
||||
/// Answer state (Also used to check compatibilites)
|
||||
enum LfgAnswer
|
||||
{
|
||||
LFG_ANSWER_PENDING = -1,
|
||||
LFG_ANSWER_DENY = 0,
|
||||
LFG_ANSWER_AGREE = 1
|
||||
};
|
||||
|
||||
class Lfg5Guids;
|
||||
|
||||
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;
|
||||
|
||||
class Lfg5Guids
|
||||
{
|
||||
public:
|
||||
uint64 guid[5];
|
||||
LfgRolesMap* roles;
|
||||
Lfg5Guids()
|
||||
{
|
||||
if (guid[4])
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
else if (guid[3])
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
else if (guid[1])
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (guid[0])
|
||||
{
|
||||
return 1;
|
||||
memset(&guid, 0, 5 * 8);
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void insert(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == 0)
|
||||
Lfg5Guids(uint64 g)
|
||||
{
|
||||
memset(&guid, 0, 5 * 8);
|
||||
guid[0] = g;
|
||||
return;
|
||||
roles = nullptr;
|
||||
}
|
||||
|
||||
if (g <= guid[0])
|
||||
Lfg5Guids(Lfg5Guids const& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
||||
Lfg5Guids(Lfg5Guids const& x, bool /*copyRoles*/)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
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]; }
|
||||
|
||||
uint8 size() const
|
||||
{
|
||||
if (guid[2])
|
||||
{
|
||||
if (guid[4])
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
else if (guid[3])
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
return 3;
|
||||
}
|
||||
else if (guid[1])
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
else if (guid[0])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void insert(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == 0)
|
||||
{
|
||||
guid[0] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[0])
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
}
|
||||
|
||||
if (guid[1])
|
||||
{
|
||||
guid[2] = guid[1];
|
||||
}
|
||||
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[1] == 0)
|
||||
{
|
||||
guid[1] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[1])
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
}
|
||||
|
||||
guid[2] = guid[1];
|
||||
guid[1] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2] == 0)
|
||||
{
|
||||
guid[2] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[2])
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
guid[3] = guid[2];
|
||||
guid[2] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == 0)
|
||||
{
|
||||
guid[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guid[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = g;
|
||||
}
|
||||
|
||||
void force_insert_front(const uint64& g)
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
@@ -188,296 +271,213 @@ public:
|
||||
guid[2] = guid[1];
|
||||
}
|
||||
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[1] == 0)
|
||||
void remove(const uint64& g)
|
||||
{
|
||||
guid[1] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[1])
|
||||
{
|
||||
if (guid[3])
|
||||
// avoid loops for performance
|
||||
if (guid[0] == g)
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
if (guid[1])
|
||||
{
|
||||
guid[0] = guid[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
}
|
||||
if (guid[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[2] = guid[1];
|
||||
guid[1] = g;
|
||||
if (guid[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2] == 0)
|
||||
{
|
||||
guid[2] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[2])
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
guid[3] = guid[2];
|
||||
guid[2] = g;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == 0)
|
||||
{
|
||||
guid[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
if (g <= guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
guid[3] = g;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = g;
|
||||
}
|
||||
|
||||
void force_insert_front(const uint64& g)
|
||||
{
|
||||
if (guid[3])
|
||||
{
|
||||
guid[4] = guid[3];
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
{
|
||||
guid[3] = guid[2];
|
||||
}
|
||||
|
||||
if (guid[1])
|
||||
{
|
||||
guid[2] = guid[1];
|
||||
}
|
||||
|
||||
guid[1] = guid[0];
|
||||
guid[0] = g;
|
||||
}
|
||||
|
||||
void remove(const uint64& g)
|
||||
{
|
||||
// avoid loops for performance
|
||||
if (guid[0] == g)
|
||||
{
|
||||
if (guid[1])
|
||||
{
|
||||
guid[0] = guid[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[0] = 0;
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[2])
|
||||
if (guid[1] == g)
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
if (guid[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
if (guid[2] == g)
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
if (guid[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
if (guid[3] == g)
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
if (guid[4] == g)
|
||||
{
|
||||
guid[4] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (guid[1] == g)
|
||||
bool hasGuid(const uint64& g) const
|
||||
{
|
||||
if (guid[2])
|
||||
{
|
||||
guid[1] = guid[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[1] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
|
||||
}
|
||||
|
||||
if (guid[2] == g)
|
||||
bool operator<(const Lfg5Guids& x) const
|
||||
{
|
||||
if (guid[3])
|
||||
if (guid[0] <= x.guid[0])
|
||||
{
|
||||
guid[2] = guid[3];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[2] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[3] == g)
|
||||
{
|
||||
if (guid[4])
|
||||
{
|
||||
guid[3] = guid[4];
|
||||
}
|
||||
else
|
||||
{
|
||||
guid[3] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
guid[4] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (guid[4] == g)
|
||||
{
|
||||
guid[4] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bool hasGuid(const uint64& g) const
|
||||
{
|
||||
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
|
||||
}
|
||||
|
||||
bool operator<(const Lfg5Guids& x) const
|
||||
{
|
||||
if (guid[0] <= x.guid[0])
|
||||
{
|
||||
if (guid[0] != x.guid[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[1] <= x.guid[1])
|
||||
{
|
||||
if (guid[1] != x.guid[1])
|
||||
if (guid[0] != x.guid[0])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[2] <= x.guid[2])
|
||||
if (guid[1] <= x.guid[1])
|
||||
{
|
||||
if (guid[2] != x.guid[2])
|
||||
if (guid[1] != x.guid[1])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[3] <= x.guid[3])
|
||||
if (guid[2] <= x.guid[2])
|
||||
{
|
||||
if (guid[3] != x.guid[3])
|
||||
if (guid[2] != x.guid[2])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[4] <= x.guid[4])
|
||||
if (guid[3] <= x.guid[3])
|
||||
{
|
||||
return !(guid[4] == x.guid[4]);
|
||||
if (guid[3] != x.guid[3])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (guid[4] <= x.guid[4])
|
||||
{
|
||||
return !(guid[4] == x.guid[4]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
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];
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
void operator=(const Lfg5Guids& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5 * 8);
|
||||
delete roles;
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
||||
void operator=(const Lfg5Guids& x)
|
||||
{
|
||||
memcpy(guid, x.guid, 5*8);
|
||||
delete roles;
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
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);
|
||||
return o.str();
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
return o.str();
|
||||
}
|
||||
};
|
||||
|
||||
std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
|
||||
std::string GetRolesString(uint8 roles);
|
||||
std::string GetStateString(LfgState state);
|
||||
std::string ConcatenateDungeons(LfgDungeonSet const& dungeons);
|
||||
std::string GetRolesString(uint8 roles);
|
||||
std::string GetStateString(LfgState state);
|
||||
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
@@ -10,110 +10,110 @@
|
||||
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)
|
||||
{ }
|
||||
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
|
||||
m_Leader(0), m_Dungeon(0), m_KicksLeft(LFG_GROUP_MAX_KICKS)
|
||||
{ }
|
||||
|
||||
LfgGroupData::~LfgGroupData()
|
||||
{ }
|
||||
LfgGroupData::~LfgGroupData()
|
||||
{ }
|
||||
|
||||
bool LfgGroupData::IsLfgGroup()
|
||||
{
|
||||
return m_OldState != LFG_STATE_NONE;
|
||||
}
|
||||
|
||||
void LfgGroupData::SetState(LfgState state)
|
||||
{
|
||||
switch (state)
|
||||
bool LfgGroupData::IsLfgGroup()
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
m_Dungeon = 0;
|
||||
m_KicksLeft = LFG_GROUP_MAX_KICKS;
|
||||
[[fallthrough]];
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_State = state;
|
||||
return m_OldState != LFG_STATE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgGroupData::RestoreState()
|
||||
{
|
||||
m_State = m_OldState;
|
||||
}
|
||||
void LfgGroupData::SetState(LfgState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
m_Dungeon = 0;
|
||||
m_KicksLeft = LFG_GROUP_MAX_KICKS;
|
||||
[[fallthrough]];
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_State = state;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgGroupData::AddPlayer(uint64 guid)
|
||||
{
|
||||
m_Players.insert(guid);
|
||||
}
|
||||
void LfgGroupData::RestoreState()
|
||||
{
|
||||
m_State = m_OldState;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::RemovePlayer(uint64 guid)
|
||||
{
|
||||
LfgGuidSet::iterator it = m_Players.find(guid);
|
||||
if (it != m_Players.end())
|
||||
m_Players.erase(it);
|
||||
return uint8(m_Players.size());
|
||||
}
|
||||
void LfgGroupData::AddPlayer(uint64 guid)
|
||||
{
|
||||
m_Players.insert(guid);
|
||||
}
|
||||
|
||||
void LfgGroupData::RemoveAllPlayers()
|
||||
{
|
||||
m_Players.clear();
|
||||
}
|
||||
uint8 LfgGroupData::RemovePlayer(uint64 guid)
|
||||
{
|
||||
LfgGuidSet::iterator it = m_Players.find(guid);
|
||||
if (it != m_Players.end())
|
||||
m_Players.erase(it);
|
||||
return uint8(m_Players.size());
|
||||
}
|
||||
|
||||
void LfgGroupData::SetLeader(uint64 guid)
|
||||
{
|
||||
m_Leader = guid;
|
||||
}
|
||||
void LfgGroupData::RemoveAllPlayers()
|
||||
{
|
||||
m_Players.clear();
|
||||
}
|
||||
|
||||
void LfgGroupData::SetDungeon(uint32 dungeon)
|
||||
{
|
||||
m_Dungeon = dungeon;
|
||||
}
|
||||
void LfgGroupData::SetLeader(uint64 guid)
|
||||
{
|
||||
m_Leader = guid;
|
||||
}
|
||||
|
||||
void LfgGroupData::DecreaseKicksLeft()
|
||||
{
|
||||
if (m_KicksLeft)
|
||||
--m_KicksLeft;
|
||||
}
|
||||
void LfgGroupData::SetDungeon(uint32 dungeon)
|
||||
{
|
||||
m_Dungeon = dungeon;
|
||||
}
|
||||
|
||||
LfgState LfgGroupData::GetState() const
|
||||
{
|
||||
return m_State;
|
||||
}
|
||||
void LfgGroupData::DecreaseKicksLeft()
|
||||
{
|
||||
if (m_KicksLeft)
|
||||
--m_KicksLeft;
|
||||
}
|
||||
|
||||
LfgState LfgGroupData::GetOldState() const
|
||||
{
|
||||
return m_OldState;
|
||||
}
|
||||
LfgState LfgGroupData::GetState() const
|
||||
{
|
||||
return m_State;
|
||||
}
|
||||
|
||||
LfgGuidSet const& LfgGroupData::GetPlayers() const
|
||||
{
|
||||
return m_Players;
|
||||
}
|
||||
LfgState LfgGroupData::GetOldState() const
|
||||
{
|
||||
return m_OldState;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::GetPlayerCount() const
|
||||
{
|
||||
return m_Players.size();
|
||||
}
|
||||
LfgGuidSet const& LfgGroupData::GetPlayers() const
|
||||
{
|
||||
return m_Players;
|
||||
}
|
||||
|
||||
uint64 LfgGroupData::GetLeader() const
|
||||
{
|
||||
return m_Leader;
|
||||
}
|
||||
uint8 LfgGroupData::GetPlayerCount() const
|
||||
{
|
||||
return m_Players.size();
|
||||
}
|
||||
|
||||
uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
|
||||
{
|
||||
if (asId)
|
||||
return (m_Dungeon & 0x00FFFFFF);
|
||||
else
|
||||
return m_Dungeon;
|
||||
}
|
||||
uint64 LfgGroupData::GetLeader() const
|
||||
{
|
||||
return m_Leader;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::GetKicksLeft() const
|
||||
{
|
||||
return m_KicksLeft;
|
||||
}
|
||||
uint32 LfgGroupData::GetDungeon(bool asId /* = true */) const
|
||||
{
|
||||
if (asId)
|
||||
return (m_Dungeon & 0x00FFFFFF);
|
||||
else
|
||||
return m_Dungeon;
|
||||
}
|
||||
|
||||
uint8 LfgGroupData::GetKicksLeft() const
|
||||
{
|
||||
return m_KicksLeft;
|
||||
}
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
@@ -12,16 +12,16 @@
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
enum LfgGroupEnum
|
||||
{
|
||||
LFG_GROUP_MAX_KICKS = 3,
|
||||
};
|
||||
enum LfgGroupEnum
|
||||
{
|
||||
LFG_GROUP_MAX_KICKS = 3,
|
||||
};
|
||||
|
||||
/**
|
||||
Stores all lfg data needed about a group.
|
||||
*/
|
||||
class LfgGroupData
|
||||
{
|
||||
/**
|
||||
Stores all lfg data needed about a group.
|
||||
*/
|
||||
class LfgGroupData
|
||||
{
|
||||
public:
|
||||
LfgGroupData();
|
||||
~LfgGroupData();
|
||||
@@ -65,7 +65,7 @@ class LfgGroupData
|
||||
uint32 m_Dungeon; ///< Dungeon entry
|
||||
// Vote Kick
|
||||
uint8 m_KicksLeft; ///< Number of kicks left
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,362 +22,380 @@ class Quest;
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
enum LfgOptions
|
||||
{
|
||||
LFG_OPTION_ENABLE_DUNGEON_FINDER = 0x01,
|
||||
LFG_OPTION_ENABLE_RAID_BROWSER = 0x02,
|
||||
};
|
||||
enum LfgOptions
|
||||
{
|
||||
LFG_OPTION_ENABLE_DUNGEON_FINDER = 0x01,
|
||||
LFG_OPTION_ENABLE_RAID_BROWSER = 0x02,
|
||||
};
|
||||
|
||||
enum LFGMgrEnum
|
||||
{
|
||||
LFG_TIME_ROLECHECK = 45 * IN_MILLISECONDS,
|
||||
LFG_TIME_BOOT = 120,
|
||||
LFG_TIME_PROPOSAL = 40,
|
||||
LFG_QUEUEUPDATE_INTERVAL = 8 * IN_MILLISECONDS,
|
||||
LFG_SPELL_DUNGEON_COOLDOWN = 71328,
|
||||
LFG_SPELL_DUNGEON_DESERTER = 71041,
|
||||
LFG_SPELL_LUCK_OF_THE_DRAW = 72221,
|
||||
LFG_GROUP_KICK_VOTES_NEEDED = 3
|
||||
};
|
||||
enum LFGMgrEnum
|
||||
{
|
||||
LFG_TIME_ROLECHECK = 45 * IN_MILLISECONDS,
|
||||
LFG_TIME_BOOT = 120,
|
||||
LFG_TIME_PROPOSAL = 40,
|
||||
LFG_QUEUEUPDATE_INTERVAL = 8 * IN_MILLISECONDS,
|
||||
LFG_SPELL_DUNGEON_COOLDOWN = 71328,
|
||||
LFG_SPELL_DUNGEON_DESERTER = 71041,
|
||||
LFG_SPELL_LUCK_OF_THE_DRAW = 72221,
|
||||
LFG_GROUP_KICK_VOTES_NEEDED = 3
|
||||
};
|
||||
|
||||
enum LfgFlags
|
||||
{
|
||||
LFG_FLAG_UNK1 = 0x1,
|
||||
LFG_FLAG_UNK2 = 0x2,
|
||||
LFG_FLAG_SEASONAL = 0x4,
|
||||
LFG_FLAG_UNK3 = 0x8
|
||||
};
|
||||
enum LfgFlags
|
||||
{
|
||||
LFG_FLAG_UNK1 = 0x1,
|
||||
LFG_FLAG_UNK2 = 0x2,
|
||||
LFG_FLAG_SEASONAL = 0x4,
|
||||
LFG_FLAG_UNK3 = 0x8
|
||||
};
|
||||
|
||||
/// Determines the type of instance
|
||||
enum LfgType
|
||||
{
|
||||
LFG_TYPE_NONE = 0,
|
||||
LFG_TYPE_DUNGEON = 1,
|
||||
LFG_TYPE_RAID = 2,
|
||||
LFG_TYPE_HEROIC = 5,
|
||||
LFG_TYPE_RANDOM = 6
|
||||
};
|
||||
/// Determines the type of instance
|
||||
enum LfgType
|
||||
{
|
||||
LFG_TYPE_NONE = 0,
|
||||
LFG_TYPE_DUNGEON = 1,
|
||||
LFG_TYPE_RAID = 2,
|
||||
LFG_TYPE_HEROIC = 5,
|
||||
LFG_TYPE_RANDOM = 6
|
||||
};
|
||||
|
||||
/// Proposal states
|
||||
enum LfgProposalState
|
||||
{
|
||||
LFG_PROPOSAL_INITIATING = 0,
|
||||
LFG_PROPOSAL_FAILED = 1,
|
||||
LFG_PROPOSAL_SUCCESS = 2
|
||||
};
|
||||
/// Proposal states
|
||||
enum LfgProposalState
|
||||
{
|
||||
LFG_PROPOSAL_INITIATING = 0,
|
||||
LFG_PROPOSAL_FAILED = 1,
|
||||
LFG_PROPOSAL_SUCCESS = 2
|
||||
};
|
||||
|
||||
/// Teleport errors
|
||||
enum LfgTeleportError
|
||||
{
|
||||
// 7 = "You can't do that right now" | 5 = No client reaction
|
||||
LFG_TELEPORTERROR_OK = 0, // Internal use
|
||||
LFG_TELEPORTERROR_PLAYER_DEAD = 1,
|
||||
LFG_TELEPORTERROR_FALLING = 2,
|
||||
LFG_TELEPORTERROR_IN_VEHICLE = 3,
|
||||
LFG_TELEPORTERROR_FATIGUE = 4,
|
||||
LFG_TELEPORTERROR_INVALID_LOCATION = 6,
|
||||
LFG_TELEPORTERROR_CHARMING = 8 // FIXME - It can be 7 or 8 (Need proper data)
|
||||
};
|
||||
/// Teleport errors
|
||||
enum LfgTeleportError
|
||||
{
|
||||
// 7 = "You can't do that right now" | 5 = No client reaction
|
||||
LFG_TELEPORTERROR_OK = 0, // Internal use
|
||||
LFG_TELEPORTERROR_PLAYER_DEAD = 1,
|
||||
LFG_TELEPORTERROR_FALLING = 2,
|
||||
LFG_TELEPORTERROR_IN_VEHICLE = 3,
|
||||
LFG_TELEPORTERROR_FATIGUE = 4,
|
||||
LFG_TELEPORTERROR_INVALID_LOCATION = 6,
|
||||
LFG_TELEPORTERROR_CHARMING = 8 // FIXME - It can be 7 or 8 (Need proper data)
|
||||
};
|
||||
|
||||
/// Queue join results
|
||||
enum LfgJoinResult
|
||||
{
|
||||
// 3 = No client reaction | 18 = "Rolecheck failed"
|
||||
LFG_JOIN_OK = 0, // Joined (no client msg)
|
||||
LFG_JOIN_FAILED = 1, // RoleCheck Failed
|
||||
LFG_JOIN_GROUPFULL = 2, // Your group is full
|
||||
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_PARTY_NOT_MEET_REQS = 6, // One or more party members do not meet the requirements for the chosen dungeons
|
||||
LFG_JOIN_MIXED_RAID_DUNGEON = 7, // You cannot mix dungeons, raids, and random when picking dungeons
|
||||
LFG_JOIN_MULTI_REALM = 8, // The dungeon you chose does not support players from multiple realms
|
||||
LFG_JOIN_DISCONNECTED = 9, // One or more party members are pending invites or disconnected
|
||||
LFG_JOIN_PARTY_INFO_FAILED = 10, // Could not retrieve information about some party members
|
||||
LFG_JOIN_DUNGEON_INVALID = 11, // One or more dungeons was not valid
|
||||
LFG_JOIN_DESERTER = 12, // You can not queue for dungeons until your deserter debuff wears off
|
||||
LFG_JOIN_PARTY_DESERTER = 13, // One or more party members has a deserter debuff
|
||||
LFG_JOIN_RANDOM_COOLDOWN = 14, // You can not queue for random dungeons while 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_USING_BG_SYSTEM = 17 // You can not use the dungeon system while in BG or arenas
|
||||
};
|
||||
/// Queue join results
|
||||
enum LfgJoinResult
|
||||
{
|
||||
// 3 = No client reaction | 18 = "Rolecheck failed"
|
||||
LFG_JOIN_OK = 0, // Joined (no client msg)
|
||||
LFG_JOIN_FAILED = 1, // RoleCheck Failed
|
||||
LFG_JOIN_GROUPFULL = 2, // Your group is full
|
||||
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_PARTY_NOT_MEET_REQS = 6, // One or more party members do not meet the requirements for the chosen dungeons
|
||||
LFG_JOIN_MIXED_RAID_DUNGEON = 7, // You cannot mix dungeons, raids, and random when picking dungeons
|
||||
LFG_JOIN_MULTI_REALM = 8, // The dungeon you chose does not support players from multiple realms
|
||||
LFG_JOIN_DISCONNECTED = 9, // One or more party members are pending invites or disconnected
|
||||
LFG_JOIN_PARTY_INFO_FAILED = 10, // Could not retrieve information about some party members
|
||||
LFG_JOIN_DUNGEON_INVALID = 11, // One or more dungeons was not valid
|
||||
LFG_JOIN_DESERTER = 12, // You can not queue for dungeons until your deserter debuff wears off
|
||||
LFG_JOIN_PARTY_DESERTER = 13, // One or more party members has a deserter debuff
|
||||
LFG_JOIN_RANDOM_COOLDOWN = 14, // You can not queue for random dungeons while 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_USING_BG_SYSTEM = 17 // You can not use the dungeon system while in BG or arenas
|
||||
};
|
||||
|
||||
/// Role check states
|
||||
enum LfgRoleCheckState
|
||||
{
|
||||
LFG_ROLECHECK_DEFAULT = 0, // Internal use = Not initialized.
|
||||
LFG_ROLECHECK_FINISHED = 1, // Role check finished
|
||||
LFG_ROLECHECK_INITIALITING = 2, // Role check begins
|
||||
LFG_ROLECHECK_MISSING_ROLE = 3, // Someone didn't selected a role after 2 mins
|
||||
LFG_ROLECHECK_WRONG_ROLES = 4, // Can't form a group with that role selection
|
||||
LFG_ROLECHECK_ABORTED = 5, // Someone leave the group
|
||||
LFG_ROLECHECK_NO_ROLE = 6 // Someone selected no role
|
||||
};
|
||||
/// Role check states
|
||||
enum LfgRoleCheckState
|
||||
{
|
||||
LFG_ROLECHECK_DEFAULT = 0, // Internal use = Not initialized.
|
||||
LFG_ROLECHECK_FINISHED = 1, // Role check finished
|
||||
LFG_ROLECHECK_INITIALITING = 2, // Role check begins
|
||||
LFG_ROLECHECK_MISSING_ROLE = 3, // Someone didn't selected a role after 2 mins
|
||||
LFG_ROLECHECK_WRONG_ROLES = 4, // Can't form a group with that role selection
|
||||
LFG_ROLECHECK_ABORTED = 5, // Someone leave the group
|
||||
LFG_ROLECHECK_NO_ROLE = 6 // Someone selected no role
|
||||
};
|
||||
|
||||
enum LfgUpdateFlag // pussywizard: for raid browser
|
||||
{
|
||||
LFG_UPDATE_FLAG_NONE = 0x00,
|
||||
LFG_UPDATE_FLAG_CHARACTERINFO = 0x01,
|
||||
LFG_UPDATE_FLAG_COMMENT = 0x02,
|
||||
LFG_UPDATE_FLAG_GROUPLEADER = 0x04,
|
||||
LFG_UPDATE_FLAG_GROUPGUID = 0x08,
|
||||
LFG_UPDATE_FLAG_ROLES = 0x10,
|
||||
LFG_UPDATE_FLAG_AREA = 0x20,
|
||||
LFG_UPDATE_FLAG_STATUS = 0x40,
|
||||
LFG_UPDATE_FLAG_BINDED = 0x80
|
||||
};
|
||||
enum LfgUpdateFlag // pussywizard: for raid browser
|
||||
{
|
||||
LFG_UPDATE_FLAG_NONE = 0x00,
|
||||
LFG_UPDATE_FLAG_CHARACTERINFO = 0x01,
|
||||
LFG_UPDATE_FLAG_COMMENT = 0x02,
|
||||
LFG_UPDATE_FLAG_GROUPLEADER = 0x04,
|
||||
LFG_UPDATE_FLAG_GROUPGUID = 0x08,
|
||||
LFG_UPDATE_FLAG_ROLES = 0x10,
|
||||
LFG_UPDATE_FLAG_AREA = 0x20,
|
||||
LFG_UPDATE_FLAG_STATUS = 0x40,
|
||||
LFG_UPDATE_FLAG_BINDED = 0x80
|
||||
};
|
||||
|
||||
struct RBEntryInfo
|
||||
{
|
||||
RBEntryInfo() {}
|
||||
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
|
||||
uint8 roles;
|
||||
std::string comment;
|
||||
};
|
||||
struct RBEntryInfo
|
||||
{
|
||||
RBEntryInfo() {}
|
||||
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
|
||||
uint8 roles;
|
||||
std::string comment;
|
||||
};
|
||||
|
||||
struct RBInternalInfo
|
||||
{
|
||||
uint64 guid;
|
||||
std::string comment;
|
||||
bool isGroupLeader;
|
||||
uint64 groupGuid;
|
||||
uint8 roles;
|
||||
uint32 encounterMask;
|
||||
uint64 instanceGuid;
|
||||
struct RBInternalInfo
|
||||
{
|
||||
uint64 guid;
|
||||
std::string comment;
|
||||
bool isGroupLeader;
|
||||
uint64 groupGuid;
|
||||
uint8 roles;
|
||||
uint32 encounterMask;
|
||||
uint64 instanceGuid;
|
||||
|
||||
// additional character info parameters:
|
||||
uint8 _online;
|
||||
uint8 _level;
|
||||
uint8 _class;
|
||||
uint8 _race;
|
||||
float _avgItemLevel;
|
||||
// --
|
||||
uint8 _talents0;
|
||||
uint8 _talents1;
|
||||
uint8 _talents2;
|
||||
uint32 _area;
|
||||
uint32 _armor;
|
||||
uint32 _spellDamage;
|
||||
uint32 _spellHeal;
|
||||
// --
|
||||
uint32 _critRatingMelee;
|
||||
uint32 _critRatingRanged;
|
||||
uint32 _critRatingSpell;
|
||||
float _mp5;
|
||||
float _mp5combat;
|
||||
// --
|
||||
uint32 _attackPower;
|
||||
uint32 _agility;
|
||||
uint32 _health;
|
||||
uint32 _mana;
|
||||
uint32 _defenseSkill;
|
||||
// --
|
||||
uint32 _dodgeRating;
|
||||
uint32 _blockRating;
|
||||
uint32 _parryRating;
|
||||
uint32 _hasteRating;
|
||||
uint32 _expertiseRating;
|
||||
// additional character info parameters:
|
||||
uint8 _online;
|
||||
uint8 _level;
|
||||
uint8 _class;
|
||||
uint8 _race;
|
||||
float _avgItemLevel;
|
||||
// --
|
||||
uint8 _talents0;
|
||||
uint8 _talents1;
|
||||
uint8 _talents2;
|
||||
uint32 _area;
|
||||
uint32 _armor;
|
||||
uint32 _spellDamage;
|
||||
uint32 _spellHeal;
|
||||
// --
|
||||
uint32 _critRatingMelee;
|
||||
uint32 _critRatingRanged;
|
||||
uint32 _critRatingSpell;
|
||||
float _mp5;
|
||||
float _mp5combat;
|
||||
// --
|
||||
uint32 _attackPower;
|
||||
uint32 _agility;
|
||||
uint32 _health;
|
||||
uint32 _mana;
|
||||
uint32 _defenseSkill;
|
||||
// --
|
||||
uint32 _dodgeRating;
|
||||
uint32 _blockRating;
|
||||
uint32 _parryRating;
|
||||
uint32 _hasteRating;
|
||||
uint32 _expertiseRating;
|
||||
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 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,
|
||||
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
|
||||
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 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,
|
||||
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
|
||||
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
|
||||
: guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
|
||||
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
|
||||
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
|
||||
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
|
||||
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
|
||||
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
|
||||
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
|
||||
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
|
||||
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
|
||||
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
|
||||
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
|
||||
{}
|
||||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel - i._avgItemLevel) < 0.01f
|
||||
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5 - i._mp5) < 0.01f && fabs(_mp5combat - i._mp5combat) < 0.01f
|
||||
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
|
||||
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
|
||||
}
|
||||
void CopyStats(RBInternalInfo const& i)
|
||||
{
|
||||
_avgItemLevel = i._avgItemLevel;
|
||||
_talents0 = i._talents0;
|
||||
_talents1 = i._talents1;
|
||||
_talents2 = i._talents2;
|
||||
_area = i._area;
|
||||
_armor = i._armor;
|
||||
_spellDamage = i._spellDamage;
|
||||
_spellHeal = i._spellHeal;
|
||||
_critRatingMelee = i._critRatingMelee;
|
||||
_critRatingRanged = i._critRatingRanged;
|
||||
_critRatingSpell = i._critRatingSpell;
|
||||
_mp5 = i._mp5;
|
||||
_mp5combat = i._mp5combat;
|
||||
_attackPower = i._attackPower;
|
||||
_agility = i._agility;
|
||||
_health = i._health;
|
||||
_mana = i._mana;
|
||||
_defenseSkill = i._defenseSkill;
|
||||
_dodgeRating = i._dodgeRating;
|
||||
_blockRating = i._blockRating;
|
||||
_parryRating = i._parryRating;
|
||||
_hasteRating = i._hasteRating;
|
||||
_expertiseRating = i._expertiseRating;
|
||||
}
|
||||
};
|
||||
|
||||
// Forward declaration (just to have all typedef together)
|
||||
struct LFGDungeonData;
|
||||
struct LfgReward;
|
||||
struct LfgQueueInfo;
|
||||
struct LfgRoleCheck;
|
||||
struct LfgProposal;
|
||||
struct LfgProposalPlayer;
|
||||
struct LfgPlayerBoot;
|
||||
|
||||
typedef std::map<uint8, LFGQueue> LfgQueueContainer;
|
||||
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<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::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer;
|
||||
|
||||
// Data needed by SMSG_LFG_JOIN_RESULT
|
||||
struct LfgJoinResultData
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel-i._avgItemLevel) < 0.01f
|
||||
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5-i._mp5) < 0.01f && fabs(_mp5combat-i._mp5combat) < 0.01f
|
||||
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
|
||||
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
|
||||
}
|
||||
void CopyStats(RBInternalInfo const& i)
|
||||
LfgJoinResultData(LfgJoinResult _result = LFG_JOIN_OK, LfgRoleCheckState _state = LFG_ROLECHECK_DEFAULT):
|
||||
result(_result), state(_state) {}
|
||||
LfgJoinResult result;
|
||||
LfgRoleCheckState state;
|
||||
LfgLockPartyMap lockmap;
|
||||
};
|
||||
|
||||
// Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER
|
||||
struct LfgUpdateData
|
||||
{
|
||||
_avgItemLevel = i._avgItemLevel;
|
||||
_talents0 = i._talents0; _talents1 = i._talents1; _talents2 = i._talents2; _area = i._area; _armor = i._armor; _spellDamage = i._spellDamage; _spellHeal = i._spellHeal;
|
||||
_critRatingMelee = i._critRatingMelee; _critRatingRanged = i._critRatingRanged; _critRatingSpell = i._critRatingSpell; _mp5 = i._mp5; _mp5combat = i._mp5combat;
|
||||
_attackPower = i._attackPower; _agility = i._agility; _health = i._health; _mana = i._mana; _defenseSkill = i._defenseSkill;
|
||||
_dodgeRating = i._dodgeRating; _blockRating = i._blockRating; _parryRating = i._parryRating; _hasteRating = i._hasteRating; _expertiseRating = i._expertiseRating;
|
||||
}
|
||||
};
|
||||
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
|
||||
updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""):
|
||||
updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { }
|
||||
|
||||
// Forward declaration (just to have all typedef together)
|
||||
struct LFGDungeonData;
|
||||
struct LfgReward;
|
||||
struct LfgQueueInfo;
|
||||
struct LfgRoleCheck;
|
||||
struct LfgProposal;
|
||||
struct LfgProposalPlayer;
|
||||
struct LfgPlayerBoot;
|
||||
LfgUpdateType updateType;
|
||||
LfgState state;
|
||||
LfgDungeonSet dungeons;
|
||||
std::string comment;
|
||||
};
|
||||
|
||||
typedef std::map<uint8, LFGQueue> LfgQueueContainer;
|
||||
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<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::unordered_map<uint32, LFGDungeonData> LFGDungeonContainer;
|
||||
// Data needed by SMSG_LFG_QUEUE_STATUS
|
||||
struct LfgQueueStatusData
|
||||
{
|
||||
LfgQueueStatusData(uint32 _dungeonId = 0, int32 _waitTime = -1, int32 _waitTimeAvg = -1, int32 _waitTimeTank = -1, int32 _waitTimeHealer = -1,
|
||||
int32 _waitTimeDps = -1, uint32 _queuedTime = 0, uint8 _tanks = 0, uint8 _healers = 0, uint8 _dps = 0) :
|
||||
dungeonId(_dungeonId), waitTime(_waitTime), waitTimeAvg(_waitTimeAvg), waitTimeTank(_waitTimeTank), waitTimeHealer(_waitTimeHealer),
|
||||
waitTimeDps(_waitTimeDps), queuedTime(_queuedTime), tanks(_tanks), healers(_healers), dps(_dps) {}
|
||||
|
||||
// Data needed by SMSG_LFG_JOIN_RESULT
|
||||
struct LfgJoinResultData
|
||||
{
|
||||
LfgJoinResultData(LfgJoinResult _result = LFG_JOIN_OK, LfgRoleCheckState _state = LFG_ROLECHECK_DEFAULT):
|
||||
result(_result), state(_state) {}
|
||||
LfgJoinResult result;
|
||||
LfgRoleCheckState state;
|
||||
LfgLockPartyMap lockmap;
|
||||
};
|
||||
uint32 dungeonId;
|
||||
int32 waitTime;
|
||||
int32 waitTimeAvg;
|
||||
int32 waitTimeTank;
|
||||
int32 waitTimeHealer;
|
||||
int32 waitTimeDps;
|
||||
uint32 queuedTime;
|
||||
uint8 tanks;
|
||||
uint8 healers;
|
||||
uint8 dps;
|
||||
};
|
||||
|
||||
// Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER
|
||||
struct LfgUpdateData
|
||||
{
|
||||
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
|
||||
updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""):
|
||||
updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { }
|
||||
struct LfgPlayerRewardData
|
||||
{
|
||||
LfgPlayerRewardData(uint32 random, uint32 current, bool _done, Quest const* _quest):
|
||||
rdungeonEntry(random), sdungeonEntry(current), done(_done), quest(_quest) { }
|
||||
uint32 rdungeonEntry;
|
||||
uint32 sdungeonEntry;
|
||||
bool done;
|
||||
Quest const* quest;
|
||||
};
|
||||
|
||||
LfgUpdateType updateType;
|
||||
LfgState state;
|
||||
LfgDungeonSet dungeons;
|
||||
std::string comment;
|
||||
};
|
||||
/// Reward info
|
||||
struct LfgReward
|
||||
{
|
||||
LfgReward(uint32 _maxLevel = 0, uint32 _firstQuest = 0, uint32 _otherQuest = 0):
|
||||
maxLevel(_maxLevel), firstQuest(_firstQuest), otherQuest(_otherQuest) { }
|
||||
|
||||
// Data needed by SMSG_LFG_QUEUE_STATUS
|
||||
struct LfgQueueStatusData
|
||||
{
|
||||
LfgQueueStatusData(uint32 _dungeonId = 0, int32 _waitTime = -1, int32 _waitTimeAvg = -1, int32 _waitTimeTank = -1, int32 _waitTimeHealer = -1,
|
||||
int32 _waitTimeDps = -1, uint32 _queuedTime = 0, uint8 _tanks = 0, uint8 _healers = 0, uint8 _dps = 0) :
|
||||
dungeonId(_dungeonId), waitTime(_waitTime), waitTimeAvg(_waitTimeAvg), waitTimeTank(_waitTimeTank), waitTimeHealer(_waitTimeHealer),
|
||||
waitTimeDps(_waitTimeDps), queuedTime(_queuedTime), tanks(_tanks), healers(_healers), dps(_dps) {}
|
||||
uint32 maxLevel;
|
||||
uint32 firstQuest;
|
||||
uint32 otherQuest;
|
||||
};
|
||||
|
||||
uint32 dungeonId;
|
||||
int32 waitTime;
|
||||
int32 waitTimeAvg;
|
||||
int32 waitTimeTank;
|
||||
int32 waitTimeHealer;
|
||||
int32 waitTimeDps;
|
||||
uint32 queuedTime;
|
||||
uint8 tanks;
|
||||
uint8 healers;
|
||||
uint8 dps;
|
||||
};
|
||||
/// Stores player data related to proposal to join
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
|
||||
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
|
||||
};
|
||||
|
||||
struct LfgPlayerRewardData
|
||||
{
|
||||
LfgPlayerRewardData(uint32 random, uint32 current, bool _done, Quest const* _quest):
|
||||
rdungeonEntry(random), sdungeonEntry(current), done(_done), quest(_quest) { }
|
||||
uint32 rdungeonEntry;
|
||||
uint32 sdungeonEntry;
|
||||
bool done;
|
||||
Quest const* quest;
|
||||
};
|
||||
|
||||
/// Reward info
|
||||
struct LfgReward
|
||||
{
|
||||
LfgReward(uint32 _maxLevel = 0, uint32 _firstQuest = 0, uint32 _otherQuest = 0):
|
||||
maxLevel(_maxLevel), firstQuest(_firstQuest), otherQuest(_otherQuest) { }
|
||||
|
||||
uint32 maxLevel;
|
||||
uint32 firstQuest;
|
||||
uint32 otherQuest;
|
||||
};
|
||||
|
||||
/// Stores player data related to proposal to join
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING), group(0) { }
|
||||
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
|
||||
};
|
||||
|
||||
/// 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)
|
||||
/// 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)
|
||||
{ }
|
||||
|
||||
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.
|
||||
time_t cancelTime; ///< Time when we will cancel this proposal
|
||||
uint32 encounters; ///< Dungeon Encounters
|
||||
bool isNew; ///< Determines if it's new group or not
|
||||
Lfg5Guids queues; ///< Queue Ids to remove/readd
|
||||
LfgGuidList showorder; ///< Show order in update window
|
||||
LfgProposalPlayerContainer players; ///< Players data
|
||||
};
|
||||
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.
|
||||
time_t cancelTime; ///< Time when we will cancel this proposal
|
||||
uint32 encounters; ///< Dungeon Encounters
|
||||
bool isNew; ///< Determines if it's new group or not
|
||||
Lfg5Guids queues; ///< Queue Ids to remove/readd
|
||||
LfgGuidList showorder; ///< Show order in update window
|
||||
LfgProposalPlayerContainer players; ///< Players data
|
||||
};
|
||||
|
||||
/// Stores all rolecheck info of a group that wants to join
|
||||
struct LfgRoleCheck
|
||||
{
|
||||
time_t cancelTime; ///< Time when the rolecheck will fail
|
||||
LfgRolesMap roles; ///< Player selected roles
|
||||
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
|
||||
};
|
||||
/// Stores all rolecheck info of a group that wants to join
|
||||
struct LfgRoleCheck
|
||||
{
|
||||
time_t cancelTime; ///< Time when the rolecheck will fail
|
||||
LfgRolesMap roles; ///< Player selected roles
|
||||
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
|
||||
};
|
||||
|
||||
/// Stores information of a current vote to kick someone from a group
|
||||
struct LfgPlayerBoot
|
||||
{
|
||||
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)
|
||||
std::string reason; ///< kick reason
|
||||
};
|
||||
/// Stores information of a current vote to kick someone from a group
|
||||
struct LfgPlayerBoot
|
||||
{
|
||||
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)
|
||||
std::string reason; ///< kick reason
|
||||
};
|
||||
|
||||
struct LFGDungeonData
|
||||
{
|
||||
LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0),
|
||||
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
struct LFGDungeonData
|
||||
{
|
||||
LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0),
|
||||
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
{ }
|
||||
LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map),
|
||||
type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype),
|
||||
minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)),
|
||||
seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map),
|
||||
type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype),
|
||||
minlevel(dbc->minlevel), maxlevel(dbc->maxlevel), difficulty(Difficulty(dbc->difficulty)),
|
||||
seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
{ }
|
||||
|
||||
uint32 id;
|
||||
std::string name;
|
||||
uint16 map;
|
||||
uint8 type;
|
||||
uint8 expansion;
|
||||
uint8 group;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
Difficulty difficulty;
|
||||
bool seasonal;
|
||||
float x, y, z, o;
|
||||
uint32 id;
|
||||
std::string name;
|
||||
uint16 map;
|
||||
uint8 type;
|
||||
uint8 expansion;
|
||||
uint8 group;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
Difficulty difficulty;
|
||||
bool seasonal;
|
||||
float x, y, z, o;
|
||||
|
||||
// Helpers
|
||||
uint32 Entry() const { return id + (type << 24); }
|
||||
};
|
||||
// Helpers
|
||||
uint32 Entry() const { return id + (type << 24); }
|
||||
};
|
||||
|
||||
class LFGMgr
|
||||
{
|
||||
class LFGMgr
|
||||
{
|
||||
private:
|
||||
LFGMgr();
|
||||
~LFGMgr();
|
||||
@@ -528,7 +546,7 @@ class LFGMgr
|
||||
/// Checks if all players are queued
|
||||
bool AllQueued(Lfg5Guids const& check);
|
||||
/// Checks if given roles match, modifies given roles map with new roles
|
||||
static uint8 CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
||||
static uint8 CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag = true);
|
||||
/// Checks if given players are ignoring each other
|
||||
static bool HasIgnore(uint64 guid1, uint64 guid2);
|
||||
/// Sends queue status to player
|
||||
@@ -553,7 +571,7 @@ class LFGMgr
|
||||
void MakeNewGroup(LfgProposal const& proposal);
|
||||
|
||||
// Generic
|
||||
LFGQueue &GetQueue(uint64 guid);
|
||||
LFGQueue& GetQueue(uint64 guid);
|
||||
LfgDungeonSet const& GetDungeonsByRandom(uint32 randomdungeon);
|
||||
LfgType GetDungeonType(uint32 dungeon);
|
||||
|
||||
@@ -585,7 +603,7 @@ class LFGMgr
|
||||
LfgPlayerBootContainer BootsStore; ///< Current player kicks
|
||||
LfgPlayerDataContainer PlayersStore; ///< Player data
|
||||
LfgGroupDataContainer GroupsStore; ///< Group data
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
|
||||
@@ -10,126 +10,126 @@
|
||||
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("")
|
||||
{}
|
||||
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("")
|
||||
{}
|
||||
|
||||
LfgPlayerData::~LfgPlayerData()
|
||||
{
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetState(LfgState state)
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
switch (state)
|
||||
LfgPlayerData::~LfgPlayerData()
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
m_Roles = 0;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetState(LfgState state)
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
m_Roles = 0;
|
||||
m_SelectedDungeons.clear();
|
||||
m_Comment = "";
|
||||
[[fallthrough]];
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_State = state;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgPlayerData::RestoreState()
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
if (m_OldState == LFG_STATE_NONE)
|
||||
{
|
||||
m_SelectedDungeons.clear();
|
||||
m_Comment = "";
|
||||
[[fallthrough]];
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = state;
|
||||
[[fallthrough]];
|
||||
default:
|
||||
m_State = state;
|
||||
m_Roles = 0;
|
||||
}
|
||||
m_State = m_OldState;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgPlayerData::RestoreState()
|
||||
{
|
||||
if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
|
||||
return;
|
||||
|
||||
if (m_OldState == LFG_STATE_NONE)
|
||||
void LfgPlayerData::SetLockedDungeons(LfgLockMap const& lockStatus)
|
||||
{
|
||||
m_SelectedDungeons.clear();
|
||||
m_Roles = 0;
|
||||
m_LockedDungeons = lockStatus;
|
||||
}
|
||||
m_State = m_OldState;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetLockedDungeons(LfgLockMap const& lockStatus)
|
||||
{
|
||||
m_LockedDungeons = lockStatus;
|
||||
}
|
||||
void LfgPlayerData::SetTeam(TeamId teamId)
|
||||
{
|
||||
m_TeamId = teamId;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetTeam(TeamId teamId)
|
||||
{
|
||||
m_TeamId = teamId;
|
||||
}
|
||||
void LfgPlayerData::SetGroup(uint64 group)
|
||||
{
|
||||
m_Group = group;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetGroup(uint64 group)
|
||||
{
|
||||
m_Group = group;
|
||||
}
|
||||
void LfgPlayerData::SetRoles(uint8 roles)
|
||||
{
|
||||
m_Roles = roles;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetRoles(uint8 roles)
|
||||
{
|
||||
m_Roles = roles;
|
||||
}
|
||||
void LfgPlayerData::SetComment(std::string const& comment)
|
||||
{
|
||||
m_Comment = comment;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetComment(std::string const& comment)
|
||||
{
|
||||
m_Comment = comment;
|
||||
}
|
||||
void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
|
||||
{
|
||||
m_SelectedDungeons = dungeons;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
|
||||
{
|
||||
m_SelectedDungeons = dungeons;
|
||||
}
|
||||
void LfgPlayerData::SetRandomPlayersCount(uint8 count)
|
||||
{
|
||||
m_randomPlayers = count;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetRandomPlayersCount(uint8 count)
|
||||
{
|
||||
m_randomPlayers = count;
|
||||
}
|
||||
uint8 LfgPlayerData::GetRandomPlayersCount() const
|
||||
{
|
||||
return m_randomPlayers;
|
||||
}
|
||||
|
||||
uint8 LfgPlayerData::GetRandomPlayersCount() const
|
||||
{
|
||||
return m_randomPlayers;
|
||||
}
|
||||
LfgState LfgPlayerData::GetState() const
|
||||
{
|
||||
return m_State;
|
||||
}
|
||||
|
||||
LfgState LfgPlayerData::GetState() const
|
||||
{
|
||||
return m_State;
|
||||
}
|
||||
LfgState LfgPlayerData::GetOldState() const
|
||||
{
|
||||
return m_OldState;
|
||||
}
|
||||
|
||||
LfgState LfgPlayerData::GetOldState() const
|
||||
{
|
||||
return m_OldState;
|
||||
}
|
||||
const LfgLockMap& LfgPlayerData::GetLockedDungeons() const
|
||||
{
|
||||
return m_LockedDungeons;
|
||||
}
|
||||
|
||||
const LfgLockMap& LfgPlayerData::GetLockedDungeons() const
|
||||
{
|
||||
return m_LockedDungeons;
|
||||
}
|
||||
TeamId LfgPlayerData::GetTeam() const
|
||||
{
|
||||
return m_TeamId;
|
||||
}
|
||||
|
||||
TeamId LfgPlayerData::GetTeam() const
|
||||
{
|
||||
return m_TeamId;
|
||||
}
|
||||
uint64 LfgPlayerData::GetGroup() const
|
||||
{
|
||||
return m_Group;
|
||||
}
|
||||
|
||||
uint64 LfgPlayerData::GetGroup() const
|
||||
{
|
||||
return m_Group;
|
||||
}
|
||||
uint8 LfgPlayerData::GetRoles() const
|
||||
{
|
||||
return m_Roles;
|
||||
}
|
||||
|
||||
uint8 LfgPlayerData::GetRoles() const
|
||||
{
|
||||
return m_Roles;
|
||||
}
|
||||
std::string const& LfgPlayerData::GetComment() const
|
||||
{
|
||||
return m_Comment;
|
||||
}
|
||||
|
||||
std::string const& LfgPlayerData::GetComment() const
|
||||
{
|
||||
return m_Comment;
|
||||
}
|
||||
|
||||
LfgDungeonSet const& LfgPlayerData::GetSelectedDungeons() const
|
||||
{
|
||||
return m_SelectedDungeons;
|
||||
}
|
||||
LfgDungeonSet const& LfgPlayerData::GetSelectedDungeons() const
|
||||
{
|
||||
return m_SelectedDungeons;
|
||||
}
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
/**
|
||||
Stores all lfg data needed about the player.
|
||||
*/
|
||||
/**
|
||||
Stores all lfg data needed about the player.
|
||||
*/
|
||||
|
||||
class LfgPlayerData
|
||||
{
|
||||
class LfgPlayerData
|
||||
{
|
||||
public:
|
||||
LfgPlayerData();
|
||||
~LfgPlayerData();
|
||||
@@ -65,7 +65,7 @@ class LfgPlayerData
|
||||
uint8 m_Roles; ///< Roles the player selected when joined LFG
|
||||
std::string m_Comment; ///< Player comment used when joined LFG
|
||||
LfgDungeonSet m_SelectedDungeons; ///< Selected Dungeons when joined LFG
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,57 +12,57 @@
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
enum LfgCompatibility
|
||||
{
|
||||
LFG_COMPATIBILITY_PENDING,
|
||||
LFG_INCOMPATIBLES_WRONG_GROUP_SIZE,
|
||||
LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS,
|
||||
LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS,
|
||||
LFG_INCOMPATIBLES_HAS_IGNORES,
|
||||
LFG_INCOMPATIBLES_NO_ROLES,
|
||||
LFG_INCOMPATIBLES_NO_DUNGEONS,
|
||||
LFG_COMPATIBLES_WITH_LESS_PLAYERS, // Values under this = not compatible (do not modify order)
|
||||
LFG_COMPATIBLES_MATCH // Must be the last one
|
||||
};
|
||||
enum LfgCompatibility
|
||||
{
|
||||
LFG_COMPATIBILITY_PENDING,
|
||||
LFG_INCOMPATIBLES_WRONG_GROUP_SIZE,
|
||||
LFG_INCOMPATIBLES_TOO_MUCH_PLAYERS,
|
||||
LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS,
|
||||
LFG_INCOMPATIBLES_HAS_IGNORES,
|
||||
LFG_INCOMPATIBLES_NO_ROLES,
|
||||
LFG_INCOMPATIBLES_NO_DUNGEONS,
|
||||
LFG_COMPATIBLES_WITH_LESS_PLAYERS, // Values under this = not compatible (do not modify order)
|
||||
LFG_COMPATIBLES_MATCH // Must be the last one
|
||||
};
|
||||
|
||||
/// Stores player or group queue info
|
||||
struct LfgQueueData
|
||||
{
|
||||
LfgQueueData(): joinTime(time_t(time(nullptr))), lastRefreshTime(joinTime), tanks(LFG_TANKS_NEEDED),
|
||||
healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED)
|
||||
/// Stores player or group queue info
|
||||
struct LfgQueueData
|
||||
{
|
||||
LfgQueueData(): joinTime(time_t(time(nullptr))), lastRefreshTime(joinTime), tanks(LFG_TANKS_NEEDED),
|
||||
healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED)
|
||||
{ }
|
||||
|
||||
LfgQueueData(time_t _joinTime, LfgDungeonSet const& _dungeons, LfgRolesMap const& _roles):
|
||||
joinTime(_joinTime), lastRefreshTime(_joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED),
|
||||
dps(LFG_DPS_NEEDED), dungeons(_dungeons), roles(_roles)
|
||||
LfgQueueData(time_t _joinTime, LfgDungeonSet const& _dungeons, LfgRolesMap const& _roles):
|
||||
joinTime(_joinTime), lastRefreshTime(_joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED),
|
||||
dps(LFG_DPS_NEEDED), dungeons(_dungeons), roles(_roles)
|
||||
{ }
|
||||
|
||||
time_t joinTime; ///< Player queue join time (to calculate wait times)
|
||||
time_t lastRefreshTime; ///< pussywizard
|
||||
uint8 tanks; ///< Tanks needed
|
||||
uint8 healers; ///< Healers needed
|
||||
uint8 dps; ///< Dps needed
|
||||
LfgDungeonSet dungeons; ///< Selected Player/Group Dungeon/s
|
||||
LfgRolesMap roles; ///< Selected Player Role/s
|
||||
Lfg5Guids bestCompatible; ///< Best compatible combination of people queued
|
||||
};
|
||||
time_t joinTime; ///< Player queue join time (to calculate wait times)
|
||||
time_t lastRefreshTime; ///< pussywizard
|
||||
uint8 tanks; ///< Tanks needed
|
||||
uint8 healers; ///< Healers needed
|
||||
uint8 dps; ///< Dps needed
|
||||
LfgDungeonSet dungeons; ///< Selected Player/Group Dungeon/s
|
||||
LfgRolesMap roles; ///< Selected Player Role/s
|
||||
Lfg5Guids bestCompatible; ///< Best compatible combination of people queued
|
||||
};
|
||||
|
||||
struct LfgWaitTime
|
||||
{
|
||||
LfgWaitTime(): time(-1), number(0) {}
|
||||
int32 time; ///< Wait time
|
||||
uint32 number; ///< Number of people used to get that wait time
|
||||
};
|
||||
struct LfgWaitTime
|
||||
{
|
||||
LfgWaitTime(): time(-1), number(0) {}
|
||||
int32 time; ///< Wait time
|
||||
uint32 number; ///< Number of people used to get that wait time
|
||||
};
|
||||
|
||||
typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
|
||||
typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer;
|
||||
typedef std::list<Lfg5Guids> LfgCompatibleContainer;
|
||||
typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
|
||||
typedef std::map<uint64, LfgQueueData> LfgQueueDataContainer;
|
||||
typedef std::list<Lfg5Guids> LfgCompatibleContainer;
|
||||
|
||||
/**
|
||||
Stores all data related to queue
|
||||
*/
|
||||
class LFGQueue
|
||||
{
|
||||
/**
|
||||
Stores all data related to queue
|
||||
*/
|
||||
class LFGQueue
|
||||
{
|
||||
public:
|
||||
|
||||
// Add/Remove from queue
|
||||
@@ -111,7 +111,7 @@ class LFGQueue
|
||||
LfgWaitTimesContainer waitTimesDpsStore; ///< Average wait time to find a group queuing as dps
|
||||
LfgGuidList newToQueueStore; ///< New groups to add to queue
|
||||
LfgGuidList restoredAfterProposal;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
|
||||
@@ -21,279 +21,279 @@
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript")
|
||||
{
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLevelChanged(Player* player, uint8 /*oldLevel*/)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLogout(Player* player)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
if (!player->GetGroup() || !player->GetGroup()->isLFGGroup())
|
||||
LFGPlayerScript::LFGPlayerScript() : PlayerScript("LFGPlayerScript")
|
||||
{
|
||||
player->GetSession()->SendLfgLfrList(false);
|
||||
sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true, player->GetGroup() ? player->GetGroup()->GetGUID() : 0);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
//if (sLFGMgr->GetState(player->GetGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
// sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
}
|
||||
|
||||
sLFGMgr->LfrSearchRemove(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLogin(Player* player)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
// Temporal: Trying to determine when group data and LFG data gets desynched
|
||||
uint64 guid = player->GetGUID();
|
||||
uint64 gguid = sLFGMgr->GetGroup(guid);
|
||||
|
||||
if (Group const* group = player->GetGroup())
|
||||
void LFGPlayerScript::OnLevelChanged(Player* player, uint8 /*oldLevel*/)
|
||||
{
|
||||
uint64 gguid2 = group->GetGUID();
|
||||
if (gguid != gguid2)
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLogout(Player* player)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
if (!player->GetGroup() || !player->GetGroup()->isLFGGroup())
|
||||
{
|
||||
//sLog->outError("%s on group %u but LFG has group %u saved... Fixing.",
|
||||
// player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
|
||||
sLFGMgr->SetupGroupMember(guid, group->GetGUID());
|
||||
player->GetSession()->SendLfgLfrList(false);
|
||||
sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true, player->GetGroup() ? player->GetGroup()->GetGUID() : 0);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
//if (sLFGMgr->GetState(player->GetGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
// sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
}
|
||||
|
||||
sLFGMgr->LfrSearchRemove(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnLogin(Player* player)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
// Temporal: Trying to determine when group data and LFG data gets desynched
|
||||
uint64 guid = player->GetGUID();
|
||||
uint64 gguid = sLFGMgr->GetGroup(guid);
|
||||
|
||||
if (Group const* group = player->GetGroup())
|
||||
{
|
||||
uint64 gguid2 = group->GetGUID();
|
||||
if (gguid != gguid2)
|
||||
{
|
||||
//sLog->outError("%s on group %u but LFG has group %u saved... Fixing.",
|
||||
// player->GetSession()->GetPlayerInfo().c_str(), GUID_LOPART(gguid2), GUID_LOPART(gguid));
|
||||
sLFGMgr->SetupGroupMember(guid, group->GetGUID());
|
||||
}
|
||||
}
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
sLFGMgr->SetTeam(player->GetGUID(), player->GetTeamId());
|
||||
// TODO - Restore LfgPlayerData and send proper status to player if it was in a group
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool /*permanent*/)
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnMapChanged(Player* player)
|
||||
{
|
||||
Map const* map = player->GetMap();
|
||||
|
||||
if (sLFGMgr->inLfgDungeonMap(player->GetGUID(), map->GetId(), map->GetDifficulty()))
|
||||
{
|
||||
Group* group = player->GetGroup();
|
||||
// This function is also called when players log in
|
||||
// if for some reason the LFG system recognises the player as being in a LFG dungeon,
|
||||
// but the player was loaded without a valid group, we'll teleport to homebind to prevent
|
||||
// crashes or other undefined behaviour
|
||||
if (!group)
|
||||
{
|
||||
sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true);
|
||||
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)
|
||||
sLog->outDebug(LOG_FILTER_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());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
if (Player* member = itr->GetSource())
|
||||
player->GetSession()->SendNameQueryOpcode(member->GetGUID());
|
||||
|
||||
if (group->IsLfgWithBuff())
|
||||
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
|
||||
|
||||
// Xinef: Destroy group if only one player is left
|
||||
if (Group* group = player->GetGroup())
|
||||
if (group->GetMembersCount() <= 1u)
|
||||
group->Disband();
|
||||
}
|
||||
}
|
||||
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
sLFGMgr->SetTeam(player->GetGUID(), player->GetTeamId());
|
||||
// TODO - Restore LfgPlayerData and send proper status to player if it was in a group
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool /*permanent*/)
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(mapId);
|
||||
if (mapEntry->IsDungeon() && difficulty > DUNGEON_DIFFICULTY_NORMAL)
|
||||
sLFGMgr->InitializeLockedDungeons(player);
|
||||
}
|
||||
|
||||
void LFGPlayerScript::OnMapChanged(Player* player)
|
||||
{
|
||||
Map const* map = player->GetMap();
|
||||
|
||||
if (sLFGMgr->inLfgDungeonMap(player->GetGUID(), map->GetId(), map->GetDifficulty()))
|
||||
LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript")
|
||||
{
|
||||
Group* group = player->GetGroup();
|
||||
// This function is also called when players log in
|
||||
// if for some reason the LFG system recognises the player as being in a LFG dungeon,
|
||||
// but the player was loaded without a valid group, we'll teleport to homebind to prevent
|
||||
// crashes or other undefined behaviour
|
||||
if (!group)
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
|
||||
if (leader == guid)
|
||||
{
|
||||
sLFGMgr->LeaveLfg(player->GetGUID());
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true);
|
||||
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)
|
||||
sLog->outDebug(LOG_FILTER_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());
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
|
||||
#endif
|
||||
sLFGMgr->SetLeader(gguid, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
LfgState gstate = sLFGMgr->GetState(gguid);
|
||||
LfgState state = sLFGMgr->GetState(guid);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
|
||||
#endif
|
||||
|
||||
if (state == LFG_STATE_QUEUED)
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
|
||||
if (gstate == LFG_STATE_QUEUED)
|
||||
sLFGMgr->LeaveLfg(gguid);
|
||||
}
|
||||
|
||||
if (!group->isLFGGroup())
|
||||
{
|
||||
sLFGMgr->LeaveAllLfgQueues(leader, true, gguid); // pussywizard: invited, queued, party formed, neither party nor new member are queued, but leader is in queue solo!
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, false);
|
||||
}
|
||||
|
||||
sLFGMgr->SetGroup(guid, gguid);
|
||||
sLFGMgr->AddPlayerToGroup(gguid, guid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(kicker);
|
||||
UNUSED(reason);
|
||||
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
|
||||
#endif
|
||||
|
||||
bool isLFG = group->isLFGGroup();
|
||||
LfgState state = sLFGMgr->GetState(gguid);
|
||||
|
||||
// If group is being formed after proposal success do nothing more
|
||||
if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT)
|
||||
{
|
||||
// LfgData: Remove player from group
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
return;
|
||||
}
|
||||
|
||||
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
if (Player* member = itr->GetSource())
|
||||
player->GetSession()->SendNameQueryOpcode(member->GetGUID());
|
||||
|
||||
if (group->IsLfgWithBuff())
|
||||
player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
|
||||
|
||||
// Xinef: Destroy group if only one player is left
|
||||
if (Group* group = player->GetGroup())
|
||||
if (group->GetMembersCount() <= 1u)
|
||||
group->Disband();
|
||||
}
|
||||
}
|
||||
|
||||
LFGGroupScript::LFGGroupScript() : GroupScript("LFGGroupScript")
|
||||
{
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnAddMember(Group* group, uint64 guid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
|
||||
if (leader == guid)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "]", gguid, guid, leader);
|
||||
#endif
|
||||
sLFGMgr->SetLeader(gguid, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
LfgState gstate = sLFGMgr->GetState(gguid);
|
||||
LfgState state = sLFGMgr->GetState(guid);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "] leader " UI64FMTD "] gstate: %u, state: %u", gguid, guid, leader, gstate, state);
|
||||
#endif
|
||||
|
||||
if (state == LFG_STATE_QUEUED)
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
|
||||
if (gstate == LFG_STATE_QUEUED)
|
||||
sLFGMgr->LeaveLfg(gguid);
|
||||
}
|
||||
|
||||
if (!group->isLFGGroup())
|
||||
{
|
||||
sLFGMgr->LeaveAllLfgQueues(leader, true, gguid); // pussywizard: invited, queued, party formed, neither party nor new member are queued, but leader is in queue solo!
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, false);
|
||||
}
|
||||
|
||||
sLFGMgr->SetGroup(guid, gguid);
|
||||
sLFGMgr->AddPlayerToGroup(gguid, guid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod method, uint64 kicker, char const* reason)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(kicker);
|
||||
UNUSED(reason);
|
||||
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnRemoveMember [" UI64FMTD "]: remove [" UI64FMTD "] Method: %d Kicker: [" UI64FMTD "] Reason: %s", gguid, guid, method, kicker, (reason ? reason : ""));
|
||||
#endif
|
||||
|
||||
bool isLFG = group->isLFGGroup();
|
||||
LfgState state = sLFGMgr->GetState(gguid);
|
||||
|
||||
// If group is being formed after proposal success do nothing more
|
||||
if (state == LFG_STATE_PROPOSAL && method == GROUP_REMOVEMETHOD_DEFAULT)
|
||||
{
|
||||
// LfgData: Remove player from group
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true, gguid);
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
return;
|
||||
}
|
||||
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true, gguid);
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
//if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||
// sLFGMgr->LeaveLfg(guid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
// pussywizard: already done above
|
||||
//if (sLFGMgr->GetState(guid) == LFG_STATE_RAIDBROWSER)
|
||||
// sLFGMgr->LeaveLfg(guid);
|
||||
// Xinef: only LFG groups can go below
|
||||
if (!isLFG)
|
||||
return;
|
||||
|
||||
// Xinef: only LFG groups can go below
|
||||
if (!isLFG)
|
||||
return;
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
{
|
||||
// xinef: fixed dungeon deserter
|
||||
if (method != GROUP_REMOVEMETHOD_KICK_LFG && state != LFG_STATE_FINISHED_DUNGEON &&
|
||||
player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN) && players >= LFG_GROUP_KICK_VOTES_NEEDED)
|
||||
if (Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
{
|
||||
player->AddAura(LFG_SPELL_DUNGEON_DESERTER, player);
|
||||
}
|
||||
//else if (state == LFG_STATE_BOOT)
|
||||
// xinef: fixed dungeon deserter
|
||||
if (method != GROUP_REMOVEMETHOD_KICK_LFG && state != LFG_STATE_FINISHED_DUNGEON &&
|
||||
player->HasAura(LFG_SPELL_DUNGEON_COOLDOWN) && players >= LFG_GROUP_KICK_VOTES_NEEDED)
|
||||
{
|
||||
player->AddAura(LFG_SPELL_DUNGEON_DESERTER, player);
|
||||
}
|
||||
//else if (state == LFG_STATE_BOOT)
|
||||
// Update internal kick cooldown of kicked
|
||||
|
||||
player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_LEADER_UNK1));
|
||||
if (player->GetMap()->IsDungeon()) // Teleport player out the dungeon
|
||||
player->GetSession()->SendLfgUpdateParty(LfgUpdateData(LFG_UPDATETYPE_LEADER_UNK1));
|
||||
if (player->GetMap()->IsDungeon()) // Teleport player out the dungeon
|
||||
{
|
||||
// Xinef: no longer valid sLFGMgr->TeleportPlayer(player, true);
|
||||
if (!player->IsBeingTeleportedFar() && player->GetMapId() == sLFGMgr->GetDungeonMapId(gguid))
|
||||
player->TeleportToEntryPoint();
|
||||
}
|
||||
}
|
||||
|
||||
if (state != LFG_STATE_FINISHED_DUNGEON) // Need more players to finish the dungeon
|
||||
if (Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(sLFGMgr->GetLeader(gguid)))
|
||||
leader->GetSession()->SendLfgOfferContinue(sLFGMgr->GetDungeon(gguid, false));
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnDisband(Group* group)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
|
||||
#endif
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(group->GetLeaderGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(group->GetLeaderGUID());
|
||||
|
||||
sLFGMgr->RemoveGroupData(gguid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
|
||||
#endif
|
||||
sLFGMgr->SetLeader(gguid, newLeaderGuid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(oldLeaderGuid) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(oldLeaderGuid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(guid);
|
||||
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
|
||||
#endif
|
||||
// No gguid == new group being formed
|
||||
// No leader == after group creation first invite is new leader
|
||||
// leader and no gguid == first invite after leader is added to new group (this is the real invite)
|
||||
if (leader && !gguid)
|
||||
{
|
||||
// Xinef: no longer valid sLFGMgr->TeleportPlayer(player, true);
|
||||
if (!player->IsBeingTeleportedFar() && player->GetMapId() == sLFGMgr->GetDungeonMapId(gguid))
|
||||
player->TeleportToEntryPoint();
|
||||
sLFGMgr->LeaveLfg(leader);
|
||||
sLFGMgr->LeaveAllLfgQueues(leader, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (state != LFG_STATE_FINISHED_DUNGEON) // Need more players to finish the dungeon
|
||||
if (Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(sLFGMgr->GetLeader(gguid)))
|
||||
leader->GetSession()->SendLfgOfferContinue(sLFGMgr->GetDungeon(gguid, false));
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnDisband(Group* group)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnDisband [" UI64FMTD "]", gguid);
|
||||
#endif
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(group->GetLeaderGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(group->GetLeaderGUID());
|
||||
|
||||
sLFGMgr->RemoveGroupData(gguid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid)
|
||||
{
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid);
|
||||
#endif
|
||||
sLFGMgr->SetLeader(gguid, newLeaderGuid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(oldLeaderGuid) == LFG_STATE_RAIDBROWSER)
|
||||
sLFGMgr->LeaveLfg(oldLeaderGuid);
|
||||
}
|
||||
|
||||
void LFGGroupScript::OnInviteMember(Group* group, uint64 guid)
|
||||
{
|
||||
// used only with EXTRA_LOGS
|
||||
UNUSED(guid);
|
||||
|
||||
if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
|
||||
return;
|
||||
|
||||
uint64 gguid = group->GetGUID();
|
||||
uint64 leader = group->GetLeaderGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnInviteMember [" UI64FMTD "]: invite [" UI64FMTD "] leader [" UI64FMTD "]", gguid, guid, leader);
|
||||
#endif
|
||||
// No gguid == new group being formed
|
||||
// No leader == after group creation first invite is new leader
|
||||
// leader and no gguid == first invite after leader is added to new group (this is the real invite)
|
||||
if (leader && !gguid)
|
||||
{
|
||||
sLFGMgr->LeaveLfg(leader);
|
||||
sLFGMgr->LeaveAllLfgQueues(leader, true);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
@@ -18,8 +18,8 @@ class Group;
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
class LFGPlayerScript : public PlayerScript
|
||||
{
|
||||
class LFGPlayerScript : public PlayerScript
|
||||
{
|
||||
public:
|
||||
LFGPlayerScript();
|
||||
|
||||
@@ -29,10 +29,10 @@ class LFGPlayerScript : public PlayerScript
|
||||
void OnLogin(Player* player);
|
||||
void OnBindToInstance(Player* player, Difficulty difficulty, uint32 mapId, bool permanent);
|
||||
void OnMapChanged(Player* player);
|
||||
};
|
||||
};
|
||||
|
||||
class LFGGroupScript : public GroupScript
|
||||
{
|
||||
class LFGGroupScript : public GroupScript
|
||||
{
|
||||
public:
|
||||
LFGGroupScript();
|
||||
|
||||
@@ -42,6 +42,6 @@ class LFGGroupScript : public GroupScript
|
||||
void OnDisband(Group* group);
|
||||
void OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLeaderGuid);
|
||||
void OnInviteMember(Group* group, uint64 guid);
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace lfg
|
||||
|
||||
Reference in New Issue
Block a user