diff options
Diffstat (limited to 'src/server/game/DungeonFinding/LFGMgr.cpp')
-rw-r--r-- | src/server/game/DungeonFinding/LFGMgr.cpp | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 977dcbb216b..19ea140d998 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -309,9 +309,8 @@ void LFGMgr::Update(uint32 diff) ObjectGuid pguid = itVotes->first; if (pguid != boot.victim) SendLfgBootProposalUpdate(pguid, boot); - SetState(pguid, LFG_STATE_DUNGEON); } - SetState(itBoot->first, LFG_STATE_DUNGEON); + SetVoteKick(itBoot->first, false); BootsStore.erase(itBoot); } } @@ -642,7 +641,6 @@ void LFGMgr::LeaveLfg(ObjectGuid guid) break; case LFG_STATE_DUNGEON: case LFG_STATE_FINISHED_DUNGEON: - case LFG_STATE_BOOT: if (guid != gguid) // Player SetState(guid, LFG_STATE_NONE); break; @@ -1159,7 +1157,7 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate */ void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, std::string const& reason) { - SetState(gguid, LFG_STATE_BOOT); + SetVoteKick(gguid, true); LfgPlayerBoot& boot = BootsStore[gguid]; boot.inProgress = true; @@ -1173,7 +1171,6 @@ void LFGMgr::InitBoot(ObjectGuid gguid, ObjectGuid kicker, ObjectGuid victim, st for (GuidSet::const_iterator itr = players.begin(); itr != players.end(); ++itr) { ObjectGuid guid = (*itr); - SetState(guid, LFG_STATE_BOOT); boot.votes[guid] = LFG_ANSWER_PENDING; } @@ -1230,13 +1227,10 @@ void LFGMgr::UpdateBoot(ObjectGuid guid, bool accept) { ObjectGuid pguid = itVotes->first; if (pguid != boot.victim) - { - SetState(pguid, LFG_STATE_DUNGEON); SendLfgBootProposalUpdate(pguid, boot); - } } - SetState(gguid, LFG_STATE_DUNGEON); + SetVoteKick(gguid, false); if (agreeNum == LFG_GROUP_KICK_VOTES_NEEDED) // Vote passed - Kick player { if (Group* group = sGroupMgr->GetGroupByGUID(gguid)) @@ -1498,12 +1492,12 @@ LfgState LFGMgr::GetState(ObjectGuid guid) if (guid.IsParty()) { state = GroupsStore[guid].GetState(); - TC_LOG_TRACE("lfg.data.group.state.get", "Group: %s, State: %u", guid.ToString().c_str(), state); + TC_LOG_TRACE("lfg.data.group.state.get", "Group: %s, State: %s", guid.ToString().c_str(), GetStateString(state).c_str()); } else { state = PlayersStore[guid].GetState(); - TC_LOG_TRACE("lfg.data.player.state.get", "Player: %s, State: %u", guid.ToString().c_str(), state); + TC_LOG_TRACE("lfg.data.player.state.get", "Player: %s, State: %s", guid.ToString().c_str(), GetStateString(state).c_str()); } return state; @@ -1526,6 +1520,16 @@ LfgState LFGMgr::GetOldState(ObjectGuid guid) return state; } +bool LFGMgr::IsVoteKickActive(ObjectGuid gguid) +{ + ASSERT(gguid.IsGroup()); + + bool active = GroupsStore[gguid].IsVoteKickActive(); + TC_LOG_TRACE("lfg.data.group.votekick.get", "Group: %s, Active: %d", gguid.ToString().c_str(), active); + + return active; +} + uint32 LFGMgr::GetDungeon(ObjectGuid guid, bool asId /*= true */) { uint32 dungeon = GroupsStore[guid].GetDungeon(asId); @@ -1686,6 +1690,17 @@ void LFGMgr::SetState(ObjectGuid guid, LfgState state) } } +void LFGMgr::SetVoteKick(ObjectGuid gguid, bool active) +{ + ASSERT(gguid.IsGroup()); + + LfgGroupData& data = GroupsStore[gguid]; + TC_LOG_TRACE("lfg.data.group.votekick.set", "Group: %s, New state: %d, Previous: %d", + gguid.ToString().c_str(), active, data.IsVoteKickActive()); + + data.SetVoteKick(active); +} + void LFGMgr::SetDungeon(ObjectGuid guid, uint32 dungeon) { TC_LOG_TRACE("lfg.data.group.dungeon.set", "Group: %s, Dungeon: %u", guid.ToString().c_str(), dungeon); |