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

solo-lfg incompatible with AzerothCore 4.0 #26

Closed
Artanisx opened this issue Oct 20, 2021 · 4 comments
Closed

solo-lfg incompatible with AzerothCore 4.0 #26

Artanisx opened this issue Oct 20, 2021 · 4 comments

Comments

@Artanisx
Copy link

Unfortunately, latest AC build breaks the lfg-solo.patch.

error: patch failed: src/server/game/DungeonFinding/LFGQueue.cpp:285
error: src/server/game/DungeonFinding/LFGQueue.cpp: patch does not apply

The underlying code for LFGQueue.cpp doesn't look like it's changed aside from a minor line change, however I'm unfamiliar with how git patches work so I'm currently unable to propose a way to make this patch work with the updated core.

Hopefully someone can help :)

@SgtShaw
Copy link

SgtShaw commented Nov 6, 2021

Copy the following code into your lfg-solo.patch file. This should fix the issue.

diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 307a453d3..69507e79f 100644
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -37,8 +37,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();
@@ -1790,8 +1789,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);
@@ -2763,5 +2761,8 @@ 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 96773f24c..7498b0da5 100644
--- a/src/server/game/DungeonFinding/LFGMgr.h
+++ b/src/server/game/DungeonFinding/LFGMgr.h
@@ -553,6 +553,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)
@@ -616,6 +620,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 8f47db421..d2d1b9e66 100644
--- a/src/server/game/DungeonFinding/LFGQueue.cpp
+++ b/src/server/game/DungeonFinding/LFGQueue.cpp
@@ -289,7 +289,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;
@@ -386,7 +386,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)

@Artanisx
Copy link
Author

Artanisx commented Nov 6, 2021

I will try, thank you very much :)

@foley64
Copy link

foley64 commented Nov 27, 2021

The code should be paste at the beginning or the end? Or must replace all the code ?
Because I try this fix but it did not work for me.

@pangolp
Copy link

pangolp commented Jun 17, 2023

The module was recently updated, so it should be compatible with the latest version of the emulator. If the problem persists, please do not hesitate to re-create an issue, completing the data and providing all the necessary information so that we can solve the problem. Thank you.

@pangolp pangolp closed this as completed Jun 17, 2023
@azerothcore azerothcore locked and limited conversation to collaborators Jun 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants