mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
- Added chat command to wipe group (#1408)
This commit is contained in:
@@ -73,6 +73,7 @@
|
|||||||
#include "UseItemAction.h"
|
#include "UseItemAction.h"
|
||||||
#include "UseMeetingStoneAction.h"
|
#include "UseMeetingStoneAction.h"
|
||||||
#include "WhoAction.h"
|
#include "WhoAction.h"
|
||||||
|
#include "WipeAction.h"
|
||||||
#include "WtsAction.h"
|
#include "WtsAction.h"
|
||||||
#include "OpenItemAction.h"
|
#include "OpenItemAction.h"
|
||||||
#include "UnlockItemAction.h"
|
#include "UnlockItemAction.h"
|
||||||
@@ -185,6 +186,7 @@ public:
|
|||||||
creators["join"] = &ChatActionContext::join;
|
creators["join"] = &ChatActionContext::join;
|
||||||
creators["lfg"] = &ChatActionContext::lfg;
|
creators["lfg"] = &ChatActionContext::lfg;
|
||||||
creators["calc"] = &ChatActionContext::calc;
|
creators["calc"] = &ChatActionContext::calc;
|
||||||
|
creators["wipe"] = &ChatActionContext::wipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -290,6 +292,7 @@ private:
|
|||||||
static Action* tell_estimated_dps(PlayerbotAI* ai) { return new TellEstimatedDpsAction(ai); }
|
static Action* tell_estimated_dps(PlayerbotAI* ai) { return new TellEstimatedDpsAction(ai); }
|
||||||
static Action* join(PlayerbotAI* ai) { return new JoinGroupAction(ai); }
|
static Action* join(PlayerbotAI* ai) { return new JoinGroupAction(ai); }
|
||||||
static Action* calc(PlayerbotAI* ai) { return new TellCalculateItemAction(ai); }
|
static Action* calc(PlayerbotAI* ai) { return new TellCalculateItemAction(ai); }
|
||||||
|
static Action* wipe(PlayerbotAI* ai) { return new WipeAction(ai); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
18
src/strategy/actions/WipeAction.cpp
Normal file
18
src/strategy/actions/WipeAction.cpp
Normal 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;
|
||||||
|
}
|
||||||
24
src/strategy/actions/WipeAction.h
Normal file
24
src/strategy/actions/WipeAction.h
Normal 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
|
||||||
@@ -100,6 +100,8 @@ void ChatCommandHandlerStrategy::InitTriggers(std::vector<TriggerNode*>& trigger
|
|||||||
new TriggerNode("unlock items", NextAction::array(0, new NextAction("unlock items", relevance), nullptr)));
|
new TriggerNode("unlock items", NextAction::array(0, new NextAction("unlock items", relevance), nullptr)));
|
||||||
triggers.push_back(
|
triggers.push_back(
|
||||||
new TriggerNode("unlock traded item", NextAction::array(0, new NextAction("unlock traded item", relevance), nullptr)));
|
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)
|
ChatCommandHandlerStrategy::ChatCommandHandlerStrategy(PlayerbotAI* botAI) : PassTroughStrategy(botAI)
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ public:
|
|||||||
creators["disperse"] = &ChatTriggerContext::disperse;
|
creators["disperse"] = &ChatTriggerContext::disperse;
|
||||||
creators["calc"] = &ChatTriggerContext::calc;
|
creators["calc"] = &ChatTriggerContext::calc;
|
||||||
creators["qi"] = &ChatTriggerContext::qi;
|
creators["qi"] = &ChatTriggerContext::qi;
|
||||||
|
creators["wipe"] = &ChatTriggerContext::wipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -243,6 +244,7 @@ private:
|
|||||||
static Trigger* disperse(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, "disperse"); }
|
static Trigger* disperse(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, "disperse"); }
|
||||||
static Trigger* calc(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, "calc"); }
|
static Trigger* calc(PlayerbotAI* ai) { return new ChatCommandTrigger(ai, "calc"); }
|
||||||
static Trigger* qi(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "qi"); }
|
static Trigger* qi(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "qi"); }
|
||||||
|
static Trigger* wipe(PlayerbotAI* botAI) { return new ChatCommandTrigger(botAI, "wipe"); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user