diff options
Diffstat (limited to 'src/game/LFGMgr.h')
-rw-r--r-- | src/game/LFGMgr.h | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/src/game/LFGMgr.h b/src/game/LFGMgr.h index d54fb0f3c1b..809db7b6929 100644 --- a/src/game/LFGMgr.h +++ b/src/game/LFGMgr.h @@ -24,6 +24,16 @@ #include "Group.h" #include "LFG.h" +enum LFGenum +{ + LFG_TIME_ROLECHECK = 2*MINUTE, + LFG_TANKS_NEEDED = 1, + LFG_HEALERS_NEEDED = 1, + LFG_DPS_NEEDED = 3, + LFG_QUEUEUPDATE_INTERVAL = 15000, + LFG_SPELL_COOLDOWN = 71328, + LFG_SPELL_DESERTER = 71041, +}; enum LfgType { @@ -35,6 +45,19 @@ enum LfgType LFG_TYPE_RANDOM = 6, }; +enum LfgGroupType +{ + LFG_GROUPTYPE_CLASSIC = 1, + LFG_GROUPTYPE_BC_NORMAL = 2, + LFG_GROUPTYPE_BC_HEROIC = 3, + LFG_GROUPTYPE_WTLK_NORMAL = 4, + LFG_GROUPTYPE_WTLK_HEROIC = 5, + LFG_GROUPTYPE_CLASSIC_RAID = 6, + LFG_GROUPTYPE_BC_RAID = 7, + LFG_GROUPTYPE_WTLK_RAID_10 = 8, + LFG_GROUPTYPE_WTLK_RAID_25 = 9, +}; + enum LfgLockStatusType { LFG_LOCKSTATUS_OK = 0, // Internal use only @@ -51,6 +74,39 @@ enum LfgLockStatusType LFG_LOCKSTATUS_NOT_IN_SEASON = 1031, }; +enum LfgJoinResult +{ + LFG_JOIN_OK = 0, // Joined (no client msg) + LFG_JOIN_FAILED = 1, // RoleCheck Failed + LFG_JOIN_GROUPFULL = 2, // Your group is full + LFG_JOIN_UNK3 = 3, // No client reaction + 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 + LFG_JOIN_FAILED2 = 18, // RoleCheck Failed +}; + +enum LfgRoleCheckResult +{ + 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 LfgRandomDungeonEntries { LFG_ALL_DUNGEONS = 0, @@ -131,6 +187,54 @@ typedef std::vector<LfgReward*> LfgRewardList; typedef std::map<uint64, LfgLockStatusSet*> LfgLockStatusMap; typedef std::map<uint32, LfgDungeonSet*> LfgDungeonMap; +typedef std::map<uint64, int8> LfgAnswerMap; +typedef std::map<uint64, uint8> LfgRolesMap; +typedef std::set<uint64> LfgGuidSet; + +// Stores player or group queue info +struct LfgQueueInfo +{ + time_t joinTime; // Player queue join time (to calculate wait times) + uint32 dungeonId; // Selected Player/Group Dungeon + LfgRolesMap roles; // Selected Player Role/s + uint8 tanks; // Tanks needed + uint8 healers; // Healers needed + uint8 dps; // Dps needed +}; + +// Stores all rolecheck info of a group that wants to join LFG +struct LfgRoleCheck +{ + time_t cancelTime; + LfgRolesMap roles; + LfgRoleCheckResult result; + LfgDungeonSet dungeons; + uint64 leader; +}; + +typedef std::map<uint64, LfgQueueInfo*> LfgQueueInfoMap; +typedef std::map<uint32, LfgRoleCheck*> LfgRoleCheckMap; + +class LFGQueue +{ + public: + LFGQueue(); + ~LFGQueue(); + + void Update(); + void AddToQueue(uint64 guid, LfgQueueInfo *pqInfo); + bool RemoveFromQueue(uint64 guid); + LfgQueueInfo* GetQueueInfo(uint64 guid); + private: + LfgQueueInfoMap m_LfgQueue; + int32 avgWaitTime; + int32 waitTimeTanks; + int32 waitTimeHealer; + int32 waitTimeDps; +}; + +typedef std::map<uint8, LFGQueue *> LFGQueueMap; + class LFGMgr { public: @@ -140,22 +244,35 @@ public: void InitLFG(); void SendLfgPlayerInfo(Player *plr); void SendLfgPartyInfo(Player *plr); + void Join(Player *plr); + void Leave(Player *plr, Group *grp = NULL); + void UpdateRoleCheck(Group *grp, Player *plr = NULL); + void Update(uint32 diff); private: + void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck); void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr); void BuildRewardBlock(WorldPacket &data, uint32 dungeon, Player *plr); void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet); void BuildPartyLockDungeonBlock(WorldPacket &data, LfgLockStatusMap *lockMap); + bool CheckGroupRoles(LfgRolesMap &groles); + LfgLockStatusMap* GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons); LfgLockStatusSet* GetPlayerLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons); LfgDungeonSet* GetRandomDungeons(uint8 level, uint8 expansion); LfgDungeonSet* GetDungeonsByRandom(uint32 randomdungeon); LfgDungeonSet* GetAllDungeons(); LfgReward* GetRandomDungeonReward(uint32 dungeon, bool done, uint8 level); + uint8 GetDungeonGroupType(uint32 dungeon); LfgRewardList m_RewardList; LfgRewardList m_RewardDoneList; LfgDungeonMap m_DungeonsMap; + + LFGQueueMap m_Queues; + LfgRoleCheckMap m_RoleChecks; + uint32 m_QueueTimer; + bool m_update; }; #define sLFGMgr Trinity::Singleton<LFGMgr>::Instance() |