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

No longer buffs on right-click #31

Closed
ghost opened this issue Jul 8, 2024 · 7 comments · Fixed by #36
Closed

No longer buffs on right-click #31

ghost opened this issue Jul 8, 2024 · 7 comments · Fixed by #36

Comments

@ghost
Copy link

ghost commented Jul 8, 2024

Current Behaviour

Right clicking no longer buffs players. Nothing happens. This only started after the most recent module update. It used to work prior.

I also restored the .conf from the .conf.dist to test and still no right-click.

Expected Blizzlike Behaviour

Not blizzlike since it's a custom NPC, but it should cast buffs on players upon right-click.

Steps to reproduce the problem

  1. npc add 601016
  2. right-click new npc
  3. nothing happens

Extra Notes

This used to work prior to the latest update.

AC rev. hash/commit

AzerothCore rev. 099b6ab59a4a 2024-07-08 02:53:58 +0000 (master branch) (Unix, RelWithDebInfo, Static) (worldserver-daemon) ready...

Operating system

Debian 12.6

Custom changes or Modules

  • Modules configuration (static):
    |
    +- worldserver
    | +- mod-ah-bot
    | +- mod-anticheat
    | +- mod-aoe-loot
    | +- mod-assistant
    | +- mod-eluna
    | +- mod-individual-xp
    | +- mod-learn-spells
    | +- mod-npc-all-mounts
    | +- mod-npc-buffer
    | +- mod-npc-enchanter
    | +- mod-npc-services
    | +- mod-random-enchants
    | +- mod-skip-dk-starting-area
@parashorea
Copy link

Yes, I encountered this problem too.

@parashorea
Copy link

@Helias

@Helias
Copy link
Member

Helias commented Aug 16, 2024

I have not enough time to investigate this :(

@parashorea
Copy link

@Helias But do you really think hiding will stop me from finding you? It’s pointless! You're such a flamboyant man—no matter where you are, you're like a firefly in the dark—so bright, so outstanding!

@entropiccode
Copy link
Contributor

I'm experiencing this issue with this module as well.

The script seems to be partially working, as toggling the option to announce the module at login does have an effect, however nothing relating to the NPC itself functions.

I tested with custom buffs and the default buffs, and setting "Buff.ByLevel" to 0 and 1 but there was no change in the described behavior regardless of configuration.

The "buff_npc" creaturescript as a whole doesn't seem to be working, as the NPC doesn't whisper the player, nor do they say any phrases or emote.

@entropiccode
Copy link
Contributor

entropiccode commented Aug 27, 2024

After some testing, I've been able to get a very stripped down version of the bot to work.

I started by stripping out everything in the "buff_npc" class except for checking to see if the module is enabled, storing buff IDs, buffing the player, and having the NPC flex once the buff is applied. At first, this still wasn't working for me, as the NPC would just open the gossip window with the generic "Greetings, <player name>" behavior seen previously. On a whim, I updated "OnGossipSelect" to "OnGossipHello".

After compiling, the bot began to work without issue. Right clicking the bot does not open a dialogue interface, instead the bot flexes as the configured buffs are added to your character. I tested with the default set of buffs and a set of custom buffs, both configurations worked without issue.

Going back through commits to the project, it looks like the code has been using OnGossipSelect for far longer than this issue has been a problem (I used this module myself 2 years ago and the code from that timeframe used OnGossipSelect), so the issue is either the NPC had gossip options previously that are missing, causing the rest of the OnGossipSelect to fail, or the core itself has adjusted how OnGossipSelect is handled.

For the sake of reference, here is what my buff_npc class looks like. It's a hacky fix at best as I don't program in C and changes I made were based on generalized knowledge of programming based on other languages, but it's a bare-bones demonstration of something I got to work.

class buff_npc : public CreatureScript
{
public:
    buff_npc() : CreatureScript("buff_npc") { }

    bool OnGossipHello(Player* player, Creature* creature) override
    {
        if (!BFEnableModule)
        {
            return false;
        }

        // Store Buff IDs
        std::vector<uint32> vecBuffs = {};
        std::stringstream ss(sConfigMgr->GetOption<std::string>("Buff.Spells", ""));
        for (std::string buff; std::getline(ss, buff, ';');)
        {
            vecBuffs.push_back(stoul(buff));
        }

        for (std::vector<uint32>::const_iterator itr = vecBuffs.begin(); itr != vecBuffs.end(); itr++)
        {
            player->CastSpell(player, *itr, true);
        }

        // Emote and Close
        creature->HandleEmoteCommand(EMOTE_ONESHOT_FLEX);
        CloseGossipMenuFor(player);
        return true;
    }
};

@entropiccode
Copy link
Contributor

Reverted npc_buffer.cpp back to its current state and changed OnGossipSelect to OnGossipHello again, leaving all other functionality. NPC seems to be working after compile, created pull request for my fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@Helias @entropiccode @parashorea and others