Skip to content

Commit d281473

Browse files
authored
[Feat] Wire LFGMgr into the world (#327)
Drive LFGMgr::Update() from World::Update every 30s via the existing WUPDATE_LFGMGR timer, and call sLFGMgr.ResetDailyRecords() from the daily quest reset path. Both gated behind a new LFG.Enable config option (World.h enum, WorldConfig.cpp setter, mangosd.conf.dist.in block), defaulting off. The timer had been dead since it was added: the interval was set but nothing ever read it. When LFG is off, send SMSG_LFG_DISABLED on login via the Phase 3a LFGPackets::BuildDisabled builder. Verified in-game: the client clears its LFG state and raises ERR_SYSTEM_DISABLED ("This system is currently disabled."). Note it does NOT change the Dungeon Finder panel itself -- the opcode's handler fires the LFG_UPDATE Lua event, and LFDFrame.lua:30 has that registration commented out by Blizzard, so the panel keeps its normal empty appearance. Populating it needs the lock/dungeon lists, which is a later phase. Fixes SMSG_LFG_DISABLED being unsendable: it was registered STATUS_UNHANDLED, and WorldSession::SendPacket drops any such packet with "tried to send an unhandled opcode 0x0815" before it reaches the wire. Every other server-to-client opcode that is actually sent uses STATUS_NEVER -- 483 of them against 13 stragglers. Nothing had ever tried to send this one, so the mis-registration was invisible. Adds LOG_FILTER_LFG rather than borrowing an unrelated filter bit, so the tick trace can be enabled without turning on something else. Also fixes iterator invalidation in RemoveOldRoleChecks: it erased from m_roleCheckMap by key while iterating with the loop's ++roleItr, invalidating the iterator before the increment. Switched to the erase-returns-next-iterator idiom. This was dead code until now; the tick would have hit it on the first expired role check.
1 parent 6918569 commit d281473

9 files changed

Lines changed: 57 additions & 6 deletions

File tree

src/game/Server/OpcodeTable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ void InitializeOpcodes()
10541054
//OPCODE(CMSG_MAELSTROM_GM_SENT_MAIL, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
10551055
OPCODE(SMSG_RESET_FAILED_NOTIFY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
10561056
OPCODE(SMSG_REAL_GROUP_UPDATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
1057-
OPCODE(SMSG_LFG_DISABLED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
1057+
OPCODE(SMSG_LFG_DISABLED, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
10581058
//OPCODE(CMSG_ACTIVE_PVP_CHEAT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
10591059
//OPCODE(CMSG_CHEAT_DUMP_ITEMS_DEBUG_ONLY, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL );
10601060
//OPCODE(SMSG_CHEAT_DUMP_ITEMS_DEBUG_ONLY_RESPONSE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );

src/game/WorldHandlers/CharacterHandler.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#include "Language.h"
7272
#include "SpellMgr.h"
7373
#include "Calendar.h"
74+
#include "LFGPackets.h"
7475
#include "GameTime.h"
7576
#include "Timer.h"
7677
#ifdef ENABLE_ELUNA
@@ -941,6 +942,16 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
941942
data << uint32(60);
942943
SendPacket(&data);
943944

945+
// Dungeon Finder: tell the client up front when the feature is off, so
946+
// the Dungeon Finder panel shows the disabled state instead of an empty
947+
// list
948+
if (!sWorld.getConfig(CONFIG_BOOL_LFG_ENABLE))
949+
{
950+
data.Initialize(SMSG_LFG_DISABLED, 0);
951+
LFGPackets::BuildDisabled(data);
952+
SendPacket(&data);
953+
}
954+
944955
// Send MOTD
945956
{
946957
data.Initialize(SMSG_MOTD, 50); // new in 2.0.1

src/game/WorldHandlers/LFGMgrProposal.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,8 @@ void LFGMgr::SendLfgJoinResult(ObjectGuid plrGuid, LfgJoinResult result, LFGStat
11081108

11091109
void LFGMgr::RemoveOldRoleChecks()
11101110
{
1111-
for (roleCheckMap::iterator roleItr = m_roleCheckMap.begin(); roleItr != m_roleCheckMap.end(); ++roleItr)
1111+
for (roleCheckMap::iterator roleItr = m_roleCheckMap.begin(); roleItr != m_roleCheckMap.end();)
11121112
{
1113-
ObjectGuid groupGuid = roleItr->first;
1114-
11151113
LFGRoleCheck roleCheck = roleItr->second;
11161114
if ((roleCheck.waitForRoleTime - time(NULL)) <= 0) // no time left
11171115
{
@@ -1127,7 +1125,11 @@ void LFGMgr::RemoveOldRoleChecks()
11271125
SendLfgUpdate(plrGuid, GetPlayerStatus(plrGuid), true); // not in lfg system anymore
11281126
}
11291127

1130-
m_roleCheckMap.erase(groupGuid);
1128+
roleItr = m_roleCheckMap.erase(roleItr);
1129+
}
1130+
else
1131+
{
1132+
++roleItr;
11311133
}
11321134
}
11331135
}

src/game/WorldHandlers/World.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,15 @@ void World::Update(uint32 diff)
11461146
m_timers[WUPDATE_AHBOT].Reset();
11471147
}
11481148

1149+
/// <li> Handle LFG (Dungeon Finder) queue and role-check processing
1150+
if (getConfig(CONFIG_BOOL_LFG_ENABLE) && m_timers[WUPDATE_LFGMGR].Passed())
1151+
{
1152+
sLFGMgr.Update();
1153+
m_timers[WUPDATE_LFGMGR].Reset();
1154+
1155+
DEBUG_FILTER_LOG(LOG_FILTER_LFG, "WORLD: LFGMgr::Update tick");
1156+
}
1157+
11491158
#ifdef ENABLE_PLAYERBOTS
11501159
sRandomPlayerbotMgr.UpdateAI(diff);
11511160
sRandomPlayerbotMgr.UpdateSessions(diff);
@@ -1976,6 +1985,11 @@ void World::ResetDailyQuests()
19761985

19771986
m_NextDailyQuestReset = time_t(m_NextDailyQuestReset + DAY);
19781987
CharacterDatabase.PExecute("UPDATE `saved_variables` SET `NextDailyQuestResetTime` = '" UI64FMTD "'", uint64(m_NextDailyQuestReset));
1988+
1989+
if (getConfig(CONFIG_BOOL_LFG_ENABLE))
1990+
{
1991+
sLFGMgr.ResetDailyRecords();
1992+
}
19791993
}
19801994

19811995
void World::ResetWeeklyQuests()

src/game/WorldHandlers/World.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ enum eConfigBoolValues
432432
// Cinematic flyover
433433
CONFIG_BOOL_CINEMATIC_FLYOVER_ENABLE,
434434
CONFIG_BOOL_CINEMATIC_FLYOVER_DEBUG,
435+
436+
// LFG (Dungeon Finder)
437+
CONFIG_BOOL_LFG_ENABLE,
435438
CONFIG_BOOL_VALUE_COUNT
436439
};
437440

src/game/WorldHandlers/WorldConfig.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,9 @@ void World::LoadConfigSettings(bool reload)
444444
setConfig(CONFIG_BOOL_RESTRICTED_LFG_CHANNEL, "Channel.RestrictedLfg", true);
445445
setConfig(CONFIG_BOOL_SILENTLY_GM_JOIN_TO_CHANNEL, "Channel.SilentlyGMJoin", false);
446446

447+
///- Load the LFG (Dungeon Finder) related config options
448+
setConfig(CONFIG_BOOL_LFG_ENABLE, "LFG.Enable", false);
449+
447450
setConfig(CONFIG_BOOL_TALENTS_INSPECTING, "TalentsInspecting", true);
448451
setConfig(CONFIG_BOOL_CHAT_FAKE_MESSAGE_PREVENTING, "ChatFakeMessagePreventing", false);
449452

src/mangosd/mangosd.conf.dist.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ MaxWhoListReturns = 49
294294
# LogFilter_Calendar
295295
# LogFilter_CellEnvelope
296296
# LogFilter_DeckMinions
297+
# LogFilter_Lfg
297298
# Log filters (active by default - meaning: the filter is active, hence the log is not displayed)
298299
# Default: 1 - not include with any log level
299300
# 0 - include in log if log level permit
@@ -417,6 +418,7 @@ LogFilter_Damage = 1
417418
LogFilter_Combat = 1
418419
LogFilter_SpellCast = 1
419420
LogFilter_Calendar = 1
421+
LogFilter_Lfg = 1
420422
LogWhispers = 1
421423
WorldLogFile = "world-packets.log"
422424
PacketLoggingEnabled = 0
@@ -1396,6 +1398,20 @@ CinematicFlyover.Debug = 0
13961398
CinematicFlyover.BodyEntry = 12999
13971399
CinematicFlyover.VisibilityDistance = 250
13981400

1401+
################################################################################
1402+
# LFG (DUNGEON FINDER)
1403+
#
1404+
# LFG.Enable
1405+
# Enable the Dungeon Finder (Looking For Group) system.
1406+
# While disabled, clients are sent SMSG_LFG_DISABLED on login and the
1407+
# Dungeon Finder panel shows the feature-disabled state.
1408+
# Default: 0 (disabled)
1409+
# 1 (enabled)
1410+
#
1411+
################################################################################
1412+
1413+
LFG.Enable = 0
1414+
13991415
################################################################################
14001416
# SERVER RATES
14011417
#

src/shared/Log/Log.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ LogFilterData logFilterData[LOG_FILTER_COUNT] =
9999
{ "grid_add", "LogFilter_GridAdd", true },
100100
{ "db_scripts", "LogFilter_DbScripts", true },
101101
{ "deck_minions", "LogFilter_DeckMinions", true },
102+
{ "lfg", "LogFilter_Lfg", true },
102103
};
103104

104105
/**

src/shared/Log/Log.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ enum LogFilters
8787
LOG_FILTER_GRID_ADD = 0x200000, // 21 object added to a grid cell ("X enters grid[x,y]") - high-volume, mostly creatures
8888
LOG_FILTER_DB_SCRIPTS = 0x400000, // 22 db_scripts command processing trace (execution, not errors)
8989
LOG_FILTER_DECK_MINIONS = 0x800000, // 23 minions drawn across a deck boundary: board, step ashore, reconcile
90+
LOG_FILTER_LFG = 0x1000000, // 24 Dungeon Finder / Raid Finder queue and proposal trace
9091
};
9192

92-
#define LOG_FILTER_COUNT 24
93+
#define LOG_FILTER_COUNT 25
9394

9495
/**
9596
* @brief Configuration data for individual log filters

0 commit comments

Comments
 (0)