Skip to content

Commit

Permalink
Solo LFG mode
Browse files Browse the repository at this point in the history
  • Loading branch information
KamiliaBlow committed Feb 14, 2025
1 parent 5ea4634 commit 9248e19
Show file tree
Hide file tree
Showing 5 changed files with 39 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(LFGDungeonsEntry const* dbc) : id(dbc->ID), name(
}

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 @@ -1081,7 +1082,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 @@ -2223,4 +2224,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 @@ -427,6 +427,11 @@ class TC_GAME_API LFGMgr
/// Gets unique join queue data
WorldPackets::LFG::RideTicket const* GetTicket(ObjectGuid guid) const;

/// 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 @@ -489,6 +494,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 @@ -416,7 +416,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 @@ -514,7 +514,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 @@ -50,6 +51,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
13 changes: 13 additions & 0 deletions src/server/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4514,5 +4514,18 @@ Eluna.RequireCPaths = ""
Roleplay.CustomNpc.OutfitIdStart = 200001
Roleplay.CustomNpc.CreatureTemplateIdStart = 400000

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

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

SoloLFG.Enable = 1

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

0 comments on commit 9248e19

Please sign in to comment.