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

Add new hook OnPlayerQueueRandomDungeon() and revert (now unnecessary) PR #8196

Merged
merged 5 commits into from
Oct 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion src/server/game/DungeonFinding/LFGMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ namespace lfg
DungeonProgressionRequirements const* ar = sObjectMgr->GetAccessRequirement(dungeon->map, Difficulty(dungeon->difficulty));

uint32 lockData = 0;
if (dungeon->expansion > expansion || dungeon->expansion > sWorld->getIntConfig(CONFIG_LFG_DUNGEON_FINDER_EXPANSION))
if (dungeon->expansion > expansion)
lockData = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION;
else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, player))
lockData = LFG_LOCKSTATUS_RAID_LOCKED;
Expand Down Expand Up @@ -572,6 +572,7 @@ namespace lfg
else
{
rDungeonId = (*dungeons.begin());
sScriptMgr->OnPlayerQueueRandomDungeon(player, rDungeonId);
}
// No break on purpose (Random can only be dungeon or heroic dungeon)
[[fallthrough]];
Expand Down
5 changes: 5 additions & 0 deletions src/server/game/Scripting/ScriptMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,11 @@ void ScriptMgr::OnPlayerAddToBattleground(Player* player, Battleground* bg)
FOREACH_SCRIPT(PlayerScript)->OnAddToBattleground(player, bg);
}

void ScriptMgr::OnPlayerQueueRandomDungeon(Player* player, uint32 & rDungeonId)
{
FOREACH_SCRIPT(PlayerScript)->OnQueueRandomDungeon(player, rDungeonId);
}

void ScriptMgr::OnPlayerRemoveFromBattleground(Player* player, Battleground* bg)
{
FOREACH_SCRIPT(PlayerScript)->OnRemoveFromBattleground(player, bg);
Expand Down
4 changes: 4 additions & 0 deletions src/server/game/Scripting/ScriptMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,9 @@ class PlayerScript : public ScriptObject
// Called when a player is added to battleground
virtual void OnAddToBattleground(Player* /*player*/, Battleground* /*bg*/) { }

// Called when a player queues a Random Dungeon using the RDF (Random Dungeon Finder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need new style info

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry I missed this, I'll address this in another PR

virtual void OnQueueRandomDungeon(Player* /*player*/, uint32 & /*rDungeonId*/) { }

// Called when a player is removed from battleground
virtual void OnRemoveFromBattleground(Player* /*player*/, Battleground* /*bg*/) { }

Expand Down Expand Up @@ -1646,6 +1649,7 @@ class ScriptMgr
bool OnBeforePlayerTeleport(Player* player, uint32 mapid, float x, float y, float z, float orientation, uint32 options, Unit* target);
void OnPlayerUpdateFaction(Player* player);
void OnPlayerAddToBattleground(Player* player, Battleground* bg);
void OnPlayerQueueRandomDungeon(Player* player, uint32 & rDungeonId);
void OnPlayerRemoveFromBattleground(Player* player, Battleground* bg);
void OnAchievementComplete(Player* player, AchievementEntry const* achievement);
bool OnBeforeAchievementComplete(Player* player, AchievementEntry const* achievement);
Expand Down
1 change: 0 additions & 1 deletion src/server/game/World/IWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ enum WorldIntConfigs
CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION,
CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS,
CONFIG_LFG_OPTIONSMASK,
CONFIG_LFG_DUNGEON_FINDER_EXPANSION,
CONFIG_MAX_INSTANCES_PER_HOUR,
CONFIG_WINTERGRASP_PLR_MAX,
CONFIG_WINTERGRASP_PLR_MIN,
Expand Down
1 change: 0 additions & 1 deletion src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,6 @@ void World::LoadConfigSettings(bool reload)

// Dungeon finder
m_int_configs[CONFIG_LFG_OPTIONSMASK] = sConfigMgr->GetOption<int32>("DungeonFinder.OptionsMask", 3);
m_int_configs[CONFIG_LFG_DUNGEON_FINDER_EXPANSION] = sConfigMgr->GetOption<int32>("DungeonFinder.Expansion", 2);

// Max instances per hour
m_int_configs[CONFIG_MAX_INSTANCES_PER_HOUR] = sConfigMgr->GetOption<int32>("AccountInstancesPerHour", 5);
Expand Down
10 changes: 0 additions & 10 deletions src/server/worldserver/worldserver.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -1252,16 +1252,6 @@ DeletedCharacterTicketTrace = 0

DungeonFinder.OptionsMask = 1

#
# DungeonFinder.Expansion
# Description: Allow setting which expansion can be used in LFG
# 2 - Wotlk (Default)
# 1 - TBC
# 0 - Classic
# Default: 2

DungeonFinder.Expansion = 2

#
# AccountInstancesPerHour
# Description: Controls the max amount of different instances player can enter within hour
Expand Down