Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/andrew/3.3.5-lfgsolo' into 3.3.…
Browse files Browse the repository at this point in the history
…5-andrew_world
  • Loading branch information
andrew-wroe committed Sep 8, 2024
2 parents 866e9d2 + dcf00c3 commit 65f808b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/server/game/DungeonFinding/LFGMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ LFGDungeonData::LFGDungeonData(LFGDungeonEntry const* dbc) : id(dbc->ID), name(d
}

LFGMgr::LFGMgr(): m_QueueTimer(0), m_lfgProposalId(1),
m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK))
m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK)),
m_isSoloLFG(false)
{
}

Expand Down Expand Up @@ -1060,7 +1061,7 @@ void LFGMgr::UpdateProposal(uint32 proposalId, ObjectGuid guid, bool accept)
if (itPlayers->second.accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
allAnswered = false;

if (!allAnswered)
if (!sLFGMgr->IsSoloLFG() && !allAnswered)
{
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
SendLfgUpdateProposal(it->first, proposal);
Expand Down Expand Up @@ -2143,4 +2144,9 @@ LfgDungeonSet LFGMgr::GetRandomAndSeasonalDungeons(uint8 level, uint8 expansion)
return randomDungeons;
}

void LFGMgr::ToggleSoloLFG()
{
m_isSoloLFG = !m_isSoloLFG;
}

} // namespace lfg
7 changes: 7 additions & 0 deletions src/server/game/DungeonFinding/LFGMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,11 @@ class TC_GAME_API LFGMgr
/// Leaves lfg
void LeaveLfg(ObjectGuid guid, bool disconnected = false);

/// Toggle LFG in debug mode
void ToggleSoloLFG();
/// Check if debug mode
bool IsSoloLFG() const { return m_isSoloLFG; }

// LfgQueue
/// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
LfgState GetOldState(ObjectGuid guid);
Expand Down Expand Up @@ -465,6 +470,8 @@ class TC_GAME_API LFGMgr
uint32 m_lfgProposalId; /// used as internal counter for proposals
uint32 m_options; /// Stores config options

bool m_isSoloLFG; /// solo lfg

LfgQueueContainer QueuesStore; /// Queues
LfgCachedDungeonContainer CachedDungeonMapStore; /// Stores all dungeons by groupType
// Reward System
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/DungeonFinding/LFGQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
}

// Group with less that MAX_GROUP_SIZE members always compatible
if (check.size() == 1 && numPlayers != MAX_GROUP_SIZE)
if (!sLFGMgr->IsSoloLFG() && numPlayers != MAX_GROUP_SIZE) //solo lfg
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) single group. Compatibles", GetDetailedMatchRoles(check));
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
Expand Down Expand Up @@ -520,7 +520,7 @@ LfgCompatibility LFGQueue::CheckCompatibility(GuidList check)
}

// Enough players?
if (numPlayers != MAX_GROUP_SIZE)
if (!sLFGMgr->IsSoloLFG() && numPlayers != MAX_GROUP_SIZE) //solo lfg
{
TC_LOG_DEBUG("lfg.queue.match.compatibility.check", "Guids: ({}) Compatibles but not enough players({})", GetDetailedMatchRoles(check), numPlayers);
LfgCompatibilityData data(LFG_COMPATIBLES_WITH_LESS_PLAYERS);
Expand Down
9 changes: 9 additions & 0 deletions src/server/game/DungeonFinding/LFGScripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

#include "LFGScripts.h"
#include "Common.h"
#include "Config.h"
#include "Group.h"
#include "LFGMgr.h"
#include "Log.h"
Expand Down Expand Up @@ -52,6 +53,14 @@ void LFGPlayerScript::OnLogout(Player* player)

void LFGPlayerScript::OnLogin(Player* player, bool /*loginFirst*/)
{
if (sConfigMgr->GetIntDefault("SoloLFG.Enable", true))
{
if (!sLFGMgr->IsSoloLFG())
{
sLFGMgr->ToggleSoloLFG();
}
}

if (!sLFGMgr->isOptionEnabled(LFG_OPTION_ENABLE_DUNGEON_FINDER | LFG_OPTION_ENABLE_RAID_BROWSER))
return;

Expand Down
14 changes: 14 additions & 0 deletions src/server/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
# PACKET SPOOF PROTECTION SETTINGS
# MISC ANTI-CHEAT SETTINGS
# METRIC SETTINGS
# SOLO LFG
#
###################################################################################################

Expand Down Expand Up @@ -4147,3 +4148,16 @@ Metric.OverallStatusInterval = 1

#
###################################################################################################

###################################################################################################
# SOLO LFG
#
# SoloLFG.Enable
# Description: Enable the module.
# Default: 1 - (Enabled)
# 0 - (Disabled)

SoloLFG.Enable = 1

#
###################################################################################################

0 comments on commit 65f808b

Please sign in to comment.