naxx chat short cut

This commit is contained in:
Yunfan Li
2023-06-11 23:20:57 +08:00
parent 81149246c4
commit c9367debeb
6 changed files with 26 additions and 2 deletions

View File

@@ -164,6 +164,7 @@ class ChatActionContext : public NamedObjectContext<Action>
creators["guild remove"] = &ChatActionContext::guild_remove;
creators["guild leave"] = &ChatActionContext::guild_leave;
creators["rtsc"] = &ChatActionContext::rtsc;
creators["naxx chat shortcut"] = &ChatActionContext::naxx_chat_shortcut;
}
private:
@@ -253,6 +254,7 @@ class ChatActionContext : public NamedObjectContext<Action>
static Action* guild_remove(PlayerbotAI* botAI) { return new GuildRemoveAction(botAI); }
static Action* guild_leave(PlayerbotAI* botAI) { return new GuildLeaveAction(botAI); }
static Action* rtsc(PlayerbotAI* botAI) { return new RTSCAction(botAI); }
static Action* naxx_chat_shortcut(PlayerbotAI* ai) { return new NaxxChatShortcutAction(ai); }
};
#endif

View File

@@ -188,3 +188,16 @@ bool MaxDpsChatShortcutAction::Execute(Event event)
return true;
}
bool NaxxChatShortcutAction::Execute(Event event)
{
Player* master = GetMaster();
if (!master)
return false;
botAI->Reset();
botAI->ChangeStrategy("+naxx", BOT_STATE_NON_COMBAT);
botAI->ChangeStrategy("+naxx", BOT_STATE_COMBAT);
bot->Say("Add Naxx Strategies!", LANG_UNIVERSAL);
return true;
}

View File

@@ -74,4 +74,10 @@ class MaxDpsChatShortcutAction : public Action
bool Execute(Event event) override;
};
class NaxxChatShortcutAction : public Action
{
public:
NaxxChatShortcutAction(PlayerbotAI* ai) : Action(ai, "naxx chat shortcut") {}
virtual bool Execute(Event event);
};
#endif

View File

@@ -28,8 +28,8 @@ float CastTimeMultiplier::GetValue(Action* action)
return 1.0f;
uint32 castTime = spellInfo->CalcCastTime();
if (castTime >= 3000)
return 0.0f;
// if (castTime >= 3000)
// return 0.0f;
if (castTime >= 1500)
return 0.5f;

View File

@@ -58,6 +58,7 @@ void ChatCommandHandlerStrategy::InitTriggers(std::vector<TriggerNode*>& trigger
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)));
}
ChatCommandHandlerStrategy::ChatCommandHandlerStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI)

View File

@@ -112,6 +112,7 @@ class ChatTriggerContext : public NamedObjectContext<Trigger>
creators["guild leave"] = &ChatTriggerContext::guild_leave;
creators["rtsc"] = &ChatTriggerContext::rtsc;
creators["drink"] = &ChatTriggerContext::drink;
creators["naxx"] = &ChatTriggerContext::naxx;
}
private:
@@ -204,6 +205,7 @@ class ChatTriggerContext : public NamedObjectContext<Trigger>
static Trigger* guild_leave(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "guild leave"); }
static Trigger* rtsc(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "rtsc"); }
static Trigger* drink(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, "drink"); }
static Trigger* naxx(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, "naxx"); }
};
#endif