Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Core/LFG): Add config to prevent LFG teleportation #20973

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
56e1b9a
Add config to prevent lfg teleportation
Exitare Dec 19, 2024
438f248
Add messages for the player(s) to know which dungeon was randomly sel…
Exitare Dec 19, 2024
34363f2
Remove trailing whitespace
Exitare Dec 19, 2024
94298c8
Adress code review
Exitare Dec 20, 2024
2a7c42f
Update worldserver.conf.dist
Exitare Dec 20, 2024
407009a
Core review
Exitare Dec 21, 2024
828df43
Merge branch 'master' into feature-lfg-teleport-disabled
Exitare Dec 21, 2024
fa4529a
Core review
Exitare Dec 21, 2024
2620693
Merge branch 'master' into feature-lfg-teleport-disabled
Exitare Dec 21, 2024
43770aa
Update data/sql/updates/pending_db_world/rev_1734657034946976800.sql
Kitzunu Dec 21, 2024
5d234e5
Address code review
Exitare Dec 21, 2024
8280aab
Merge branch 'feature-lfg-teleport-disabled' of https://github.com/Ex…
Exitare Dec 21, 2024
c7a89af
Remove c_str()
Exitare Dec 21, 2024
fdde414
Merge branch 'master' into feature-lfg-teleport-disabled
Exitare Dec 21, 2024
4787b3d
Merge branch 'master' into feature-lfg-teleport-disabled
Grimdhex Dec 25, 2024
57d29fc
Update rev_1734657034946976800.sql
Exitare Dec 26, 2024
219d6e8
Update lfg to take debug into account
Exitare Jan 5, 2025
e56596d
Merge branch 'master' into feature-lfg-teleport-disabled
Exitare Jan 5, 2025
da0791a
Remove empty line
Exitare Jan 5, 2025
5068412
Merge branch 'master' into feature-lfg-teleport-disabled
Exitare Jan 6, 2025
2059497
Merge branch 'master' into feature-lfg-teleport-disabled
Exitare Jan 7, 2025
fce499b
Merge branch 'feature-lfg-teleport-disabled' of https://github.com/Ex…
Exitare Jan 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/server/apps/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -3278,6 +3278,14 @@ LFG.MaxKickCount = 2

LFG.KickPreventionTimer = 900

#
# LFG.Teleport
# Description: Specify whether player are teleported to the dungeon after forming a group
# Default: 1 (default)
Exitare marked this conversation as resolved.
Show resolved Hide resolved
# 0 - Disabled (Players are not teleported but have to walk to dungeon)

LFG.Teleport = 1
Exitare marked this conversation as resolved.
Show resolved Hide resolved

#
# DungeonAccessRequirements.LFGLevelDBCOverride
#
Expand Down
51 changes: 51 additions & 0 deletions src/server/game/DungeonFinding/LFGMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,16 @@ namespace lfg

bool randomDungeon = false;
std::vector<Player*> playersTeleported;

Exitare marked this conversation as resolved.
Show resolved Hide resolved
// clear list of players to be teleported if config option is disabled
if (!sWorld->getBoolConfig(CONFIG_LFG_TELEPORT))
{
// Send message to all players in newly formed group
SendMessageToAllPlayers(playersToTeleport, proposal);
// clearn the player list
playersToTeleport.clear();
}

// Teleport Player
for (GuidUnorderedSet::const_iterator it = playersToTeleport.begin(); it != playersToTeleport.end(); ++it)
{
Expand Down Expand Up @@ -2150,13 +2160,31 @@ namespace lfg
}
else if (out && error == LFG_TELEPORTERROR_OK)
{
// No dungon teleport allowed
if (!sWorld->getBoolConfig(CONFIG_LFG_TELEPORT))
{
std::ostringstream ss;
ss << "Please move to the Dungeon: " << dungeon->name;
ChatHandler(player->GetSession()).PSendSysMessage(ss.str());
return;
Exitare marked this conversation as resolved.
Show resolved Hide resolved
}

if (player->GetMapId() == uint32(dungeon->map))
player->TeleportToEntryPoint();

return;
Exitare marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
// No dungon teleport allowed
if (!sWorld->getBoolConfig(CONFIG_LFG_TELEPORT))
{
std::ostringstream ss;
ss << "Please move to the Dungeon: " << dungeon->name;
ChatHandler(player->GetSession()).PSendSysMessage(ss.str());
return;
}

uint32 mapid = dungeon->map;
float x = dungeon->x;
float y = dungeon->y;
Expand Down Expand Up @@ -2491,6 +2519,29 @@ namespace lfg
GroupsStore[guid].SetDungeon(dungeon);
}

void LFGMgr::SendMessageToAllPlayers(GuidUnorderedSet players, LfgProposal const& proposal)
{
// Send a message to the players
for (GuidUnorderedSet::const_iterator it = players.begin(); it != players.end(); ++it)
{
if (Player* player = ObjectAccessor::FindPlayer(*it))
{
LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(proposal.dungeonId);
if (dungeon) {
Exitare marked this conversation as resolved.
Show resolved Hide resolved
Exitare marked this conversation as resolved.
Show resolved Hide resolved
std::ostringstream ss;
ss << "Please move to the Dungeon: " << dungeon->Name[0];
ChatHandler(player->GetSession()).PSendSysMessage(ss.str());

}
else {
Exitare marked this conversation as resolved.
Show resolved Hide resolved
Exitare marked this conversation as resolved.
Show resolved Hide resolved
std::ostringstream ss;
ss << "No Dungeon name found. You are on your own.";
Exitare marked this conversation as resolved.
Show resolved Hide resolved
ChatHandler(player->GetSession()).PSendSysMessage(ss.str());
}
}
}
}

void LFGMgr::SetRoles(ObjectGuid guid, uint8 roles)
{
LOG_DEBUG("lfg", "LFGMgr::SetRoles: [{}] roles: {}", guid.ToString(), roles);
Expand Down
2 changes: 2 additions & 0 deletions src/server/game/DungeonFinding/LFGMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ namespace lfg
[[nodiscard]] bool IsTesting() const { return m_Testing; }

void SetDungeon(ObjectGuid guid, uint32 dungeon);
// Sends a message to all players in a set
void SendMessageToAllPlayers(GuidUnorderedSet players, LfgProposal const& proposal);

private:
TeamId GetTeam(ObjectGuid guid);
Expand Down
1 change: 1 addition & 0 deletions src/server/game/World/IWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ enum WorldBoolConfigs
CONFIG_MUNCHING_BLIZZLIKE,
CONFIG_ENABLE_DAZE,
CONFIG_SPELL_QUEUE_ENABLED,
CONFIG_LFG_TELEPORT,
BOOL_CONFIG_VALUE_COUNT
};

Expand Down
Loading