fix(cpp): Remove Need for Patch Using New Hook in AC (#33)

* fix(cpp): Remove Need for Patch Using New Hook in AC
A new hook has been added to AC that can be used by this module.
This removes the need for the patch.
- Updated the cpp to use the new IsTesting mode hook
- Updated the Readme to remove the patch information
- Deleted the patch file

* fix(cpp): GetOption Update
GetOption Update

* update workflow

Co-authored-by: BuildTools <unconfigured@null.spigotmc.org>
Co-authored-by: Patrick Lewis <pat@lo5t.com>
This commit is contained in:
LannyE
2022-02-26 17:26:22 -07:00
committed by GitHub
parent 0def32ca35
commit 6bd97792b5
4 changed files with 8 additions and 108 deletions

View File

@@ -24,12 +24,7 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
path: 'modules/mod-solo-lfg'
- name: Apply core patch
run: git apply modules/mod-solo-lfg/lfg-solo.patch
- name: Apply docker patch
working-directory: ./modules/mod-solo-lfg
run: git apply docker.patch
path: 'modules/mod-solo-lfg'
- name: Cache
uses: actions/cache@v2
with:

View File

@@ -8,10 +8,7 @@ Allows for players to use dungeon finder solo or in groups less than and up to 5
```
1. Go inside your /modules/ folder
2. git clone https://github.com/azerothcore/mod-solo-lfg.git
3. Apply lfg-solo.patch to your core.
a. In order to do this, please go to the root /azerothcore-wotlk of your installation.
b. Then do git apply modules/mod-solo-lfg/lfg-solo.patch
4. Re-run cmake and launch a clean build of AzerothCore.
3. Re-run cmake and launch a clean build of AzerothCore.
a. If using AzerothCore Bash Dashboard setup: Do a ./acore.sh compiler configure followed by ./acore.sh compiler build.
b. If using standard installation, refer to https://www.azerothcore.org/wiki/installation
```
@@ -20,15 +17,7 @@ Allows for players to use dungeon finder solo or in groups less than and up to 5
```
1. Go inside your /modules/ folder
2. git clone https://github.com/azerothcore/mod-solo-lfg.git
3. Apply lfg-solo.patch to your core.
a. In order to do this, please go to the root /azerothcore-wotlk of your installation.
b. Then do 'git apply modules/mod-solo-lfg/lfg-solo.patch'
(make sure the path is indeed pointing to your lfg-solo.patch file)
4. Apply lfg-solo.patch to your core.
a. In order to do this, please go to the mod-solo-lfg module directory 'modules/mod-solo-lfg'.
b. Then do 'git apply docker.patch'
(make sure the path is indeed pointing to your docker.patch file)
5. Re-run cmake and launch a clean build of AzerothCore.
3. Re-run cmake and launch a clean build of AzerothCore.
a. Go to your root folder and ./bin/acore-docker-build
b. Then do a docker-compose up
```
@@ -40,19 +29,14 @@ copy the file SoloLfg.conf.dist to SoloLfg.conf and edit it (keep both files).
## Standard Uninstallation
```
1. Remove the lfg-solo.patch from y our core.
a. In order to do this, please go to the root /azerothcore-wotlk of your installation.
b. Then do git apply -R modules/mod-solo-lfg/lfg-solo.patch
1. Remove the /modules/mod-solo-lfg folder
2. Re-run cmake and launch a clean build of AzerothCore.
```
## Docker Uninstallation
```
1. Remove the /modules/mod-solo-lfg folder
2. Remove the lfg-solo.patch from your core.
a. In order to do this, please go to the root /azerothcore-wotlk of your installation.
b. Then do git apply -R modules/mod-solo-lfg/lfg-solo.patch
3. Re-run cmake and launch a clean build of AzerothCore.
2. Re-run cmake and launch a clean build of AzerothCore.
a. Go to your root folder and ./bin/acore-docker-build
b. Then do a docker-compose up
```

View File

@@ -1,79 +0,0 @@
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 6d32c5760..1d17ab738 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -26,8 +26,7 @@
namespace lfg
{
-
- LFGMgr::LFGMgr(): m_lfgProposalId(1), m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK)), m_Testing(false)
+ LFGMgr::LFGMgr(): m_lfgProposalId(1), m_options(sWorld->getIntConfig(CONFIG_LFG_OPTIONSMASK)), m_isSoloLFG(false), m_Testing(false)
{
new LFGPlayerScript();
new LFGGroupScript();
@@ -1672,8 +1671,7 @@ namespace lfg
for (LfgProposalPlayerContainer::const_iterator itPlayers = proposal.players.begin(); itPlayers != proposal.players.end(); ++itPlayers)
if (itPlayers->second.accept != LFG_ANSWER_AGREE) // No answer (-1) or not accepted (0)
allAnswered = false;
-
- if (!m_Testing && !allAnswered)
+ if (!sLFGMgr->IsSoloLFG() && !allAnswered)
{
for (LfgProposalPlayerContainer::const_iterator it = proposal.players.begin(); it != proposal.players.end(); ++it)
SendLfgUpdateProposal(it->first, proposal);
@@ -2656,5 +2654,9 @@ namespace lfg
}
return randomDungeons;
}
+ void LFGMgr::ToggleSoloLFG()
+ {
+ m_isSoloLFG = !m_isSoloLFG;
+ }
} // namespace lfg
diff --git a/src/server/game/DungeonFinding/LFGMgr.h b/src/server/game/DungeonFinding/LFGMgr.h
index 0340cc57a..b4ae800ed 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -532,6 +532,10 @@ namespace lfg
void RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer);
void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer& buffer_deleted, uint32 groupCounter, ByteBuffer& buffer_groups, uint32 playerCounter, ByteBuffer& buffer_players);
void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap& infoMap);
+ /// 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)
@@ -590,6 +594,7 @@ namespace lfg
uint32 lastProposalId; ///< pussywizard, store it here because of splitting LFGMgr update into tasks
uint32 m_raidBrowserUpdateTimer[2]; ///< pussywizard
uint32 m_raidBrowserLastUpdatedDungeonId[2]; ///< pussywizard: for 2 factions
+ bool m_isSoloLFG; ///< solo lfg
LfgQueueContainer QueuesStore; ///< Queues
LfgCachedDungeonContainer CachedDungeonMapStore; ///< Stores all dungeons by groupType
diff --git a/src/server/game/DungeonFinding/LFGQueue.cpp b/src/server/game/DungeonFinding/LFGQueue.cpp
index e43080c14..e532ddb57 100644
--- a/src/server/game/DungeonFinding/LFGQueue.cpp
+++ b/src/server/game/DungeonFinding/LFGQueue.cpp
@@ -285,7 +285,7 @@ namespace lfg
return LFG_INCOMPATIBLES_MULTIPLE_LFG_GROUPS;
// Group with less that MAXGROUPSIZE members always compatible
- if (!sLFGMgr->IsTesting() && check.size() == 1 && numPlayers < MAXGROUPSIZE)
+ if (!sLFGMgr->IsSoloLFG() && numPlayers != MAXGROUPSIZE) // solo lfg
{
LfgQueueDataContainer::iterator itQueue = QueueDataStore.find(check.front());
LfgRolesMap roles = itQueue->second.roles;
@@ -382,7 +382,7 @@ namespace lfg
}
// Enough players?
- if (!sLFGMgr->IsTesting() && numPlayers != MAXGROUPSIZE)
+ if (!sLFGMgr->IsSoloLFG() && numPlayers != MAXGROUPSIZE) // solo lfg
{
strGuids.addRoles(proposalRoles);
for (uint8 i = 0; i < 5 && check.guids[i]; ++i)

View File

@@ -21,7 +21,7 @@ public:
void OnLogin(Player* player)
{
// Announce Module
if (sConfigMgr->GetBoolDefault("SoloLFG.Announce", true))
if (sConfigMgr->GetOption<bool>("SoloLFG.Announce", true))
{
ChatHandler(player->GetSession()).SendSysMessage("This server is running the |cff4CFF00Solo Dungeon Finder |rmodule.");
}
@@ -35,9 +35,9 @@ public:
void OnAfterConfigLoad(bool /*reload*/) override
{
if (sConfigMgr->GetBoolDefault("SoloLFG.Enable", true) != sLFGMgr->IsSoloLFG())
if (sConfigMgr->GetOption<bool>("SoloLFG.Enable", true) != sLFGMgr->IsTesting())
{
sLFGMgr->ToggleSoloLFG();
sLFGMgr->ToggleTesting();
}
}
};