azerothcore-wotlk icon indicating copy to clipboard operation
azerothcore-wotlk copied to clipboard

Gossips on NPCs randomly turn unusable at random

Open 0xCiBeR opened this issue 1 year ago • 8 comments

Current Behaviour

All NPCs except those who go directly into Vendor/Training window can reproduce this bug.

The problem is when interacting with a NPC that has a gossip in certain random situations the gossip is unusable. Options are shown, but when clicked they do nothing. After closing the window, and interacting again it gets fixed. Following up on discord, seems i'm not the only one seeing this behaviour: https://discord.com/channels/217589275766685707/284406375495368704/1097561125052223649

Expected Blizzlike Behaviour

Gossips should work 10/10 you try

Source

No response

Steps to reproduce the problem

This is not so easy to reproduce since it happens at random, seems to be related to approching NPCs to fast or circleing through the menu options fast.

Extra Notes

No response

AC rev. hash/commit

AzerothCore rev. fd6941de7c7e 2023-04-09 23:44:52 -0300 (prod branch) (Unix, RelWithDebInfo, Static) Using SSL version: OpenSSL 1.1.1n 15 Mar 2022 (library: OpenSSL 1.1.1n 15 Mar 2022) Using Boost version: 1.74.0 Using MySQL version: 100518 Using CMake version: 3.18.4 Compiled on: Linux 5.10.0-20-amd64 Worldserver listening connections on port 8085 Realmlist (Realm Id: 1) configured in port 8085 VMAPs status: Enabled. LineOfSight: 1, getHeight: 1, indoorCheck: 1 MMAPs status: Enabled maps directory located in /root/azeroth-server/data/maps. Total size: 291014951 bytes vmaps directory located in /root/azeroth-server/data/vmaps. Total size: 658130721 bytes mmaps directory located in /root/azeroth-server/data/mmaps. Total size: 2192910800 bytes Using esES DBC Locale as default. All available DBC locales: esES Using World DB: ACDB 335.9-dev LoginDatabase queue size: 0 CharacterDatabase queue size: 0 WorldDatabase queue size: 0

List enable modules:

  • mod-eluna
  • mod-globalchat
  • mod-ip-tracker
  • mod-multi-client-check
  • mod-npc-spectator
  • mod-reward-shop
  • mod-transmog
  • mod-weekend-xp

Operating system

Debian 11

Custom changes or Modules

  • mod-eluna
  • mod-globalchat
  • mod-ip-tracker
  • mod-multi-client-check
  • mod-npc-spectator
  • mod-reward-shop
  • mod-transmog
  • mod-weekend-xp

0xCiBeR avatar Apr 17 '23 17:04 0xCiBeR

I can confirm this issue. From what I've found over the hundreds of times I've had this happen it's like if you approach a NPC too fast, like it doesn't get properly loaded, and talk to them too fast it doesn't know what to do. If you wait a few seconds before talking to the NPC it doesn't happen - at least not for me.

noisiver avatar Apr 17 '23 17:04 noisiver

I think these are linked. This specific issue is talking to the NPC and instantly the options are unusable while the issue you linked is about keeping the gossip menu open for a longer period of time. These could very well be caused by the same issue.

noisiver avatar Apr 17 '23 20:04 noisiver

I did a little investigating with a custom gossip NPC, it would be nice if somebody else can confirm this. While testing one of my modules I noted that when choosing some of my gossip items it would sometimes activate/deactivate the first item instead of the item I selected. You can observe it here (I have a macro to select item 3, but it selects 1 instead)

So I did some digging and I found this function (L152 of GossipDef.cpp):

uint32 GossipMenu::GetMenuItemAction(uint32 menuItemId) const
{
    GossipMenuItemContainer::const_iterator itr = _menuItems.find(menuItemId);
    if (itr == _menuItems.end())
        return 0; // The culprit

    return itr->second.OptionType;
}

