liyunfan1223 / mod-playerbots

AzerothCore Playerbots Module
https://discord.gg/NQm5QShwf9
GNU Affero General Public License v3.0
258 stars 141 forks source link

Chat command "q [item link]" crashes server, providing a [quest link] works #620

Open avirar opened 1 day ago

avirar commented 1 day ago

Describe the bug The chat command "q [item link]" crashes the server when an item link is provided. Quest links work correctly and shows progress on the linked quest

Commit hash AzerothCore rev. 418afce6d74c 2024-10-10 23:13:20 +0800 (Playerbot branch) (Unix, Release, Static)

To Reproduce Steps to reproduce the behavior:

  1. Invite bot to group
  2. Open trade window with bot so they list their inventory
  3. Whisper bot "q [item link]" using an item from their inventory, I was testing trinkets but it seems to crash with any item link i provide
  4. Worldserver restarts with Segmentation fault

Expected behavior It should provide the item usage status, eg. ITEM_USAGE_EQUIP = Equip, ITEM_USAGE_REPLACE = "Equip (replace)"

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Thread 11 "worldserver" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fd2767ff6c0 (LWP 269303)] Quest::GetQuestId (this=0x0) at /root/azerothcore-wotlk/src/server/game/Quests/QuestDef.h:228 228 [[nodiscard]] uint32 GetQuestId() const { return Id; }

0 Quest::GetQuestId (this=0x0) at /root/azerothcore-wotlk/src/server/game/Quests/QuestDef.h:228

1 0x000055ecc45d025f in ChatHelper::FormatQuest[abi:cxx11](Quest const*) (quest=0x0) at /root/azerothcore-wotlk/modules/mod-playerbots/src/ChatHelper.cpp:308

2 0x000055ecc44882ff in QueryQuestAction::Execute (this=0x7fd1f9845400, event=...) at /root/azerothcore-wotlk/modules/mod-playerbots/src/strategy/actions/QueryQuestAction.cpp:58

3 0x000055ecc46e111e in Engine::ListenAndExecute (this=0x7fd26457c200, action=0x7fd1f9845400, event=...) at /root/azerothcore-wotlk/modules/mod-playerbots/src/strategy/Engine.cpp:629

4 0x000055ecc46de866 in Engine::DoNextAction (this=0x7fd26457c200, unit=0x0, depth=0, minimal=false) at /root/azerothcore-wotlk/modules/mod-playerbots/src/strategy/Engine.cpp:214

5 0x000055ecc460d35b in PlayerbotAI::DoNextAction (this=0x7fd259e32d00, min=false) at /root/azerothcore-wotlk/modules/mod-playerbots/src/PlayerbotAI.cpp:1322

6 0x000055ecc460c577 in PlayerbotAI::UpdateAIInternal (this=0x7fd259e32d00, elapsed=6987, minimal=false) at /root/azerothcore-wotlk/modules/mod-playerbots/src/PlayerbotAI.cpp:484

7 0x000055ecc460b5b2 in PlayerbotAI::UpdateAI (this=0x7fd259e32d00, elapsed=6987, minimal=false) at /root/azerothcore-wotlk/modules/mod-playerbots/src/PlayerbotAI.cpp:408

8 0x000055ecc4161221 in PlayerbotsPlayerScript::OnAfterUpdate (this=0x7fd2d7bb0dd0, player=0x7fd26452ab00, diff=6987) at /root/azerothcore-wotlk/modules/mod-playerbots/src/Playerbots.cpp:106

9 0x000055ecc5f6cc5d in ScriptMgr::OnAfterPlayerUpdate(Player, unsigned int)::$_0::operator()(PlayerScript) const (this=0x7fd2767fc6e8, script=0x7fd2d7bb0dd0) at /root/azerothcore-wotlk/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp:226

