Dungeon Finder: Add proposals, find group algorithm and teleport support
Note: Adds hability to find a group and be teleported to dungeon, but no rewards yet (WIP) --HG-- branch : trunk
This commit is contained in:
@@ -27,12 +27,15 @@
|
||||
enum LFGenum
|
||||
{
|
||||
LFG_TIME_ROLECHECK = 2*MINUTE,
|
||||
LFG_TIME_PROPOSAL = 2*MINUTE,
|
||||
LFG_VOTES_NEEDED = 3,
|
||||
LFG_TANKS_NEEDED = 1,
|
||||
LFG_HEALERS_NEEDED = 1,
|
||||
LFG_DPS_NEEDED = 3,
|
||||
LFG_QUEUEUPDATE_INTERVAL = 15000,
|
||||
LFG_SPELL_COOLDOWN = 71328,
|
||||
LFG_SPELL_DESERTER = 71041,
|
||||
LFG_MAX_KICKS = 3,
|
||||
};
|
||||
|
||||
enum LfgType
|
||||
@@ -45,6 +48,13 @@ enum LfgType
|
||||
LFG_TYPE_RANDOM = 6,
|
||||
};
|
||||
|
||||
enum LfgProposalState
|
||||
{
|
||||
LFG_PROPOSAL_INITIATING = 0,
|
||||
LFG_PROPOSAL_FAILED = 1,
|
||||
LFG_PROPOSAL_SUCCESS = 2,
|
||||
};
|
||||
|
||||
enum LfgGroupType
|
||||
{
|
||||
LFG_GROUPTYPE_ALL = 0, // Internal use, represents all groups.
|
||||
@@ -75,6 +85,19 @@ enum LfgLockStatusType
|
||||
LFG_LOCKSTATUS_NOT_IN_SEASON = 1031,
|
||||
};
|
||||
|
||||
enum LfgTeleportError
|
||||
{
|
||||
//LFG_TELEPORTERROR_UNK1 = 0, // No reaction
|
||||
LFG_TELEPORTERROR_PLAYER_DEAD = 1,
|
||||
LFG_TELEPORTERROR_FALLING = 2,
|
||||
//LFG_TELEPORTERROR_UNK2 = 3, // You can't do that right now
|
||||
LFG_TELEPORTERROR_FATIGUE = 4,
|
||||
//LFG_TELEPORTERROR_UNK3 = 5, // No reaction
|
||||
LFG_TELEPORTERROR_INVALID_LOCATION = 6,
|
||||
//LFG_TELEPORTERROR_UNK4 = 7, // You can't do that right now
|
||||
//LFG_TELEPORTERROR_UNK5 = 8, // You can't do that right now
|
||||
};
|
||||
|
||||
enum LfgJoinResult
|
||||
{
|
||||
LFG_JOIN_OK = 0, // Joined (no client msg)
|
||||
@@ -135,6 +158,13 @@ enum LfgRewardEnums
|
||||
LFG_REWARD_DATA_SIZE = 10,
|
||||
};
|
||||
|
||||
enum LfgDungeonStatus
|
||||
{
|
||||
LFG_STATUS_SAVED = 0,
|
||||
LFG_STATUS_NOT_SAVED = 1,
|
||||
LFG_STATUS_COMPLETE = 2,
|
||||
};
|
||||
|
||||
const uint32 RewardDungeonData[LFG_REWARD_DATA_SIZE+1][5] =
|
||||
{ // XP, money, item, item display, count
|
||||
{310, 3500, 51999, 56915, 1}, // Classic 15-23
|
||||
@@ -201,6 +231,38 @@ struct LfgQueueInfo
|
||||
LfgRolesMap roles; // Selected Player Role/s
|
||||
};
|
||||
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(-1), groupLowGuid(0) {};
|
||||
uint8 role; // Proposed role
|
||||
int8 accept; // Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
uint32 groupLowGuid; // Original group guid (Low guid) 0 if no original group
|
||||
};
|
||||
|
||||
typedef std::map<uint32, LfgProposalPlayer*> LfgProposalPlayerMap;
|
||||
|
||||
// Stores all Dungeon Proposal after matching candidates
|
||||
struct LfgProposal
|
||||
{
|
||||
LfgProposal(uint32 dungeon): state(LFG_PROPOSAL_INITIATING), groupLowGuid(0), dungeonId(dungeon), leaderLowGuid(0) {}
|
||||
|
||||
~LfgProposal()
|
||||
{
|
||||
for (LfgProposalPlayerMap::iterator it = players.begin(); it != players.end(); ++it)
|
||||
delete it->second;
|
||||
players.clear();
|
||||
queues.clear();
|
||||
};
|
||||
uint32 dungeonId; // Dungeon to join
|
||||
LfgProposalState state; // State of the proposal
|
||||
uint32 groupLowGuid; // Proposal group (0 if new)
|
||||
uint32 leaderLowGuid; // Leader guid.
|
||||
time_t cancelTime; // Time when we will cancel this proposal
|
||||
LfgGuidList queues; // Queue Ids to remove/readd
|
||||
LfgProposalPlayerMap players; // Player current groupId
|
||||
|
||||
};
|
||||
|
||||
// Stores all rolecheck info of a group that wants to join LFG
|
||||
struct LfgRoleCheck
|
||||
{
|
||||
@@ -215,9 +277,11 @@ typedef std::set<Player*> PlayerSet;
|
||||
typedef std::set<LfgLockStatus*> LfgLockStatusSet;
|
||||
typedef std::vector<LfgReward*> LfgRewardList;
|
||||
typedef std::map<uint32, LfgReward*> LfgRewardMap;
|
||||
typedef std::vector<LfgProposal*> LfgProposalList;
|
||||
typedef std::map<uint32, LfgLockStatusSet*> LfgLockStatusMap;
|
||||
typedef std::map<uint64, LfgQueueInfo*> LfgQueueInfoMap;
|
||||
typedef std::map<uint32, LfgRoleCheck*> LfgRoleCheckMap;
|
||||
typedef std::map<uint32, LfgProposal*> LfgProposalMap;
|
||||
typedef std::list<Player *> LfgPlayerList;
|
||||
|
||||
class LFGMgr
|
||||
@@ -230,6 +294,9 @@ class LFGMgr
|
||||
void InitLFG();
|
||||
void Join(Player *plr);
|
||||
void Leave(Player *plr, Group *grp = NULL);
|
||||
void OfferContinue(Group *grp);
|
||||
void TeleportPlayer(Player *plr, bool out);
|
||||
void UpdateProposal(uint32 proposalId, uint32 lowGuid, uint8 accept);
|
||||
void UpdateRoleCheck(Group *grp, Player *plr = NULL);
|
||||
void Update(uint32 diff);
|
||||
|
||||
@@ -237,6 +304,9 @@ class LFGMgr
|
||||
void SendLfgPartyInfo(Player *plr);
|
||||
|
||||
private:
|
||||
void SendUpdateProposal(Player *plr, uint32 proposalId, LfgProposal *pProp);
|
||||
void SendLfgPlayerReward(Player *plr);
|
||||
|
||||
void BuildLfgRoleCheck(WorldPacket &data, LfgRoleCheck *pRoleCheck);
|
||||
void BuildAvailableRandomDungeonList(WorldPacket &data, Player *plr);
|
||||
void BuildPlayerLockDungeonBlock(WorldPacket &data, LfgLockStatusSet *lockSet);
|
||||
@@ -245,7 +315,9 @@ class LFGMgr
|
||||
void AddToQueue(uint64 guid, LfgRolesMap *roles, LfgDungeonSet *dungeons);
|
||||
bool RemoveFromQueue(uint64 guid);
|
||||
bool isRandomDungeon(uint32 dungeonId);
|
||||
void FindNewGroups(LfgGuidList &check, LfgGuidList all, LfgProposalList *proposals);
|
||||
bool CheckGroupRoles(LfgRolesMap &groles, bool removeLeaderFlag = true);
|
||||
void RemoveProposal(LfgProposalMap::iterator itProposal, LfgUpdateType type);
|
||||
|
||||
LfgLockStatusMap* GetGroupLockStatusDungeons(PlayerSet *pPlayers, LfgDungeonSet *dungeons);
|
||||
LfgLockStatusMap* GetPartyLockStatusDungeons(Player *plr, LfgDungeonSet *dungeons);
|
||||
@@ -262,6 +334,7 @@ class LFGMgr
|
||||
LfgQueueInfoMap m_QueueInfoMap; // Queued groups
|
||||
LfgGuidList m_currentQueue; // Ordered list. Used to find groups
|
||||
LfgGuidList m_newToQueue; // New groups to add to queue;
|
||||
LfgProposalMap m_Proposals; // Current Proposals
|
||||
LfgRoleCheckMap m_RoleChecks; // Current Role checks
|
||||
uint32 m_QueueTimer; // used to check interval of update
|
||||
uint32 m_lfgProposalId; // used as internal counter for proposals
|
||||
|
||||
Reference in New Issue
Block a user