From 563c3d0511ee2b3f096589ed72f83c55e8add642 Mon Sep 17 00:00:00 2001 From: FrancescoBorzi Date: Fri, 1 Oct 2021 15:45:28 +0200 Subject: [PATCH 1/5] fix: expansion --- src/server/game/DungeonFinding/LFGMgr.cpp | 35 ++++++++++++++++++++++- src/server/game/DungeonFinding/LFGMgr.h | 2 ++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 474050f109db0c..d62d205c34796f 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -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; @@ -572,6 +572,7 @@ namespace lfg else { rDungeonId = (*dungeons.begin()); + setRandomDungeonId(rDungeonId); } // No break on purpose (Random can only be dungeon or heroic dungeon) [[fallthrough]]; @@ -779,6 +780,38 @@ namespace lfg }*/ } + void LFGMgr::setRandomDungeonId(uint32 & rDungeonId) const + { + // values from LFGDungeons.dbc + constexpr const uint32 RDF_CLASSIC = 258; + constexpr const uint32 RDF_THE_BURNING_CRUSADE = 259; + constexpr const uint32 RDF_THE_BURNING_CRUSADE_HEROIC = 260; + constexpr const uint32 RDF_WRATH_OF_THE_LICH_KING = 261; + constexpr const uint32 RDF_WRATH_OF_THE_LICH_KING_HEROIC = 262; + + switch (sWorld->getIntConfig(CONFIG_LFG_DUNGEON_FINDER_EXPANSION)) + { + case EXPANSION_CLASSIC: + // always force classic RDF + rDungeonId = RDF_CLASSIC; + break; + case EXPANSION_THE_BURNING_CRUSADE: + // select at most RDF_THE_BURNING_CRUSADE_* + if (rDungeonId == RDF_WRATH_OF_THE_LICH_KING) + { + rDungeonId = RDF_THE_BURNING_CRUSADE; + } + else if (rDungeonId == RDF_WRATH_OF_THE_LICH_KING_HEROIC) + { + rDungeonId = RDF_THE_BURNING_CRUSADE_HEROIC; + } + case EXPANSION_WRATH_OF_THE_LICH_KING: + default: + // keep the original value + break; + } + } + void LFGMgr::ToggleTesting() { m_Testing = !m_Testing; diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index 82981c746de8f2..f13cfdae27696a 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -620,6 +620,8 @@ namespace lfg LfgPlayerDataContainer PlayersStore; ///< Player data LfgGroupDataContainer GroupsStore; ///< Group data bool m_Testing; + + void setRandomDungeonId(uint32 & rDungeonId) const; }; } // namespace lfg From 9cc2ede1a3ac2168981e8ceaae03eca95964c94d Mon Sep 17 00:00:00 2001 From: FrancescoBorzi Date: Fri, 1 Oct 2021 17:50:50 +0200 Subject: [PATCH 2/5] feat: new hook --- modules/create_module.sh | 105 ---------------------- modules/how_to_make_a_module.md | 20 ----- src/server/game/DungeonFinding/LFGMgr.cpp | 3 +- src/server/game/Scripting/ScriptMgr.cpp | 5 ++ src/server/game/Scripting/ScriptMgr.h | 4 + 5 files changed, 11 insertions(+), 126 deletions(-) delete mode 100644 modules/create_module.sh delete mode 100644 modules/how_to_make_a_module.md diff --git a/modules/create_module.sh b/modules/create_module.sh deleted file mode 100644 index 51e9de479a3f26..00000000000000 --- a/modules/create_module.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -## Just run it with bash or `git bash` on windows, and it will ask for the module's name and tada! -## By Barbz - -##------------------------------- VARIABLES ---------------------------------## - -MODULE_TEMPLATE_URL="https://github.com/azerothcore/skeleton-module/" -GIT_COMMIT_MSG_SETUP="setup_git_commit_template.sh" - -##------------------------------- CODE ---------------------------------## - -read -p "Enter the name of your future module: " "MODULE_NAME" -echo $MODULE_NAME | fgrep -q ' ' - -while [ $? -eq 0 ] -do - echo 'Blanks are not allowed!' - read -p "Enter the name of your future module: " MODULE_NAME - echo $MODULE_NAME | fgrep -q ' ' -done - -if test -n "$MODULE_NAME" -then - echo "--- Cloning 'skeleton-module' as $MODULE_NAME/" - git clone --depth 1 -b master $MODULE_TEMPLATE_URL $MODULE_NAME - - echo "--- Removing 'skeleton-module/.git/' history" - cd $MODULE_NAME && rm -rf .git/ - - echo "--- Init new git repository" - git init && git add -A && git commit -m "Initial commit - $MODULE_NAME" - - echo "--- Configure git for nice commit messages" - source "$GIT_COMMIT_MSG_SETUP" || bash "$GIT_COMMIT_MSG_SETUP" - - echo "--- Ready to code" -fi - - -# ## TODO Set the remote origin with username, repo url etc - - # $USER_NAME/$MODULE_NAME.git - - # echo "Do you want to set your git remote?" - # select yn in "Yes" "No"; do - # case $yn in - # Yes ) - # CONFIGURE_GIT=1; break;; - # No ) - # CONFIGURE_GIT=0; - # exit;; - # esac - # done - - - # if test "$CONFIGURE_GIT" == "1" - # then - # PS3='Where do you want to push your module?' - # options=("github.com" "gitlab.com" "bitbucket.org" "Quit") - # select opt in "${options[@]}" - # do - # case $opt in - # "github.com") - # echo "you chose choice 1" - # break - # ;; - # "gitlab.com") - # echo "you chose choice 2" - # break - # ;; - # "bitbucket.org") - # echo "you chose choice $REPLY which is $opt" - # break - # ;; - # "Quit") - # break - # ;; - # *) echo "invalid option $REPLY";; - # esac - # done - - # REMOTE_HOST="$opt" - - # PS3='HTTPS or SSH?' - # options=("HTTPS (default)" "SSH" "Quit") - # select opt in "${options[@]}" - # do - # case $opt in - # "HTTPS") - # echo "you chose choice 1" - # break - # ;; - # "SSH") - # echo "you chose choice $REPLY which is $opt" - # break - # ;; - # "Quit") - # break - # ;; - # *) echo "invalid option $REPLY";; - # esac - # done - - # REMOTE_PROTOCOL="$opt" - # fi diff --git a/modules/how_to_make_a_module.md b/modules/how_to_make_a_module.md deleted file mode 100644 index 8a803c456a5059..00000000000000 --- a/modules/how_to_make_a_module.md +++ /dev/null @@ -1,20 +0,0 @@ -# CREATE A NEW AZEROTHCORE MODULE - -1) Read this page first: - -http://www.azerothcore.org/wiki/Create-a-Module - - -2) Run the script `create_module.sh`: -- If you're on windows, execute it with Git Bash (right click on it and choose Git bash) if you have installed Git extensions -- If you're on linux, just run it with bash or with ./create_module.sh - -This script will create the base of your module, with a clean history and add a git configuration option to this repository only (local config). - - -NOTE: You can also clone our skeleton-module manually, clean the history, and configure but you should use the script instead https://github.com/azerothcore/skeleton-module/ - - -3) Share it with the community! - -Join us on our discord, share it there, then we might fork it officially and it will appear in the module catalogue. diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index d62d205c34796f..07fd5f3a41f320 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -572,7 +572,8 @@ namespace lfg else { rDungeonId = (*dungeons.begin()); - setRandomDungeonId(rDungeonId); +// setRandomDungeonId(rDungeonId); + sScriptMgr->OnPlayerQueueRandomDungeon(player, rDungeonId); } // No break on purpose (Random can only be dungeon or heroic dungeon) [[fallthrough]]; diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 8cece2e618c1fd..f42f18bf56cf74 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -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); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 8bcba63ae2a473..2e77c7a928dd82 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -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) + virtual void OnQueueRandomDungeon(Player* /*player*/, uint32 & /*rDungeonId*/) { } + // Called when a player is removed from battleground virtual void OnRemoveFromBattleground(Player* /*player*/, Battleground* /*bg*/) { } @@ -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); From e5536bff2613df2a35eef73ce54b813881d4eee7 Mon Sep 17 00:00:00 2001 From: FrancescoBorzi Date: Fri, 1 Oct 2021 17:50:54 +0200 Subject: [PATCH 3/5] Revert "feat(Core/Config): add option for LFG expansion (#7256)" This reverts commit 1c43e6ac6e1a5c72c4559bd8bc9a382275d35b14. --- src/server/game/World/IWorld.h | 1 - src/server/game/World/World.cpp | 1 - src/server/worldserver/worldserver.conf.dist | 10 ---------- 3 files changed, 12 deletions(-) diff --git a/src/server/game/World/IWorld.h b/src/server/game/World/IWorld.h index bb66d422e3b61a..97c820e7bfa9ff 100644 --- a/src/server/game/World/IWorld.h +++ b/src/server/game/World/IWorld.h @@ -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, diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 6de3a1323a2ebc..001ccf346ab3a0 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1321,7 +1321,6 @@ void World::LoadConfigSettings(bool reload) // Dungeon finder m_int_configs[CONFIG_LFG_OPTIONSMASK] = sConfigMgr->GetOption("DungeonFinder.OptionsMask", 3); - m_int_configs[CONFIG_LFG_DUNGEON_FINDER_EXPANSION] = sConfigMgr->GetOption("DungeonFinder.Expansion", 2); // Max instances per hour m_int_configs[CONFIG_MAX_INSTANCES_PER_HOUR] = sConfigMgr->GetOption("AccountInstancesPerHour", 5); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index c1e2f9852d7296..1458d239c48ee6 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -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 From 0b1aedd3ed4fdce7b350c22c7cb043ab7b9f3d4f Mon Sep 17 00:00:00 2001 From: FrancescoBorzi Date: Fri, 1 Oct 2021 17:53:34 +0200 Subject: [PATCH 4/5] chore(wip): wip --- src/server/game/DungeonFinding/LFGMgr.cpp | 33 ----------------------- src/server/game/DungeonFinding/LFGMgr.h | 2 -- 2 files changed, 35 deletions(-) diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index 07fd5f3a41f320..48f45f6b81f481 100644 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -572,7 +572,6 @@ namespace lfg else { rDungeonId = (*dungeons.begin()); -// setRandomDungeonId(rDungeonId); sScriptMgr->OnPlayerQueueRandomDungeon(player, rDungeonId); } // No break on purpose (Random can only be dungeon or heroic dungeon) @@ -781,38 +780,6 @@ namespace lfg }*/ } - void LFGMgr::setRandomDungeonId(uint32 & rDungeonId) const - { - // values from LFGDungeons.dbc - constexpr const uint32 RDF_CLASSIC = 258; - constexpr const uint32 RDF_THE_BURNING_CRUSADE = 259; - constexpr const uint32 RDF_THE_BURNING_CRUSADE_HEROIC = 260; - constexpr const uint32 RDF_WRATH_OF_THE_LICH_KING = 261; - constexpr const uint32 RDF_WRATH_OF_THE_LICH_KING_HEROIC = 262; - - switch (sWorld->getIntConfig(CONFIG_LFG_DUNGEON_FINDER_EXPANSION)) - { - case EXPANSION_CLASSIC: - // always force classic RDF - rDungeonId = RDF_CLASSIC; - break; - case EXPANSION_THE_BURNING_CRUSADE: - // select at most RDF_THE_BURNING_CRUSADE_* - if (rDungeonId == RDF_WRATH_OF_THE_LICH_KING) - { - rDungeonId = RDF_THE_BURNING_CRUSADE; - } - else if (rDungeonId == RDF_WRATH_OF_THE_LICH_KING_HEROIC) - { - rDungeonId = RDF_THE_BURNING_CRUSADE_HEROIC; - } - case EXPANSION_WRATH_OF_THE_LICH_KING: - default: - // keep the original value - break; - } - } - void LFGMgr::ToggleTesting() { m_Testing = !m_Testing; diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h index f13cfdae27696a..82981c746de8f2 100644 --- a/src/server/game/DungeonFinding/LFGMgr.h +++ b/src/server/game/DungeonFinding/LFGMgr.h @@ -620,8 +620,6 @@ namespace lfg LfgPlayerDataContainer PlayersStore; ///< Player data LfgGroupDataContainer GroupsStore; ///< Group data bool m_Testing; - - void setRandomDungeonId(uint32 & rDungeonId) const; }; } // namespace lfg From 123437e2cbf030b145563bfe9edbe0d2c042fff0 Mon Sep 17 00:00:00 2001 From: FrancescoBorzi Date: Fri, 1 Oct 2021 17:54:56 +0200 Subject: [PATCH 5/5] chore(wip): wip --- modules/create_module.sh | 105 ++++++++++++++++++++++++++++++++ modules/how_to_make_a_module.md | 20 ++++++ 2 files changed, 125 insertions(+) create mode 100644 modules/create_module.sh create mode 100644 modules/how_to_make_a_module.md diff --git a/modules/create_module.sh b/modules/create_module.sh new file mode 100644 index 00000000000000..51e9de479a3f26 --- /dev/null +++ b/modules/create_module.sh @@ -0,0 +1,105 @@ +#!/bin/bash +## Just run it with bash or `git bash` on windows, and it will ask for the module's name and tada! +## By Barbz + +##------------------------------- VARIABLES ---------------------------------## + +MODULE_TEMPLATE_URL="https://github.com/azerothcore/skeleton-module/" +GIT_COMMIT_MSG_SETUP="setup_git_commit_template.sh" + +##------------------------------- CODE ---------------------------------## + +read -p "Enter the name of your future module: " "MODULE_NAME" +echo $MODULE_NAME | fgrep -q ' ' + +while [ $? -eq 0 ] +do + echo 'Blanks are not allowed!' + read -p "Enter the name of your future module: " MODULE_NAME + echo $MODULE_NAME | fgrep -q ' ' +done + +if test -n "$MODULE_NAME" +then + echo "--- Cloning 'skeleton-module' as $MODULE_NAME/" + git clone --depth 1 -b master $MODULE_TEMPLATE_URL $MODULE_NAME + + echo "--- Removing 'skeleton-module/.git/' history" + cd $MODULE_NAME && rm -rf .git/ + + echo "--- Init new git repository" + git init && git add -A && git commit -m "Initial commit - $MODULE_NAME" + + echo "--- Configure git for nice commit messages" + source "$GIT_COMMIT_MSG_SETUP" || bash "$GIT_COMMIT_MSG_SETUP" + + echo "--- Ready to code" +fi + + +# ## TODO Set the remote origin with username, repo url etc + + # $USER_NAME/$MODULE_NAME.git + + # echo "Do you want to set your git remote?" + # select yn in "Yes" "No"; do + # case $yn in + # Yes ) + # CONFIGURE_GIT=1; break;; + # No ) + # CONFIGURE_GIT=0; + # exit;; + # esac + # done + + + # if test "$CONFIGURE_GIT" == "1" + # then + # PS3='Where do you want to push your module?' + # options=("github.com" "gitlab.com" "bitbucket.org" "Quit") + # select opt in "${options[@]}" + # do + # case $opt in + # "github.com") + # echo "you chose choice 1" + # break + # ;; + # "gitlab.com") + # echo "you chose choice 2" + # break + # ;; + # "bitbucket.org") + # echo "you chose choice $REPLY which is $opt" + # break + # ;; + # "Quit") + # break + # ;; + # *) echo "invalid option $REPLY";; + # esac + # done + + # REMOTE_HOST="$opt" + + # PS3='HTTPS or SSH?' + # options=("HTTPS (default)" "SSH" "Quit") + # select opt in "${options[@]}" + # do + # case $opt in + # "HTTPS") + # echo "you chose choice 1" + # break + # ;; + # "SSH") + # echo "you chose choice $REPLY which is $opt" + # break + # ;; + # "Quit") + # break + # ;; + # *) echo "invalid option $REPLY";; + # esac + # done + + # REMOTE_PROTOCOL="$opt" + # fi diff --git a/modules/how_to_make_a_module.md b/modules/how_to_make_a_module.md new file mode 100644 index 00000000000000..8a803c456a5059 --- /dev/null +++ b/modules/how_to_make_a_module.md @@ -0,0 +1,20 @@ +# CREATE A NEW AZEROTHCORE MODULE + +1) Read this page first: + +http://www.azerothcore.org/wiki/Create-a-Module + + +2) Run the script `create_module.sh`: +- If you're on windows, execute it with Git Bash (right click on it and choose Git bash) if you have installed Git extensions +- If you're on linux, just run it with bash or with ./create_module.sh + +This script will create the base of your module, with a clean history and add a git configuration option to this repository only (local config). + + +NOTE: You can also clone our skeleton-module manually, clean the history, and configure but you should use the script instead https://github.com/azerothcore/skeleton-module/ + + +3) Share it with the community! + +Join us on our discord, share it there, then we might fork it officially and it will appear in the module catalogue.