mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 00:53:46 +00:00
Big update.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
std::string ConcatenateDungeons(LfgDungeonSet const& dungeons)
|
||||
{
|
||||
std::string dungeonstr = "";
|
||||
|
||||
@@ -147,10 +147,10 @@ namespace lfg
|
||||
~Lfg5Guids() { delete roles; }
|
||||
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
|
||||
void clear() { guids.fill(ObjectGuid::Empty); }
|
||||
bool empty() const { return guids[0] == ObjectGuid::Empty; }
|
||||
ObjectGuid front() const { return guids[0]; }
|
||||
[[nodiscard]] bool empty() const { return guids[0] == ObjectGuid::Empty; }
|
||||
[[nodiscard]] ObjectGuid front() const { return guids[0]; }
|
||||
|
||||
uint8 size() const
|
||||
[[nodiscard]] uint8 size() const
|
||||
{
|
||||
if (guids[2])
|
||||
{
|
||||
@@ -422,7 +422,7 @@ namespace lfg
|
||||
}
|
||||
}
|
||||
|
||||
bool hasGuid(const ObjectGuid& g) const
|
||||
[[nodiscard]] bool hasGuid(const ObjectGuid& g) const
|
||||
{
|
||||
return g && (guids[0] == g || guids[1] == g || guids[2] == g || guids[3] == g || guids[4] == g);
|
||||
}
|
||||
@@ -481,7 +481,7 @@ namespace lfg
|
||||
roles = x.roles ? (new LfgRolesMap(*(x.roles))) : nullptr;
|
||||
}
|
||||
|
||||
std::string toString() const // for debugging
|
||||
[[nodiscard]] std::string toString() const // for debugging
|
||||
{
|
||||
std::ostringstream o;
|
||||
o << guids[0].ToString().c_str() << "," << guids[1].ToString().c_str() << "," << guids[2].ToString().c_str() << "," << guids[3].ToString().c_str() << "," << guids[4].ToString().c_str() << ":" << (roles ? 1 : 0);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
namespace lfg
|
||||
{
|
||||
LfgGroupData::LfgGroupData(): m_State(LFG_STATE_NONE), m_OldState(LFG_STATE_NONE),
|
||||
m_Dungeon(0), m_KicksLeft(sWorld->getIntConfig(CONFIG_LFG_MAX_KICK_COUNT))
|
||||
m_Dungeon(0), _isLFGGroup(false), m_KicksLeft(sWorld->getIntConfig(CONFIG_LFG_MAX_KICK_COUNT))
|
||||
{ }
|
||||
|
||||
LfgGroupData::~LfgGroupData()
|
||||
@@ -30,11 +30,23 @@ namespace lfg
|
||||
|
||||
bool LfgGroupData::IsLfgGroup()
|
||||
{
|
||||
return m_OldState != LFG_STATE_NONE;
|
||||
return _isLFGGroup;
|
||||
}
|
||||
|
||||
void LfgGroupData::SetState(LfgState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_DUNGEON:
|
||||
_isLFGGroup = true;
|
||||
break;
|
||||
case LFG_STATE_FINISHED_DUNGEON:
|
||||
_isLFGGroup = false;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case LFG_STATE_NONE:
|
||||
|
||||
@@ -48,17 +48,17 @@ namespace lfg
|
||||
void DecreaseKicksLeft();
|
||||
|
||||
// General
|
||||
LfgState GetState() const;
|
||||
LfgState GetOldState() const;
|
||||
LfgGuidSet const& GetPlayers() const;
|
||||
uint8 GetPlayerCount() const;
|
||||
ObjectGuid GetLeader() const;
|
||||
[[nodiscard]] LfgState GetState() const;
|
||||
[[nodiscard]] LfgState GetOldState() const;
|
||||
[[nodiscard]] LfgGuidSet const& GetPlayers() const;
|
||||
[[nodiscard]] uint8 GetPlayerCount() const;
|
||||
[[nodiscard]] ObjectGuid GetLeader() const;
|
||||
|
||||
// Dungeon
|
||||
uint32 GetDungeon(bool asId = true) const;
|
||||
[[nodiscard]] uint32 GetDungeon(bool asId = true) const;
|
||||
|
||||
// VoteKick
|
||||
uint8 GetKicksLeft() const;
|
||||
[[nodiscard]] uint8 GetKicksLeft() const;
|
||||
|
||||
private:
|
||||
// General
|
||||
@@ -68,6 +68,7 @@ namespace lfg
|
||||
LfgGuidSet m_Players; ///< Players in group
|
||||
// Dungeon
|
||||
uint32 m_Dungeon; ///< Dungeon entry
|
||||
bool _isLFGGroup;
|
||||
// Vote Kick
|
||||
uint8 m_KicksLeft; ///< Number of kicks left
|
||||
};
|
||||
|
||||
@@ -16,11 +16,13 @@
|
||||
*/
|
||||
|
||||
#include "LFGMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "CharacterCache.h"
|
||||
#include "Common.h"
|
||||
#include "DBCStores.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
@@ -71,10 +73,10 @@ namespace lfg
|
||||
if (!guid.IsGroup())
|
||||
return;
|
||||
|
||||
SetLeader(guid, ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt32()));
|
||||
SetLeader(guid, ObjectGuid::Create<HighGuid::Player>(fields[0].Get<uint32>()));
|
||||
|
||||
uint32 dungeon = fields[17].GetUInt32();
|
||||
uint8 state = fields[18].GetUInt8();
|
||||
uint32 dungeon = fields[17].Get<uint32>();
|
||||
uint8 state = fields[18].Get<uint8>();
|
||||
|
||||
if (!dungeon || !state)
|
||||
return;
|
||||
@@ -98,9 +100,9 @@ namespace lfg
|
||||
return;
|
||||
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_LFG_DATA);
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
stmt->setUInt32(1, GetDungeon(guid));
|
||||
stmt->setUInt32(2, GetState(guid));
|
||||
stmt->SetData(0, guid.GetCounter());
|
||||
stmt->SetData(1, GetDungeon(guid));
|
||||
stmt->SetData(2, GetState(guid));
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -128,32 +130,32 @@ namespace lfg
|
||||
do
|
||||
{
|
||||
fields = result->Fetch();
|
||||
uint32 dungeonId = fields[0].GetUInt32();
|
||||
uint32 maxLevel = fields[1].GetUInt8();
|
||||
uint32 firstQuestId = fields[2].GetUInt32();
|
||||
uint32 otherQuestId = fields[3].GetUInt32();
|
||||
uint32 dungeonId = fields[0].Get<uint32>();
|
||||
uint32 maxLevel = fields[1].Get<uint8>();
|
||||
uint32 firstQuestId = fields[2].Get<uint32>();
|
||||
uint32 otherQuestId = fields[3].Get<uint32>();
|
||||
|
||||
if (!GetLFGDungeonEntry(dungeonId))
|
||||
{
|
||||
LOG_ERROR("lfg", "Dungeon %u specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
|
||||
LOG_ERROR("lfg", "Dungeon {} specified in table `lfg_dungeon_rewards` does not exist!", dungeonId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!maxLevel || maxLevel > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL))
|
||||
{
|
||||
LOG_ERROR("lfg", "Level %u specified for dungeon %u in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
|
||||
LOG_ERROR("lfg", "Level {} specified for dungeon {} in table `lfg_dungeon_rewards` can never be reached!", maxLevel, dungeonId);
|
||||
maxLevel = sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL);
|
||||
}
|
||||
|
||||
if (!firstQuestId || !sObjectMgr->GetQuestTemplate(firstQuestId))
|
||||
{
|
||||
LOG_ERROR("lfg", "First quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
|
||||
LOG_ERROR("lfg", "First quest {} specified for dungeon {} in table `lfg_dungeon_rewards` does not exist!", firstQuestId, dungeonId);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (otherQuestId && !sObjectMgr->GetQuestTemplate(otherQuestId))
|
||||
{
|
||||
LOG_ERROR("lfg", "Other quest %u specified for dungeon %u in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
|
||||
LOG_ERROR("lfg", "Other quest {} specified for dungeon {} in table `lfg_dungeon_rewards` does not exist!", otherQuestId, dungeonId);
|
||||
otherQuestId = 0;
|
||||
}
|
||||
|
||||
@@ -161,7 +163,7 @@ namespace lfg
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u lfg dungeon rewards in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", ">> Loaded {} lfg dungeon rewards in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
}
|
||||
|
||||
@@ -214,24 +216,24 @@ namespace lfg
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
uint32 dungeonId = fields[0].GetUInt32();
|
||||
uint32 dungeonId = fields[0].Get<uint32>();
|
||||
LFGDungeonContainer::iterator dungeonItr = LfgDungeonStore.find(dungeonId);
|
||||
if (dungeonItr == LfgDungeonStore.end())
|
||||
{
|
||||
LOG_ERROR("lfg", "table `lfg_dungeon_template` contains coordinates for wrong dungeon %u", dungeonId);
|
||||
LOG_ERROR("lfg", "table `lfg_dungeon_template` contains coordinates for wrong dungeon {}", dungeonId);
|
||||
continue;
|
||||
}
|
||||
|
||||
LFGDungeonData& data = dungeonItr->second;
|
||||
data.x = fields[1].GetFloat();
|
||||
data.y = fields[2].GetFloat();
|
||||
data.z = fields[3].GetFloat();
|
||||
data.o = fields[4].GetFloat();
|
||||
data.x = fields[1].Get<float>();
|
||||
data.y = fields[2].Get<float>();
|
||||
data.z = fields[3].Get<float>();
|
||||
data.o = fields[4].Get<float>();
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
|
||||
LOG_INFO("server.loading", ">> Loaded %u lfg entrance positions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", ">> Loaded {} lfg entrance positions in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||
LOG_INFO("server.loading", " ");
|
||||
|
||||
// Fill all other teleport coords from areatriggers
|
||||
@@ -245,7 +247,7 @@ namespace lfg
|
||||
AreaTriggerTeleport const* at = sObjectMgr->GetMapEntranceTrigger(dungeon.map);
|
||||
if (!at)
|
||||
{
|
||||
LOG_ERROR("lfg", "LFGMgr::LoadLFGDungeons: Failed to load dungeon %s, cant find areatrigger for map %u", dungeon.name.c_str(), dungeon.map);
|
||||
LOG_ERROR("lfg", "LFGMgr::LoadLFGDungeons: Failed to load dungeon {}, cant find areatrigger for map {}", dungeon.name, dungeon.map);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -278,7 +280,7 @@ namespace lfg
|
||||
|
||||
if (task == 0)
|
||||
{
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime().count();
|
||||
|
||||
// Remove obsolete role checks
|
||||
for (LfgRoleCheckContainer::iterator it = RoleChecksStore.begin(); it != RoleChecksStore.end();)
|
||||
@@ -577,8 +579,7 @@ namespace lfg
|
||||
rDungeonId = (*dungeons.begin());
|
||||
sScriptMgr->OnPlayerQueueRandomDungeon(player, rDungeonId);
|
||||
}
|
||||
// No break on purpose (Random can only be dungeon or heroic dungeon)
|
||||
[[fallthrough]];
|
||||
[[fallthrough]]; // On purpose (Random can only be dungeon or heroic dungeon)
|
||||
case LFG_TYPE_HEROIC:
|
||||
case LFG_TYPE_DUNGEON:
|
||||
if (isRaid)
|
||||
@@ -595,7 +596,7 @@ namespace lfg
|
||||
isRaid = true;
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("lfg", "Wrong dungeon type %u for dungeon %u", type, *it);
|
||||
LOG_ERROR("lfg", "Wrong dungeon type {} for dungeon {}", type, *it);
|
||||
joinData.result = LFG_JOIN_DUNGEON_INVALID;
|
||||
break;
|
||||
}
|
||||
@@ -605,12 +606,18 @@ namespace lfg
|
||||
if (!isRaid && joinData.result == LFG_JOIN_OK)
|
||||
{
|
||||
// Check player or group member restrictions
|
||||
if (player->InBattleground() || player->InArena() || player->InBattlegroundQueue())
|
||||
if (player->InBattleground() || (player->InBattlegroundQueue() && !sWorld->getBoolConfig(CONFIG_ALLOW_JOIN_BG_AND_LFG)))
|
||||
{
|
||||
joinData.result = LFG_JOIN_USING_BG_SYSTEM;
|
||||
}
|
||||
else if (player->HasAura(LFG_SPELL_DUNGEON_DESERTER))
|
||||
{
|
||||
joinData.result = LFG_JOIN_DESERTER;
|
||||
}
|
||||
else if (dungeons.empty())
|
||||
{
|
||||
joinData.result = LFG_JOIN_NOT_MEET_REQS;
|
||||
}
|
||||
else if (grp)
|
||||
{
|
||||
if (grp->GetMembersCount() > MAXGROUPSIZE)
|
||||
@@ -623,9 +630,14 @@ namespace lfg
|
||||
if (Player* plrg = itr->GetSource())
|
||||
{
|
||||
if (plrg->HasAura(LFG_SPELL_DUNGEON_DESERTER))
|
||||
{
|
||||
joinData.result = LFG_JOIN_PARTY_DESERTER;
|
||||
else if (plrg->InBattleground() || plrg->InArena() || plrg->InBattlegroundQueue())
|
||||
}
|
||||
else if (plrg->InBattleground() || (plrg->InBattlegroundQueue() && !sWorld->getBoolConfig(CONFIG_ALLOW_JOIN_BG_AND_LFG)))
|
||||
{
|
||||
joinData.result = LFG_JOIN_USING_BG_SYSTEM;
|
||||
}
|
||||
|
||||
++memberCount;
|
||||
players.insert(plrg->GetGUID());
|
||||
}
|
||||
@@ -688,7 +700,7 @@ namespace lfg
|
||||
// Can't join. Send result
|
||||
if (joinData.result != LFG_JOIN_OK)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::Join: [%s] joining with %u members. result: %u", guid.ToString().c_str(), grp ? grp->GetMembersCount() : 1, joinData.result);
|
||||
LOG_DEBUG("lfg", "LFGMgr::Join: [{}] joining with {} members. result: {}", guid.ToString(), grp ? grp->GetMembersCount() : 1, joinData.result);
|
||||
if (!dungeons.empty()) // Only should show lockmap when have no dungeons available
|
||||
joinData.lockmap.clear();
|
||||
player->GetSession()->SendLfgJoinResult(joinData);
|
||||
@@ -717,7 +729,7 @@ namespace lfg
|
||||
// Create new rolecheck
|
||||
LfgRoleCheck& roleCheck = RoleChecksStore[gguid];
|
||||
roleCheck.roles.clear(); // pussywizard: NEW rolecheck, not old one with trash data >_>
|
||||
roleCheck.cancelTime = time_t(time(nullptr)) + LFG_TIME_ROLECHECK;
|
||||
roleCheck.cancelTime = time_t(GameTime::GetGameTime().count()) + LFG_TIME_ROLECHECK;
|
||||
roleCheck.state = LFG_ROLECHECK_INITIALITING;
|
||||
roleCheck.leader = guid;
|
||||
roleCheck.dungeons = dungeons;
|
||||
@@ -755,7 +767,7 @@ namespace lfg
|
||||
LfgRolesMap rolesMap;
|
||||
rolesMap[guid] = roles;
|
||||
LFGQueue& queue = GetQueue(guid);
|
||||
queue.AddQueueData(guid, time(nullptr), dungeons, rolesMap);
|
||||
queue.AddQueueData(guid, GameTime::GetGameTime().count(), dungeons, rolesMap);
|
||||
|
||||
if (!isContinue)
|
||||
{
|
||||
@@ -779,7 +791,7 @@ namespace lfg
|
||||
std::ostringstream o;
|
||||
o << "LFGMgr::Join: [" << guid << "] joined (" << (grp ? "group" : "player") << ") Members: " << debugNames.c_str()
|
||||
<< ". Dungeons (" << uint32(dungeons.size()) << "): " << ConcatenateDungeons(dungeons);
|
||||
LOG_DEBUG("lfg", "%s", o.str().c_str());
|
||||
LOG_DEBUG("lfg", "{}", o.str());
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -797,7 +809,7 @@ namespace lfg
|
||||
*/
|
||||
void LFGMgr::LeaveLfg(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::Leave: [%s]", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::Leave: [{}]", guid.ToString());
|
||||
ObjectGuid gguid = guid.IsGroup() ? guid : GetGroup(guid);
|
||||
LfgState state = GetState(guid);
|
||||
switch (state)
|
||||
@@ -965,8 +977,10 @@ namespace lfg
|
||||
m_raidBrowserUpdateTimer[team] = 0;
|
||||
}
|
||||
|
||||
if (getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) > (70 * 7) / 5) // prevent lagging
|
||||
if (GetMSTimeDiff(GameTime::GetGameTimeMS(), GetTimeMS()) > 98ms) // prevent lagging
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectGuid guid, groupGuid, instanceGuid;
|
||||
uint8 level, Class, race, talents[3];
|
||||
@@ -1445,7 +1459,7 @@ namespace lfg
|
||||
{
|
||||
SetState(gguid, LFG_STATE_QUEUED);
|
||||
LFGQueue& queue = GetQueue(gguid);
|
||||
queue.AddQueueData(gguid, time_t(time(nullptr)), roleCheck.dungeons, roleCheck.roles);
|
||||
queue.AddQueueData(gguid, time_t(GameTime::GetGameTime().count()), roleCheck.dungeons, roleCheck.roles);
|
||||
RoleChecksStore.erase(itRoleCheck);
|
||||
}
|
||||
else if (roleCheck.state != LFG_ROLECHECK_INITIALITING)
|
||||
@@ -1673,8 +1687,7 @@ namespace lfg
|
||||
bool leaderTeleportIncluded = false;
|
||||
for (GroupReference* itr = grp->GetFirstMember(); itr != nullptr; itr = itr->next())
|
||||
{
|
||||
Player* plr = itr->GetSource();
|
||||
if (plr)
|
||||
if (Player* plr = itr->GetSource())
|
||||
{
|
||||
if (grp->IsLeader(plr->GetGUID()) && playersToTeleport.find(plr->GetGUID()) != playersToTeleport.end())
|
||||
{
|
||||
@@ -1686,6 +1699,19 @@ namespace lfg
|
||||
teleportLocation = plr;
|
||||
break;
|
||||
}
|
||||
|
||||
// Remove from battleground queues
|
||||
for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
|
||||
{
|
||||
if (BattlegroundQueueTypeId bgQueueTypeId = plr->GetBattlegroundQueueTypeId(i))
|
||||
{
|
||||
if (bgQueueTypeId != BATTLEGROUND_QUEUE_NONE)
|
||||
{
|
||||
plr->RemoveBattlegroundQueueId(bgQueueTypeId);
|
||||
sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId).RemovePlayer(plr->GetGUID(), false, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1787,7 +1813,7 @@ namespace lfg
|
||||
LfgProposalPlayer& player = itProposalPlayer->second;
|
||||
player.accept = LfgAnswer(accept);
|
||||
|
||||
LOG_DEBUG("lfg", "LFGMgr::UpdateProposal: Player [%s] of proposal %u selected: %u", guid.ToString().c_str(), proposalId, accept);
|
||||
LOG_DEBUG("lfg", "LFGMgr::UpdateProposal: Player [{}] of proposal {} selected: {}", guid.ToString(), proposalId, accept);
|
||||
if (!accept)
|
||||
{
|
||||
RemoveProposal(itProposal, LFG_UPDATETYPE_PROPOSAL_DECLINED);
|
||||
@@ -1810,7 +1836,7 @@ namespace lfg
|
||||
|
||||
bool sendUpdate = proposal.state != LFG_PROPOSAL_SUCCESS;
|
||||
proposal.state = LFG_PROPOSAL_SUCCESS;
|
||||
time_t joinTime = time(nullptr);
|
||||
time_t joinTime = GameTime::GetGameTime().count();
|
||||
|
||||
LFGQueue& queue = GetQueue(guid);
|
||||
LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_GROUP_FOUND);
|
||||
@@ -1878,7 +1904,7 @@ namespace lfg
|
||||
LfgProposal& proposal = itProposal->second;
|
||||
proposal.state = LFG_PROPOSAL_FAILED;
|
||||
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: Proposal %u, state FAILED, UpdateType %u", itProposal->first, type);
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: Proposal {}, state FAILED, UpdateType {}", itProposal->first, type);
|
||||
// Mark all people that didn't answered as no accept
|
||||
if (type == LFG_UPDATETYPE_PROPOSAL_FAILED)
|
||||
for (LfgProposalPlayerContainer::iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
|
||||
@@ -1922,12 +1948,12 @@ namespace lfg
|
||||
if (it->second.accept == LFG_ANSWER_DENY)
|
||||
{
|
||||
updateData.updateType = type;
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: [%s] didn't accept. Removing from queue and compatible cache", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: [{}] didn't accept. Removing from queue and compatible cache", guid.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
updateData.updateType = LFG_UPDATETYPE_REMOVED_FROM_QUEUE;
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: [%s] in same group that someone that didn't accept. Removing from queue and compatible cache", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: [{}] in same group that someone that didn't accept. Removing from queue and compatible cache", guid.ToString());
|
||||
}
|
||||
|
||||
RestoreState(guid, "Proposal Fail (didn't accepted or in group with someone that didn't accept");
|
||||
@@ -1941,7 +1967,7 @@ namespace lfg
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: Readding [%s] to queue.", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveProposal: Readding [{}] to queue.", guid.ToString());
|
||||
SetState(guid, LFG_STATE_QUEUED);
|
||||
if (gguid != guid)
|
||||
{
|
||||
@@ -1988,7 +2014,7 @@ namespace lfg
|
||||
|
||||
LfgPlayerBoot& boot = BootsStore[gguid];
|
||||
boot.inProgress = true;
|
||||
boot.cancelTime = time_t(time(nullptr)) + LFG_TIME_BOOT;
|
||||
boot.cancelTime = time_t(GameTime::GetGameTime().count()) + LFG_TIME_BOOT;
|
||||
boot.reason = reason;
|
||||
boot.victim = victim;
|
||||
|
||||
@@ -2150,8 +2176,8 @@ namespace lfg
|
||||
if (error != LFG_TELEPORTERROR_OK)
|
||||
player->GetSession()->SendLfgTeleportError(uint8(error));
|
||||
|
||||
//LOG_DEBUG("lfg", "TeleportPlayer: Player %s is being teleported in to map %u "
|
||||
// "(x: %f, y: %f, z: %f) Result: %u", player->GetName().c_str(), dungeon->map,
|
||||
//LOG_DEBUG("lfg", "TeleportPlayer: Player {} is being teleported in to map {} "
|
||||
// "(x: {}, y: {}, z: {}) Result: {}", player->GetName(), dungeon->map,
|
||||
// dungeon->x, dungeon->y, dungeon->z, error);
|
||||
}
|
||||
|
||||
@@ -2166,13 +2192,13 @@ namespace lfg
|
||||
uint32 gDungeonId = GetDungeon(gguid);
|
||||
if (gDungeonId != dungeonId)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [%s] Finished dungeon %u but group queued for %u. Ignoring", gguid.ToString().c_str(), dungeonId, gDungeonId);
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [{}] Finished dungeon {} but group queued for {}. Ignoring", gguid.ToString(), dungeonId, gDungeonId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetState(gguid) == LFG_STATE_FINISHED_DUNGEON) // Shouldn't happen. Do not reward multiple times
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [%s] Already rewarded group. Ignoring", gguid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [{}] Already rewarded group. Ignoring", gguid.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2185,7 +2211,7 @@ namespace lfg
|
||||
ObjectGuid guid = (*it);
|
||||
if (GetState(guid) == LFG_STATE_FINISHED_DUNGEON)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [%s] Already rewarded player. Ignoring", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [{}] Already rewarded player. Ignoring", guid.ToString());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2201,14 +2227,14 @@ namespace lfg
|
||||
|
||||
if (!dungeon || (dungeon->type != LFG_TYPE_RANDOM && !dungeon->seasonal))
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [%s] dungeon %u is not random or seasonal", guid.ToString().c_str(), rDungeonId);
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [{}] dungeon {} is not random or seasonal", guid.ToString(), rDungeonId);
|
||||
continue;
|
||||
}
|
||||
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (!player || player->FindMap() != currMap) // pussywizard: currMap - multithreading crash if on other map (map id check is not enough, binding system is not reliable)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [%s] not found in world", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [{}] not found in world", guid.ToString());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2217,7 +2243,7 @@ namespace lfg
|
||||
|
||||
if (player->GetMapId() != mapId)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [%s] is in map %u and should be in %u to get reward", guid.ToString().c_str(), player->GetMapId(), mapId);
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [{}] is in map {} and should be in {} to get reward", guid.ToString(), player->GetMapId(), mapId);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -2255,7 +2281,7 @@ namespace lfg
|
||||
}
|
||||
|
||||
// Give rewards
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [%s] done dungeon %u, %s previously done.", player->GetGUID().ToString().c_str(), GetDungeon(gguid), done ? " " : " not");
|
||||
LOG_DEBUG("lfg", "LFGMgr::FinishDungeon: [{}] done dungeon {}, {} previously done.", player->GetGUID().ToString(), GetDungeon(gguid), done ? " " : " not");
|
||||
LfgPlayerRewardData data = LfgPlayerRewardData(dungeon->Entry(), GetDungeon(gguid, false), done, quest);
|
||||
player->GetSession()->SendLfgPlayerReward(data);
|
||||
}
|
||||
@@ -2323,7 +2349,7 @@ namespace lfg
|
||||
else
|
||||
state = PlayersStore[guid].GetState();
|
||||
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetState: [%s] = %u", guid.ToString().c_str(), state);
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetState: [{}] = {}", guid.ToString(), state);
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -2335,14 +2361,14 @@ namespace lfg
|
||||
else
|
||||
state = PlayersStore[guid].GetOldState();
|
||||
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetOldState: [%s] = %u", guid.ToString().c_str(), state);
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetOldState: [{}] = {}", guid.ToString(), state);
|
||||
return state;
|
||||
}
|
||||
|
||||
uint32 LFGMgr::GetDungeon(ObjectGuid guid, bool asId /*= true */)
|
||||
{
|
||||
uint32 dungeon = GroupsStore[guid].GetDungeon(asId);
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetDungeon: [%s] asId: %u = %u", guid.ToString().c_str(), asId, dungeon);
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetDungeon: [{}] asId: {} = {}", guid.ToString(), asId, dungeon);
|
||||
return dungeon;
|
||||
}
|
||||
|
||||
@@ -2354,39 +2380,39 @@ namespace lfg
|
||||
if (LFGDungeonData const* dungeon = GetLFGDungeon(dungeonId))
|
||||
mapId = dungeon->map;
|
||||
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetDungeonMapId: [%s] = %u (DungeonId = %u)", guid.ToString().c_str(), mapId, dungeonId);
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetDungeonMapId: [{}] = {} (DungeonId = {})", guid.ToString(), mapId, dungeonId);
|
||||
return mapId;
|
||||
}
|
||||
|
||||
uint8 LFGMgr::GetRoles(ObjectGuid guid)
|
||||
{
|
||||
uint8 roles = PlayersStore[guid].GetRoles();
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetRoles: [%s] = %u", guid.ToString().c_str(), roles);
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetRoles: [{}] = {}", guid.ToString(), roles);
|
||||
return roles;
|
||||
}
|
||||
|
||||
const std::string& LFGMgr::GetComment(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetComment: [%s] = %s", guid.ToString().c_str(), PlayersStore[guid].GetComment().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetComment: [{}] = {}", guid.ToString(), PlayersStore[guid].GetComment());
|
||||
return PlayersStore[guid].GetComment();
|
||||
}
|
||||
|
||||
LfgDungeonSet const& LFGMgr::GetSelectedDungeons(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetSelectedDungeons: [%s]", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetSelectedDungeons: [{}]", guid.ToString());
|
||||
return PlayersStore[guid].GetSelectedDungeons();
|
||||
}
|
||||
|
||||
LfgLockMap const& LFGMgr::GetLockedDungeons(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetLockedDungeons: [%s]", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetLockedDungeons: [{}]", guid.ToString());
|
||||
return PlayersStore[guid].GetLockedDungeons();
|
||||
}
|
||||
|
||||
uint8 LFGMgr::GetKicksLeft(ObjectGuid guid)
|
||||
{
|
||||
uint8 kicks = GroupsStore[guid].GetKicksLeft();
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetKicksLeft: [%s] = %u", guid.ToString().c_str(), kicks);
|
||||
LOG_DEBUG("lfg", "LFGMgr::GetKicksLeft: [{}] = {}", guid.ToString(), kicks);
|
||||
return kicks;
|
||||
}
|
||||
|
||||
@@ -2399,8 +2425,8 @@ namespace lfg
|
||||
{
|
||||
std::string const& ps = GetStateString(data.GetState());
|
||||
std::string const& os = GetStateString(data.GetOldState());
|
||||
LOG_TRACE("lfg", "LFGMgr::RestoreState: Group: [%s] (%s) State: %s, oldState: %s",
|
||||
guid.ToString().c_str(), debugMsg, ps.c_str(), os.c_str());
|
||||
LOG_TRACE("lfg", "LFGMgr::RestoreState: Group: [{}] ({}) State: {}, oldState: {}",
|
||||
guid.ToString(), debugMsg, ps, os);
|
||||
}*/
|
||||
|
||||
data.RestoreState();
|
||||
@@ -2412,8 +2438,8 @@ namespace lfg
|
||||
{
|
||||
std::string const& ps = GetStateString(data.GetState());
|
||||
std::string const& os = GetStateString(data.GetOldState());
|
||||
LOG_TRACE("lfg", "LFGMgr::RestoreState: Player: [%s] (%s) State: %s, oldState: %s",
|
||||
guid.ToString().c_str(), debugMsg, ps.c_str(), os.c_str());
|
||||
LOG_TRACE("lfg", "LFGMgr::RestoreState: Player: [{}] ({}) State: {}, oldState: {}",
|
||||
guid.ToString(), debugMsg, ps, os);
|
||||
}*/
|
||||
data.RestoreState();
|
||||
}
|
||||
@@ -2427,7 +2453,7 @@ namespace lfg
|
||||
std::string ns = GetStateString(state);
|
||||
std::string ps = GetStateString(data.GetState());
|
||||
std::string os = GetStateString(data.GetOldState());
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetState: Group: [%s] newState: %s, previous: %s, oldState: %s", guid.ToString().c_str(), ns.c_str(), ps.c_str(), os.c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetState: Group: [{}] newState: {}, previous: {}, oldState: {}", guid.ToString(), ns, ps, os);
|
||||
data.SetState(state);
|
||||
}
|
||||
else
|
||||
@@ -2436,7 +2462,7 @@ namespace lfg
|
||||
std::string ns = GetStateString(state);
|
||||
std::string ps = GetStateString(data.GetState());
|
||||
std::string os = GetStateString(data.GetOldState());
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetState: Player: [%s] newState: %s, previous: %s, oldState: %s", guid.ToString().c_str(), ns.c_str(), ps.c_str(), os.c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetState: Player: [{}] newState: {}, previous: {}, oldState: {}", guid.ToString(), ns, ps, os);
|
||||
data.SetState(state);
|
||||
}
|
||||
}
|
||||
@@ -2448,19 +2474,19 @@ namespace lfg
|
||||
|
||||
void LFGMgr::SetDungeon(ObjectGuid guid, uint32 dungeon)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetDungeon: [%s] dungeon %u", guid.ToString().c_str(), dungeon);
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetDungeon: [{}] dungeon {}", guid.ToString(), dungeon);
|
||||
GroupsStore[guid].SetDungeon(dungeon);
|
||||
}
|
||||
|
||||
void LFGMgr::SetRoles(ObjectGuid guid, uint8 roles)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetRoles: [%s] roles: %u", guid.ToString().c_str(), roles);
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetRoles: [{}] roles: {}", guid.ToString(), roles);
|
||||
PlayersStore[guid].SetRoles(roles);
|
||||
}
|
||||
|
||||
void LFGMgr::SetComment(ObjectGuid guid, std::string const& comment)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetComment: [%s] comment: %s", guid.ToString().c_str(), comment.c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetComment: [{}] comment: {}", guid.ToString(), comment);
|
||||
PlayersStore[guid].SetComment(comment);
|
||||
}
|
||||
|
||||
@@ -2479,25 +2505,25 @@ namespace lfg
|
||||
|
||||
void LFGMgr::SetSelectedDungeons(ObjectGuid guid, LfgDungeonSet const& dungeons)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetLockedDungeons: [%s]", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetLockedDungeons: [{}]", guid.ToString());
|
||||
PlayersStore[guid].SetSelectedDungeons(dungeons);
|
||||
}
|
||||
|
||||
void LFGMgr::SetLockedDungeons(ObjectGuid guid, LfgLockMap const& lock)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetLockedDungeons: [%s]", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::SetLockedDungeons: [{}]", guid.ToString());
|
||||
PlayersStore[guid].SetLockedDungeons(lock);
|
||||
}
|
||||
|
||||
void LFGMgr::DecreaseKicksLeft(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::DecreaseKicksLeft: [%s]", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::DecreaseKicksLeft: [{}]", guid.ToString());
|
||||
GroupsStore[guid].DecreaseKicksLeft();
|
||||
}
|
||||
|
||||
void LFGMgr::RemoveGroupData(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveGroupData: [%s]", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGMgr::RemoveGroupData: [{}]", guid.ToString());
|
||||
LfgGroupDataContainer::iterator it = GroupsStore.find(guid);
|
||||
if (it == GroupsStore.end())
|
||||
return;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef _LFGMGR_H
|
||||
#define _LFGMGR_H
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "DBCStructure.h"
|
||||
#include "Field.h"
|
||||
#include "LFG.h"
|
||||
@@ -150,8 +152,8 @@ namespace lfg
|
||||
|
||||
struct RBEntryInfo
|
||||
{
|
||||
RBEntryInfo() {}
|
||||
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
|
||||
RBEntryInfo() = default;
|
||||
RBEntryInfo(uint8 _roles, std::string _comment) : roles(_roles), comment(std::move(_comment)) {}
|
||||
uint8 roles;
|
||||
std::string comment;
|
||||
};
|
||||
@@ -199,26 +201,26 @@ namespace lfg
|
||||
uint32 _hasteRating;
|
||||
uint32 _expertiseRating;
|
||||
|
||||
RBInternalInfo() {}
|
||||
RBInternalInfo(ObjectGuid guid, std::string const& comment, bool isGroupLeader, ObjectGuid groupGuid, uint8 roles, uint32 encounterMask, ObjectGuid instanceGuid,
|
||||
RBInternalInfo() = default;
|
||||
RBInternalInfo(ObjectGuid guid, std::string comment, bool isGroupLeader, ObjectGuid groupGuid, uint8 roles, uint32 encounterMask, ObjectGuid instanceGuid,
|
||||
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
|
||||
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
|
||||
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
|
||||
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
|
||||
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
|
||||
: guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
|
||||
: guid(guid), comment(std::move(comment)), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
|
||||
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
|
||||
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
|
||||
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
|
||||
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
|
||||
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
|
||||
{}
|
||||
bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
[[nodiscard]] bool PlayerSameAs(RBInternalInfo const& i) const
|
||||
{
|
||||
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel - i._avgItemLevel) < 0.01f
|
||||
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && std::fabs(_avgItemLevel - i._avgItemLevel) < 0.01f
|
||||
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5 - i._mp5) < 0.01f && fabs(_mp5combat - i._mp5combat) < 0.01f
|
||||
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && std::fabs(_mp5 - i._mp5) < 0.01f && std::fabs(_mp5combat - i._mp5combat) < 0.01f
|
||||
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
|
||||
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
|
||||
}
|
||||
@@ -285,14 +287,14 @@ namespace lfg
|
||||
// Data needed by SMSG_LFG_UPDATE_PARTY and SMSG_LFG_UPDATE_PLAYER
|
||||
struct LfgUpdateData
|
||||
{
|
||||
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), state(LFG_STATE_NONE), comment("") { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet const& _dungeons, std::string const& _comment):
|
||||
updateType(_type), state(LFG_STATE_NONE), dungeons(_dungeons), comment(_comment) { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet const& _dungeons, std::string const& _comment = ""):
|
||||
updateType(_type), state(_state), dungeons(_dungeons), comment(_comment) { }
|
||||
LfgUpdateData(LfgUpdateType _type = LFG_UPDATETYPE_DEFAULT): updateType(_type), comment("") { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgDungeonSet _dungeons, std::string _comment):
|
||||
updateType(_type), state(LFG_STATE_NONE), dungeons(std::move(_dungeons)), comment(std::move(_comment)) { }
|
||||
LfgUpdateData(LfgUpdateType _type, LfgState _state, LfgDungeonSet _dungeons, std::string _comment = ""):
|
||||
updateType(_type), state(_state), dungeons(std::move(_dungeons)), comment(std::move(_comment)) { }
|
||||
|
||||
LfgUpdateType updateType;
|
||||
LfgState state;
|
||||
LfgState state{LFG_STATE_NONE};
|
||||
LfgDungeonSet dungeons;
|
||||
std::string comment;
|
||||
};
|
||||
@@ -341,26 +343,26 @@ namespace lfg
|
||||
/// Stores player data related to proposal to join
|
||||
struct LfgProposalPlayer
|
||||
{
|
||||
LfgProposalPlayer(): role(0), accept(LFG_ANSWER_PENDING) { }
|
||||
uint8 role; ///< Proposed role
|
||||
LfgAnswer accept; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
LfgProposalPlayer() = default;
|
||||
uint8 role{0}; ///< Proposed role
|
||||
LfgAnswer accept{LFG_ANSWER_PENDING}; ///< Accept status (-1 not answer | 0 Not agree | 1 agree)
|
||||
ObjectGuid group; ///< Original group guid. 0 if no original group
|
||||
};
|
||||
|
||||
/// Stores group data related to proposal to join
|
||||
struct LfgProposal
|
||||
{
|
||||
LfgProposal(uint32 dungeon = 0): id(0), dungeonId(dungeon), state(LFG_PROPOSAL_INITIATING), cancelTime(0), encounters(0), isNew(true)
|
||||
LfgProposal(uint32 dungeon = 0): dungeonId(dungeon)
|
||||
{ }
|
||||
|
||||
uint32 id; ///< Proposal Id
|
||||
uint32 id{0}; ///< Proposal Id
|
||||
uint32 dungeonId; ///< Dungeon to join
|
||||
LfgProposalState state; ///< State of the proposal
|
||||
LfgProposalState state{LFG_PROPOSAL_INITIATING}; ///< State of the proposal
|
||||
ObjectGuid group; ///< Proposal group (0 if new)
|
||||
ObjectGuid leader; ///< Leader guid.
|
||||
time_t cancelTime; ///< Time when we will cancel this proposal
|
||||
uint32 encounters; ///< Dungeon Encounters
|
||||
bool isNew; ///< Determines if it's new group or not
|
||||
time_t cancelTime{0}; ///< Time when we will cancel this proposal
|
||||
uint32 encounters{0}; ///< Dungeon Encounters
|
||||
bool isNew{true}; ///< Determines if it's new group or not
|
||||
Lfg5Guids queues; ///< Queue Ids to remove/readd
|
||||
LfgGuidList showorder; ///< Show order in update window
|
||||
LfgProposalPlayerContainer players; ///< Players data
|
||||
@@ -389,8 +391,7 @@ namespace lfg
|
||||
|
||||
struct LFGDungeonData
|
||||
{
|
||||
LFGDungeonData(): id(0), name(""), map(0), type(0), expansion(0), group(0), minlevel(0),
|
||||
maxlevel(0), difficulty(REGULAR_DIFFICULTY), seasonal(false), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
LFGDungeonData(): name("")
|
||||
{ }
|
||||
LFGDungeonData(LFGDungeonEntry const* dbc): id(dbc->ID), name(dbc->name[0]), map(dbc->map),
|
||||
type(dbc->type), expansion(dbc->expansion), group(dbc->grouptype),
|
||||
@@ -398,20 +399,20 @@ namespace lfg
|
||||
seasonal(dbc->flags & LFG_FLAG_SEASONAL), x(0.0f), y(0.0f), z(0.0f), o(0.0f)
|
||||
{ }
|
||||
|
||||
uint32 id;
|
||||
uint32 id{0};
|
||||
std::string name;
|
||||
uint16 map;
|
||||
uint8 type;
|
||||
uint8 expansion;
|
||||
uint8 group;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
Difficulty difficulty;
|
||||
bool seasonal;
|
||||
float x, y, z, o;
|
||||
uint16 map{0};
|
||||
uint8 type{0};
|
||||
uint8 expansion{0};
|
||||
uint8 group{0};
|
||||
uint8 minlevel{0};
|
||||
uint8 maxlevel{0};
|
||||
Difficulty difficulty{REGULAR_DIFFICULTY};
|
||||
bool seasonal{false};
|
||||
float x{0.0f}, y{0.0f}, z{0.0f}, o{0.0f};
|
||||
|
||||
// Helpers
|
||||
uint32 Entry() const { return id + (type << 24); }
|
||||
[[nodiscard]] uint32 Entry() const { return id + (type << 24); }
|
||||
};
|
||||
|
||||
class LFGMgr
|
||||
@@ -577,6 +578,7 @@ namespace lfg
|
||||
[[nodiscard]] bool IsTesting() const { return m_Testing; }
|
||||
|
||||
void SetDungeon(ObjectGuid guid, uint32 dungeon);
|
||||
LFGDungeonData const* GetLFGDungeon(uint32 id);
|
||||
|
||||
private:
|
||||
TeamId GetTeam(ObjectGuid guid);
|
||||
@@ -589,7 +591,6 @@ namespace lfg
|
||||
void SetCanOverrideRBState(ObjectGuid guid, bool val);
|
||||
void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
|
||||
void _SaveToDB(ObjectGuid guid);
|
||||
LFGDungeonData const* GetLFGDungeon(uint32 id);
|
||||
|
||||
// Proposals
|
||||
void RemoveProposal(LfgProposalContainer::iterator itProposal, LfgUpdateType type);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include "LFGPlayerData.h"
|
||||
#include "LFGMgr.h"
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
|
||||
@@ -47,19 +47,19 @@ namespace lfg
|
||||
void SetSelectedDungeons(const LfgDungeonSet& dungeons);
|
||||
|
||||
// General
|
||||
LfgState GetState() const;
|
||||
LfgState GetOldState() const;
|
||||
LfgLockMap const& GetLockedDungeons() const;
|
||||
TeamId GetTeam() const;
|
||||
ObjectGuid GetGroup() const;
|
||||
uint8 GetRandomPlayersCount() const;
|
||||
[[nodiscard]] LfgState GetState() const;
|
||||
[[nodiscard]] LfgState GetOldState() const;
|
||||
[[nodiscard]] LfgLockMap const& GetLockedDungeons() const;
|
||||
[[nodiscard]] TeamId GetTeam() const;
|
||||
[[nodiscard]] ObjectGuid GetGroup() const;
|
||||
[[nodiscard]] uint8 GetRandomPlayersCount() const;
|
||||
void SetCanOverrideRBState(bool val) { m_canOverrideRBState = val; }
|
||||
bool CanOverrideRBState() const { return m_canOverrideRBState; }
|
||||
[[nodiscard]] bool CanOverrideRBState() const { return m_canOverrideRBState; }
|
||||
|
||||
// Queue
|
||||
uint8 GetRoles() const;
|
||||
std::string const& GetComment() const;
|
||||
LfgDungeonSet const& GetSelectedDungeons() const;
|
||||
[[nodiscard]] uint8 GetRoles() const;
|
||||
[[nodiscard]] std::string const& GetComment() const;
|
||||
[[nodiscard]] LfgDungeonSet const& GetSelectedDungeons() const;
|
||||
|
||||
private:
|
||||
// General
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "LFGQueue.h"
|
||||
#include "Containers.h"
|
||||
#include "DBCStores.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "LFGMgr.h"
|
||||
@@ -25,26 +26,31 @@
|
||||
#include "ObjectDefines.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "World.h"
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
LfgQueueData::LfgQueueData() :
|
||||
joinTime(time_t(GameTime::GetGameTime().count())), lastRefreshTime(joinTime), tanks(LFG_TANKS_NEEDED),
|
||||
healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED) { }
|
||||
|
||||
void LFGQueue::AddToQueue(ObjectGuid guid, bool failedProposal)
|
||||
{
|
||||
LOG_DEBUG("lfg", "ADD AddToQueue: %s, failed proposal: %u", guid.ToString().c_str(), failedProposal ? 1 : 0);
|
||||
LOG_DEBUG("lfg", "ADD AddToQueue: {}, failed proposal: {}", guid.ToString(), failedProposal ? 1 : 0);
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
|
||||
if (itQueue == QueueDataStore.end())
|
||||
{
|
||||
LOG_ERROR("lfg", "LFGQueue::AddToQueue: Queue data not found for [%s]", guid.ToString().c_str());
|
||||
LOG_ERROR("lfg", "LFGQueue::AddToQueue: Queue data not found for [{}]", guid.ToString());
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("lfg", "AddToQueue success: %s", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "AddToQueue success: {}", guid.ToString());
|
||||
AddToNewQueue(guid, failedProposal);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromQueue(ObjectGuid guid, bool partial)
|
||||
{
|
||||
LOG_DEBUG("lfg", "REMOVE RemoveFromQueue: %s, partial: %u", guid.ToString().c_str(), partial ? 1 : 0);
|
||||
LOG_DEBUG("lfg", "REMOVE RemoveFromQueue: {}, partial: {}", guid.ToString(), partial ? 1 : 0);
|
||||
RemoveFromNewQueue(guid);
|
||||
RemoveFromCompatibles(guid);
|
||||
|
||||
@@ -55,13 +61,13 @@ namespace lfg
|
||||
{
|
||||
if (itr->second.bestCompatible.hasGuid(guid))
|
||||
{
|
||||
LOG_DEBUG("lfg", "CLEAR bestCompatible: %s, because of: %s", itr->second.bestCompatible.toString().c_str(), guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "CLEAR bestCompatible: {}, because of: {}", itr->second.bestCompatible.toString(), guid.ToString());
|
||||
itr->second.bestCompatible.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("lfg", "CLEAR bestCompatible SELF: %s, because of: %s", itr->second.bestCompatible.toString().c_str(), guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "CLEAR bestCompatible SELF: {}, because of: {}", itr->second.bestCompatible.toString(), guid.ToString());
|
||||
//itr->second.bestCompatible.clear(); // don't clear here, because UpdateQueueTimers will try to find with every diff update
|
||||
itDelete = itr;
|
||||
}
|
||||
@@ -70,10 +76,10 @@ namespace lfg
|
||||
// xinef: partial
|
||||
if (!partial && itDelete != QueueDataStore.end())
|
||||
{
|
||||
LOG_DEBUG("lfg", "ERASE QueueDataStore for: %s", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "ERASE QueueDataStore for: %s, itDelete: %u,%u,%u", guid.ToString().c_str(), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
|
||||
LOG_DEBUG("lfg", "ERASE QueueDataStore for: {}", guid.ToString());
|
||||
LOG_DEBUG("lfg", "ERASE QueueDataStore for: {}, itDelete: {},{},{}", guid.ToString(), itDelete->second.dps, itDelete->second.healers, itDelete->second.tanks);
|
||||
QueueDataStore.erase(itDelete);
|
||||
LOG_DEBUG("lfg", "ERASE QueueDataStore for: %s SUCCESS", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "ERASE QueueDataStore for: {} SUCCESS", guid.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,34 +87,34 @@ namespace lfg
|
||||
{
|
||||
if (front)
|
||||
{
|
||||
LOG_DEBUG("lfg", "ADD AddToNewQueue at FRONT: %s", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "ADD AddToNewQueue at FRONT: {}", guid.ToString());
|
||||
restoredAfterProposal.push_back(guid);
|
||||
newToQueueStore.push_front(guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("lfg", "ADD AddToNewQueue at the END: %s", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "ADD AddToNewQueue at the END: {}", guid.ToString());
|
||||
newToQueueStore.push_back(guid);
|
||||
}
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveFromNewQueue(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "REMOVE RemoveFromNewQueue: %s", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "REMOVE RemoveFromNewQueue: {}", guid.ToString());
|
||||
newToQueueStore.remove(guid);
|
||||
restoredAfterProposal.remove(guid);
|
||||
}
|
||||
|
||||
void LFGQueue::AddQueueData(ObjectGuid guid, time_t joinTime, LfgDungeonSet const& dungeons, LfgRolesMap const& rolesMap)
|
||||
{
|
||||
LOG_DEBUG("lfg", "JOINED AddQueueData: %s", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "JOINED AddQueueData: {}", guid.ToString());
|
||||
QueueDataStore[guid] = LfgQueueData(joinTime, dungeons, rolesMap);
|
||||
AddToQueue(guid);
|
||||
}
|
||||
|
||||
void LFGQueue::RemoveQueueData(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LEFT RemoveQueueData: %s", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LEFT RemoveQueueData: {}", guid.ToString());
|
||||
LfgQueueDataContainer::iterator it = QueueDataStore.find(guid);
|
||||
if (it != QueueDataStore.end())
|
||||
QueueDataStore.erase(it);
|
||||
@@ -144,11 +150,11 @@ namespace lfg
|
||||
|
||||
void LFGQueue::RemoveFromCompatibles(ObjectGuid guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "COMPATIBLES REMOVE for: %s", guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "COMPATIBLES REMOVE for: {}", guid.ToString());
|
||||
for (LfgCompatibleContainer::iterator it = CompatibleList.begin(); it != CompatibleList.end(); ++it)
|
||||
if (it->hasGuid(guid))
|
||||
{
|
||||
LOG_DEBUG("lfg", "Removed Compatible: %s, because of: %s", it->toString().c_str(), guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "Removed Compatible: {}, because of: {}", it->toString(), guid.ToString());
|
||||
it->clear(); // set to 0, this will be removed while iterating in FindNewGroups
|
||||
}
|
||||
for (LfgCompatibleContainer::iterator itr = CompatibleTempList.begin(); itr != CompatibleTempList.end(); )
|
||||
@@ -156,7 +162,7 @@ namespace lfg
|
||||
LfgCompatibleContainer::iterator it = itr++;
|
||||
if (it->hasGuid(guid))
|
||||
{
|
||||
LOG_DEBUG("lfg", "Erased Temp Compatible: %s, because of: %s", it->toString().c_str(), guid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "Erased Temp Compatible: {}, because of: {}", it->toString(), guid.ToString());
|
||||
CompatibleTempList.erase(it);
|
||||
}
|
||||
}
|
||||
@@ -164,7 +170,7 @@ namespace lfg
|
||||
|
||||
void LFGQueue::AddToCompatibles(Lfg5Guids const& key)
|
||||
{
|
||||
LOG_DEBUG("lfg", "COMPATIBLES ADD: %s", key.toString().c_str());
|
||||
LOG_DEBUG("lfg", "COMPATIBLES ADD: {}", key.toString());
|
||||
CompatibleTempList.push_back(key);
|
||||
}
|
||||
|
||||
@@ -177,7 +183,7 @@ namespace lfg
|
||||
++newGroupsProcessed;
|
||||
ObjectGuid newGuid = newToQueueStore.front();
|
||||
bool pushCompatiblesToFront = (std::find(restoredAfterProposal.begin(), restoredAfterProposal.end(), newGuid) != restoredAfterProposal.end());
|
||||
LOG_DEBUG("lfg", "newToQueueStore: %s, front: %u", newGuid.ToString().c_str(), pushCompatiblesToFront ? 1 : 0);
|
||||
LOG_DEBUG("lfg", "newToQueueStore: {}, front: {}", newGuid.ToString(), pushCompatiblesToFront ? 1 : 0);
|
||||
RemoveFromNewQueue(newGuid);
|
||||
|
||||
FindNewGroups(newGuid);
|
||||
@@ -197,7 +203,7 @@ namespace lfg
|
||||
uint64 foundMask = 0;
|
||||
uint32 foundCount = 0;
|
||||
|
||||
LOG_DEBUG("lfg", "FIND NEW GROUPS for: %s", newGuid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "FIND NEW GROUPS for: {}", newGuid.ToString());
|
||||
|
||||
// we have to take into account that FindNewGroups is called every X minutes if number of compatibles is low!
|
||||
// build set of already present compatibles for this guid
|
||||
@@ -241,7 +247,7 @@ namespace lfg
|
||||
|
||||
LfgCompatibility LFGQueue::CheckCompatibility(Lfg5Guids const& checkWith, const ObjectGuid& newGuid, uint64& foundMask, uint32& foundCount, const std::set<Lfg5Guids>& currentCompatibles)
|
||||
{
|
||||
LOG_DEBUG("lfg", "CHECK CheckCompatibility: %s, new guid: %s", checkWith.toString().c_str(), newGuid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "CHECK CheckCompatibility: {}, new guid: {}", checkWith.toString(), newGuid.ToString());
|
||||
Lfg5Guids check(checkWith, false); // here newGuid is at front
|
||||
Lfg5Guids strGuids(checkWith, false); // here guids are sorted
|
||||
check.force_insert_front(newGuid);
|
||||
@@ -266,7 +272,7 @@ namespace lfg
|
||||
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(guid);
|
||||
if (itQueue == QueueDataStore.end())
|
||||
{
|
||||
LOG_ERROR("lfg", "LFGQueue::CheckCompatibility: [%s] is not queued but listed as queued!", guid.ToString().c_str());
|
||||
LOG_ERROR("lfg", "LFGQueue::CheckCompatibility: [{}] is not queued but listed as queued!", guid.ToString());
|
||||
RemoveFromQueue(guid);
|
||||
return LFG_COMPATIBILITY_PENDING;
|
||||
}
|
||||
@@ -320,7 +326,7 @@ namespace lfg
|
||||
if (itRoles->first == itPlayer->first)
|
||||
{
|
||||
// pussywizard: LFG this means that this player was in two different LfgQueueData (in QueueDataStore), and at least one of them is a group guid, because we do checks so there aren't 2 same guids in current CHECK
|
||||
//LOG_ERROR("lfg", "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [%s]", itRoles->first.ToString().c_str());
|
||||
//LOG_ERROR("lfg", "LFGQueue::CheckCompatibility: ERROR! Player multiple times in queue! [{}]", itRoles->first.ToString());
|
||||
break;
|
||||
}
|
||||
else if (sLFGMgr->HasIgnore(itRoles->first, itPlayer->first))
|
||||
@@ -401,30 +407,19 @@ namespace lfg
|
||||
return LFG_COMPATIBLES_WITH_LESS_PLAYERS;
|
||||
}
|
||||
|
||||
#ifdef PLAYERBOTS
|
||||
bool nonBotFound = false;
|
||||
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)
|
||||
{
|
||||
ObjectGuid guid = check.guids[i];
|
||||
Player* player = ObjectAccessor::FindPlayer(guid);
|
||||
if (guid.IsGroup() || (player && !player->GetPlayerbotAI()))
|
||||
{
|
||||
nonBotFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!nonBotFound)
|
||||
return LFG_INCOMPATIBLES_HAS_IGNORES;
|
||||
#endif
|
||||
|
||||
proposal.queues = strGuids;
|
||||
proposal.isNew = numLfgGroups != 1 || sLFGMgr->GetOldState(proposal.group) != LFG_STATE_DUNGEON;
|
||||
proposal.isNew = numLfgGroups != 1;
|
||||
|
||||
if (!sLFGMgr->AllQueued(check)) // can't create proposal
|
||||
return LFG_COMPATIBILITY_PENDING;
|
||||
|
||||
if (!sScriptMgr->OnPlayerbotCheckLFGQueue(proposal.queues))
|
||||
{
|
||||
return LFG_INCOMPATIBLES_HAS_IGNORES;
|
||||
}
|
||||
|
||||
// Create a new proposal
|
||||
proposal.cancelTime = time(nullptr) + LFG_TIME_PROPOSAL;
|
||||
proposal.cancelTime = GameTime::GetGameTime().count() + LFG_TIME_PROPOSAL;
|
||||
proposal.state = LFG_PROPOSAL_INITIATING;
|
||||
proposal.leader.Clear();
|
||||
proposal.dungeonId = Acore::Containers::SelectRandomContainerElement(proposalDungeons);
|
||||
@@ -480,7 +475,7 @@ namespace lfg
|
||||
|
||||
void LFGQueue::UpdateQueueTimers(uint32 diff)
|
||||
{
|
||||
time_t currTime = time(nullptr);
|
||||
time_t currTime = GameTime::GetGameTime().count();
|
||||
bool sendQueueStatus = false;
|
||||
|
||||
if (m_QueueStatusTimer > LFG_QUEUEUPDATE_INTERVAL)
|
||||
@@ -597,7 +592,7 @@ namespace lfg
|
||||
|
||||
void LFGQueue::UpdateBestCompatibleInQueue(LfgQueueDataContainer::iterator itrQueue, Lfg5Guids const& key)
|
||||
{
|
||||
LOG_DEBUG("lfg", "UpdateBestCompatibleInQueue: %s", key.toString().c_str());
|
||||
LOG_DEBUG("lfg", "UpdateBestCompatibleInQueue: {}", key.toString());
|
||||
LfgQueueData& queueData = itrQueue->second;
|
||||
|
||||
uint8 storedSize = queueData.bestCompatible.size();
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef _LFGQUEUE_H
|
||||
#define _LFGQUEUE_H
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "LFG.h"
|
||||
|
||||
namespace lfg
|
||||
@@ -39,20 +41,18 @@ namespace lfg
|
||||
/// Stores player or group queue info
|
||||
struct LfgQueueData
|
||||
{
|
||||
LfgQueueData(): joinTime(time_t(time(nullptr))), lastRefreshTime(joinTime), tanks(LFG_TANKS_NEEDED),
|
||||
healers(LFG_HEALERS_NEEDED), dps(LFG_DPS_NEEDED)
|
||||
{ }
|
||||
LfgQueueData();
|
||||
|
||||
LfgQueueData(time_t _joinTime, LfgDungeonSet const& _dungeons, LfgRolesMap const& _roles):
|
||||
LfgQueueData(time_t _joinTime, LfgDungeonSet _dungeons, LfgRolesMap _roles):
|
||||
joinTime(_joinTime), lastRefreshTime(_joinTime), tanks(LFG_TANKS_NEEDED), healers(LFG_HEALERS_NEEDED),
|
||||
dps(LFG_DPS_NEEDED), dungeons(_dungeons), roles(_roles)
|
||||
dps(LFG_DPS_NEEDED), dungeons(std::move(_dungeons)), roles(std::move(_roles))
|
||||
{ }
|
||||
|
||||
time_t joinTime; ///< Player queue join time (to calculate wait times)
|
||||
time_t lastRefreshTime; ///< pussywizard
|
||||
uint8 tanks; ///< Tanks needed
|
||||
uint8 healers; ///< Healers needed
|
||||
uint8 dps; ///< Dps needed
|
||||
uint8 tanks{LFG_TANKS_NEEDED}; ///< Tanks needed
|
||||
uint8 healers{LFG_HEALERS_NEEDED}; ///< Healers needed
|
||||
uint8 dps{LFG_DPS_NEEDED}; ///< Dps needed
|
||||
LfgDungeonSet dungeons; ///< Selected Player/Group Dungeon/s
|
||||
LfgRolesMap roles; ///< Selected Player Role/s
|
||||
Lfg5Guids bestCompatible; ///< Best compatible combination of people queued
|
||||
@@ -60,9 +60,9 @@ namespace lfg
|
||||
|
||||
struct LfgWaitTime
|
||||
{
|
||||
LfgWaitTime(): time(-1), number(0) {}
|
||||
int32 time; ///< Wait time
|
||||
uint32 number; ///< Number of people used to get that wait time
|
||||
LfgWaitTime() = default;
|
||||
int32 time{-1}; ///< Wait time
|
||||
uint32 number{0}; ///< Number of people used to get that wait time
|
||||
};
|
||||
|
||||
typedef std::map<uint32, LfgWaitTime> LfgWaitTimesContainer;
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
namespace lfg
|
||||
{
|
||||
@@ -107,8 +106,8 @@ namespace lfg
|
||||
sLFGMgr->LeaveAllLfgQueues(player->GetGUID(), true);
|
||||
player->RemoveAurasDueToSpell(LFG_SPELL_LUCK_OF_THE_DRAW);
|
||||
player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, 0.0f);
|
||||
LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player %s (%s) is in LFG dungeon map but does not have a valid group! Teleporting to homebind.",
|
||||
player->GetName().c_str(), player->GetGUID().ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGPlayerScript::OnMapChanged, Player {} ({}) is in LFG dungeon map but does not have a valid group! Teleporting to homebind.",
|
||||
player->GetName(), player->GetGUID().ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -144,15 +143,15 @@ namespace lfg
|
||||
|
||||
if (leader == guid)
|
||||
{
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [{}]: added [{}] leader [{}]", gguid.ToString(), guid.ToString(), leader.ToString());
|
||||
sLFGMgr->SetLeader(gguid, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
LfgState gstate = sLFGMgr->GetState(gguid);
|
||||
LfgState state = sLFGMgr->GetState(guid);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [%s]: added [%s] leader [%s] gstate: %u, state: %u",
|
||||
gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str(), gstate, state);
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnAddMember [{}]: added [{}] leader [{}] gstate: {}, state: {}",
|
||||
gguid.ToString(), guid.ToString(), leader.ToString(), gstate, state);
|
||||
|
||||
if (state == LFG_STATE_QUEUED)
|
||||
sLFGMgr->LeaveLfg(guid);
|
||||
@@ -185,8 +184,8 @@ namespace lfg
|
||||
return;
|
||||
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [%s]: remove [%s] Method: %d Kicker: [%s] Reason: %s",
|
||||
gguid.ToString().c_str(), guid.ToString().c_str(), method, kicker.ToString().c_str(), (reason ? reason : ""));
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnRemoveMember [{}]: remove [{}] Method: {} Kicker: [{}] Reason: {}",
|
||||
gguid.ToString(), guid.ToString(), method, kicker.ToString(), (reason ? reason : ""));
|
||||
|
||||
bool isLFG = group->isLFGGroup();
|
||||
LfgState state = sLFGMgr->GetState(gguid);
|
||||
@@ -251,7 +250,7 @@ namespace lfg
|
||||
return;
|
||||
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnDisband [%s]", gguid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnDisband [{}]", gguid.ToString());
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
if (sLFGMgr->GetState(group->GetLeaderGUID()) == LFG_STATE_RAIDBROWSER)
|
||||
@@ -267,8 +266,8 @@ namespace lfg
|
||||
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [%s]: old [%s] new [%s]",
|
||||
gguid.ToString().c_str(), newLeaderGuid.ToString().c_str(), oldLeaderGuid.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnChangeLeader [{}]: old [{}] new [{}]",
|
||||
gguid.ToString(), newLeaderGuid.ToString(), oldLeaderGuid.ToString());
|
||||
sLFGMgr->SetLeader(gguid, newLeaderGuid);
|
||||
|
||||
// pussywizard: after all necessary actions handle raid browser
|
||||
@@ -286,7 +285,7 @@ namespace lfg
|
||||
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
ObjectGuid leader = group->GetLeaderGUID();
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [%s]: invite [%s] leader [%s]", gguid.ToString().c_str(), guid.ToString().c_str(), leader.ToString().c_str());
|
||||
LOG_DEBUG("lfg", "LFGScripts::OnInviteMember [{}]: invite [{}] leader [{}]", gguid.ToString(), guid.ToString(), leader.ToString());
|
||||
// No gguid == new group being formed
|
||||
// No leader == after group creation first invite is new leader
|
||||
// leader and no gguid == first invite after leader is added to new group (this is the real invite)
|
||||
|
||||
Reference in New Issue
Block a user