mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 00:58:33 +00:00
Hello everyone, I am on a quest to make bot's pets completely functional, focuses on solving issues #1351 , #1230 , and #1137 . This PR achieves the following: 1. Changes the current "pet" chat command to "tame", which is more intuitive that only hunters can use it. The modes are "tame name (name)", "tame id (id)", "tame family (family)", "tame rename (new name)", and "tame abandon". Tame abandon is new - it simply abandons the current pet. Also, now, if you type in "tame family" by itself, it will list the available families. See pictures below for examples. 2. Added new "pet" chat command, with the following modes: "pet passive", "pet aggressive", "pet defensive", "pet stance" (shows current pet stance), "pet attack", "pet follow", and "pet stay". Previously, the pet's stance was not changeable, and there were some less than desired effects from summonable pets - see the issues above. 3. New config option: AiPlayerbot.DefaultPetStance, which changes the stance that all bot's pets are summoned as. This makes sure when feral spirits or treants are summoned by shamans and druids, they are immediately set to this configured stance. Set as 1 as default, which is defensive. (0 = Passive, 1 = Defensive, 2 = Aggressive) 4. New config option: AiPlayerbot.PetChatCommandDebug, which enables debug messages for the "pet" chat command. By default it is set to 0, which is disabled, but if you would like to see when pet's stances are changed, or when you tell the pet to attack/follow/stay, and when pet spells are auto-toggled, this is an option. I made this for myself mainly to test the command - if anyone notices any wierd pet behavior, this will be an option to help them report it as well. 5. Modified FollowActions to not constantly execute the petfollow action, overriding any stay or attack commands issued. 6. Modified GenericActions to have TogglePetSpellAutoCastAction optionally log when spells are toggled based on AiPlayerbot.PetChatCommandDebug. 7. Modified PetAttackAction to not attack if the pet is set to passive, and not override the pet's stance to passive every time it was executed. 8. Modified CombatStrategy.cpp to not constantly issue the petattack command, respecting the "pet stay" and "pet follow" commands. Pets will still automatically attack the enemy if set to aggressive or defensive. 9. Warlocks, Priests, Hunters, Shamans, Mages, Druids, and DKs (all classes that have summons): Added a "new pet" trigger that executes the "set pet stance" action. The "new pet" trigger happens only once, upon summoning a pet. It sets the pet's stance from AiPlayerbot.DefaultPetStance's value.
195 lines
10 KiB
C++
195 lines
10 KiB
C++
/*
|
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it
|
|
* and/or modify it under version 2 of the License, or (at your option), any later version.
|
|
*/
|
|
|
|
#include "ChatCommandHandlerStrategy.h"
|
|
|
|
#include "Playerbots.h"
|
|
|
|
class ChatCommandActionNodeFactoryInternal : public NamedObjectFactory<ActionNode>
|
|
{
|
|
public:
|
|
ChatCommandActionNodeFactoryInternal() { creators["tank attack chat shortcut"] = &tank_attack_chat_shortcut; }
|
|
|
|
private:
|
|
static ActionNode* tank_attack_chat_shortcut(PlayerbotAI* botAI)
|
|
{
|
|
return new ActionNode("tank attack chat shortcut",
|
|
/*P*/ nullptr,
|
|
/*A*/ nullptr,
|
|
/*C*/ NextAction::array(0, new NextAction("attack my target", 100.0f), nullptr));
|
|
}
|
|
};
|
|
|
|
void ChatCommandHandlerStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|
{
|
|
PassTroughStrategy::InitTriggers(triggers);
|
|
|
|
triggers.push_back(new TriggerNode("rep", NextAction::array(0, new NextAction("reputation", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("q", NextAction::array(0, new NextAction("query quest", relevance),
|
|
new NextAction("query item usage", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("add all loot", NextAction::array(0, new NextAction("add all loot", relevance),
|
|
new NextAction("loot", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("u", NextAction::array(0, new NextAction("use", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("c", NextAction::array(0, new NextAction("item count", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("items", NextAction::array(0, new NextAction("item count", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("inv", NextAction::array(0, new NextAction("item count", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("e", NextAction::array(0, new NextAction("equip", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("ue", NextAction::array(0, new NextAction("unequip", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("t", NextAction::array(0, new NextAction("trade", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("nt", NextAction::array(0, new NextAction("trade", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("s", NextAction::array(0, new NextAction("sell", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("b", NextAction::array(0, new NextAction("buy", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("r", NextAction::array(0, new NextAction("reward", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("attack", NextAction::array(0, new NextAction("attack my target", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("accept", NextAction::array(0, new NextAction("accept quest", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("follow", NextAction::array(0, new NextAction("follow chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("stay", NextAction::array(0, new NextAction("stay chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("move from group", NextAction::array(0, new NextAction("move from group chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("flee", NextAction::array(0, new NextAction("flee chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode(
|
|
"tank attack", NextAction::array(0, new NextAction("tank attack chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("grind", NextAction::array(0, new NextAction("grind chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("talk", NextAction::array(0, new NextAction("gossip hello", relevance),
|
|
new NextAction("talk to quest giver", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("enter vehicle", NextAction::array(0, new NextAction("enter vehicle", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("leave vehicle", NextAction::array(0, new NextAction("leave vehicle", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("cast", NextAction::array(0, new NextAction("cast custom spell", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("castnc", NextAction::array(0, new NextAction("cast custom nc spell", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("revive", NextAction::array(0, new NextAction("spirit healer", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("runaway", NextAction::array(0, new NextAction("runaway chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("warning", NextAction::array(0, new NextAction("runaway chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("max dps", NextAction::array(0, new NextAction("max dps chat shortcut", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("attackers", NextAction::array(0, new NextAction("tell attackers", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("target", NextAction::array(0, new NextAction("tell target", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("ready", NextAction::array(0, new NextAction("ready check", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("naxx", NextAction::array(0, new NextAction("naxx chat shortcut", relevance), NULL)));
|
|
triggers.push_back(
|
|
new TriggerNode("bwl", NextAction::array(0, new NextAction("bwl chat shortcut", relevance), NULL)));
|
|
triggers.push_back(
|
|
new TriggerNode("dps", NextAction::array(0, new NextAction("tell estimated dps", relevance), NULL)));
|
|
triggers.push_back(
|
|
new TriggerNode("disperse", NextAction::array(0, new NextAction("disperse set", relevance), NULL)));
|
|
triggers.push_back(
|
|
new TriggerNode("open items", NextAction::array(0, new NextAction("open items", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("qi", NextAction::array(0, new NextAction("query item usage", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("unlock items", NextAction::array(0, new NextAction("unlock items", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("unlock traded item", NextAction::array(0, new NextAction("unlock traded item", relevance), nullptr)));
|
|
triggers.push_back(
|
|
new TriggerNode("wipe", NextAction::array(0, new NextAction("wipe", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("tame", NextAction::array(0, new NextAction("tame", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("glyphs", NextAction::array(0, new NextAction("glyphs", relevance), nullptr))); // Added for custom Glyphs
|
|
triggers.push_back(new TriggerNode("glyph equip", NextAction::array(0, new NextAction("glyph equip", relevance), nullptr))); // Added for custom Glyphs
|
|
triggers.push_back(new TriggerNode("pet", NextAction::array(0, new NextAction("pet", relevance), nullptr)));
|
|
triggers.push_back(new TriggerNode("pet attack", NextAction::array(0, new NextAction("pet attack", relevance), nullptr)));
|
|
}
|
|
|
|
ChatCommandHandlerStrategy::ChatCommandHandlerStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI)
|
|
{
|
|
actionNodeFactories.Add(new ChatCommandActionNodeFactoryInternal());
|
|
|
|
supported.push_back("quests");
|
|
supported.push_back("stats");
|
|
supported.push_back("leave");
|
|
supported.push_back("reputation");
|
|
supported.push_back("log");
|
|
supported.push_back("los");
|
|
supported.push_back("rpg status");
|
|
supported.push_back("rpg do quest");
|
|
supported.push_back("aura");
|
|
supported.push_back("drop");
|
|
supported.push_back("share");
|
|
supported.push_back("ll");
|
|
supported.push_back("ss");
|
|
supported.push_back("release");
|
|
supported.push_back("teleport");
|
|
supported.push_back("taxi");
|
|
supported.push_back("repair");
|
|
supported.push_back("talents");
|
|
supported.push_back("spells");
|
|
supported.push_back("co");
|
|
supported.push_back("nc");
|
|
supported.push_back("de");
|
|
supported.push_back("trainer");
|
|
supported.push_back("maintenance");
|
|
supported.push_back("remove glyph");
|
|
supported.push_back("autogear");
|
|
supported.push_back("equip upgrade");
|
|
supported.push_back("chat");
|
|
supported.push_back("home");
|
|
supported.push_back("destroy");
|
|
supported.push_back("reset botAI");
|
|
supported.push_back("emote");
|
|
supported.push_back("buff");
|
|
supported.push_back("help");
|
|
supported.push_back("gb");
|
|
supported.push_back("bank");
|
|
supported.push_back("invite");
|
|
supported.push_back("lfg");
|
|
supported.push_back("spell");
|
|
supported.push_back("rti");
|
|
supported.push_back("position");
|
|
supported.push_back("summon");
|
|
supported.push_back("who");
|
|
supported.push_back("save mana");
|
|
supported.push_back("formation");
|
|
supported.push_back("stance");
|
|
supported.push_back("sendmail");
|
|
supported.push_back("mail");
|
|
supported.push_back("outfit");
|
|
supported.push_back("go");
|
|
supported.push_back("debug");
|
|
supported.push_back("cdebug");
|
|
supported.push_back("cs");
|
|
supported.push_back("wts");
|
|
supported.push_back("hire");
|
|
supported.push_back("craft");
|
|
supported.push_back("flag");
|
|
supported.push_back("range");
|
|
supported.push_back("ra");
|
|
supported.push_back("give leader");
|
|
supported.push_back("cheat");
|
|
supported.push_back("ginvite");
|
|
supported.push_back("guild promote");
|
|
supported.push_back("guild demote");
|
|
supported.push_back("guild remove");
|
|
supported.push_back("guild leave");
|
|
supported.push_back("rtsc");
|
|
supported.push_back("drink");
|
|
supported.push_back("calc");
|
|
supported.push_back("open items");
|
|
supported.push_back("qi");
|
|
supported.push_back("unlock items");
|
|
supported.push_back("unlock traded item");
|
|
supported.push_back("tame");
|
|
supported.push_back("glyphs"); // Added for custom Glyphs
|
|
supported.push_back("glyph equip"); // Added for custom Glyphs
|
|
supported.push_back("pet");
|
|
supported.push_back("pet attack");
|
|
}
|