Log Crash: 00007FF7750C05ED 00000028A47FEA10 FirebombSpreadAction::Execute+1AD E:\Server\Heroes_Azeroth\modules\mod-playerbots\src\strategy\dungeons\wotlk\nexus\NexusActions.cpp line 58
This PR fixes a possible crash in the FirebombSpreadAction::Execute function, located in the NexusActions.cpp file, which occurred due to the lack of checking for null pointers when accessing group members.
Main changes: Added a null pointer check to ensure botAI->GetUnit(member) returns a valid unit before calling functions like GetExactDist2d and MoveAway.
If botAI->GetUnit(member) returns nullptr, execution ignores the specific member, avoiding access to an invalid pointer that could cause a server crash.
This PR adds a null pointer check to the ChatHelper::FormatQuest function to avoid a crash that occurred when trying to format a null quest. The crash occurred when the quest pointer was nullptr and the code tried to access the GetQuestId(), GetQuestLevel() and GetTitle() methods.
Changes:
Added a nullptr check to the beginning of the ChatHelper::FormatQuest function.
Return of a standard error message ("Invalid quest") if the quest is null.
Impact:
Prevents crashes when formatting null quests.
Improves bot system stability when dealing with invalid quests.
Added a new table to store user-specified mount ids.
Can specify flying and ground mounts for a character which will prioritise that mount. If multiple entries, a random entry will be selected from that list.
Currently no way to add entries other than manual DB editing, but can be developed into a whisper command pretty easily.
This should gracefully fail (if no entries exist for the character, or the db table does not exist) and fallback to the default random selection as usual.
Winged Steed of the Ebon Blade gets incorrectly categorised as a ground mount, causes issues and bots will not be able to ground mount if they have this mount in the account spellbook.
There may by other scaling mounts that have the same issue, either we blacklist them all or figure out a way to correctly read them as flyers.
Protection against race conditions: Added a global mutex (session_mutex) to synchronize access to the session() function when multiple threads are running. This avoids concurrency problems in environments with many simultaneous connections.
Thread pool usage: Replaced manual thread creation with boost::thread with a thread pool using boost::asio::thread_pool. The thread pool improves resource management and limits the number of simultaneous threads, optimizing performance.
Checking for socket errors: Added check to ensure the socket is not null or closed before trying to read it.
Implemented detailed error handling for readings and writings, including detailed logs to facilitate debugging.
Secure socket closure: Now sockets are correctly closed at the end of the session, even in the event of an error, preventing resource leaks.
1. Improvements in error handling: Added detailed logs for cases where botAI or master are null, allowing better failure tracking.
2. Additional null pointer checks: Added checks to ensure that the botAI and master are valid before performing actions dependent on these objects, preventing potential crashes.
3. Optimization in bot login logic: Revised the bot input flow to ensure it is added to the group appropriately depending on its relationship to the master.
Added logic for handling different types of groups (raid, LFG, etc.), including the possibility of automatic conversion to raid if necessary.
Added logic so bots will only roll need on usable class armor tokens. The tokens/items are classed as MISC > JUNK oddly, code simply checks if the bots class is part of the bitmask of classes for the item, and the item is EPIC. This catches all the tokens I've tested so far.
After leaving PT, the Bot was stuck in a Group, stopped and without receiving invites from other players. Ideally, use the LeaveGroupOnLogout.Enabled = 1 setting in Worldserver.conf so that after the player leaves the game, the Bots are not stuck in Raid.
This PR adjusts the execution priority of bot actions in Dungeon Finder (DF), modifying the relevance logic to make responses faster. The relevance calculation formula was changed in RpgAction::SetNextRpgAction to reduce the delay between activating actions, especially to improve the acceptance time of bots in DF queues. With these changes, bots now accept vacancies in a more agile and efficient way, optimizing overall response time.