mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 01:15:35 +01:00
Core/Dungeon Finder: Fix reward for last member of each group being disbanded to join new lfg group
- Move some messages to Trace - Add some cases where internal data wasn't updated with new state - Reverts441712fbbandae507e5(Old State should only store those states you can Restore from a Rolecheck/Proposal) Closes #8339 Closes #8420 Closes #8421
This commit is contained in:
@@ -34,10 +34,12 @@ void LfgGroupData::SetState(LfgState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
case LFG_STATE_NONE:
|
||||
m_Dungeon = 0;
|
||||
m_KicksLeft = LFG_GROUP_MAX_KICKS;
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = m_State;
|
||||
m_OldState = state;
|
||||
// No break on purpose
|
||||
default:
|
||||
m_State = state;
|
||||
|
||||
@@ -370,11 +370,13 @@ void LFGMgr::Update(uint32 diff)
|
||||
for (LfgRolesMap::const_iterator itRoles = roleCheck.roles.begin(); itRoles != roleCheck.roles.end(); ++itRoles)
|
||||
{
|
||||
uint64 guid = itRoles->first;
|
||||
ClearState(guid, "Remove Obsolete RoleCheck");
|
||||
RestoreState(guid, "Remove Obsolete RoleCheck");
|
||||
SendLfgRoleCheckUpdate(guid, roleCheck);
|
||||
if (guid == roleCheck.leader)
|
||||
SendLfgJoinResult(guid, LfgJoinResultData(LFG_JOIN_FAILED, LFG_ROLECHECK_MISSING_ROLE));
|
||||
}
|
||||
|
||||
RestoreState(itRoleCheck->first, "Remove Obsolete RoleCheck");
|
||||
RoleChecksStore.erase(itRoleCheck);
|
||||
}
|
||||
|
||||
@@ -754,7 +756,7 @@ void LFGMgr::JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, const
|
||||
*/
|
||||
void LFGMgr::LeaveLfg(uint64 guid)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::Leave: [" UI64FMTD "]", guid);
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::LeaveLfg: [" UI64FMTD "]", guid);
|
||||
|
||||
uint64 gguid = IS_GROUP(guid) ? guid : GetGroup(guid);
|
||||
LfgState state = GetState(guid);
|
||||
@@ -765,13 +767,12 @@ void LFGMgr::LeaveLfg(uint64 guid)
|
||||
{
|
||||
LFGQueue& queue = GetQueue(gguid);
|
||||
queue.RemoveFromQueue(gguid);
|
||||
RestoreState(gguid, "Leave queue");
|
||||
SetState(gguid, LFG_STATE_NONE);
|
||||
const LfgGuidSet& players = GetPlayers(gguid);
|
||||
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
|
||||
{
|
||||
uint64 guid = (*it);
|
||||
ClearState(guid, "Leave queue");
|
||||
SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
|
||||
SetState(*it, LFG_STATE_NONE);
|
||||
SendLfgUpdateParty(*it, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -779,7 +780,7 @@ void LFGMgr::LeaveLfg(uint64 guid)
|
||||
LFGQueue& queue = GetQueue(guid);
|
||||
queue.RemoveFromQueue(guid);
|
||||
SendLfgUpdatePlayer(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
|
||||
ClearState(guid, "Leave queue");
|
||||
SetState(guid, LFG_STATE_NONE);
|
||||
}
|
||||
break;
|
||||
case LFG_STATE_ROLECHECK:
|
||||
@@ -808,7 +809,20 @@ void LFGMgr::LeaveLfg(uint64 guid)
|
||||
RemoveProposal(it, LFG_UPDATETYPE_PROPOSAL_DECLINED);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
case LFG_STATE_BOOT:
|
||||
if (guid != gguid) // Player
|
||||
{
|
||||
UpdateBoot(guid); // Forcing LFG_ANSWER_PENDING (Removal of player)
|
||||
SetState(guid, LFG_STATE_NONE);
|
||||
}
|
||||
break;
|
||||
case LFG_STATE_NONE:
|
||||
case LFG_STATE_RAIDBROWSER:
|
||||
break;
|
||||
case LFG_STATE_DUNGEON:
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
if (guid != gguid) // Player
|
||||
SetState(guid, LFG_STATE_NONE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -882,7 +896,7 @@ void LFGMgr::UpdateRoleCheck(uint64 gguid, uint64 guid /* = 0 */, uint8 roles /*
|
||||
if (roleCheck.leader == pguid)
|
||||
SendLfgJoinResult(pguid, joinData);
|
||||
SendLfgUpdateParty(pguid, LfgUpdateData(LFG_UPDATETYPE_ROLECHECK_FAILED));
|
||||
ClearState(pguid, "Role check Failed");
|
||||
RestoreState(pguid, "Rolecheck Failed");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1007,7 +1021,7 @@ bool LFGMgr::CheckGroupRoles(LfgRolesMap& groles, bool removeLeaderFlag /*= true
|
||||
Makes a new group given a proposal
|
||||
@param[in] proposal Proposal to get info from
|
||||
*/
|
||||
void LFGMgr::MakeNewGroup(const LfgProposal& proposal)
|
||||
void LFGMgr::MakeNewGroup(LfgProposal const& proposal)
|
||||
{
|
||||
LfgGuidList players;
|
||||
LfgGuidList playersToTeleport;
|
||||
@@ -1038,7 +1052,7 @@ void LFGMgr::MakeNewGroup(const LfgProposal& proposal)
|
||||
|
||||
Group* group = player->GetGroup();
|
||||
if (group && group != grp)
|
||||
player->RemoveFromGroup();
|
||||
group->RemoveMember(player->GetGUID());
|
||||
|
||||
if (!grp)
|
||||
{
|
||||
@@ -1243,10 +1257,11 @@ void LFGMgr::RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdate
|
||||
updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE;
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveProposal: [" UI64FMTD "] in same group that someone that didn't accept. Removing from queue and compatible cache", guid);
|
||||
}
|
||||
ClearState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept");
|
||||
|
||||
RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept");
|
||||
if (gguid != guid)
|
||||
{
|
||||
RestoreState(gguid, "Proposal Fail (someone in group didn't accepted)");
|
||||
RestoreState(it->second.group, "Proposal Fail (someone in group didn't accepted)");
|
||||
SendLfgUpdateParty(guid, updateData);
|
||||
}
|
||||
else
|
||||
@@ -1325,9 +1340,9 @@ void LFGMgr::InitBoot(uint64 gguid, uint64 kicker, uint64 victim, std::string co
|
||||
Update Boot info with player answer
|
||||
|
||||
@param[in] guid Player who has answered
|
||||
@param[in] accept player answer
|
||||
@param[in] player answer
|
||||
*/
|
||||
void LFGMgr::UpdateBoot(uint64 guid, bool accept)
|
||||
void LFGMgr::UpdateBoot(uint64 guid, LfgAnswer answer)
|
||||
{
|
||||
uint64 gguid = GetGroup(guid);
|
||||
if (!gguid)
|
||||
@@ -1339,26 +1354,42 @@ void LFGMgr::UpdateBoot(uint64 guid, bool accept)
|
||||
|
||||
LfgPlayerBoot& boot = itBoot->second;
|
||||
|
||||
if (boot.votes[guid] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
|
||||
return;
|
||||
|
||||
boot.votes[guid] = LfgAnswer(accept);
|
||||
|
||||
uint8 votesNum = 0;
|
||||
uint8 agreeNum = 0;
|
||||
for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
|
||||
|
||||
if (guid == boot.victim)
|
||||
agreeNum = LFG_GROUP_KICK_VOTES_NEEDED + 1; // +1 on purpose to skip kick code
|
||||
else if (answer == LFG_ANSWER_PENDING)
|
||||
{
|
||||
if (itVotes->second != LFG_ANSWER_PENDING)
|
||||
boot.votes.erase(guid);
|
||||
// If we don't have enough members - force boot fail
|
||||
if (boot.votes.size() <= LFG_GROUP_KICK_VOTES_NEEDED)
|
||||
{
|
||||
++votesNum;
|
||||
if (itVotes->second == LFG_ANSWER_AGREE)
|
||||
++agreeNum;
|
||||
agreeNum = 0;
|
||||
votesNum = boot.votes.size();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (boot.votes[guid] != LFG_ANSWER_PENDING) // Cheat check: Player can't vote twice
|
||||
return;
|
||||
|
||||
// if we don't have enough votes (agree or deny) do nothing
|
||||
if (agreeNum < LFG_GROUP_KICK_VOTES_NEEDED && (votesNum - agreeNum) < LFG_GROUP_KICK_VOTES_NEEDED)
|
||||
return;
|
||||
boot.votes[guid] = answer;
|
||||
|
||||
for (LfgAnswerContainer::const_iterator itVotes = boot.votes.begin(); itVotes != boot.votes.end(); ++itVotes)
|
||||
{
|
||||
if (itVotes->second != LFG_ANSWER_PENDING)
|
||||
{
|
||||
++votesNum;
|
||||
if (itVotes->second == LFG_ANSWER_AGREE)
|
||||
++agreeNum;
|
||||
}
|
||||
}
|
||||
|
||||
// if we don't have enough votes (agree or deny) do nothing
|
||||
if (agreeNum < LFG_GROUP_KICK_VOTES_NEEDED && (votesNum - agreeNum) < LFG_GROUP_KICK_VOTES_NEEDED)
|
||||
return;
|
||||
}
|
||||
|
||||
// Send update info to all players
|
||||
boot.inProgress = false;
|
||||
@@ -1517,7 +1548,6 @@ void LFGMgr::RewardDungeonDoneFor(const uint32 dungeonId, Player* player)
|
||||
|
||||
// Clear player related lfg stuff
|
||||
uint32 rDungeonId = (*GetSelectedDungeons(guid).begin());
|
||||
ClearState(guid, "Dungeon Finished");
|
||||
SetState(guid, LFG_STATE_FINISHED_DUNGEON);
|
||||
|
||||
// Give rewards only if its a random or seasonal dungeon
|
||||
@@ -1621,14 +1651,14 @@ LfgState LFGMgr::GetState(uint64 guid)
|
||||
else
|
||||
state = PlayersStore[guid].GetState();
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetState: [" UI64FMTD "] = %u", guid, state);
|
||||
return state;
|
||||
}
|
||||
|
||||
uint32 LFGMgr::GetDungeon(uint64 guid, bool asId /*= true */)
|
||||
{
|
||||
uint32 dungeon = GroupsStore[guid].GetDungeon(asId);
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetDungeon: [" UI64FMTD "] asId: %u = %u", guid, asId, dungeon);
|
||||
return dungeon;
|
||||
}
|
||||
|
||||
@@ -1640,20 +1670,20 @@ uint32 LFGMgr::GetDungeonMapId(uint64 guid)
|
||||
if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
|
||||
mapId = dungeon->map;
|
||||
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetDungeonMapId: [" UI64FMTD "] = %u (DungeonId = %u)", guid, mapId, dungeonId);
|
||||
return mapId;
|
||||
}
|
||||
|
||||
uint8 LFGMgr::GetRoles(uint64 guid)
|
||||
{
|
||||
uint8 roles = PlayersStore[guid].GetRoles();
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetRoles: [" UI64FMTD "] = %u", guid, roles);
|
||||
return roles;
|
||||
}
|
||||
|
||||
const std::string& LFGMgr::GetComment(uint64 guid)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str());
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetComment: [" UI64FMTD "] = %s", guid, PlayersStore[guid].GetComment().c_str());
|
||||
return PlayersStore[guid].GetComment();
|
||||
}
|
||||
|
||||
@@ -1669,48 +1699,50 @@ bool LFGMgr::IsTeleported(uint64 pguid)
|
||||
|
||||
const LfgDungeonSet& LFGMgr::GetSelectedDungeons(uint64 guid)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetSelectedDungeons: [" UI64FMTD "]", guid);
|
||||
return PlayersStore[guid].GetSelectedDungeons();
|
||||
}
|
||||
|
||||
const LfgLockMap& LFGMgr::GetLockedDungeons(uint64 guid)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetLockedDungeons: [" UI64FMTD "]", guid);
|
||||
return PlayersStore[guid].GetLockedDungeons();
|
||||
}
|
||||
|
||||
uint8 LFGMgr::GetKicksLeft(uint64 guid)
|
||||
{
|
||||
uint8 kicks = GroupsStore[guid].GetKicksLeft();
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::GetKicksLeft: [" UI64FMTD "] = %u", guid, kicks);
|
||||
return kicks;
|
||||
}
|
||||
|
||||
void LFGMgr::RestoreState(uint64 guid, char const *debugMsg)
|
||||
{
|
||||
LfgGroupData& data = GroupsStore[guid];
|
||||
if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
|
||||
if (IS_GROUP(guid))
|
||||
{
|
||||
std::string const& ps = GetStateString(data.GetState());
|
||||
std::string const& os = GetStateString(data.GetOldState());
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RestoreState: Group: [" UI64FMTD "] (%s) State: %s, oldState: %s",
|
||||
guid, debugMsg, ps.c_str(), os.c_str());
|
||||
LfgGroupData& data = GroupsStore[guid];
|
||||
if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
|
||||
{
|
||||
std::string const& ps = GetStateString(data.GetState());
|
||||
std::string const& os = GetStateString(data.GetOldState());
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RestoreState: Group: [" UI64FMTD "] (%s) State: %s, oldState: %s",
|
||||
guid, debugMsg, ps.c_str(), os.c_str());
|
||||
}
|
||||
|
||||
data.RestoreState();
|
||||
}
|
||||
|
||||
data.RestoreState();
|
||||
}
|
||||
|
||||
void LFGMgr::ClearState(uint64 guid, char const *debugMsg)
|
||||
{
|
||||
LfgPlayerData& data = PlayersStore[guid];
|
||||
if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
|
||||
else
|
||||
{
|
||||
std::string const& ps = GetStateString(data.GetState());
|
||||
std::string const& os = GetStateString(data.GetOldState());
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::ClearState: Player: [" UI64FMTD "] (%s) State: %s, oldState: %s",
|
||||
guid, debugMsg, ps.c_str(), os.c_str());
|
||||
LfgPlayerData& data = PlayersStore[guid];
|
||||
if (sLog->ShouldLog(LOG_FILTER_LFG, LOG_LEVEL_DEBUG))
|
||||
{
|
||||
std::string const& ps = GetStateString(data.GetState());
|
||||
std::string const& os = GetStateString(data.GetOldState());
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RestoreState: Player: [" UI64FMTD "] (%s) State: %s, oldState: %s",
|
||||
guid, debugMsg, ps.c_str(), os.c_str());
|
||||
}
|
||||
data.RestoreState();
|
||||
}
|
||||
data.ClearState();
|
||||
}
|
||||
|
||||
void LFGMgr::SetState(uint64 guid, LfgState state)
|
||||
@@ -1723,7 +1755,7 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
|
||||
std::string const& ns = GetStateString(state);
|
||||
std::string const& ps = GetStateString(data.GetState());
|
||||
std::string const& os = GetStateString(data.GetOldState());
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetState: Group: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetState: Group: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
|
||||
guid, ns.c_str(), ps.c_str(), os.c_str());
|
||||
}
|
||||
data.SetState(state);
|
||||
@@ -1736,7 +1768,7 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
|
||||
std::string const& ns = GetStateString(state);
|
||||
std::string const& ps = GetStateString(data.GetState());
|
||||
std::string const& os = GetStateString(data.GetOldState());
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetState: Player: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetState: Player: [" UI64FMTD "] newState: %s, previous: %s, oldState: %s",
|
||||
guid, ns.c_str(), ps.c_str(), os.c_str());
|
||||
}
|
||||
data.SetState(state);
|
||||
@@ -1745,43 +1777,43 @@ void LFGMgr::SetState(uint64 guid, LfgState state)
|
||||
|
||||
void LFGMgr::SetDungeon(uint64 guid, uint32 dungeon)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetDungeon: [" UI64FMTD "] dungeon %u", guid, dungeon);
|
||||
GroupsStore[guid].SetDungeon(dungeon);
|
||||
}
|
||||
|
||||
void LFGMgr::SetRoles(uint64 guid, uint8 roles)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetRoles: [" UI64FMTD "] roles: %u", guid, roles);
|
||||
PlayersStore[guid].SetRoles(roles);
|
||||
}
|
||||
|
||||
void LFGMgr::SetComment(uint64 guid, const std::string& comment)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetComment: [" UI64FMTD "] comment: %s", guid, comment.c_str());
|
||||
PlayersStore[guid].SetComment(comment);
|
||||
}
|
||||
|
||||
void LFGMgr::SetSelectedDungeons(uint64 guid, const LfgDungeonSet& dungeons)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetSelectedDungeons: [" UI64FMTD "]", guid);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetSelectedDungeons: [" UI64FMTD "]", guid);
|
||||
PlayersStore[guid].SetSelectedDungeons(dungeons);
|
||||
}
|
||||
|
||||
void LFGMgr::SetLockedDungeons(uint64 guid, const LfgLockMap& lock)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::SetLockedDungeons: [" UI64FMTD "]", guid);
|
||||
PlayersStore[guid].SetLockedDungeons(lock);
|
||||
}
|
||||
|
||||
void LFGMgr::DecreaseKicksLeft(uint64 guid)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::DecreaseKicksLeft: [" UI64FMTD "]", guid);
|
||||
GroupsStore[guid].DecreaseKicksLeft();
|
||||
}
|
||||
|
||||
void LFGMgr::RemovePlayerData(uint64 guid)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemovePlayerData: [" UI64FMTD "]", guid);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RemovePlayerData: [" UI64FMTD "]", guid);
|
||||
LfgPlayerDataContainer::iterator it = PlayersStore.find(guid);
|
||||
if (it != PlayersStore.end())
|
||||
PlayersStore.erase(it);
|
||||
@@ -1789,18 +1821,23 @@ void LFGMgr::RemovePlayerData(uint64 guid)
|
||||
|
||||
void LFGMgr::RemoveGroupData(uint64 guid)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
|
||||
sLog->outTrace(LOG_FILTER_LFG, "LFGMgr::RemoveGroupData: [" UI64FMTD "]", guid);
|
||||
LfgGroupDataContainer::iterator it = GroupsStore.find(guid);
|
||||
if (it == GroupsStore.end())
|
||||
return;
|
||||
|
||||
LfgState state = GetState(guid);
|
||||
// If group is being formed after proposal success do nothing more
|
||||
LfgGuidSet const& players = it->second.GetPlayers();
|
||||
for (LfgGuidSet::const_iterator it = players.begin(); it != players.end(); ++it)
|
||||
{
|
||||
uint64 guid = (*it);
|
||||
ClearState(*it, "Group Disband");
|
||||
SetGroup(*it, 0);
|
||||
SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
|
||||
if (state != LFG_STATE_PROPOSAL)
|
||||
{
|
||||
SetState(*it, LFG_STATE_NONE);
|
||||
SendLfgUpdateParty(guid, LfgUpdateData(LFG_UPDATETYPE_REMOVED_FROM_QUEUE));
|
||||
}
|
||||
}
|
||||
GroupsStore.erase(it);
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ 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)
|
||||
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
|
||||
};
|
||||
@@ -322,7 +322,7 @@ class LFGMgr
|
||||
|
||||
// Vote kick
|
||||
void InitBoot(uint64 gguid, uint64 kguid, uint64 vguid, std::string const& reason);
|
||||
void UpdateBoot(uint64 guid, bool accept);
|
||||
void UpdateBoot(uint64 guid, LfgAnswer accept = LFG_ANSWER_PENDING);
|
||||
|
||||
void InitializeLockedDungeons(Player* player, uint8 level = 0);
|
||||
|
||||
|
||||
@@ -33,23 +33,27 @@ void LfgPlayerData::SetState(LfgState state)
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
m_Roles = 0;
|
||||
m_SelectedDungeons.clear();
|
||||
m_Comment = "";
|
||||
// No break on purpose
|
||||
case LFG_STATE_DUNGEON:
|
||||
m_OldState = m_State;
|
||||
m_OldState = state;
|
||||
// No break on purpose
|
||||
default:
|
||||
m_State = state;
|
||||
}
|
||||
}
|
||||
|
||||
void LfgPlayerData::ClearState()
|
||||
void LfgPlayerData::RestoreState()
|
||||
{
|
||||
m_SelectedDungeons.clear();
|
||||
m_Roles = 0;
|
||||
if (m_OldState == LFG_STATE_NONE)
|
||||
{
|
||||
m_SelectedDungeons.clear();
|
||||
m_Roles = 0;
|
||||
}
|
||||
m_State = m_OldState;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetLockedDungeons(const LfgLockMap& lockStatus)
|
||||
void LfgPlayerData::SetLockedDungeons(LfgLockMap const& lockStatus)
|
||||
{
|
||||
m_LockedDungeons = lockStatus;
|
||||
}
|
||||
@@ -69,12 +73,12 @@ void LfgPlayerData::SetRoles(uint8 roles)
|
||||
m_Roles = roles;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetComment(const std::string& comment)
|
||||
void LfgPlayerData::SetComment(std::string const& comment)
|
||||
{
|
||||
m_Comment = comment;
|
||||
}
|
||||
|
||||
void LfgPlayerData::SetSelectedDungeons(const LfgDungeonSet& dungeons)
|
||||
void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
|
||||
{
|
||||
m_SelectedDungeons = dungeons;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class LfgPlayerData
|
||||
|
||||
// General
|
||||
void SetState(LfgState state);
|
||||
void ClearState();
|
||||
void RestoreState();
|
||||
void SetLockedDungeons(LfgLockMap const& lock);
|
||||
void SetTeam(uint8 team);
|
||||
void SetGroup(uint64 group);
|
||||
@@ -56,7 +56,7 @@ class LfgPlayerData
|
||||
private:
|
||||
// General
|
||||
LfgState m_State; ///< State if group in LFG
|
||||
LfgState m_OldState; ///< Old State
|
||||
LfgState m_OldState; ///< Old State - Used to restore state after failed Rolecheck/Proposal
|
||||
// Player
|
||||
LfgLockMap m_LockedDungeons; ///< Dungeons player can't do and reason
|
||||
uint8 m_Team; ///< Player team - determines the queue to join
|
||||
|
||||
@@ -483,12 +483,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(LfgGuidList check)
|
||||
}
|
||||
|
||||
proposal.queues = check;
|
||||
if (check.size() == 1)
|
||||
{
|
||||
for (LfgGroupsMap::const_iterator it = proposalGroups.begin(); it != proposalGroups.end(); ++it)
|
||||
if (proposal.group && it->second != proposal.group)
|
||||
proposal.isNew = false;
|
||||
}
|
||||
proposal.isNew = numLfgGroups != 1;
|
||||
|
||||
if (!sLFGMgr->AllQueued(check))
|
||||
{
|
||||
|
||||
@@ -161,7 +161,6 @@ void LFGGroupScript::OnRemoveMember(Group* group, uint64 guid, RemoveMethod meth
|
||||
}
|
||||
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
sLFGMgr->SetState(guid, LFG_STATE_NONE);
|
||||
sLFGMgr->SetGroup(guid, 0);
|
||||
uint8 players = sLFGMgr->RemovePlayerFromGroup(gguid, guid);
|
||||
|
||||
|
||||
@@ -368,10 +368,13 @@ bool Group::AddMember(Player* player)
|
||||
if (player)
|
||||
{
|
||||
player->SetGroupInvite(NULL);
|
||||
if (player->GetGroup() && (isBGGroup() || isBFGroup())) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
|
||||
player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
|
||||
else if (player->GetGroup()) //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
|
||||
player->SetOriginalGroup(this, subGroup);
|
||||
if (player->GetGroup())
|
||||
{
|
||||
if (isBGGroup() || isBFGroup()) // if player is in group and he is being added to BG raid group, then call SetBattlegroundRaid()
|
||||
player->SetBattlegroundOrBattlefieldRaid(this, subGroup);
|
||||
else //if player is in bg raid and we are adding him to normal group, then call SetOriginalGroup()
|
||||
player->SetOriginalGroup(this, subGroup);
|
||||
}
|
||||
else //if player is not in group, then call set group
|
||||
player->SetGroup(this, subGroup);
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData)
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
sLog->outDebug(LOG_FILTER_LFG, "CMSG_LFG_SET_BOOT_VOTE %s agree: %u",
|
||||
GetPlayerInfo().c_str(), agree ? 1 : 0);
|
||||
sLFGMgr->UpdateBoot(guid, agree);
|
||||
sLFGMgr->UpdateBoot(guid, agree ? LFG_ANSWER_AGREE : LFG_ANSWER_DENY);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData)
|
||||
|
||||
Reference in New Issue
Block a user