Mangos-Bot - Adding chat command


I’ve been playing around with Ike3’s Mangos-Bot fork and I’m wanting to make some changes to my own branch to do some things for a learning experience. I’m a pretty experienced C# programmer but C++ I’m still pretty rusty with. I’m wondering if anyone can help me with adding a chat command that my Bots respond to through whispes/party/raid chat. Here’s what I did so far:

  • Add the following lines in ChatTriggerContext.h:

creators[“grcheck”] = &ChatTriggerContext::gear_check; // Added to constructor

static Trigger* gear_check(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, “grcheck”); } // added as private method

  • Added the following lines in ChatActionContext.h

creators[“grcheck”] = &ChatActionContext::gear_check; // Added to constructor

static Action* gear_check(PlayerbotAI* ai) { return new GearCheckAction(ai); }

  • Created a new GearCheckAction class modeled after the EquipAction with the following code in the Execute method:

ostringstream out; out << “I am checking my gear”;

return true;

When I send my command “grcheck” in a whisper my bots receive the message (I have them whispering me the command when they receive one) but nothing ever happens after that. I never get a whisper “I am checking my gear”. I pretty sure what I’m missing is the link between the chat trigger and the action, but I can’t seem to find that. For example, I’m assuming that when I whisper one of my bots to equip an item with:

/w BotName e {item_link}

That then calls the EquipAction. However, the chat trigger for equip is set as “e” and the action trigger is setup as “equip”. How does the system know to call the EquipAction when I whisper “e {item_link}” to my bot. This is the part I believe I am missing. Hopefully someone with more experience in Mangos-Bot can point me in the right direction. Thanks in advance!