- Added chat command to wipe group (#1408)

This commit is contained in:
kadeshar
2025-07-04 17:14:07 +02:00
committed by GitHub
parent c0aa55416b
commit 305f769a84
5 changed files with 49 additions and 0 deletions

View File

@@ -73,6 +73,7 @@
#include "UseItemAction.h"
#include "UseMeetingStoneAction.h"
#include "WhoAction.h"
#include "WipeAction.h"
#include "WtsAction.h"
#include "OpenItemAction.h"
#include "UnlockItemAction.h"
@@ -185,6 +186,7 @@ public:
creators["join"] = &ChatActionContext::join;
creators["lfg"] = &ChatActionContext::lfg;
creators["calc"] = &ChatActionContext::calc;
creators["wipe"] = &ChatActionContext::wipe;
}
private:
@@ -290,6 +292,7 @@ private:
static Action* tell_estimated_dps(PlayerbotAI* ai) { return new TellEstimatedDpsAction(ai); }
static Action* join(PlayerbotAI* ai) { return new JoinGroupAction(ai); }
static Action* calc(PlayerbotAI* ai) { return new TellCalculateItemAction(ai); }
static Action* wipe(PlayerbotAI* ai) { return new WipeAction(ai); }
};
#endif

View File

@@ -0,0 +1,18 @@
/*
* 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 "PlayerbotAI.h"
#include "WipeAction.h"
bool WipeAction::Execute(Event event)
{
Player* master = event.getOwner();
if (botAI->GetMaster()->GetGUID() != event.getOwner()->GetGUID())
return false;
bot->Kill(bot, bot);
return true;
}

View File

@@ -0,0 +1,24 @@
/*
* 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.
*/
#ifndef _PLAYERBOT_WIPEACTION_H
#define _PLAYERBOT_WIPEACTION_H
#include "Action.h"
class PlayerbotAI;
class WipeAction : public Action
{
public:
WipeAction(PlayerbotAI* botAI) : Action(botAI, "wipe") {}
bool Execute(Event event) override;
private:
std::string bossName;
};
#endif

View File

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

View File

@@ -132,6 +132,7 @@ public:
creators["disperse"] = &ChatTriggerContext::disperse;
creators["calc"] = &ChatTriggerContext::calc;
creators["qi"] = &ChatTriggerContext::qi;
creators["wipe"] = &ChatTriggerContext::wipe;
}
private:
@@ -243,6 +244,7 @@ private:
static Trigger* disperse(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, "disperse"); }
static Trigger* calc(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, "calc"); }
static Trigger* qi(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "qi"); }
static Trigger* wipe(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "wipe"); }
};
#endif