I set a breakpoint on this function and noted that when this bug occurs it is happening when it fails to find the menu item in the GossipMenuItemContainer, so it returns 0 for the index which is the first item.

I tried to replicate this on a Stormwind Guard but couldn't get it to happen so if somebody can re-replicate it that would be great. Looking at _menuItems when this occurs does show that it has 0 items in its container which makes sense on why it can't find the correct item.

EDIT: I'm not sure if this is unrelated but it could be worth investigating.

AnchyDev avatar Apr 18 '23 03:04 AnchyDev

It might or might not be unrelated but I can tell you there has never been any occasion for me where the first item worked when this issue popped up.

noisiver avatar Apr 18 '23 15:04 noisiver

Can confirm, it also happens when you interact with a NPC, and then cast certain spells; For example if you open a Profession trainers gossip window, and then craft any item, all options do nothing

duncrafter avatar Apr 18 '23 22:04 duncrafter

It might or might not be unrelated but I can tell you there has never been any occasion for me where the first item worked when this issue popped up.

I don't have a video, but when my gameobject has only 1 option sometimes it doesn't work either.

AnchyDev avatar Apr 19 '23 00:04 AnchyDev

It will happen 100% when you interact NPC while you are do moving, expecially left right stride.

jokerlfm avatar May 04 '23 01:05 jokerlfm

Update on this issue on how to reproduce this with an existing npc:

  • .go creature 116913
  • Setup macro: /run SelectGossipOption(2)
  • Run out of range
  • Run back into range
  • Quickly interact with NPC (any of the two navigation NPCs)
  • If the gossip does not continue, you have triggered the bug and can observe none of the options work.

AnchyDev avatar May 25 '23 03:05 AnchyDev

I can consistently reproduce this, if I run towards an npc and interact with it, 50% of the time the NPC just turns and stares at me but fails to even open the dialogue window. In the other 50% the dialogue window does open, but the options in there don't work when clicked. This is fixed by stepping back, allowing the NPC to turn back away, then approaching them slower and clicking them from a closer proximity.

ghost avatar Aug 27 '23 23:08 ghost

One of our very experienced Discord members mentioned a possible fix when talking about this topic: robinsch: This issue happens when getting dialog status from other NPCs while having a gossip menu open e.g when they move into visibility range Unsure why AC clears gossip menus there - needs to be removed and the bug is fixed

Kaev avatar Oct 19 '23 06:10 Kaev

One of our very experienced Discord members mentioned a possible fix when talking about this topic: robinsch: This issue happens when getting dialog status from other NPCs while having a gossip menu open e.g when they move into visibility range Unsure why AC clears gossip menus there - needs to be removed and the bug is fixed

That would explain why moving triggers it because you are moving in and out of this range, thanks for the comment.

AnchyDev avatar Oct 19 '23 08:10 AnchyDev

Confirmed on my local server that removing L151 of CreatureScript.cpp fixes the issue for me.

Tested on .go creature 116913, moving left to right pre-patch will break the gossip but if you remove that line of code it no longer occurs.

Free PR for whoever wants to implement this.

Thanks @Kaev

AnchyDev avatar Oct 27 '23 03:10 AnchyDev

Confirmed on my local server that removing L151 of CreatureScript.cpp fixes the issue for me

The line in this function seems to have been introduced a very long time ago, much longer than I remember the issue first being noticed/reported. Wonder if a commit unearthed the issue rather than created it.

heyitsbench avatar Oct 27 '23 04:10 heyitsbench

Either way, it's unlikely we need to clear the gossip every time that function is executed.

Maybe you can make a pull request, and we can test to ensure it doesn't break anything else.

lewpar avatar Oct 27 '23 05:10 lewpar

Free PR for whoever wants to implement this.

Sure, I'll bite.

https://github.com/azerothcore/azerothcore-wotlk/pull/17596

kjack9 avatar Oct 27 '23 05:10 kjack9