TrinityCore
|
#include <LFGMgr.h>
Public Member Functions | |
void | Update (uint32 diff) |
void | FinishDungeon (ObjectGuid gguid, uint32 dungeonId) |
Finish the dungeon for the given group. All check are performed using internal lfg data. More... | |
void | LoadRewards () |
Loads rewards for random dungeons. More... | |
void | LoadLFGDungeons (bool reload=false) |
Loads dungeons from dbc and adds teleport coords. More... | |
bool | selectedRandomLfgDungeon (ObjectGuid guid) |
Check if given guid applied for random dungeon. More... | |
bool | inLfgDungeonMap (ObjectGuid guid, uint32 map, Difficulty difficulty) |
Check if given guid applied for given map and difficulty. Used to know. More... | |
LfgDungeonSet const & | GetSelectedDungeons (ObjectGuid guid) |
Get selected dungeons. More... | |
LfgState | GetState (ObjectGuid guid) |
Get current lfg state. More... | |
bool | IsVoteKickActive (ObjectGuid gguid) |
Get current vote kick state. More... | |
uint32 | GetDungeon (ObjectGuid guid, bool asId=true) |
Get current dungeon. More... | |
uint32 | GetDungeonMapId (ObjectGuid guid) |
Get the map id of the current dungeon. More... | |
uint8 | GetKicksLeft (ObjectGuid gguid) |
Get kicks left in current group. More... | |
void | _LoadFromDB (Field *fields, ObjectGuid guid) |
Load Lfg group info from DB. More... | |
void | SetupGroupMember (ObjectGuid guid, ObjectGuid gguid) |
Initializes player data after loading group data from DB. More... | |
uint32 | GetLFGDungeonEntry (uint32 id) |
Return Lfg dungeon entry for given dungeon id. More... | |
uint8 | GetRoles (ObjectGuid guid) |
Get current player roles. More... | |
std::string const & | GetComment (ObjectGuid gguid) |
Get current player comment (used for LFR) More... | |
uint32 | GetOptions () |
Gets current lfg options. More... | |
void | SetOptions (uint32 options) |
Sets new lfg options. More... | |
bool | isOptionEnabled (uint32 option) |
Checks if given lfg option is enabled. More... | |
void | Clean () |
Clears queue - Only for internal testing. More... | |
std::string | DumpQueueInfo (bool full=false) |
Dumps the state of the queue - Only for internal testing. More... | |
ObjectGuid | GetLeader (ObjectGuid guid) |
Get leader of the group (using internal data) More... | |
void | SetTeam (ObjectGuid guid, uint8 team) |
Sets player team. More... | |
void | SetGroup (ObjectGuid guid, ObjectGuid group) |
Sets player group. More... | |
ObjectGuid | GetGroup (ObjectGuid guid) |
Gets player group. More... | |
void | SetLeader (ObjectGuid gguid, ObjectGuid leader) |
Sets the leader of the group. More... | |
void | RemoveGroupData (ObjectGuid guid) |
Removes saved group data. More... | |
uint8 | RemovePlayerFromGroup (ObjectGuid gguid, ObjectGuid guid) |
Removes a player from a group. More... | |
void | AddPlayerToGroup (ObjectGuid gguid, ObjectGuid guid) |
Adds player to group. More... | |
LfgLockMap const | GetLockedDungeons (ObjectGuid guid) |
Get locked dungeons. More... | |
LfgUpdateData | GetLfgStatus (ObjectGuid guid) |
Returns current lfg status. More... | |
bool | IsSeasonActive (uint32 dungeonId) |
Checks if Seasonal dungeon is active. More... | |
LfgReward const * | GetRandomDungeonReward (uint32 dungeon, uint8 level) |
Gets the random dungeon reward corresponding to given dungeon and player level. More... | |
LfgDungeonSet | GetRandomAndSeasonalDungeons (uint8 level, uint8 expansion) |
Returns all random and seasonal dungeons for given level and expansion. More... | |
void | TeleportPlayer (Player *player, bool out, bool fromOpcode=false) |
Teleport a player to/from selected dungeon. More... | |
void | InitBoot (ObjectGuid gguid, ObjectGuid kguid, ObjectGuid vguid, std::string const &reason) |
Inits new proposal to boot a player. More... | |
void | UpdateBoot (ObjectGuid guid, bool accept) |
Updates player boot proposal with new player answer. More... | |
void | UpdateProposal (uint32 proposalId, ObjectGuid guid, bool accept) |
Updates proposal to join dungeon with player answer. More... | |
void | UpdateRoleCheck (ObjectGuid gguid, ObjectGuid guid=ObjectGuid::Empty, uint8 roles=PLAYER_ROLE_NONE) |
Updates the role check with player answer. More... | |
void | SetRoles (ObjectGuid guid, uint8 roles) |
Sets player lfg roles. More... | |
void | SetComment (ObjectGuid guid, std::string const &comment) |
Sets player lfr comment. More... | |
void | JoinLfg (Player *player, uint8 roles, LfgDungeonSet &dungeons, std::string const &comment) |
Join Lfg with selected roles, dungeons and comment. More... | |
void | LeaveLfg (ObjectGuid guid, bool disconnected=false) |
Leaves lfg. More... | |
LfgState | GetOldState (ObjectGuid guid) |
Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON) More... | |
bool | IsLfgGroup (ObjectGuid guid) |
Check if given group guid is lfg. More... | |
uint8 | GetPlayerCount (ObjectGuid guid) |
Gets the player count of given group. More... | |
uint32 | AddProposal (LfgProposal &proposal) |
Add a new Proposal. More... | |
uint8 | GetQueueId (ObjectGuid guid) |
Returns queue id. More... | |
bool | AllQueued (GuidList const &check) |
Checks if all players are queued. More... | |
time_t | GetQueueJoinTime (ObjectGuid guid) |
Gets queue join time. More... | |
Static Public Member Functions | |
static LFGMgr * | instance () |
static bool | CheckGroupRoles (LfgRolesMap &groles) |
Checks if given roles match, modifies given roles map with new roles. More... | |
static bool | HasIgnore (ObjectGuid guid1, ObjectGuid guid2) |
Checks if given players are ignoring each other. More... | |
static void | SendLfgQueueStatus (ObjectGuid guid, LfgQueueStatusData const &data) |
Sends queue status to player. More... | |
Private Attributes | |
uint32 | m_QueueTimer |
used to check interval of update More... | |
uint32 | m_lfgProposalId |
used as internal counter for proposals More... | |
uint32 | m_options |
Stores config options. More... | |
LfgQueueContainer | QueuesStore |
Queues. More... | |
LfgCachedDungeonContainer | CachedDungeonMapStore |
Stores all dungeons by groupType. More... | |
LfgRewardContainer | RewardMapStore |
Stores rewards for random dungeons. More... | |
LFGDungeonContainer | LfgDungeonStore |
LfgRoleCheckContainer | RoleChecksStore |
Current Role checks. More... | |
LfgProposalContainer | ProposalsStore |
Current Proposals. More... | |
LfgPlayerBootContainer | BootsStore |
Current player kicks. More... | |
LfgPlayerDataContainer | PlayersStore |
Player data. More... | |
LfgGroupDataContainer | GroupsStore |
Group data. More... | |
|
private |
|
private |
void lfg::LFGMgr::_LoadFromDB | ( | Field * | fields, |
ObjectGuid | guid | ||
) |
Load Lfg group info from DB.
|
private |
void lfg::LFGMgr::AddPlayerToGroup | ( | ObjectGuid | gguid, |
ObjectGuid | guid | ||
) |
Adds player to group.
uint32 lfg::LFGMgr::AddProposal | ( | LfgProposal & | proposal | ) |
Add a new Proposal.
Checks if all players are queued.
|
static |
Checks if given roles match, modifies given roles map with new roles.
Check if a group can be formed with the given group roles
[in] | groles | Map of roles to check |
void lfg::LFGMgr::Clean | ( | ) |
Clears queue - Only for internal testing.
|
private |
|
private |
Dumps the state of the queue - Only for internal testing.
void lfg::LFGMgr::FinishDungeon | ( | ObjectGuid | gguid, |
uint32 | dungeonId | ||
) |
Finish the dungeon for the given group. All check are performed using internal lfg data.
Finish a dungeon and give reward, if any.
[in] | guid | Group guid |
[in] | dungeonId | Dungeonid |
const std::string & lfg::LFGMgr::GetComment | ( | ObjectGuid | gguid | ) |
Get current player comment (used for LFR)
|
private |
Given a list of dungeons remove the dungeons players have restrictions.
[in,out] | dungeons | Dungeons to check restrictions |
[in] | players | Set of players to check their dungeon restrictions |
[out] | lockMap | Map of players Lock status info of given dungeons (Empty if dungeons is not empty) |
uint32 lfg::LFGMgr::GetDungeon | ( | ObjectGuid | guid, |
bool | asId = true |
||
) |
Get current dungeon.
uint32 lfg::LFGMgr::GetDungeonMapId | ( | ObjectGuid | guid | ) |
Get the map id of the current dungeon.
|
private |
Get the dungeon list that can be done given a random dungeon entry.
[in] | randomdungeon | Random dungeon id (if value = 0 will return all dungeons) |
Given a Dungeon id returns the dungeon Type
[in] | dungeon | dungeon id |
ObjectGuid lfg::LFGMgr::GetGroup | ( | ObjectGuid | guid | ) |
Gets player group.
uint8 lfg::LFGMgr::GetKicksLeft | ( | ObjectGuid | gguid | ) |
Get kicks left in current group.
ObjectGuid lfg::LFGMgr::GetLeader | ( | ObjectGuid | guid | ) |
Get leader of the group (using internal data)
|
private |
Return Lfg dungeon entry for given dungeon id.
LfgUpdateData lfg::LFGMgr::GetLfgStatus | ( | ObjectGuid | guid | ) |
Returns current lfg status.
LfgLockMap const lfg::LFGMgr::GetLockedDungeons | ( | ObjectGuid | guid | ) |
Get locked dungeons.
LfgState lfg::LFGMgr::GetOldState | ( | ObjectGuid | guid | ) |
Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
uint32 lfg::LFGMgr::GetOptions | ( | ) |
Gets current lfg options.
uint8 lfg::LFGMgr::GetPlayerCount | ( | ObjectGuid | guid | ) |
Gets the player count of given group.
|
private |
|
private |
uint8 lfg::LFGMgr::GetQueueId | ( | ObjectGuid | guid | ) |
Returns queue id.
time_t lfg::LFGMgr::GetQueueJoinTime | ( | ObjectGuid | guid | ) |
Gets queue join time.
LfgDungeonSet lfg::LFGMgr::GetRandomAndSeasonalDungeons | ( | uint8 | level, |
uint8 | expansion | ||
) |
Returns all random and seasonal dungeons for given level and expansion.
Gets the random dungeon reward corresponding to given dungeon and player level.
Get the reward of a given random dungeon at a certain level
[in] | dungeon | dungeon id |
[in] | level | Player level |
uint8 lfg::LFGMgr::GetRoles | ( | ObjectGuid | guid | ) |
Get current player roles.
LfgDungeonSet const & lfg::LFGMgr::GetSelectedDungeons | ( | ObjectGuid | guid | ) |
Get selected dungeons.
LfgState lfg::LFGMgr::GetState | ( | ObjectGuid | guid | ) |
Get current lfg state.
|
private |
|
static |
void lfg::LFGMgr::InitBoot | ( | ObjectGuid | gguid, |
ObjectGuid | kicker, | ||
ObjectGuid | victim, | ||
std::string const & | reason | ||
) |
Inits new proposal to boot a player.
Initialize a boot kick vote
[in] | gguid | Group the vote kicks belongs to |
[in] | kicker | Kicker guid |
[in] | victim | Victim guid |
[in] | reason | Kick reason |
bool lfg::LFGMgr::inLfgDungeonMap | ( | ObjectGuid | guid, |
uint32 | map, | ||
Difficulty | difficulty | ||
) |
Check if given guid applied for given map and difficulty. Used to know.
|
static |
bool lfg::LFGMgr::IsLfgGroup | ( | ObjectGuid | guid | ) |
Check if given group guid is lfg.
Checks if given lfg option is enabled.
Checks if Seasonal dungeon is active.
bool lfg::LFGMgr::IsVoteKickActive | ( | ObjectGuid | gguid | ) |
Get current vote kick state.
void lfg::LFGMgr::JoinLfg | ( | Player * | player, |
uint8 | roles, | ||
LfgDungeonSet & | dungeons, | ||
std::string const & | comment | ||
) |
Join Lfg with selected roles, dungeons and comment.
Adds the player/group to lfg queue. If player is in a group then it is the leader of the group tying to join the group. Join conditions are checked before adding to the new queue.
[in] | player | Player trying to join (or leader of group trying to join) |
[in] | roles | Player selected roles |
[in] | dungeons | Dungeons the player/group is applying for |
[in] | comment | Player selected comment |
void lfg::LFGMgr::LeaveLfg | ( | ObjectGuid | guid, |
bool | disconnected = false |
||
) |
Leaves lfg.
Leaves Dungeon System. Player/Group is removed from queue, rolechecks, proposals or votekicks. Player or group needs to be not NULL and using Dungeon System
[in] | guid | Player or group guid |
Loads dungeons from dbc and adds teleport coords.
void lfg::LFGMgr::LoadRewards | ( | ) |
Loads rewards for random dungeons.
Load rewards for completing dungeons.
|
private |
Makes a new group given a proposal
[in] | proposal | Proposal to get info from |
void lfg::LFGMgr::RemoveGroupData | ( | ObjectGuid | guid | ) |
Removes saved group data.
|
private |
uint8 lfg::LFGMgr::RemovePlayerFromGroup | ( | ObjectGuid | gguid, |
ObjectGuid | guid | ||
) |
Removes a player from a group.
|
private |
Remove a proposal from the pool, remove the group that didn't accept (if needed) and readd the other members to the queue
[in] | itProposal | Iterator to the proposal to remove |
[in] | type | Type of removal (LFG_UPDATETYPE_PROPOSAL_FAILED, LFG_UPDATETYPE_PROPOSAL_DECLINED) |
|
private |
bool lfg::LFGMgr::selectedRandomLfgDungeon | ( | ObjectGuid | guid | ) |
Check if given guid applied for random dungeon.
|
private |
|
private |
|
static |
Sends queue status to player.
|
private |
|
private |
|
private |
|
private |
void lfg::LFGMgr::SetComment | ( | ObjectGuid | guid, |
std::string const & | comment | ||
) |
Sets player lfr comment.
|
private |
void lfg::LFGMgr::SetGroup | ( | ObjectGuid | guid, |
ObjectGuid | group | ||
) |
Sets player group.
void lfg::LFGMgr::SetLeader | ( | ObjectGuid | gguid, |
ObjectGuid | leader | ||
) |
Sets the leader of the group.
void lfg::LFGMgr::SetOptions | ( | uint32 | options | ) |
Sets new lfg options.
void lfg::LFGMgr::SetRoles | ( | ObjectGuid | guid, |
uint8 | roles | ||
) |
Sets player lfg roles.
|
private |
|
private |
void lfg::LFGMgr::SetTeam | ( | ObjectGuid | guid, |
uint8 | team | ||
) |
Sets player team.
void lfg::LFGMgr::SetupGroupMember | ( | ObjectGuid | guid, |
ObjectGuid | gguid | ||
) |
Initializes player data after loading group data from DB.
|
private |
Teleport a player to/from selected dungeon.
Teleports the player in or out the dungeon
[in] | player | Player to teleport |
[in] | out | Teleport out (true) or in (false) |
[in] | fromOpcode | Function called from opcode handlers? (Default false) |
void lfg::LFGMgr::Update | ( | uint32 | diff | ) |
void lfg::LFGMgr::UpdateBoot | ( | ObjectGuid | guid, |
bool | accept | ||
) |
Updates player boot proposal with new player answer.
Update Boot info with player answer
[in] | guid | Player who has answered |
[in] | player | answer |
void lfg::LFGMgr::UpdateProposal | ( | uint32 | proposalId, |
ObjectGuid | guid, | ||
bool | accept | ||
) |
Updates proposal to join dungeon with player answer.
Update Proposal info with player answer
[in] | proposalId | Proposal id to be updated |
[in] | guid | Player guid to update answer |
[in] | accept | Player answer |
void lfg::LFGMgr::UpdateRoleCheck | ( | ObjectGuid | gguid, |
ObjectGuid | guid = ObjectGuid::Empty , |
||
uint8 | roles = PLAYER_ROLE_NONE |
||
) |
Updates the role check with player answer.
Update the Role check info with the player selected role.
[in] | grp | Group guid to update rolecheck |
[in] | guid | Player guid (0 = rolecheck failed) |
[in] | roles | Player selected roles |
|
private |
Current player kicks.
|
private |
Stores all dungeons by groupType.
|
private |
Group data.
|
private |
|
private |
used as internal counter for proposals
|
private |
Stores config options.
|
private |
used to check interval of update
|
private |
Player data.
|
private |
Current Proposals.
|
private |
Queues.
|
private |
Stores rewards for random dungeons.
|
private |
Current Role checks.