10 0x000055ecc5f6cc12 in std::invoke_impl<void, ScriptMgr::OnAfterPlayerUpdate(Player, unsigned int)::$_0&, PlayerScript>(std::invoke_other, ScriptMgr::OnAfterPlayerUpdate(Player, unsigned int)::$_0&, PlayerScript&&) (f=..., args=@0x7fd2767fc650: 0x7fd2d7bb0dd0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:61

11 0x000055ecc5f6cba2 in std::__invoke_r<void, ScriptMgr::OnAfterPlayerUpdate(Player, unsigned int)::$_0&, PlayerScript>(ScriptMgr::OnAfterPlayerUpdate(Player, unsigned int)::$_0&, PlayerScript&&) (fn=..., args=@0x7fd2767fc650: 0x7fd2d7bb0dd0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:111

12 0x000055ecc5f6ca82 in std::_Function_handler<void (PlayerScript), ScriptMgr::OnAfterPlayerUpdate(Player, unsigned int)::$_0>::_M_invoke(std::_Any_data const&, PlayerScript*&&) (functor=..., args=@0x7fd2767fc650: 0x7fd2d7bb0dd0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:290

13 0x000055ecc5ef6f95 in std::function<void (PlayerScript)>::operator()(PlayerScript) const (this=0x7fd2767fc6e8, __args=0x7fd2d7bb0dd0) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_function.h:591

14 0x000055ecc5ef3728 in ExecuteScript(std::function<void (PlayerScript*)>) (executeHook=...) at /root/azerothcore-wotlk/src/server/game/Scripting/ScriptMgrMacros.h:63

15 0x000055ecc5f64f0d in ScriptMgr::OnAfterPlayerUpdate (this=0x55ecc7879910 <ScriptMgr::instance()::instance>, player=0x7fd26452ab00, diff=6987) at /root/azerothcore-wotlk/src/server/game/Scripting/ScriptDefines/PlayerScript.cpp:224

16 0x000055ecc583acf0 in Player::Update (this=0x7fd26452ab00, p_time=6987) at /root/azerothcore-wotlk/src/server/game/Entities/Player/PlayerUpdates.cpp:425

17 0x000055ecc5d3f425 in Map::Update (this=0x7fd29515cbc0, t_diff=0, s_diff=6987) at /root/azerothcore-wotlk/src/server/game/Maps/Map.cpp:766

18 0x000055ecc5d78591 in MapUpdateRequest::call (this=0x7fd206625240) at /root/azerothcore-wotlk/src/server/game/Maps/MapUpdater.cpp:44

19 0x000055ecc5d778b9 in MapUpdater::WorkerThread (this=0x55ecc7878918 <MapMgr::instance()::instance+216>) at /root/azerothcore-wotlk/src/server/game/Maps/MapUpdater.cpp:156

20 0x000055ecc5d7967e in std::__invoke_impl<void, void (MapUpdater::)(), MapUpdater> (f=@0x7fd277c0cd10: (void (MapUpdater::)(MapUpdater const)) 0x55ecc5d77830 <MapUpdater::WorkerThread()>, t=@0x7fd277c0cd08: 0x55ecc7878918 <MapMgr::instance()::instance+216>) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:74

21 0x000055ecc5d79592 in std::invoke<void (MapUpdater::)(), MapUpdater> (fn=@0x7fd277c0cd10: (void (MapUpdater::)(MapUpdater const)) 0x55ecc5d77830 <MapUpdater::WorkerThread()>, __args=@0x7fd277c0cd08: 0x55ecc7878918 <MapMgr::instance()::instance+216>) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/invoke.h:96

22 0x000055ecc5d79552 in std::thread::_Invoker<std::tuple<void (MapUpdater::)(), MapUpdater> >::_M_invoke<0ul, 1ul> (this=0x7fd277c0cd08) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_thread.h:252

23 0x000055ecc5d79505 in std::thread::_Invoker<std::tuple<void (MapUpdater::)(), MapUpdater> >::operator() (this=0x7fd277c0cd08) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_thread.h:259

24 0x000055ecc5d793c9 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (MapUpdater::)(), MapUpdater> > >::_M_run (this=0x7fd277c0cd00) at /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/std_thread.h:210

25 0x00007fd2dbad44a3 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6

26 0x00007fd2dbca8134 in start_thread (arg=) at ./nptl/pthread_create.c:442

27 0x00007fd2dbd287dc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

0 Quest::GetQuestId (this=0x0) at /root/azerothcore-wotlk/src/server/game/Quests/QuestDef.h:228

EricksOliveira commented 1 day ago

Crash Cofirmed.

EricksOliveira commented 1 day ago

Fix https://github.com/liyunfan1223/mod-playerbots/pull/623

Testing pls

avirar commented 20 hours ago

Doesn't crash now :)

It doesn't report the usage/status of the linked item. I believe it should display the item count and total needed if it's a quest item, or how the bot intends to use the item, eg. EQUIP, REPLACE, USELESS, AUCTIONHOUSE, etc. Being able to query the bots item usage will help me debug some other issues I've encountered (bots not equipping/replacing trinket upgrades)

Outputs: --- Invalid quest not completed --- Quest template not found.