mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-18 11:15:43 +00:00
Run clang-format
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Action.h"
|
||||
|
||||
#include "Playerbots.h"
|
||||
#include "Timer.h"
|
||||
|
||||
@@ -66,8 +68,7 @@ NextAction** NextAction::array(uint32 nil, ...)
|
||||
{
|
||||
cur = va_arg(vl, NextAction*);
|
||||
++size;
|
||||
}
|
||||
while (cur);
|
||||
} while (cur);
|
||||
|
||||
va_end(vl);
|
||||
|
||||
@@ -85,28 +86,19 @@ void NextAction::destroy(NextAction** actions)
|
||||
if (!actions)
|
||||
return;
|
||||
|
||||
for (uint32 i=0; actions[i]; i++)
|
||||
for (uint32 i = 0; actions[i]; i++)
|
||||
delete actions[i];
|
||||
|
||||
delete[] actions;
|
||||
}
|
||||
|
||||
Value<Unit*>* Action::GetTargetValue()
|
||||
{
|
||||
return context->GetValue<Unit*>(GetTargetName());
|
||||
}
|
||||
Value<Unit*>* Action::GetTargetValue() { return context->GetValue<Unit*>(GetTargetName()); }
|
||||
|
||||
Unit* Action::GetTarget()
|
||||
{
|
||||
return GetTargetValue()->Get();
|
||||
}
|
||||
Unit* Action::GetTarget() { return GetTargetValue()->Get(); }
|
||||
|
||||
ActionBasket::ActionBasket(ActionNode* action, float relevance, bool skipPrerequisites, Event event) :
|
||||
action(action), relevance(relevance), skipPrerequisites(skipPrerequisites), event(event), created(getMSTime())
|
||||
ActionBasket::ActionBasket(ActionNode* action, float relevance, bool skipPrerequisites, Event event)
|
||||
: action(action), relevance(relevance), skipPrerequisites(skipPrerequisites), event(event), created(getMSTime())
|
||||
{
|
||||
}
|
||||
|
||||
bool ActionBasket::isExpired(uint32 msecs)
|
||||
{
|
||||
return getMSTime() - created >= msecs;
|
||||
}
|
||||
bool ActionBasket::isExpired(uint32 msecs) { return getMSTime() - created >= msecs; }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ACTION_H
|
||||
@@ -15,108 +16,119 @@ class Unit;
|
||||
|
||||
class NextAction
|
||||
{
|
||||
public:
|
||||
NextAction(std::string const name, float relevance = 0.0f) : relevance(relevance), name(name) { } // name after relevance - whipowill
|
||||
NextAction(NextAction const& o) : relevance(o.relevance), name(o.name) { } // name after relevance - whipowill
|
||||
public:
|
||||
NextAction(std::string const name, float relevance = 0.0f)
|
||||
: relevance(relevance), name(name) {} // name after relevance - whipowill
|
||||
NextAction(NextAction const& o) : relevance(o.relevance), name(o.name) {} // name after relevance - whipowill
|
||||
|
||||
std::string const getName() { return name; }
|
||||
float getRelevance() {return relevance;}
|
||||
std::string const getName() { return name; }
|
||||
float getRelevance() { return relevance; }
|
||||
|
||||
static uint32 size(NextAction** actions);
|
||||
static NextAction** clone(NextAction** actions);
|
||||
static NextAction** merge(NextAction** what, NextAction** with);
|
||||
static NextAction** array(uint32 nil,...);
|
||||
static void destroy(NextAction** actions);
|
||||
static uint32 size(NextAction** actions);
|
||||
static NextAction** clone(NextAction** actions);
|
||||
static NextAction** merge(NextAction** what, NextAction** with);
|
||||
static NextAction** array(uint32 nil, ...);
|
||||
static void destroy(NextAction** actions);
|
||||
|
||||
private:
|
||||
float relevance;
|
||||
std::string const name;
|
||||
private:
|
||||
float relevance;
|
||||
std::string const name;
|
||||
};
|
||||
|
||||
class Action : public AiNamedObject
|
||||
{
|
||||
public:
|
||||
enum class ActionThreatType
|
||||
{
|
||||
None = 0,
|
||||
Single = 1,
|
||||
Aoe = 2
|
||||
};
|
||||
public:
|
||||
enum class ActionThreatType
|
||||
{
|
||||
None = 0,
|
||||
Single = 1,
|
||||
Aoe = 2
|
||||
};
|
||||
|
||||
Action(PlayerbotAI* botAI, std::string const name = "action") : AiNamedObject(botAI, name), verbose(false) { } // verbose after ainamedobject - whipowill
|
||||
virtual ~Action(void) { }
|
||||
Action(PlayerbotAI* botAI, std::string const name = "action")
|
||||
: AiNamedObject(botAI, name), verbose(false) {} // verbose after ainamedobject - whipowill
|
||||
virtual ~Action(void) {}
|
||||
|
||||
virtual bool Execute([[maybe_unused]] Event event) { return true; }
|
||||
virtual bool isPossible() { return true; }
|
||||
virtual bool isUseful() { return true; }
|
||||
virtual NextAction** getPrerequisites() { return nullptr; }
|
||||
virtual NextAction** getAlternatives() { return nullptr; }
|
||||
virtual NextAction** getContinuers() { return nullptr; }
|
||||
virtual ActionThreatType getThreatType() { return ActionThreatType::None; }
|
||||
void Update() { }
|
||||
void Reset() { }
|
||||
virtual Unit* GetTarget();
|
||||
virtual Value<Unit*>* GetTargetValue();
|
||||
virtual std::string const GetTargetName() { return "self target"; }
|
||||
void MakeVerbose() { verbose = true; }
|
||||
void setRelevance(uint32 relevance1) { relevance = relevance1; };
|
||||
virtual float getRelevance() { return relevance; }
|
||||
virtual bool Execute([[maybe_unused]] Event event) { return true; }
|
||||
virtual bool isPossible() { return true; }
|
||||
virtual bool isUseful() { return true; }
|
||||
virtual NextAction** getPrerequisites() { return nullptr; }
|
||||
virtual NextAction** getAlternatives() { return nullptr; }
|
||||
virtual NextAction** getContinuers() { return nullptr; }
|
||||
virtual ActionThreatType getThreatType() { return ActionThreatType::None; }
|
||||
void Update() {}
|
||||
void Reset() {}
|
||||
virtual Unit* GetTarget();
|
||||
virtual Value<Unit*>* GetTargetValue();
|
||||
virtual std::string const GetTargetName() { return "self target"; }
|
||||
void MakeVerbose() { verbose = true; }
|
||||
void setRelevance(uint32 relevance1) { relevance = relevance1; };
|
||||
virtual float getRelevance() { return relevance; }
|
||||
|
||||
protected:
|
||||
bool verbose;
|
||||
float relevance = 0;
|
||||
protected:
|
||||
bool verbose;
|
||||
float relevance = 0;
|
||||
};
|
||||
|
||||
class ActionNode
|
||||
{
|
||||
public:
|
||||
ActionNode(std::string const name, NextAction** prerequisites = nullptr, NextAction** alternatives = nullptr, NextAction** continuers = nullptr) :
|
||||
name(name), action(nullptr), continuers(continuers), alternatives(alternatives), prerequisites(prerequisites) { } // reorder arguments - whipowill
|
||||
public:
|
||||
ActionNode(std::string const name, NextAction** prerequisites = nullptr, NextAction** alternatives = nullptr,
|
||||
NextAction** continuers = nullptr)
|
||||
: name(name), action(nullptr), continuers(continuers), alternatives(alternatives), prerequisites(prerequisites)
|
||||
{
|
||||
} // reorder arguments - whipowill
|
||||
|
||||
virtual ~ActionNode()
|
||||
{
|
||||
NextAction::destroy(prerequisites);
|
||||
NextAction::destroy(alternatives);
|
||||
NextAction::destroy(continuers);
|
||||
}
|
||||
virtual ~ActionNode()
|
||||
{
|
||||
NextAction::destroy(prerequisites);
|
||||
NextAction::destroy(alternatives);
|
||||
NextAction::destroy(continuers);
|
||||
}
|
||||
|
||||
Action* getAction() { return action; }
|
||||
void setAction(Action* action) { this->action = action; }
|
||||
std::string const getName() { return name; }
|
||||
Action* getAction() { return action; }
|
||||
void setAction(Action* action) { this->action = action; }
|
||||
std::string const getName() { return name; }
|
||||
|
||||
NextAction** getContinuers() { return NextAction::merge(NextAction::clone(continuers), action->getContinuers()); }
|
||||
NextAction** getAlternatives() { return NextAction::merge(NextAction::clone(alternatives), action->getAlternatives()); }
|
||||
NextAction** getPrerequisites() { return NextAction::merge(NextAction::clone(prerequisites), action->getPrerequisites()); }
|
||||
NextAction** getContinuers() { return NextAction::merge(NextAction::clone(continuers), action->getContinuers()); }
|
||||
NextAction** getAlternatives()
|
||||
{
|
||||
return NextAction::merge(NextAction::clone(alternatives), action->getAlternatives());
|
||||
}
|
||||
NextAction** getPrerequisites()
|
||||
{
|
||||
return NextAction::merge(NextAction::clone(prerequisites), action->getPrerequisites());
|
||||
}
|
||||
|
||||
private:
|
||||
std::string const name;
|
||||
Action* action;
|
||||
NextAction** continuers;
|
||||
NextAction** alternatives;
|
||||
NextAction** prerequisites;
|
||||
private:
|
||||
std::string const name;
|
||||
Action* action;
|
||||
NextAction** continuers;
|
||||
NextAction** alternatives;
|
||||
NextAction** prerequisites;
|
||||
};
|
||||
|
||||
class ActionBasket
|
||||
{
|
||||
public:
|
||||
ActionBasket(ActionNode* action, float relevance, bool skipPrerequisites, Event event);
|
||||
public:
|
||||
ActionBasket(ActionNode* action, float relevance, bool skipPrerequisites, Event event);
|
||||
|
||||
virtual ~ActionBasket(void) { }
|
||||
virtual ~ActionBasket(void) {}
|
||||
|
||||
float getRelevance() {return relevance;}
|
||||
ActionNode* getAction() {return action;}
|
||||
Event getEvent() { return event; }
|
||||
bool isSkipPrerequisites() { return skipPrerequisites; }
|
||||
void AmendRelevance(float k) { relevance *= k; }
|
||||
void setRelevance(float relevance) { this->relevance = relevance; }
|
||||
bool isExpired(uint32 msecs);
|
||||
float getRelevance() { return relevance; }
|
||||
ActionNode* getAction() { return action; }
|
||||
Event getEvent() { return event; }
|
||||
bool isSkipPrerequisites() { return skipPrerequisites; }
|
||||
void AmendRelevance(float k) { relevance *= k; }
|
||||
void setRelevance(float relevance) { this->relevance = relevance; }
|
||||
bool isExpired(uint32 msecs);
|
||||
|
||||
private:
|
||||
ActionNode* action;
|
||||
float relevance;
|
||||
bool skipPrerequisites;
|
||||
Event event;
|
||||
uint32 created;
|
||||
private:
|
||||
ActionNode* action;
|
||||
float relevance;
|
||||
bool skipPrerequisites;
|
||||
Event event;
|
||||
uint32 created;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AiObject.h"
|
||||
|
||||
#include "Playerbots.h"
|
||||
|
||||
AiObject::AiObject(PlayerbotAI* botAI) : PlayerbotAIAware(botAI), bot(botAI->GetBot()), context(botAI->GetAiObjectContext()), chat(botAI->GetChatHelper())
|
||||
AiObject::AiObject(PlayerbotAI* botAI)
|
||||
: PlayerbotAIAware(botAI), bot(botAI->GetBot()), context(botAI->GetAiObjectContext()), chat(botAI->GetChatHelper())
|
||||
{
|
||||
}
|
||||
|
||||
Player* AiObject::GetMaster()
|
||||
{
|
||||
return botAI->GetMaster();
|
||||
}
|
||||
Player* AiObject::GetMaster() { return botAI->GetMaster(); }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_AIOBJECT_H
|
||||
@@ -15,26 +16,26 @@ class PlayerbotAI;
|
||||
|
||||
class AiObject : public PlayerbotAIAware
|
||||
{
|
||||
public:
|
||||
AiObject(PlayerbotAI* botAI);
|
||||
public:
|
||||
AiObject(PlayerbotAI* botAI);
|
||||
|
||||
protected:
|
||||
Player* bot;
|
||||
Player* GetMaster();
|
||||
AiObjectContext* context;
|
||||
ChatHelper* chat;
|
||||
protected:
|
||||
Player* bot;
|
||||
Player* GetMaster();
|
||||
AiObjectContext* context;
|
||||
ChatHelper* chat;
|
||||
};
|
||||
|
||||
class AiNamedObject : public AiObject
|
||||
{
|
||||
public:
|
||||
AiNamedObject(PlayerbotAI* botAI, std::string const name) : AiObject(botAI), name(name) { }
|
||||
public:
|
||||
AiNamedObject(PlayerbotAI* botAI, std::string const name) : AiObject(botAI), name(name) {}
|
||||
|
||||
public:
|
||||
virtual std::string const getName() { return name; }
|
||||
public:
|
||||
virtual std::string const getName() { return name; }
|
||||
|
||||
protected:
|
||||
std::string const name;
|
||||
protected:
|
||||
std::string const name;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -44,475 +45,469 @@ class AiNamedObject : public AiObject
|
||||
#define NEXT_TRIGGERS(name, relevance) \
|
||||
virtual NextAction* getNextAction() { return new NextAction(name, relevance); }
|
||||
|
||||
#define BEGIN_TRIGGER(clazz, super) \
|
||||
class clazz : public super \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : super(botAI) { } \
|
||||
bool IsActive() override; \
|
||||
#define BEGIN_TRIGGER(clazz, super) \
|
||||
class clazz : public super \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : super(botAI) {} \
|
||||
bool IsActive() override;
|
||||
|
||||
#define END_TRIGGER() \
|
||||
};
|
||||
} \
|
||||
;
|
||||
|
||||
#define BUFF_TRIGGER(clazz, spell) \
|
||||
class clazz : public BuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define BUFF_TRIGGER(clazz, spell) \
|
||||
class clazz : public BuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define BUFF_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public BuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define BUFF_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public BuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define BUFF_PARTY_TRIGGER(clazz, spell) \
|
||||
class clazz : public BuffOnPartyTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define BUFF_PARTY_TRIGGER(clazz, spell) \
|
||||
class clazz : public BuffOnPartyTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define BUFF_PARTY_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public BuffOnPartyTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define BUFF_PARTY_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public BuffOnPartyTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffOnPartyTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define DEBUFF_TRIGGER(clazz, spell) \
|
||||
class clazz : public DebuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define DEBUFF_TRIGGER(clazz, spell) \
|
||||
class clazz : public DebuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define DEBUFF_CHECKISOWNER_TRIGGER(clazz, spell) \
|
||||
class clazz : public DebuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffTrigger(botAI, spell, 1, true) { } \
|
||||
}
|
||||
#define DEBUFF_CHECKISOWNER_TRIGGER(clazz, spell) \
|
||||
class clazz : public DebuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffTrigger(botAI, spell, 1, true) {} \
|
||||
}
|
||||
|
||||
#define DEBUFF_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public DebuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define DEBUFF_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public DebuffTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define DEBUFF_ENEMY_TRIGGER(clazz, spell) \
|
||||
class clazz : public DebuffOnAttackerTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffOnAttackerTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define DEBUFF_ENEMY_TRIGGER(clazz, spell) \
|
||||
class clazz : public DebuffOnAttackerTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffOnAttackerTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define DEBUFF_ENEMY_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public DebuffOnAttackerTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffOnAttackerTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define DEBUFF_ENEMY_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public DebuffOnAttackerTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DebuffOnAttackerTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define CURE_TRIGGER(clazz, spell, dispel) \
|
||||
class clazz : public NeedCureTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : NeedCureTrigger(botAI, spell, dispel) { } \
|
||||
}
|
||||
#define CURE_TRIGGER(clazz, spell, dispel) \
|
||||
class clazz : public NeedCureTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : NeedCureTrigger(botAI, spell, dispel) {} \
|
||||
}
|
||||
|
||||
#define CURE_PARTY_TRIGGER(clazz, spell, dispel) \
|
||||
class clazz : public PartyMemberNeedCureTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : PartyMemberNeedCureTrigger(botAI, spell, dispel) { } \
|
||||
}
|
||||
#define CURE_PARTY_TRIGGER(clazz, spell, dispel) \
|
||||
class clazz : public PartyMemberNeedCureTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : PartyMemberNeedCureTrigger(botAI, spell, dispel) {} \
|
||||
}
|
||||
|
||||
#define CAN_CAST_TRIGGER(clazz, spell) \
|
||||
class clazz : public SpellCanBeCastTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SpellCanBeCastTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define CAN_CAST_TRIGGER(clazz, spell) \
|
||||
class clazz : public SpellCanBeCastTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SpellCanBeCastTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define CAN_CAST_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public SpellCanBeCastTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SpellCanBeCastTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define CAN_CAST_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public SpellCanBeCastTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SpellCanBeCastTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define CD_TRIGGER(clazz, spell) \
|
||||
class clazz : public SpellNoCooldownTrigger \
|
||||
{ \
|
||||
public: \
|
||||
#define CD_TRIGGER(clazz, spell) \
|
||||
class clazz : public SpellNoCooldownTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SpellNoCooldownTrigger(botAI, spell) {} \
|
||||
}
|
||||
}
|
||||
|
||||
#define INTERRUPT_TRIGGER(clazz, spell) \
|
||||
class clazz : public InterruptSpellTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : InterruptSpellTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define INTERRUPT_TRIGGER(clazz, spell) \
|
||||
class clazz : public InterruptSpellTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : InterruptSpellTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define INTERRUPT_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public InterruptSpellTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : InterruptSpellTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define INTERRUPT_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public InterruptSpellTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : InterruptSpellTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define HAS_AURA_TRIGGER(clazz, spell) \
|
||||
class clazz : public HasAuraTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : HasAuraTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define HAS_AURA_TRIGGER(clazz, spell) \
|
||||
class clazz : public HasAuraTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : HasAuraTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define HAS_AURA_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public HasAuraTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : HasAuraTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define HAS_AURA_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public HasAuraTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : HasAuraTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define SNARE_TRIGGER(clazz, spell) \
|
||||
class clazz : public SnareTargetTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SnareTargetTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define SNARE_TRIGGER(clazz, spell) \
|
||||
class clazz : public SnareTargetTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SnareTargetTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define SNARE_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public SnareTargetTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SnareTargetTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define SNARE_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public SnareTargetTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : SnareTargetTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define PROTECT_TRIGGER(clazz, spell) \
|
||||
class clazz : public ProtectPartyMemberTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : ProtectPartyMemberTrigger(botAI) { } \
|
||||
}
|
||||
#define PROTECT_TRIGGER(clazz, spell) \
|
||||
class clazz : public ProtectPartyMemberTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : ProtectPartyMemberTrigger(botAI) {} \
|
||||
}
|
||||
|
||||
#define DEFLECT_TRIGGER(clazz, spell) \
|
||||
class clazz : public DeflectSpellTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DeflectSpellTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define DEFLECT_TRIGGER(clazz, spell) \
|
||||
class clazz : public DeflectSpellTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : DeflectSpellTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define BOOST_TRIGGER(clazz, spell) \
|
||||
class clazz : public BoostTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BoostTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define BOOST_TRIGGER(clazz, spell) \
|
||||
class clazz : public BoostTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BoostTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define BOOST_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public BoostTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BoostTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define BOOST_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public BoostTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BoostTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define INTERRUPT_HEALER_TRIGGER(clazz, spell) \
|
||||
class clazz : public InterruptEnemyHealerTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : InterruptEnemyHealerTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define INTERRUPT_HEALER_TRIGGER(clazz, spell) \
|
||||
class clazz : public InterruptEnemyHealerTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : InterruptEnemyHealerTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define INTERRUPT_HEALER_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public InterruptEnemyHealerTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : InterruptEnemyHealerTrigger(botAI, spell) { } \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
#define INTERRUPT_HEALER_TRIGGER_A(clazz, spell) \
|
||||
class clazz : public InterruptEnemyHealerTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : InterruptEnemyHealerTrigger(botAI, spell) {} \
|
||||
bool IsActive() override; \
|
||||
}
|
||||
|
||||
#define CC_TRIGGER(clazz, spell) \
|
||||
class clazz : public HasCcTargetTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : HasCcTargetTrigger(botAI, spell) { } \
|
||||
}
|
||||
#define CC_TRIGGER(clazz, spell) \
|
||||
class clazz : public HasCcTargetTrigger \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : HasCcTargetTrigger(botAI, spell) {} \
|
||||
}
|
||||
|
||||
//
|
||||
// ACTIONS
|
||||
//
|
||||
|
||||
#define MELEE_ACTION(clazz, spell) \
|
||||
class clazz : public CastMeleeSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define MELEE_ACTION(clazz, spell) \
|
||||
class clazz : public CastMeleeSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define MELEE_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastMeleeSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, spell) { } \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
#define MELEE_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastMeleeSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, spell) {} \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
|
||||
#define SPELL_ACTION(clazz, spell) \
|
||||
class clazz : public CastSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define SPELL_ACTION(clazz, spell) \
|
||||
class clazz : public CastSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define SPELL_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellAction(botAI, spell) { } \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
#define SPELL_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellAction(botAI, spell) {} \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
|
||||
#define HEAL_ACTION(clazz, spell) \
|
||||
class clazz : public CastHealingSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define HEAL_ACTION(clazz, spell) \
|
||||
class clazz : public CastHealingSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define HEAL_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastHealingSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, spell) { } \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
#define HEAL_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastHealingSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastHealingSpellAction(botAI, spell) {} \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
|
||||
#define HEAL_PARTY_ACTION(clazz, spell, estAmount, manaEfficiency) \
|
||||
class clazz : public HealPartyMemberAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, spell, estAmount, manaEfficiency) { } \
|
||||
}
|
||||
#define HEAL_PARTY_ACTION(clazz, spell, estAmount, manaEfficiency) \
|
||||
class clazz : public HealPartyMemberAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : HealPartyMemberAction(botAI, spell, estAmount, manaEfficiency) {} \
|
||||
}
|
||||
|
||||
#define AOE_HEAL_ACTION(clazz, spell, estAmount, manaEfficiency) \
|
||||
class clazz : public CastAoeHealSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastAoeHealSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define AOE_HEAL_ACTION(clazz, spell, estAmount, manaEfficiency) \
|
||||
class clazz : public CastAoeHealSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastAoeHealSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define BUFF_ACTION(clazz, spell) \
|
||||
class clazz : public CastBuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define BUFF_ACTION(clazz, spell) \
|
||||
class clazz : public CastBuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define BUFF_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastBuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, spell) { } \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
#define BUFF_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastBuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, spell) {} \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
|
||||
#define BUFF_PARTY_ACTION(clazz, spell) \
|
||||
class clazz : public BuffOnPartyAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffOnPartyAction(botAI, spell) { } \
|
||||
}
|
||||
#define BUFF_PARTY_ACTION(clazz, spell) \
|
||||
class clazz : public BuffOnPartyAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffOnPartyAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define CURE_ACTION(clazz, spell) \
|
||||
class clazz : public CastCureSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastCureSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define CURE_ACTION(clazz, spell) \
|
||||
class clazz : public CastCureSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastCureSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define CURE_PARTY_ACTION(clazz, spell, dispel) \
|
||||
class clazz : public CurePartyMemberAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CurePartyMemberAction(botAI, spell, dispel) { } \
|
||||
}
|
||||
#define CURE_PARTY_ACTION(clazz, spell, dispel) \
|
||||
class clazz : public CurePartyMemberAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CurePartyMemberAction(botAI, spell, dispel) {} \
|
||||
}
|
||||
|
||||
#define RESS_ACTION(clazz, spell) \
|
||||
class clazz : public ResurrectPartyMemberAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : ResurrectPartyMemberAction(botAI, spell) { } \
|
||||
}
|
||||
#define RESS_ACTION(clazz, spell) \
|
||||
class clazz : public ResurrectPartyMemberAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : ResurrectPartyMemberAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define DEBUFF_ACTION(clazz, spell) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define DEBUFF_ACTION(clazz, spell) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define DEBUFF_CHECKISOWNER_ACTION(clazz, spell) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, spell, true) { } \
|
||||
}
|
||||
#define DEBUFF_CHECKISOWNER_ACTION(clazz, spell) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, spell, true) {} \
|
||||
}
|
||||
|
||||
#define DEBUFF_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, spell) { } \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
#define DEBUFF_ACTION_U(clazz, spell, useful) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, spell) {} \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
|
||||
#define DEBUFF_ACTION_R(clazz, spell, distance) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, spell) \
|
||||
{ \
|
||||
range = distance; \
|
||||
} \
|
||||
}
|
||||
#define DEBUFF_ACTION_R(clazz, spell, distance) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, spell) { range = distance; } \
|
||||
}
|
||||
|
||||
#define DEBUFF_ENEMY_ACTION(clazz, spell) \
|
||||
class clazz : public CastDebuffSpellOnAttackerAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellOnAttackerAction(botAI, spell) { } \
|
||||
}
|
||||
#define DEBUFF_ENEMY_ACTION(clazz, spell) \
|
||||
class clazz : public CastDebuffSpellOnAttackerAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellOnAttackerAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define REACH_ACTION(clazz, spell, range) \
|
||||
class clazz : public CastReachTargetSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastReachTargetSpellAction(botAI, spell, range) { } \
|
||||
}
|
||||
#define REACH_ACTION(clazz, spell, range) \
|
||||
class clazz : public CastReachTargetSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastReachTargetSpellAction(botAI, spell, range) {} \
|
||||
}
|
||||
|
||||
#define REACH_ACTION_U(clazz, spell, range, useful) \
|
||||
class clazz : public CastReachTargetSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastReachTargetSpellAction(botAI, spell, range) { } \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
#define REACH_ACTION_U(clazz, spell, range, useful) \
|
||||
class clazz : public CastReachTargetSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastReachTargetSpellAction(botAI, spell, range) {} \
|
||||
bool isUseful() override { return useful; } \
|
||||
}
|
||||
|
||||
#define ENEMY_HEALER_ACTION(clazz, spell) \
|
||||
class clazz : public CastSpellOnEnemyHealerAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellOnEnemyHealerAction(botAI, spell) { } \
|
||||
}
|
||||
#define ENEMY_HEALER_ACTION(clazz, spell) \
|
||||
class clazz : public CastSpellOnEnemyHealerAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellOnEnemyHealerAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define SNARE_ACTION(clazz, spell) \
|
||||
class clazz : public CastSnareSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSnareSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define SNARE_ACTION(clazz, spell) \
|
||||
class clazz : public CastSnareSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSnareSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define CC_ACTION(clazz, spell) \
|
||||
class clazz : public CastCrowdControlSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastCrowdControlSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define CC_ACTION(clazz, spell) \
|
||||
class clazz : public CastCrowdControlSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastCrowdControlSpellAction(botAI, spell) { } \
|
||||
}
|
||||
|
||||
#define PROTECT_ACTION(clazz, spell) \
|
||||
class clazz : public CastProtectSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastProtectSpellAction(botAI, spell) { } \
|
||||
}
|
||||
#define PROTECT_ACTION(clazz, spell) \
|
||||
class clazz : public CastProtectSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastProtectSpellAction(botAI, spell) {} \
|
||||
}
|
||||
|
||||
#define END_RANGED_SPELL_ACTION() \
|
||||
};
|
||||
} \
|
||||
;
|
||||
|
||||
#define BEGIN_SPELL_ACTION(clazz, name) \
|
||||
class clazz : public CastSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellAction(botAI, name) { } \
|
||||
#define BEGIN_SPELL_ACTION(clazz, name) \
|
||||
class clazz : public CastSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellAction(botAI, name) {}
|
||||
|
||||
#define END_SPELL_ACTION() \
|
||||
};
|
||||
} \
|
||||
;
|
||||
|
||||
#define BEGIN_DEBUFF_ACTION(clazz, name) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, name) { } \
|
||||
#define BEGIN_DEBUFF_ACTION(clazz, name) \
|
||||
class clazz : public CastDebuffSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastDebuffSpellAction(botAI, name) {}
|
||||
|
||||
#define BEGIN_RANGED_SPELL_ACTION(clazz, name) \
|
||||
class clazz : public CastSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellAction(botAI, name) { } \
|
||||
class clazz : public CastSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastSpellAction(botAI, name) {}
|
||||
|
||||
#define BEGIN_MELEE_SPELL_ACTION(clazz, name) \
|
||||
class clazz : public CastMeleeSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, name) { } \
|
||||
class clazz : public CastMeleeSpellAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : CastMeleeSpellAction(botAI, name) {}
|
||||
|
||||
#define END_RANGED_SPELL_ACTION() \
|
||||
};
|
||||
} \
|
||||
;
|
||||
|
||||
#define BEGIN_BUFF_ON_PARTY_ACTION(clazz, name) \
|
||||
class clazz : public BuffOnPartyAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffOnPartyAction(botAI, name) { }
|
||||
class clazz : public BuffOnPartyAction \
|
||||
{ \
|
||||
public: \
|
||||
clazz(PlayerbotAI* botAI) : BuffOnPartyAction(botAI, name) {}
|
||||
|
||||
//
|
||||
// Action node
|
||||
//
|
||||
|
||||
// node_name , action, prerequisite
|
||||
#define ACTION_NODE_P(name, spell, pre) \
|
||||
static ActionNode* name(PlayerbotAI* botAI) \
|
||||
{ \
|
||||
return new ActionNode(spell, \
|
||||
/*P*/ NextAction::array(0, new NextAction(pre), nullptr), \
|
||||
/*A*/ nullptr, \
|
||||
/*C*/ nullptr); \
|
||||
}
|
||||
#define ACTION_NODE_P(name, spell, pre) \
|
||||
static ActionNode* name(PlayerbotAI* botAI) \
|
||||
{ \
|
||||
return new ActionNode(spell, /*P*/ NextAction::array(0, new NextAction(pre), nullptr), /*A*/ nullptr, \
|
||||
/*C*/ nullptr); \
|
||||
}
|
||||
|
||||
// node_name , action, alternative
|
||||
#define ACTION_NODE_A(name, spell, alt) \
|
||||
static ActionNode* name(PlayerbotAI* botAI) \
|
||||
{ \
|
||||
return new ActionNode(spell, \
|
||||
/*P*/ nullptr, \
|
||||
/*A*/ NextAction::array(0, new NextAction(alt), nullptr), \
|
||||
/*C*/ nullptr); \
|
||||
}
|
||||
#define ACTION_NODE_A(name, spell, alt) \
|
||||
static ActionNode* name(PlayerbotAI* botAI) \
|
||||
{ \
|
||||
return new ActionNode(spell, /*P*/ nullptr, /*A*/ NextAction::array(0, new NextAction(alt), nullptr), \
|
||||
/*C*/ nullptr); \
|
||||
}
|
||||
|
||||
// node_name , action, continuer
|
||||
#define ACTION_NODE_C(name, spell, con) \
|
||||
static ActionNode* name(PlayerbotAI* botAI) \
|
||||
{ \
|
||||
return new ActionNode(spell, \
|
||||
/*P*/ nullptr, \
|
||||
/*A*/ nullptr, \
|
||||
/*C*/ NextAction::array(0, new NextAction(con), nullptr)); \
|
||||
}
|
||||
#define ACTION_NODE_C(name, spell, con) \
|
||||
static ActionNode* name(PlayerbotAI* botAI) \
|
||||
{ \
|
||||
return new ActionNode(spell, /*P*/ nullptr, /*A*/ nullptr, \
|
||||
/*C*/ NextAction::array(0, new NextAction(con), nullptr)); \
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AiObjectContext.h"
|
||||
#include "StrategyContext.h"
|
||||
|
||||
#include "ActionContext.h"
|
||||
#include "ChatActionContext.h"
|
||||
#include "WorldPacketActionContext.h"
|
||||
#include "ChatTriggerContext.h"
|
||||
#include "TriggerContext.h"
|
||||
#include "SharedValueContext.h"
|
||||
#include "WorldPacketTriggerContext.h"
|
||||
#include "ValueContext.h"
|
||||
#include "Playerbots.h"
|
||||
#include "raids/RaidTriggerContext.h"
|
||||
#include "SharedValueContext.h"
|
||||
#include "StrategyContext.h"
|
||||
#include "TriggerContext.h"
|
||||
#include "ValueContext.h"
|
||||
#include "WorldPacketActionContext.h"
|
||||
#include "WorldPacketTriggerContext.h"
|
||||
#include "raids/RaidActionContext.h"
|
||||
#include "raids/RaidStrategyContext.h"
|
||||
#include "raids/RaidTriggerContext.h"
|
||||
#include "raids/naxxramas/RaidNaxxActionContext.h"
|
||||
#include "raids/naxxramas/RaidNaxxTriggerContext.h"
|
||||
|
||||
@@ -26,7 +28,7 @@ AiObjectContext::AiObjectContext(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
|
||||
strategyContexts.Add(new AssistStrategyContext());
|
||||
strategyContexts.Add(new QuestStrategyContext());
|
||||
strategyContexts.Add(new RaidStrategyContext());
|
||||
|
||||
|
||||
actionContexts.Add(new ActionContext());
|
||||
actionContexts.Add(new ChatActionContext());
|
||||
actionContexts.Add(new WorldPacketActionContext());
|
||||
@@ -116,35 +118,20 @@ std::set<std::string> AiObjectContext::GetSiblingStrategy(std::string const name
|
||||
return strategyContexts.GetSiblings(name);
|
||||
}
|
||||
|
||||
Trigger* AiObjectContext::GetTrigger(std::string const name)
|
||||
{
|
||||
return triggerContexts.GetContextObject(name, botAI);
|
||||
}
|
||||
Trigger* AiObjectContext::GetTrigger(std::string const name) { return triggerContexts.GetContextObject(name, botAI); }
|
||||
|
||||
Action* AiObjectContext::GetAction(std::string const name)
|
||||
{
|
||||
return actionContexts.GetContextObject(name, botAI);
|
||||
}
|
||||
Action* AiObjectContext::GetAction(std::string const name) { return actionContexts.GetContextObject(name, botAI); }
|
||||
|
||||
UntypedValue* AiObjectContext::GetUntypedValue(std::string const name)
|
||||
{
|
||||
return valueContexts.GetContextObject(name, botAI);
|
||||
}
|
||||
|
||||
std::set<std::string> AiObjectContext::GetValues()
|
||||
{
|
||||
return valueContexts.GetCreated();
|
||||
}
|
||||
std::set<std::string> AiObjectContext::GetValues() { return valueContexts.GetCreated(); }
|
||||
|
||||
std::set<std::string> AiObjectContext::GetSupportedStrategies()
|
||||
{
|
||||
return strategyContexts.supports();
|
||||
}
|
||||
std::set<std::string> AiObjectContext::GetSupportedStrategies() { return strategyContexts.supports(); }
|
||||
|
||||
std::set<std::string> AiObjectContext::GetSupportedActions()
|
||||
{
|
||||
return actionContexts.supports();
|
||||
}
|
||||
std::set<std::string> AiObjectContext::GetSupportedActions() { return actionContexts.supports(); }
|
||||
|
||||
std::string const AiObjectContext::FormatValues()
|
||||
{
|
||||
@@ -166,7 +153,4 @@ std::string const AiObjectContext::FormatValues()
|
||||
return out.str();
|
||||
}
|
||||
|
||||
void AiObjectContext::AddShared(NamedObjectContext<UntypedValue>* sharedValues)
|
||||
{
|
||||
valueContexts.Add(sharedValues);
|
||||
}
|
||||
void AiObjectContext::AddShared(NamedObjectContext<UntypedValue>* sharedValues) { valueContexts.Add(sharedValues); }
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_AIOBJECTCONTEXT_H
|
||||
#define _PLAYERBOT_AIOBJECTCONTEXT_H
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "Common.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "PlayerbotAIAware.h"
|
||||
@@ -12,62 +16,59 @@
|
||||
#include "Trigger.h"
|
||||
#include "Value.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class AiObjectContext : public PlayerbotAIAware
|
||||
{
|
||||
public:
|
||||
AiObjectContext(PlayerbotAI* botAI);
|
||||
virtual ~AiObjectContext() { }
|
||||
public:
|
||||
AiObjectContext(PlayerbotAI* botAI);
|
||||
virtual ~AiObjectContext() {}
|
||||
|
||||
virtual Strategy* GetStrategy(std::string const name);
|
||||
virtual std::set<std::string> GetSiblingStrategy(std::string const name);
|
||||
virtual Trigger* GetTrigger(std::string const name);
|
||||
virtual Action* GetAction(std::string const name);
|
||||
virtual UntypedValue* GetUntypedValue(std::string const name);
|
||||
virtual Strategy* GetStrategy(std::string const name);
|
||||
virtual std::set<std::string> GetSiblingStrategy(std::string const name);
|
||||
virtual Trigger* GetTrigger(std::string const name);
|
||||
virtual Action* GetAction(std::string const name);
|
||||
virtual UntypedValue* GetUntypedValue(std::string const name);
|
||||
|
||||
template<class T>
|
||||
Value<T>* GetValue(std::string const name)
|
||||
{
|
||||
return dynamic_cast<Value<T>*>(GetUntypedValue(name));
|
||||
}
|
||||
template <class T>
|
||||
Value<T>* GetValue(std::string const name)
|
||||
{
|
||||
return dynamic_cast<Value<T>*>(GetUntypedValue(name));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Value<T>* GetValue(std::string const name, std::string const param)
|
||||
{
|
||||
return GetValue<T>((std::string(name) + "::" + param));
|
||||
}
|
||||
template <class T>
|
||||
Value<T>* GetValue(std::string const name, std::string const param)
|
||||
{
|
||||
return GetValue<T>((std::string(name) + "::" + param));
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Value<T>* GetValue(std::string const name, int32 param)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << param;
|
||||
return GetValue<T>(name, out.str());
|
||||
}
|
||||
template <class T>
|
||||
Value<T>* GetValue(std::string const name, int32 param)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << param;
|
||||
return GetValue<T>(name, out.str());
|
||||
}
|
||||
|
||||
std::set<std::string> GetValues();
|
||||
std::set<std::string> GetSupportedStrategies();
|
||||
std::set<std::string> GetSupportedActions();
|
||||
std::string const FormatValues();
|
||||
std::set<std::string> GetValues();
|
||||
std::set<std::string> GetSupportedStrategies();
|
||||
std::set<std::string> GetSupportedActions();
|
||||
std::string const FormatValues();
|
||||
|
||||
virtual void Update();
|
||||
virtual void Reset();
|
||||
virtual void AddShared(NamedObjectContext<UntypedValue>* sharedValues);
|
||||
virtual void Update();
|
||||
virtual void Reset();
|
||||
virtual void AddShared(NamedObjectContext<UntypedValue>* sharedValues);
|
||||
|
||||
std::vector<std::string> Save();
|
||||
void Load(std::vector<std::string> data);
|
||||
std::vector<std::string> Save();
|
||||
void Load(std::vector<std::string> data);
|
||||
|
||||
std::vector<std::string> performanceStack;
|
||||
std::vector<std::string> performanceStack;
|
||||
|
||||
protected:
|
||||
NamedObjectContextList<Strategy> strategyContexts;
|
||||
NamedObjectContextList<Action> actionContexts;
|
||||
NamedObjectContextList<Trigger> triggerContexts;
|
||||
NamedObjectContextList<UntypedValue> valueContexts;
|
||||
protected:
|
||||
NamedObjectContextList<Strategy> strategyContexts;
|
||||
NamedObjectContextList<Action> actionContexts;
|
||||
NamedObjectContextList<Trigger> triggerContexts;
|
||||
NamedObjectContextList<UntypedValue> valueContexts;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CustomStrategy.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include "Playerbots.h"
|
||||
|
||||
std::map<std::string, std::string> CustomStrategy::actionLinesCache;
|
||||
|
||||
NextAction* toNextAction(std::string const action)
|
||||
@@ -33,7 +35,7 @@ NextAction** toNextActionArray(std::string const actions)
|
||||
res[index++] = na;
|
||||
}
|
||||
|
||||
res[index++] = nullptr;
|
||||
res[index++] = nullptr;
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -47,11 +49,9 @@ TriggerNode* toTriggerNode(std::string const actionLine)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CustomStrategy::CustomStrategy(PlayerbotAI* botAI) : Strategy(botAI), Qualified()
|
||||
{
|
||||
}
|
||||
CustomStrategy::CustomStrategy(PlayerbotAI* botAI) : Strategy(botAI), Qualified() {}
|
||||
|
||||
void CustomStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
|
||||
void CustomStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
||||
{
|
||||
if (actionLines.empty())
|
||||
{
|
||||
@@ -68,7 +68,8 @@ void CustomStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
|
||||
for (std::vector<std::string>::iterator i = tokens.begin(); i != tokens.end(); ++i)
|
||||
{
|
||||
std::string const line = *i;
|
||||
for (std::sregex_iterator j = std::sregex_iterator(line.begin(), line.end(), tpl); j != std::sregex_iterator(); ++j)
|
||||
for (std::sregex_iterator j = std::sregex_iterator(line.begin(), line.end(), tpl);
|
||||
j != std::sregex_iterator(); ++j)
|
||||
{
|
||||
std::smatch match = *j;
|
||||
std::string const actionLine = match[1].str();
|
||||
@@ -88,7 +89,8 @@ void CustomStrategy::InitTriggers(std::vector<TriggerNode*> &triggers)
|
||||
|
||||
void CustomStrategy::LoadActionLines(uint32 owner)
|
||||
{
|
||||
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME);
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME);
|
||||
stmt->SetData(0, owner);
|
||||
stmt->SetData(1, qualifier);
|
||||
PreparedQueryResult result = PlayerbotsDatabase.Query(stmt);
|
||||
@@ -99,8 +101,7 @@ void CustomStrategy::LoadActionLines(uint32 owner)
|
||||
Field* fields = result->Fetch();
|
||||
std::string const action = fields[1].Get<std::string>();
|
||||
actionLines.push_back(action);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,31 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CUSTOMSTRATEGY_H
|
||||
#define _PLAYERBOT_CUSTOMSTRATEGY_H
|
||||
|
||||
#include "Strategy.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "Strategy.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class CustomStrategy : public Strategy, public Qualified
|
||||
{
|
||||
public:
|
||||
CustomStrategy(PlayerbotAI* botAI);
|
||||
public:
|
||||
CustomStrategy(PlayerbotAI* botAI);
|
||||
|
||||
void InitTriggers(std::vector<TriggerNode*> &triggers) override;
|
||||
std::string const getName() override { return std::string("custom::" + qualifier); }
|
||||
void Reset();
|
||||
void InitTriggers(std::vector<TriggerNode*>& triggers) override;
|
||||
std::string const getName() override { return std::string("custom::" + qualifier); }
|
||||
void Reset();
|
||||
|
||||
static std::map<std::string, std::string> actionLinesCache;
|
||||
static std::map<std::string, std::string> actionLinesCache;
|
||||
|
||||
private:
|
||||
std::vector<std::string> actionLines;
|
||||
void LoadActionLines(uint32 owner);
|
||||
private:
|
||||
std::vector<std::string> actionLines;
|
||||
void LoadActionLines(uint32 owner);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Engine.h"
|
||||
|
||||
#include "Action.h"
|
||||
#include "Event.h"
|
||||
#include "Queue.h"
|
||||
#include "PerformanceMonitor.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Queue.h"
|
||||
#include "Strategy.h"
|
||||
|
||||
Engine::Engine(PlayerbotAI* botAI, AiObjectContext* factory) : PlayerbotAIAware(botAI), aiObjectContext(factory)
|
||||
@@ -125,12 +127,12 @@ void Engine::Init()
|
||||
MultiplyAndPush(strategy->getDefaultActions(), 0.0f, false, emptyEvent, "default");
|
||||
}
|
||||
|
||||
if (testMode)
|
||||
{
|
||||
if (testMode)
|
||||
{
|
||||
FILE* file = fopen("test.log", "w");
|
||||
fprintf(file, "\n");
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
|
||||
@@ -147,7 +149,7 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
|
||||
// aiObjectContext->Update();
|
||||
ProcessTriggers(minimal);
|
||||
PushDefaultActions();
|
||||
|
||||
|
||||
uint32 iterations = 0;
|
||||
uint32 iterationsPerTick = queue.Size() * (minimal ? 2 : sPlayerbotAIConfig->iterationsPerTick);
|
||||
do
|
||||
@@ -156,7 +158,7 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
|
||||
|
||||
if (basket)
|
||||
{
|
||||
float relevance = basket->getRelevance(); // just for reference
|
||||
float relevance = basket->getRelevance(); // just for reference
|
||||
bool skipPrerequisites = basket->isSkipPrerequisites();
|
||||
|
||||
if (minimal && (relevance < 100))
|
||||
@@ -172,12 +174,13 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
|
||||
|
||||
if (!action)
|
||||
{
|
||||
//LOG_ERROR("playerbots", "Action: {} - is UNKNOWN - c:{} l:{}", actionNode->getName().c_str(), botAI->GetBot()->getClass(), botAI->GetBot()->GetLevel());
|
||||
// LOG_ERROR("playerbots", "Action: {} - is UNKNOWN - c:{} l:{}", actionNode->getName().c_str(),
|
||||
// botAI->GetBot()->getClass(), botAI->GetBot()->GetLevel());
|
||||
LogAction("A:%s - UNKNOWN", actionNode->getName().c_str());
|
||||
}
|
||||
else if (action->isUseful())
|
||||
{
|
||||
for (std::vector<Multiplier*>::iterator i = multipliers.begin(); i!= multipliers.end(); i++)
|
||||
for (std::vector<Multiplier*>::iterator i = multipliers.begin(); i != multipliers.end(); i++)
|
||||
{
|
||||
Multiplier* multiplier = *i;
|
||||
relevance *= multiplier->GetValue(action);
|
||||
@@ -185,7 +188,8 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
|
||||
|
||||
if (!relevance)
|
||||
{
|
||||
LogAction("Multiplier %s made action %s useless", multiplier->getName().c_str(), action->getName().c_str());
|
||||
LogAction("Multiplier %s made action %s useless", multiplier->getName().c_str(),
|
||||
action->getName().c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -203,7 +207,8 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
|
||||
}
|
||||
}
|
||||
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_ACTION, action->getName(), &aiObjectContext->performanceStack);
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_ACTION, action->getName(),
|
||||
&aiObjectContext->performanceStack);
|
||||
actionExecuted = ListenAndExecute(action, event);
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
@@ -264,8 +269,7 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
|
||||
|
||||
delete actionNode;
|
||||
}
|
||||
}
|
||||
while (basket && ++iterations <= iterationsPerTick);
|
||||
} while (basket && ++iterations <= iterationsPerTick);
|
||||
|
||||
// if (!basket)
|
||||
// {
|
||||
@@ -312,13 +316,14 @@ ActionNode* Engine::CreateActionNode(std::string const name)
|
||||
return node;
|
||||
}
|
||||
|
||||
return new ActionNode (name,
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
return new ActionNode(name,
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
bool Engine::MultiplyAndPush(NextAction** actions, float forceRelevance, bool skipPrerequisites, Event event, char const* pushType)
|
||||
bool Engine::MultiplyAndPush(NextAction** actions, float forceRelevance, bool skipPrerequisites, Event event,
|
||||
char const* pushType)
|
||||
{
|
||||
bool pushed = false;
|
||||
if (actions)
|
||||
@@ -361,7 +366,7 @@ bool Engine::MultiplyAndPush(NextAction** actions, float forceRelevance, bool sk
|
||||
|
||||
ActionResult Engine::ExecuteAction(std::string const name, Event event, std::string const qualifier)
|
||||
{
|
||||
bool result = false;
|
||||
bool result = false;
|
||||
|
||||
ActionNode* actionNode = CreateActionNode(name);
|
||||
if (!actionNode)
|
||||
@@ -399,7 +404,7 @@ ActionResult Engine::ExecuteAction(std::string const name, Event event, std::str
|
||||
|
||||
delete actionNode;
|
||||
|
||||
return result ? ACTION_RESULT_OK : ACTION_RESULT_FAILED;
|
||||
return result ? ACTION_RESULT_OK : ACTION_RESULT_FAILED;
|
||||
}
|
||||
|
||||
void Engine::addStrategy(std::string const name)
|
||||
@@ -421,21 +426,20 @@ void Engine::addStrategy(std::string const name)
|
||||
|
||||
void Engine::addStrategies(std::string first, ...)
|
||||
{
|
||||
addStrategy(first);
|
||||
addStrategy(first);
|
||||
|
||||
va_list vl;
|
||||
va_start(vl, first);
|
||||
va_list vl;
|
||||
va_start(vl, first);
|
||||
|
||||
const char* cur;
|
||||
do
|
||||
{
|
||||
cur = va_arg(vl, const char*);
|
||||
if (cur)
|
||||
addStrategy(cur);
|
||||
}
|
||||
while (cur);
|
||||
const char* cur;
|
||||
do
|
||||
{
|
||||
cur = va_arg(vl, const char*);
|
||||
if (cur)
|
||||
addStrategy(cur);
|
||||
} while (cur);
|
||||
|
||||
va_end(vl);
|
||||
va_end(vl);
|
||||
}
|
||||
|
||||
bool Engine::removeStrategy(std::string const name)
|
||||
@@ -463,10 +467,7 @@ void Engine::toggleStrategy(std::string const name)
|
||||
addStrategy(name);
|
||||
}
|
||||
|
||||
bool Engine::HasStrategy(std::string const name)
|
||||
{
|
||||
return strategies.find(name) != strategies.end();
|
||||
}
|
||||
bool Engine::HasStrategy(std::string const name) { return strategies.find(name) != strategies.end(); }
|
||||
|
||||
void Engine::ProcessTriggers(bool minimal)
|
||||
{
|
||||
@@ -486,16 +487,17 @@ void Engine::ProcessTriggers(bool minimal)
|
||||
|
||||
if (!trigger)
|
||||
continue;
|
||||
|
||||
|
||||
if (fires.find(trigger) != fires.end())
|
||||
continue;
|
||||
|
||||
|
||||
if (testMode || trigger->needCheck())
|
||||
{
|
||||
if (minimal && node->getFirstRelevance() < 100)
|
||||
continue;
|
||||
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_TRIGGER, trigger->getName(), &aiObjectContext->performanceStack);
|
||||
PerformanceMonitorOperation* pmo =
|
||||
sPerformanceMonitor->start(PERF_MON_TRIGGER, trigger->getName(), &aiObjectContext->performanceStack);
|
||||
Event event = trigger->Check();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
@@ -574,12 +576,12 @@ void Engine::PushAgain(ActionNode* actionNode, float relevance, Event event)
|
||||
|
||||
bool Engine::ContainsStrategy(StrategyType type)
|
||||
{
|
||||
for (std::map<std::string, Strategy*>::iterator i = strategies.begin(); i != strategies.end(); i++)
|
||||
{
|
||||
if (i->second->GetType() & type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
for (std::map<std::string, Strategy*>::iterator i = strategies.begin(); i != strategies.end(); i++)
|
||||
{
|
||||
if (i->second->GetType() & type)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Action* Engine::InitializeAction(ActionNode* actionNode)
|
||||
@@ -658,7 +660,7 @@ void Engine::LogAction(char const* format, ...)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_DEBUG("playerbots", "{} {}", bot->GetName().c_str(), buf);
|
||||
LOG_DEBUG("playerbots", "{} {}", bot->GetName().c_str(), buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -671,13 +673,13 @@ void Engine::ChangeStrategy(std::string const names)
|
||||
switch (name[0])
|
||||
{
|
||||
case '+':
|
||||
addStrategy(name+1);
|
||||
addStrategy(name + 1);
|
||||
break;
|
||||
case '-':
|
||||
removeStrategy(name+1);
|
||||
removeStrategy(name + 1);
|
||||
break;
|
||||
case '~':
|
||||
toggleStrategy(name+1);
|
||||
toggleStrategy(name + 1);
|
||||
break;
|
||||
case '?':
|
||||
botAI->TellMaster(ListStrategies());
|
||||
@@ -696,5 +698,5 @@ void Engine::LogValues()
|
||||
return;
|
||||
|
||||
std::string const text = botAI->GetAiObjectContext()->FormatValues();
|
||||
LOG_DEBUG("playerbots", "Values for {}: {}", bot->GetName().c_str(), text.c_str());
|
||||
LOG_DEBUG("playerbots", "Values for {}: {}", bot->GetName().c_str(), text.c_str());
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ENGINE_H
|
||||
#define _PLAYERBOT_ENGINE_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "Multiplier.h"
|
||||
#include "Queue.h"
|
||||
#include "PlayerbotAIAware.h"
|
||||
#include "Queue.h"
|
||||
#include "Strategy.h"
|
||||
#include "Trigger.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
class Action;
|
||||
class ActionNode;
|
||||
class AiObjectContext;
|
||||
@@ -31,97 +32,86 @@ enum ActionResult
|
||||
|
||||
class ActionExecutionListener
|
||||
{
|
||||
public:
|
||||
virtual ~ActionExecutionListener() { };
|
||||
public:
|
||||
virtual ~ActionExecutionListener(){};
|
||||
|
||||
virtual bool Before(Action* action, Event event) = 0;
|
||||
virtual bool AllowExecution(Action* action, Event event) = 0;
|
||||
virtual void After(Action* action, bool executed, Event event) = 0;
|
||||
virtual bool OverrideResult(Action* action, bool executed, Event event) = 0;
|
||||
virtual bool Before(Action* action, Event event) = 0;
|
||||
virtual bool AllowExecution(Action* action, Event event) = 0;
|
||||
virtual void After(Action* action, bool executed, Event event) = 0;
|
||||
virtual bool OverrideResult(Action* action, bool executed, Event event) = 0;
|
||||
};
|
||||
|
||||
class ActionExecutionListeners : public ActionExecutionListener
|
||||
{
|
||||
public:
|
||||
virtual ~ActionExecutionListeners();
|
||||
public:
|
||||
virtual ~ActionExecutionListeners();
|
||||
|
||||
bool Before(Action* action, Event event) override;
|
||||
bool AllowExecution(Action* action, Event event) override;
|
||||
void After(Action* action, bool executed, Event event) override;
|
||||
bool OverrideResult(Action* action, bool executed, Event event) override;
|
||||
bool Before(Action* action, Event event) override;
|
||||
bool AllowExecution(Action* action, Event event) override;
|
||||
void After(Action* action, bool executed, Event event) override;
|
||||
bool OverrideResult(Action* action, bool executed, Event event) override;
|
||||
|
||||
void Add(ActionExecutionListener* listener)
|
||||
{
|
||||
listeners.push_back(listener);
|
||||
}
|
||||
void Add(ActionExecutionListener* listener) { listeners.push_back(listener); }
|
||||
|
||||
void Remove(ActionExecutionListener* listener)
|
||||
{
|
||||
listeners.remove(listener);
|
||||
}
|
||||
void Remove(ActionExecutionListener* listener) { listeners.remove(listener); }
|
||||
|
||||
private:
|
||||
std::list<ActionExecutionListener*> listeners;
|
||||
private:
|
||||
std::list<ActionExecutionListener*> listeners;
|
||||
};
|
||||
|
||||
class Engine : public PlayerbotAIAware
|
||||
{
|
||||
public:
|
||||
Engine(PlayerbotAI* botAI, AiObjectContext* factory);
|
||||
public:
|
||||
Engine(PlayerbotAI* botAI, AiObjectContext* factory);
|
||||
|
||||
void Init();
|
||||
void addStrategy(std::string const name);
|
||||
void addStrategies(std::string first, ...);
|
||||
bool removeStrategy(std::string const name);
|
||||
bool HasStrategy(std::string const name);
|
||||
void removeAllStrategies();
|
||||
void toggleStrategy(std::string const name);
|
||||
std::string const ListStrategies();
|
||||
std::vector<std::string> GetStrategies();
|
||||
bool ContainsStrategy(StrategyType type);
|
||||
void ChangeStrategy(std::string const names);
|
||||
std::string const GetLastAction() { return lastAction; }
|
||||
void Init();
|
||||
void addStrategy(std::string const name);
|
||||
void addStrategies(std::string first, ...);
|
||||
bool removeStrategy(std::string const name);
|
||||
bool HasStrategy(std::string const name);
|
||||
void removeAllStrategies();
|
||||
void toggleStrategy(std::string const name);
|
||||
std::string const ListStrategies();
|
||||
std::vector<std::string> GetStrategies();
|
||||
bool ContainsStrategy(StrategyType type);
|
||||
void ChangeStrategy(std::string const names);
|
||||
std::string const GetLastAction() { return lastAction; }
|
||||
|
||||
virtual bool DoNextAction(Unit*, uint32 depth = 0, bool minimal = false);
|
||||
ActionResult ExecuteAction(std::string const name, Event event = Event(), std::string const qualifier = "");
|
||||
virtual bool DoNextAction(Unit*, uint32 depth = 0, bool minimal = false);
|
||||
ActionResult ExecuteAction(std::string const name, Event event = Event(), std::string const qualifier = "");
|
||||
|
||||
void AddActionExecutionListener(ActionExecutionListener* listener)
|
||||
{
|
||||
actionExecutionListeners.Add(listener);
|
||||
}
|
||||
void AddActionExecutionListener(ActionExecutionListener* listener) { actionExecutionListeners.Add(listener); }
|
||||
|
||||
void removeActionExecutionListener(ActionExecutionListener* listener)
|
||||
{
|
||||
actionExecutionListeners.Remove(listener);
|
||||
}
|
||||
void removeActionExecutionListener(ActionExecutionListener* listener) { actionExecutionListeners.Remove(listener); }
|
||||
|
||||
virtual ~Engine(void);
|
||||
virtual ~Engine(void);
|
||||
|
||||
bool testMode;
|
||||
bool testMode;
|
||||
|
||||
private:
|
||||
bool MultiplyAndPush(NextAction** actions, float forceRelevance, bool skipPrerequisites, Event event, const char* pushType);
|
||||
void Reset();
|
||||
void ProcessTriggers(bool minimal);
|
||||
void PushDefaultActions();
|
||||
void PushAgain(ActionNode* actionNode, float relevance, Event event);
|
||||
ActionNode* CreateActionNode(std::string const name);
|
||||
Action* InitializeAction(ActionNode* actionNode);
|
||||
bool ListenAndExecute(Action* action, Event event);
|
||||
private:
|
||||
bool MultiplyAndPush(NextAction** actions, float forceRelevance, bool skipPrerequisites, Event event,
|
||||
const char* pushType);
|
||||
void Reset();
|
||||
void ProcessTriggers(bool minimal);
|
||||
void PushDefaultActions();
|
||||
void PushAgain(ActionNode* actionNode, float relevance, Event event);
|
||||
ActionNode* CreateActionNode(std::string const name);
|
||||
Action* InitializeAction(ActionNode* actionNode);
|
||||
bool ListenAndExecute(Action* action, Event event);
|
||||
|
||||
void LogAction(char const* format, ...);
|
||||
void LogValues();
|
||||
void LogAction(char const* format, ...);
|
||||
void LogValues();
|
||||
|
||||
ActionExecutionListeners actionExecutionListeners;
|
||||
ActionExecutionListeners actionExecutionListeners;
|
||||
|
||||
protected:
|
||||
Queue queue;
|
||||
std::vector<TriggerNode*> triggers;
|
||||
std::vector<Multiplier*> multipliers;
|
||||
AiObjectContext* aiObjectContext;
|
||||
std::map<std::string, Strategy*> strategies;
|
||||
float lastRelevance;
|
||||
std::string lastAction;
|
||||
protected:
|
||||
Queue queue;
|
||||
std::vector<TriggerNode*> triggers;
|
||||
std::vector<Multiplier*> multipliers;
|
||||
AiObjectContext* aiObjectContext;
|
||||
std::map<std::string, Strategy*> strategies;
|
||||
float lastRelevance;
|
||||
std::string lastAction;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Event.h"
|
||||
|
||||
#include "Playerbots.h"
|
||||
|
||||
Event::Event(std::string const source, ObjectGuid object, Player* owner) : source(source), owner(owner)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_EVENT_H
|
||||
@@ -12,27 +13,33 @@ class Player;
|
||||
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
Event(Event const& other) : source(other.source), param(other.param), packet(other.packet), owner(other.owner) { }
|
||||
Event() { }
|
||||
Event(std::string const source) : source(source) { }
|
||||
Event(std::string const source, std::string const param, Player* owner = nullptr) : source(source), param(param), owner(owner) { }
|
||||
Event(std::string const source, WorldPacket& packet, Player* owner = nullptr) : source(source), packet(packet), owner(owner) { }
|
||||
Event(std::string const source, ObjectGuid object, Player* owner = nullptr);
|
||||
virtual ~Event() { }
|
||||
public:
|
||||
Event(Event const& other) : source(other.source), param(other.param), packet(other.packet), owner(other.owner) {}
|
||||
Event() {}
|
||||
Event(std::string const source) : source(source) {}
|
||||
Event(std::string const source, std::string const param, Player* owner = nullptr)
|
||||
: source(source), param(param), owner(owner)
|
||||
{
|
||||
}
|
||||
Event(std::string const source, WorldPacket& packet, Player* owner = nullptr)
|
||||
: source(source), packet(packet), owner(owner)
|
||||
{
|
||||
}
|
||||
Event(std::string const source, ObjectGuid object, Player* owner = nullptr);
|
||||
virtual ~Event() {}
|
||||
|
||||
std::string const GetSource() { return source; }
|
||||
std::string const getParam() { return param; }
|
||||
WorldPacket& getPacket() { return packet; }
|
||||
ObjectGuid getObject();
|
||||
Player* getOwner() { return owner; }
|
||||
bool operator! () const { return source.empty(); }
|
||||
std::string const GetSource() { return source; }
|
||||
std::string const getParam() { return param; }
|
||||
WorldPacket& getPacket() { return packet; }
|
||||
ObjectGuid getObject();
|
||||
Player* getOwner() { return owner; }
|
||||
bool operator!() const { return source.empty(); }
|
||||
|
||||
protected:
|
||||
std::string source;
|
||||
std::string param;
|
||||
WorldPacket packet;
|
||||
Player* owner = nullptr;
|
||||
protected:
|
||||
std::string source;
|
||||
std::string param;
|
||||
WorldPacket packet;
|
||||
Player* owner = nullptr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ExternalEventHelper.h"
|
||||
#include "Trigger.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Trigger.h"
|
||||
|
||||
bool ExternalEventHelper::ParseChatCommand(std::string const command, Player* owner)
|
||||
{
|
||||
@@ -37,7 +39,8 @@ bool ExternalEventHelper::ParseChatCommand(std::string const command, Player* ow
|
||||
return true;
|
||||
}
|
||||
|
||||
void ExternalEventHelper::HandlePacket(std::map<uint16, std::string>& handlers, WorldPacket const& packet, Player* owner)
|
||||
void ExternalEventHelper::HandlePacket(std::map<uint16, std::string>& handlers, WorldPacket const& packet,
|
||||
Player* owner)
|
||||
{
|
||||
uint16 opcode = packet.GetOpcode();
|
||||
std::string const name = handlers[opcode];
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_EXTERNALEVENTHELPER_H
|
||||
#define _PLAYERBOT_EXTERNALEVENTHELPER_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
class AiObjectContext;
|
||||
class Player;
|
||||
class WorldPacket;
|
||||
|
||||
class ExternalEventHelper
|
||||
{
|
||||
public:
|
||||
ExternalEventHelper(AiObjectContext* aiObjectContext) : aiObjectContext(aiObjectContext) { }
|
||||
public:
|
||||
ExternalEventHelper(AiObjectContext* aiObjectContext) : aiObjectContext(aiObjectContext) {}
|
||||
|
||||
bool ParseChatCommand(std::string const command, Player* owner = nullptr);
|
||||
void HandlePacket(std::map<uint16, std::string>& handlers, WorldPacket const& packet, Player* owner = nullptr);
|
||||
bool HandleCommand(std::string const name, std::string const param, Player* owner = nullptr);
|
||||
bool ParseChatCommand(std::string const command, Player* owner = nullptr);
|
||||
void HandlePacket(std::map<uint16, std::string>& handlers, WorldPacket const& packet, Player* owner = nullptr);
|
||||
bool HandleCommand(std::string const name, std::string const param, Player* owner = nullptr);
|
||||
|
||||
private:
|
||||
AiObjectContext* aiObjectContext;
|
||||
private:
|
||||
AiObjectContext* aiObjectContext;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ItemVisitors.h"
|
||||
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool FindUsableItemVisitor::Visit(Item* item)
|
||||
@@ -15,7 +17,8 @@ bool FindUsableItemVisitor::Visit(Item* item)
|
||||
|
||||
bool FindPotionVisitor::Accept(ItemTemplate const* proto)
|
||||
{
|
||||
if (proto->Class == ITEM_CLASS_CONSUMABLE && (proto->SubClass == ITEM_SUBCLASS_POTION || proto->SubClass == ITEM_SUBCLASS_FLASK))
|
||||
if (proto->Class == ITEM_CLASS_CONSUMABLE &&
|
||||
(proto->SubClass == ITEM_SUBCLASS_POTION || proto->SubClass == ITEM_SUBCLASS_FLASK))
|
||||
{
|
||||
for (uint8 j = 0; j < MAX_ITEM_PROTO_SPELLS; j++)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ITEMVISITORS_H
|
||||
@@ -17,407 +18,401 @@ char* strstri(char const* str1, char const* str2);
|
||||
|
||||
enum IterateItemsMask : uint32
|
||||
{
|
||||
ITERATE_ITEMS_IN_BAGS = 1,
|
||||
ITERATE_ITEMS_IN_EQUIP = 2,
|
||||
ITERATE_ITEMS_IN_BANK = 4,
|
||||
ITERATE_ALL_ITEMS = 255
|
||||
ITERATE_ITEMS_IN_BAGS = 1,
|
||||
ITERATE_ITEMS_IN_EQUIP = 2,
|
||||
ITERATE_ITEMS_IN_BANK = 4,
|
||||
ITERATE_ALL_ITEMS = 255
|
||||
};
|
||||
|
||||
class IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
IterateItemsVisitor() { }
|
||||
public:
|
||||
IterateItemsVisitor() {}
|
||||
|
||||
virtual bool Visit(Item* item) = 0;
|
||||
virtual bool Visit(Item* item) = 0;
|
||||
};
|
||||
|
||||
class FindItemVisitor : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
FindItemVisitor() : IterateItemsVisitor(), result() { }
|
||||
public:
|
||||
FindItemVisitor() : IterateItemsVisitor(), result() {}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (!Accept(item->GetTemplate()))
|
||||
return true;
|
||||
|
||||
result.push_back(item);
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (!Accept(item->GetTemplate()))
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<Item*>& GetResult() { return result; }
|
||||
result.push_back(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool Accept(ItemTemplate const* proto) = 0;
|
||||
std::vector<Item*>& GetResult() { return result; }
|
||||
|
||||
private:
|
||||
std::vector<Item*> result;
|
||||
protected:
|
||||
virtual bool Accept(ItemTemplate const* proto) = 0;
|
||||
|
||||
private:
|
||||
std::vector<Item*> result;
|
||||
};
|
||||
|
||||
class FindUsableItemVisitor : public FindItemVisitor
|
||||
{
|
||||
public:
|
||||
FindUsableItemVisitor(Player* bot) : FindItemVisitor(), bot(bot) { }
|
||||
public:
|
||||
FindUsableItemVisitor(Player* bot) : FindItemVisitor(), bot(bot) {}
|
||||
|
||||
bool Visit(Item* item) override;
|
||||
bool Visit(Item* item) override;
|
||||
|
||||
private:
|
||||
Player* bot;
|
||||
private:
|
||||
Player* bot;
|
||||
};
|
||||
|
||||
class FindItemsByQualityVisitor : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
FindItemsByQualityVisitor(uint32 quality, uint32 count) : IterateItemsVisitor(), quality(quality), count(count) { }
|
||||
public:
|
||||
FindItemsByQualityVisitor(uint32 quality, uint32 count) : IterateItemsVisitor(), quality(quality), count(count) {}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (item->GetTemplate()->Quality != quality)
|
||||
return true;
|
||||
|
||||
if (result.size() >= (size_t)count)
|
||||
return false;
|
||||
|
||||
result.push_back(item);
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (item->GetTemplate()->Quality != quality)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<Item*>& GetResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (result.size() >= (size_t)count)
|
||||
return false;
|
||||
|
||||
private:
|
||||
uint32 quality;
|
||||
uint32 count;
|
||||
std::vector<Item*> result;
|
||||
result.push_back(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<Item*>& GetResult() { return result; }
|
||||
|
||||
private:
|
||||
uint32 quality;
|
||||
uint32 count;
|
||||
std::vector<Item*> result;
|
||||
};
|
||||
|
||||
class FindItemsToTradeByQualityVisitor : public FindItemsByQualityVisitor
|
||||
{
|
||||
public:
|
||||
FindItemsToTradeByQualityVisitor(uint32 quality, uint32 count) : FindItemsByQualityVisitor(quality, count) { }
|
||||
public:
|
||||
FindItemsToTradeByQualityVisitor(uint32 quality, uint32 count) : FindItemsByQualityVisitor(quality, count) {}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (item->IsSoulBound())
|
||||
return true;
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (item->IsSoulBound())
|
||||
return true;
|
||||
|
||||
return FindItemsByQualityVisitor::Visit(item);
|
||||
}
|
||||
return FindItemsByQualityVisitor::Visit(item);
|
||||
}
|
||||
};
|
||||
|
||||
class FindItemsToTradeByClassVisitor : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
FindItemsToTradeByClassVisitor(uint32 itemClass, uint32 itemSubClass, uint32 count)
|
||||
: IterateItemsVisitor(), itemClass(itemClass), itemSubClass(itemSubClass), count(count) { } // reorder args - whipowill
|
||||
public:
|
||||
FindItemsToTradeByClassVisitor(uint32 itemClass, uint32 itemSubClass, uint32 count)
|
||||
: IterateItemsVisitor(), itemClass(itemClass), itemSubClass(itemSubClass), count(count)
|
||||
{
|
||||
} // reorder args - whipowill
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (item->IsSoulBound())
|
||||
return true;
|
||||
|
||||
if (item->GetTemplate()->Class != itemClass || item->GetTemplate()->SubClass != itemSubClass)
|
||||
return true;
|
||||
|
||||
if (result.size() >= (size_t)count)
|
||||
return false;
|
||||
|
||||
result.push_back(item);
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (item->IsSoulBound())
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<Item*>& GetResult()
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (item->GetTemplate()->Class != itemClass || item->GetTemplate()->SubClass != itemSubClass)
|
||||
return true;
|
||||
|
||||
private:
|
||||
uint32 itemClass;
|
||||
uint32 itemSubClass;
|
||||
uint32 count;
|
||||
std::vector<Item*> result;
|
||||
if (result.size() >= (size_t)count)
|
||||
return false;
|
||||
|
||||
result.push_back(item);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<Item*>& GetResult() { return result; }
|
||||
|
||||
private:
|
||||
uint32 itemClass;
|
||||
uint32 itemSubClass;
|
||||
uint32 count;
|
||||
std::vector<Item*> result;
|
||||
};
|
||||
|
||||
class QueryItemCountVisitor : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
QueryItemCountVisitor(uint32 itemId) : count(0), itemId(itemId) { }
|
||||
public:
|
||||
QueryItemCountVisitor(uint32 itemId) : count(0), itemId(itemId) {}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (item->GetTemplate()->ItemId == itemId)
|
||||
count += item->GetCount();
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (item->GetTemplate()->ItemId == itemId)
|
||||
count += item->GetCount();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32 GetCount() { return count; }
|
||||
uint32 GetCount() { return count; }
|
||||
|
||||
protected:
|
||||
uint32 count;
|
||||
uint32 itemId;
|
||||
protected:
|
||||
uint32 count;
|
||||
uint32 itemId;
|
||||
};
|
||||
|
||||
class QueryNamedItemCountVisitor : public QueryItemCountVisitor
|
||||
{
|
||||
public:
|
||||
QueryNamedItemCountVisitor(std::string const name) : QueryItemCountVisitor(0), name(name) { }
|
||||
public:
|
||||
QueryNamedItemCountVisitor(std::string const name) : QueryItemCountVisitor(0), name(name) {}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
if (proto && proto->Name1.c_str() && strstri(proto->Name1.c_str(), name.c_str()))
|
||||
count += item->GetCount();
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
if (proto && proto->Name1.c_str() && strstri(proto->Name1.c_str(), name.c_str()))
|
||||
count += item->GetCount();
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string const name;
|
||||
private:
|
||||
std::string const name;
|
||||
};
|
||||
|
||||
class FindNamedItemVisitor : public FindItemVisitor
|
||||
{
|
||||
public:
|
||||
FindNamedItemVisitor([[maybe_unused]] Player* bot, std::string const name) : FindItemVisitor(), name(name) { }
|
||||
public:
|
||||
FindNamedItemVisitor([[maybe_unused]] Player* bot, std::string const name) : FindItemVisitor(), name(name) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
return proto && proto->Name1.c_str() && strstri(proto->Name1.c_str(), name.c_str());
|
||||
}
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
return proto && proto->Name1.c_str() && strstri(proto->Name1.c_str(), name.c_str());
|
||||
}
|
||||
|
||||
private:
|
||||
std::string const name;
|
||||
private:
|
||||
std::string const name;
|
||||
};
|
||||
|
||||
class FindItemByIdVisitor : public FindItemVisitor
|
||||
{
|
||||
public:
|
||||
FindItemByIdVisitor(uint32 id) : FindItemVisitor(), id(id) { }
|
||||
public:
|
||||
FindItemByIdVisitor(uint32 id) : FindItemVisitor(), id(id) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
return proto->ItemId == id;
|
||||
}
|
||||
bool Accept(ItemTemplate const* proto) override { return proto->ItemId == id; }
|
||||
|
||||
private:
|
||||
uint32 id;
|
||||
private:
|
||||
uint32 id;
|
||||
};
|
||||
|
||||
class FindItemByIdsVisitor : public FindItemVisitor
|
||||
{
|
||||
public:
|
||||
FindItemByIdsVisitor(ItemIds ids) : FindItemVisitor(), ids(ids) { }
|
||||
public:
|
||||
FindItemByIdsVisitor(ItemIds ids) : FindItemVisitor(), ids(ids) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
return ids.find(proto->ItemId) != ids.end();
|
||||
}
|
||||
bool Accept(ItemTemplate const* proto) override { return ids.find(proto->ItemId) != ids.end(); }
|
||||
|
||||
private:
|
||||
ItemIds ids;
|
||||
private:
|
||||
ItemIds ids;
|
||||
};
|
||||
|
||||
class ListItemsVisitor : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
ListItemsVisitor() : IterateItemsVisitor() { }
|
||||
public:
|
||||
ListItemsVisitor() : IterateItemsVisitor() {}
|
||||
|
||||
std::map<uint32, uint32> items;
|
||||
std::map<uint32, bool> soulbound;
|
||||
std::map<uint32, uint32> items;
|
||||
std::map<uint32, bool> soulbound;
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
uint32 id = item->GetTemplate()->ItemId;
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
uint32 id = item->GetTemplate()->ItemId;
|
||||
|
||||
if (items.find(id) == items.end())
|
||||
items[id] = 0;
|
||||
if (items.find(id) == items.end())
|
||||
items[id] = 0;
|
||||
|
||||
items[id] += item->GetCount();
|
||||
soulbound[id] = item->IsSoulBound();
|
||||
return true;
|
||||
}
|
||||
items[id] += item->GetCount();
|
||||
soulbound[id] = item->IsSoulBound();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class ItemCountByQuality : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
ItemCountByQuality() : IterateItemsVisitor()
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_ITEM_QUALITY; ++i)
|
||||
count[i] = 0;
|
||||
}
|
||||
public:
|
||||
ItemCountByQuality() : IterateItemsVisitor()
|
||||
{
|
||||
for (uint32 i = 0; i < MAX_ITEM_QUALITY; ++i)
|
||||
count[i] = 0;
|
||||
}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
++count[item->GetTemplate()->Quality];
|
||||
return true;
|
||||
}
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
++count[item->GetTemplate()->Quality];
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
std::map<uint32, uint32> count;
|
||||
public:
|
||||
std::map<uint32, uint32> count;
|
||||
};
|
||||
|
||||
class FindPotionVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindPotionVisitor(Player* bot, uint32 effectId) : FindUsableItemVisitor(bot), effectId(effectId) { }
|
||||
public:
|
||||
FindPotionVisitor(Player* bot, uint32 effectId) : FindUsableItemVisitor(bot), effectId(effectId) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
|
||||
private:
|
||||
uint32 effectId;
|
||||
private:
|
||||
uint32 effectId;
|
||||
};
|
||||
|
||||
class FindFoodVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindFoodVisitor(Player* bot, uint32 spellCategory, bool conjured = false) : FindUsableItemVisitor(bot),
|
||||
spellCategory(spellCategory), conjured(conjured) { }
|
||||
public:
|
||||
FindFoodVisitor(Player* bot, uint32 spellCategory, bool conjured = false)
|
||||
: FindUsableItemVisitor(bot), spellCategory(spellCategory), conjured(conjured)
|
||||
{
|
||||
}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
return proto->Class == ITEM_CLASS_CONSUMABLE && (proto->SubClass == ITEM_SUBCLASS_CONSUMABLE || proto->SubClass == ITEM_SUBCLASS_FOOD) &&
|
||||
proto->Spells[0].SpellCategory == spellCategory && (!conjured || proto->IsConjuredConsumable());
|
||||
}
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
return proto->Class == ITEM_CLASS_CONSUMABLE &&
|
||||
(proto->SubClass == ITEM_SUBCLASS_CONSUMABLE || proto->SubClass == ITEM_SUBCLASS_FOOD) &&
|
||||
proto->Spells[0].SpellCategory == spellCategory && (!conjured || proto->IsConjuredConsumable());
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 spellCategory;
|
||||
bool conjured;
|
||||
private:
|
||||
uint32 spellCategory;
|
||||
bool conjured;
|
||||
};
|
||||
|
||||
class FindMountVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindMountVisitor(Player* bot) : FindUsableItemVisitor(bot) { }
|
||||
public:
|
||||
FindMountVisitor(Player* bot) : FindUsableItemVisitor(bot) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
|
||||
private:
|
||||
uint32 effectId;
|
||||
private:
|
||||
uint32 effectId;
|
||||
};
|
||||
|
||||
class FindPetVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindPetVisitor(Player* bot) : FindUsableItemVisitor(bot) { }
|
||||
public:
|
||||
FindPetVisitor(Player* bot) : FindUsableItemVisitor(bot) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
};
|
||||
|
||||
class FindAmmoVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindAmmoVisitor(Player* bot, uint32 weaponType) : FindUsableItemVisitor(bot), weaponType(weaponType) { }
|
||||
public:
|
||||
FindAmmoVisitor(Player* bot, uint32 weaponType) : FindUsableItemVisitor(bot), weaponType(weaponType) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto)override
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
if (proto->Class == ITEM_CLASS_PROJECTILE)
|
||||
{
|
||||
if (proto->Class == ITEM_CLASS_PROJECTILE)
|
||||
uint32 subClass = 0;
|
||||
switch (weaponType)
|
||||
{
|
||||
uint32 subClass = 0;
|
||||
switch (weaponType)
|
||||
{
|
||||
case ITEM_SUBCLASS_WEAPON_GUN:
|
||||
subClass = ITEM_SUBCLASS_BULLET;
|
||||
break;
|
||||
case ITEM_SUBCLASS_WEAPON_BOW:
|
||||
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
|
||||
subClass = ITEM_SUBCLASS_ARROW;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!subClass)
|
||||
return false;
|
||||
|
||||
if (proto->SubClass == subClass)
|
||||
return true;
|
||||
case ITEM_SUBCLASS_WEAPON_GUN:
|
||||
subClass = ITEM_SUBCLASS_BULLET;
|
||||
break;
|
||||
case ITEM_SUBCLASS_WEAPON_BOW:
|
||||
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
|
||||
subClass = ITEM_SUBCLASS_ARROW;
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (!subClass)
|
||||
return false;
|
||||
|
||||
if (proto->SubClass == subClass)
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 weaponType;
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
uint32 weaponType;
|
||||
};
|
||||
|
||||
class FindQuestItemVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindQuestItemVisitor(Player* bot) : FindUsableItemVisitor(bot) { }
|
||||
public:
|
||||
FindQuestItemVisitor(Player* bot) : FindUsableItemVisitor(bot) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
if (proto->Class == ITEM_CLASS_QUEST)
|
||||
{
|
||||
if (proto->Class == ITEM_CLASS_QUEST)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
class FindRecipeVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindRecipeVisitor(Player* bot, SkillType skill = SKILL_NONE) : FindUsableItemVisitor(bot), skill(skill) { };
|
||||
public:
|
||||
FindRecipeVisitor(Player* bot, SkillType skill = SKILL_NONE) : FindUsableItemVisitor(bot), skill(skill){};
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
bool Accept(ItemTemplate const* proto) override
|
||||
{
|
||||
if (proto->Class == ITEM_CLASS_RECIPE)
|
||||
{
|
||||
if (proto->Class == ITEM_CLASS_RECIPE)
|
||||
if (skill == SKILL_NONE)
|
||||
return true;
|
||||
|
||||
switch (proto->SubClass)
|
||||
{
|
||||
if (skill == SKILL_NONE)
|
||||
return true;
|
||||
|
||||
switch (proto->SubClass)
|
||||
{
|
||||
case ITEM_SUBCLASS_LEATHERWORKING_PATTERN:
|
||||
return skill == SKILL_LEATHERWORKING;
|
||||
case ITEM_SUBCLASS_TAILORING_PATTERN:
|
||||
return skill == SKILL_TAILORING;
|
||||
case ITEM_SUBCLASS_ENGINEERING_SCHEMATIC:
|
||||
return skill == SKILL_ENGINEERING;
|
||||
case ITEM_SUBCLASS_BLACKSMITHING:
|
||||
return skill == SKILL_BLACKSMITHING;
|
||||
case ITEM_SUBCLASS_COOKING_RECIPE:
|
||||
return skill == SKILL_COOKING;
|
||||
case ITEM_SUBCLASS_ALCHEMY_RECIPE:
|
||||
return skill == SKILL_ALCHEMY;
|
||||
case ITEM_SUBCLASS_FIRST_AID_MANUAL:
|
||||
return skill == SKILL_FIRST_AID;
|
||||
case ITEM_SUBCLASS_ENCHANTING_FORMULA:
|
||||
return skill == SKILL_ENCHANTING;
|
||||
case ITEM_SUBCLASS_FISHING_MANUAL:
|
||||
return skill == SKILL_FISHING;
|
||||
}
|
||||
case ITEM_SUBCLASS_LEATHERWORKING_PATTERN:
|
||||
return skill == SKILL_LEATHERWORKING;
|
||||
case ITEM_SUBCLASS_TAILORING_PATTERN:
|
||||
return skill == SKILL_TAILORING;
|
||||
case ITEM_SUBCLASS_ENGINEERING_SCHEMATIC:
|
||||
return skill == SKILL_ENGINEERING;
|
||||
case ITEM_SUBCLASS_BLACKSMITHING:
|
||||
return skill == SKILL_BLACKSMITHING;
|
||||
case ITEM_SUBCLASS_COOKING_RECIPE:
|
||||
return skill == SKILL_COOKING;
|
||||
case ITEM_SUBCLASS_ALCHEMY_RECIPE:
|
||||
return skill == SKILL_ALCHEMY;
|
||||
case ITEM_SUBCLASS_FIRST_AID_MANUAL:
|
||||
return skill == SKILL_FIRST_AID;
|
||||
case ITEM_SUBCLASS_ENCHANTING_FORMULA:
|
||||
return skill == SKILL_ENCHANTING;
|
||||
case ITEM_SUBCLASS_FISHING_MANUAL:
|
||||
return skill == SKILL_FISHING;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
SkillType skill;
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
SkillType skill;
|
||||
};
|
||||
|
||||
class FindItemUsageVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindItemUsageVisitor(Player* bot, ItemUsage usage = ITEM_USAGE_NONE);
|
||||
public:
|
||||
FindItemUsageVisitor(Player* bot, ItemUsage usage = ITEM_USAGE_NONE);
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
|
||||
private:
|
||||
AiObjectContext* context;
|
||||
ItemUsage usage;
|
||||
private:
|
||||
AiObjectContext* context;
|
||||
ItemUsage usage;
|
||||
};
|
||||
|
||||
class FindUsableNamedItemVisitor : public FindUsableItemVisitor
|
||||
{
|
||||
public:
|
||||
FindUsableNamedItemVisitor(Player* bot, std::string name): FindUsableItemVisitor(bot), name(name) {}
|
||||
public:
|
||||
FindUsableNamedItemVisitor(Player* bot, std::string name) : FindUsableItemVisitor(bot), name(name) {}
|
||||
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
private:
|
||||
std::string name;
|
||||
bool Accept(ItemTemplate const* proto) override;
|
||||
|
||||
private:
|
||||
std::string name;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_MULTIPLIER_H
|
||||
@@ -12,11 +13,11 @@ class PlayerbotAI;
|
||||
|
||||
class Multiplier : public AiNamedObject
|
||||
{
|
||||
public:
|
||||
Multiplier(PlayerbotAI* botAI, std::string const name) : AiNamedObject(botAI, name) {}
|
||||
virtual ~Multiplier() { }
|
||||
public:
|
||||
Multiplier(PlayerbotAI* botAI, std::string const name) : AiNamedObject(botAI, name) {}
|
||||
virtual ~Multiplier() {}
|
||||
|
||||
virtual float GetValue([[maybe_unused]] Action* action) { return 1.0f; }
|
||||
virtual float GetValue([[maybe_unused]] Action* action) { return 1.0f; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "NamedObjectContext.h"
|
||||
|
||||
#include "Playerbots.h"
|
||||
|
||||
void Qualified::Qualify(int qual)
|
||||
@@ -24,7 +26,7 @@ std::string const Qualified::MultiQualify(std::vector<std::string> qualifiers)
|
||||
std::vector<std::string> Qualified::getMultiQualifiers(std::string const qualifier1)
|
||||
{
|
||||
std::istringstream iss(qualifier1);
|
||||
return { std::istream_iterator<std::string>{iss}, std::istream_iterator<std::string>{} };
|
||||
return {std::istream_iterator<std::string>{iss}, std::istream_iterator<std::string>{}};
|
||||
}
|
||||
|
||||
int32 Qualified::getMultiQualifier(std::string const qualifier1, uint32 pos)
|
||||
|
||||
@@ -1,283 +1,272 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_NAMEDOBJECTCONEXT_H
|
||||
#define _PLAYERBOT_NAMEDOBJECTCONEXT_H
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <list>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class Qualified
|
||||
{
|
||||
public:
|
||||
Qualified() { };
|
||||
Qualified(std::string const qualifier) : qualifier(qualifier) { }
|
||||
Qualified(int32 qualifier1)
|
||||
{
|
||||
Qualify(qualifier1);
|
||||
}
|
||||
public:
|
||||
Qualified(){};
|
||||
Qualified(std::string const qualifier) : qualifier(qualifier) {}
|
||||
Qualified(int32 qualifier1) { Qualify(qualifier1); }
|
||||
|
||||
virtual void Qualify(int qual);
|
||||
virtual void Qualify(int qual);
|
||||
|
||||
virtual void Qualify(std::string const qual)
|
||||
{
|
||||
qualifier = qual;
|
||||
}
|
||||
virtual void Qualify(std::string const qual) { qualifier = qual; }
|
||||
|
||||
std::string const getQualifier() { return qualifier; }
|
||||
std::string const getQualifier() { return qualifier; }
|
||||
|
||||
static std::string const MultiQualify(std::vector<std::string> qualifiers);
|
||||
static std::vector<std::string> getMultiQualifiers(std::string const qualifier1);
|
||||
static int32 getMultiQualifier(std::string const qualifier1, uint32 pos);
|
||||
static std::string const MultiQualify(std::vector<std::string> qualifiers);
|
||||
static std::vector<std::string> getMultiQualifiers(std::string const qualifier1);
|
||||
static int32 getMultiQualifier(std::string const qualifier1, uint32 pos);
|
||||
|
||||
protected:
|
||||
std::string qualifier;
|
||||
protected:
|
||||
std::string qualifier;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class NamedObjectFactory
|
||||
{
|
||||
protected:
|
||||
typedef T*(*ActionCreator)(PlayerbotAI* botAI);
|
||||
std::unordered_map<std::string, ActionCreator> creators;
|
||||
protected:
|
||||
typedef T* (*ActionCreator)(PlayerbotAI* botAI);
|
||||
std::unordered_map<std::string, ActionCreator> creators;
|
||||
|
||||
public:
|
||||
T* create(std::string name, PlayerbotAI* botAI)
|
||||
public:
|
||||
T* create(std::string name, PlayerbotAI* botAI)
|
||||
{
|
||||
size_t found = name.find("::");
|
||||
std::string qualifier;
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
size_t found = name.find("::");
|
||||
std::string qualifier;
|
||||
if (found != std::string::npos)
|
||||
{
|
||||
qualifier = name.substr(found + 2);
|
||||
name = name.substr(0, found);
|
||||
}
|
||||
|
||||
if (creators.find(name) == creators.end())
|
||||
return nullptr;
|
||||
|
||||
ActionCreator creator = creators[name];
|
||||
if (!creator)
|
||||
return nullptr;
|
||||
|
||||
T* object = (*creator)(botAI);
|
||||
Qualified* q = dynamic_cast<Qualified*>(object);
|
||||
if (q && found != std::string::npos)
|
||||
q->Qualify(qualifier);
|
||||
|
||||
return object;
|
||||
qualifier = name.substr(found + 2);
|
||||
name = name.substr(0, found);
|
||||
}
|
||||
|
||||
std::set<std::string> supports()
|
||||
{
|
||||
std::set<std::string> keys;
|
||||
for (typename std::unordered_map<std::string, ActionCreator>::iterator it = creators.begin(); it != creators.end(); it++)
|
||||
keys.insert(it->first);
|
||||
if (creators.find(name) == creators.end())
|
||||
return nullptr;
|
||||
|
||||
return keys;
|
||||
}
|
||||
ActionCreator creator = creators[name];
|
||||
if (!creator)
|
||||
return nullptr;
|
||||
|
||||
T* object = (*creator)(botAI);
|
||||
Qualified* q = dynamic_cast<Qualified*>(object);
|
||||
if (q && found != std::string::npos)
|
||||
q->Qualify(qualifier);
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
std::set<std::string> supports()
|
||||
{
|
||||
std::set<std::string> keys;
|
||||
for (typename std::unordered_map<std::string, ActionCreator>::iterator it = creators.begin();
|
||||
it != creators.end(); it++)
|
||||
keys.insert(it->first);
|
||||
|
||||
return keys;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class NamedObjectContext : public NamedObjectFactory<T>
|
||||
{
|
||||
public:
|
||||
NamedObjectContext(bool shared = false, bool supportsSiblings = false) :
|
||||
NamedObjectFactory<T>(), shared(shared), supportsSiblings(supportsSiblings) { }
|
||||
public:
|
||||
NamedObjectContext(bool shared = false, bool supportsSiblings = false)
|
||||
: NamedObjectFactory<T>(), shared(shared), supportsSiblings(supportsSiblings)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~NamedObjectContext()
|
||||
virtual ~NamedObjectContext() { Clear(); }
|
||||
|
||||
T* create(std::string const name, PlayerbotAI* botAI)
|
||||
{
|
||||
if (created.find(name) == created.end())
|
||||
return created[name] = NamedObjectFactory<T>::create(name, botAI);
|
||||
|
||||
return created[name];
|
||||
}
|
||||
|
||||
void Clear()
|
||||
{
|
||||
for (typename std::unordered_map<std::string, T*>::iterator i = created.begin(); i != created.end(); i++)
|
||||
{
|
||||
Clear();
|
||||
if (i->second)
|
||||
delete i->second;
|
||||
}
|
||||
|
||||
T* create(std::string const name, PlayerbotAI* botAI)
|
||||
created.clear();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
for (typename std::unordered_map<std::string, T*>::iterator i = created.begin(); i != created.end(); i++)
|
||||
{
|
||||
if (created.find(name) == created.end())
|
||||
return created[name] = NamedObjectFactory<T>::create(name, botAI);
|
||||
|
||||
return created[name];
|
||||
if (i->second)
|
||||
i->second->Update();
|
||||
}
|
||||
}
|
||||
|
||||
void Clear()
|
||||
void Reset()
|
||||
{
|
||||
for (typename std::unordered_map<std::string, T*>::iterator i = created.begin(); i != created.end(); i++)
|
||||
{
|
||||
for (typename std::unordered_map<std::string, T*>::iterator i = created.begin(); i != created.end(); i++)
|
||||
{
|
||||
if (i->second)
|
||||
delete i->second;
|
||||
}
|
||||
|
||||
created.clear();
|
||||
if (i->second)
|
||||
i->second->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
for (typename std::unordered_map<std::string, T*>::iterator i = created.begin(); i != created.end(); i++)
|
||||
{
|
||||
if (i->second)
|
||||
i->second->Update();
|
||||
}
|
||||
}
|
||||
bool IsShared() { return shared; }
|
||||
bool IsSupportsSiblings() { return supportsSiblings; }
|
||||
|
||||
void Reset()
|
||||
{
|
||||
for (typename std::unordered_map<std::string, T*>::iterator i = created.begin(); i != created.end(); i++)
|
||||
{
|
||||
if (i->second)
|
||||
i->second->Reset();
|
||||
}
|
||||
}
|
||||
std::set<std::string> GetCreated()
|
||||
{
|
||||
std::set<std::string> keys;
|
||||
for (typename std::unordered_map<std::string, T*>::iterator it = created.begin(); it != created.end(); it++)
|
||||
keys.insert(it->first);
|
||||
|
||||
bool IsShared() { return shared; }
|
||||
bool IsSupportsSiblings() { return supportsSiblings; }
|
||||
return keys;
|
||||
}
|
||||
|
||||
std::set<std::string> GetCreated()
|
||||
{
|
||||
std::set<std::string> keys;
|
||||
for (typename std::unordered_map<std::string, T*>::iterator it = created.begin(); it != created.end(); it++)
|
||||
keys.insert(it->first);
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::unordered_map<std::string, T*> created;
|
||||
bool shared;
|
||||
bool supportsSiblings;
|
||||
protected:
|
||||
std::unordered_map<std::string, T*> created;
|
||||
bool shared;
|
||||
bool supportsSiblings;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class NamedObjectContextList
|
||||
{
|
||||
public:
|
||||
virtual ~NamedObjectContextList()
|
||||
public:
|
||||
virtual ~NamedObjectContextList()
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
NamedObjectContext<T>* context = *i;
|
||||
if (!context->IsShared())
|
||||
delete context;
|
||||
}
|
||||
NamedObjectContext<T>* context = *i;
|
||||
if (!context->IsShared())
|
||||
delete context;
|
||||
}
|
||||
}
|
||||
|
||||
void Add(NamedObjectContext<T>* context) { contexts.push_back(context); }
|
||||
|
||||
T* GetContextObject(std::string const name, PlayerbotAI* botAI)
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
if (T* object = (*i)->create(name, botAI))
|
||||
return object;
|
||||
}
|
||||
|
||||
void Add(NamedObjectContext<T>* context)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
contexts.push_back(context);
|
||||
if (!(*i)->IsShared())
|
||||
(*i)->Update();
|
||||
}
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
(*i)->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
std::set<std::string> GetSiblings(std::string const name)
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
if (!(*i)->IsSupportsSiblings())
|
||||
continue;
|
||||
|
||||
std::set<std::string> supported = (*i)->supports();
|
||||
std::set<std::string>::iterator found = supported.find(name);
|
||||
if (found == supported.end())
|
||||
continue;
|
||||
|
||||
supported.erase(found);
|
||||
return supported;
|
||||
}
|
||||
|
||||
T* GetContextObject(std::string const name, PlayerbotAI* botAI)
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
if (T* object = (*i)->create(name, botAI))
|
||||
return object;
|
||||
}
|
||||
return std::set<std::string>();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
std::set<std::string> supports()
|
||||
{
|
||||
std::set<std::string> result;
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
std::set<std::string> supported = (*i)->supports();
|
||||
|
||||
for (std::set<std::string>::iterator j = supported.begin(); j != supported.end(); j++)
|
||||
result.insert(*j);
|
||||
}
|
||||
|
||||
void Update()
|
||||
return result;
|
||||
}
|
||||
|
||||
std::set<std::string> GetCreated()
|
||||
{
|
||||
std::set<std::string> result;
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
if (!(*i)->IsShared())
|
||||
(*i)->Update();
|
||||
}
|
||||
std::set<std::string> createdKeys = (*i)->GetCreated();
|
||||
|
||||
for (std::set<std::string>::iterator j = createdKeys.begin(); j != createdKeys.end(); j++)
|
||||
result.insert(*j);
|
||||
}
|
||||
|
||||
void Reset()
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
(*i)->Reset();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::set<std::string> GetSiblings(std::string const name)
|
||||
{
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
if (!(*i)->IsSupportsSiblings())
|
||||
continue;
|
||||
|
||||
std::set<std::string> supported = (*i)->supports();
|
||||
std::set<std::string>::iterator found = supported.find(name);
|
||||
if (found == supported.end())
|
||||
continue;
|
||||
|
||||
supported.erase(found);
|
||||
return supported;
|
||||
}
|
||||
|
||||
return std::set<std::string>();
|
||||
}
|
||||
|
||||
std::set<std::string> supports()
|
||||
{
|
||||
std::set<std::string> result;
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
std::set<std::string> supported = (*i)->supports();
|
||||
|
||||
for (std::set<std::string>::iterator j = supported.begin(); j != supported.end(); j++)
|
||||
result.insert(*j);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::set<std::string> GetCreated()
|
||||
{
|
||||
std::set<std::string> result;
|
||||
for (typename std::vector<NamedObjectContext<T>*>::iterator i = contexts.begin(); i != contexts.end(); i++)
|
||||
{
|
||||
std::set<std::string> createdKeys = (*i)->GetCreated();
|
||||
|
||||
for (std::set<std::string>::iterator j = createdKeys.begin(); j != createdKeys.end(); j++)
|
||||
result.insert(*j);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<NamedObjectContext<T>*> contexts;
|
||||
private:
|
||||
std::vector<NamedObjectContext<T>*> contexts;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class NamedObjectFactoryList
|
||||
{
|
||||
public:
|
||||
virtual ~NamedObjectFactoryList()
|
||||
public:
|
||||
virtual ~NamedObjectFactoryList()
|
||||
{
|
||||
for (typename std::list<NamedObjectFactory<T>*>::iterator i = factories.begin(); i != factories.end(); i++)
|
||||
delete *i;
|
||||
}
|
||||
|
||||
void Add(NamedObjectFactory<T>* context) { factories.push_front(context); }
|
||||
|
||||
T* GetContextObject(std::string const& name, PlayerbotAI* botAI)
|
||||
{
|
||||
for (typename std::list<NamedObjectFactory<T>*>::iterator i = factories.begin(); i != factories.end(); i++)
|
||||
{
|
||||
for (typename std::list<NamedObjectFactory<T>*>::iterator i = factories.begin(); i != factories.end(); i++)
|
||||
delete *i;
|
||||
if (T* object = (*i)->create(name, botAI))
|
||||
return object;
|
||||
}
|
||||
|
||||
void Add(NamedObjectFactory<T>* context)
|
||||
{
|
||||
factories.push_front(context);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
T* GetContextObject(std::string const &name, PlayerbotAI* botAI)
|
||||
{
|
||||
for (typename std::list<NamedObjectFactory<T>*>::iterator i = factories.begin(); i != factories.end(); i++)
|
||||
{
|
||||
if (T* object = (*i)->create(name, botAI))
|
||||
return object;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<NamedObjectFactory<T>*> factories;
|
||||
private:
|
||||
std::list<NamedObjectFactory<T>*> factories;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "PassiveMultiplier.h"
|
||||
|
||||
#include "Action.h"
|
||||
#include "AiObjectContext.h"
|
||||
|
||||
@@ -30,7 +32,7 @@ PassiveMultiplier::PassiveMultiplier(PlayerbotAI* botAI) : Multiplier(botAI, "pa
|
||||
float PassiveMultiplier::GetValue(Action* action)
|
||||
{
|
||||
if (!action)
|
||||
return 1.0f;
|
||||
return 1.0f;
|
||||
|
||||
std::string const name = action->getName();
|
||||
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_PASSIVEMULTIPLIER_H
|
||||
#define _PLAYERBOT_PASSIVEMULTIPLIER_H
|
||||
|
||||
#include "Multiplier.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "Multiplier.h"
|
||||
|
||||
class Action;
|
||||
class PlayerbotAI;
|
||||
|
||||
class PassiveMultiplier : public Multiplier
|
||||
{
|
||||
public:
|
||||
PassiveMultiplier(PlayerbotAI* botAI);
|
||||
public:
|
||||
PassiveMultiplier(PlayerbotAI* botAI);
|
||||
|
||||
float GetValue(Action* action) override;
|
||||
float GetValue(Action* action) override;
|
||||
|
||||
private:
|
||||
static std::vector<std::string> allowedActions;
|
||||
static std::vector<std::string> allowedParts;
|
||||
private:
|
||||
static std::vector<std::string> allowedActions;
|
||||
static std::vector<std::string> allowedParts;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,26 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Queue.h"
|
||||
|
||||
#include "AiObjectContext.h"
|
||||
#include "Log.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
|
||||
void Queue::Push(ActionBasket *action)
|
||||
void Queue::Push(ActionBasket* action)
|
||||
{
|
||||
if (action)
|
||||
if (action)
|
||||
{
|
||||
for (std::list<ActionBasket*>::iterator iter = actions.begin(); iter != actions.end(); iter++)
|
||||
{
|
||||
ActionBasket* basket = *iter;
|
||||
if (action->getAction()->getName() == basket->getAction()->getName())
|
||||
{
|
||||
if (basket->getRelevance() < action->getRelevance())
|
||||
basket->setRelevance(action->getRelevance());
|
||||
if (basket->getRelevance() < action->getRelevance())
|
||||
basket->setRelevance(action->getRelevance());
|
||||
|
||||
if (ActionNode* actionNode = action->getAction())
|
||||
delete actionNode;
|
||||
if (ActionNode* actionNode = action->getAction())
|
||||
delete actionNode;
|
||||
|
||||
delete action;
|
||||
|
||||
@@ -28,34 +30,34 @@ void Queue::Push(ActionBasket *action)
|
||||
}
|
||||
}
|
||||
|
||||
actions.push_back(action);
|
||||
actions.push_back(action);
|
||||
}
|
||||
}
|
||||
|
||||
ActionNode* Queue::Pop()
|
||||
{
|
||||
float max = -1;
|
||||
ActionBasket* selection = nullptr;
|
||||
float max = -1;
|
||||
ActionBasket* selection = nullptr;
|
||||
|
||||
for (std::list<ActionBasket*>::iterator iter = actions.begin(); iter != actions.end(); iter++)
|
||||
{
|
||||
ActionBasket* basket = *iter;
|
||||
if (basket->getRelevance() > max)
|
||||
{
|
||||
max = basket->getRelevance();
|
||||
selection = basket;
|
||||
}
|
||||
}
|
||||
for (std::list<ActionBasket*>::iterator iter = actions.begin(); iter != actions.end(); iter++)
|
||||
{
|
||||
ActionBasket* basket = *iter;
|
||||
if (basket->getRelevance() > max)
|
||||
{
|
||||
max = basket->getRelevance();
|
||||
selection = basket;
|
||||
}
|
||||
}
|
||||
|
||||
if (selection != nullptr)
|
||||
{
|
||||
ActionNode* action = selection->getAction();
|
||||
actions.remove(selection);
|
||||
delete selection;
|
||||
return action;
|
||||
}
|
||||
if (selection != nullptr)
|
||||
{
|
||||
ActionNode* action = selection->getAction();
|
||||
actions.remove(selection);
|
||||
delete selection;
|
||||
return action;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ActionBasket* Queue::Peek()
|
||||
@@ -75,10 +77,7 @@ ActionBasket* Queue::Peek()
|
||||
return selection;
|
||||
}
|
||||
|
||||
uint32 Queue::Size()
|
||||
{
|
||||
return actions.size();
|
||||
}
|
||||
uint32 Queue::Size() { return actions.size(); }
|
||||
|
||||
void Queue::RemoveExpired()
|
||||
{
|
||||
|
||||
@@ -1,27 +1,28 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_QUEUE_H
|
||||
#define _PLAYERBOT_QUEUE_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Action.h"
|
||||
#include "Common.h"
|
||||
|
||||
class Queue
|
||||
{
|
||||
public:
|
||||
Queue(void) { }
|
||||
~Queue(void) { }
|
||||
public:
|
||||
Queue(void) {}
|
||||
~Queue(void) {}
|
||||
|
||||
void Push(ActionBasket *action);
|
||||
ActionNode* Pop();
|
||||
ActionBasket* Peek();
|
||||
uint32 Size();
|
||||
void RemoveExpired();
|
||||
void Push(ActionBasket* action);
|
||||
ActionNode* Pop();
|
||||
ActionBasket* Peek();
|
||||
uint32 Size();
|
||||
void RemoveExpired();
|
||||
|
||||
private:
|
||||
std::list<ActionBasket*> actions;
|
||||
private:
|
||||
std::list<ActionBasket*> actions;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,116 +1,118 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Strategy.h"
|
||||
|
||||
#include "Playerbots.h"
|
||||
|
||||
class ActionNodeFactoryInternal : public NamedObjectFactory<ActionNode>
|
||||
{
|
||||
public:
|
||||
ActionNodeFactoryInternal()
|
||||
{
|
||||
creators["melee"] = &melee;
|
||||
creators["healthstone"] = &healthstone;
|
||||
creators["be near"] = &follow_master_random;
|
||||
creators["attack anything"] = &attack_anything;
|
||||
creators["move random"] = &move_random;
|
||||
creators["move to loot"] = &move_to_loot;
|
||||
creators["food"] = &food;
|
||||
creators["drink"] = &drink;
|
||||
creators["mana potion"] = &mana_potion;
|
||||
creators["healing potion"] = &healing_potion;
|
||||
creators["flee"] = &flee;
|
||||
}
|
||||
public:
|
||||
ActionNodeFactoryInternal()
|
||||
{
|
||||
creators["melee"] = &melee;
|
||||
creators["healthstone"] = &healthstone;
|
||||
creators["be near"] = &follow_master_random;
|
||||
creators["attack anything"] = &attack_anything;
|
||||
creators["move random"] = &move_random;
|
||||
creators["move to loot"] = &move_to_loot;
|
||||
creators["food"] = &food;
|
||||
creators["drink"] = &drink;
|
||||
creators["mana potion"] = &mana_potion;
|
||||
creators["healing potion"] = &healing_potion;
|
||||
creators["flee"] = &flee;
|
||||
}
|
||||
|
||||
private:
|
||||
static ActionNode* melee([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("melee",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
private:
|
||||
static ActionNode* melee([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("melee",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* healthstone([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("healthstone",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("healing potion"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* healthstone([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("healthstone",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("healing potion"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* follow_master_random([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("be near",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("follow"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* follow_master_random([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("be near",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("follow"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* attack_anything([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("attack anything",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* attack_anything([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("attack anything",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* move_random([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("move random",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("stay line"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* move_random([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("move random",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("stay line"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* move_to_loot([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("move to loot",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* move_to_loot([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("move to loot",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* food([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("food",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* food([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("food",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* drink([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("drink",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* drink([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("drink",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* mana_potion([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("mana potion",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("drink"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* mana_potion([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("mana potion",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("drink"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* healing_potion([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("healing potion",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("food"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* healing_potion([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("healing potion",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ NextAction::array(0, new NextAction("food"), nullptr),
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
|
||||
static ActionNode* flee([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode ("flee",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
static ActionNode* flee([[maybe_unused]] PlayerbotAI* botAI)
|
||||
{
|
||||
return new ActionNode("flee",
|
||||
/*P*/ nullptr,
|
||||
/*A*/ nullptr,
|
||||
/*C*/ nullptr);
|
||||
}
|
||||
};
|
||||
|
||||
Strategy::Strategy(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
|
||||
@@ -118,8 +120,4 @@ Strategy::Strategy(PlayerbotAI* botAI) : PlayerbotAIAware(botAI)
|
||||
actionNodeFactories.Add(new ActionNodeFactoryInternal());
|
||||
}
|
||||
|
||||
ActionNode* Strategy::GetAction(std::string const name)
|
||||
{
|
||||
return actionNodeFactories.GetContextObject(name, botAI);
|
||||
}
|
||||
|
||||
ActionNode* Strategy::GetAction(std::string const name) { return actionNodeFactories.GetContextObject(name, botAI); }
|
||||
|
||||
@@ -1,26 +1,27 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_STRATEGY_H
|
||||
#define _PLAYERBOT_STRATEGY_H
|
||||
|
||||
#include "Action.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "Multiplier.h"
|
||||
#include "Trigger.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "PlayerbotAIAware.h"
|
||||
#include "Trigger.h"
|
||||
|
||||
enum StrategyType : uint32
|
||||
{
|
||||
STRATEGY_TYPE_GENERIC = 0,
|
||||
STRATEGY_TYPE_COMBAT = 1,
|
||||
STRATEGY_TYPE_NONCOMBAT = 2,
|
||||
STRATEGY_TYPE_TANK = 4,
|
||||
STRATEGY_TYPE_DPS = 8,
|
||||
STRATEGY_TYPE_HEAL = 16,
|
||||
STRATEGY_TYPE_RANGED = 32,
|
||||
STRATEGY_TYPE_MELEE = 64
|
||||
STRATEGY_TYPE_GENERIC = 0,
|
||||
STRATEGY_TYPE_COMBAT = 1,
|
||||
STRATEGY_TYPE_NONCOMBAT = 2,
|
||||
STRATEGY_TYPE_TANK = 4,
|
||||
STRATEGY_TYPE_DPS = 8,
|
||||
STRATEGY_TYPE_HEAL = 16,
|
||||
STRATEGY_TYPE_RANGED = 32,
|
||||
STRATEGY_TYPE_MELEE = 64
|
||||
};
|
||||
|
||||
// enum ActionPriority
|
||||
@@ -54,21 +55,21 @@ static float ACTION_EMERGENCY = 90.0f;
|
||||
|
||||
class Strategy : public PlayerbotAIAware
|
||||
{
|
||||
public:
|
||||
Strategy(PlayerbotAI* botAI);
|
||||
virtual ~Strategy() { }
|
||||
public:
|
||||
Strategy(PlayerbotAI* botAI);
|
||||
virtual ~Strategy() {}
|
||||
|
||||
virtual NextAction** getDefaultActions() { return nullptr; }
|
||||
virtual void InitTriggers([[maybe_unused]] std::vector<TriggerNode*> &triggers) { }
|
||||
virtual void InitMultipliers([[maybe_unused]] std::vector<Multiplier*> &multipliers) { }
|
||||
virtual std::string const getName() = 0;
|
||||
virtual uint32 GetType() const { return STRATEGY_TYPE_GENERIC; }
|
||||
virtual ActionNode* GetAction(std::string const name);
|
||||
void Update() { }
|
||||
void Reset() { }
|
||||
virtual NextAction** getDefaultActions() { return nullptr; }
|
||||
virtual void InitTriggers([[maybe_unused]] std::vector<TriggerNode*>& triggers) {}
|
||||
virtual void InitMultipliers([[maybe_unused]] std::vector<Multiplier*>& multipliers) {}
|
||||
virtual std::string const getName() = 0;
|
||||
virtual uint32 GetType() const { return STRATEGY_TYPE_GENERIC; }
|
||||
virtual ActionNode* GetAction(std::string const name);
|
||||
void Update() {}
|
||||
void Reset() {}
|
||||
|
||||
protected:
|
||||
NamedObjectFactoryList<ActionNode> actionNodeFactories;
|
||||
protected:
|
||||
NamedObjectFactoryList<ActionNode> actionNodeFactories;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_STRATEGYCONTEXT_H
|
||||
#define _PLAYERBOT_STRATEGYCONTEXT_H
|
||||
|
||||
#include "CustomStrategy.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "AttackEnemyPlayersStrategy.h"
|
||||
#include "BattlegroundStrategy.h"
|
||||
#include "CastTimeStrategy.h"
|
||||
#include "ChatCommandHandlerStrategy.h"
|
||||
#include "ConserveManaStrategy.h"
|
||||
#include "CustomStrategy.h"
|
||||
#include "DeadStrategy.h"
|
||||
#include "DebugStrategy.h"
|
||||
#include "DpsAssistStrategy.h"
|
||||
@@ -29,15 +29,16 @@
|
||||
#include "MaintenanceStrategy.h"
|
||||
#include "MarkRtiStrategy.h"
|
||||
#include "MeleeCombatStrategy.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "NonCombatStrategy.h"
|
||||
#include "QuestStrategies.h"
|
||||
#include "PassiveStrategy.h"
|
||||
#include "PullStrategy.h"
|
||||
#include "QuestStrategies.h"
|
||||
#include "RTSCStrategy.h"
|
||||
#include "RacialsStrategy.h"
|
||||
#include "RangedCombatStrategy.h"
|
||||
#include "ReturnStrategy.h"
|
||||
#include "RpgStrategy.h"
|
||||
#include "RTSCStrategy.h"
|
||||
#include "RunawayStrategy.h"
|
||||
#include "StayStrategy.h"
|
||||
#include "TankAssistStrategy.h"
|
||||
@@ -50,184 +51,182 @@
|
||||
|
||||
class StrategyContext : public NamedObjectContext<Strategy>
|
||||
{
|
||||
public:
|
||||
StrategyContext()
|
||||
{
|
||||
creators["racials"] = &StrategyContext::racials;
|
||||
creators["loot"] = &StrategyContext::loot;
|
||||
creators["gather"] = &StrategyContext::gather;
|
||||
creators["emote"] = &StrategyContext::emote;
|
||||
creators["passive"] = &StrategyContext::passive;
|
||||
// creators["conserve mana"] = &StrategyContext::conserve_mana;
|
||||
creators["auto save mana"] = &StrategyContext::auto_save_mana;
|
||||
creators["food"] = &StrategyContext::food;
|
||||
creators["chat"] = &StrategyContext::chat;
|
||||
creators["default"] = &StrategyContext::world_packet;
|
||||
creators["ready check"] = &StrategyContext::ready_check;
|
||||
creators["dead"] = &StrategyContext::dead;
|
||||
creators["flee"] = &StrategyContext::flee;
|
||||
creators["duel"] = &StrategyContext::duel;
|
||||
creators["start duel"] = &StrategyContext::start_duel;
|
||||
creators["kite"] = &StrategyContext::kite;
|
||||
creators["potions"] = &StrategyContext::potions;
|
||||
creators["cast time"] = &StrategyContext::cast_time;
|
||||
creators["threat"] = &StrategyContext::threat;
|
||||
creators["focus"] = &StrategyContext::focus;
|
||||
creators["tell target"] = &StrategyContext::tell_target;
|
||||
creators["pvp"] = &StrategyContext::pvp;
|
||||
creators["return"] = &StrategyContext::_return;
|
||||
creators["lfg"] = &StrategyContext::lfg;
|
||||
creators["custom"] = &StrategyContext::custom;
|
||||
creators["reveal"] = &StrategyContext::reveal;
|
||||
creators["collision"] = &StrategyContext::collision;
|
||||
creators["rpg"] = &StrategyContext::rpg;
|
||||
creators["travel"] = &StrategyContext::travel;
|
||||
creators["explore"] = &StrategyContext::explore;
|
||||
creators["map"] = &StrategyContext::map;
|
||||
creators["map full"] = &StrategyContext::map_full;
|
||||
creators["sit"] = &StrategyContext::sit;
|
||||
creators["mark rti"] = &StrategyContext::mark_rti;
|
||||
creators["adds"] = &StrategyContext::possible_adds;
|
||||
creators["close"] = &StrategyContext::close;
|
||||
creators["ranged"] = &StrategyContext::ranged;
|
||||
creators["behind"] = &StrategyContext::behind;
|
||||
creators["bg"] = &StrategyContext::bg;
|
||||
creators["battleground"] = &StrategyContext::battleground;
|
||||
creators["warsong"] = &StrategyContext::warsong;
|
||||
creators["alterac"] = &StrategyContext::alterac;
|
||||
creators["arathi"] = &StrategyContext::arathi;
|
||||
creators["eye"] = &StrategyContext::eye;
|
||||
creators["isle"] = &StrategyContext::isle;
|
||||
creators["arena"] = &StrategyContext::arena;
|
||||
creators["mount"] = &StrategyContext::mount;
|
||||
creators["rtsc"] = &StrategyContext::rtsc;
|
||||
creators["attack tagged"] = &StrategyContext::attack_tagged;
|
||||
creators["debug"] = &StrategyContext::debug;
|
||||
creators["debug move"] = &StrategyContext::debug_move;
|
||||
creators["debug rpg"] = &StrategyContext::debug_rpg;
|
||||
creators["debug spell"] = &StrategyContext::debug_spell;
|
||||
creators["maintenance"] = &StrategyContext::maintenance;
|
||||
creators["group"] = &StrategyContext::group;
|
||||
creators["guild"] = &StrategyContext::guild;
|
||||
creators["grind"] = &StrategyContext::grind;
|
||||
creators["avoid aoe"] = &StrategyContext::avoid_aoe;
|
||||
creators["move random"] = &StrategyContext::move_random;
|
||||
creators["combat formation"] = &StrategyContext::combat_formation;
|
||||
}
|
||||
public:
|
||||
StrategyContext()
|
||||
{
|
||||
creators["racials"] = &StrategyContext::racials;
|
||||
creators["loot"] = &StrategyContext::loot;
|
||||
creators["gather"] = &StrategyContext::gather;
|
||||
creators["emote"] = &StrategyContext::emote;
|
||||
creators["passive"] = &StrategyContext::passive;
|
||||
// creators["conserve mana"] = &StrategyContext::conserve_mana;
|
||||
creators["auto save mana"] = &StrategyContext::auto_save_mana;
|
||||
creators["food"] = &StrategyContext::food;
|
||||
creators["chat"] = &StrategyContext::chat;
|
||||
creators["default"] = &StrategyContext::world_packet;
|
||||
creators["ready check"] = &StrategyContext::ready_check;
|
||||
creators["dead"] = &StrategyContext::dead;
|
||||
creators["flee"] = &StrategyContext::flee;
|
||||
creators["duel"] = &StrategyContext::duel;
|
||||
creators["start duel"] = &StrategyContext::start_duel;
|
||||
creators["kite"] = &StrategyContext::kite;
|
||||
creators["potions"] = &StrategyContext::potions;
|
||||
creators["cast time"] = &StrategyContext::cast_time;
|
||||
creators["threat"] = &StrategyContext::threat;
|
||||
creators["focus"] = &StrategyContext::focus;
|
||||
creators["tell target"] = &StrategyContext::tell_target;
|
||||
creators["pvp"] = &StrategyContext::pvp;
|
||||
creators["return"] = &StrategyContext::_return;
|
||||
creators["lfg"] = &StrategyContext::lfg;
|
||||
creators["custom"] = &StrategyContext::custom;
|
||||
creators["reveal"] = &StrategyContext::reveal;
|
||||
creators["collision"] = &StrategyContext::collision;
|
||||
creators["rpg"] = &StrategyContext::rpg;
|
||||
creators["travel"] = &StrategyContext::travel;
|
||||
creators["explore"] = &StrategyContext::explore;
|
||||
creators["map"] = &StrategyContext::map;
|
||||
creators["map full"] = &StrategyContext::map_full;
|
||||
creators["sit"] = &StrategyContext::sit;
|
||||
creators["mark rti"] = &StrategyContext::mark_rti;
|
||||
creators["adds"] = &StrategyContext::possible_adds;
|
||||
creators["close"] = &StrategyContext::close;
|
||||
creators["ranged"] = &StrategyContext::ranged;
|
||||
creators["behind"] = &StrategyContext::behind;
|
||||
creators["bg"] = &StrategyContext::bg;
|
||||
creators["battleground"] = &StrategyContext::battleground;
|
||||
creators["warsong"] = &StrategyContext::warsong;
|
||||
creators["alterac"] = &StrategyContext::alterac;
|
||||
creators["arathi"] = &StrategyContext::arathi;
|
||||
creators["eye"] = &StrategyContext::eye;
|
||||
creators["isle"] = &StrategyContext::isle;
|
||||
creators["arena"] = &StrategyContext::arena;
|
||||
creators["mount"] = &StrategyContext::mount;
|
||||
creators["rtsc"] = &StrategyContext::rtsc;
|
||||
creators["attack tagged"] = &StrategyContext::attack_tagged;
|
||||
creators["debug"] = &StrategyContext::debug;
|
||||
creators["debug move"] = &StrategyContext::debug_move;
|
||||
creators["debug rpg"] = &StrategyContext::debug_rpg;
|
||||
creators["debug spell"] = &StrategyContext::debug_spell;
|
||||
creators["maintenance"] = &StrategyContext::maintenance;
|
||||
creators["group"] = &StrategyContext::group;
|
||||
creators["guild"] = &StrategyContext::guild;
|
||||
creators["grind"] = &StrategyContext::grind;
|
||||
creators["avoid aoe"] = &StrategyContext::avoid_aoe;
|
||||
creators["move random"] = &StrategyContext::move_random;
|
||||
creators["combat formation"] = &StrategyContext::combat_formation;
|
||||
}
|
||||
|
||||
private:
|
||||
static Strategy* behind(PlayerbotAI* botAI) { return new SetBehindCombatStrategy(botAI); }
|
||||
static Strategy* ranged(PlayerbotAI* botAI) { return new RangedCombatStrategy(botAI); }
|
||||
static Strategy* close(PlayerbotAI* botAI) { return new MeleeCombatStrategy(botAI); }
|
||||
static Strategy* mark_rti(PlayerbotAI* botAI) { return new MarkRtiStrategy(botAI); }
|
||||
static Strategy* tell_target(PlayerbotAI* botAI) { return new TellTargetStrategy(botAI); }
|
||||
static Strategy* threat(PlayerbotAI* botAI) { return new ThreatStrategy(botAI); }
|
||||
static Strategy* focus(PlayerbotAI* botAI) { return new FocusStrategy(botAI); }
|
||||
static Strategy* cast_time(PlayerbotAI* botAI) { return new CastTimeStrategy(botAI); }
|
||||
static Strategy* potions(PlayerbotAI* botAI) { return new UsePotionsStrategy(botAI); }
|
||||
static Strategy* kite(PlayerbotAI* botAI) { return new KiteStrategy(botAI); }
|
||||
static Strategy* duel(PlayerbotAI* botAI) { return new DuelStrategy(botAI); }
|
||||
static Strategy* start_duel(PlayerbotAI* botAI) { return new StartDuelStrategy(botAI); }
|
||||
static Strategy* flee(PlayerbotAI* botAI) { return new FleeStrategy(botAI); }
|
||||
static Strategy* dead(PlayerbotAI* botAI) { return new DeadStrategy(botAI); }
|
||||
static Strategy* racials(PlayerbotAI* botAI) { return new RacialsStrategy(botAI); }
|
||||
static Strategy* loot(PlayerbotAI* botAI) { return new LootNonCombatStrategy(botAI); }
|
||||
static Strategy* gather(PlayerbotAI* botAI) { return new GatherStrategy(botAI); }
|
||||
static Strategy* emote(PlayerbotAI* botAI) { return new EmoteStrategy(botAI); }
|
||||
static Strategy* passive(PlayerbotAI* botAI) { return new PassiveStrategy(botAI); }
|
||||
// static Strategy* conserve_mana(PlayerbotAI* botAI) { return new ConserveManaStrategy(botAI); }
|
||||
static Strategy* auto_save_mana(PlayerbotAI* botAI) { return new HealerAutoSaveManaStrategy(botAI); }
|
||||
static Strategy* food(PlayerbotAI* botAI) { return new UseFoodStrategy(botAI); }
|
||||
static Strategy* chat(PlayerbotAI* botAI) { return new ChatCommandHandlerStrategy(botAI); }
|
||||
static Strategy* world_packet(PlayerbotAI* botAI) { return new WorldPacketHandlerStrategy(botAI); }
|
||||
static Strategy* ready_check(PlayerbotAI* botAI) { return new ReadyCheckStrategy(botAI); }
|
||||
static Strategy* pvp(PlayerbotAI* botAI) { return new AttackEnemyPlayersStrategy(botAI); }
|
||||
static Strategy* _return(PlayerbotAI* botAI) { return new ReturnStrategy(botAI); }
|
||||
static Strategy* lfg(PlayerbotAI* botAI) { return new LfgStrategy(botAI); }
|
||||
static Strategy* custom(PlayerbotAI* botAI) { return new CustomStrategy(botAI); }
|
||||
static Strategy* reveal(PlayerbotAI* botAI) { return new RevealStrategy(botAI); }
|
||||
static Strategy* collision(PlayerbotAI* botAI) { return new CollisionStrategy(botAI); }
|
||||
static Strategy* rpg(PlayerbotAI* botAI) { return new RpgStrategy(botAI); }
|
||||
static Strategy* travel(PlayerbotAI* botAI) { return new TravelStrategy(botAI); }
|
||||
static Strategy* explore(PlayerbotAI* botAI) { return new ExploreStrategy(botAI); }
|
||||
static Strategy* map(PlayerbotAI* botAI) { return new MapStrategy(botAI); }
|
||||
static Strategy* map_full(PlayerbotAI* botAI) { return new MapFullStrategy(botAI); }
|
||||
static Strategy* sit(PlayerbotAI* botAI) { return new SitStrategy(botAI); }
|
||||
static Strategy* possible_adds(PlayerbotAI* botAI) { return new PossibleAddsStrategy(botAI); }
|
||||
static Strategy* mount(PlayerbotAI* botAI) { return new MountStrategy(botAI); }
|
||||
static Strategy* bg(PlayerbotAI* botAI) { return new BGStrategy(botAI); }
|
||||
static Strategy* battleground(PlayerbotAI* botAI) { return new BattlegroundStrategy(botAI); }
|
||||
static Strategy* warsong(PlayerbotAI* botAI) { return new WarsongStrategy(botAI); }
|
||||
static Strategy* alterac(PlayerbotAI* botAI) { return new AlteracStrategy(botAI); }
|
||||
static Strategy* arathi(PlayerbotAI* botAI) { return new ArathiStrategy(botAI); }
|
||||
static Strategy* eye(PlayerbotAI* botAI) { return new EyeStrategy(botAI); }
|
||||
static Strategy* isle(PlayerbotAI* botAI) { return new IsleStrategy(botAI); }
|
||||
static Strategy* arena(PlayerbotAI* botAI) { return new ArenaStrategy(botAI); }
|
||||
static Strategy* rtsc(PlayerbotAI* botAI) { return new RTSCStrategy(botAI); }
|
||||
static Strategy* attack_tagged(PlayerbotAI* botAI) { return new AttackTaggedStrategy(botAI); }
|
||||
static Strategy* debug(PlayerbotAI* botAI) { return new DebugStrategy(botAI); }
|
||||
static Strategy* debug_move(PlayerbotAI* botAI) { return new DebugMoveStrategy(botAI); }
|
||||
static Strategy* debug_rpg(PlayerbotAI* botAI) { return new DebugRpgStrategy(botAI); }
|
||||
static Strategy* debug_spell(PlayerbotAI* botAI) { return new DebugSpellStrategy(botAI); }
|
||||
static Strategy* maintenance(PlayerbotAI* botAI) { return new MaintenanceStrategy(botAI); }
|
||||
static Strategy* group(PlayerbotAI* botAI) { return new GroupStrategy(botAI); }
|
||||
static Strategy* guild (PlayerbotAI* botAI) { return new GuildStrategy(botAI); }
|
||||
static Strategy* grind(PlayerbotAI* botAI) { return new GrindingStrategy(botAI); }
|
||||
static Strategy* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeStrategy(botAI); }
|
||||
static Strategy* move_random(PlayerbotAI* ai) { return new MoveRandomStrategy(ai); }
|
||||
static Strategy* combat_formation(PlayerbotAI* ai) { return new CombatFormationStrategy(ai); }
|
||||
private:
|
||||
static Strategy* behind(PlayerbotAI* botAI) { return new SetBehindCombatStrategy(botAI); }
|
||||
static Strategy* ranged(PlayerbotAI* botAI) { return new RangedCombatStrategy(botAI); }
|
||||
static Strategy* close(PlayerbotAI* botAI) { return new MeleeCombatStrategy(botAI); }
|
||||
static Strategy* mark_rti(PlayerbotAI* botAI) { return new MarkRtiStrategy(botAI); }
|
||||
static Strategy* tell_target(PlayerbotAI* botAI) { return new TellTargetStrategy(botAI); }
|
||||
static Strategy* threat(PlayerbotAI* botAI) { return new ThreatStrategy(botAI); }
|
||||
static Strategy* focus(PlayerbotAI* botAI) { return new FocusStrategy(botAI); }
|
||||
static Strategy* cast_time(PlayerbotAI* botAI) { return new CastTimeStrategy(botAI); }
|
||||
static Strategy* potions(PlayerbotAI* botAI) { return new UsePotionsStrategy(botAI); }
|
||||
static Strategy* kite(PlayerbotAI* botAI) { return new KiteStrategy(botAI); }
|
||||
static Strategy* duel(PlayerbotAI* botAI) { return new DuelStrategy(botAI); }
|
||||
static Strategy* start_duel(PlayerbotAI* botAI) { return new StartDuelStrategy(botAI); }
|
||||
static Strategy* flee(PlayerbotAI* botAI) { return new FleeStrategy(botAI); }
|
||||
static Strategy* dead(PlayerbotAI* botAI) { return new DeadStrategy(botAI); }
|
||||
static Strategy* racials(PlayerbotAI* botAI) { return new RacialsStrategy(botAI); }
|
||||
static Strategy* loot(PlayerbotAI* botAI) { return new LootNonCombatStrategy(botAI); }
|
||||
static Strategy* gather(PlayerbotAI* botAI) { return new GatherStrategy(botAI); }
|
||||
static Strategy* emote(PlayerbotAI* botAI) { return new EmoteStrategy(botAI); }
|
||||
static Strategy* passive(PlayerbotAI* botAI) { return new PassiveStrategy(botAI); }
|
||||
// static Strategy* conserve_mana(PlayerbotAI* botAI) { return new ConserveManaStrategy(botAI); }
|
||||
static Strategy* auto_save_mana(PlayerbotAI* botAI) { return new HealerAutoSaveManaStrategy(botAI); }
|
||||
static Strategy* food(PlayerbotAI* botAI) { return new UseFoodStrategy(botAI); }
|
||||
static Strategy* chat(PlayerbotAI* botAI) { return new ChatCommandHandlerStrategy(botAI); }
|
||||
static Strategy* world_packet(PlayerbotAI* botAI) { return new WorldPacketHandlerStrategy(botAI); }
|
||||
static Strategy* ready_check(PlayerbotAI* botAI) { return new ReadyCheckStrategy(botAI); }
|
||||
static Strategy* pvp(PlayerbotAI* botAI) { return new AttackEnemyPlayersStrategy(botAI); }
|
||||
static Strategy* _return(PlayerbotAI* botAI) { return new ReturnStrategy(botAI); }
|
||||
static Strategy* lfg(PlayerbotAI* botAI) { return new LfgStrategy(botAI); }
|
||||
static Strategy* custom(PlayerbotAI* botAI) { return new CustomStrategy(botAI); }
|
||||
static Strategy* reveal(PlayerbotAI* botAI) { return new RevealStrategy(botAI); }
|
||||
static Strategy* collision(PlayerbotAI* botAI) { return new CollisionStrategy(botAI); }
|
||||
static Strategy* rpg(PlayerbotAI* botAI) { return new RpgStrategy(botAI); }
|
||||
static Strategy* travel(PlayerbotAI* botAI) { return new TravelStrategy(botAI); }
|
||||
static Strategy* explore(PlayerbotAI* botAI) { return new ExploreStrategy(botAI); }
|
||||
static Strategy* map(PlayerbotAI* botAI) { return new MapStrategy(botAI); }
|
||||
static Strategy* map_full(PlayerbotAI* botAI) { return new MapFullStrategy(botAI); }
|
||||
static Strategy* sit(PlayerbotAI* botAI) { return new SitStrategy(botAI); }
|
||||
static Strategy* possible_adds(PlayerbotAI* botAI) { return new PossibleAddsStrategy(botAI); }
|
||||
static Strategy* mount(PlayerbotAI* botAI) { return new MountStrategy(botAI); }
|
||||
static Strategy* bg(PlayerbotAI* botAI) { return new BGStrategy(botAI); }
|
||||
static Strategy* battleground(PlayerbotAI* botAI) { return new BattlegroundStrategy(botAI); }
|
||||
static Strategy* warsong(PlayerbotAI* botAI) { return new WarsongStrategy(botAI); }
|
||||
static Strategy* alterac(PlayerbotAI* botAI) { return new AlteracStrategy(botAI); }
|
||||
static Strategy* arathi(PlayerbotAI* botAI) { return new ArathiStrategy(botAI); }
|
||||
static Strategy* eye(PlayerbotAI* botAI) { return new EyeStrategy(botAI); }
|
||||
static Strategy* isle(PlayerbotAI* botAI) { return new IsleStrategy(botAI); }
|
||||
static Strategy* arena(PlayerbotAI* botAI) { return new ArenaStrategy(botAI); }
|
||||
static Strategy* rtsc(PlayerbotAI* botAI) { return new RTSCStrategy(botAI); }
|
||||
static Strategy* attack_tagged(PlayerbotAI* botAI) { return new AttackTaggedStrategy(botAI); }
|
||||
static Strategy* debug(PlayerbotAI* botAI) { return new DebugStrategy(botAI); }
|
||||
static Strategy* debug_move(PlayerbotAI* botAI) { return new DebugMoveStrategy(botAI); }
|
||||
static Strategy* debug_rpg(PlayerbotAI* botAI) { return new DebugRpgStrategy(botAI); }
|
||||
static Strategy* debug_spell(PlayerbotAI* botAI) { return new DebugSpellStrategy(botAI); }
|
||||
static Strategy* maintenance(PlayerbotAI* botAI) { return new MaintenanceStrategy(botAI); }
|
||||
static Strategy* group(PlayerbotAI* botAI) { return new GroupStrategy(botAI); }
|
||||
static Strategy* guild(PlayerbotAI* botAI) { return new GuildStrategy(botAI); }
|
||||
static Strategy* grind(PlayerbotAI* botAI) { return new GrindingStrategy(botAI); }
|
||||
static Strategy* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeStrategy(botAI); }
|
||||
static Strategy* move_random(PlayerbotAI* ai) { return new MoveRandomStrategy(ai); }
|
||||
static Strategy* combat_formation(PlayerbotAI* ai) { return new CombatFormationStrategy(ai); }
|
||||
};
|
||||
|
||||
class MovementStrategyContext : public NamedObjectContext<Strategy>
|
||||
{
|
||||
public:
|
||||
MovementStrategyContext() : NamedObjectContext<Strategy>(false, true)
|
||||
{
|
||||
creators["follow"] = &MovementStrategyContext::follow_master;
|
||||
creators["stay"] = &MovementStrategyContext::stay;
|
||||
creators["runaway"] = &MovementStrategyContext::runaway;
|
||||
creators["flee from adds"] = &MovementStrategyContext::flee_from_adds;
|
||||
creators["guard"] = &MovementStrategyContext::guard;
|
||||
}
|
||||
|
||||
private:
|
||||
static Strategy* guard(PlayerbotAI* botAI) { return new GuardStrategy(botAI); }
|
||||
static Strategy* follow_master(PlayerbotAI* botAI) { return new FollowMasterStrategy(botAI); }
|
||||
static Strategy* stay(PlayerbotAI* botAI) { return new StayStrategy(botAI); }
|
||||
static Strategy* runaway(PlayerbotAI* botAI) { return new RunawayStrategy(botAI); }
|
||||
static Strategy* flee_from_adds(PlayerbotAI* botAI) { return new FleeFromAddsStrategy(botAI); }
|
||||
};
|
||||
|
||||
class AssistStrategyContext : public NamedObjectContext<Strategy>
|
||||
public:
|
||||
MovementStrategyContext() : NamedObjectContext<Strategy>(false, true)
|
||||
{
|
||||
public:
|
||||
AssistStrategyContext() : NamedObjectContext<Strategy>(false, true)
|
||||
{
|
||||
creators["dps assist"] = &AssistStrategyContext::dps_assist;
|
||||
creators["dps aoe"] = &AssistStrategyContext::dps_aoe;
|
||||
creators["tank assist"] = &AssistStrategyContext::tank_assist;
|
||||
}
|
||||
creators["follow"] = &MovementStrategyContext::follow_master;
|
||||
creators["stay"] = &MovementStrategyContext::stay;
|
||||
creators["runaway"] = &MovementStrategyContext::runaway;
|
||||
creators["flee from adds"] = &MovementStrategyContext::flee_from_adds;
|
||||
creators["guard"] = &MovementStrategyContext::guard;
|
||||
}
|
||||
|
||||
private:
|
||||
static Strategy* dps_assist(PlayerbotAI* botAI) { return new DpsAssistStrategy(botAI); }
|
||||
static Strategy* dps_aoe(PlayerbotAI* botAI) { return new DpsAoeStrategy(botAI); }
|
||||
static Strategy* tank_assist(PlayerbotAI* botAI) { return new TankAssistStrategy(botAI); }
|
||||
private:
|
||||
static Strategy* guard(PlayerbotAI* botAI) { return new GuardStrategy(botAI); }
|
||||
static Strategy* follow_master(PlayerbotAI* botAI) { return new FollowMasterStrategy(botAI); }
|
||||
static Strategy* stay(PlayerbotAI* botAI) { return new StayStrategy(botAI); }
|
||||
static Strategy* runaway(PlayerbotAI* botAI) { return new RunawayStrategy(botAI); }
|
||||
static Strategy* flee_from_adds(PlayerbotAI* botAI) { return new FleeFromAddsStrategy(botAI); }
|
||||
};
|
||||
|
||||
class AssistStrategyContext : public NamedObjectContext<Strategy>
|
||||
{
|
||||
public:
|
||||
AssistStrategyContext() : NamedObjectContext<Strategy>(false, true)
|
||||
{
|
||||
creators["dps assist"] = &AssistStrategyContext::dps_assist;
|
||||
creators["dps aoe"] = &AssistStrategyContext::dps_aoe;
|
||||
creators["tank assist"] = &AssistStrategyContext::tank_assist;
|
||||
}
|
||||
|
||||
private:
|
||||
static Strategy* dps_assist(PlayerbotAI* botAI) { return new DpsAssistStrategy(botAI); }
|
||||
static Strategy* dps_aoe(PlayerbotAI* botAI) { return new DpsAoeStrategy(botAI); }
|
||||
static Strategy* tank_assist(PlayerbotAI* botAI) { return new TankAssistStrategy(botAI); }
|
||||
};
|
||||
|
||||
class QuestStrategyContext : public NamedObjectContext<Strategy>
|
||||
{
|
||||
public:
|
||||
QuestStrategyContext() : NamedObjectContext<Strategy>(false, true)
|
||||
{
|
||||
creators["quest"] = &QuestStrategyContext::quest;
|
||||
creators["accept all quests"] = &QuestStrategyContext::accept_all_quests;
|
||||
}
|
||||
public:
|
||||
QuestStrategyContext() : NamedObjectContext<Strategy>(false, true)
|
||||
{
|
||||
creators["quest"] = &QuestStrategyContext::quest;
|
||||
creators["accept all quests"] = &QuestStrategyContext::accept_all_quests;
|
||||
}
|
||||
|
||||
private:
|
||||
static Strategy* quest(PlayerbotAI* botAI) { return new DefaultQuestStrategy(botAI); }
|
||||
static Strategy* accept_all_quests(PlayerbotAI* botAI) { return new AcceptAllQuestsStrategy(botAI); }
|
||||
private:
|
||||
static Strategy* quest(PlayerbotAI* botAI) { return new DefaultQuestStrategy(botAI); }
|
||||
static Strategy* accept_all_quests(PlayerbotAI* botAI) { return new AcceptAllQuestsStrategy(botAI); }
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,38 +1,36 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Trigger.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Timer.h"
|
||||
|
||||
Trigger::Trigger(PlayerbotAI* botAI, std::string const name, int32 checkInterval) :
|
||||
AiNamedObject(botAI, name), checkInterval(checkInterval == 1 ? 1 : (checkInterval < 100 ? checkInterval * 1000 : checkInterval)), lastCheckTime(0)
|
||||
Trigger::Trigger(PlayerbotAI* botAI, std::string const name, int32 checkInterval)
|
||||
: AiNamedObject(botAI, name),
|
||||
checkInterval(checkInterval == 1 ? 1 : (checkInterval < 100 ? checkInterval * 1000 : checkInterval)),
|
||||
lastCheckTime(0)
|
||||
{
|
||||
}
|
||||
|
||||
Event Trigger::Check()
|
||||
{
|
||||
if (IsActive())
|
||||
{
|
||||
Event event(getName());
|
||||
return event;
|
||||
}
|
||||
if (IsActive())
|
||||
{
|
||||
Event event(getName());
|
||||
return event;
|
||||
}
|
||||
|
||||
Event event;
|
||||
return event;
|
||||
Event event;
|
||||
return event;
|
||||
}
|
||||
|
||||
Value<Unit*>* Trigger::GetTargetValue()
|
||||
{
|
||||
return context->GetValue<Unit*>(GetTargetName());
|
||||
}
|
||||
Value<Unit*>* Trigger::GetTargetValue() { return context->GetValue<Unit*>(GetTargetName()); }
|
||||
|
||||
Unit* Trigger::GetTarget()
|
||||
{
|
||||
return GetTargetValue()->Get();
|
||||
}
|
||||
Unit* Trigger::GetTarget() { return GetTargetValue()->Get(); }
|
||||
|
||||
bool Trigger::needCheck()
|
||||
{
|
||||
|
||||
@@ -1,69 +1,64 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_TRIGGER_H
|
||||
#define _PLAYERBOT_TRIGGER_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "Action.h"
|
||||
#include "Common.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
class Unit;
|
||||
|
||||
class Trigger : public AiNamedObject
|
||||
{
|
||||
public:
|
||||
Trigger(PlayerbotAI* botAI, std::string const name = "trigger", int32 checkInterval = 1);
|
||||
public:
|
||||
Trigger(PlayerbotAI* botAI, std::string const name = "trigger", int32 checkInterval = 1);
|
||||
|
||||
virtual ~Trigger() { }
|
||||
virtual ~Trigger() {}
|
||||
|
||||
virtual Event Check();
|
||||
virtual void ExternalEvent([[maybe_unused]] std::string const param, [[maybe_unused]] Player* owner = nullptr) { }
|
||||
virtual void ExternalEvent([[maybe_unused]] WorldPacket& packet, [[maybe_unused]] Player* owner = nullptr) { }
|
||||
virtual bool IsActive() { return false; }
|
||||
virtual NextAction** getHandlers() { return nullptr; }
|
||||
void Update() { }
|
||||
virtual void Reset() { }
|
||||
virtual Unit* GetTarget();
|
||||
virtual Value<Unit*>* GetTargetValue();
|
||||
virtual std::string const GetTargetName() { return "self target"; }
|
||||
virtual Event Check();
|
||||
virtual void ExternalEvent([[maybe_unused]] std::string const param, [[maybe_unused]] Player* owner = nullptr) {}
|
||||
virtual void ExternalEvent([[maybe_unused]] WorldPacket& packet, [[maybe_unused]] Player* owner = nullptr) {}
|
||||
virtual bool IsActive() { return false; }
|
||||
virtual NextAction** getHandlers() { return nullptr; }
|
||||
void Update() {}
|
||||
virtual void Reset() {}
|
||||
virtual Unit* GetTarget();
|
||||
virtual Value<Unit*>* GetTargetValue();
|
||||
virtual std::string const GetTargetName() { return "self target"; }
|
||||
|
||||
bool needCheck();
|
||||
bool needCheck();
|
||||
|
||||
protected:
|
||||
int32 checkInterval;
|
||||
uint32 lastCheckTime;
|
||||
protected:
|
||||
int32 checkInterval;
|
||||
uint32 lastCheckTime;
|
||||
};
|
||||
|
||||
class TriggerNode
|
||||
{
|
||||
public:
|
||||
TriggerNode(std::string const name, NextAction** handlers = nullptr) : trigger(nullptr), handlers(handlers), name(name) { } // reorder args - whipowill
|
||||
public:
|
||||
TriggerNode(std::string const name, NextAction** handlers = nullptr)
|
||||
: trigger(nullptr), handlers(handlers), name(name)
|
||||
{
|
||||
} // reorder args - whipowill
|
||||
|
||||
virtual ~TriggerNode()
|
||||
{
|
||||
NextAction::destroy(handlers);
|
||||
}
|
||||
virtual ~TriggerNode() { NextAction::destroy(handlers); }
|
||||
|
||||
Trigger* getTrigger() { return trigger; }
|
||||
void setTrigger(Trigger* trigger) { this->trigger = trigger; }
|
||||
std::string const getName() { return name; }
|
||||
Trigger* getTrigger() { return trigger; }
|
||||
void setTrigger(Trigger* trigger) { this->trigger = trigger; }
|
||||
std::string const getName() { return name; }
|
||||
|
||||
NextAction** getHandlers()
|
||||
{
|
||||
return NextAction::merge(NextAction::clone(handlers), trigger->getHandlers());
|
||||
}
|
||||
NextAction** getHandlers() { return NextAction::merge(NextAction::clone(handlers), trigger->getHandlers()); }
|
||||
|
||||
float getFirstRelevance()
|
||||
{
|
||||
return handlers[0] ? handlers[0]->getRelevance() : -1;
|
||||
}
|
||||
float getFirstRelevance() { return handlers[0] ? handlers[0]->getRelevance() : -1; }
|
||||
|
||||
private:
|
||||
Trigger* trigger;
|
||||
NextAction** handlers;
|
||||
std::string const name;
|
||||
private:
|
||||
Trigger* trigger;
|
||||
NextAction** handlers;
|
||||
std::string const name;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Value.h"
|
||||
|
||||
#include "PerformanceMonitor.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Timer.h"
|
||||
|
||||
UnitCalculatedValue::UnitCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) : CalculatedValue<Unit*>(botAI, name, checkInterval)
|
||||
UnitCalculatedValue::UnitCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval)
|
||||
: CalculatedValue<Unit*>(botAI, name, checkInterval)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -44,8 +47,8 @@ std::string const FloatCalculatedValue::Format()
|
||||
return out.str();
|
||||
}
|
||||
|
||||
CDPairCalculatedValue::CDPairCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) :
|
||||
CalculatedValue<CreatureData const*>(botAI, name, checkInterval)
|
||||
CDPairCalculatedValue::CDPairCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval)
|
||||
: CalculatedValue<CreatureData const*>(botAI, name, checkInterval)
|
||||
{
|
||||
// lastCheckTime = getMSTime() - checkInterval / 2;
|
||||
}
|
||||
@@ -62,15 +65,16 @@ std::string const CDPairCalculatedValue::Format()
|
||||
return "<none>";
|
||||
}
|
||||
|
||||
CDPairListCalculatedValue::CDPairListCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) :
|
||||
CalculatedValue<std::vector<CreatureData const*>>(botAI, name, checkInterval)
|
||||
CDPairListCalculatedValue::CDPairListCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval)
|
||||
: CalculatedValue<std::vector<CreatureData const*>>(botAI, name, checkInterval)
|
||||
{
|
||||
// lastCheckTime = time(nullptr) - checkInterval / 2;
|
||||
}
|
||||
|
||||
std::string const CDPairListCalculatedValue::Format()
|
||||
{
|
||||
std::ostringstream out; out << "{";
|
||||
std::ostringstream out;
|
||||
out << "{";
|
||||
std::vector<CreatureData const*> cdPairs = Calculate();
|
||||
for (CreatureData const* cdPair : cdPairs)
|
||||
{
|
||||
@@ -81,8 +85,8 @@ std::string const CDPairListCalculatedValue::Format()
|
||||
return out.str();
|
||||
}
|
||||
|
||||
ObjectGuidCalculatedValue::ObjectGuidCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) :
|
||||
CalculatedValue<ObjectGuid>(botAI, name, checkInterval)
|
||||
ObjectGuidCalculatedValue::ObjectGuidCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval)
|
||||
: CalculatedValue<ObjectGuid>(botAI, name, checkInterval)
|
||||
{
|
||||
// lastCheckTime = time(nullptr) - checkInterval / 2;
|
||||
}
|
||||
@@ -93,8 +97,9 @@ std::string const ObjectGuidCalculatedValue::Format()
|
||||
return guid ? std::to_string(guid.GetRawValue()) : "<none>";
|
||||
}
|
||||
|
||||
ObjectGuidListCalculatedValue::ObjectGuidListCalculatedValue(PlayerbotAI* botAI, std::string const name, int32 checkInterval) :
|
||||
CalculatedValue<GuidVector>(botAI, name, checkInterval)
|
||||
ObjectGuidListCalculatedValue::ObjectGuidListCalculatedValue(PlayerbotAI* botAI, std::string const name,
|
||||
int32 checkInterval)
|
||||
: CalculatedValue<GuidVector>(botAI, name, checkInterval)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -116,17 +121,22 @@ std::string const ObjectGuidListCalculatedValue::Format()
|
||||
|
||||
Unit* UnitCalculatedValue::Get()
|
||||
{
|
||||
if (checkInterval < 2) {
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
if (checkInterval < 2)
|
||||
{
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(
|
||||
PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t now = getMSTime();
|
||||
if (!lastCheckTime || now - lastCheckTime >= checkInterval)
|
||||
{
|
||||
lastCheckTime = now;
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(
|
||||
PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
|
||||
@@ -1,388 +1,418 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_VALUE_H
|
||||
#define _PLAYERBOT_VALUE_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "AiObject.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "PerformanceMonitor.h"
|
||||
#include "Timer.h"
|
||||
#include "Unit.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
class PlayerbotAI;
|
||||
class Unit;
|
||||
|
||||
class FleeInfo
|
||||
{
|
||||
public:
|
||||
Position fromPos;
|
||||
float radius;
|
||||
float angle;
|
||||
uint32 timestamp;
|
||||
int GetAngleRangeIndex() { return (angle + 2 * M_PI) / (M_PI / 2); } // [0, 7)
|
||||
public:
|
||||
Position fromPos;
|
||||
float radius;
|
||||
float angle;
|
||||
uint32 timestamp;
|
||||
int GetAngleRangeIndex() { return (angle + 2 * M_PI) / (M_PI / 2); } // [0, 7)
|
||||
};
|
||||
|
||||
struct CreatureData;
|
||||
|
||||
class UntypedValue : public AiNamedObject
|
||||
{
|
||||
public:
|
||||
UntypedValue(PlayerbotAI* botAI, std::string const name) : AiNamedObject(botAI, name) { }
|
||||
virtual ~UntypedValue() { }
|
||||
virtual void Update() { }
|
||||
virtual void Reset() { }
|
||||
virtual std::string const Format() { return "?"; }
|
||||
virtual std::string const Save() { return "?"; }
|
||||
virtual bool Load([[maybe_unused]] std::string const value) { return false; }
|
||||
public:
|
||||
UntypedValue(PlayerbotAI* botAI, std::string const name) : AiNamedObject(botAI, name) {}
|
||||
virtual ~UntypedValue() {}
|
||||
virtual void Update() {}
|
||||
virtual void Reset() {}
|
||||
virtual std::string const Format() { return "?"; }
|
||||
virtual std::string const Save() { return "?"; }
|
||||
virtual bool Load([[maybe_unused]] std::string const value) { return false; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class Value
|
||||
{
|
||||
public:
|
||||
virtual ~Value() { }
|
||||
virtual T Get() = 0;
|
||||
virtual T LazyGet() = 0;
|
||||
virtual T& RefGet() = 0;
|
||||
virtual void Reset() { }
|
||||
virtual void Set(T value) = 0;
|
||||
operator T() { return Get(); }
|
||||
public:
|
||||
virtual ~Value() {}
|
||||
virtual T Get() = 0;
|
||||
virtual T LazyGet() = 0;
|
||||
virtual T& RefGet() = 0;
|
||||
virtual void Reset() {}
|
||||
virtual void Set(T value) = 0;
|
||||
operator T() { return Get(); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class CalculatedValue : public UntypedValue, public Value<T>
|
||||
{
|
||||
public:
|
||||
CalculatedValue(PlayerbotAI* botAI, std::string const name = "value", uint32 checkInterval = 1) : UntypedValue(botAI, name),
|
||||
checkInterval(checkInterval == 1 ? 1 : (checkInterval < 100 ? checkInterval * 1000 : checkInterval)) /*turn s -> ms?*/, lastCheckTime(0) { }
|
||||
public:
|
||||
CalculatedValue(PlayerbotAI* botAI, std::string const name = "value", uint32 checkInterval = 1)
|
||||
: UntypedValue(botAI, name),
|
||||
checkInterval(
|
||||
checkInterval == 1 ? 1 : (checkInterval < 100 ? checkInterval * 1000 : checkInterval)) /*turn s -> ms?*/,
|
||||
lastCheckTime(0)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~CalculatedValue() { }
|
||||
virtual ~CalculatedValue() {}
|
||||
|
||||
T Get() override
|
||||
T Get() override
|
||||
{
|
||||
if (checkInterval < 2)
|
||||
{
|
||||
if (checkInterval < 2) {
|
||||
// PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
// PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(),
|
||||
// this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
// if (pmo)
|
||||
// pmo->finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
time_t now = getMSTime();
|
||||
if (!lastCheckTime || now - lastCheckTime >= checkInterval)
|
||||
{
|
||||
lastCheckTime = now;
|
||||
// PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(),
|
||||
// this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
// if (pmo)
|
||||
// pmo->finish();
|
||||
} else {
|
||||
time_t now = getMSTime();
|
||||
if (!lastCheckTime || now - lastCheckTime >= checkInterval)
|
||||
{
|
||||
lastCheckTime = now;
|
||||
// PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
// if (pmo)
|
||||
// pmo->finish();
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
T LazyGet() override
|
||||
T LazyGet() override
|
||||
{
|
||||
if (!lastCheckTime)
|
||||
return Get();
|
||||
|
||||
return value;
|
||||
}
|
||||
T& RefGet() override
|
||||
{
|
||||
if (checkInterval < 2)
|
||||
{
|
||||
if (!lastCheckTime)
|
||||
return Get();
|
||||
|
||||
return value;
|
||||
// PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(),
|
||||
// this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
// if (pmo)
|
||||
// pmo->finish();
|
||||
}
|
||||
T& RefGet() override
|
||||
else
|
||||
{
|
||||
if (checkInterval < 2) {
|
||||
// PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
time_t now = getMSTime();
|
||||
if (!lastCheckTime || now - lastCheckTime >= checkInterval)
|
||||
{
|
||||
lastCheckTime = now;
|
||||
// PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(),
|
||||
// this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
// if (pmo)
|
||||
// pmo->finish();
|
||||
} else {
|
||||
time_t now = getMSTime();
|
||||
if (!lastCheckTime || now - lastCheckTime >= checkInterval)
|
||||
{
|
||||
lastCheckTime = now;
|
||||
// PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
value = Calculate();
|
||||
// if (pmo)
|
||||
// pmo->finish();
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
void Set(T val) override { value = val; }
|
||||
void Update() override {}
|
||||
void Reset() override { lastCheckTime = 0; }
|
||||
return value;
|
||||
}
|
||||
void Set(T val) override { value = val; }
|
||||
void Update() override {}
|
||||
void Reset() override { lastCheckTime = 0; }
|
||||
|
||||
protected:
|
||||
virtual T Calculate() = 0;
|
||||
protected:
|
||||
virtual T Calculate() = 0;
|
||||
|
||||
uint32 checkInterval;
|
||||
uint32 lastCheckTime;
|
||||
T value;
|
||||
uint32 checkInterval;
|
||||
uint32 lastCheckTime;
|
||||
T value;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class SingleCalculatedValue : public CalculatedValue<T>
|
||||
{
|
||||
public:
|
||||
SingleCalculatedValue(PlayerbotAI* botAI, std::string const name = "value") : CalculatedValue<T>(botAI, name)
|
||||
public:
|
||||
SingleCalculatedValue(PlayerbotAI* botAI, std::string const name = "value") : CalculatedValue<T>(botAI, name)
|
||||
{
|
||||
this->Reset();
|
||||
}
|
||||
|
||||
T Get() override
|
||||
{
|
||||
time_t now = time(0);
|
||||
if (!this->lastCheckTime)
|
||||
{
|
||||
this->Reset();
|
||||
this->lastCheckTime = now;
|
||||
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(
|
||||
PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
this->value = this->Calculate();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
}
|
||||
|
||||
T Get() override
|
||||
{
|
||||
time_t now = time(0);
|
||||
if (!this->lastCheckTime)
|
||||
{
|
||||
this->lastCheckTime = now;
|
||||
|
||||
PerformanceMonitorOperation* pmo = sPerformanceMonitor->start(PERF_MON_VALUE, this->getName(), this->context ? &this->context->performanceStack : nullptr);
|
||||
this->value = this->Calculate();
|
||||
if (pmo)
|
||||
pmo->finish();
|
||||
}
|
||||
|
||||
return this->value;
|
||||
}
|
||||
return this->value;
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class MemoryCalculatedValue : public CalculatedValue<T>
|
||||
{
|
||||
public:
|
||||
MemoryCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1) : CalculatedValue<T>(botAI, name, checkInterval)
|
||||
{
|
||||
lastChangeTime = time(0);
|
||||
}
|
||||
public:
|
||||
MemoryCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1)
|
||||
: CalculatedValue<T>(botAI, name, checkInterval)
|
||||
{
|
||||
lastChangeTime = time(0);
|
||||
}
|
||||
|
||||
virtual bool EqualToLast(T value) = 0;
|
||||
virtual bool CanCheckChange()
|
||||
{
|
||||
return time(0) - lastChangeTime < minChangeInterval || EqualToLast(this->value);
|
||||
}
|
||||
virtual bool EqualToLast(T value) = 0;
|
||||
virtual bool CanCheckChange() { return time(0) - lastChangeTime < minChangeInterval || EqualToLast(this->value); }
|
||||
|
||||
virtual bool UpdateChange()
|
||||
{
|
||||
if (CanCheckChange())
|
||||
return false;
|
||||
virtual bool UpdateChange()
|
||||
{
|
||||
if (CanCheckChange())
|
||||
return false;
|
||||
|
||||
lastChangeTime = time(0);
|
||||
lastValue = this->value;
|
||||
return true;
|
||||
}
|
||||
lastChangeTime = time(0);
|
||||
lastValue = this->value;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Set([[maybe_unused]] T value) override
|
||||
{
|
||||
CalculatedValue<T>::Set(this->value);
|
||||
UpdateChange();
|
||||
}
|
||||
void Set([[maybe_unused]] T value) override
|
||||
{
|
||||
CalculatedValue<T>::Set(this->value);
|
||||
UpdateChange();
|
||||
}
|
||||
|
||||
T Get() override
|
||||
{
|
||||
this->value = CalculatedValue<T>::Get();
|
||||
UpdateChange();
|
||||
return this->value;
|
||||
}
|
||||
T Get() override
|
||||
{
|
||||
this->value = CalculatedValue<T>::Get();
|
||||
UpdateChange();
|
||||
return this->value;
|
||||
}
|
||||
|
||||
T LazyGet() override
|
||||
{
|
||||
return this->value;
|
||||
}
|
||||
T LazyGet() override { return this->value; }
|
||||
|
||||
time_t LastChangeOn()
|
||||
{
|
||||
Get();
|
||||
UpdateChange();
|
||||
return lastChangeTime;
|
||||
}
|
||||
time_t LastChangeOn()
|
||||
{
|
||||
Get();
|
||||
UpdateChange();
|
||||
return lastChangeTime;
|
||||
}
|
||||
|
||||
uint32 LastChangeDelay() { return time(0) - LastChangeOn(); }
|
||||
uint32 LastChangeDelay() { return time(0) - LastChangeOn(); }
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
CalculatedValue<T>::Reset();
|
||||
lastChangeTime = time(0);
|
||||
}
|
||||
void Reset() override
|
||||
{
|
||||
CalculatedValue<T>::Reset();
|
||||
lastChangeTime = time(0);
|
||||
}
|
||||
|
||||
protected:
|
||||
T lastValue;
|
||||
uint32 minChangeInterval = 0;
|
||||
time_t lastChangeTime;
|
||||
protected:
|
||||
T lastValue;
|
||||
uint32 minChangeInterval = 0;
|
||||
time_t lastChangeTime;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class LogCalculatedValue : public MemoryCalculatedValue<T>
|
||||
{
|
||||
public:
|
||||
LogCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1) : MemoryCalculatedValue<T>(botAI, name, checkInterval) { }
|
||||
public:
|
||||
LogCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1)
|
||||
: MemoryCalculatedValue<T>(botAI, name, checkInterval)
|
||||
{
|
||||
}
|
||||
|
||||
bool UpdateChange() override
|
||||
{
|
||||
if (MemoryCalculatedValue<T>::UpdateChange())
|
||||
return false;
|
||||
bool UpdateChange() override
|
||||
{
|
||||
if (MemoryCalculatedValue<T>::UpdateChange())
|
||||
return false;
|
||||
|
||||
valueLog.push_back(std::make_pair(this->value, time(0)));
|
||||
valueLog.push_back(std::make_pair(this->value, time(0)));
|
||||
|
||||
if (valueLog.size() > logLength)
|
||||
valueLog.pop_front();
|
||||
return true;
|
||||
}
|
||||
if (valueLog.size() > logLength)
|
||||
valueLog.pop_front();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::list<std::pair<T, time_t>> ValueLog() { return valueLog; }
|
||||
std::list<std::pair<T, time_t>> ValueLog() { return valueLog; }
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
MemoryCalculatedValue<T>::Reset();
|
||||
valueLog.clear();
|
||||
}
|
||||
void Reset() override
|
||||
{
|
||||
MemoryCalculatedValue<T>::Reset();
|
||||
valueLog.clear();
|
||||
}
|
||||
|
||||
protected:
|
||||
std::list<std::pair<T, time_t>> valueLog;
|
||||
uint8 logLength = 10;
|
||||
};
|
||||
protected:
|
||||
std::list<std::pair<T, time_t>> valueLog;
|
||||
uint8 logLength = 10;
|
||||
};
|
||||
|
||||
class Uint8CalculatedValue : public CalculatedValue<uint8>
|
||||
{
|
||||
public:
|
||||
Uint8CalculatedValue(PlayerbotAI* botAI, std::string const name = "value", uint32 checkInterval = 1) :
|
||||
CalculatedValue<uint8>(botAI, name, checkInterval) { }
|
||||
public:
|
||||
Uint8CalculatedValue(PlayerbotAI* botAI, std::string const name = "value", uint32 checkInterval = 1)
|
||||
: CalculatedValue<uint8>(botAI, name, checkInterval)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const Format() override;
|
||||
std::string const Format() override;
|
||||
};
|
||||
|
||||
class Uint32CalculatedValue : public CalculatedValue<uint32>
|
||||
{
|
||||
public:
|
||||
Uint32CalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int checkInterval = 1) :
|
||||
CalculatedValue<uint32>(botAI, name, checkInterval) { }
|
||||
public:
|
||||
Uint32CalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int checkInterval = 1)
|
||||
: CalculatedValue<uint32>(botAI, name, checkInterval)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const Format() override;
|
||||
std::string const Format() override;
|
||||
};
|
||||
|
||||
class FloatCalculatedValue : public CalculatedValue<float>
|
||||
{
|
||||
public:
|
||||
FloatCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int checkInterval = 1) :
|
||||
CalculatedValue<float>(botAI, name, checkInterval) { }
|
||||
public:
|
||||
FloatCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int checkInterval = 1)
|
||||
: CalculatedValue<float>(botAI, name, checkInterval)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const Format() override;
|
||||
std::string const Format() override;
|
||||
};
|
||||
|
||||
class BoolCalculatedValue : public CalculatedValue<bool>
|
||||
{
|
||||
public:
|
||||
BoolCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int checkInterval = 1) :
|
||||
CalculatedValue<bool>(botAI, name, checkInterval) { }
|
||||
public:
|
||||
BoolCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int checkInterval = 1)
|
||||
: CalculatedValue<bool>(botAI, name, checkInterval)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const Format() override
|
||||
{
|
||||
return Calculate() ? "true" : "false";
|
||||
}
|
||||
std::string const Format() override { return Calculate() ? "true" : "false"; }
|
||||
};
|
||||
|
||||
class UnitCalculatedValue : public CalculatedValue<Unit*>
|
||||
{
|
||||
public:
|
||||
UnitCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
public:
|
||||
UnitCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
|
||||
std::string const Format() override;
|
||||
Unit* Get() override;
|
||||
std::string const Format() override;
|
||||
Unit* Get() override;
|
||||
};
|
||||
|
||||
class CDPairCalculatedValue : public CalculatedValue<CreatureData const*>
|
||||
{
|
||||
public:
|
||||
CDPairCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
public:
|
||||
CDPairCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
|
||||
std::string const Format() override;
|
||||
std::string const Format() override;
|
||||
};
|
||||
|
||||
class CDPairListCalculatedValue : public CalculatedValue<std::vector<CreatureData const*>>
|
||||
{
|
||||
public:
|
||||
CDPairListCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
public:
|
||||
CDPairListCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
|
||||
std::string const Format() override;
|
||||
std::string const Format() override;
|
||||
};
|
||||
|
||||
class ObjectGuidCalculatedValue : public CalculatedValue<ObjectGuid>
|
||||
{
|
||||
public:
|
||||
ObjectGuidCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
public:
|
||||
ObjectGuidCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
|
||||
std::string const Format() override;
|
||||
std::string const Format() override;
|
||||
};
|
||||
|
||||
class ObjectGuidListCalculatedValue : public CalculatedValue<GuidVector>
|
||||
{
|
||||
public:
|
||||
ObjectGuidListCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
public:
|
||||
ObjectGuidListCalculatedValue(PlayerbotAI* botAI, std::string const name = "value", int32 checkInterval = 1);
|
||||
|
||||
std::string const Format() override;
|
||||
std::string const Format() override;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template <class T>
|
||||
class ManualSetValue : public UntypedValue, public Value<T>
|
||||
{
|
||||
public:
|
||||
ManualSetValue(PlayerbotAI* botAI, T defaultValue, std::string const name = "value") :
|
||||
UntypedValue(botAI, name), value(defaultValue), defaultValue(defaultValue) { }
|
||||
public:
|
||||
ManualSetValue(PlayerbotAI* botAI, T defaultValue, std::string const name = "value")
|
||||
: UntypedValue(botAI, name), value(defaultValue), defaultValue(defaultValue)
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~ManualSetValue() { }
|
||||
virtual ~ManualSetValue() {}
|
||||
|
||||
T Get() override { return value; }
|
||||
T LazyGet() override { return value; }
|
||||
T& RefGet() override { return value; }
|
||||
void Set(T val) override { value = val; }
|
||||
void Update() override {}
|
||||
void Reset() override
|
||||
{
|
||||
value = defaultValue;
|
||||
}
|
||||
T Get() override { return value; }
|
||||
T LazyGet() override { return value; }
|
||||
T& RefGet() override { return value; }
|
||||
void Set(T val) override { value = val; }
|
||||
void Update() override {}
|
||||
void Reset() override { value = defaultValue; }
|
||||
|
||||
protected:
|
||||
T value;
|
||||
T defaultValue;
|
||||
protected:
|
||||
T value;
|
||||
T defaultValue;
|
||||
};
|
||||
|
||||
class UnitManualSetValue : public ManualSetValue<Unit*>
|
||||
{
|
||||
public:
|
||||
UnitManualSetValue(PlayerbotAI* botAI, Unit* defaultValue, std::string const name = "value") :
|
||||
ManualSetValue<Unit*>(botAI, defaultValue, name) { }
|
||||
public:
|
||||
UnitManualSetValue(PlayerbotAI* botAI, Unit* defaultValue, std::string const name = "value")
|
||||
: ManualSetValue<Unit*>(botAI, defaultValue, name)
|
||||
{
|
||||
}
|
||||
|
||||
std::string const Format() override;
|
||||
Unit* Get() override;
|
||||
std::string const Format() override;
|
||||
Unit* Get() override;
|
||||
};
|
||||
|
||||
class DisperseDistanceValue : public ManualSetValue<float>
|
||||
{
|
||||
public:
|
||||
DisperseDistanceValue(PlayerbotAI* botAI, float defaultValue = -1.0f, std::string const name = "disperse distance") :
|
||||
ManualSetValue<float>(botAI, defaultValue, name) { }
|
||||
public:
|
||||
DisperseDistanceValue(PlayerbotAI* botAI, float defaultValue = -1.0f, std::string const name = "disperse distance")
|
||||
: ManualSetValue<float>(botAI, defaultValue, name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class LastFleeAngleValue : public ManualSetValue<float>
|
||||
{
|
||||
public:
|
||||
LastFleeAngleValue(PlayerbotAI* botAI, float defaultValue = 0.0f, std::string const name = "last flee angle") :
|
||||
ManualSetValue<float>(botAI, defaultValue, name) { }
|
||||
public:
|
||||
LastFleeAngleValue(PlayerbotAI* botAI, float defaultValue = 0.0f, std::string const name = "last flee angle")
|
||||
: ManualSetValue<float>(botAI, defaultValue, name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class LastFleeTimestampValue : public ManualSetValue<uint32>
|
||||
{
|
||||
public:
|
||||
LastFleeTimestampValue(PlayerbotAI* botAI, uint32 defaultValue = 0, std::string const name = "last flee timestamp") :
|
||||
ManualSetValue<uint32>(botAI, defaultValue, name) { }
|
||||
public:
|
||||
LastFleeTimestampValue(PlayerbotAI* botAI, uint32 defaultValue = 0, std::string const name = "last flee timestamp")
|
||||
: ManualSetValue<uint32>(botAI, defaultValue, name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class RecentlyFleeInfo : public ManualSetValue<std::list<FleeInfo>>
|
||||
{
|
||||
public:
|
||||
RecentlyFleeInfo(PlayerbotAI* botAI, std::list<FleeInfo> defaultValue = {}, std::string const name = "recently flee info") :
|
||||
ManualSetValue<std::list<FleeInfo>>(botAI, defaultValue, name) { }
|
||||
public:
|
||||
RecentlyFleeInfo(PlayerbotAI* botAI, std::list<FleeInfo> defaultValue = {},
|
||||
std::string const name = "recently flee info")
|
||||
: ManualSetValue<std::list<FleeInfo>>(botAI, defaultValue, name)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,22 +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.
|
||||
* 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 "AcceptBattlegroundInvitationAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool AcceptBgInvitationAction::Execute(Event event)
|
||||
{
|
||||
uint8 type = 0; // arenatype if arena
|
||||
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||
uint32 bgTypeId_ = BATTLEGROUND_WS; // type id from dbc
|
||||
uint16 unk = 0x1F90; // 0x1F90 constant?*/
|
||||
uint8 type = 0; // arenatype if arena
|
||||
uint8 unk2 = 0; // unk, can be 0x0 (may be if was invited?) and 0x1
|
||||
uint32 bgTypeId_ = BATTLEGROUND_WS; // type id from dbc
|
||||
uint16 unk = 0x1F90; // 0x1F90 constant?*/
|
||||
uint8 action = 1;
|
||||
|
||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||
packet << type << unk2 << (uint32)bgTypeId_ << unk << action;
|
||||
//packet << bgTypeId_ << action;
|
||||
// packet << bgTypeId_ << action;
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ACCEPTBATTLEGROUNDINVITATIONACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class AcceptBgInvitationAction : public Action
|
||||
{
|
||||
public:
|
||||
AcceptBgInvitationAction(PlayerbotAI* botAI) : Action(botAI, "accept bg invitatio") { }
|
||||
public:
|
||||
AcceptBgInvitationAction(PlayerbotAI* botAI) : Action(botAI, "accept bg invitatio") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptDuelAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -16,7 +18,8 @@ bool AcceptDuelAction::Execute(Event event)
|
||||
p >> playerGuid;
|
||||
|
||||
// do not auto duel with low hp
|
||||
if ((!botAI->HasRealPlayerMaster() || (botAI->GetMaster() && botAI->GetMaster()->GetGUID() != playerGuid)) && AI_VALUE2(uint8, "health", "self target") < 90)
|
||||
if ((!botAI->HasRealPlayerMaster() || (botAI->GetMaster() && botAI->GetMaster()->GetGUID() != playerGuid)) &&
|
||||
AI_VALUE2(uint8, "health", "self target") < 90)
|
||||
{
|
||||
WorldPacket packet(CMSG_DUEL_CANCELLED, 8);
|
||||
packet << flagGuid;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ACCEPTDUELACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class AcceptDuelAction : public Action
|
||||
{
|
||||
public:
|
||||
AcceptDuelAction(PlayerbotAI* botAI) : Action(botAI, "accept duel") { }
|
||||
public:
|
||||
AcceptDuelAction(PlayerbotAI* botAI) : Action(botAI, "accept duel") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptInvitationAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PlayerbotSecurity.h"
|
||||
#include "Playerbots.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
bool AcceptInvitationAction::Execute(Event event)
|
||||
@@ -41,8 +43,8 @@ bool AcceptInvitationAction::Execute(Event event)
|
||||
|
||||
if (sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
botAI->SetMaster(inviter);
|
||||
//else
|
||||
//sPlayerbotDbStore->Save(botAI);
|
||||
// else
|
||||
// sPlayerbotDbStore->Save(botAI);
|
||||
|
||||
botAI->ResetStrategies();
|
||||
botAI->ChangeStrategy("+follow,-lfg,-bg", BOT_STATE_NON_COMBAT);
|
||||
@@ -50,7 +52,8 @@ bool AcceptInvitationAction::Execute(Event event)
|
||||
|
||||
botAI->TellMaster("Hello");
|
||||
|
||||
if (sPlayerbotAIConfig->summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig->sightDistance) {
|
||||
if (sPlayerbotAIConfig->summonWhenGroup && bot->GetDistance(inviter) > sPlayerbotAIConfig->sightDistance)
|
||||
{
|
||||
Teleport(inviter, bot);
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ACCEPTINVITATIONACTION_H
|
||||
@@ -12,10 +13,10 @@ class PlayerbotAI;
|
||||
|
||||
class AcceptInvitationAction : public SummonAction
|
||||
{
|
||||
public:
|
||||
AcceptInvitationAction(PlayerbotAI* botAI) : SummonAction(botAI, "accept invitation") { }
|
||||
public:
|
||||
AcceptInvitationAction(PlayerbotAI* botAI) : SummonAction(botAI, "accept invitation") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptQuestAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -112,7 +114,7 @@ bool AcceptQuestShareAction::Execute(Event event)
|
||||
bot->SetDivider(ObjectGuid::Empty);
|
||||
}
|
||||
|
||||
if (bot->CanAddQuest( qInfo, false))
|
||||
if (bot->CanAddQuest(qInfo, false))
|
||||
{
|
||||
bot->AddQuest(qInfo, master);
|
||||
|
||||
@@ -125,7 +127,7 @@ bool AcceptQuestShareAction::Execute(Event event)
|
||||
|
||||
if (qInfo->GetSrcSpell() > 0)
|
||||
{
|
||||
bot->CastSpell( bot, qInfo->GetSrcSpell(), true);
|
||||
bot->CastSpell(bot, qInfo->GetSrcSpell(), true);
|
||||
}
|
||||
|
||||
botAI->TellMaster("Quest accepted");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ACCEPTQUESTACTION_H
|
||||
@@ -13,25 +14,27 @@ class WorldObject;
|
||||
|
||||
class AcceptAllQuestsAction : public QuestAction
|
||||
{
|
||||
public:
|
||||
AcceptAllQuestsAction(PlayerbotAI* botAI, std::string const name = "accept all quests") : QuestAction(botAI, name) { }
|
||||
public:
|
||||
AcceptAllQuestsAction(PlayerbotAI* botAI, std::string const name = "accept all quests") : QuestAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
void ProcessQuest(Quest const* quest, Object* questGiver) override;
|
||||
protected:
|
||||
void ProcessQuest(Quest const* quest, Object* questGiver) override;
|
||||
};
|
||||
|
||||
class AcceptQuestAction : public AcceptAllQuestsAction
|
||||
{
|
||||
public:
|
||||
AcceptQuestAction(PlayerbotAI* botAI) : AcceptAllQuestsAction(botAI, "accept quest") { }
|
||||
bool Execute(Event event) override;
|
||||
public:
|
||||
AcceptQuestAction(PlayerbotAI* botAI) : AcceptAllQuestsAction(botAI, "accept quest") {}
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class AcceptQuestShareAction : public Action
|
||||
{
|
||||
public:
|
||||
AcceptQuestShareAction(PlayerbotAI* botAI) : Action(botAI, "accept quest share") { }
|
||||
bool Execute(Event event) override;
|
||||
public:
|
||||
AcceptQuestShareAction(PlayerbotAI* botAI) : Action(botAI, "accept quest share") {}
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AcceptResurrectAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -18,8 +20,8 @@ bool AcceptResurrectAction::Execute(Event event)
|
||||
|
||||
WorldPacket packet(CMSG_RESURRECT_RESPONSE, 8 + 1);
|
||||
packet << guid;
|
||||
packet << uint8(1); // accept
|
||||
bot->GetSession()->HandleResurrectResponseOpcode(packet); // queue the packet to get around race condition
|
||||
packet << uint8(1); // accept
|
||||
bot->GetSession()->HandleResurrectResponseOpcode(packet); // queue the packet to get around race condition
|
||||
|
||||
botAI->ChangeEngine(BOT_STATE_NON_COMBAT);
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ACCEPTRESURRECTACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class AcceptResurrectAction : public Action
|
||||
{
|
||||
public:
|
||||
AcceptResurrectAction(PlayerbotAI* botAI) : Action(botAI, "accept resurrect") { }
|
||||
public:
|
||||
AcceptResurrectAction(PlayerbotAI* botAI) : Action(botAI, "accept resurrect") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ACTIONCONTEXT_H
|
||||
@@ -8,21 +9,23 @@
|
||||
#include "AddLootAction.h"
|
||||
#include "AttackAction.h"
|
||||
#include "AutoLearnSpellAction.h"
|
||||
#include "BattleGroundTactics.h"
|
||||
#include "AutoTeleportForLevelAction.h"
|
||||
#include "BattleGroundJoinAction.h"
|
||||
#include "BattleGroundTactics.h"
|
||||
#include "BuyAction.h"
|
||||
#include "CastCustomSpellAction.h"
|
||||
#include "ChangeStrategyAction.h"
|
||||
#include "ChangeTalentsAction.h"
|
||||
#include "CheckMailAction.h"
|
||||
#include "CheckValuesAction.h"
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "ChooseTargetActions.h"
|
||||
#include "ChooseTravelTargetAction.h"
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "CombatActions.h"
|
||||
#include "DelayAction.h"
|
||||
#include "DestroyItemAction.h"
|
||||
#include "EmoteAction.h"
|
||||
#include "FollowActions.h"
|
||||
#include "GenericActions.h"
|
||||
#include "GenericSpellActions.h"
|
||||
#include "GiveItemAction.h"
|
||||
@@ -33,14 +36,14 @@
|
||||
#include "ImbueAction.h"
|
||||
#include "InviteToGroupAction.h"
|
||||
#include "LeaveGroupAction.h"
|
||||
#include "FollowActions.h"
|
||||
#include "LootAction.h"
|
||||
#include "MovementActions.h"
|
||||
#include "MoveToRpgTargetAction.h"
|
||||
#include "MoveToTravelTargetAction.h"
|
||||
#include "MovementActions.h"
|
||||
#include "NonCombatActions.h"
|
||||
#include "OutfitAction.h"
|
||||
#include "PositionAction.h"
|
||||
#include "RaidNaxxActions.h"
|
||||
#include "RandomBotUpdateAction.h"
|
||||
#include "ReachTargetActions.h"
|
||||
#include "ReleaseSpiritAction.h"
|
||||
@@ -54,354 +57,353 @@
|
||||
#include "StayActions.h"
|
||||
#include "SuggestWhatToDoAction.h"
|
||||
#include "TravelAction.h"
|
||||
#include "XpGainAction.h"
|
||||
#include "VehicleActions.h"
|
||||
#include "WorldBuffAction.h"
|
||||
#include "RaidNaxxActions.h"
|
||||
#include "AutoTeleportForLevelAction.h"
|
||||
#include "XpGainAction.h"
|
||||
|
||||
class PlayerbotAI;
|
||||
|
||||
class ActionContext : public NamedObjectContext<Action>
|
||||
{
|
||||
public:
|
||||
ActionContext()
|
||||
{
|
||||
creators["mark rti"] = &ActionContext::mark_rti;
|
||||
creators["set return position"] = &ActionContext::set_return_position;
|
||||
creators["rpg"] = &ActionContext::rpg;
|
||||
creators["crpg"] = &ActionContext::crpg;
|
||||
creators["choose rpg target"] = &ActionContext::choose_rpg_target;
|
||||
creators["move to rpg target"] = &ActionContext::move_to_rpg_target;
|
||||
creators["travel"] = &ActionContext::travel;
|
||||
creators["choose travel target"] = &ActionContext::choose_travel_target;
|
||||
creators["move to travel target"] = &ActionContext::move_to_travel_target;
|
||||
creators["move out of collision"] = &ActionContext::move_out_of_collision;
|
||||
creators["move random"] = &ActionContext::move_random;
|
||||
creators["attack"] = &ActionContext::melee;
|
||||
creators["melee"] = &ActionContext::melee;
|
||||
creators["switch to melee"] = &ActionContext::switch_to_melee;
|
||||
creators["switch to ranged"] = &ActionContext::switch_to_ranged;
|
||||
creators["reach spell"] = &ActionContext::ReachSpell;
|
||||
creators["reach melee"] = &ActionContext::ReachMelee;
|
||||
creators["reach party member to heal"] = &ActionContext::reach_party_member_to_heal;
|
||||
creators["reach party member to resurrect"] = &ActionContext::reach_party_member_to_resurrect;
|
||||
creators["flee"] = &ActionContext::flee;
|
||||
creators["flee with pet"] = &ActionContext::flee_with_pet;
|
||||
creators["avoid aoe"] = &ActionContext::avoid_aoe;
|
||||
creators["combat formation move"] = &ActionContext::combat_formation_move;
|
||||
creators["disperse set"] = &ActionContext::disperse_set;
|
||||
creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["lifeblood"] = &ActionContext::lifeblood;
|
||||
creators["arcane torrent"] = &ActionContext::arcane_torrent;
|
||||
creators["end pull"] = &ActionContext::end_pull;
|
||||
creators["healthstone"] = &ActionContext::healthstone;
|
||||
creators["healing potion"] = &ActionContext::healing_potion;
|
||||
creators["mana potion"] = &ActionContext::mana_potion;
|
||||
creators["food"] = &ActionContext::food;
|
||||
creators["drink"] = &ActionContext::drink;
|
||||
creators["tank assist"] = &ActionContext::tank_assist;
|
||||
creators["dps assist"] = &ActionContext::dps_assist;
|
||||
creators["dps aoe"] = &ActionContext::dps_aoe;
|
||||
creators["attack rti target"] = &ActionContext::attack_rti_target;
|
||||
creators["loot"] = &ActionContext::loot;
|
||||
creators["add loot"] = &ActionContext::add_loot;
|
||||
creators["add gathering loot"] = &ActionContext::add_gathering_loot;
|
||||
creators["add all loot"] = &ActionContext::add_all_loot;
|
||||
creators["release loot"] = &ActionContext::release_loot;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["follow"] = &ActionContext::follow;
|
||||
creators["flee to master"] = &ActionContext::flee_to_master;
|
||||
creators["runaway"] = &ActionContext::runaway;
|
||||
creators["stay"] = &ActionContext::stay;
|
||||
creators["sit"] = &ActionContext::sit;
|
||||
creators["attack anything"] = &ActionContext::attack_anything;
|
||||
creators["attack least hp target"] = &ActionContext::attack_least_hp_target;
|
||||
creators["attack enemy player"] = &ActionContext::attack_enemy_player;
|
||||
creators["emote"] = &ActionContext::emote;
|
||||
creators["talk"] = &ActionContext::talk;
|
||||
creators["suggest what to do"] = &ActionContext::suggest_what_to_do;
|
||||
creators["suggest trade"] = &ActionContext::suggest_trade;
|
||||
creators["suggest dungeon"] = &ActionContext::suggest_dungeon;
|
||||
creators["return"] = &ActionContext::_return;
|
||||
creators["move to loot"] = &ActionContext::move_to_loot;
|
||||
creators["open loot"] = &ActionContext::open_loot;
|
||||
creators["guard"] = &ActionContext::guard;
|
||||
creators["move out of enemy contact"] = &ActionContext::move_out_of_enemy_contact;
|
||||
creators["set facing"] = &ActionContext::set_facing;
|
||||
creators["set behind"] = &ActionContext::set_behind;
|
||||
creators["attack duel opponent"] = &ActionContext::attack_duel_opponent;
|
||||
creators["drop target"] = &ActionContext::drop_target;
|
||||
creators["check mail"] = &ActionContext::check_mail;
|
||||
creators["say"] = &ActionContext::say;
|
||||
creators["reveal gathering item"] = &ActionContext::reveal_gathering_item;
|
||||
creators["outfit"] = &ActionContext::outfit;
|
||||
creators["random bot update"] = &ActionContext::random_bot_update;
|
||||
creators["delay"] = &ActionContext::delay;
|
||||
creators["greet"] = &ActionContext::greet;
|
||||
creators["check values"] = &ActionContext::check_values;
|
||||
creators["ra"] = &ActionContext::ra;
|
||||
creators["apply poison"] = &ActionContext::apply_poison;
|
||||
creators["apply stone"] = &ActionContext::apply_stone;
|
||||
creators["apply oil"] = &ActionContext::apply_oil;
|
||||
creators["try emergency"] = &ActionContext::try_emergency;
|
||||
creators["give food"] = &ActionContext::give_food;
|
||||
creators["give water"] = &ActionContext::give_water;
|
||||
creators["mount"] = &ActionContext::mount;
|
||||
creators["war stomp"] = &ActionContext::war_stomp;
|
||||
creators["auto talents"] = &ActionContext::auto_talents;
|
||||
creators["auto learn spell"] = &ActionContext::auto_learn_spell;
|
||||
creators["auto teleport for level"] = &ActionContext::auto_teleport_for_level;
|
||||
creators["auto upgrade equip"] = &ActionContext::auto_upgrade_equip;
|
||||
creators["xp gain"] = &ActionContext::xp_gain;
|
||||
creators["invite nearby"] = &ActionContext::invite_nearby;
|
||||
creators["invite guild"] = &ActionContext::invite_guild;
|
||||
creators["leave far away"] = &ActionContext::leave_far_away;
|
||||
creators["move to dark portal"] = &ActionContext::move_to_dark_portal;
|
||||
creators["move from dark portal"] = &ActionContext::move_from_dark_portal;
|
||||
creators["use dark portal azeroth"] = &ActionContext::use_dark_portal_azeroth;
|
||||
creators["world buff"] = &ActionContext::world_buff;
|
||||
creators["hearthstone"] = &ActionContext::hearthstone;
|
||||
creators["cast random spell"] = &ActionContext::cast_random_spell;
|
||||
creators["free bg join"] = &ActionContext::free_bg_join;
|
||||
creators["use random recipe"] = &ActionContext::use_random_recipe;
|
||||
creators["use random quest item"] = &ActionContext::use_random_quest_item;
|
||||
creators["craft random item"] = &ActionContext::craft_random_item;
|
||||
creators["smart destroy item"] = &ActionContext::smart_destroy_item;
|
||||
creators["disenchant random item"] = &ActionContext::disenchant_random_item;
|
||||
creators["enchant random item"] = &ActionContext::enchant_random_item;
|
||||
creators["reset instances"] = &ActionContext::reset_instances;
|
||||
creators["buy petition"] = &ActionContext::buy_petition;
|
||||
creators["offer petition"] = &ActionContext::offer_petition;
|
||||
creators["offer petition nearby"] = &ActionContext::offer_petition_nearby;
|
||||
creators["turn in petition"] = &ActionContext::turn_in_petition;
|
||||
creators["buy tabard"] = &ActionContext::buy_tabard;
|
||||
creators["guild manage nearby"] = &ActionContext::guild_manage_nearby;
|
||||
|
||||
// BG Tactics
|
||||
creators["bg tactics"] = &ActionContext::bg_tactics;
|
||||
creators["bg move to start"] = &ActionContext::bg_move_to_start;
|
||||
creators["bg move to objective"] = &ActionContext::bg_move_to_objective;
|
||||
creators["bg select objective"] = &ActionContext::bg_select_objective;
|
||||
creators["bg check objective"] = &ActionContext::bg_check_objective;
|
||||
creators["bg attack fc"] = &ActionContext::bg_attack_fc;
|
||||
creators["bg protect fc"] = &ActionContext::bg_protect_fc;
|
||||
creators["bg use buff"] = &ActionContext::bg_use_buff;
|
||||
creators["attack enemy flag carrier"] = &ActionContext::attack_enemy_fc;
|
||||
creators["bg check flag"] = &ActionContext::bg_check_flag;
|
||||
|
||||
// Vehicles
|
||||
creators["enter vehicle"] = &ActionContext::enter_vehicle;
|
||||
creators["leave vehicle"] = &ActionContext::leave_vehicle;
|
||||
creators["hurl boulder"] = &ActionContext::hurl_boulder;
|
||||
creators["ram"] = &ActionContext::ram;
|
||||
creators["steam rush"] = &ActionContext::steam_rush;
|
||||
creators["steam blast"] = &ActionContext::steam_blast;
|
||||
creators["napalm"] = &ActionContext::napalm;
|
||||
creators["fire cannon"] = &ActionContext::fire_cannon;
|
||||
creators["incendiary rocket"] = &ActionContext::incendiary_rocket;
|
||||
creators["rocket blast"] = &ActionContext::rocket_blast;
|
||||
creators["blade salvo"] = &ActionContext::blade_salvo;
|
||||
creators["glaive throw"] = &ActionContext::glaive_throw;
|
||||
|
||||
//Rpg
|
||||
creators["rpg stay"] = &ActionContext::rpg_stay;
|
||||
creators["rpg work"] = &ActionContext::rpg_work;
|
||||
creators["rpg emote"] = &ActionContext::rpg_emote;
|
||||
creators["rpg cancel"] = &ActionContext::rpg_cancel;
|
||||
creators["rpg taxi"] = &ActionContext::rpg_taxi;
|
||||
creators["rpg discover"] = &ActionContext::rpg_discover;
|
||||
creators["rpg start quest"] = &ActionContext::rpg_start_quest;
|
||||
creators["rpg end quest"] = &ActionContext::rpg_end_quest;
|
||||
creators["rpg buy"] = &ActionContext::rpg_buy;
|
||||
creators["rpg sell"] = &ActionContext::rpg_sell;
|
||||
creators["rpg repair"] = &ActionContext::rpg_repair;
|
||||
creators["rpg train"] = &ActionContext::rpg_train;
|
||||
creators["rpg heal"] = &ActionContext::rpg_heal;
|
||||
creators["rpg home bind"] = &ActionContext::rpg_home_bind;
|
||||
creators["rpg queue bg"] = &ActionContext::rpg_queue_bg;
|
||||
creators["rpg buy petition"] = &ActionContext::rpg_buy_petition;
|
||||
creators["rpg use"] = &ActionContext::rpg_use;
|
||||
creators["rpg spell"] = &ActionContext::rpg_spell;
|
||||
creators["rpg craft"] = &ActionContext::rpg_craft;
|
||||
creators["rpg trade useful"] = &ActionContext::rpg_trade_useful;
|
||||
creators["rpg duel"] = &ActionContext::rpg_duel;
|
||||
creators["rpg mount anim"] = &ActionContext::rpg_mount_anim;
|
||||
|
||||
creators["toggle pet spell"] = &ActionContext::toggle_pet_spell;
|
||||
creators["pet attack"] = &ActionContext::pet_attack;
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
static Action* give_water(PlayerbotAI* botAI) { return new GiveWaterAction(botAI); }
|
||||
static Action* give_food(PlayerbotAI* botAI) { return new GiveFoodAction(botAI); }
|
||||
static Action* ra(PlayerbotAI* botAI) { return new RemoveAuraAction(botAI); }
|
||||
static Action* mark_rti(PlayerbotAI* botAI) { return new MarkRtiAction(botAI); }
|
||||
static Action* set_return_position(PlayerbotAI* botAI) { return new SetReturnPositionAction(botAI); }
|
||||
static Action* rpg(PlayerbotAI* botAI) { return new RpgAction(botAI); }
|
||||
static Action* crpg(PlayerbotAI* botAI) { return new CRpgAction(botAI); }
|
||||
static Action* choose_rpg_target(PlayerbotAI* botAI) { return new ChooseRpgTargetAction(botAI); }
|
||||
static Action* move_to_rpg_target(PlayerbotAI* botAI) { return new MoveToRpgTargetAction(botAI); }
|
||||
static Action* travel(PlayerbotAI* botAI) { return new TravelAction(botAI); }
|
||||
static Action* choose_travel_target(PlayerbotAI* botAI) { return new ChooseTravelTargetAction(botAI); }
|
||||
static Action* move_to_travel_target(PlayerbotAI* botAI) { return new MoveToTravelTargetAction(botAI); }
|
||||
static Action* move_out_of_collision(PlayerbotAI* botAI) { return new MoveOutOfCollisionAction(botAI); }
|
||||
static Action* move_random(PlayerbotAI* botAI) { return new MoveRandomAction(botAI); }
|
||||
static Action* check_values(PlayerbotAI* botAI) { return new CheckValuesAction(botAI); }
|
||||
static Action* greet(PlayerbotAI* botAI) { return new GreetAction(botAI); }
|
||||
static Action* check_mail(PlayerbotAI* botAI) { return new CheckMailAction(botAI); }
|
||||
static Action* drop_target(PlayerbotAI* botAI) { return new DropTargetAction(botAI); }
|
||||
static Action* attack_duel_opponent(PlayerbotAI* botAI) { return new AttackDuelOpponentAction(botAI); }
|
||||
static Action* guard(PlayerbotAI* botAI) { return new GuardAction(botAI); }
|
||||
static Action* open_loot(PlayerbotAI* botAI) { return new OpenLootAction(botAI); }
|
||||
static Action* move_to_loot(PlayerbotAI* botAI) { return new MoveToLootAction(botAI); }
|
||||
static Action* _return(PlayerbotAI* botAI) { return new ReturnAction(botAI); }
|
||||
static Action* shoot(PlayerbotAI* botAI) { return new CastShootAction(botAI); }
|
||||
static Action* melee(PlayerbotAI* botAI) { return new MeleeAction(botAI); }
|
||||
static Action* switch_to_melee(PlayerbotAI* botAI) { return new SwitchToMeleeAction(botAI); }
|
||||
static Action* switch_to_ranged(PlayerbotAI* botAI) { return new SwitchToRangedAction(botAI); }
|
||||
static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); }
|
||||
static Action* ReachMelee(PlayerbotAI* botAI) { return new ReachMeleeAction(botAI); }
|
||||
static Action* reach_party_member_to_heal(PlayerbotAI* botAI) { return new ReachPartyMemberToHealAction(botAI); }
|
||||
static Action* reach_party_member_to_resurrect(PlayerbotAI* botAI) { return new ReachPartyMemberToResurrectAction(botAI); }
|
||||
static Action* flee(PlayerbotAI* botAI) { return new FleeAction(botAI); }
|
||||
static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); }
|
||||
static Action* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeAction(botAI); }
|
||||
static Action* combat_formation_move(PlayerbotAI* botAI) { return new CombatFormationMoveAction(botAI); }
|
||||
static Action* disperse_set(PlayerbotAI* botAI) { return new DisperseSetAction(botAI); }
|
||||
static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); }
|
||||
static Action* lifeblood(PlayerbotAI* botAI) { return new CastLifeBloodAction(botAI); }
|
||||
static Action* arcane_torrent(PlayerbotAI* botAI) { return new CastArcaneTorrentAction(botAI); }
|
||||
static Action* mana_tap(PlayerbotAI* botAI) { return new CastManaTapAction(botAI); }
|
||||
static Action* end_pull(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI, "-pull"); }
|
||||
|
||||
static Action* emote(PlayerbotAI* botAI) { return new EmoteAction(botAI); }
|
||||
static Action* talk(PlayerbotAI* botAI) { return new TalkAction(botAI); }
|
||||
static Action* suggest_what_to_do(PlayerbotAI* botAI) { return new SuggestWhatToDoAction(botAI); }
|
||||
static Action* suggest_trade(PlayerbotAI* botAI) { return new SuggestTradeAction(botAI); }
|
||||
static Action* suggest_dungeon(PlayerbotAI* botAI) { return new SuggestDungeonAction(botAI); }
|
||||
static Action* attack_anything(PlayerbotAI* botAI) { return new AttackAnythingAction(botAI); }
|
||||
static Action* attack_least_hp_target(PlayerbotAI* botAI) { return new AttackLeastHpTargetAction(botAI); }
|
||||
static Action* attack_enemy_player(PlayerbotAI* botAI) { return new AttackEnemyPlayerAction(botAI); }
|
||||
static Action* stay(PlayerbotAI* botAI) { return new StayAction(botAI); }
|
||||
static Action* sit(PlayerbotAI* botAI) { return new SitAction(botAI); }
|
||||
static Action* runaway(PlayerbotAI* botAI) { return new RunAwayAction(botAI); }
|
||||
static Action* follow(PlayerbotAI* botAI) { return new FollowAction(botAI); }
|
||||
static Action* flee_to_master(PlayerbotAI* botAI) { return new FleeToMasterAction(botAI); }
|
||||
static Action* add_gathering_loot(PlayerbotAI* botAI) { return new AddGatheringLootAction(botAI); }
|
||||
static Action* add_loot(PlayerbotAI* botAI) { return new AddLootAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
static Action* loot(PlayerbotAI* botAI) { return new LootAction(botAI); }
|
||||
static Action* release_loot(PlayerbotAI* botAI) { return new ReleaseLootAction(botAI); }
|
||||
static Action* dps_assist(PlayerbotAI* botAI) { return new DpsAssistAction(botAI); }
|
||||
static Action* dps_aoe(PlayerbotAI* botAI) { return new DpsAoeAction(botAI); }
|
||||
static Action* attack_rti_target(PlayerbotAI* botAI) { return new AttackRtiTargetAction(botAI); }
|
||||
static Action* tank_assist(PlayerbotAI* botAI) { return new TankAssistAction(botAI); }
|
||||
static Action* drink(PlayerbotAI* botAI) { return new DrinkAction(botAI); }
|
||||
static Action* food(PlayerbotAI* botAI) { return new EatAction(botAI); }
|
||||
static Action* mana_potion(PlayerbotAI* botAI) { return new UseManaPotion(botAI); }
|
||||
static Action* healing_potion(PlayerbotAI* botAI) { return new UseHealingPotion(botAI); }
|
||||
static Action* healthstone(PlayerbotAI* botAI) { return new UseItemAction(botAI, "healthstone"); }
|
||||
static Action* move_out_of_enemy_contact(PlayerbotAI* botAI) { return new MoveOutOfEnemyContactAction(botAI); }
|
||||
static Action* set_facing(PlayerbotAI* botAI) { return new SetFacingTargetAction(botAI); }
|
||||
static Action* set_behind(PlayerbotAI* botAI) { return new SetBehindTargetAction(botAI); }
|
||||
static Action* say(PlayerbotAI* botAI) { return new SayAction(botAI); }
|
||||
static Action* reveal_gathering_item(PlayerbotAI* botAI) { return new RevealGatheringItemAction(botAI); }
|
||||
static Action* outfit(PlayerbotAI* botAI) { return new OutfitAction(botAI); }
|
||||
static Action* random_bot_update(PlayerbotAI* botAI) { return new RandomBotUpdateAction(botAI); }
|
||||
static Action* delay(PlayerbotAI* botAI) { return new DelayAction(botAI); }
|
||||
|
||||
static Action* apply_poison(PlayerbotAI* botAI) { return new ImbueWithPoisonAction(botAI); }
|
||||
static Action* apply_oil(PlayerbotAI* botAI) { return new ImbueWithOilAction(botAI); }
|
||||
static Action* apply_stone(PlayerbotAI* botAI) { return new ImbueWithStoneAction(botAI); }
|
||||
static Action* try_emergency(PlayerbotAI* botAI) { return new TryEmergencyAction(botAI); }
|
||||
static Action* mount(PlayerbotAI* botAI) { return new CastSpellAction(botAI, "mount"); }
|
||||
static Action* war_stomp(PlayerbotAI* botAI) { return new CastWarStompAction(botAI); }
|
||||
static Action* auto_talents(PlayerbotAI* botAI) { return new AutoSetTalentsAction(botAI); }
|
||||
static Action* auto_learn_spell(PlayerbotAI* botAI) { return new AutoLearnSpellAction(botAI); }
|
||||
static Action* auto_teleport_for_level(PlayerbotAI* botAI) { return new AutoTeleportForLevelAction(botAI); }
|
||||
static Action* auto_upgrade_equip(PlayerbotAI* botAI) { return new AutoUpgradeEquipAction(botAI); }
|
||||
static Action* xp_gain(PlayerbotAI* botAI) { return new XpGainAction(botAI); }
|
||||
static Action* invite_nearby(PlayerbotAI* botAI) { return new InviteNearbyToGroupAction(botAI); }
|
||||
static Action* invite_guild(PlayerbotAI* botAI) { return new InviteGuildToGroupAction(botAI); }
|
||||
static Action* leave_far_away(PlayerbotAI* botAI) { return new LeaveFarAwayAction(botAI); }
|
||||
static Action* move_to_dark_portal(PlayerbotAI* botAI) { return new MoveToDarkPortalAction(botAI); }
|
||||
static Action* use_dark_portal_azeroth(PlayerbotAI* botAI) { return new DarkPortalAzerothAction(botAI); }
|
||||
static Action* move_from_dark_portal(PlayerbotAI* botAI) { return new MoveFromDarkPortalAction(botAI); }
|
||||
static Action* world_buff(PlayerbotAI* botAI) { return new WorldBuffAction(botAI); }
|
||||
static Action* hearthstone(PlayerbotAI* botAI) { return new UseHearthStone(botAI); }
|
||||
static Action* cast_random_spell(PlayerbotAI* botAI) { return new CastRandomSpellAction(botAI); }
|
||||
static Action* free_bg_join(PlayerbotAI* botAI) { return new FreeBGJoinAction(botAI); }
|
||||
|
||||
static Action* use_random_recipe(PlayerbotAI* botAI) { return new UseRandomRecipe(botAI); }
|
||||
static Action* use_random_quest_item(PlayerbotAI* botAI) { return new UseRandomQuestItem(botAI); }
|
||||
static Action* craft_random_item(PlayerbotAI* botAI) { return new CraftRandomItemAction(botAI); }
|
||||
static Action* smart_destroy_item(PlayerbotAI* botAI) { return new SmartDestroyItemAction(botAI); }
|
||||
static Action* disenchant_random_item(PlayerbotAI* botAI) { return new DisEnchantRandomItemAction(botAI); }
|
||||
static Action* enchant_random_item(PlayerbotAI* botAI) { return new EnchantRandomItemAction(botAI); }
|
||||
static Action* reset_instances(PlayerbotAI* botAI) { return new ResetInstancesAction(botAI); }
|
||||
static Action* buy_petition(PlayerbotAI* botAI) { return new BuyPetitionAction(botAI); }
|
||||
static Action* offer_petition(PlayerbotAI* botAI) { return new PetitionOfferAction(botAI); }
|
||||
static Action* offer_petition_nearby(PlayerbotAI* botAI) { return new PetitionOfferNearbyAction(botAI); }
|
||||
static Action* turn_in_petition(PlayerbotAI* botAI) { return new PetitionTurnInAction(botAI); }
|
||||
static Action* buy_tabard(PlayerbotAI* botAI) { return new BuyTabardAction(botAI); }
|
||||
static Action* guild_manage_nearby(PlayerbotAI* botAI) { return new GuildManageNearbyAction(botAI); }
|
||||
public:
|
||||
ActionContext()
|
||||
{
|
||||
creators["mark rti"] = &ActionContext::mark_rti;
|
||||
creators["set return position"] = &ActionContext::set_return_position;
|
||||
creators["rpg"] = &ActionContext::rpg;
|
||||
creators["crpg"] = &ActionContext::crpg;
|
||||
creators["choose rpg target"] = &ActionContext::choose_rpg_target;
|
||||
creators["move to rpg target"] = &ActionContext::move_to_rpg_target;
|
||||
creators["travel"] = &ActionContext::travel;
|
||||
creators["choose travel target"] = &ActionContext::choose_travel_target;
|
||||
creators["move to travel target"] = &ActionContext::move_to_travel_target;
|
||||
creators["move out of collision"] = &ActionContext::move_out_of_collision;
|
||||
creators["move random"] = &ActionContext::move_random;
|
||||
creators["attack"] = &ActionContext::melee;
|
||||
creators["melee"] = &ActionContext::melee;
|
||||
creators["switch to melee"] = &ActionContext::switch_to_melee;
|
||||
creators["switch to ranged"] = &ActionContext::switch_to_ranged;
|
||||
creators["reach spell"] = &ActionContext::ReachSpell;
|
||||
creators["reach melee"] = &ActionContext::ReachMelee;
|
||||
creators["reach party member to heal"] = &ActionContext::reach_party_member_to_heal;
|
||||
creators["reach party member to resurrect"] = &ActionContext::reach_party_member_to_resurrect;
|
||||
creators["flee"] = &ActionContext::flee;
|
||||
creators["flee with pet"] = &ActionContext::flee_with_pet;
|
||||
creators["avoid aoe"] = &ActionContext::avoid_aoe;
|
||||
creators["combat formation move"] = &ActionContext::combat_formation_move;
|
||||
creators["disperse set"] = &ActionContext::disperse_set;
|
||||
creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["lifeblood"] = &ActionContext::lifeblood;
|
||||
creators["arcane torrent"] = &ActionContext::arcane_torrent;
|
||||
creators["end pull"] = &ActionContext::end_pull;
|
||||
creators["healthstone"] = &ActionContext::healthstone;
|
||||
creators["healing potion"] = &ActionContext::healing_potion;
|
||||
creators["mana potion"] = &ActionContext::mana_potion;
|
||||
creators["food"] = &ActionContext::food;
|
||||
creators["drink"] = &ActionContext::drink;
|
||||
creators["tank assist"] = &ActionContext::tank_assist;
|
||||
creators["dps assist"] = &ActionContext::dps_assist;
|
||||
creators["dps aoe"] = &ActionContext::dps_aoe;
|
||||
creators["attack rti target"] = &ActionContext::attack_rti_target;
|
||||
creators["loot"] = &ActionContext::loot;
|
||||
creators["add loot"] = &ActionContext::add_loot;
|
||||
creators["add gathering loot"] = &ActionContext::add_gathering_loot;
|
||||
creators["add all loot"] = &ActionContext::add_all_loot;
|
||||
creators["release loot"] = &ActionContext::release_loot;
|
||||
creators["shoot"] = &ActionContext::shoot;
|
||||
creators["follow"] = &ActionContext::follow;
|
||||
creators["flee to master"] = &ActionContext::flee_to_master;
|
||||
creators["runaway"] = &ActionContext::runaway;
|
||||
creators["stay"] = &ActionContext::stay;
|
||||
creators["sit"] = &ActionContext::sit;
|
||||
creators["attack anything"] = &ActionContext::attack_anything;
|
||||
creators["attack least hp target"] = &ActionContext::attack_least_hp_target;
|
||||
creators["attack enemy player"] = &ActionContext::attack_enemy_player;
|
||||
creators["emote"] = &ActionContext::emote;
|
||||
creators["talk"] = &ActionContext::talk;
|
||||
creators["suggest what to do"] = &ActionContext::suggest_what_to_do;
|
||||
creators["suggest trade"] = &ActionContext::suggest_trade;
|
||||
creators["suggest dungeon"] = &ActionContext::suggest_dungeon;
|
||||
creators["return"] = &ActionContext::_return;
|
||||
creators["move to loot"] = &ActionContext::move_to_loot;
|
||||
creators["open loot"] = &ActionContext::open_loot;
|
||||
creators["guard"] = &ActionContext::guard;
|
||||
creators["move out of enemy contact"] = &ActionContext::move_out_of_enemy_contact;
|
||||
creators["set facing"] = &ActionContext::set_facing;
|
||||
creators["set behind"] = &ActionContext::set_behind;
|
||||
creators["attack duel opponent"] = &ActionContext::attack_duel_opponent;
|
||||
creators["drop target"] = &ActionContext::drop_target;
|
||||
creators["check mail"] = &ActionContext::check_mail;
|
||||
creators["say"] = &ActionContext::say;
|
||||
creators["reveal gathering item"] = &ActionContext::reveal_gathering_item;
|
||||
creators["outfit"] = &ActionContext::outfit;
|
||||
creators["random bot update"] = &ActionContext::random_bot_update;
|
||||
creators["delay"] = &ActionContext::delay;
|
||||
creators["greet"] = &ActionContext::greet;
|
||||
creators["check values"] = &ActionContext::check_values;
|
||||
creators["ra"] = &ActionContext::ra;
|
||||
creators["apply poison"] = &ActionContext::apply_poison;
|
||||
creators["apply stone"] = &ActionContext::apply_stone;
|
||||
creators["apply oil"] = &ActionContext::apply_oil;
|
||||
creators["try emergency"] = &ActionContext::try_emergency;
|
||||
creators["give food"] = &ActionContext::give_food;
|
||||
creators["give water"] = &ActionContext::give_water;
|
||||
creators["mount"] = &ActionContext::mount;
|
||||
creators["war stomp"] = &ActionContext::war_stomp;
|
||||
creators["auto talents"] = &ActionContext::auto_talents;
|
||||
creators["auto learn spell"] = &ActionContext::auto_learn_spell;
|
||||
creators["auto teleport for level"] = &ActionContext::auto_teleport_for_level;
|
||||
creators["auto upgrade equip"] = &ActionContext::auto_upgrade_equip;
|
||||
creators["xp gain"] = &ActionContext::xp_gain;
|
||||
creators["invite nearby"] = &ActionContext::invite_nearby;
|
||||
creators["invite guild"] = &ActionContext::invite_guild;
|
||||
creators["leave far away"] = &ActionContext::leave_far_away;
|
||||
creators["move to dark portal"] = &ActionContext::move_to_dark_portal;
|
||||
creators["move from dark portal"] = &ActionContext::move_from_dark_portal;
|
||||
creators["use dark portal azeroth"] = &ActionContext::use_dark_portal_azeroth;
|
||||
creators["world buff"] = &ActionContext::world_buff;
|
||||
creators["hearthstone"] = &ActionContext::hearthstone;
|
||||
creators["cast random spell"] = &ActionContext::cast_random_spell;
|
||||
creators["free bg join"] = &ActionContext::free_bg_join;
|
||||
creators["use random recipe"] = &ActionContext::use_random_recipe;
|
||||
creators["use random quest item"] = &ActionContext::use_random_quest_item;
|
||||
creators["craft random item"] = &ActionContext::craft_random_item;
|
||||
creators["smart destroy item"] = &ActionContext::smart_destroy_item;
|
||||
creators["disenchant random item"] = &ActionContext::disenchant_random_item;
|
||||
creators["enchant random item"] = &ActionContext::enchant_random_item;
|
||||
creators["reset instances"] = &ActionContext::reset_instances;
|
||||
creators["buy petition"] = &ActionContext::buy_petition;
|
||||
creators["offer petition"] = &ActionContext::offer_petition;
|
||||
creators["offer petition nearby"] = &ActionContext::offer_petition_nearby;
|
||||
creators["turn in petition"] = &ActionContext::turn_in_petition;
|
||||
creators["buy tabard"] = &ActionContext::buy_tabard;
|
||||
creators["guild manage nearby"] = &ActionContext::guild_manage_nearby;
|
||||
|
||||
// BG Tactics
|
||||
static Action* bg_tactics(PlayerbotAI* botAI) { return new BGTactics(botAI); }
|
||||
static Action* bg_move_to_start(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to start"); }
|
||||
static Action* bg_move_to_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to objective"); }
|
||||
static Action* bg_select_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "select objective"); }
|
||||
static Action* bg_check_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "check objective"); }
|
||||
static Action* bg_attack_fc(PlayerbotAI* botAI) { return new BGTactics(botAI, "attack fc"); }
|
||||
static Action* bg_protect_fc(PlayerbotAI* botAI) { return new BGTactics(botAI, "protect fc"); }
|
||||
static Action* attack_enemy_fc(PlayerbotAI* botAI) { return new AttackEnemyFlagCarrierAction(botAI); }
|
||||
static Action* bg_use_buff(PlayerbotAI* botAI) { return new BGTactics(botAI, "use buff"); }
|
||||
static Action* bg_check_flag(PlayerbotAI* botAI) { return new BGTactics(botAI, "check flag"); }
|
||||
creators["bg tactics"] = &ActionContext::bg_tactics;
|
||||
creators["bg move to start"] = &ActionContext::bg_move_to_start;
|
||||
creators["bg move to objective"] = &ActionContext::bg_move_to_objective;
|
||||
creators["bg select objective"] = &ActionContext::bg_select_objective;
|
||||
creators["bg check objective"] = &ActionContext::bg_check_objective;
|
||||
creators["bg attack fc"] = &ActionContext::bg_attack_fc;
|
||||
creators["bg protect fc"] = &ActionContext::bg_protect_fc;
|
||||
creators["bg use buff"] = &ActionContext::bg_use_buff;
|
||||
creators["attack enemy flag carrier"] = &ActionContext::attack_enemy_fc;
|
||||
creators["bg check flag"] = &ActionContext::bg_check_flag;
|
||||
|
||||
// Vehicles
|
||||
static Action* enter_vehicle(PlayerbotAI* botAI) { return new EnterVehicleAction(botAI); }
|
||||
static Action* leave_vehicle(PlayerbotAI* botAI) { return new LeaveVehicleAction(botAI); }
|
||||
static Action* hurl_boulder(PlayerbotAI* botAI) { return new CastHurlBoulderAction(botAI); }
|
||||
static Action* ram(PlayerbotAI* botAI) { return new CastRamAction(botAI); }
|
||||
static Action* steam_blast(PlayerbotAI* botAI) { return new CastSteamBlastAction(botAI); }
|
||||
static Action* steam_rush(PlayerbotAI* botAI) { return new CastSteamRushAction(botAI); }
|
||||
static Action* napalm(PlayerbotAI* botAI) { return new CastNapalmAction(botAI); }
|
||||
static Action* fire_cannon(PlayerbotAI* botAI) { return new CastFireCannonAction(botAI); }
|
||||
static Action* incendiary_rocket(PlayerbotAI* botAI) { return new CastIncendiaryRocketAction(botAI); }
|
||||
static Action* rocket_blast(PlayerbotAI* botAI) { return new CastRocketBlastAction(botAI); }
|
||||
static Action* glaive_throw(PlayerbotAI* botAI) { return new CastGlaiveThrowAction(botAI); }
|
||||
static Action* blade_salvo(PlayerbotAI* botAI) { return new CastBladeSalvoAction(botAI); }
|
||||
creators["enter vehicle"] = &ActionContext::enter_vehicle;
|
||||
creators["leave vehicle"] = &ActionContext::leave_vehicle;
|
||||
creators["hurl boulder"] = &ActionContext::hurl_boulder;
|
||||
creators["ram"] = &ActionContext::ram;
|
||||
creators["steam rush"] = &ActionContext::steam_rush;
|
||||
creators["steam blast"] = &ActionContext::steam_blast;
|
||||
creators["napalm"] = &ActionContext::napalm;
|
||||
creators["fire cannon"] = &ActionContext::fire_cannon;
|
||||
creators["incendiary rocket"] = &ActionContext::incendiary_rocket;
|
||||
creators["rocket blast"] = &ActionContext::rocket_blast;
|
||||
creators["blade salvo"] = &ActionContext::blade_salvo;
|
||||
creators["glaive throw"] = &ActionContext::glaive_throw;
|
||||
|
||||
//Rpg
|
||||
static Action* rpg_stay(PlayerbotAI* botAI) { return new RpgStayAction(botAI); }
|
||||
static Action* rpg_work(PlayerbotAI* botAI) { return new RpgWorkAction(botAI); }
|
||||
static Action* rpg_emote(PlayerbotAI* botAI) { return new RpgEmoteAction(botAI); }
|
||||
static Action* rpg_cancel(PlayerbotAI* botAI) { return new RpgCancelAction(botAI); }
|
||||
static Action* rpg_taxi(PlayerbotAI* botAI) { return new RpgTaxiAction(botAI); }
|
||||
static Action* rpg_discover(PlayerbotAI* botAI) { return new RpgDiscoverAction(botAI); }
|
||||
static Action* rpg_start_quest(PlayerbotAI* botAI) { return new RpgStartQuestAction(botAI); }
|
||||
static Action* rpg_end_quest(PlayerbotAI* botAI) { return new RpgEndQuestAction(botAI); }
|
||||
static Action* rpg_buy(PlayerbotAI* botAI) { return new RpgBuyAction(botAI); }
|
||||
static Action* rpg_sell(PlayerbotAI* botAI) { return new RpgSellAction(botAI); }
|
||||
static Action* rpg_repair(PlayerbotAI* botAI) { return new RpgRepairAction(botAI); }
|
||||
static Action* rpg_train(PlayerbotAI* botAI) { return new RpgTrainAction(botAI); }
|
||||
static Action* rpg_heal(PlayerbotAI* botAI) { return new RpgHealAction(botAI); }
|
||||
static Action* rpg_home_bind(PlayerbotAI* botAI) { return new RpgHomeBindAction(botAI); }
|
||||
static Action* rpg_queue_bg(PlayerbotAI* botAI) { return new RpgQueueBgAction(botAI); }
|
||||
static Action* rpg_buy_petition(PlayerbotAI* botAI) { return new RpgBuyPetitionAction(botAI); }
|
||||
static Action* rpg_use(PlayerbotAI* botAI) { return new RpgUseAction(botAI); }
|
||||
static Action* rpg_spell(PlayerbotAI* botAI) { return new RpgSpellAction(botAI); }
|
||||
static Action* rpg_craft(PlayerbotAI* botAI) { return new RpgCraftAction(botAI); }
|
||||
static Action* rpg_trade_useful(PlayerbotAI* botAI) { return new RpgTradeUsefulAction(botAI); }
|
||||
static Action* rpg_duel(PlayerbotAI* botAI) { return new RpgDuelAction(botAI); }
|
||||
static Action* rpg_mount_anim(PlayerbotAI* botAI) { return new RpgMountAnimAction(botAI); }
|
||||
// Rpg
|
||||
creators["rpg stay"] = &ActionContext::rpg_stay;
|
||||
creators["rpg work"] = &ActionContext::rpg_work;
|
||||
creators["rpg emote"] = &ActionContext::rpg_emote;
|
||||
creators["rpg cancel"] = &ActionContext::rpg_cancel;
|
||||
creators["rpg taxi"] = &ActionContext::rpg_taxi;
|
||||
creators["rpg discover"] = &ActionContext::rpg_discover;
|
||||
creators["rpg start quest"] = &ActionContext::rpg_start_quest;
|
||||
creators["rpg end quest"] = &ActionContext::rpg_end_quest;
|
||||
creators["rpg buy"] = &ActionContext::rpg_buy;
|
||||
creators["rpg sell"] = &ActionContext::rpg_sell;
|
||||
creators["rpg repair"] = &ActionContext::rpg_repair;
|
||||
creators["rpg train"] = &ActionContext::rpg_train;
|
||||
creators["rpg heal"] = &ActionContext::rpg_heal;
|
||||
creators["rpg home bind"] = &ActionContext::rpg_home_bind;
|
||||
creators["rpg queue bg"] = &ActionContext::rpg_queue_bg;
|
||||
creators["rpg buy petition"] = &ActionContext::rpg_buy_petition;
|
||||
creators["rpg use"] = &ActionContext::rpg_use;
|
||||
creators["rpg spell"] = &ActionContext::rpg_spell;
|
||||
creators["rpg craft"] = &ActionContext::rpg_craft;
|
||||
creators["rpg trade useful"] = &ActionContext::rpg_trade_useful;
|
||||
creators["rpg duel"] = &ActionContext::rpg_duel;
|
||||
creators["rpg mount anim"] = &ActionContext::rpg_mount_anim;
|
||||
|
||||
static Action* toggle_pet_spell(PlayerbotAI* ai) { return new TogglePetSpellAutoCastAction(ai); }
|
||||
static Action* pet_attack(PlayerbotAI* ai) { return new PetAttackAction(ai); }
|
||||
|
||||
creators["toggle pet spell"] = &ActionContext::toggle_pet_spell;
|
||||
creators["pet attack"] = &ActionContext::pet_attack;
|
||||
}
|
||||
|
||||
private:
|
||||
static Action* give_water(PlayerbotAI* botAI) { return new GiveWaterAction(botAI); }
|
||||
static Action* give_food(PlayerbotAI* botAI) { return new GiveFoodAction(botAI); }
|
||||
static Action* ra(PlayerbotAI* botAI) { return new RemoveAuraAction(botAI); }
|
||||
static Action* mark_rti(PlayerbotAI* botAI) { return new MarkRtiAction(botAI); }
|
||||
static Action* set_return_position(PlayerbotAI* botAI) { return new SetReturnPositionAction(botAI); }
|
||||
static Action* rpg(PlayerbotAI* botAI) { return new RpgAction(botAI); }
|
||||
static Action* crpg(PlayerbotAI* botAI) { return new CRpgAction(botAI); }
|
||||
static Action* choose_rpg_target(PlayerbotAI* botAI) { return new ChooseRpgTargetAction(botAI); }
|
||||
static Action* move_to_rpg_target(PlayerbotAI* botAI) { return new MoveToRpgTargetAction(botAI); }
|
||||
static Action* travel(PlayerbotAI* botAI) { return new TravelAction(botAI); }
|
||||
static Action* choose_travel_target(PlayerbotAI* botAI) { return new ChooseTravelTargetAction(botAI); }
|
||||
static Action* move_to_travel_target(PlayerbotAI* botAI) { return new MoveToTravelTargetAction(botAI); }
|
||||
static Action* move_out_of_collision(PlayerbotAI* botAI) { return new MoveOutOfCollisionAction(botAI); }
|
||||
static Action* move_random(PlayerbotAI* botAI) { return new MoveRandomAction(botAI); }
|
||||
static Action* check_values(PlayerbotAI* botAI) { return new CheckValuesAction(botAI); }
|
||||
static Action* greet(PlayerbotAI* botAI) { return new GreetAction(botAI); }
|
||||
static Action* check_mail(PlayerbotAI* botAI) { return new CheckMailAction(botAI); }
|
||||
static Action* drop_target(PlayerbotAI* botAI) { return new DropTargetAction(botAI); }
|
||||
static Action* attack_duel_opponent(PlayerbotAI* botAI) { return new AttackDuelOpponentAction(botAI); }
|
||||
static Action* guard(PlayerbotAI* botAI) { return new GuardAction(botAI); }
|
||||
static Action* open_loot(PlayerbotAI* botAI) { return new OpenLootAction(botAI); }
|
||||
static Action* move_to_loot(PlayerbotAI* botAI) { return new MoveToLootAction(botAI); }
|
||||
static Action* _return(PlayerbotAI* botAI) { return new ReturnAction(botAI); }
|
||||
static Action* shoot(PlayerbotAI* botAI) { return new CastShootAction(botAI); }
|
||||
static Action* melee(PlayerbotAI* botAI) { return new MeleeAction(botAI); }
|
||||
static Action* switch_to_melee(PlayerbotAI* botAI) { return new SwitchToMeleeAction(botAI); }
|
||||
static Action* switch_to_ranged(PlayerbotAI* botAI) { return new SwitchToRangedAction(botAI); }
|
||||
static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); }
|
||||
static Action* ReachMelee(PlayerbotAI* botAI) { return new ReachMeleeAction(botAI); }
|
||||
static Action* reach_party_member_to_heal(PlayerbotAI* botAI) { return new ReachPartyMemberToHealAction(botAI); }
|
||||
static Action* reach_party_member_to_resurrect(PlayerbotAI* botAI)
|
||||
{
|
||||
return new ReachPartyMemberToResurrectAction(botAI);
|
||||
}
|
||||
static Action* flee(PlayerbotAI* botAI) { return new FleeAction(botAI); }
|
||||
static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); }
|
||||
static Action* avoid_aoe(PlayerbotAI* botAI) { return new AvoidAoeAction(botAI); }
|
||||
static Action* combat_formation_move(PlayerbotAI* botAI) { return new CombatFormationMoveAction(botAI); }
|
||||
static Action* disperse_set(PlayerbotAI* botAI) { return new DisperseSetAction(botAI); }
|
||||
static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); }
|
||||
static Action* lifeblood(PlayerbotAI* botAI) { return new CastLifeBloodAction(botAI); }
|
||||
static Action* arcane_torrent(PlayerbotAI* botAI) { return new CastArcaneTorrentAction(botAI); }
|
||||
static Action* mana_tap(PlayerbotAI* botAI) { return new CastManaTapAction(botAI); }
|
||||
static Action* end_pull(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI, "-pull"); }
|
||||
|
||||
static Action* emote(PlayerbotAI* botAI) { return new EmoteAction(botAI); }
|
||||
static Action* talk(PlayerbotAI* botAI) { return new TalkAction(botAI); }
|
||||
static Action* suggest_what_to_do(PlayerbotAI* botAI) { return new SuggestWhatToDoAction(botAI); }
|
||||
static Action* suggest_trade(PlayerbotAI* botAI) { return new SuggestTradeAction(botAI); }
|
||||
static Action* suggest_dungeon(PlayerbotAI* botAI) { return new SuggestDungeonAction(botAI); }
|
||||
static Action* attack_anything(PlayerbotAI* botAI) { return new AttackAnythingAction(botAI); }
|
||||
static Action* attack_least_hp_target(PlayerbotAI* botAI) { return new AttackLeastHpTargetAction(botAI); }
|
||||
static Action* attack_enemy_player(PlayerbotAI* botAI) { return new AttackEnemyPlayerAction(botAI); }
|
||||
static Action* stay(PlayerbotAI* botAI) { return new StayAction(botAI); }
|
||||
static Action* sit(PlayerbotAI* botAI) { return new SitAction(botAI); }
|
||||
static Action* runaway(PlayerbotAI* botAI) { return new RunAwayAction(botAI); }
|
||||
static Action* follow(PlayerbotAI* botAI) { return new FollowAction(botAI); }
|
||||
static Action* flee_to_master(PlayerbotAI* botAI) { return new FleeToMasterAction(botAI); }
|
||||
static Action* add_gathering_loot(PlayerbotAI* botAI) { return new AddGatheringLootAction(botAI); }
|
||||
static Action* add_loot(PlayerbotAI* botAI) { return new AddLootAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
static Action* loot(PlayerbotAI* botAI) { return new LootAction(botAI); }
|
||||
static Action* release_loot(PlayerbotAI* botAI) { return new ReleaseLootAction(botAI); }
|
||||
static Action* dps_assist(PlayerbotAI* botAI) { return new DpsAssistAction(botAI); }
|
||||
static Action* dps_aoe(PlayerbotAI* botAI) { return new DpsAoeAction(botAI); }
|
||||
static Action* attack_rti_target(PlayerbotAI* botAI) { return new AttackRtiTargetAction(botAI); }
|
||||
static Action* tank_assist(PlayerbotAI* botAI) { return new TankAssistAction(botAI); }
|
||||
static Action* drink(PlayerbotAI* botAI) { return new DrinkAction(botAI); }
|
||||
static Action* food(PlayerbotAI* botAI) { return new EatAction(botAI); }
|
||||
static Action* mana_potion(PlayerbotAI* botAI) { return new UseManaPotion(botAI); }
|
||||
static Action* healing_potion(PlayerbotAI* botAI) { return new UseHealingPotion(botAI); }
|
||||
static Action* healthstone(PlayerbotAI* botAI) { return new UseItemAction(botAI, "healthstone"); }
|
||||
static Action* move_out_of_enemy_contact(PlayerbotAI* botAI) { return new MoveOutOfEnemyContactAction(botAI); }
|
||||
static Action* set_facing(PlayerbotAI* botAI) { return new SetFacingTargetAction(botAI); }
|
||||
static Action* set_behind(PlayerbotAI* botAI) { return new SetBehindTargetAction(botAI); }
|
||||
static Action* say(PlayerbotAI* botAI) { return new SayAction(botAI); }
|
||||
static Action* reveal_gathering_item(PlayerbotAI* botAI) { return new RevealGatheringItemAction(botAI); }
|
||||
static Action* outfit(PlayerbotAI* botAI) { return new OutfitAction(botAI); }
|
||||
static Action* random_bot_update(PlayerbotAI* botAI) { return new RandomBotUpdateAction(botAI); }
|
||||
static Action* delay(PlayerbotAI* botAI) { return new DelayAction(botAI); }
|
||||
|
||||
static Action* apply_poison(PlayerbotAI* botAI) { return new ImbueWithPoisonAction(botAI); }
|
||||
static Action* apply_oil(PlayerbotAI* botAI) { return new ImbueWithOilAction(botAI); }
|
||||
static Action* apply_stone(PlayerbotAI* botAI) { return new ImbueWithStoneAction(botAI); }
|
||||
static Action* try_emergency(PlayerbotAI* botAI) { return new TryEmergencyAction(botAI); }
|
||||
static Action* mount(PlayerbotAI* botAI) { return new CastSpellAction(botAI, "mount"); }
|
||||
static Action* war_stomp(PlayerbotAI* botAI) { return new CastWarStompAction(botAI); }
|
||||
static Action* auto_talents(PlayerbotAI* botAI) { return new AutoSetTalentsAction(botAI); }
|
||||
static Action* auto_learn_spell(PlayerbotAI* botAI) { return new AutoLearnSpellAction(botAI); }
|
||||
static Action* auto_teleport_for_level(PlayerbotAI* botAI) { return new AutoTeleportForLevelAction(botAI); }
|
||||
static Action* auto_upgrade_equip(PlayerbotAI* botAI) { return new AutoUpgradeEquipAction(botAI); }
|
||||
static Action* xp_gain(PlayerbotAI* botAI) { return new XpGainAction(botAI); }
|
||||
static Action* invite_nearby(PlayerbotAI* botAI) { return new InviteNearbyToGroupAction(botAI); }
|
||||
static Action* invite_guild(PlayerbotAI* botAI) { return new InviteGuildToGroupAction(botAI); }
|
||||
static Action* leave_far_away(PlayerbotAI* botAI) { return new LeaveFarAwayAction(botAI); }
|
||||
static Action* move_to_dark_portal(PlayerbotAI* botAI) { return new MoveToDarkPortalAction(botAI); }
|
||||
static Action* use_dark_portal_azeroth(PlayerbotAI* botAI) { return new DarkPortalAzerothAction(botAI); }
|
||||
static Action* move_from_dark_portal(PlayerbotAI* botAI) { return new MoveFromDarkPortalAction(botAI); }
|
||||
static Action* world_buff(PlayerbotAI* botAI) { return new WorldBuffAction(botAI); }
|
||||
static Action* hearthstone(PlayerbotAI* botAI) { return new UseHearthStone(botAI); }
|
||||
static Action* cast_random_spell(PlayerbotAI* botAI) { return new CastRandomSpellAction(botAI); }
|
||||
static Action* free_bg_join(PlayerbotAI* botAI) { return new FreeBGJoinAction(botAI); }
|
||||
|
||||
static Action* use_random_recipe(PlayerbotAI* botAI) { return new UseRandomRecipe(botAI); }
|
||||
static Action* use_random_quest_item(PlayerbotAI* botAI) { return new UseRandomQuestItem(botAI); }
|
||||
static Action* craft_random_item(PlayerbotAI* botAI) { return new CraftRandomItemAction(botAI); }
|
||||
static Action* smart_destroy_item(PlayerbotAI* botAI) { return new SmartDestroyItemAction(botAI); }
|
||||
static Action* disenchant_random_item(PlayerbotAI* botAI) { return new DisEnchantRandomItemAction(botAI); }
|
||||
static Action* enchant_random_item(PlayerbotAI* botAI) { return new EnchantRandomItemAction(botAI); }
|
||||
static Action* reset_instances(PlayerbotAI* botAI) { return new ResetInstancesAction(botAI); }
|
||||
static Action* buy_petition(PlayerbotAI* botAI) { return new BuyPetitionAction(botAI); }
|
||||
static Action* offer_petition(PlayerbotAI* botAI) { return new PetitionOfferAction(botAI); }
|
||||
static Action* offer_petition_nearby(PlayerbotAI* botAI) { return new PetitionOfferNearbyAction(botAI); }
|
||||
static Action* turn_in_petition(PlayerbotAI* botAI) { return new PetitionTurnInAction(botAI); }
|
||||
static Action* buy_tabard(PlayerbotAI* botAI) { return new BuyTabardAction(botAI); }
|
||||
static Action* guild_manage_nearby(PlayerbotAI* botAI) { return new GuildManageNearbyAction(botAI); }
|
||||
|
||||
// BG Tactics
|
||||
static Action* bg_tactics(PlayerbotAI* botAI) { return new BGTactics(botAI); }
|
||||
static Action* bg_move_to_start(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to start"); }
|
||||
static Action* bg_move_to_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "move to objective"); }
|
||||
static Action* bg_select_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "select objective"); }
|
||||
static Action* bg_check_objective(PlayerbotAI* botAI) { return new BGTactics(botAI, "check objective"); }
|
||||
static Action* bg_attack_fc(PlayerbotAI* botAI) { return new BGTactics(botAI, "attack fc"); }
|
||||
static Action* bg_protect_fc(PlayerbotAI* botAI) { return new BGTactics(botAI, "protect fc"); }
|
||||
static Action* attack_enemy_fc(PlayerbotAI* botAI) { return new AttackEnemyFlagCarrierAction(botAI); }
|
||||
static Action* bg_use_buff(PlayerbotAI* botAI) { return new BGTactics(botAI, "use buff"); }
|
||||
static Action* bg_check_flag(PlayerbotAI* botAI) { return new BGTactics(botAI, "check flag"); }
|
||||
|
||||
// Vehicles
|
||||
static Action* enter_vehicle(PlayerbotAI* botAI) { return new EnterVehicleAction(botAI); }
|
||||
static Action* leave_vehicle(PlayerbotAI* botAI) { return new LeaveVehicleAction(botAI); }
|
||||
static Action* hurl_boulder(PlayerbotAI* botAI) { return new CastHurlBoulderAction(botAI); }
|
||||
static Action* ram(PlayerbotAI* botAI) { return new CastRamAction(botAI); }
|
||||
static Action* steam_blast(PlayerbotAI* botAI) { return new CastSteamBlastAction(botAI); }
|
||||
static Action* steam_rush(PlayerbotAI* botAI) { return new CastSteamRushAction(botAI); }
|
||||
static Action* napalm(PlayerbotAI* botAI) { return new CastNapalmAction(botAI); }
|
||||
static Action* fire_cannon(PlayerbotAI* botAI) { return new CastFireCannonAction(botAI); }
|
||||
static Action* incendiary_rocket(PlayerbotAI* botAI) { return new CastIncendiaryRocketAction(botAI); }
|
||||
static Action* rocket_blast(PlayerbotAI* botAI) { return new CastRocketBlastAction(botAI); }
|
||||
static Action* glaive_throw(PlayerbotAI* botAI) { return new CastGlaiveThrowAction(botAI); }
|
||||
static Action* blade_salvo(PlayerbotAI* botAI) { return new CastBladeSalvoAction(botAI); }
|
||||
|
||||
// Rpg
|
||||
static Action* rpg_stay(PlayerbotAI* botAI) { return new RpgStayAction(botAI); }
|
||||
static Action* rpg_work(PlayerbotAI* botAI) { return new RpgWorkAction(botAI); }
|
||||
static Action* rpg_emote(PlayerbotAI* botAI) { return new RpgEmoteAction(botAI); }
|
||||
static Action* rpg_cancel(PlayerbotAI* botAI) { return new RpgCancelAction(botAI); }
|
||||
static Action* rpg_taxi(PlayerbotAI* botAI) { return new RpgTaxiAction(botAI); }
|
||||
static Action* rpg_discover(PlayerbotAI* botAI) { return new RpgDiscoverAction(botAI); }
|
||||
static Action* rpg_start_quest(PlayerbotAI* botAI) { return new RpgStartQuestAction(botAI); }
|
||||
static Action* rpg_end_quest(PlayerbotAI* botAI) { return new RpgEndQuestAction(botAI); }
|
||||
static Action* rpg_buy(PlayerbotAI* botAI) { return new RpgBuyAction(botAI); }
|
||||
static Action* rpg_sell(PlayerbotAI* botAI) { return new RpgSellAction(botAI); }
|
||||
static Action* rpg_repair(PlayerbotAI* botAI) { return new RpgRepairAction(botAI); }
|
||||
static Action* rpg_train(PlayerbotAI* botAI) { return new RpgTrainAction(botAI); }
|
||||
static Action* rpg_heal(PlayerbotAI* botAI) { return new RpgHealAction(botAI); }
|
||||
static Action* rpg_home_bind(PlayerbotAI* botAI) { return new RpgHomeBindAction(botAI); }
|
||||
static Action* rpg_queue_bg(PlayerbotAI* botAI) { return new RpgQueueBgAction(botAI); }
|
||||
static Action* rpg_buy_petition(PlayerbotAI* botAI) { return new RpgBuyPetitionAction(botAI); }
|
||||
static Action* rpg_use(PlayerbotAI* botAI) { return new RpgUseAction(botAI); }
|
||||
static Action* rpg_spell(PlayerbotAI* botAI) { return new RpgSpellAction(botAI); }
|
||||
static Action* rpg_craft(PlayerbotAI* botAI) { return new RpgCraftAction(botAI); }
|
||||
static Action* rpg_trade_useful(PlayerbotAI* botAI) { return new RpgTradeUsefulAction(botAI); }
|
||||
static Action* rpg_duel(PlayerbotAI* botAI) { return new RpgDuelAction(botAI); }
|
||||
static Action* rpg_mount_anim(PlayerbotAI* botAI) { return new RpgMountAnimAction(botAI); }
|
||||
|
||||
static Action* toggle_pet_spell(PlayerbotAI* ai) { return new TogglePetSpellAutoCastAction(ai); }
|
||||
static Action* pet_attack(PlayerbotAI* ai) { return new PetAttackAction(ai); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AddLootAction.h"
|
||||
|
||||
#include "CellImpl.h"
|
||||
#include "Event.h"
|
||||
#include "GridNotifiers.h"
|
||||
@@ -35,20 +37,11 @@ bool AddAllLootAction::Execute(Event event)
|
||||
return added;
|
||||
}
|
||||
|
||||
bool AddLootAction::isUseful()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool AddLootAction::isUseful() { return true; }
|
||||
|
||||
bool AddAllLootAction::isUseful()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool AddAllLootAction::isUseful() { return true; }
|
||||
|
||||
bool AddAllLootAction::AddLoot(ObjectGuid guid)
|
||||
{
|
||||
return AI_VALUE(LootObjectStack*, "available loot")->Add(guid);
|
||||
}
|
||||
bool AddAllLootAction::AddLoot(ObjectGuid guid) { return AI_VALUE(LootObjectStack*, "available loot")->Add(guid); }
|
||||
|
||||
bool AddGatheringLootAction::AddLoot(ObjectGuid guid)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ADDLOOTACTION_H
|
||||
@@ -12,30 +13,30 @@ class PlayerbotAI;
|
||||
|
||||
class AddLootAction : public Action
|
||||
{
|
||||
public:
|
||||
AddLootAction(PlayerbotAI* botAI) : Action(botAI, "add loot") { }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
public:
|
||||
AddLootAction(PlayerbotAI* botAI) : Action(botAI, "add loot") {}
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class AddAllLootAction : public Action
|
||||
{
|
||||
public:
|
||||
AddAllLootAction(PlayerbotAI* botAI, std::string const name = "add all loot") : Action(botAI, name) { }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
public:
|
||||
AddAllLootAction(PlayerbotAI* botAI, std::string const name = "add all loot") : Action(botAI, name) {}
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
protected:
|
||||
virtual bool AddLoot(ObjectGuid guid);
|
||||
protected:
|
||||
virtual bool AddLoot(ObjectGuid guid);
|
||||
};
|
||||
|
||||
class AddGatheringLootAction : public AddAllLootAction
|
||||
{
|
||||
public:
|
||||
AddGatheringLootAction(PlayerbotAI* botAI) : AddAllLootAction(botAI, "add gathering loot") { }
|
||||
public:
|
||||
AddGatheringLootAction(PlayerbotAI* botAI) : AddAllLootAction(botAI, "add gathering loot") {}
|
||||
|
||||
protected:
|
||||
bool AddLoot(ObjectGuid guid) override;
|
||||
protected:
|
||||
bool AddLoot(ObjectGuid guid) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AreaTriggerAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "LastMovementValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -10,7 +12,7 @@
|
||||
|
||||
bool ReachAreaTriggerAction::Execute(Event event)
|
||||
{
|
||||
if (botAI->IsRealPlayer()) //Do not trigger own area trigger.
|
||||
if (botAI->IsRealPlayer()) // Do not trigger own area trigger.
|
||||
return false;
|
||||
|
||||
uint32 triggerId;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_AREATRIGGERACTION_H
|
||||
@@ -11,18 +12,18 @@ class PlayerbotAI;
|
||||
|
||||
class ReachAreaTriggerAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
ReachAreaTriggerAction(PlayerbotAI* botAI) : MovementAction(botAI, "reach area trigger") { }
|
||||
public:
|
||||
ReachAreaTriggerAction(PlayerbotAI* botAI) : MovementAction(botAI, "reach area trigger") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class AreaTriggerAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
AreaTriggerAction(PlayerbotAI* botAI) : MovementAction(botAI, "area trigger") { }
|
||||
public:
|
||||
AreaTriggerAction(PlayerbotAI* botAI) : MovementAction(botAI, "area trigger") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ArenaTeamActions.h"
|
||||
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -38,14 +40,16 @@ bool ArenaTeamAcceptAction::Execute(Event event)
|
||||
WorldPacket data(CMSG_ARENA_TEAM_ACCEPT);
|
||||
bot->GetSession()->HandleArenaTeamAcceptOpcode(data);
|
||||
bot->Say("Thanks for the invite!", LANG_UNIVERSAL);
|
||||
LOG_INFO("playerbots", "Bot {} <{}> accepts Arena Team invite", bot->GetGUID().ToString().c_str(), bot->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Bot {} <{}> accepts Arena Team invite", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetName().c_str());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
WorldPacket data(CMSG_ARENA_TEAM_DECLINE);
|
||||
bot->GetSession()->HandleArenaTeamDeclineOpcode(data);
|
||||
LOG_INFO("playerbots", "Bot {} <{}> declines Arena Team invite", bot->GetGUID().ToString().c_str(), bot->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Bot {} <{}> declines Arena Team invite", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetName().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ARENATEAMACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class ArenaTeamAcceptAction : public Action
|
||||
{
|
||||
public:
|
||||
ArenaTeamAcceptAction(PlayerbotAI* botAI) : Action(botAI, "arena team accept") { }
|
||||
public:
|
||||
ArenaTeamAcceptAction(PlayerbotAI* botAI) : Action(botAI, "arena team accept") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AttackAction.h"
|
||||
|
||||
#include "CreatureAI.h"
|
||||
#include "Event.h"
|
||||
#include "LootObjectStack.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "Unit.h"
|
||||
|
||||
bool AttackAction::Execute(Event event)
|
||||
@@ -15,8 +17,9 @@ bool AttackAction::Execute(Event event)
|
||||
Unit* target = GetTarget();
|
||||
if (!target)
|
||||
return false;
|
||||
|
||||
if (!target->IsInWorld()) {
|
||||
|
||||
if (!target->IsInWorld())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Attack(target);
|
||||
@@ -36,7 +39,7 @@ bool AttackMyTargetAction::Execute(Event event)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
botAI->GetAiObjectContext()->GetValue<GuidVector>("prioritized targets")->Set({guid});
|
||||
bool result = Attack(botAI->GetUnit(guid));
|
||||
if (result)
|
||||
@@ -47,7 +50,8 @@ bool AttackMyTargetAction::Execute(Event event)
|
||||
|
||||
bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
{
|
||||
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE || bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||
if (bot->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE ||
|
||||
bot->HasUnitState(UNIT_STATE_IN_FLIGHT))
|
||||
{
|
||||
if (verbose)
|
||||
botAI->TellError("I cannot attack in flight");
|
||||
@@ -109,16 +113,18 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
|
||||
context->GetValue<Unit*>("current target")->Set(target);
|
||||
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
|
||||
|
||||
|
||||
bool melee = bot->IsWithinMeleeRange(target) || botAI->IsMelee(bot);
|
||||
bot->Attack(target, melee);
|
||||
|
||||
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) {
|
||||
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target))
|
||||
{
|
||||
sServerFacade->SetFacingTo(bot, target);
|
||||
}
|
||||
botAI->ChangeEngine(BOT_STATE_COMBAT);
|
||||
|
||||
if (!bot->GetVictim()) {
|
||||
if (!bot->GetVictim())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
/* prevent pet dead immediately in group */
|
||||
@@ -141,12 +147,6 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AttackDuelOpponentAction::isUseful()
|
||||
{
|
||||
return AI_VALUE(Unit*, "duel target");
|
||||
}
|
||||
bool AttackDuelOpponentAction::isUseful() { return AI_VALUE(Unit*, "duel target"); }
|
||||
|
||||
bool AttackDuelOpponentAction::Execute(Event event)
|
||||
{
|
||||
return Attack(AI_VALUE(Unit*, "duel target"));
|
||||
}
|
||||
bool AttackDuelOpponentAction::Execute(Event event) { return Attack(AI_VALUE(Unit*, "duel target")); }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_ATTACKACTION_H
|
||||
@@ -11,31 +12,34 @@ class PlayerbotAI;
|
||||
|
||||
class AttackAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
AttackAction(PlayerbotAI* botAI, std::string const name) : MovementAction(botAI, name) { }
|
||||
public:
|
||||
AttackAction(PlayerbotAI* botAI, std::string const name) : MovementAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
protected:
|
||||
bool Attack(Unit* target, bool with_pet = true);
|
||||
protected:
|
||||
bool Attack(Unit* target, bool with_pet = true);
|
||||
};
|
||||
|
||||
class AttackMyTargetAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackMyTargetAction(PlayerbotAI* botAI, std::string const name = "attack my target") : AttackAction(botAI, name) { }
|
||||
public:
|
||||
AttackMyTargetAction(PlayerbotAI* botAI, std::string const name = "attack my target") : AttackAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class AttackDuelOpponentAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackDuelOpponentAction(PlayerbotAI* botAI, std::string const name = "attack duel opponent")
|
||||
: AttackAction(botAI, name)
|
||||
{
|
||||
public:
|
||||
AttackDuelOpponentAction(PlayerbotAI* botAI, std::string const name = "attack duel opponent") : AttackAction(botAI, name) { }
|
||||
}
|
||||
|
||||
public:
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
public:
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "AutoLearnSpellAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "GuildMgr.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
#include "Playerbots.h"
|
||||
#include "GuildMgr.h"
|
||||
|
||||
bool AutoLearnSpellAction::Execute(Event event)
|
||||
{
|
||||
@@ -30,10 +32,12 @@ bool AutoLearnSpellAction::Execute(Event event)
|
||||
|
||||
void AutoLearnSpellAction::LearnSpells(std::ostringstream* out)
|
||||
{
|
||||
if (sPlayerbotAIConfig->autoLearnTrainerSpells && sRandomPlayerbotMgr->IsRandomBot(bot))// || (!botAI->GetMaster() && sRandomPlayerbotMgr->IsRandomBot(bot)))
|
||||
if (sPlayerbotAIConfig->autoLearnTrainerSpells &&
|
||||
sRandomPlayerbotMgr->IsRandomBot(bot)) // || (!botAI->GetMaster() && sRandomPlayerbotMgr->IsRandomBot(bot)))
|
||||
LearnTrainerSpells(out);
|
||||
|
||||
if (sPlayerbotAIConfig->autoLearnQuestSpells && sRandomPlayerbotMgr->IsRandomBot(bot))// || (!botAI->GetMaster() && sRandomPlayerbotMgr->IsRandomBot(bot)))
|
||||
if (sPlayerbotAIConfig->autoLearnQuestSpells &&
|
||||
sRandomPlayerbotMgr->IsRandomBot(bot)) // || (!botAI->GetMaster() && sRandomPlayerbotMgr->IsRandomBot(bot)))
|
||||
LearnQuestSpells(out);
|
||||
|
||||
if (sPlayerbotAIConfig->randomBotGuildTalk)
|
||||
@@ -63,7 +67,8 @@ void AutoLearnSpellAction::LearnTrainerSpells(std::ostringstream* out)
|
||||
// bot->LearnDefaultSkills();
|
||||
|
||||
// CreatureTemplateContainer const* creatureTemplateContainer = sObjectMgr->GetCreatureTemplates();
|
||||
// for (CreatureTemplateContainer::const_iterator i = creatureTemplateContainer->begin(); i != creatureTemplateContainer->end(); ++i)
|
||||
// for (CreatureTemplateContainer::const_iterator i = creatureTemplateContainer->begin(); i !=
|
||||
// creatureTemplateContainer->end(); ++i)
|
||||
// {
|
||||
// CreatureTemplate const& co = i->second;
|
||||
// if (co.trainer_type != TRAINER_TYPE_TRADESKILLS && co.trainer_type != TRAINER_TYPE_CLASS)
|
||||
@@ -72,16 +77,17 @@ void AutoLearnSpellAction::LearnTrainerSpells(std::ostringstream* out)
|
||||
// if (co.trainer_type == TRAINER_TYPE_CLASS && co.trainer_class != bot->getClass())
|
||||
// continue;
|
||||
|
||||
// uint32 trainerId = co.Entry;
|
||||
// uint32 trainerId = co.Entry;
|
||||
|
||||
// TrainerSpellData const* trainer_spells = sObjectMgr->GetNpcTrainerSpells(trainerId);
|
||||
// TrainerSpellData const* trainer_spells = sObjectMgr->GetNpcTrainerSpells(trainerId);
|
||||
// if (!trainer_spells)
|
||||
// trainer_spells = sObjectMgr->GetNpcTrainerSpells(trainerId);
|
||||
|
||||
// if (!trainer_spells)
|
||||
// continue;
|
||||
|
||||
// for (TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin(); itr != trainer_spells->spellList.end(); ++itr)
|
||||
// for (TrainerSpellMap::const_iterator itr = trainer_spells->spellList.begin(); itr !=
|
||||
// trainer_spells->spellList.end(); ++itr)
|
||||
// {
|
||||
// TrainerSpell const* tSpell = &itr->second;
|
||||
|
||||
@@ -127,7 +133,7 @@ void AutoLearnSpellAction::LearnTrainerSpells(std::ostringstream* out)
|
||||
|
||||
void AutoLearnSpellAction::LearnQuestSpells(std::ostringstream* out)
|
||||
{
|
||||
//CreatureTemplate const* co = sCreatureStorage.LookupEntry<CreatureTemplate>(id);
|
||||
// CreatureTemplate const* co = sCreatureStorage.LookupEntry<CreatureTemplate>(id);
|
||||
ObjectMgr::QuestMap const& questTemplates = sObjectMgr->GetQuestTemplates();
|
||||
for (ObjectMgr::QuestMap::const_iterator i = questTemplates.begin(); i != questTemplates.end(); ++i)
|
||||
{
|
||||
@@ -137,7 +143,8 @@ void AutoLearnSpellAction::LearnQuestSpells(std::ostringstream* out)
|
||||
if (!quest->GetRequiredClasses() || quest->IsRepeatable() || quest->GetMinLevel() < 10)
|
||||
continue;
|
||||
|
||||
if (!bot->SatisfyQuestClass(quest, false) || quest->GetMinLevel() > bot->GetLevel() || !bot->SatisfyQuestRace(quest, false))
|
||||
if (!bot->SatisfyQuestClass(quest, false) || quest->GetMinLevel() > bot->GetLevel() ||
|
||||
!bot->SatisfyQuestRace(quest, false))
|
||||
continue;
|
||||
|
||||
if (quest->GetRewSpellCast() > 0)
|
||||
@@ -197,12 +204,15 @@ void AutoLearnSpellAction::LearnSpell(uint32 spellId, std::ostringstream* out)
|
||||
}
|
||||
}
|
||||
|
||||
bool AutoUpgradeEquipAction::Execute(Event event) {
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot)) {
|
||||
bool AutoUpgradeEquipAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoUpgradeEquip || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE);
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel) {
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||
{
|
||||
factory.InitEquipment(true);
|
||||
}
|
||||
factory.InitAmmo();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_AUTOLEARNSPELLACTION_H
|
||||
@@ -11,24 +12,24 @@ class PlayerbotAI;
|
||||
|
||||
class AutoLearnSpellAction : public Action
|
||||
{
|
||||
public:
|
||||
AutoLearnSpellAction(PlayerbotAI* botAI, std::string const name = "auto learn spell") : Action(botAI, name) { }
|
||||
public:
|
||||
AutoLearnSpellAction(PlayerbotAI* botAI, std::string const name = "auto learn spell") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event);
|
||||
bool Execute(Event event);
|
||||
|
||||
private:
|
||||
void LearnSpells(std::ostringstream* out);
|
||||
void LearnTrainerSpells(std::ostringstream* out);
|
||||
void LearnQuestSpells(std::ostringstream* out);
|
||||
void LearnSpell(uint32 spellId, std::ostringstream* out);
|
||||
private:
|
||||
void LearnSpells(std::ostringstream* out);
|
||||
void LearnTrainerSpells(std::ostringstream* out);
|
||||
void LearnQuestSpells(std::ostringstream* out);
|
||||
void LearnSpell(uint32 spellId, std::ostringstream* out);
|
||||
};
|
||||
|
||||
class AutoUpgradeEquipAction : public Action
|
||||
{
|
||||
public:
|
||||
AutoUpgradeEquipAction(PlayerbotAI* botAI, std::string const name = "auto upgrade equip") : Action(botAI, name) { }
|
||||
public:
|
||||
AutoUpgradeEquipAction(PlayerbotAI* botAI, std::string const name = "auto upgrade equip") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event);
|
||||
bool Execute(Event event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
#include "AutoTeleportForLevelAction.h"
|
||||
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "PlayerbotFactory.h"
|
||||
#include "RandomPlayerbotMgr.h"
|
||||
#include "Playerbots.h"
|
||||
#include "RandomPlayerbotMgr.h"
|
||||
#include "SharedDefines.h"
|
||||
|
||||
bool AutoTeleportForLevelAction::Execute(Event event) {
|
||||
if (!sPlayerbotAIConfig->autoTeleportForLevel || !sRandomPlayerbotMgr->IsRandomBot(bot)) {
|
||||
bool AutoTeleportForLevelAction::Execute(Event event)
|
||||
{
|
||||
if (!sPlayerbotAIConfig->autoTeleportForLevel || !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (botAI->HasRealPlayerMaster()) {
|
||||
if (botAI->HasRealPlayerMaster())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
sRandomPlayerbotMgr->RandomTeleportForLevel(bot);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_AUTOTELEPORTFORLEVELACTION_H
|
||||
@@ -11,10 +12,13 @@ class PlayerbotAI;
|
||||
|
||||
class AutoTeleportForLevelAction : public Action
|
||||
{
|
||||
public:
|
||||
AutoTeleportForLevelAction(PlayerbotAI* botAI, std::string const name = "auto teleport for level") : Action(botAI, name) { }
|
||||
public:
|
||||
AutoTeleportForLevelAction(PlayerbotAI* botAI, std::string const name = "auto teleport for level")
|
||||
: Action(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool Execute(Event event);
|
||||
bool Execute(Event event);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "BankAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -102,7 +104,7 @@ bool BankAction::Deposit(Item* pItem)
|
||||
|
||||
out << "put " << chat->FormatItem(pItem->GetTemplate(), pItem->GetCount()) << " to bank";
|
||||
botAI->TellMaster(out.str());
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void BankAction::ListItems()
|
||||
@@ -143,14 +145,14 @@ Item* BankAction::FindItemInBank(uint32 ItemId)
|
||||
if (!pItemProto)
|
||||
continue;
|
||||
|
||||
if (pItemProto->ItemId == ItemId) // have required item
|
||||
if (pItemProto->ItemId == ItemId) // have required item
|
||||
return pItem;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 bag = BANK_SLOT_BAG_START; bag < BANK_SLOT_BAG_END; ++bag)
|
||||
{
|
||||
Bag const* const pBag = (Bag *) bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag);
|
||||
Bag const* const pBag = (Bag*)bot->GetItemByPos(INVENTORY_SLOT_BAG_0, bag);
|
||||
if (pBag)
|
||||
for (uint8 slot = 0; slot < pBag->GetBagSize(); ++slot)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_BANKACTION_H
|
||||
@@ -12,17 +13,17 @@ class PlayerbotAI;
|
||||
|
||||
class BankAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
BankAction(PlayerbotAI* botAI) : InventoryAction(botAI, "bank") { }
|
||||
public:
|
||||
BankAction(PlayerbotAI* botAI) : InventoryAction(botAI, "bank") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool ExecuteBank(std::string const text, Unit* bank);
|
||||
void ListItems();
|
||||
bool Withdraw(uint32 itemid);
|
||||
bool Deposit(Item* pItem);
|
||||
Item* FindItemInBank(uint32 ItemId);
|
||||
private:
|
||||
bool ExecuteBank(std::string const text, Unit* bank);
|
||||
void ListItems();
|
||||
bool Withdraw(uint32 itemid);
|
||||
bool Deposit(Item* pItem);
|
||||
Item* FindItemInBank(uint32 ItemId);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "BattleGroundJoinAction.h"
|
||||
|
||||
#include "ArenaTeam.h"
|
||||
#include "ArenaTeamMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
@@ -16,7 +18,7 @@
|
||||
bool BGJoinAction::Execute(Event event)
|
||||
{
|
||||
uint32 queueType = AI_VALUE(uint32, "bg type");
|
||||
if (!queueType) // force join to fill bg
|
||||
if (!queueType) // force join to fill bg
|
||||
{
|
||||
if (bgList.empty())
|
||||
return false;
|
||||
@@ -53,7 +55,7 @@ bool BGJoinAction::Execute(Event event)
|
||||
}
|
||||
|
||||
// set bg type and bm guid
|
||||
//botAI->GetAiObjectContext()->GetValue<ObjectGuid>("bg master")->Set(bmGUID);
|
||||
// botAI->GetAiObjectContext()->GetValue<ObjectGuid>("bg master")->Set(bmGUID);
|
||||
botAI->GetAiObjectContext()->GetValue<uint32>("bg type")->Set(queueTypeId);
|
||||
queueType = queueTypeId;
|
||||
}
|
||||
@@ -63,19 +65,19 @@ bool BGJoinAction::Execute(Event event)
|
||||
|
||||
bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
{
|
||||
|
||||
ArenaTeam* arenateam = sArenaTeamMgr->GetArenaTeamByCaptain(bot->GetGUID(), type);
|
||||
|
||||
if (!arenateam)
|
||||
return false;
|
||||
|
||||
if (arenateam->GetMembersSize() < ((uint32) arenateam->GetType()))
|
||||
if (arenateam->GetMembersSize() < ((uint32)arenateam->GetType()))
|
||||
return false;
|
||||
|
||||
GuidVector members;
|
||||
|
||||
// search for arena team members and make them online
|
||||
for (ArenaTeam::MemberList::iterator itr = arenateam->GetMembers().begin(); itr != arenateam->GetMembers().end(); ++itr)
|
||||
for (ArenaTeam::MemberList::iterator itr = arenateam->GetMembers().begin(); itr != arenateam->GetMembers().end();
|
||||
++itr)
|
||||
{
|
||||
bool offline = false;
|
||||
Player* member = ObjectAccessor::FindConnectedPlayer(itr->Guid);
|
||||
@@ -83,8 +85,8 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
{
|
||||
offline = true;
|
||||
}
|
||||
//if (!member && !sObjectMgr->GetPlayerAccountIdByGUID(itr->guid))
|
||||
// continue;
|
||||
// if (!member && !sObjectMgr->GetPlayerAccountIdByGUID(itr->guid))
|
||||
// continue;
|
||||
|
||||
if (offline)
|
||||
sRandomPlayerbotMgr->AddPlayerBot(itr->Guid, 0);
|
||||
@@ -107,10 +109,10 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
if (member->GetGUID() == bot->GetGUID())
|
||||
continue;
|
||||
|
||||
if(member->InBattleground())
|
||||
if (member->InBattleground())
|
||||
continue;
|
||||
|
||||
if(member->InBattlegroundQueue())
|
||||
if (member->InBattlegroundQueue())
|
||||
continue;
|
||||
|
||||
if (member->GetGroup())
|
||||
@@ -125,7 +127,8 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
|
||||
if (!members.size() || (int)members.size() < (int)(arenateam->GetType() - 1))
|
||||
{
|
||||
LOG_INFO("playerbots", "Team #{} <{}> has not enough members for match", arenateam->GetId(), arenateam->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Team #{} <{}> has not enough members for match", arenateam->GetId(),
|
||||
arenateam->GetName().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -137,24 +140,25 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
|
||||
if (!group->Create(bot))
|
||||
{
|
||||
LOG_INFO("playerbots", "Team #{} <{}>: Can't create group for arena queue", arenateam->GetId(), arenateam->GetName());
|
||||
LOG_INFO("playerbots", "Team #{} <{}>: Can't create group for arena queue", arenateam->GetId(),
|
||||
arenateam->GetName());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
sGroupMgr->AddGroup(group);
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}>: Leader of <{}>", bot->GetGUID().ToString().c_str(), bot->GetName(), arenateam->GetName());
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}>: Leader of <{}>", bot->GetGUID().ToString().c_str(), bot->GetName(),
|
||||
arenateam->GetName());
|
||||
|
||||
for (auto i = begin(members); i != end(members); ++i)
|
||||
{
|
||||
if (*i == bot->GetGUID())
|
||||
continue;
|
||||
|
||||
//if (count >= (int)arenateam->GetType())
|
||||
//break;
|
||||
// if (count >= (int)arenateam->GetType())
|
||||
// break;
|
||||
|
||||
if (group->GetMembersCount() >= (uint32) arenateam->GetType())
|
||||
if (group->GetMembersCount() >= (uint32)arenateam->GetType())
|
||||
break;
|
||||
|
||||
Player* member = ObjectAccessor::FindConnectedPlayer(*i);
|
||||
@@ -174,19 +178,20 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
||||
memberBotAI->Reset();
|
||||
member->TeleportTo(bot->GetMapId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), 0);
|
||||
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}>: Member of <{}>", member->GetGUID().ToString().c_str(), member->GetName().c_str(), arenateam->GetName().c_str());
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}>: Member of <{}>", member->GetGUID().ToString().c_str(),
|
||||
member->GetName().c_str(), arenateam->GetName().c_str());
|
||||
}
|
||||
|
||||
if (group && group->GetMembersCount() >= (uint32)arenateam->GetType())
|
||||
{
|
||||
LOG_INFO("playerbots", "Team #{} <{}> Group is ready for match", arenateam->GetId(), arenateam->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Team #{} <{}> Group is ready for match", arenateam->GetId(),
|
||||
arenateam->GetName().c_str());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INFO("playerbots", "Team #{} <{}> Group is not ready for match (not enough members)", arenateam->GetId(), arenateam->GetName().c_str());
|
||||
LOG_INFO("playerbots", "Team #{} <{}> Group is not ready for match (not enough members)", arenateam->GetId(),
|
||||
arenateam->GetName().c_str());
|
||||
group->Disband();
|
||||
}
|
||||
|
||||
@@ -229,7 +234,10 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
return false;
|
||||
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() ? sPlayerbotAIConfig->diffEmpty : sPlayerbotAIConfig->diffWithPlayer) * 1.1;
|
||||
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty()
|
||||
? sPlayerbotAIConfig->diffEmpty
|
||||
: sPlayerbotAIConfig->diffWithPlayer) *
|
||||
1.1;
|
||||
|
||||
uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2;
|
||||
uint32 TeamSize = bg->GetMaxPlayersPerTeam();
|
||||
@@ -251,11 +259,15 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
|
||||
// Check if bots should join Rated Arena (Only captains can queue)
|
||||
uint32 ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
|
||||
uint32 ratedArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
uint32 ratedArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) < (BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
||||
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
|
||||
if (isRated)
|
||||
{
|
||||
@@ -269,10 +281,14 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
|
||||
// Check if bots should join Skirmish Arena
|
||||
// We have extra bots queue because same faction can vs each other but can't be in the same group.
|
||||
uint32 skirmishArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 skirmishArenaBotCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
||||
if (maxRequiredSkirmishBots != 0)
|
||||
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
||||
@@ -293,14 +309,14 @@ bool BGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battlegroun
|
||||
uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||
uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||
|
||||
if(teamId == TEAM_ALLIANCE)
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
if((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
if ((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
if ((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -351,9 +367,9 @@ bool BGJoinAction::isUseful()
|
||||
return false;
|
||||
|
||||
// do not try if in dungeon
|
||||
//Map* map = bot->GetMap();
|
||||
//if (map && map->Instanceable())
|
||||
// return false;
|
||||
// Map* map = bot->GetMap();
|
||||
// if (map && map->Instanceable())
|
||||
// return false;
|
||||
|
||||
bgList.clear();
|
||||
ratedList.clear();
|
||||
@@ -415,8 +431,8 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
|
||||
// get BG MapId
|
||||
uint32 bgTypeId_ = bgTypeId;
|
||||
uint32 instanceId = 0; // 0 = First Available
|
||||
|
||||
uint32 instanceId = 0; // 0 = First Available
|
||||
|
||||
bool isPremade = false;
|
||||
bool isArena = false;
|
||||
bool isRated = false;
|
||||
@@ -431,7 +447,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
isArena = true;
|
||||
|
||||
// get battlemaster
|
||||
//Unit* unit = botAI->GetUnit(AI_VALUE2(CreatureData const*, "bg master", bgTypeId));
|
||||
// Unit* unit = botAI->GetUnit(AI_VALUE2(CreatureData const*, "bg master", bgTypeId));
|
||||
Unit* unit = botAI->GetUnit(sRandomPlayerbotMgr->GetBattleMasterGUID(bot, bgTypeId));
|
||||
if (!unit && isArena)
|
||||
{
|
||||
@@ -442,10 +458,10 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
|
||||
// This breaks groups as refresh includes a remove from group function call.
|
||||
// refresh food/regs
|
||||
//sRandomPlayerbotMgr->Refresh(bot);
|
||||
// sRandomPlayerbotMgr->Refresh(bot);
|
||||
|
||||
bool joinAsGroup = bot->GetGroup() && bot->GetGroup()->GetLeaderGUID() == bot->GetGUID();
|
||||
|
||||
|
||||
// in wotlk only arena requires battlemaster guid
|
||||
ObjectGuid guid = isArena ? unit->GetGUID() : bot->GetGUID();
|
||||
|
||||
@@ -459,7 +475,7 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
break;
|
||||
case BATTLEGROUND_AB:
|
||||
_bgType = "AB";
|
||||
break;
|
||||
break;
|
||||
case BATTLEGROUND_EY:
|
||||
_bgType = "EotS";
|
||||
break;
|
||||
@@ -505,10 +521,11 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> queued {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), _bgType.c_str(),
|
||||
isRated ? "Rated Arena" : isArena ? "Arena" : "");
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> queued {} {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), _bgType.c_str(),
|
||||
isRated ? "Rated Arena"
|
||||
: isArena ? "Arena"
|
||||
: "");
|
||||
|
||||
if (isArena)
|
||||
{
|
||||
@@ -519,17 +536,19 @@ bool BGJoinAction::JoinQueue(uint32 type)
|
||||
}
|
||||
else if (!joinAsGroup)
|
||||
{
|
||||
if(teamId == TEAM_ALLIANCE)
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount++;
|
||||
else
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(teamId == TEAM_ALLIANCE)
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount += bot->GetGroup()->GetMembersCount();
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgAllianceBotCount +=
|
||||
bot->GetGroup()->GetMembersCount();
|
||||
else
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount += bot->GetGroup()->GetMembersCount();
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgHordeBotCount +=
|
||||
bot->GetGroup()->GetMembersCount();
|
||||
}
|
||||
|
||||
botAI->GetAiObjectContext()->GetValue<uint32>("bg type")->Set(0);
|
||||
@@ -559,7 +578,10 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
return false;
|
||||
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty() ? sPlayerbotAIConfig->diffEmpty : sPlayerbotAIConfig->diffWithPlayer) * 1.1;
|
||||
bool noLag = sWorldUpdateTime.GetAverageUpdateTime() < (sRandomPlayerbotMgr->GetPlayers().empty()
|
||||
? sPlayerbotAIConfig->diffEmpty
|
||||
: sPlayerbotAIConfig->diffWithPlayer) *
|
||||
1.1;
|
||||
|
||||
uint32 BracketSize = bg->GetMaxPlayersPerTeam() * 2;
|
||||
uint32 TeamSize = bg->GetMaxPlayersPerTeam();
|
||||
@@ -581,11 +603,15 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
|
||||
// Check if bots should join Rated Arena (Only captains can queue)
|
||||
uint32 ratedArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaBotCount;
|
||||
uint32 ratedArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
uint32 ratedArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount;
|
||||
uint32 ratedArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaInstanceCount;
|
||||
uint32 activeRatedArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeRatedArenaQueue;
|
||||
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) < (BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
bool isRated = (ratedArenaBotCount + ratedArenaPlayerCount) <
|
||||
(BracketSize * (activeRatedArenaQueue + ratedArenaInstanceCount));
|
||||
|
||||
if (isRated)
|
||||
{
|
||||
@@ -599,10 +625,14 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
|
||||
// Check if bots should join Skirmish Arena
|
||||
// We have extra bots queue because same faction can vs each other but can't be in the same group.
|
||||
uint32 skirmishArenaBotCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 skirmishArenaBotCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaBotCount;
|
||||
uint32 skirmishArenaPlayerCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount;
|
||||
uint32 skirmishArenaInstanceCount =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaInstanceCount;
|
||||
uint32 activeSkirmishArenaQueue =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeSkirmishArenaQueue;
|
||||
uint32 maxRequiredSkirmishBots = BracketSize * (activeSkirmishArenaQueue + skirmishArenaInstanceCount);
|
||||
if (maxRequiredSkirmishBots != 0)
|
||||
maxRequiredSkirmishBots = maxRequiredSkirmishBots + TeamSize;
|
||||
@@ -623,14 +653,14 @@ bool FreeBGJoinAction::shouldJoinBg(BattlegroundQueueTypeId queueTypeId, Battleg
|
||||
uint32 activeBgQueue = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].activeBgQueue;
|
||||
uint32 bgInstanceCount = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].bgInstanceCount;
|
||||
|
||||
if(teamId == TEAM_ALLIANCE)
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
{
|
||||
if((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
if ((bgAllianceBotCount + bgAlliancePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
if ((bgHordeBotCount + bgHordePlayerCount) < TeamSize * (activeBgQueue + bgInstanceCount))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -642,7 +672,7 @@ bool BGLeaveAction::Execute(Event event)
|
||||
if (!(bot->InBattlegroundQueue() || bot->InBattleground()))
|
||||
return false;
|
||||
|
||||
//botAI->ChangeStrategy("-bg", BOT_STATE_NON_COMBAT);
|
||||
// botAI->ChangeStrategy("-bg", BOT_STATE_NON_COMBAT);
|
||||
|
||||
BattlegroundQueueTypeId queueTypeId = bot->GetBattlegroundQueueTypeId(0);
|
||||
BattlegroundTypeId _bgTypeId = BattlegroundMgr::BGTemplateId(queueTypeId);
|
||||
@@ -661,8 +691,9 @@ bool BGLeaveAction::Execute(Event event)
|
||||
|
||||
if (bot->InBattleground())
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG");
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
isArena ? "Arena" : "BG");
|
||||
|
||||
WorldPacket leave(CMSG_LEAVE_BATTLEFIELD);
|
||||
leave << uint8(0) << uint8(0) << uint32(0) << uint16(0);
|
||||
@@ -683,8 +714,9 @@ bool BGLeaveAction::Execute(Event event)
|
||||
if (!queueType)
|
||||
return false;
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {} queue",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(), isArena ? "Arena" : "BG");
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {} queue", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName().c_str(),
|
||||
isArena ? "Arena" : "BG");
|
||||
|
||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||
packet << type << unk2 << (uint32)_bgTypeId << unk << uint8(0);
|
||||
@@ -701,10 +733,7 @@ bool BGLeaveAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BGStatusAction::isUseful()
|
||||
{
|
||||
return bot->InBattlegroundQueue();
|
||||
}
|
||||
bool BGStatusAction::isUseful() { return bot->InBattlegroundQueue(); }
|
||||
|
||||
bool BGStatusAction::Execute(Event event)
|
||||
{
|
||||
@@ -725,7 +754,7 @@ bool BGStatusAction::Execute(Event event)
|
||||
|
||||
WorldPacket p(event.getPacket());
|
||||
statusid = 0;
|
||||
p >> QueueSlot; // queue id (0...2) - player can be in 3 queues in time
|
||||
p >> QueueSlot; // queue id (0...2) - player can be in 3 queues in time
|
||||
p >> arenaByte;
|
||||
if (arenaByte == 0)
|
||||
return false;
|
||||
@@ -738,20 +767,20 @@ bool BGStatusAction::Execute(Event event)
|
||||
// check status
|
||||
switch (statusid)
|
||||
{
|
||||
case STATUS_WAIT_QUEUE: // status_in_queue
|
||||
p >> Time1; // average wait time, milliseconds
|
||||
p >> Time2; // time in queue, updated every minute!, milliseconds
|
||||
case STATUS_WAIT_QUEUE: // status_in_queue
|
||||
p >> Time1; // average wait time, milliseconds
|
||||
p >> Time2; // time in queue, updated every minute!, milliseconds
|
||||
break;
|
||||
case STATUS_WAIT_JOIN: // status_invite
|
||||
p >> mapId; // map id
|
||||
case STATUS_WAIT_JOIN: // status_invite
|
||||
p >> mapId; // map id
|
||||
p >> unk0;
|
||||
p >> Time1; // time to remove from queue, milliseconds
|
||||
p >> Time1; // time to remove from queue, milliseconds
|
||||
break;
|
||||
case STATUS_IN_PROGRESS: // status_in_progress
|
||||
p >> mapId; // map id
|
||||
case STATUS_IN_PROGRESS: // status_in_progress
|
||||
p >> mapId; // map id
|
||||
p >> unk0;
|
||||
p >> Time1; // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
|
||||
p >> Time2; // time from bg start, milliseconds
|
||||
p >> Time1; // time to bg auto leave, 0 at bg start, 120000 after bg end, milliseconds
|
||||
p >> Time2; // time from bg start, milliseconds
|
||||
p >> arenaTeam;
|
||||
break;
|
||||
default:
|
||||
@@ -773,7 +802,7 @@ bool BGStatusAction::Execute(Event event)
|
||||
bracketId = pvpDiff->GetBracketId();
|
||||
|
||||
bool isArena = false;
|
||||
uint8 type = false; // arenatype if arena
|
||||
uint8 type = false; // arenatype if arena
|
||||
uint16 unk = 0x1F90;
|
||||
uint8 unk2 = 0x0;
|
||||
uint8 action = 0x1;
|
||||
@@ -829,10 +858,11 @@ bool BGStatusAction::Execute(Event event)
|
||||
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
|
||||
if (Time1 == TIME_TO_AUTOREMOVE) //Battleground is over, bot needs to leave
|
||||
if (Time1 == TIME_TO_AUTOREMOVE) // Battleground is over, bot needs to leave
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} <{}> ({} {}): Received BG status TIME_REMOVE for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetName(), bot->GetLevel(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetName(), bot->GetLevel(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
// remove warsong strategy
|
||||
if (IsRandomBot)
|
||||
@@ -851,12 +881,13 @@ bool BGStatusAction::Execute(Event event)
|
||||
botAI->ChangeStrategy("-arena", BOT_STATE_COMBAT);
|
||||
botAI->ChangeStrategy("-arena", BOT_STATE_NON_COMBAT);
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {} - {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> leaves {} - {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
WorldPacket packet(CMSG_LEAVE_BATTLEFIELD);
|
||||
packet << uint8(0);
|
||||
packet << uint8(0); // BattlegroundTypeId-1 ?
|
||||
packet << uint8(0); // BattlegroundTypeId-1 ?
|
||||
packet << uint32(0);
|
||||
packet << uint16(0);
|
||||
|
||||
@@ -872,12 +903,13 @@ bool BGStatusAction::Execute(Event event)
|
||||
posMap["bg objective"] = pos;
|
||||
}
|
||||
|
||||
if (statusid == STATUS_WAIT_QUEUE) // bot is in queue
|
||||
if (statusid == STATUS_WAIT_QUEUE) // bot is in queue
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Received BG status WAIT_QUEUE (wait time: {}) for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), Time2, isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), Time2, isArena ? "Arena" : "BG", _bgType);
|
||||
// temp fix for crash
|
||||
//return true;
|
||||
// return true;
|
||||
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(queueTypeId);
|
||||
GroupQueueInfo ginfo;
|
||||
@@ -886,7 +918,8 @@ bool BGStatusAction::Execute(Event event)
|
||||
if (ginfo.IsInvitedToBGInstanceGUID && !bot->InBattleground())
|
||||
{
|
||||
// BattlegroundMgr::GetBattleground() does not return battleground if bgTypeId==BATTLEGROUND_AA
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, _bgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : _bgTypeId);
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(
|
||||
ginfo.IsInvitedToBGInstanceGUID, _bgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : _bgTypeId);
|
||||
if (bg)
|
||||
{
|
||||
if (isArena)
|
||||
@@ -894,8 +927,9 @@ bool BGStatusAction::Execute(Event event)
|
||||
_bgTypeId = bg->GetBgTypeID();
|
||||
}
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Force join {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Force join {} {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
isArena ? "Arena" : "BG", _bgType);
|
||||
WorldPacket emptyPacket;
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
action = 0x1;
|
||||
@@ -905,8 +939,10 @@ bool BGStatusAction::Execute(Event event)
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies(false);
|
||||
if (!bot->GetBattleground()) {
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly, set bg for "bg strategy check" to fix that
|
||||
if (!bot->GetBattleground())
|
||||
{
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up
|
||||
// properly, set bg for "bg strategy check" to fix that
|
||||
botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT);
|
||||
}
|
||||
context->GetValue<uint32>("bg role")->Set(urand(0, 9));
|
||||
@@ -931,23 +967,26 @@ bool BGStatusAction::Execute(Event event)
|
||||
else
|
||||
timer = TIME_TO_AUTOREMOVE + 1000 * (bg->GetMaxPlayersPerTeam() * 8);
|
||||
|
||||
if (Time2 > timer && isArena) // disabled for BG
|
||||
if (Time2 > timer && isArena) // disabled for BG
|
||||
leaveQ = true;
|
||||
|
||||
if (leaveQ && ((bot->GetGroup() && bot->GetGroup()->IsLeader(bot->GetGUID())) || !(bot->GetGroup() || botAI->GetMaster())))
|
||||
if (leaveQ && ((bot->GetGroup() && bot->GetGroup()->IsLeader(bot->GetGUID())) ||
|
||||
!(bot->GetGroup() || botAI->GetMaster())))
|
||||
{
|
||||
TeamId teamId = bot->GetTeamId();
|
||||
bool realPlayers = false;
|
||||
if (isRated)
|
||||
realPlayers = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].ratedArenaPlayerCount > 0;
|
||||
else
|
||||
realPlayers = sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount > 0;
|
||||
realPlayers =
|
||||
sRandomPlayerbotMgr->BattlegroundData[queueTypeId][bracketId].skirmishArenaPlayerCount > 0;
|
||||
|
||||
if (realPlayers)
|
||||
return false;
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> waited too long and leaves queue ({} {}).",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
WorldPacket packet(CMSG_BATTLEFIELD_PORT, 20);
|
||||
action = 0;
|
||||
@@ -963,17 +1002,19 @@ bool BGStatusAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
if (statusid == STATUS_IN_PROGRESS) // placeholder for Leave BG if it takes too long
|
||||
if (statusid == STATUS_IN_PROGRESS) // placeholder for Leave BG if it takes too long
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Received BG status IN_PROGRESS for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (statusid == STATUS_WAIT_JOIN) //bot may join
|
||||
if (statusid == STATUS_WAIT_JOIN) // bot may join
|
||||
{
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}>: Received BG status WAIT_JOIN for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(),
|
||||
bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
if (isArena)
|
||||
{
|
||||
@@ -984,18 +1025,21 @@ bool BGStatusAction::Execute(Event event)
|
||||
if (!bgQueue.GetPlayerGroupInfoData(bot->GetGUID(), &ginfo))
|
||||
{
|
||||
LOG_ERROR("playerbots", "Bot {} {}:{} <{}>: Missing QueueInfo for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H",
|
||||
bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ginfo.IsInvitedToBGInstanceGUID)
|
||||
{
|
||||
// BattlegroundMgr::GetBattleground() does not return battleground if bgTypeId==BATTLEGROUND_AA
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, _bgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : _bgTypeId);
|
||||
Battleground* bg = sBattlegroundMgr->GetBattleground(
|
||||
ginfo.IsInvitedToBGInstanceGUID, _bgTypeId == BATTLEGROUND_AA ? BATTLEGROUND_TYPE_NONE : _bgTypeId);
|
||||
if (!bg)
|
||||
{
|
||||
LOG_ERROR("playerbots", "Bot {} {}:{} <{}>: Missing QueueInfo for {} {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H",
|
||||
bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1003,8 +1047,9 @@ bool BGStatusAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> joined {} - {}",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(), isArena ? "Arena" : "BG", _bgType);
|
||||
LOG_INFO("playerbots", "Bot {} {}:{} <{}> joined {} - {}", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H", bot->GetLevel(), bot->GetName(),
|
||||
isArena ? "Arena" : "BG", _bgType);
|
||||
|
||||
WorldPacket emptyPacket;
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
@@ -1016,8 +1061,10 @@ bool BGStatusAction::Execute(Event event)
|
||||
bot->GetSession()->HandleBattleFieldPortOpcode(packet);
|
||||
|
||||
botAI->ResetStrategies(false);
|
||||
if (!bot->GetBattleground()) {
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly, set bg for "bg strategy check" to fix that
|
||||
if (!bot->GetBattleground())
|
||||
{
|
||||
// first bot to join wont have battleground and PlayerbotAI::ResetStrategies() wont set them up properly,
|
||||
// set bg for "bg strategy check" to fix that
|
||||
botAI->ChangeStrategy("+bg", BOT_STATE_NON_COMBAT);
|
||||
}
|
||||
context->GetValue<uint32>("bg role")->Set(urand(0, 9));
|
||||
@@ -1043,25 +1090,25 @@ bool BGStatusCheckAction::Execute(Event event)
|
||||
WorldPacket packet(CMSG_BATTLEFIELD_STATUS);
|
||||
bot->GetSession()->HandleBattlefieldStatusOpcode(packet);
|
||||
|
||||
LOG_INFO("playerbots", "Bot {} <{}> ({} {}) : Checking BG invite status",
|
||||
bot->GetGUID().ToString().c_str(), bot->GetName(), bot->GetLevel(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H");
|
||||
LOG_INFO("playerbots", "Bot {} <{}> ({} {}) : Checking BG invite status", bot->GetGUID().ToString().c_str(),
|
||||
bot->GetName(), bot->GetLevel(), bot->GetTeamId() == TEAM_ALLIANCE ? "A" : "H");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool BGStatusCheckAction::isUseful()
|
||||
{
|
||||
return bot->InBattlegroundQueue();
|
||||
}
|
||||
bool BGStatusCheckAction::isUseful() { return bot->InBattlegroundQueue(); }
|
||||
|
||||
bool BGStrategyCheckAction::Execute(Event event)
|
||||
{
|
||||
bool inside_bg = bot->InBattleground() && bot->GetBattleground();;
|
||||
if (!inside_bg && botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT)) {
|
||||
bool inside_bg = bot->InBattleground() && bot->GetBattleground();
|
||||
;
|
||||
if (!inside_bg && botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT))
|
||||
{
|
||||
botAI->ResetStrategies();
|
||||
return true;
|
||||
}
|
||||
if (inside_bg && !botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT)) {
|
||||
if (inside_bg && !botAI->HasStrategy("battleground", BOT_STATE_NON_COMBAT))
|
||||
{
|
||||
botAI->ResetStrategies();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_BATTLEGROUNDJOINACTION_H
|
||||
@@ -18,60 +19,60 @@ enum BattlegroundBracketId : uint8;
|
||||
|
||||
class BGJoinAction : public Action
|
||||
{
|
||||
public:
|
||||
BGJoinAction(PlayerbotAI* botAI, std::string const name = "bg join") : Action(botAI, name) { }
|
||||
public:
|
||||
BGJoinAction(PlayerbotAI* botAI, std::string const name = "bg join") : Action(botAI, name) {}
|
||||
|
||||
bool isUseful() override;
|
||||
bool canJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId);
|
||||
virtual bool shouldJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId);
|
||||
bool Execute(Event event) override;
|
||||
virtual bool gatherArenaTeam(ArenaType type);
|
||||
bool isUseful() override;
|
||||
bool canJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId);
|
||||
virtual bool shouldJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId);
|
||||
bool Execute(Event event) override;
|
||||
virtual bool gatherArenaTeam(ArenaType type);
|
||||
|
||||
protected:
|
||||
bool JoinQueue(uint32 type);
|
||||
std::vector<uint32> bgList;
|
||||
std::vector<uint32> ratedList;
|
||||
protected:
|
||||
bool JoinQueue(uint32 type);
|
||||
std::vector<uint32> bgList;
|
||||
std::vector<uint32> ratedList;
|
||||
};
|
||||
|
||||
class FreeBGJoinAction : public BGJoinAction
|
||||
{
|
||||
public:
|
||||
FreeBGJoinAction(PlayerbotAI* botAI, std::string const name = "free bg join") : BGJoinAction(botAI, name) { }
|
||||
public:
|
||||
FreeBGJoinAction(PlayerbotAI* botAI, std::string const name = "free bg join") : BGJoinAction(botAI, name) {}
|
||||
|
||||
bool shouldJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId) override;
|
||||
bool shouldJoinBg(BattlegroundQueueTypeId queueTypeId, BattlegroundBracketId bracketId) override;
|
||||
};
|
||||
|
||||
class BGLeaveAction : public Action
|
||||
{
|
||||
public:
|
||||
BGLeaveAction(PlayerbotAI* botAI, std::string const name = "bg leave") : Action(botAI, name) { }
|
||||
BGLeaveAction(PlayerbotAI* botAI, std::string const name = "bg leave") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class BGStatusAction : public Action
|
||||
{
|
||||
public:
|
||||
BGStatusAction(PlayerbotAI* botAI) : Action(botAI, "bg status") { }
|
||||
BGStatusAction(PlayerbotAI* botAI) : Action(botAI, "bg status") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class BGStatusCheckAction : public Action
|
||||
{
|
||||
public:
|
||||
BGStatusCheckAction(PlayerbotAI* botAI, std::string const name = "bg status check") : Action(botAI, name) { }
|
||||
public:
|
||||
BGStatusCheckAction(PlayerbotAI* botAI, std::string const name = "bg status check") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class BGStrategyCheckAction : public Action
|
||||
{
|
||||
public:
|
||||
BGStrategyCheckAction(PlayerbotAI* botAI, std::string const name = "bg strategy check") : Action(botAI, name) { }
|
||||
public:
|
||||
BGStrategyCheckAction(PlayerbotAI* botAI, std::string const name = "bg strategy check") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_BATTLEGROUNDTACTICSACTION_H
|
||||
@@ -14,11 +15,11 @@ struct Position;
|
||||
|
||||
#define SPELL_CAPTURE_BANNER 21651
|
||||
|
||||
typedef void(*BattleBotWaypointFunc)();
|
||||
typedef void (*BattleBotWaypointFunc)();
|
||||
|
||||
struct BattleBotWaypoint
|
||||
{
|
||||
BattleBotWaypoint(float x_, float y_, float z_, BattleBotWaypointFunc func) : x(x_), y(y_), z(z_), pFunc(func) { };
|
||||
BattleBotWaypoint(float x_, float y_, float z_, BattleBotWaypointFunc func) : x(x_), y(y_), z(z_), pFunc(func){};
|
||||
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
@@ -36,43 +37,43 @@ extern std::vector<BattleBotPath*> const vPaths_IC;
|
||||
|
||||
class BGTactics : public MovementAction
|
||||
{
|
||||
public:
|
||||
static bool HandleConsoleCommand(ChatHandler* handler, char const* args);
|
||||
public:
|
||||
static bool HandleConsoleCommand(ChatHandler* handler, char const* args);
|
||||
|
||||
BGTactics(PlayerbotAI* botAI, std::string const name = "bg tactics") : MovementAction(botAI, name) { }
|
||||
BGTactics(PlayerbotAI* botAI, std::string const name = "bg tactics") : MovementAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
static std::string const HandleConsoleCommandPrivate(WorldSession* session, char const* args);
|
||||
bool moveToStart(bool force = false);
|
||||
bool selectObjective(bool reset = false);
|
||||
bool moveToObjective();
|
||||
bool selectObjectiveWp(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 currentPoint, bool reverse = false);
|
||||
bool startNewPathBegin(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool startNewPathFree(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool resetObjective();
|
||||
bool wsgPaths();
|
||||
bool eyJumpDown();
|
||||
bool atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<uint32> const& vFlagIds);
|
||||
bool flagTaken();
|
||||
bool teamFlagTaken();
|
||||
bool protectFC();
|
||||
bool useBuff();
|
||||
uint32 getPlayersInArea(TeamId teamId, Position point, float range, bool combat = true);
|
||||
bool IsLockedInsideKeep();
|
||||
private:
|
||||
static std::string const HandleConsoleCommandPrivate(WorldSession* session, char const* args);
|
||||
bool moveToStart(bool force = false);
|
||||
bool selectObjective(bool reset = false);
|
||||
bool moveToObjective();
|
||||
bool selectObjectiveWp(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 currentPoint, bool reverse = false);
|
||||
bool startNewPathBegin(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool startNewPathFree(std::vector<BattleBotPath*> const& vPaths);
|
||||
bool resetObjective();
|
||||
bool wsgPaths();
|
||||
bool eyJumpDown();
|
||||
bool atFlag(std::vector<BattleBotPath*> const& vPaths, std::vector<uint32> const& vFlagIds);
|
||||
bool flagTaken();
|
||||
bool teamFlagTaken();
|
||||
bool protectFC();
|
||||
bool useBuff();
|
||||
uint32 getPlayersInArea(TeamId teamId, Position point, float range, bool combat = true);
|
||||
bool IsLockedInsideKeep();
|
||||
};
|
||||
|
||||
class ArenaTactics : public MovementAction
|
||||
{
|
||||
public:
|
||||
ArenaTactics(PlayerbotAI* botAI, std::string const name = "arena tactics") : MovementAction(botAI, name) { }
|
||||
public:
|
||||
ArenaTactics(PlayerbotAI* botAI, std::string const name = "arena tactics") : MovementAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool moveToCenter(Battleground *bg);
|
||||
private:
|
||||
bool moveToCenter(Battleground* bg);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,60 +1,62 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "BuffAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
class FindBuffVisitor : public IterateItemsVisitor
|
||||
{
|
||||
public:
|
||||
FindBuffVisitor(Player* bot) : IterateItemsVisitor(), bot(bot)
|
||||
{
|
||||
}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (bot->CanUseItem(item->GetTemplate()) != EQUIP_ERR_OK)
|
||||
return true;
|
||||
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
|
||||
if (proto->Class != ITEM_CLASS_CONSUMABLE)
|
||||
return true;
|
||||
|
||||
if (proto->SubClass != ITEM_SUBCLASS_ELIXIR && proto->SubClass != ITEM_SUBCLASS_FLASK && proto->SubClass != ITEM_SUBCLASS_SCROLL &&
|
||||
proto->SubClass != ITEM_SUBCLASS_FOOD && proto->SubClass != ITEM_SUBCLASS_CONSUMABLE_OTHER && proto->SubClass != ITEM_SUBCLASS_ITEM_ENHANCEMENT)
|
||||
return true;
|
||||
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; i++)
|
||||
{
|
||||
uint32 spellId = proto->Spells[i].SpellId;
|
||||
if (!spellId)
|
||||
continue;
|
||||
|
||||
if (bot->HasAura(spellId))
|
||||
return true;
|
||||
|
||||
Item* itemForSpell = *GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<Item*>("item for spell", spellId);
|
||||
if (itemForSpell && itemForSpell->IsInWorld() && itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
|
||||
return true;
|
||||
|
||||
if (items.find(proto->SubClass) == items.end())
|
||||
items[proto->SubClass] = std::vector<Item*>();
|
||||
|
||||
items[proto->SubClass].push_back(item);
|
||||
break;
|
||||
}
|
||||
public:
|
||||
FindBuffVisitor(Player* bot) : IterateItemsVisitor(), bot(bot) {}
|
||||
|
||||
bool Visit(Item* item) override
|
||||
{
|
||||
if (bot->CanUseItem(item->GetTemplate()) != EQUIP_ERR_OK)
|
||||
return true;
|
||||
|
||||
ItemTemplate const* proto = item->GetTemplate();
|
||||
|
||||
if (proto->Class != ITEM_CLASS_CONSUMABLE)
|
||||
return true;
|
||||
|
||||
if (proto->SubClass != ITEM_SUBCLASS_ELIXIR && proto->SubClass != ITEM_SUBCLASS_FLASK &&
|
||||
proto->SubClass != ITEM_SUBCLASS_SCROLL && proto->SubClass != ITEM_SUBCLASS_FOOD &&
|
||||
proto->SubClass != ITEM_SUBCLASS_CONSUMABLE_OTHER && proto->SubClass != ITEM_SUBCLASS_ITEM_ENHANCEMENT)
|
||||
return true;
|
||||
|
||||
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; i++)
|
||||
{
|
||||
uint32 spellId = proto->Spells[i].SpellId;
|
||||
if (!spellId)
|
||||
continue;
|
||||
|
||||
if (bot->HasAura(spellId))
|
||||
return true;
|
||||
|
||||
Item* itemForSpell =
|
||||
*GET_PLAYERBOT_AI(bot)->GetAiObjectContext()->GetValue<Item*>("item for spell", spellId);
|
||||
if (itemForSpell && itemForSpell->IsInWorld() && itemForSpell->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT))
|
||||
return true;
|
||||
|
||||
if (items.find(proto->SubClass) == items.end())
|
||||
items[proto->SubClass] = std::vector<Item*>();
|
||||
|
||||
items[proto->SubClass].push_back(item);
|
||||
break;
|
||||
}
|
||||
|
||||
std::map<uint32, std::vector<Item*> > items;
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Player* bot;
|
||||
std::map<uint32, std::vector<Item*> > items;
|
||||
|
||||
private:
|
||||
Player* bot;
|
||||
};
|
||||
|
||||
void BuffAction::TellHeader(uint32 subClass)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_BUFFACTION_H
|
||||
@@ -11,13 +12,13 @@ class PlayerbotAI;
|
||||
|
||||
class BuffAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
BuffAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buff") { }
|
||||
public:
|
||||
BuffAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buff") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
void TellHeader(uint32 subClass);
|
||||
private:
|
||||
void TellHeader(uint32 subClass);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "BuyAction.h"
|
||||
|
||||
#include "BudgetValues.h"
|
||||
#include "Event.h"
|
||||
#include "ItemVisitors.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "ItemUsageValue.h"
|
||||
#include "ItemVisitors.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool BuyAction::Execute(Event event)
|
||||
@@ -48,20 +50,26 @@ bool BuyAction::Execute(Event event)
|
||||
|
||||
VendorItemList m_items_sorted = tItems->m_items;
|
||||
|
||||
m_items_sorted.erase(std::remove_if(m_items_sorted.begin(), m_items_sorted.end(), [](VendorItem* i)
|
||||
{
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(i->item);
|
||||
return !proto;
|
||||
}), m_items_sorted.end());
|
||||
m_items_sorted.erase(std::remove_if(m_items_sorted.begin(), m_items_sorted.end(),
|
||||
[](VendorItem* i)
|
||||
{
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(i->item);
|
||||
return !proto;
|
||||
}),
|
||||
m_items_sorted.end());
|
||||
|
||||
if (m_items_sorted.empty())
|
||||
continue;
|
||||
|
||||
std::sort(m_items_sorted.begin(), m_items_sorted.end(), [](VendorItem* i, VendorItem* j) { return sObjectMgr->GetItemTemplate(i->item)->ItemLevel > sObjectMgr->GetItemTemplate(j->item)->ItemLevel; });
|
||||
std::sort(m_items_sorted.begin(), m_items_sorted.end(),
|
||||
[](VendorItem* i, VendorItem* j) {
|
||||
return sObjectMgr->GetItemTemplate(i->item)->ItemLevel >
|
||||
sObjectMgr->GetItemTemplate(j->item)->ItemLevel;
|
||||
});
|
||||
|
||||
for (auto& tItem : m_items_sorted)
|
||||
{
|
||||
for (uint32 i = 0; i < 10; i++) // Buy 10 times or until no longer usefull/possible
|
||||
for (uint32 i = 0; i < 10; i++) // Buy 10 times or until no longer usefull/possible
|
||||
{
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", tItem->item);
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(tItem->item);
|
||||
@@ -104,7 +112,8 @@ bool BuyAction::Execute(Event event)
|
||||
if (!BuyItem(tItems, vendorguid, proto))
|
||||
break;
|
||||
|
||||
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP) // Equip upgrades and stop buying this time.
|
||||
if (usage == ITEM_USAGE_REPLACE ||
|
||||
usage == ITEM_USAGE_EQUIP) // Equip upgrades and stop buying this time.
|
||||
{
|
||||
botAI->DoSpecificAction("equip upgrades");
|
||||
break;
|
||||
@@ -120,7 +129,7 @@ bool BuyAction::Execute(Event event)
|
||||
for (ItemIds::iterator i = itemIds.begin(); i != itemIds.end(); i++)
|
||||
{
|
||||
uint32 itemId = *i;
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
|
||||
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
|
||||
if (!proto)
|
||||
continue;
|
||||
|
||||
@@ -170,7 +179,10 @@ bool BuyAction::BuyItem(VendorItemData const* tItems, ObjectGuid vendorguid, Ite
|
||||
bot->SetMoney(botMoney);
|
||||
}
|
||||
|
||||
if (oldCount < AI_VALUE2(uint32, "item count", proto->Name1)) // BuyItem Always returns false (unless unique) so we have to check the item counts.
|
||||
if (oldCount <
|
||||
AI_VALUE2(
|
||||
uint32, "item count",
|
||||
proto->Name1)) // BuyItem Always returns false (unless unique) so we have to check the item counts.
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Buying " << ChatHelper::FormatItem(proto);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_BUYACTION_H
|
||||
@@ -18,16 +19,15 @@ struct VendorItemData;
|
||||
|
||||
class BuyAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
BuyAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buy") { }
|
||||
public:
|
||||
BuyAction(PlayerbotAI* botAI) : InventoryAction(botAI, "buy") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool BuyItem(VendorItemData const* tItems, ObjectGuid vendorguid, ItemTemplate const* proto);
|
||||
bool TradeItem(FindItemVisitor* visitor, int8 slot);
|
||||
bool TradeItem(Item const* item, int8 slot);
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool BuyItem(VendorItemData const* tItems, ObjectGuid vendorguid, ItemTemplate const* proto);
|
||||
bool TradeItem(FindItemVisitor* visitor, int8 slot);
|
||||
bool TradeItem(Item const* item, int8 slot);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CastCustomSpellAction.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
#include "ItemUsageValue.h"
|
||||
@@ -56,10 +58,10 @@ bool CastCustomSpellAction::Execute(Event event)
|
||||
if (master && master->GetTarget())
|
||||
target = botAI->GetUnit(master->GetTarget());
|
||||
|
||||
if (!target)
|
||||
if (!target)
|
||||
target = bot;
|
||||
|
||||
if (!master) // Use self as master for permissions.
|
||||
if (!master) // Use self as master for permissions.
|
||||
master = bot;
|
||||
|
||||
Item* itemTarget = nullptr;
|
||||
@@ -136,7 +138,7 @@ bool CastCustomSpellAction::Execute(Event event)
|
||||
std::ostringstream cmd;
|
||||
cmd << castString(target) << " " << text << " " << (castCount - 1);
|
||||
botAI->HandleCommand(CHAT_MSG_WHISPER, cmd.str(), master);
|
||||
msg << "|cffffff00(x" << (castCount-1) << " left)|r";
|
||||
msg << "|cffffff00(x" << (castCount - 1) << " left)|r";
|
||||
}
|
||||
|
||||
botAI->TellMasterNoFacing(msg.str());
|
||||
@@ -150,10 +152,7 @@ bool CastCustomSpellAction::Execute(Event event)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool CastCustomNcSpellAction::isUseful()
|
||||
{
|
||||
return !bot->IsInCombat();
|
||||
}
|
||||
bool CastCustomNcSpellAction::isUseful() { return !bot->IsInCombat(); }
|
||||
|
||||
std::string const CastCustomNcSpellAction::castString(WorldObject* target)
|
||||
{
|
||||
@@ -162,7 +161,8 @@ std::string const CastCustomNcSpellAction::castString(WorldObject* target)
|
||||
|
||||
bool CastRandomSpellAction::AcceptSpell(SpellInfo const* spellInfo)
|
||||
{
|
||||
bool isTradeSkill = spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_CREATE_ITEM && spellInfo->ReagentCount[EFFECT_0] > 0 && spellInfo->SchoolMask == 1;
|
||||
bool isTradeSkill = spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_CREATE_ITEM &&
|
||||
spellInfo->ReagentCount[EFFECT_0] > 0 && spellInfo->SchoolMask == 1;
|
||||
return !isTradeSkill && spellInfo->GetRecoveryTime() < MINUTE * IN_MILLISECONDS;
|
||||
}
|
||||
|
||||
@@ -220,7 +220,8 @@ bool CastRandomSpellAction::Execute(Event event)
|
||||
|
||||
if (target && botAI->CanCastSpell(spellId, target, true))
|
||||
spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, target)));
|
||||
if (got && botAI->CanCastSpell(spellId, got->GetPositionX(), got->GetPositionY(), got->GetPositionZ(), true))
|
||||
if (got &&
|
||||
botAI->CanCastSpell(spellId, got->GetPositionX(), got->GetPositionY(), got->GetPositionZ(), true))
|
||||
spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, got)));
|
||||
if (botAI->CanCastSpell(spellId, bot, true))
|
||||
spellList.push_back(std::make_pair(spellId, std::make_pair(spellPriority, bot)));
|
||||
@@ -232,10 +233,9 @@ bool CastRandomSpellAction::Execute(Event event)
|
||||
|
||||
bool isCast = false;
|
||||
|
||||
std::sort(spellList.begin(), spellList.end(), [](std::pair<uint32, std::pair<uint32, WorldObject*>> i, std::pair<uint32, std::pair<uint32, WorldObject*>> j)
|
||||
{
|
||||
return i.first > j.first;
|
||||
});
|
||||
std::sort(spellList.begin(), spellList.end(),
|
||||
[](std::pair<uint32, std::pair<uint32, WorldObject*>> i,
|
||||
std::pair<uint32, std::pair<uint32, WorldObject*>> j) { return i.first > j.first; });
|
||||
|
||||
uint32 rndBound = spellList.size() / 4;
|
||||
|
||||
@@ -270,7 +270,8 @@ bool CastRandomSpellAction::Execute(Event event)
|
||||
|
||||
bool CraftRandomItemAction::AcceptSpell(SpellInfo const* spellInfo)
|
||||
{
|
||||
return spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_CREATE_ITEM && spellInfo->ReagentCount[EFFECT_0] > 0 && spellInfo->SchoolMask == 0;
|
||||
return spellInfo->Effects[EFFECT_0].Effect == SPELL_EFFECT_CREATE_ITEM && spellInfo->ReagentCount[EFFECT_0] > 0 &&
|
||||
spellInfo->SchoolMask == 0;
|
||||
}
|
||||
|
||||
uint32 CraftRandomItemAction::GetSpellPriority(SpellInfo const* spellInfo)
|
||||
@@ -282,7 +283,8 @@ uint32 CraftRandomItemAction::GetSpellPriority(SpellInfo const* spellInfo)
|
||||
{
|
||||
ItemUsage usage = AI_VALUE2(ItemUsage, "item usage", newItemId);
|
||||
|
||||
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_AMMO || usage == ITEM_USAGE_QUEST || usage == ITEM_USAGE_SKILL || usage == ITEM_USAGE_USE)
|
||||
if (usage == ITEM_USAGE_REPLACE || usage == ITEM_USAGE_EQUIP || usage == ITEM_USAGE_AMMO ||
|
||||
usage == ITEM_USAGE_QUEST || usage == ITEM_USAGE_SKILL || usage == ITEM_USAGE_USE)
|
||||
return 10;
|
||||
}
|
||||
|
||||
@@ -295,7 +297,6 @@ uint32 CraftRandomItemAction::GetSpellPriority(SpellInfo const* spellInfo)
|
||||
|
||||
bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo)
|
||||
{
|
||||
|
||||
if (wo->GetGUID().IsUnit())
|
||||
return botAI->CastSpell(spellId, (Unit*)(wo));
|
||||
else
|
||||
@@ -304,16 +305,19 @@ bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo)
|
||||
|
||||
bool DisEnchantRandomItemAction::Execute(Event event)
|
||||
{
|
||||
std::vector<Item*> items = AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
||||
std::vector<Item*> items =
|
||||
AI_VALUE2(std::vector<Item*>, "inventory items", "usage " + std::to_string(ITEM_USAGE_DISENCHANT));
|
||||
std::reverse(items.begin(), items.end());
|
||||
|
||||
for (auto& item: items)
|
||||
for (auto& item : items)
|
||||
{
|
||||
// don't touch rare+ items if with real player/guild
|
||||
if ((botAI->HasRealPlayerMaster() || botAI->IsInRealGuild()) && item->GetTemplate()->Quality > ITEM_QUALITY_UNCOMMON)
|
||||
if ((botAI->HasRealPlayerMaster() || botAI->IsInRealGuild()) &&
|
||||
item->GetTemplate()->Quality > ITEM_QUALITY_UNCOMMON)
|
||||
return false;
|
||||
|
||||
if(CastCustomSpellAction::Execute(Event("disenchant random item", "13262 "+ chat->FormatQItem(item->GetEntry()))))
|
||||
if (CastCustomSpellAction::Execute(
|
||||
Event("disenchant random item", "13262 " + chat->FormatQItem(item->GetEntry()))))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -322,13 +326,11 @@ bool DisEnchantRandomItemAction::Execute(Event event)
|
||||
|
||||
bool DisEnchantRandomItemAction::isUseful()
|
||||
{
|
||||
return botAI->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat() && AI_VALUE2(uint32, "item count", "usage " + std::to_string(ITEM_USAGE_DISENCHANT)) > 0;
|
||||
return botAI->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat() &&
|
||||
AI_VALUE2(uint32, "item count", "usage " + std::to_string(ITEM_USAGE_DISENCHANT)) > 0;
|
||||
}
|
||||
|
||||
bool EnchantRandomItemAction::isUseful()
|
||||
{
|
||||
return botAI->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat();
|
||||
}
|
||||
bool EnchantRandomItemAction::isUseful() { return botAI->HasSkill(SKILL_ENCHANTING) && !bot->IsInCombat(); }
|
||||
|
||||
bool EnchantRandomItemAction::AcceptSpell(SpellInfo const* spellInfo)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CASTCUSTOMSPELLACTION_H
|
||||
@@ -13,11 +14,14 @@ class WorldObject;
|
||||
|
||||
class CastCustomSpellAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
CastCustomSpellAction(PlayerbotAI* botAI, std::string const name = "cast custom spell") : InventoryAction(botAI, name) { }
|
||||
public:
|
||||
CastCustomSpellAction(PlayerbotAI* botAI, std::string const name = "cast custom spell")
|
||||
: InventoryAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
virtual std::string const castString(WorldObject* target) { return "cast"; }
|
||||
bool Execute(Event event) override;
|
||||
virtual std::string const castString(WorldObject* target) { return "cast"; }
|
||||
|
||||
protected:
|
||||
bool ncCast = false;
|
||||
@@ -25,57 +29,60 @@ protected:
|
||||
|
||||
class CastCustomNcSpellAction : public CastCustomSpellAction
|
||||
{
|
||||
public:
|
||||
CastCustomNcSpellAction(PlayerbotAI* botAI, std::string const name = "cast custom nc spell") : CastCustomSpellAction(botAI, name) { }
|
||||
public:
|
||||
CastCustomNcSpellAction(PlayerbotAI* botAI, std::string const name = "cast custom nc spell")
|
||||
: CastCustomSpellAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool isUseful() override;
|
||||
std::string const castString(WorldObject* target) override;
|
||||
bool isUseful() override;
|
||||
std::string const castString(WorldObject* target) override;
|
||||
};
|
||||
|
||||
class CastRandomSpellAction : public ListSpellsAction
|
||||
{
|
||||
public:
|
||||
CastRandomSpellAction(PlayerbotAI* botAI, std::string const name = "cast random spell") : ListSpellsAction(botAI, name) { }
|
||||
public:
|
||||
CastRandomSpellAction(PlayerbotAI* botAI, std::string const name = "cast random spell")
|
||||
: ListSpellsAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool isUseful() override { return false; }
|
||||
virtual bool AcceptSpell(SpellInfo const* spellInfo);
|
||||
virtual uint32 GetSpellPriority(SpellInfo const* spellInfo) { return 1; }
|
||||
virtual bool castSpell(uint32 spellId, WorldObject* wo);
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override { return false; }
|
||||
virtual bool AcceptSpell(SpellInfo const* spellInfo);
|
||||
virtual uint32 GetSpellPriority(SpellInfo const* spellInfo) { return 1; }
|
||||
virtual bool castSpell(uint32 spellId, WorldObject* wo);
|
||||
bool Execute(Event event) override;
|
||||
|
||||
protected:
|
||||
bool MultiCast = false;
|
||||
protected:
|
||||
bool MultiCast = false;
|
||||
};
|
||||
|
||||
class CraftRandomItemAction : public CastRandomSpellAction
|
||||
{
|
||||
public:
|
||||
CraftRandomItemAction(PlayerbotAI* botAI) : CastRandomSpellAction(botAI, "craft random item")
|
||||
{
|
||||
MultiCast = true;
|
||||
}
|
||||
public:
|
||||
CraftRandomItemAction(PlayerbotAI* botAI) : CastRandomSpellAction(botAI, "craft random item") { MultiCast = true; }
|
||||
|
||||
bool AcceptSpell(SpellInfo const* spellInfo) override;
|
||||
uint32 GetSpellPriority(SpellInfo const* spellInfo) override;
|
||||
bool AcceptSpell(SpellInfo const* spellInfo) override;
|
||||
uint32 GetSpellPriority(SpellInfo const* spellInfo) override;
|
||||
};
|
||||
|
||||
class DisEnchantRandomItemAction : public CastCustomSpellAction
|
||||
{
|
||||
public:
|
||||
DisEnchantRandomItemAction(PlayerbotAI* botAI) : CastCustomSpellAction(botAI, "disenchant random item") {}
|
||||
public:
|
||||
DisEnchantRandomItemAction(PlayerbotAI* botAI) : CastCustomSpellAction(botAI, "disenchant random item") {}
|
||||
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class EnchantRandomItemAction : public CastRandomSpellAction
|
||||
{
|
||||
public:
|
||||
EnchantRandomItemAction(PlayerbotAI* botAI) : CastRandomSpellAction(botAI, "enchant random item") { }
|
||||
public:
|
||||
EnchantRandomItemAction(PlayerbotAI* botAI) : CastRandomSpellAction(botAI, "enchant random item") {}
|
||||
|
||||
bool isUseful() override;
|
||||
bool AcceptSpell(SpellInfo const* spellInfo) override;
|
||||
uint32 GetSpellPriority(SpellInfo const* spellInfo) override;
|
||||
bool isUseful() override;
|
||||
bool AcceptSpell(SpellInfo const* spellInfo) override;
|
||||
uint32 GetSpellPriority(SpellInfo const* spellInfo) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChangeChatAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHANGECHATACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class ChangeChatAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeChatAction(PlayerbotAI* botAI) : Action(botAI, "chat") { }
|
||||
public:
|
||||
ChangeChatAction(PlayerbotAI* botAI) : Action(botAI, "chat") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChangeStrategyAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PlayerbotDbStore.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool ChangeCombatStrategyAction::Execute(Event event)
|
||||
{
|
||||
@@ -38,7 +40,8 @@ bool ChangeNonCombatStrategyAction::Execute(Event event)
|
||||
std::string const text = event.getParam();
|
||||
|
||||
uint32 account = bot->GetSession()->GetAccountId();
|
||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account) && botAI->GetMaster() && botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
if (sPlayerbotAIConfig->IsInRandomAccountList(account) && botAI->GetMaster() &&
|
||||
botAI->GetMaster()->GetSession()->GetSecurity() < SEC_GAMEMASTER)
|
||||
{
|
||||
if (text.find("loot") != std::string::npos || text.find("gather") != std::string::npos)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHANGESTRATEGYACTION_H
|
||||
@@ -11,26 +12,26 @@ class PlayerbotAI;
|
||||
|
||||
class ChangeCombatStrategyAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeCombatStrategyAction(PlayerbotAI* botAI, std::string const name = "co") : Action(botAI, name) { }
|
||||
public:
|
||||
ChangeCombatStrategyAction(PlayerbotAI* botAI, std::string const name = "co") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class ChangeNonCombatStrategyAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeNonCombatStrategyAction(PlayerbotAI* botAI) : Action(botAI, "nc") { }
|
||||
public:
|
||||
ChangeNonCombatStrategyAction(PlayerbotAI* botAI) : Action(botAI, "nc") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class ChangeDeadStrategyAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeDeadStrategyAction(PlayerbotAI* botAI) : Action(botAI, "de") { }
|
||||
public:
|
||||
ChangeDeadStrategyAction(PlayerbotAI* botAI) : Action(botAI, "de") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChangeTalentsAction.h"
|
||||
|
||||
#include "AiFactory.h"
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
@@ -17,16 +19,22 @@ bool ChangeTalentsAction::Execute(Event event)
|
||||
std::ostringstream out;
|
||||
|
||||
TalentSpec botSpec(bot);
|
||||
|
||||
|
||||
if (!param.empty())
|
||||
{
|
||||
if (param.find("help") != std::string::npos) {
|
||||
if (param.find("help") != std::string::npos)
|
||||
{
|
||||
out << TalentsHelp();
|
||||
} else if (param.find("switch") != std::string::npos) {
|
||||
if (param.find("switch 1") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("switch") != std::string::npos)
|
||||
{
|
||||
if (param.find("switch 1") != std::string::npos)
|
||||
{
|
||||
bot->ActivateSpec(0);
|
||||
out << "Active first talent";
|
||||
} else if (param.find("switch 2") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("switch 2") != std::string::npos)
|
||||
{
|
||||
if (bot->GetSpecsCount() == 1 && bot->GetLevel() >= sWorld->getIntConfig(CONFIG_MIN_DUALSPEC_LEVEL))
|
||||
{
|
||||
bot->CastSpell(bot, 63680, true, nullptr, nullptr, bot->GetGUID());
|
||||
@@ -35,28 +43,39 @@ bool ChangeTalentsAction::Execute(Event event)
|
||||
bot->ActivateSpec(1);
|
||||
out << "Active second talent";
|
||||
}
|
||||
} else if (param.find("autopick") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("autopick") != std::string::npos)
|
||||
{
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
factory.InitTalentsTree(true);
|
||||
out << "Auto pick talents";
|
||||
} else if (param.find("spec list") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("spec list") != std::string::npos)
|
||||
{
|
||||
out << SpecList();
|
||||
} else if (param.find("spec ") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("spec ") != std::string::npos)
|
||||
{
|
||||
param = param.substr(5);
|
||||
out << SpecPick(param);
|
||||
botAI->ResetStrategies();
|
||||
} else if (param.find("apply ") != std::string::npos) {
|
||||
}
|
||||
else if (param.find("apply ") != std::string::npos)
|
||||
{
|
||||
param = param.substr(6);
|
||||
out << SpecApply(param);
|
||||
botAI->ResetStrategies();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
out << "Unknown command.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 tab = AiFactory::GetPlayerSpecTab(bot);
|
||||
out << "My current talent spec is: " << "|h|cffffffff";
|
||||
out << "My current talent spec is: "
|
||||
<< "|h|cffffffff";
|
||||
out << chat->FormatClass(bot, tab) << "\n";
|
||||
out << TalentsHelp();
|
||||
}
|
||||
@@ -70,7 +89,7 @@ std::string ChangeTalentsAction::TalentsHelp()
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "Talents usage: talents switch <1/2>, talents autopick, talents spec list, "
|
||||
"talents spec <specName>, talents apply <link>.";
|
||||
"talents spec <specName>, talents apply <link>.";
|
||||
return out.str();
|
||||
}
|
||||
|
||||
@@ -79,8 +98,10 @@ std::string ChangeTalentsAction::SpecList()
|
||||
int cls = bot->getClass();
|
||||
int specFound = 0;
|
||||
std::ostringstream out;
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo) {
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0) {
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
||||
{
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
specFound++;
|
||||
@@ -88,7 +109,8 @@ std::string ChangeTalentsAction::SpecList()
|
||||
std::vector<std::vector<uint32>> parsed = sPlayerbotAIConfig->parsedSpecLinkOrder[cls][specNo][80];
|
||||
std::unordered_map<int, int> tabCount;
|
||||
tabCount[0] = tabCount[1] = tabCount[2] = 0;
|
||||
for (auto &item : parsed) {
|
||||
for (auto& item : parsed)
|
||||
{
|
||||
tabCount[item[0]] += item[3];
|
||||
}
|
||||
out << specFound << ". " << sPlayerbotAIConfig->premadeSpecName[cls][specNo] << " (";
|
||||
@@ -103,11 +125,14 @@ std::string ChangeTalentsAction::SpecPick(std::string param)
|
||||
{
|
||||
int cls = bot->getClass();
|
||||
int specFound = 0;
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo) {
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0) {
|
||||
for (int specNo = 0; specNo < MAX_SPECNO; ++specNo)
|
||||
{
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo].size() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo] == param) {
|
||||
if (sPlayerbotAIConfig->premadeSpecName[cls][specNo] == param)
|
||||
{
|
||||
PlayerbotFactory::InitTalentsBySpecNo(bot, specNo, true);
|
||||
std::ostringstream out;
|
||||
out << "Picking " << sPlayerbotAIConfig->premadeSpecName[cls][specNo];
|
||||
@@ -119,13 +144,13 @@ std::string ChangeTalentsAction::SpecPick(std::string param)
|
||||
return out.str();
|
||||
}
|
||||
|
||||
|
||||
std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
{
|
||||
int cls = bot->getClass();
|
||||
std::ostringstream out;
|
||||
std::vector<std::vector<uint32>> parsedSpecLink = PlayerbotAIConfig::ParseTempTalentsOrder(cls, param);
|
||||
if (parsedSpecLink.size() == 0) {
|
||||
if (parsedSpecLink.size() == 0)
|
||||
{
|
||||
out << "Invalid link " << param;
|
||||
return out.str();
|
||||
}
|
||||
@@ -243,7 +268,8 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// newSpec.ApplyTalents(bot, out);
|
||||
// if (newSpec.GetTalentPoints() > 0)
|
||||
// {
|
||||
// *out << "Upgrading spec " << "|h|cffffffff" << getPremadePath(specId)->name << "" << newSpec.FormatSpec(bot);
|
||||
// *out << "Upgrading spec " << "|h|cffffffff" << getPremadePath(specId)->name << "" <<
|
||||
// newSpec.FormatSpec(bot);
|
||||
// }
|
||||
// }
|
||||
// else if (!specLink.empty())
|
||||
@@ -254,7 +280,8 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// if (newSpec.GetTalentPoints() > 0)
|
||||
// {
|
||||
// *out << "Upgrading saved spec "
|
||||
// << "|h|cffffffff" << chat->FormatClass(bot, newSpec.highestTree()) << " (" << newSpec.FormatSpec(bot) << ")";
|
||||
// << "|h|cffffffff" << chat->FormatClass(bot, newSpec.highestTree()) << " (" <<
|
||||
// newSpec.FormatSpec(bot) << ")";
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -278,7 +305,8 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// specId = -1;
|
||||
// // specLink = "";
|
||||
// }
|
||||
// else if (paths.size() > 1 && false/*!sPlayerbotAIConfig->autoPickTalents*/ && !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
// else if (paths.size() > 1 && false/*!sPlayerbotAIConfig->autoPickTalents*/ &&
|
||||
// !sRandomPlayerbotMgr->IsRandomBot(bot))
|
||||
// {
|
||||
// *out << "Found multiple specs: ";
|
||||
// listPremadePaths(paths, out);
|
||||
@@ -294,7 +322,8 @@ std::string ChangeTalentsAction::SpecApply(std::string param)
|
||||
// if (paths.size() > 1)
|
||||
// *out << "Found " << paths.size() << " possible specs to choose from. ";
|
||||
|
||||
// *out << "Apply spec " << "|h|cffffffff" << getPremadePath(specId)->name << " " << newSpec.FormatSpec(bot);
|
||||
// *out << "Apply spec " << "|h|cffffffff" << getPremadePath(specId)->name << " " <<
|
||||
// newSpec.FormatSpec(bot);
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHANGETALENTSACTION_H
|
||||
@@ -12,31 +13,31 @@ class PlayerbotAI;
|
||||
|
||||
class ChangeTalentsAction : public Action
|
||||
{
|
||||
public:
|
||||
ChangeTalentsAction(PlayerbotAI* botAI, std::string const name = "talents") : Action(botAI, name) { }
|
||||
public:
|
||||
ChangeTalentsAction(PlayerbotAI* botAI, std::string const name = "talents") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event);
|
||||
// bool AutoSelectTalents(std::ostringstream* out);
|
||||
bool Execute(Event event);
|
||||
// bool AutoSelectTalents(std::ostringstream* out);
|
||||
|
||||
private:
|
||||
// std::vector<TalentPath*> getPremadePaths(std::string const findName);
|
||||
// std::vector<TalentPath*> getPremadePaths(TalentSpec* oldSpec);
|
||||
// TalentPath* getPremadePath(uint32 id);
|
||||
// void listPremadePaths(std::vector<TalentPath*> paths, std::ostringstream* out);
|
||||
// TalentPath* PickPremadePath(std::vector<TalentPath*> paths, bool useProbability);
|
||||
// TalentSpec* GetBestPremadeSpec(uint32 spec);
|
||||
std::string TalentsHelp();
|
||||
std::string SpecList();
|
||||
std::string SpecPick(std::string param);
|
||||
std::string SpecApply(std::string param);
|
||||
private:
|
||||
// std::vector<TalentPath*> getPremadePaths(std::string const findName);
|
||||
// std::vector<TalentPath*> getPremadePaths(TalentSpec* oldSpec);
|
||||
// TalentPath* getPremadePath(uint32 id);
|
||||
// void listPremadePaths(std::vector<TalentPath*> paths, std::ostringstream* out);
|
||||
// TalentPath* PickPremadePath(std::vector<TalentPath*> paths, bool useProbability);
|
||||
// TalentSpec* GetBestPremadeSpec(uint32 spec);
|
||||
std::string TalentsHelp();
|
||||
std::string SpecList();
|
||||
std::string SpecPick(std::string param);
|
||||
std::string SpecApply(std::string param);
|
||||
};
|
||||
|
||||
class AutoSetTalentsAction : public ChangeTalentsAction
|
||||
{
|
||||
public:
|
||||
AutoSetTalentsAction(PlayerbotAI* botAI) : ChangeTalentsAction(botAI, "auto talents") { }
|
||||
public:
|
||||
AutoSetTalentsAction(PlayerbotAI* botAI) : ChangeTalentsAction(botAI, "auto talents") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHATACTIONCONTEXTACTION_H
|
||||
@@ -12,8 +13,8 @@
|
||||
#include "BuyAction.h"
|
||||
#include "CastCustomSpellAction.h"
|
||||
#include "ChangeChatAction.h"
|
||||
#include "ChangeTalentsAction.h"
|
||||
#include "ChangeStrategyAction.h"
|
||||
#include "ChangeTalentsAction.h"
|
||||
#include "ChatShortcutActions.h"
|
||||
#include "CheatAction.h"
|
||||
#include "CustomStrategyEditAction.h"
|
||||
@@ -22,6 +23,7 @@
|
||||
#include "DropQuestAction.h"
|
||||
#include "EquipAction.h"
|
||||
#include "FlagAction.h"
|
||||
#include "Formations.h"
|
||||
#include "GoAction.h"
|
||||
#include "GossipHelloAction.h"
|
||||
#include "GuildBankAction.h"
|
||||
@@ -35,10 +37,11 @@
|
||||
#include "LogLevelAction.h"
|
||||
#include "LootStrategyAction.h"
|
||||
#include "MailAction.h"
|
||||
#include "QueryItemUsageAction.h"
|
||||
#include "QueryQuestAction.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "PassLeadershipToMasterAction.h"
|
||||
#include "PositionAction.h"
|
||||
#include "QueryItemUsageAction.h"
|
||||
#include "QueryQuestAction.h"
|
||||
#include "RangeAction.h"
|
||||
#include "ReleaseSpiritAction.h"
|
||||
#include "RepairAllAction.h"
|
||||
@@ -49,11 +52,12 @@
|
||||
#include "RtscAction.h"
|
||||
#include "SaveManaAction.h"
|
||||
#include "SellAction.h"
|
||||
#include "SetCraftAction.h"
|
||||
#include "SendMailAction.h"
|
||||
#include "SetCraftAction.h"
|
||||
#include "SetHomeAction.h"
|
||||
#include "ShareQuestAction.h"
|
||||
#include "SkipSpellsListAction.h"
|
||||
#include "Stances.h"
|
||||
#include "StatsAction.h"
|
||||
#include "TaxiAction.h"
|
||||
#include "TeleportAction.h"
|
||||
@@ -69,205 +73,201 @@
|
||||
#include "UseMeetingStoneAction.h"
|
||||
#include "WhoAction.h"
|
||||
#include "WtsAction.h"
|
||||
#include "NamedObjectContext.h"
|
||||
#include "Formations.h"
|
||||
#include "Stances.h"
|
||||
|
||||
class ChatActionContext : public NamedObjectContext<Action>
|
||||
{
|
||||
public:
|
||||
ChatActionContext()
|
||||
{
|
||||
creators["range"] = &ChatActionContext::range;
|
||||
creators["stats"] = &ChatActionContext::stats;
|
||||
creators["quests"] = &ChatActionContext::quests;
|
||||
creators["leave"] = &ChatActionContext::leave;
|
||||
creators["reputation"] = &ChatActionContext::reputation;
|
||||
creators["log"] = &ChatActionContext::log;
|
||||
creators["los"] = &ChatActionContext::los;
|
||||
creators["aura"] = &ChatActionContext::aura;
|
||||
creators["drop"] = &ChatActionContext::drop;
|
||||
creators["clean quest log"] = &ChatActionContext::clean_quest_log;
|
||||
creators["share"] = &ChatActionContext::share;
|
||||
creators["query quest"] = &ChatActionContext::query_quest;
|
||||
creators["query item usage"] = &ChatActionContext::query_item_usage;
|
||||
creators["ll"] = &ChatActionContext::ll;
|
||||
creators["ss"] = &ChatActionContext::ss;
|
||||
creators["add all loot"] = &ChatActionContext::add_all_loot;
|
||||
creators["release"] = &ChatActionContext::release;
|
||||
creators["repop"] = &ChatActionContext::repop;
|
||||
creators["teleport"] = &ChatActionContext::teleport;
|
||||
creators["taxi"] = &ChatActionContext::taxi;
|
||||
creators["repair"] = &ChatActionContext::repair;
|
||||
creators["use"] = &ChatActionContext::use;
|
||||
creators["item count"] = &ChatActionContext::item_count;
|
||||
creators["equip"] = &ChatActionContext::equip;
|
||||
creators["equip upgrades"] = &ChatActionContext::equip_upgrades;
|
||||
creators["unequip"] = &ChatActionContext::unequip;
|
||||
creators["sell"] = &ChatActionContext::sell;
|
||||
creators["buy"] = &ChatActionContext::buy;
|
||||
creators["reward"] = &ChatActionContext::reward;
|
||||
creators["trade"] = &ChatActionContext::trade;
|
||||
creators["talents"] = &ChatActionContext::talents;
|
||||
creators["spells"] = &ChatActionContext::spells;
|
||||
creators["co"] = &ChatActionContext::co;
|
||||
creators["nc"] = &ChatActionContext::nc;
|
||||
creators["de"] = &ChatActionContext::dead;
|
||||
creators["trainer"] = &ChatActionContext::trainer;
|
||||
creators["maintenance"] = &ChatActionContext::maintenance;
|
||||
creators["remove glyph"] = &ChatActionContext::remove_glyph;
|
||||
creators["autogear"] = &ChatActionContext::autogear;
|
||||
creators["equip upgrade"] = &ChatActionContext::equip_upgrade;
|
||||
creators["attack my target"] = &ChatActionContext::attack_my_target;
|
||||
creators["chat"] = &ChatActionContext::chat;
|
||||
creators["home"] = &ChatActionContext::home;
|
||||
creators["destroy"] = &ChatActionContext::destroy;
|
||||
creators["reset botAI"] = &ChatActionContext::reset_ai;
|
||||
creators["buff"] = &ChatActionContext::buff;
|
||||
creators["help"] = &ChatActionContext::help;
|
||||
creators["gb"] = &ChatActionContext::gb;
|
||||
creators["bank"] = &ChatActionContext::bank;
|
||||
creators["follow chat shortcut"] = &ChatActionContext::follow_chat_shortcut;
|
||||
creators["stay chat shortcut"] = &ChatActionContext::stay_chat_shortcut;
|
||||
creators["flee chat shortcut"] = &ChatActionContext::flee_chat_shortcut;
|
||||
creators["runaway chat shortcut"] = &ChatActionContext::runaway_chat_shortcut;
|
||||
creators["grind chat shortcut"] = &ChatActionContext::grind_chat_shortcut;
|
||||
creators["tank attack chat shortcut"] = &ChatActionContext::tank_attack_chat_shortcut;
|
||||
creators["gossip hello"] = &ChatActionContext::gossip_hello;
|
||||
creators["cast custom spell"] = &ChatActionContext::cast_custom_spell;
|
||||
creators["cast custom nc spell"] = &ChatActionContext::cast_custom_nc_spell;
|
||||
creators["invite"] = &ChatActionContext::invite;
|
||||
creators["spell"] = &ChatActionContext::spell;
|
||||
creators["rti"] = &ChatActionContext::rti;
|
||||
creators["spirit healer"] = &ChatActionContext::spirit_healer;
|
||||
creators["position"] = &ChatActionContext::position;
|
||||
creators["tell target"] = &ChatActionContext::tell_target;
|
||||
creators["summon"] = &ChatActionContext::summon;
|
||||
creators["who"] = &ChatActionContext::who;
|
||||
creators["save mana"] = &ChatActionContext::save_mana;
|
||||
creators["max dps chat shortcut"] = &ChatActionContext::max_dps_chat_shortcut;
|
||||
creators["tell attackers"] = &ChatActionContext::tell_attackers;
|
||||
creators["tell target"] = &ChatActionContext::tell_target;
|
||||
creators["formation"] = &ChatActionContext::formation;
|
||||
creators["stance"] = &ChatActionContext::stance;
|
||||
creators["sendmail"] = &ChatActionContext::sendmail;
|
||||
creators["mail"] = &ChatActionContext::mail;
|
||||
creators["go"] = &ChatActionContext::go;
|
||||
creators["debug"] = &ChatActionContext::debug;
|
||||
creators["cdebug"] = &ChatActionContext::debug;
|
||||
creators["cs"] = &ChatActionContext::cs;
|
||||
creators["wts"] = &ChatActionContext::wts;
|
||||
creators["hire"] = &ChatActionContext::hire;
|
||||
creators["craft"] = &ChatActionContext::craft;
|
||||
creators["flag"] = &ChatActionContext::flag;
|
||||
creators["give leader"] = &ChatActionContext::give_leader;
|
||||
creators["cheat"] = &ChatActionContext::cheat;
|
||||
creators["ginvite"] = &ChatActionContext::ginvite;
|
||||
creators["guild promote"] = &ChatActionContext::guild_promote;
|
||||
creators["guild demote"] = &ChatActionContext::guild_demote;
|
||||
creators["guild remove"] = &ChatActionContext::guild_remove;
|
||||
creators["guild leave"] = &ChatActionContext::guild_leave;
|
||||
creators["rtsc"] = &ChatActionContext::rtsc;
|
||||
creators["naxx chat shortcut"] = &ChatActionContext::naxx_chat_shortcut;
|
||||
creators["bwl chat shortcut"] = &ChatActionContext::bwl_chat_shortcut;
|
||||
creators["tell expected dps"] = &ChatActionContext::tell_expected_dps;
|
||||
|
||||
}
|
||||
public:
|
||||
ChatActionContext()
|
||||
{
|
||||
creators["range"] = &ChatActionContext::range;
|
||||
creators["stats"] = &ChatActionContext::stats;
|
||||
creators["quests"] = &ChatActionContext::quests;
|
||||
creators["leave"] = &ChatActionContext::leave;
|
||||
creators["reputation"] = &ChatActionContext::reputation;
|
||||
creators["log"] = &ChatActionContext::log;
|
||||
creators["los"] = &ChatActionContext::los;
|
||||
creators["aura"] = &ChatActionContext::aura;
|
||||
creators["drop"] = &ChatActionContext::drop;
|
||||
creators["clean quest log"] = &ChatActionContext::clean_quest_log;
|
||||
creators["share"] = &ChatActionContext::share;
|
||||
creators["query quest"] = &ChatActionContext::query_quest;
|
||||
creators["query item usage"] = &ChatActionContext::query_item_usage;
|
||||
creators["ll"] = &ChatActionContext::ll;
|
||||
creators["ss"] = &ChatActionContext::ss;
|
||||
creators["add all loot"] = &ChatActionContext::add_all_loot;
|
||||
creators["release"] = &ChatActionContext::release;
|
||||
creators["repop"] = &ChatActionContext::repop;
|
||||
creators["teleport"] = &ChatActionContext::teleport;
|
||||
creators["taxi"] = &ChatActionContext::taxi;
|
||||
creators["repair"] = &ChatActionContext::repair;
|
||||
creators["use"] = &ChatActionContext::use;
|
||||
creators["item count"] = &ChatActionContext::item_count;
|
||||
creators["equip"] = &ChatActionContext::equip;
|
||||
creators["equip upgrades"] = &ChatActionContext::equip_upgrades;
|
||||
creators["unequip"] = &ChatActionContext::unequip;
|
||||
creators["sell"] = &ChatActionContext::sell;
|
||||
creators["buy"] = &ChatActionContext::buy;
|
||||
creators["reward"] = &ChatActionContext::reward;
|
||||
creators["trade"] = &ChatActionContext::trade;
|
||||
creators["talents"] = &ChatActionContext::talents;
|
||||
creators["spells"] = &ChatActionContext::spells;
|
||||
creators["co"] = &ChatActionContext::co;
|
||||
creators["nc"] = &ChatActionContext::nc;
|
||||
creators["de"] = &ChatActionContext::dead;
|
||||
creators["trainer"] = &ChatActionContext::trainer;
|
||||
creators["maintenance"] = &ChatActionContext::maintenance;
|
||||
creators["remove glyph"] = &ChatActionContext::remove_glyph;
|
||||
creators["autogear"] = &ChatActionContext::autogear;
|
||||
creators["equip upgrade"] = &ChatActionContext::equip_upgrade;
|
||||
creators["attack my target"] = &ChatActionContext::attack_my_target;
|
||||
creators["chat"] = &ChatActionContext::chat;
|
||||
creators["home"] = &ChatActionContext::home;
|
||||
creators["destroy"] = &ChatActionContext::destroy;
|
||||
creators["reset botAI"] = &ChatActionContext::reset_ai;
|
||||
creators["buff"] = &ChatActionContext::buff;
|
||||
creators["help"] = &ChatActionContext::help;
|
||||
creators["gb"] = &ChatActionContext::gb;
|
||||
creators["bank"] = &ChatActionContext::bank;
|
||||
creators["follow chat shortcut"] = &ChatActionContext::follow_chat_shortcut;
|
||||
creators["stay chat shortcut"] = &ChatActionContext::stay_chat_shortcut;
|
||||
creators["flee chat shortcut"] = &ChatActionContext::flee_chat_shortcut;
|
||||
creators["runaway chat shortcut"] = &ChatActionContext::runaway_chat_shortcut;
|
||||
creators["grind chat shortcut"] = &ChatActionContext::grind_chat_shortcut;
|
||||
creators["tank attack chat shortcut"] = &ChatActionContext::tank_attack_chat_shortcut;
|
||||
creators["gossip hello"] = &ChatActionContext::gossip_hello;
|
||||
creators["cast custom spell"] = &ChatActionContext::cast_custom_spell;
|
||||
creators["cast custom nc spell"] = &ChatActionContext::cast_custom_nc_spell;
|
||||
creators["invite"] = &ChatActionContext::invite;
|
||||
creators["spell"] = &ChatActionContext::spell;
|
||||
creators["rti"] = &ChatActionContext::rti;
|
||||
creators["spirit healer"] = &ChatActionContext::spirit_healer;
|
||||
creators["position"] = &ChatActionContext::position;
|
||||
creators["tell target"] = &ChatActionContext::tell_target;
|
||||
creators["summon"] = &ChatActionContext::summon;
|
||||
creators["who"] = &ChatActionContext::who;
|
||||
creators["save mana"] = &ChatActionContext::save_mana;
|
||||
creators["max dps chat shortcut"] = &ChatActionContext::max_dps_chat_shortcut;
|
||||
creators["tell attackers"] = &ChatActionContext::tell_attackers;
|
||||
creators["tell target"] = &ChatActionContext::tell_target;
|
||||
creators["formation"] = &ChatActionContext::formation;
|
||||
creators["stance"] = &ChatActionContext::stance;
|
||||
creators["sendmail"] = &ChatActionContext::sendmail;
|
||||
creators["mail"] = &ChatActionContext::mail;
|
||||
creators["go"] = &ChatActionContext::go;
|
||||
creators["debug"] = &ChatActionContext::debug;
|
||||
creators["cdebug"] = &ChatActionContext::debug;
|
||||
creators["cs"] = &ChatActionContext::cs;
|
||||
creators["wts"] = &ChatActionContext::wts;
|
||||
creators["hire"] = &ChatActionContext::hire;
|
||||
creators["craft"] = &ChatActionContext::craft;
|
||||
creators["flag"] = &ChatActionContext::flag;
|
||||
creators["give leader"] = &ChatActionContext::give_leader;
|
||||
creators["cheat"] = &ChatActionContext::cheat;
|
||||
creators["ginvite"] = &ChatActionContext::ginvite;
|
||||
creators["guild promote"] = &ChatActionContext::guild_promote;
|
||||
creators["guild demote"] = &ChatActionContext::guild_demote;
|
||||
creators["guild remove"] = &ChatActionContext::guild_remove;
|
||||
creators["guild leave"] = &ChatActionContext::guild_leave;
|
||||
creators["rtsc"] = &ChatActionContext::rtsc;
|
||||
creators["naxx chat shortcut"] = &ChatActionContext::naxx_chat_shortcut;
|
||||
creators["bwl chat shortcut"] = &ChatActionContext::bwl_chat_shortcut;
|
||||
creators["tell expected dps"] = &ChatActionContext::tell_expected_dps;
|
||||
}
|
||||
|
||||
private:
|
||||
static Action* range(PlayerbotAI* botAI) { return new RangeAction(botAI); }
|
||||
static Action* flag(PlayerbotAI* botAI) { return new FlagAction(botAI); }
|
||||
static Action* craft(PlayerbotAI* botAI) { return new SetCraftAction(botAI); }
|
||||
static Action* hire(PlayerbotAI* botAI) { return new HireAction(botAI); }
|
||||
static Action* wts(PlayerbotAI* botAI) { return new WtsAction(botAI); }
|
||||
static Action* cs(PlayerbotAI* botAI) { return new CustomStrategyEditAction(botAI); }
|
||||
static Action* debug(PlayerbotAI* botAI) { return new DebugAction(botAI); }
|
||||
static Action* mail(PlayerbotAI* botAI) { return new MailAction(botAI); }
|
||||
static Action* go(PlayerbotAI* botAI) { return new GoAction(botAI); }
|
||||
static Action* sendmail(PlayerbotAI* botAI) { return new SendMailAction(botAI); }
|
||||
static Action* formation(PlayerbotAI* botAI) { return new SetFormationAction(botAI); }
|
||||
static Action* stance(PlayerbotAI* botAI) { return new SetStanceAction(botAI); }
|
||||
static Action* tell_attackers(PlayerbotAI* botAI) { return new TellAttackersAction(botAI); }
|
||||
static Action* max_dps_chat_shortcut(PlayerbotAI* botAI) { return new MaxDpsChatShortcutAction(botAI); }
|
||||
static Action* save_mana(PlayerbotAI* botAI) { return new SaveManaAction(botAI); }
|
||||
static Action* who(PlayerbotAI* botAI) { return new WhoAction(botAI); }
|
||||
static Action* summon(PlayerbotAI* botAI) { return new SummonAction(botAI); }
|
||||
static Action* tell_target(PlayerbotAI* botAI) { return new TellTargetAction(botAI); }
|
||||
static Action* position(PlayerbotAI* botAI) { return new PositionAction(botAI); }
|
||||
static Action* spirit_healer(PlayerbotAI* botAI) { return new SpiritHealerAction(botAI); }
|
||||
static Action* rti(PlayerbotAI* botAI) { return new RtiAction(botAI); }
|
||||
static Action* invite(PlayerbotAI* botAI) { return new InviteToGroupAction(botAI); }
|
||||
static Action* spell(PlayerbotAI* botAI) { return new TellSpellAction(botAI); }
|
||||
static Action* cast_custom_spell(PlayerbotAI* botAI) { return new CastCustomSpellAction(botAI); }
|
||||
static Action* cast_custom_nc_spell(PlayerbotAI* botAI) { return new CastCustomNcSpellAction(botAI); }
|
||||
static Action* tank_attack_chat_shortcut(PlayerbotAI* botAI) { return new TankAttackChatShortcutAction(botAI); }
|
||||
static Action* grind_chat_shortcut(PlayerbotAI* botAI) { return new GrindChatShortcutAction(botAI); }
|
||||
static Action* flee_chat_shortcut(PlayerbotAI* botAI) { return new FleeChatShortcutAction(botAI); }
|
||||
static Action* runaway_chat_shortcut(PlayerbotAI* botAI) { return new GoawayChatShortcutAction(botAI); }
|
||||
static Action* stay_chat_shortcut(PlayerbotAI* botAI) { return new StayChatShortcutAction(botAI); }
|
||||
static Action* follow_chat_shortcut(PlayerbotAI* botAI) { return new FollowChatShortcutAction(botAI); }
|
||||
static Action* gb(PlayerbotAI* botAI) { return new GuildBankAction(botAI); }
|
||||
static Action* bank(PlayerbotAI* botAI) { return new BankAction(botAI); }
|
||||
static Action* help(PlayerbotAI* botAI) { return new HelpAction(botAI); }
|
||||
static Action* buff(PlayerbotAI* botAI) { return new BuffAction(botAI); }
|
||||
static Action* destroy(PlayerbotAI* botAI) { return new DestroyItemAction(botAI); }
|
||||
static Action* home(PlayerbotAI* botAI) { return new SetHomeAction(botAI); }
|
||||
static Action* chat(PlayerbotAI* botAI) { return new ChangeChatAction(botAI); }
|
||||
static Action* attack_my_target(PlayerbotAI* botAI) { return new AttackMyTargetAction(botAI); }
|
||||
static Action* trainer(PlayerbotAI* botAI) { return new TrainerAction(botAI); }
|
||||
static Action* maintenance(PlayerbotAI* botAI) { return new MaintenanceAction(botAI); }
|
||||
static Action* remove_glyph(PlayerbotAI* botAI) { return new RemoveGlyphAction(botAI); }
|
||||
static Action* autogear(PlayerbotAI* botAI) { return new AutoGearAction(botAI); }
|
||||
static Action* equip_upgrade(PlayerbotAI* botAI) { return new EquipUpgradeAction(botAI); }
|
||||
static Action* co(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI); }
|
||||
static Action* nc(PlayerbotAI* botAI) { return new ChangeNonCombatStrategyAction(botAI); }
|
||||
static Action* dead(PlayerbotAI* botAI) { return new ChangeDeadStrategyAction(botAI); }
|
||||
static Action* spells(PlayerbotAI* botAI) { return new ListSpellsAction(botAI); }
|
||||
static Action* talents(PlayerbotAI* botAI) { return new ChangeTalentsAction(botAI); }
|
||||
private:
|
||||
static Action* range(PlayerbotAI* botAI) { return new RangeAction(botAI); }
|
||||
static Action* flag(PlayerbotAI* botAI) { return new FlagAction(botAI); }
|
||||
static Action* craft(PlayerbotAI* botAI) { return new SetCraftAction(botAI); }
|
||||
static Action* hire(PlayerbotAI* botAI) { return new HireAction(botAI); }
|
||||
static Action* wts(PlayerbotAI* botAI) { return new WtsAction(botAI); }
|
||||
static Action* cs(PlayerbotAI* botAI) { return new CustomStrategyEditAction(botAI); }
|
||||
static Action* debug(PlayerbotAI* botAI) { return new DebugAction(botAI); }
|
||||
static Action* mail(PlayerbotAI* botAI) { return new MailAction(botAI); }
|
||||
static Action* go(PlayerbotAI* botAI) { return new GoAction(botAI); }
|
||||
static Action* sendmail(PlayerbotAI* botAI) { return new SendMailAction(botAI); }
|
||||
static Action* formation(PlayerbotAI* botAI) { return new SetFormationAction(botAI); }
|
||||
static Action* stance(PlayerbotAI* botAI) { return new SetStanceAction(botAI); }
|
||||
static Action* tell_attackers(PlayerbotAI* botAI) { return new TellAttackersAction(botAI); }
|
||||
static Action* max_dps_chat_shortcut(PlayerbotAI* botAI) { return new MaxDpsChatShortcutAction(botAI); }
|
||||
static Action* save_mana(PlayerbotAI* botAI) { return new SaveManaAction(botAI); }
|
||||
static Action* who(PlayerbotAI* botAI) { return new WhoAction(botAI); }
|
||||
static Action* summon(PlayerbotAI* botAI) { return new SummonAction(botAI); }
|
||||
static Action* tell_target(PlayerbotAI* botAI) { return new TellTargetAction(botAI); }
|
||||
static Action* position(PlayerbotAI* botAI) { return new PositionAction(botAI); }
|
||||
static Action* spirit_healer(PlayerbotAI* botAI) { return new SpiritHealerAction(botAI); }
|
||||
static Action* rti(PlayerbotAI* botAI) { return new RtiAction(botAI); }
|
||||
static Action* invite(PlayerbotAI* botAI) { return new InviteToGroupAction(botAI); }
|
||||
static Action* spell(PlayerbotAI* botAI) { return new TellSpellAction(botAI); }
|
||||
static Action* cast_custom_spell(PlayerbotAI* botAI) { return new CastCustomSpellAction(botAI); }
|
||||
static Action* cast_custom_nc_spell(PlayerbotAI* botAI) { return new CastCustomNcSpellAction(botAI); }
|
||||
static Action* tank_attack_chat_shortcut(PlayerbotAI* botAI) { return new TankAttackChatShortcutAction(botAI); }
|
||||
static Action* grind_chat_shortcut(PlayerbotAI* botAI) { return new GrindChatShortcutAction(botAI); }
|
||||
static Action* flee_chat_shortcut(PlayerbotAI* botAI) { return new FleeChatShortcutAction(botAI); }
|
||||
static Action* runaway_chat_shortcut(PlayerbotAI* botAI) { return new GoawayChatShortcutAction(botAI); }
|
||||
static Action* stay_chat_shortcut(PlayerbotAI* botAI) { return new StayChatShortcutAction(botAI); }
|
||||
static Action* follow_chat_shortcut(PlayerbotAI* botAI) { return new FollowChatShortcutAction(botAI); }
|
||||
static Action* gb(PlayerbotAI* botAI) { return new GuildBankAction(botAI); }
|
||||
static Action* bank(PlayerbotAI* botAI) { return new BankAction(botAI); }
|
||||
static Action* help(PlayerbotAI* botAI) { return new HelpAction(botAI); }
|
||||
static Action* buff(PlayerbotAI* botAI) { return new BuffAction(botAI); }
|
||||
static Action* destroy(PlayerbotAI* botAI) { return new DestroyItemAction(botAI); }
|
||||
static Action* home(PlayerbotAI* botAI) { return new SetHomeAction(botAI); }
|
||||
static Action* chat(PlayerbotAI* botAI) { return new ChangeChatAction(botAI); }
|
||||
static Action* attack_my_target(PlayerbotAI* botAI) { return new AttackMyTargetAction(botAI); }
|
||||
static Action* trainer(PlayerbotAI* botAI) { return new TrainerAction(botAI); }
|
||||
static Action* maintenance(PlayerbotAI* botAI) { return new MaintenanceAction(botAI); }
|
||||
static Action* remove_glyph(PlayerbotAI* botAI) { return new RemoveGlyphAction(botAI); }
|
||||
static Action* autogear(PlayerbotAI* botAI) { return new AutoGearAction(botAI); }
|
||||
static Action* equip_upgrade(PlayerbotAI* botAI) { return new EquipUpgradeAction(botAI); }
|
||||
static Action* co(PlayerbotAI* botAI) { return new ChangeCombatStrategyAction(botAI); }
|
||||
static Action* nc(PlayerbotAI* botAI) { return new ChangeNonCombatStrategyAction(botAI); }
|
||||
static Action* dead(PlayerbotAI* botAI) { return new ChangeDeadStrategyAction(botAI); }
|
||||
static Action* spells(PlayerbotAI* botAI) { return new ListSpellsAction(botAI); }
|
||||
static Action* talents(PlayerbotAI* botAI) { return new ChangeTalentsAction(botAI); }
|
||||
|
||||
static Action* equip(PlayerbotAI* botAI) { return new EquipAction(botAI); }
|
||||
static Action* equip_upgrades(PlayerbotAI* botAI) { return new EquipUpgradesAction(botAI); }
|
||||
static Action* unequip(PlayerbotAI* botAI) { return new UnequipAction(botAI); }
|
||||
static Action* sell(PlayerbotAI* botAI) { return new SellAction(botAI); }
|
||||
static Action* buy(PlayerbotAI* botAI) { return new BuyAction(botAI); }
|
||||
static Action* reward(PlayerbotAI* botAI) { return new RewardAction(botAI); }
|
||||
static Action* trade(PlayerbotAI* botAI) { return new TradeAction(botAI); }
|
||||
static Action* equip(PlayerbotAI* botAI) { return new EquipAction(botAI); }
|
||||
static Action* equip_upgrades(PlayerbotAI* botAI) { return new EquipUpgradesAction(botAI); }
|
||||
static Action* unequip(PlayerbotAI* botAI) { return new UnequipAction(botAI); }
|
||||
static Action* sell(PlayerbotAI* botAI) { return new SellAction(botAI); }
|
||||
static Action* buy(PlayerbotAI* botAI) { return new BuyAction(botAI); }
|
||||
static Action* reward(PlayerbotAI* botAI) { return new RewardAction(botAI); }
|
||||
static Action* trade(PlayerbotAI* botAI) { return new TradeAction(botAI); }
|
||||
|
||||
static Action* item_count(PlayerbotAI* botAI) { return new TellItemCountAction(botAI); }
|
||||
static Action* use(PlayerbotAI* botAI) { return new UseItemAction(botAI); }
|
||||
static Action* repair(PlayerbotAI* botAI) { return new RepairAllAction(botAI); }
|
||||
static Action* taxi(PlayerbotAI* botAI) { return new TaxiAction(botAI); }
|
||||
static Action* teleport(PlayerbotAI* botAI) { return new TeleportAction(botAI); }
|
||||
static Action* release(PlayerbotAI* botAI) { return new ReleaseSpiritAction(botAI); }
|
||||
static Action* repop(PlayerbotAI* botAI) { return new RepopAction(botAI); }
|
||||
static Action* query_item_usage(PlayerbotAI* botAI) { return new QueryItemUsageAction(botAI); }
|
||||
static Action* query_quest(PlayerbotAI* botAI) { return new QueryQuestAction(botAI); }
|
||||
static Action* drop(PlayerbotAI* botAI) { return new DropQuestAction(botAI); }
|
||||
static Action* clean_quest_log(PlayerbotAI* botAI) { return new CleanQuestLogAction(botAI); }
|
||||
static Action* share(PlayerbotAI* botAI) { return new ShareQuestAction(botAI); }
|
||||
static Action* stats(PlayerbotAI* botAI) { return new StatsAction(botAI); }
|
||||
static Action* quests(PlayerbotAI* botAI) { return new ListQuestsAction(botAI); }
|
||||
static Action* leave(PlayerbotAI* botAI) { return new LeaveGroupAction(botAI); }
|
||||
static Action* reputation(PlayerbotAI* botAI) { return new TellReputationAction(botAI); }
|
||||
static Action* log(PlayerbotAI* botAI) { return new LogLevelAction(botAI); }
|
||||
static Action* los(PlayerbotAI* botAI) { return new TellLosAction(botAI); }
|
||||
static Action* aura(PlayerbotAI* ai) { return new TellAuraAction(ai); }
|
||||
static Action* ll(PlayerbotAI* botAI) { return new LootStrategyAction(botAI); }
|
||||
static Action* ss(PlayerbotAI* botAI) { return new SkipSpellsListAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
static Action* reset_ai(PlayerbotAI* botAI) { return new ResetAiAction(botAI); }
|
||||
static Action* gossip_hello(PlayerbotAI* botAI) { return new GossipHelloAction(botAI); }
|
||||
static Action* give_leader(PlayerbotAI* botAI) { return new GiveLeaderAction(botAI); }
|
||||
static Action* cheat(PlayerbotAI* botAI) { return new CheatAction(botAI); }
|
||||
static Action* ginvite(PlayerbotAI* botAI) { return new GuildInviteAction(botAI); }
|
||||
static Action* guild_promote(PlayerbotAI* botAI) { return new GuildPromoteAction(botAI); }
|
||||
static Action* guild_demote(PlayerbotAI* botAI) { return new GuildDemoteAction(botAI); }
|
||||
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); }
|
||||
static Action* bwl_chat_shortcut(PlayerbotAI* ai) { return new BwlChatShortcutAction(ai); }
|
||||
static Action* tell_expected_dps(PlayerbotAI* ai) { return new TellExpectedDpsAction(ai); }
|
||||
static Action* item_count(PlayerbotAI* botAI) { return new TellItemCountAction(botAI); }
|
||||
static Action* use(PlayerbotAI* botAI) { return new UseItemAction(botAI); }
|
||||
static Action* repair(PlayerbotAI* botAI) { return new RepairAllAction(botAI); }
|
||||
static Action* taxi(PlayerbotAI* botAI) { return new TaxiAction(botAI); }
|
||||
static Action* teleport(PlayerbotAI* botAI) { return new TeleportAction(botAI); }
|
||||
static Action* release(PlayerbotAI* botAI) { return new ReleaseSpiritAction(botAI); }
|
||||
static Action* repop(PlayerbotAI* botAI) { return new RepopAction(botAI); }
|
||||
static Action* query_item_usage(PlayerbotAI* botAI) { return new QueryItemUsageAction(botAI); }
|
||||
static Action* query_quest(PlayerbotAI* botAI) { return new QueryQuestAction(botAI); }
|
||||
static Action* drop(PlayerbotAI* botAI) { return new DropQuestAction(botAI); }
|
||||
static Action* clean_quest_log(PlayerbotAI* botAI) { return new CleanQuestLogAction(botAI); }
|
||||
static Action* share(PlayerbotAI* botAI) { return new ShareQuestAction(botAI); }
|
||||
static Action* stats(PlayerbotAI* botAI) { return new StatsAction(botAI); }
|
||||
static Action* quests(PlayerbotAI* botAI) { return new ListQuestsAction(botAI); }
|
||||
static Action* leave(PlayerbotAI* botAI) { return new LeaveGroupAction(botAI); }
|
||||
static Action* reputation(PlayerbotAI* botAI) { return new TellReputationAction(botAI); }
|
||||
static Action* log(PlayerbotAI* botAI) { return new LogLevelAction(botAI); }
|
||||
static Action* los(PlayerbotAI* botAI) { return new TellLosAction(botAI); }
|
||||
static Action* aura(PlayerbotAI* ai) { return new TellAuraAction(ai); }
|
||||
static Action* ll(PlayerbotAI* botAI) { return new LootStrategyAction(botAI); }
|
||||
static Action* ss(PlayerbotAI* botAI) { return new SkipSpellsListAction(botAI); }
|
||||
static Action* add_all_loot(PlayerbotAI* botAI) { return new AddAllLootAction(botAI); }
|
||||
static Action* reset_ai(PlayerbotAI* botAI) { return new ResetAiAction(botAI); }
|
||||
static Action* gossip_hello(PlayerbotAI* botAI) { return new GossipHelloAction(botAI); }
|
||||
static Action* give_leader(PlayerbotAI* botAI) { return new GiveLeaderAction(botAI); }
|
||||
static Action* cheat(PlayerbotAI* botAI) { return new CheatAction(botAI); }
|
||||
static Action* ginvite(PlayerbotAI* botAI) { return new GuildInviteAction(botAI); }
|
||||
static Action* guild_promote(PlayerbotAI* botAI) { return new GuildPromoteAction(botAI); }
|
||||
static Action* guild_demote(PlayerbotAI* botAI) { return new GuildDemoteAction(botAI); }
|
||||
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); }
|
||||
static Action* bwl_chat_shortcut(PlayerbotAI* ai) { return new BwlChatShortcutAction(ai); }
|
||||
static Action* tell_expected_dps(PlayerbotAI* ai) { return new TellExpectedDpsAction(ai); }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChatShortcutActions.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Formations.h"
|
||||
#include "PositionValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PositionValue.h"
|
||||
|
||||
void ReturnPositionResetAction::ResetReturnPosition()
|
||||
{
|
||||
@@ -66,7 +68,8 @@ bool FollowChatShortcutAction::Execute(Event event)
|
||||
}
|
||||
|
||||
/* Default mechanics takes care of this now.
|
||||
if (bot->GetMapId() != master->GetMapId() || (master && bot->GetDistance(master) > sPlayerbotAIConfig->sightDistance))
|
||||
if (bot->GetMapId() != master->GetMapId() || (master && bot->GetDistance(master) >
|
||||
sPlayerbotAIConfig->sightDistance))
|
||||
{
|
||||
if (bot->isDead())
|
||||
{
|
||||
@@ -76,8 +79,8 @@ bool FollowChatShortcutAction::Execute(Event event)
|
||||
else
|
||||
botAI->TellMaster("You are too far away from me! I will there soon.");
|
||||
|
||||
bot->TeleportTo(master->GetMapId(), master->GetPositionX(), master->GetPositionY(), master->GetPositionZ(), master->GetOrientation());
|
||||
return true;
|
||||
bot->TeleportTo(master->GetMapId(), master->GetPositionX(), master->GetPositionY(), master->GetPositionZ(),
|
||||
master->GetOrientation()); return true;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHATSHORTCUTACTION_H
|
||||
@@ -11,80 +12,80 @@ class PlayerbotAI;
|
||||
|
||||
class ReturnPositionResetAction : public Action
|
||||
{
|
||||
public:
|
||||
ReturnPositionResetAction(PlayerbotAI* botAI, std::string const name) : Action(botAI, name) { }
|
||||
public:
|
||||
ReturnPositionResetAction(PlayerbotAI* botAI, std::string const name) : Action(botAI, name) {}
|
||||
|
||||
void ResetReturnPosition();
|
||||
void SetReturnPosition(float x, float y, float z);
|
||||
void ResetReturnPosition();
|
||||
void SetReturnPosition(float x, float y, float z);
|
||||
};
|
||||
|
||||
class FollowChatShortcutAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
FollowChatShortcutAction(PlayerbotAI* botAI) : MovementAction(botAI, "follow chat shortcut") { }
|
||||
public:
|
||||
FollowChatShortcutAction(PlayerbotAI* botAI) : MovementAction(botAI, "follow chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class StayChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
StayChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "stay chat shortcut") { }
|
||||
public:
|
||||
StayChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "stay chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class FleeChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
FleeChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "flee chat shortcut") { }
|
||||
public:
|
||||
FleeChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "flee chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class GoawayChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
GoawayChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "runaway chat shortcut") { }
|
||||
public:
|
||||
GoawayChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "runaway chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class GrindChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
GrindChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "grind chat shortcut") { }
|
||||
public:
|
||||
GrindChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "grind chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class TankAttackChatShortcutAction : public ReturnPositionResetAction
|
||||
{
|
||||
public:
|
||||
TankAttackChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "tank attack chat shortcut") { }
|
||||
public:
|
||||
TankAttackChatShortcutAction(PlayerbotAI* botAI) : ReturnPositionResetAction(botAI, "tank attack chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class MaxDpsChatShortcutAction : public Action
|
||||
{
|
||||
public:
|
||||
MaxDpsChatShortcutAction(PlayerbotAI* botAI) : Action(botAI, "max dps chat shortcut") { }
|
||||
public:
|
||||
MaxDpsChatShortcutAction(PlayerbotAI* botAI) : Action(botAI, "max dps chat shortcut") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class NaxxChatShortcutAction : public Action
|
||||
{
|
||||
public:
|
||||
NaxxChatShortcutAction(PlayerbotAI* ai) : Action(ai, "naxx chat shortcut") {}
|
||||
virtual bool Execute(Event event);
|
||||
public:
|
||||
NaxxChatShortcutAction(PlayerbotAI* ai) : Action(ai, "naxx chat shortcut") {}
|
||||
virtual bool Execute(Event event);
|
||||
};
|
||||
|
||||
class BwlChatShortcutAction : public Action
|
||||
{
|
||||
public:
|
||||
BwlChatShortcutAction(PlayerbotAI* ai) : Action(ai, "bwl chat shortcut") {}
|
||||
virtual bool Execute(Event event);
|
||||
public:
|
||||
BwlChatShortcutAction(PlayerbotAI* ai) : Action(ai, "bwl chat shortcut") {}
|
||||
virtual bool Execute(Event event);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CheatAction.h"
|
||||
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool CheatAction::Execute(Event event)
|
||||
@@ -36,7 +38,7 @@ bool CheatAction::Execute(Event event)
|
||||
|
||||
BotCheatMask CheatAction::GetCheatMask(std::string const cheat)
|
||||
{
|
||||
if (cheat=="taxi")
|
||||
if (cheat == "taxi")
|
||||
return BotCheatMask::taxi;
|
||||
|
||||
if (cheat == "gold")
|
||||
@@ -59,7 +61,7 @@ std::string const CheatAction::GetCheatName(BotCheatMask cheatMask)
|
||||
switch (cheatMask)
|
||||
{
|
||||
case BotCheatMask::taxi:
|
||||
return "taxi";
|
||||
return "taxi";
|
||||
case BotCheatMask::gold:
|
||||
return "gold";
|
||||
case BotCheatMask::health:
|
||||
@@ -80,9 +82,9 @@ void CheatAction::ListCheats()
|
||||
{
|
||||
BotCheatMask cheatMask = BotCheatMask(1 << i);
|
||||
if ((uint32)cheatMask & (uint32)sPlayerbotAIConfig->botCheatMask)
|
||||
out << "[conf:" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
out << "[conf:" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
else if (botAI->HasCheat(cheatMask))
|
||||
out << "[" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
out << "[" << GetCheatName(BotCheatMask(cheatMask)) << "]";
|
||||
}
|
||||
|
||||
botAI->TellMasterNoFacing(out);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "Action.h"
|
||||
@@ -10,13 +11,13 @@ enum class BotCheatMask : uint32;
|
||||
|
||||
class CheatAction : public Action
|
||||
{
|
||||
public:
|
||||
CheatAction(PlayerbotAI* botAI) : Action(botAI, "cheat") { }
|
||||
public:
|
||||
CheatAction(PlayerbotAI* botAI) : Action(botAI, "cheat") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
static BotCheatMask GetCheatMask(std::string const cheat);
|
||||
static std::string const GetCheatName(BotCheatMask cheatMask);
|
||||
void ListCheats();
|
||||
private:
|
||||
static BotCheatMask GetCheatMask(std::string const cheat);
|
||||
static std::string const GetCheatName(BotCheatMask cheatMask);
|
||||
void ListCheats();
|
||||
};
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CheckMailAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "GuildTaskMgr.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -74,7 +76,7 @@ void CheckMailAction::ProcessMail(Mail* mail, Player* owner, CharacterDatabaseTr
|
||||
|
||||
for (MailItemInfoVec::iterator i = mail->items.begin(); i != mail->items.end(); ++i)
|
||||
{
|
||||
Item *item = bot->GetMItem(i->item_guid);
|
||||
Item* item = bot->GetMItem(i->item_guid);
|
||||
if (!item)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHECKMAILACTION_H
|
||||
@@ -14,14 +15,14 @@ struct Mail;
|
||||
|
||||
class CheckMailAction : public Action
|
||||
{
|
||||
public:
|
||||
CheckMailAction(PlayerbotAI* botAI) : Action(botAI, "check mail") { }
|
||||
public:
|
||||
CheckMailAction(PlayerbotAI* botAI) : Action(botAI, "check mail") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
private:
|
||||
void ProcessMail(Mail* mail, Player* owner, CharacterDatabaseTransaction trans);
|
||||
private:
|
||||
void ProcessMail(Mail* mail, Player* owner, CharacterDatabaseTransaction trans);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CheckMountStateAction.h"
|
||||
|
||||
#include "BattlegroundWS.h"
|
||||
#include "Event.h"
|
||||
#include "PlayerbotAI.h"
|
||||
@@ -12,18 +14,23 @@
|
||||
|
||||
bool CheckMountStateAction::Execute(Event event)
|
||||
{
|
||||
bool noattackers = AI_VALUE2(bool, "combat", "self target") ? (AI_VALUE(uint8, "attacker count") > 0 ? false : true) : true;
|
||||
bool noattackers =
|
||||
AI_VALUE2(bool, "combat", "self target") ? (AI_VALUE(uint8, "attacker count") > 0 ? false : true) : true;
|
||||
bool enemy = AI_VALUE(Unit*, "enemy player target");
|
||||
// ignore grind target in BG or bots will dismount near any creature (eg: the rams in AV)
|
||||
bool dps = (AI_VALUE(Unit*, "dps target") || (!bot->InBattleground() && AI_VALUE(Unit*, "grind target")));
|
||||
bool fartarget = (enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 40.0f)) ||
|
||||
bool fartarget =
|
||||
(enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 40.0f)) ||
|
||||
(dps && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "dps target"), 50.0f));
|
||||
bool attackdistance = false;
|
||||
bool chasedistance = false;
|
||||
float attack_distance = 35.0f;
|
||||
if (PlayerbotAI::IsMelee(bot)) {
|
||||
if (PlayerbotAI::IsMelee(bot))
|
||||
{
|
||||
attack_distance = 10.0f;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
attack_distance = 40.0f;
|
||||
}
|
||||
if (enemy)
|
||||
@@ -31,11 +38,15 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
|
||||
if (dps || enemy)
|
||||
{
|
||||
attackdistance = (enemy || dps) && sServerFacade->IsDistanceLessThan(AI_VALUE2(float, "distance", "current target"), attack_distance);
|
||||
chasedistance = enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 45.0f) && AI_VALUE2(bool, "moving", "enemy player target");
|
||||
attackdistance = (enemy || dps) && sServerFacade->IsDistanceLessThan(
|
||||
AI_VALUE2(float, "distance", "current target"), attack_distance);
|
||||
chasedistance =
|
||||
enemy && sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "enemy player target"), 45.0f) &&
|
||||
AI_VALUE2(bool, "moving", "enemy player target");
|
||||
}
|
||||
|
||||
if (bot->IsMounted() && attackdistance) {
|
||||
if (bot->IsMounted() && attackdistance)
|
||||
{
|
||||
WorldPacket emptyPacket;
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
return true;
|
||||
@@ -48,7 +59,8 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
return false;
|
||||
|
||||
// bool farFromMaster = sServerFacade->GetDistance2d(bot, master) > sPlayerbotAIConfig->sightDistance;
|
||||
if (master->IsMounted() && !bot->IsMounted() && noattackers && !attackdistance && !bot->IsInCombat() && botAI->GetState() != BOT_STATE_COMBAT)
|
||||
if (master->IsMounted() && !bot->IsMounted() && noattackers && !attackdistance && !bot->IsInCombat() &&
|
||||
botAI->GetState() != BOT_STATE_COMBAT)
|
||||
{
|
||||
return Mount();
|
||||
}
|
||||
@@ -59,7 +71,8 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
bot->GetSession()->HandleCancelMountAuraOpcode(emptyPacket);
|
||||
return true;
|
||||
}
|
||||
// if (!bot->IsMounted() && (chasedistance || (farFromMaster && botAI->HasStrategy("follow", BOT_STATE_NON_COMBAT))) && !bot->IsInCombat() && !dps)
|
||||
// if (!bot->IsMounted() && (chasedistance || (farFromMaster && botAI->HasStrategy("follow",
|
||||
// BOT_STATE_NON_COMBAT))) && !bot->IsInCombat() && !dps)
|
||||
// return Mount();
|
||||
|
||||
// if (!bot->IsFlying() && ((!farFromMaster && !master->IsMounted()) || attackdistance) && bot->IsMounted())
|
||||
@@ -73,17 +86,20 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
}
|
||||
|
||||
// For random bots
|
||||
if (!bot->InBattleground() && !master) {
|
||||
if (!bot->IsMounted() && noattackers && !attackdistance && !bot->IsInCombat()) {
|
||||
if (!bot->InBattleground() && !master)
|
||||
{
|
||||
if (!bot->IsMounted() && noattackers && !attackdistance && !bot->IsInCombat())
|
||||
{
|
||||
return Mount();
|
||||
}
|
||||
}
|
||||
|
||||
if (bot->InBattleground() && !attackdistance && (noattackers || fartarget) && !bot->IsInCombat() && !bot->IsMounted())
|
||||
if (bot->InBattleground() && !attackdistance && (noattackers || fartarget) && !bot->IsInCombat() &&
|
||||
!bot->IsMounted())
|
||||
{
|
||||
if (bot->GetBattlegroundTypeId() == BATTLEGROUND_WS)
|
||||
{
|
||||
BattlegroundWS *bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground();
|
||||
BattlegroundWS* bg = (BattlegroundWS*)botAI->GetBot()->GetBattleground();
|
||||
if (bot->HasAura(23333) || bot->HasAura(23335))
|
||||
{
|
||||
return false;
|
||||
@@ -97,11 +113,13 @@ bool CheckMountStateAction::Execute(Event event)
|
||||
// {
|
||||
// if (AI_VALUE(GuidPosition, "rpg target"))
|
||||
// {
|
||||
// if (sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "rpg target"), sPlayerbotAIConfig->farDistance) && noattackers && !dps && !enemy)
|
||||
// if (sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "rpg target"),
|
||||
// sPlayerbotAIConfig->farDistance) && noattackers && !dps && !enemy)
|
||||
// return Mount();
|
||||
// }
|
||||
|
||||
// if (((!AI_VALUE(GuidVector, "possible rpg targets").empty()) && noattackers && !dps && !enemy) && urand(0, 100) > 50)
|
||||
// if (((!AI_VALUE(GuidVector, "possible rpg targets").empty()) && noattackers && !dps && !enemy) && urand(0,
|
||||
// 100) > 50)
|
||||
// return Mount();
|
||||
// }
|
||||
|
||||
@@ -175,8 +193,8 @@ bool CheckMountStateAction::Mount()
|
||||
// bot->GetMotionMaster()->MoveIdle();
|
||||
}
|
||||
|
||||
Player* master = GetMaster();
|
||||
botAI->RemoveShapeshift();
|
||||
Player* master = GetMaster();
|
||||
botAI->RemoveShapeshift();
|
||||
botAI->RemoveAura("tree of life");
|
||||
int32 masterSpeed = 59;
|
||||
SpellInfo const* masterSpell = nullptr;
|
||||
@@ -213,7 +231,7 @@ bool CheckMountStateAction::Mount()
|
||||
|
||||
bool hasSwiftMount = false;
|
||||
|
||||
//std::map<int32, std::vector<uint32> > spells;
|
||||
// std::map<int32, std::vector<uint32> > spells;
|
||||
std::map<uint32, std::map<int32, std::vector<uint32>>> allSpells;
|
||||
for (PlayerSpellMap::iterator itr = bot->GetSpellMap().begin(); itr != bot->GetSpellMap().end(); ++itr)
|
||||
{
|
||||
@@ -226,16 +244,20 @@ bool CheckMountStateAction::Mount()
|
||||
continue;
|
||||
|
||||
int32 effect = std::max(spellInfo->Effects[1].BasePoints, spellInfo->Effects[2].BasePoints);
|
||||
//if (effect < masterSpeed)
|
||||
//continue;
|
||||
// if (effect < masterSpeed)
|
||||
// continue;
|
||||
|
||||
uint32 index = (spellInfo->Effects[1].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED ||
|
||||
spellInfo->Effects[2].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) ? 1 : 0;
|
||||
spellInfo->Effects[2].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)
|
||||
? 1
|
||||
: 0;
|
||||
|
||||
if (index == 0 && std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) > 59)
|
||||
if (index == 0 &&
|
||||
std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) > 59)
|
||||
hasSwiftMount = true;
|
||||
|
||||
if (index == 1 && std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) > 149)
|
||||
if (index == 1 &&
|
||||
std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) > 149)
|
||||
hasSwiftMount = true;
|
||||
|
||||
allSpells[index][effect].push_back(spellId);
|
||||
@@ -245,7 +267,9 @@ bool CheckMountStateAction::Mount()
|
||||
if (masterSpell)
|
||||
{
|
||||
masterMountType = (masterSpell->Effects[1].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED ||
|
||||
masterSpell->Effects[2].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED) ? 1 : 0;
|
||||
masterSpell->Effects[2].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED)
|
||||
? 1
|
||||
: 0;
|
||||
}
|
||||
|
||||
std::map<int32, std::vector<uint32>>& spells = allSpells[masterMountType];
|
||||
@@ -260,10 +284,12 @@ bool CheckMountStateAction::Mount()
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
if (masterMountType == 0 && masterSpeed > 59 && std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) < 99)
|
||||
if (masterMountType == 0 && masterSpeed > 59 &&
|
||||
std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) < 99)
|
||||
spells[59].clear();
|
||||
|
||||
if (masterMountType == 1 && masterSpeed > 149 && std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) < 279)
|
||||
if (masterMountType == 1 && masterSpeed > 149 &&
|
||||
std::max(spellInfo->Effects[EFFECT_1].BasePoints, spellInfo->Effects[EFFECT_2].BasePoints) < 279)
|
||||
spells[149].clear();
|
||||
}
|
||||
}
|
||||
@@ -276,8 +302,8 @@ bool CheckMountStateAction::Mount()
|
||||
if (index >= ids.size())
|
||||
continue;
|
||||
|
||||
|
||||
return botAI->CastSpell(ids[index], bot);;
|
||||
return botAI->CastSpell(ids[index], bot);
|
||||
;
|
||||
}
|
||||
|
||||
std::vector<Item*> items = AI_VALUE2(std::vector<Item*>, "inventory items", "mount");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHECKMOUNTSTATEACTION_H
|
||||
@@ -11,13 +12,13 @@ class PlayerbotAI;
|
||||
|
||||
class CheckMountStateAction : public UseItemAction
|
||||
{
|
||||
public:
|
||||
CheckMountStateAction(PlayerbotAI* botAI) : UseItemAction(botAI, "check mount state", true) { }
|
||||
public:
|
||||
CheckMountStateAction(PlayerbotAI* botAI) : UseItemAction(botAI, "check mount state", true) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override { return true; }
|
||||
bool Mount();
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override { return true; }
|
||||
bool Mount();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CheckValuesAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values")
|
||||
{
|
||||
}
|
||||
CheckValuesAction::CheckValuesAction(PlayerbotAI* botAI) : Action(botAI, "check values") {}
|
||||
|
||||
bool CheckValuesAction::Execute(Event event)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHECKVALUESACTION_H
|
||||
@@ -11,10 +12,10 @@ class PlayerbotAI;
|
||||
|
||||
class CheckValuesAction : public Action
|
||||
{
|
||||
public:
|
||||
CheckValuesAction(PlayerbotAI* botAI);
|
||||
public:
|
||||
CheckValuesAction(PlayerbotAI* botAI);
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,18 +1,20 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChooseRpgTargetAction.h"
|
||||
|
||||
#include <random>
|
||||
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "BudgetValues.h"
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
#include "Formations.h"
|
||||
#include "GuildCreateActions.h"
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
#include <random>
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
|
||||
bool ChooseRpgTargetAction::HasSameTarget(ObjectGuid guid, uint32 max, GuidVector const& nearGuids)
|
||||
{
|
||||
@@ -117,7 +119,7 @@ bool ChooseRpgTargetAction::Execute(Event event)
|
||||
|
||||
if (urand(0, 9))
|
||||
{
|
||||
for (auto target : ignoreList)
|
||||
for (auto target : ignoreList)
|
||||
targets.erase(target);
|
||||
}
|
||||
|
||||
@@ -188,7 +190,8 @@ bool ChooseRpgTargetAction::Execute(Event event)
|
||||
|
||||
if (targets.empty())
|
||||
{
|
||||
LOG_DEBUG("playerbots", "{} can't choose RPG target: all {} are not available", bot->GetName().c_str(), possibleTargets.size());
|
||||
LOG_DEBUG("playerbots", "{} can't choose RPG target: all {} are not available", bot->GetName().c_str(),
|
||||
possibleTargets.size());
|
||||
RESET_AI_VALUE(GuidSet&, "ignore rpg target");
|
||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||
return false;
|
||||
@@ -280,7 +283,8 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
if (realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() && bot->GetMapId() == realMaster->GetMapId())
|
||||
inDungeon = true;
|
||||
|
||||
if (realMaster && realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() && (realMaster->GetMapId() != pos.getMapId()))
|
||||
if (realMaster && realMaster->IsInWorld() && realMaster->GetMap()->IsDungeon() &&
|
||||
(realMaster->GetMapId() != pos.getMapId()))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -299,7 +303,8 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
if (!botAI->HasActivePlayerMaster() && distance < 50.0f)
|
||||
{
|
||||
Player* player = master;
|
||||
if (!master->isMoving() || PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance)
|
||||
if (!master->isMoving() ||
|
||||
PAI_VALUE(WorldPosition, "last long move").distance(pos) < sPlayerbotAIConfig->reactDistance)
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -310,7 +315,7 @@ bool ChooseRpgTargetAction::isFollowValid(Player* bot, WorldPosition pos)
|
||||
return true;
|
||||
|
||||
if (distance < formation->GetMaxDistance())
|
||||
return true;
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHOOSERPGTARGETACTION_H
|
||||
@@ -16,27 +17,27 @@ class WorldPosition;
|
||||
|
||||
class ChooseRpgTargetAction : public Action
|
||||
{
|
||||
public:
|
||||
ChooseRpgTargetAction(PlayerbotAI* botAI, std::string const name = "choose rpg target") : Action(botAI, name) { }
|
||||
public:
|
||||
ChooseRpgTargetAction(PlayerbotAI* botAI, std::string const name = "choose rpg target") : Action(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
static bool isFollowValid(Player* bot, WorldObject* target);
|
||||
static bool isFollowValid(Player* bot, WorldPosition pos);
|
||||
static bool isFollowValid(Player* bot, WorldObject* target);
|
||||
static bool isFollowValid(Player* bot, WorldPosition pos);
|
||||
|
||||
private:
|
||||
float getMaxRelevance(GuidPosition guidP);
|
||||
bool HasSameTarget(ObjectGuid guid, uint32 max, GuidVector const& nearGuids);
|
||||
private:
|
||||
float getMaxRelevance(GuidPosition guidP);
|
||||
bool HasSameTarget(ObjectGuid guid, uint32 max, GuidVector const& nearGuids);
|
||||
};
|
||||
|
||||
class ClearRpgTargetAction : public ChooseRpgTargetAction
|
||||
{
|
||||
public:
|
||||
ClearRpgTargetAction(PlayerbotAI* botAI) : ChooseRpgTargetAction(botAI, "clear rpg target") { }
|
||||
public:
|
||||
ClearRpgTargetAction(PlayerbotAI* botAI) : ChooseRpgTargetAction(botAI, "clear rpg target") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChooseTargetActions.h"
|
||||
|
||||
#include "ChooseRpgTargetAction.h"
|
||||
#include "Event.h"
|
||||
#include "LootObjectStack.h"
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
#include "ServerFacade.h"
|
||||
|
||||
bool AttackEnemyPlayerAction::isUseful()
|
||||
@@ -22,19 +24,21 @@ bool AttackEnemyPlayerAction::isUseful()
|
||||
bool AttackEnemyFlagCarrierAction::isUseful()
|
||||
{
|
||||
Unit* target = context->GetValue<Unit*>("enemy flag carrier")->Get();
|
||||
return target && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target), 75.0f) && (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976));
|
||||
return target && sServerFacade->IsDistanceLessOrEqualThan(sServerFacade->GetDistance2d(bot, target), 75.0f) &&
|
||||
(bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976));
|
||||
}
|
||||
|
||||
bool AttackAnythingAction::isUseful()
|
||||
{
|
||||
if (!botAI->AllowActivity(GRIND_ACTIVITY)) //Bot not allowed to be active
|
||||
if (!botAI->AllowActivity(GRIND_ACTIVITY)) // Bot not allowed to be active
|
||||
return false;
|
||||
|
||||
if (!AI_VALUE(bool, "can move around"))
|
||||
return false;
|
||||
|
||||
if (context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling() &&
|
||||
ChooseRpgTargetAction::isFollowValid(bot, *context->GetValue<TravelTarget*>("travel target")->Get()->getPosition())) //Bot is traveling
|
||||
if (context->GetValue<TravelTarget*>("travel target")->Get()->isTraveling() &&
|
||||
ChooseRpgTargetAction::isFollowValid(
|
||||
bot, *context->GetValue<TravelTarget*>("travel target")->Get()->getPosition())) // Bot is traveling
|
||||
return false;
|
||||
// if (bot->IsInCombat()) {
|
||||
// return false;
|
||||
@@ -45,10 +49,11 @@ bool AttackAnythingAction::isUseful()
|
||||
return false;
|
||||
|
||||
std::string const name = std::string(target->GetName());
|
||||
if (!name.empty() && name.find("Dummy") != std::string::npos) // Target is not a targetdummy
|
||||
if (!name.empty() && name.find("Dummy") != std::string::npos) // Target is not a targetdummy
|
||||
return false;
|
||||
|
||||
// if (!ChooseRpgTargetAction::isFollowValid(bot, target)) //Do not grind mobs far away from master.
|
||||
// if (!ChooseRpgTargetAction::isFollowValid(bot, target)) //Do not grind mobs far
|
||||
// away from master.
|
||||
// return false;
|
||||
|
||||
return true;
|
||||
@@ -115,10 +120,7 @@ bool AttackAnythingAction::Execute(Event event)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool AttackAnythingAction::isPossible()
|
||||
{
|
||||
return AttackAction::isPossible() && GetTarget();
|
||||
}
|
||||
bool AttackAnythingAction::isPossible() { return AttackAction::isPossible() && GetTarget(); }
|
||||
|
||||
bool DpsAssistAction::isUseful()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHOOSETARGETACTIONS_H
|
||||
@@ -11,80 +12,80 @@ class PlayerbotAI;
|
||||
|
||||
class DpsAoeAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
DpsAoeAction(PlayerbotAI* botAI) : AttackAction(botAI, "dps aoe") { }
|
||||
public:
|
||||
DpsAoeAction(PlayerbotAI* botAI) : AttackAction(botAI, "dps aoe") {}
|
||||
|
||||
std::string const GetTargetName() override { return "dps aoe target"; }
|
||||
std::string const GetTargetName() override { return "dps aoe target"; }
|
||||
};
|
||||
|
||||
class DpsAssistAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
DpsAssistAction(PlayerbotAI* botAI) : AttackAction(botAI, "dps assist") { }
|
||||
public:
|
||||
DpsAssistAction(PlayerbotAI* botAI) : AttackAction(botAI, "dps assist") {}
|
||||
|
||||
std::string const GetTargetName() override { return "dps target"; }
|
||||
bool isUseful() override;
|
||||
std::string const GetTargetName() override { return "dps target"; }
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class TankAssistAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
TankAssistAction(PlayerbotAI* botAI) : AttackAction(botAI, "tank assist") { }
|
||||
public:
|
||||
TankAssistAction(PlayerbotAI* botAI) : AttackAction(botAI, "tank assist") {}
|
||||
|
||||
std::string const GetTargetName() override { return "tank target"; }
|
||||
std::string const GetTargetName() override { return "tank target"; }
|
||||
};
|
||||
|
||||
class AttackAnythingAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackAnythingAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack anything") { }
|
||||
public:
|
||||
AttackAnythingAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack anything") {}
|
||||
|
||||
std::string const GetTargetName() override { return "grind target"; }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
std::string const GetTargetName() override { return "grind target"; }
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool isPossible() override;
|
||||
};
|
||||
|
||||
class AttackLeastHpTargetAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackLeastHpTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack least hp target") { }
|
||||
public:
|
||||
AttackLeastHpTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack least hp target") {}
|
||||
|
||||
std::string const GetTargetName() override { return "least hp target"; }
|
||||
std::string const GetTargetName() override { return "least hp target"; }
|
||||
};
|
||||
|
||||
class AttackEnemyPlayerAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackEnemyPlayerAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack enemy player") { }
|
||||
public:
|
||||
AttackEnemyPlayerAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack enemy player") {}
|
||||
|
||||
std::string const GetTargetName() override { return "enemy player target"; }
|
||||
bool isUseful() override;
|
||||
std::string const GetTargetName() override { return "enemy player target"; }
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class AttackRtiTargetAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackRtiTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack rti target") { }
|
||||
public:
|
||||
AttackRtiTargetAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack rti target") {}
|
||||
|
||||
std::string const GetTargetName() override { return "rti target"; }
|
||||
std::string const GetTargetName() override { return "rti target"; }
|
||||
};
|
||||
|
||||
class AttackEnemyFlagCarrierAction : public AttackAction
|
||||
{
|
||||
public:
|
||||
AttackEnemyFlagCarrierAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack enemy flag carrier") { }
|
||||
public:
|
||||
AttackEnemyFlagCarrierAction(PlayerbotAI* botAI) : AttackAction(botAI, "attack enemy flag carrier") {}
|
||||
|
||||
std::string const GetTargetName() override { return "enemy flag carrier"; }
|
||||
bool isUseful() override;
|
||||
std::string const GetTargetName() override { return "enemy flag carrier"; }
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class DropTargetAction : public Action
|
||||
{
|
||||
public:
|
||||
DropTargetAction(PlayerbotAI* botAI) : Action(botAI, "drop target") { }
|
||||
public:
|
||||
DropTargetAction(PlayerbotAI* botAI) : Action(botAI, "drop target") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,97 +1,106 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "ChooseTravelTargetAction.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "LootObjectStack.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
bool ChooseTravelTargetAction::Execute(Event event)
|
||||
{
|
||||
//Get the current travel target. This target is no longer active.
|
||||
// Get the current travel target. This target is no longer active.
|
||||
TravelTarget* oldTarget = context->GetValue<TravelTarget*>("travel target")->Get();
|
||||
|
||||
//Select a new target to travel to.
|
||||
// Select a new target to travel to.
|
||||
TravelTarget newTarget = TravelTarget(botAI);
|
||||
getNewTarget(&newTarget, oldTarget);
|
||||
|
||||
//If the new target is not active we failed.
|
||||
// If the new target is not active we failed.
|
||||
if (!newTarget.isActive())
|
||||
return false;
|
||||
return false;
|
||||
|
||||
setNewTarget(&newTarget, oldTarget);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//Select a new travel target.
|
||||
//Currently this selectes mostly based on priority (current quest > new quest).
|
||||
//This works fine because destinations can be full (max 15 bots per quest giver, max 1 bot per quest mob).
|
||||
// Select a new travel target.
|
||||
// Currently this selectes mostly based on priority (current quest > new quest).
|
||||
// This works fine because destinations can be full (max 15 bots per quest giver, max 1 bot per quest mob).
|
||||
//
|
||||
//Eventually we want to rewrite this to be more intelligent.
|
||||
// Eventually we want to rewrite this to be more intelligent.
|
||||
void ChooseTravelTargetAction::getNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
|
||||
{
|
||||
bool foundTarget = false;
|
||||
|
||||
foundTarget = SetGroupTarget(newTarget); //Join groups members
|
||||
foundTarget = SetGroupTarget(newTarget); // Join groups members
|
||||
|
||||
//Enpty bags/repair
|
||||
if (!foundTarget && urand(1, 100) > 10) //90% chance
|
||||
if (AI_VALUE2(bool, "group or", "should sell,can sell,following party,near leader") || AI_VALUE2(bool, "group or", "should repair,can repair,following party,near leader"))
|
||||
foundTarget = SetRpgTarget(newTarget); //Go to town to sell items or repair
|
||||
// Enpty bags/repair
|
||||
if (!foundTarget && urand(1, 100) > 10) // 90% chance
|
||||
if (AI_VALUE2(bool, "group or", "should sell,can sell,following party,near leader") ||
|
||||
AI_VALUE2(bool, "group or", "should repair,can repair,following party,near leader"))
|
||||
foundTarget = SetRpgTarget(newTarget); // Go to town to sell items or repair
|
||||
|
||||
//Rpg in city
|
||||
if (!foundTarget && urand(1, 100) > 90) //10% chance
|
||||
foundTarget = SetNpcFlagTarget(newTarget, { UNIT_NPC_FLAG_BANKER,UNIT_NPC_FLAG_BATTLEMASTER,UNIT_NPC_FLAG_AUCTIONEER });
|
||||
// Rpg in city
|
||||
if (!foundTarget && urand(1, 100) > 90) // 10% chance
|
||||
foundTarget =
|
||||
SetNpcFlagTarget(newTarget, {UNIT_NPC_FLAG_BANKER, UNIT_NPC_FLAG_BATTLEMASTER, UNIT_NPC_FLAG_AUCTIONEER});
|
||||
|
||||
//Grind for money
|
||||
if (!foundTarget && AI_VALUE(bool, "should get money")) {
|
||||
// Grind for money
|
||||
if (!foundTarget && AI_VALUE(bool, "should get money"))
|
||||
{
|
||||
if (urand(1, 100) > 66)
|
||||
{
|
||||
foundTarget = SetQuestTarget(newTarget, true); //Turn in quests for money.
|
||||
foundTarget = SetQuestTarget(newTarget, true); // Turn in quests for money.
|
||||
|
||||
if (!foundTarget)
|
||||
foundTarget = SetQuestTarget(newTarget); //Do low level quests
|
||||
} else if (urand(1, 100) > 50) {
|
||||
foundTarget = SetGrindTarget(newTarget); //Go grind mobs for money
|
||||
} else {
|
||||
foundTarget = SetNewQuestTarget(newTarget); //Find a low level quest to do
|
||||
foundTarget = SetQuestTarget(newTarget); // Do low level quests
|
||||
}
|
||||
else if (urand(1, 100) > 50)
|
||||
{
|
||||
foundTarget = SetGrindTarget(newTarget); // Go grind mobs for money
|
||||
}
|
||||
else
|
||||
{
|
||||
foundTarget = SetNewQuestTarget(newTarget); // Find a low level quest to do
|
||||
}
|
||||
}
|
||||
|
||||
//Continue
|
||||
if (!foundTarget && urand(1, 100) > 10) //90% chance
|
||||
foundTarget = SetCurrentTarget(newTarget, oldTarget); //Extend current target.
|
||||
// Continue
|
||||
if (!foundTarget && urand(1, 100) > 10) // 90% chance
|
||||
foundTarget = SetCurrentTarget(newTarget, oldTarget); // Extend current target.
|
||||
|
||||
//Dungeon in group
|
||||
if (!foundTarget && urand(1, 100) > 50) //50% chance
|
||||
// Dungeon in group
|
||||
if (!foundTarget && urand(1, 100) > 50) // 50% chance
|
||||
if (AI_VALUE(bool, "can fight boss"))
|
||||
foundTarget = SetBossTarget(newTarget); //Go fight a (dungeon boss)
|
||||
foundTarget = SetBossTarget(newTarget); // Go fight a (dungeon boss)
|
||||
|
||||
if (!foundTarget && urand(1, 100) > 5) //95% chance
|
||||
foundTarget = SetQuestTarget(newTarget); //Do a target of an active quest.
|
||||
if (!foundTarget && urand(1, 100) > 5) // 95% chance
|
||||
foundTarget = SetQuestTarget(newTarget); // Do a target of an active quest.
|
||||
|
||||
if (!foundTarget && urand(1, 100) > 5)
|
||||
foundTarget = SetNewQuestTarget(newTarget); //Find a new quest to do.
|
||||
foundTarget = SetNewQuestTarget(newTarget); // Find a new quest to do.
|
||||
|
||||
if (!foundTarget && botAI->HasStrategy("explore", BOT_STATE_NON_COMBAT)) //Explore a unexplored sub-zone.
|
||||
if (!foundTarget && botAI->HasStrategy("explore", BOT_STATE_NON_COMBAT)) // Explore a unexplored sub-zone.
|
||||
foundTarget = SetExploreTarget(newTarget);
|
||||
|
||||
// if (!foundTarget)
|
||||
//foundTarget = SetRpgTarget(target);
|
||||
// foundTarget = SetRpgTarget(target);
|
||||
|
||||
if (!foundTarget)
|
||||
SetNullTarget(newTarget); //Idle a bit.
|
||||
SetNullTarget(newTarget); // Idle a bit.
|
||||
}
|
||||
|
||||
void ChooseTravelTargetAction::setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
|
||||
{
|
||||
//Tell the master where we are going.
|
||||
// Tell the master where we are going.
|
||||
if (!bot->GetGroup() || (botAI->GetGroupMaster() == bot))
|
||||
ReportTravelTarget(newTarget, oldTarget);
|
||||
|
||||
//If we are heading to a creature/npc clear it from the ignore list.
|
||||
// If we are heading to a creature/npc clear it from the ignore list.
|
||||
if (oldTarget && oldTarget == newTarget && newTarget->getEntry())
|
||||
{
|
||||
GuidSet& ignoreList = context->GetValue<GuidSet&>("ignore rpg target")->Get();
|
||||
@@ -107,22 +116,23 @@ void ChooseTravelTargetAction::setNewTarget(TravelTarget* newTarget, TravelTarge
|
||||
context->GetValue<GuidSet&>("ignore rpg target")->Set(ignoreList);
|
||||
}
|
||||
|
||||
//Actually apply the new target to the travel target used by the bot.
|
||||
// Actually apply the new target to the travel target used by the bot.
|
||||
oldTarget->copyTarget(newTarget);
|
||||
|
||||
//If we are idling but have a master. Idle only 10 seconds.
|
||||
if (botAI->GetMaster() && oldTarget->isActive() && oldTarget->getDestination()->getName() == "NullTravelDestination")
|
||||
// If we are idling but have a master. Idle only 10 seconds.
|
||||
if (botAI->GetMaster() && oldTarget->isActive() &&
|
||||
oldTarget->getDestination()->getName() == "NullTravelDestination")
|
||||
oldTarget->setExpireIn(10 * IN_MILLISECONDS);
|
||||
else if (oldTarget->isForced()) // Make sure travel goes into cooldown after getting to the destination.
|
||||
else if (oldTarget->isForced()) // Make sure travel goes into cooldown after getting to the destination.
|
||||
oldTarget->setExpireIn(HOUR * IN_MILLISECONDS);
|
||||
|
||||
//Clear rpg and pull/grind target. We want to travel, not hang around some more.
|
||||
// Clear rpg and pull/grind target. We want to travel, not hang around some more.
|
||||
RESET_AI_VALUE(GuidPosition, "rpg target");
|
||||
RESET_AI_VALUE(ObjectGuid, "pull target");
|
||||
}
|
||||
|
||||
//Tell the master what travel target we are moving towards.
|
||||
//This should at some point be rewritten to be denser or perhaps logic moved to ->getTitle()
|
||||
// Tell the master what travel target we are moving towards.
|
||||
// This should at some point be rewritten to be denser or perhaps logic moved to ->getTitle()
|
||||
void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, TravelTarget* oldTarget)
|
||||
{
|
||||
TravelDestination* destination = newTarget->getDestination();
|
||||
@@ -133,7 +143,8 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave
|
||||
if (newTarget->isForced())
|
||||
out << "(Forced) ";
|
||||
|
||||
if (destination->getName() == "QuestRelationTravelDestination" || destination->getName() == "QuestObjectiveTravelDestination")
|
||||
if (destination->getName() == "QuestRelationTravelDestination" ||
|
||||
destination->getName() == "QuestObjectiveTravelDestination")
|
||||
{
|
||||
QuestTravelDestination* QuestDestination = (QuestTravelDestination*)destination;
|
||||
Quest const* quest = QuestDestination->GetQuestTemplate();
|
||||
@@ -179,7 +190,7 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave
|
||||
|
||||
out << round(newTarget->getDestination()->distanceTo(&botLocation)) << "y";
|
||||
|
||||
out << " for ";
|
||||
out << " for ";
|
||||
|
||||
if (AI_VALUE2(bool, "group or", "should sell,can sell"))
|
||||
out << "selling items";
|
||||
@@ -264,20 +275,22 @@ void ChooseTravelTargetAction::ReportTravelTarget(TravelTarget* newTarget, Trave
|
||||
}
|
||||
}
|
||||
|
||||
bool ChooseTravelTargetAction::getBestDestination(std::vector<TravelDestination*>* activeDestinations, std::vector<WorldPosition*>* activePoints)
|
||||
bool ChooseTravelTargetAction::getBestDestination(std::vector<TravelDestination*>* activeDestinations,
|
||||
std::vector<WorldPosition*>* activePoints)
|
||||
{
|
||||
if (activeDestinations->empty() || activePoints->empty()) //No targets or no points.
|
||||
if (activeDestinations->empty() || activePoints->empty()) // No targets or no points.
|
||||
return false;
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
std::vector<WorldPosition*> availablePoints = sTravelMgr->getNextPoint(&botLocation, *activePoints); //Pick a good point.
|
||||
std::vector<WorldPosition*> availablePoints =
|
||||
sTravelMgr->getNextPoint(&botLocation, *activePoints); // Pick a good point.
|
||||
|
||||
if (availablePoints.empty()) //No points available.
|
||||
if (availablePoints.empty()) // No points available.
|
||||
return false;
|
||||
|
||||
TravelDestination* targetDestination;
|
||||
|
||||
for (auto activeTarget : *activeDestinations) //Pick the destination that has this point.
|
||||
for (auto activeTarget : *activeDestinations) // Pick the destination that has this point.
|
||||
if (activeTarget->distanceTo(availablePoints.front()) == 0)
|
||||
targetDestination = activeTarget;
|
||||
|
||||
@@ -319,7 +332,7 @@ bool ChooseTravelTargetAction::SetGroupTarget(TravelTarget* target)
|
||||
}
|
||||
}
|
||||
|
||||
//Find targets of the group.
|
||||
// Find targets of the group.
|
||||
for (auto& member : groupPlayers)
|
||||
{
|
||||
Player* player = ObjectAccessor::FindPlayer(member);
|
||||
@@ -341,7 +354,8 @@ bool ChooseTravelTargetAction::SetGroupTarget(TravelTarget* target)
|
||||
if (!groupTarget->isActive())
|
||||
continue;
|
||||
|
||||
if (!groupTarget->getDestination()->isActive(bot) || groupTarget->getDestination()->getName() == "RpgTravelDestination")
|
||||
if (!groupTarget->getDestination()->isActive(bot) ||
|
||||
groupTarget->getDestination()->getName() == "RpgTravelDestination")
|
||||
continue;
|
||||
|
||||
activeDestinations.push_back(groupTarget->getDestination());
|
||||
@@ -363,10 +377,10 @@ bool ChooseTravelTargetAction::SetCurrentTarget(TravelTarget* target, TravelTarg
|
||||
if (oldTarget->isMaxRetry(false))
|
||||
return false;
|
||||
|
||||
if (!oldDestination) //Does this target have a destination?
|
||||
if (!oldDestination) // Does this target have a destination?
|
||||
return false;
|
||||
|
||||
if (!oldDestination->isActive(bot)) //Is the destination still valid?
|
||||
if (!oldDestination->isActive(bot)) // Is the destination still valid?
|
||||
return false;
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
@@ -390,7 +404,7 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find destinations related to the active quests.
|
||||
// Find destinations related to the active quests.
|
||||
for (auto& quest : questMap)
|
||||
{
|
||||
if (bot->IsQuestRewarded(quest.first))
|
||||
@@ -399,10 +413,12 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
||||
uint32 questId = quest.first;
|
||||
QuestStatusData* questStatus = &quest.second;
|
||||
|
||||
if (onlyCompleted && sObjectMgr->GetQuestTemplate(questId) && !bot->CanRewardQuest(sObjectMgr->GetQuestTemplate(questId), false))
|
||||
if (onlyCompleted && sObjectMgr->GetQuestTemplate(questId) &&
|
||||
!bot->CanRewardQuest(sObjectMgr->GetQuestTemplate(questId), false))
|
||||
continue;
|
||||
|
||||
std::vector<TravelDestination*> questDestinations = sTravelMgr->getQuestTravelDestinations(bot, questId, botAI->HasRealPlayerMaster(), false, 5000);
|
||||
std::vector<TravelDestination*> questDestinations =
|
||||
sTravelMgr->getQuestTravelDestinations(bot, questId, botAI->HasRealPlayerMaster(), false, 5000);
|
||||
std::vector<WorldPosition*> questPoints;
|
||||
|
||||
for (auto& questDestination : questDestinations)
|
||||
@@ -417,7 +433,6 @@ bool ChooseTravelTargetAction::SetQuestTarget(TravelTarget* target, bool onlyCom
|
||||
activeDestinations.push_back(questDestinations.front());
|
||||
activePoints.push_back(questPoints.front());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!getBestDestination(&activeDestinations, &activePoints))
|
||||
@@ -435,12 +450,13 @@ bool ChooseTravelTargetAction::SetNewQuestTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find quest givers.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getQuestTravelDestinations(bot, -1, botAI->HasRealPlayerMaster());
|
||||
// Find quest givers.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getQuestTravelDestinations(bot, -1, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
//Pick one good point per destination.
|
||||
// Pick one good point per destination.
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
std::vector<WorldPosition*> points = activeTarget->nextPoint(&botLocation);
|
||||
@@ -463,12 +479,13 @@ bool ChooseTravelTargetAction::SetRpgTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find rpg npcs
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getRpgTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
// Find rpg npcs
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getRpgTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
//Pick one good point per destination.
|
||||
// Pick one good point per destination.
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
std::vector<WorldPosition*> points = activeTarget->nextPoint(&botLocation);
|
||||
@@ -491,12 +508,13 @@ bool ChooseTravelTargetAction::SetGrindTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find grind mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getGrindTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
// Find grind mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getGrindTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
//Pick one good point per destination.
|
||||
// Pick one good point per destination.
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
std::vector<WorldPosition*> points = activeTarget->nextPoint(&botLocation);
|
||||
@@ -519,12 +537,13 @@ bool ChooseTravelTargetAction::SetBossTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find boss mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getBossTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
// Find boss mobs.
|
||||
std::vector<TravelDestination*> TravelDestinations =
|
||||
sTravelMgr->getBossTravelDestinations(bot, botAI->HasRealPlayerMaster());
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
|
||||
//Pick one good point per destination.
|
||||
// Pick one good point per destination.
|
||||
for (auto& activeTarget : activeDestinations)
|
||||
{
|
||||
std::vector<WorldPosition*> points = activeTarget->nextPoint(&botLocation);
|
||||
@@ -547,7 +566,7 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
||||
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
//Find quest givers.
|
||||
// Find quest givers.
|
||||
std::vector<TravelDestination*> TravelDestinations = sTravelMgr->getExploreTravelDestinations(bot, true, true);
|
||||
|
||||
activeDestinations.insert(activeDestinations.end(), TravelDestinations.begin(), TravelDestinations.end());
|
||||
@@ -589,7 +608,8 @@ bool ChooseTravelTargetAction::SetExploreTarget(TravelTarget* target)
|
||||
|
||||
char* strstri(char const* haystack, char const* needle);
|
||||
|
||||
bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vector<NPCFlags> flags, std::string const name, std::vector<uint32> items)
|
||||
bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vector<NPCFlags> flags,
|
||||
std::string const name, std::vector<uint32> items)
|
||||
{
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
@@ -615,7 +635,8 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vecto
|
||||
if (!foundFlag)
|
||||
continue;
|
||||
|
||||
if (!name.empty() && !strstri(cInfo->Name.c_str(), name.c_str()) && !strstri(cInfo->SubName.c_str(), name.c_str()))
|
||||
if (!name.empty() && !strstri(cInfo->Name.c_str(), name.c_str()) &&
|
||||
!strstri(cInfo->SubName.c_str(), name.c_str()))
|
||||
continue;
|
||||
|
||||
if (!items.empty())
|
||||
@@ -652,10 +673,11 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vecto
|
||||
|
||||
if (!dests.empty())
|
||||
{
|
||||
TravelDestination* dest = *std::min_element(dests.begin(), dests.end(), [botPos](TravelDestination* i, TravelDestination* j)
|
||||
{
|
||||
return i->distanceTo(const_cast<WorldPosition*>(&botPos)) < j->distanceTo(const_cast<WorldPosition*>(&botPos));
|
||||
});
|
||||
TravelDestination* dest = *std::min_element(dests.begin(), dests.end(),
|
||||
[botPos](TravelDestination* i, TravelDestination* j) {
|
||||
return i->distanceTo(const_cast<WorldPosition*>(&botPos)) <
|
||||
j->distanceTo(const_cast<WorldPosition*>(&botPos));
|
||||
});
|
||||
|
||||
std::vector<WorldPosition*> points = dest->nextPoint(const_cast<WorldPosition*>(&botPos), true);
|
||||
if (points.empty())
|
||||
@@ -670,7 +692,8 @@ bool ChooseTravelTargetAction::SetNpcFlagTarget(TravelTarget* target, std::vecto
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<TravelDestination*> TravelMgr::getBossTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive, float maxDistance)
|
||||
std::vector<TravelDestination*> TravelMgr::getBossTravelDestinations(Player* bot, bool ignoreFull, bool ignoreInactive,
|
||||
float maxDistance)
|
||||
{
|
||||
WorldPosition botLocation(bot);
|
||||
|
||||
@@ -711,28 +734,28 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
||||
|
||||
std::vector<TravelDestination*> dests;
|
||||
|
||||
//Zones
|
||||
// Zones
|
||||
for (auto& d : sTravelMgr->getExploreTravelDestinations(bot, true, true))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
dests.push_back(d);
|
||||
}
|
||||
|
||||
//Npcs
|
||||
// Npcs
|
||||
for (auto& d : sTravelMgr->getRpgTravelDestinations(bot, true, true))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
dests.push_back(d);
|
||||
}
|
||||
|
||||
//Mobs
|
||||
// Mobs
|
||||
for (auto& d : sTravelMgr->getGrindTravelDestinations(bot, true, true))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
dests.push_back(d);
|
||||
}
|
||||
|
||||
//Bosses
|
||||
// Bosses
|
||||
for (auto& d : sTravelMgr->getBossTravelDestinations(bot, true, true))
|
||||
{
|
||||
if (strstri(d->getTitle().c_str(), name.c_str()))
|
||||
@@ -744,10 +767,11 @@ TravelDestination* ChooseTravelTargetAction::FindDestination(Player* bot, std::s
|
||||
if (dests.empty())
|
||||
return nullptr;
|
||||
|
||||
TravelDestination* dest = *std::min_element(dests.begin(), dests.end(), [botPos](TravelDestination* i, TravelDestination* j)
|
||||
{
|
||||
return i->distanceTo(const_cast<WorldPosition*>(&botPos)) < j->distanceTo(const_cast<WorldPosition*>(&botPos));
|
||||
});
|
||||
TravelDestination* dest = *std::min_element(dests.begin(), dests.end(),
|
||||
[botPos](TravelDestination* i, TravelDestination* j) {
|
||||
return i->distanceTo(const_cast<WorldPosition*>(&botPos)) <
|
||||
j->distanceTo(const_cast<WorldPosition*>(&botPos));
|
||||
});
|
||||
|
||||
return dest;
|
||||
};
|
||||
@@ -757,7 +781,8 @@ bool ChooseTravelTargetAction::isUseful()
|
||||
if (!botAI->AllowActivity(TRAVEL_ACTIVITY))
|
||||
return false;
|
||||
|
||||
return !context->GetValue<TravelTarget*>("travel target")->Get()->isActive() && !context->GetValue<LootObject>("loot target")->Get().IsLootPossible(bot) && !bot->IsInCombat();
|
||||
return !context->GetValue<TravelTarget*>("travel target")->Get()->isActive() &&
|
||||
!context->GetValue<LootObject>("loot target")->Get().IsLootPossible(bot) && !bot->IsInCombat();
|
||||
}
|
||||
|
||||
bool ChooseTravelTargetAction::needForQuest(Unit* target)
|
||||
@@ -801,7 +826,7 @@ bool ChooseTravelTargetAction::needForQuest(Unit* target)
|
||||
int required = questTemplate->RequiredNpcOrGoCount[j];
|
||||
int available = questStatus.CreatureOrGOCount[j];
|
||||
|
||||
if(required && available < required && (target->GetEntry() == entry || justCheck))
|
||||
if (required && available < required && (target->GetEntry() == entry || justCheck))
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -832,12 +857,12 @@ bool ChooseTravelTargetAction::needForQuest(Unit* target)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChooseTravelTargetAction::needItemForQuest(uint32 itemId, const Quest* questTemplate, const QuestStatusData* questStatus)
|
||||
bool ChooseTravelTargetAction::needItemForQuest(uint32 itemId, const Quest* questTemplate,
|
||||
const QuestStatusData* questStatus)
|
||||
{
|
||||
for (uint32 i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CHOOSETRAVELTARGETACTION_H
|
||||
@@ -16,35 +17,40 @@ struct QuestStatusData;
|
||||
|
||||
class ChooseTravelTargetAction : public MovementAction
|
||||
{
|
||||
public:
|
||||
ChooseTravelTargetAction(PlayerbotAI* botAI, std::string const name = "choose travel target") : MovementAction(botAI, name) { }
|
||||
public:
|
||||
ChooseTravelTargetAction(PlayerbotAI* botAI, std::string const name = "choose travel target")
|
||||
: MovementAction(botAI, name)
|
||||
{
|
||||
}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
|
||||
static TravelDestination* FindDestination(Player* bot, std::string const name);
|
||||
static TravelDestination* FindDestination(Player* bot, std::string const name);
|
||||
|
||||
protected:
|
||||
void getNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
void setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
void ReportTravelTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
protected:
|
||||
void getNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
void setNewTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
void ReportTravelTarget(TravelTarget* newTarget, TravelTarget* oldTarget);
|
||||
|
||||
bool getBestDestination(std::vector<TravelDestination*>* activeDestinations, std::vector<WorldPosition*>* activePoints);
|
||||
bool getBestDestination(std::vector<TravelDestination*>* activeDestinations,
|
||||
std::vector<WorldPosition*>* activePoints);
|
||||
|
||||
bool SetGroupTarget(TravelTarget* target);
|
||||
bool SetCurrentTarget(TravelTarget* target, TravelTarget* oldTarget);
|
||||
bool SetQuestTarget(TravelTarget* target, bool onlyCompleted = false);
|
||||
bool SetNewQuestTarget(TravelTarget* target);
|
||||
bool SetRpgTarget(TravelTarget* target);
|
||||
bool SetGrindTarget(TravelTarget* target);
|
||||
bool SetBossTarget(TravelTarget* target);
|
||||
bool SetExploreTarget(TravelTarget* target);
|
||||
bool SetNpcFlagTarget(TravelTarget* target, std::vector<NPCFlags> flags, std::string const name = "", std::vector<uint32> items = { });
|
||||
bool SetNullTarget(TravelTarget* target);
|
||||
bool SetGroupTarget(TravelTarget* target);
|
||||
bool SetCurrentTarget(TravelTarget* target, TravelTarget* oldTarget);
|
||||
bool SetQuestTarget(TravelTarget* target, bool onlyCompleted = false);
|
||||
bool SetNewQuestTarget(TravelTarget* target);
|
||||
bool SetRpgTarget(TravelTarget* target);
|
||||
bool SetGrindTarget(TravelTarget* target);
|
||||
bool SetBossTarget(TravelTarget* target);
|
||||
bool SetExploreTarget(TravelTarget* target);
|
||||
bool SetNpcFlagTarget(TravelTarget* target, std::vector<NPCFlags> flags, std::string const name = "",
|
||||
std::vector<uint32> items = {});
|
||||
bool SetNullTarget(TravelTarget* target);
|
||||
|
||||
private:
|
||||
virtual bool needForQuest(Unit* target);
|
||||
virtual bool needItemForQuest(uint32 itemId, Quest const* questTemplate, QuestStatusData const* questStatus);
|
||||
private:
|
||||
virtual bool needForQuest(Unit* target);
|
||||
virtual bool needItemForQuest(uint32 itemId, Quest const* questTemplate, QuestStatusData const* questStatus);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CombatActions.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "LastMovementValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -10,7 +12,7 @@
|
||||
|
||||
bool SwitchToMeleeAction::Execute(Event event)
|
||||
{
|
||||
//botAI->TellMasterNoFacing("Switching to melee!");
|
||||
// botAI->TellMasterNoFacing("Switching to melee!");
|
||||
return ChangeCombatStrategyAction::Execute(event);
|
||||
}
|
||||
|
||||
@@ -20,8 +22,11 @@ bool SwitchToMeleeAction::isUseful()
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
time_t lastFlee = AI_VALUE(LastMovement&, "last movement").lastFlee;
|
||||
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT) && ((bot->IsInCombat() && target && (target->GetVictim() == bot && (!bot->GetGroup() || lastFlee) &&
|
||||
sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) || (!bot->IsInCombat()));
|
||||
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT) &&
|
||||
((bot->IsInCombat() && target &&
|
||||
(target->GetVictim() == bot && (!bot->GetGroup() || lastFlee) &&
|
||||
sServerFacade->IsDistanceLessOrEqualThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) ||
|
||||
(!bot->IsInCombat()));
|
||||
}
|
||||
|
||||
return botAI->HasStrategy("ranged", BOT_STATE_COMBAT);
|
||||
@@ -29,7 +34,7 @@ bool SwitchToMeleeAction::isUseful()
|
||||
|
||||
bool SwitchToRangedAction::Execute(Event event)
|
||||
{
|
||||
//botAI->TellMasterNoFacing("Switching to ranged!");
|
||||
// botAI->TellMasterNoFacing("Switching to ranged!");
|
||||
return ChangeCombatStrategyAction::Execute(event);
|
||||
}
|
||||
|
||||
@@ -39,8 +44,11 @@ bool SwitchToRangedAction::isUseful()
|
||||
{
|
||||
Unit* target = AI_VALUE(Unit*, "current target");
|
||||
bool hasAmmo = AI_VALUE2(uint32, "item count", "ammo");
|
||||
return botAI->HasStrategy("close", BOT_STATE_COMBAT) && hasAmmo && ((bot->IsInCombat() && target && ((target->GetVictim() != bot || target->GetTarget() != bot->GetGUID()) ||
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) || (!bot->IsInCombat()));
|
||||
return botAI->HasStrategy("close", BOT_STATE_COMBAT) && hasAmmo &&
|
||||
((bot->IsInCombat() && target &&
|
||||
((target->GetVictim() != bot || target->GetTarget() != bot->GetGUID()) ||
|
||||
sServerFacade->IsDistanceGreaterThan(AI_VALUE2(float, "distance", "current target"), 8.0f))) ||
|
||||
(!bot->IsInCombat()));
|
||||
}
|
||||
|
||||
return botAI->HasStrategy("close", BOT_STATE_COMBAT);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_COMBATACTIONS_H
|
||||
@@ -11,20 +12,20 @@ class PlayerbotAI;
|
||||
|
||||
class SwitchToMeleeAction : public ChangeCombatStrategyAction
|
||||
{
|
||||
public:
|
||||
SwitchToMeleeAction(PlayerbotAI* botAI) : ChangeCombatStrategyAction(botAI, "-ranged,+close") { }
|
||||
public:
|
||||
SwitchToMeleeAction(PlayerbotAI* botAI) : ChangeCombatStrategyAction(botAI, "-ranged,+close") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
class SwitchToRangedAction : public ChangeCombatStrategyAction
|
||||
{
|
||||
public:
|
||||
SwitchToRangedAction(PlayerbotAI* botAI) : ChangeCombatStrategyAction(botAI, "-close,+ranged") { }
|
||||
public:
|
||||
SwitchToRangedAction(PlayerbotAI* botAI) : ChangeCombatStrategyAction(botAI, "-close,+ranged") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "CustomStrategyEditAction.h"
|
||||
|
||||
#include "CustomStrategy.h"
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -33,7 +35,8 @@ bool CustomStrategyEditAction::PrintHelp()
|
||||
|
||||
uint32 owner = botAI->GetBot()->GetGUID().GetCounter();
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER);
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER);
|
||||
stmt->SetData(0, owner);
|
||||
if (PreparedQueryResult result = PlayerbotsDatabase.Query(stmt))
|
||||
{
|
||||
@@ -42,8 +45,7 @@ bool CustomStrategyEditAction::PrintHelp()
|
||||
Field* fields = result->Fetch();
|
||||
std::string const name = fields[0].Get<std::string>();
|
||||
botAI->TellMaster(name);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
botAI->TellMaster("Usage: cs <name> <idx> <command>");
|
||||
@@ -58,7 +60,8 @@ bool CustomStrategyEditAction::Print(std::string const name)
|
||||
|
||||
uint32 owner = botAI->GetBot()->GetGUID().GetCounter();
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME);
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME);
|
||||
stmt->SetData(0, owner);
|
||||
stmt->SetData(1, name);
|
||||
if (PreparedQueryResult result = PlayerbotsDatabase.Query(stmt))
|
||||
@@ -70,8 +73,7 @@ bool CustomStrategyEditAction::Print(std::string const name)
|
||||
std::string const action = fields[1].Get<std::string>();
|
||||
|
||||
PrintActionLine(idx, action);
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -81,7 +83,8 @@ bool CustomStrategyEditAction::Edit(std::string const name, uint32 idx, std::str
|
||||
{
|
||||
uint32 owner = botAI->GetBot()->GetGUID().GetCounter();
|
||||
|
||||
PlayerbotsDatabasePreparedStatement* stmt = PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME_AND_IDX);
|
||||
PlayerbotsDatabasePreparedStatement* stmt =
|
||||
PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_SEL_CUSTOM_STRATEGY_BY_OWNER_AND_NAME_AND_IDX);
|
||||
stmt->SetData(0, owner);
|
||||
stmt->SetData(1, name);
|
||||
stmt->SetData(2, idx);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_CUSTOMSTRATEGYEDITACTION_H
|
||||
@@ -11,16 +12,16 @@ class PlayerbotAI;
|
||||
|
||||
class CustomStrategyEditAction : public Action
|
||||
{
|
||||
public:
|
||||
CustomStrategyEditAction(PlayerbotAI* botAI) : Action(botAI, "cs") { }
|
||||
public:
|
||||
CustomStrategyEditAction(PlayerbotAI* botAI) : Action(botAI, "cs") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
private:
|
||||
bool PrintHelp();
|
||||
bool PrintActionLine(uint32 idx, std::string const command);
|
||||
bool Print(std::string const name);
|
||||
bool Edit(std::string const name, uint32 idx, std::string const command);
|
||||
private:
|
||||
bool PrintHelp();
|
||||
bool PrintActionLine(uint32 idx, std::string const command);
|
||||
bool Print(std::string const name);
|
||||
bool Edit(std::string const name, uint32 idx, std::string const command);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "DebugAction.h"
|
||||
|
||||
#include "ChooseTravelTargetAction.h"
|
||||
#include "MapMgr.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -26,7 +28,8 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
uint32 areaId = 0;
|
||||
uint32 zoneId = 0;
|
||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(), pos.getZ());
|
||||
sMapMgr->GetZoneAndAreaId(PHASEMASK_NORMAL, zoneId, areaId, pos.getMapId(), pos.getX(), pos.getY(),
|
||||
pos.getZ());
|
||||
|
||||
std::ostringstream out;
|
||||
out << zoneId << "," << areaId << "," << (pos.getAreaName().empty() ? "none" : pos.getAreaName()) << ",";
|
||||
@@ -71,7 +74,8 @@ bool DebugAction::Execute(Event event)
|
||||
std::vector<WorldPosition> beginPath, endPath;
|
||||
TravelNodeRoute route = sTravelNodeMap->getRoute(botPos, *points.front(), beginPath, bot);
|
||||
|
||||
std::ostringstream out; out << "Traveling to " << dest->getTitle() << ": ";
|
||||
std::ostringstream out;
|
||||
out << "Traveling to " << dest->getTitle() << ": ";
|
||||
|
||||
for (auto node : route.getNodes())
|
||||
{
|
||||
@@ -228,18 +232,19 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
else if (text.find("reset node") != std::string::npos)
|
||||
{
|
||||
for (auto& node : sTravelNodeMap->getNodes()) node->setLinked(false);
|
||||
for (auto& node : sTravelNodeMap->getNodes())
|
||||
node->setLinked(false);
|
||||
return true;
|
||||
}
|
||||
else if (text.find("reset path") != std::string::npos)
|
||||
{
|
||||
for (auto& node : sTravelNodeMap->getNodes())
|
||||
for (auto& path : *node->getLinks()) node->removeLinkTo(path.first, true);
|
||||
for (auto& path : *node->getLinks())
|
||||
node->removeLinkTo(path.first, true);
|
||||
return true;
|
||||
}
|
||||
else if (text.find("gen node") != std::string::npos)
|
||||
{
|
||||
|
||||
// Pathfinder
|
||||
sTravelNodeMap->generateNodes();
|
||||
return true;
|
||||
@@ -262,11 +267,12 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
else if (text.find("load node") != std::string::npos)
|
||||
{
|
||||
std::thread t([]
|
||||
{
|
||||
sTravelNodeMap->removeNodes();
|
||||
sTravelNodeMap->loadNodeStore();
|
||||
});
|
||||
std::thread t(
|
||||
[]
|
||||
{
|
||||
sTravelNodeMap->removeNodes();
|
||||
sTravelNodeMap->loadNodeStore();
|
||||
});
|
||||
|
||||
t.detach();
|
||||
|
||||
@@ -282,7 +288,7 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (auto& l : *node->getLinks())
|
||||
{
|
||||
Unit* start = nullptr;
|
||||
Unit* start = nullptr;
|
||||
GuidVector units;
|
||||
|
||||
uint32 time = 60 * IN_MILLISECONDS;
|
||||
@@ -291,15 +297,16 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (auto p : ppath)
|
||||
{
|
||||
Creature* wpCreature = bot->SummonCreature(1, p.getX(), p.getY(), p.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
|
||||
//addAura(246, wpCreature);
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature(1, p.getX(), p.getY(), p.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 20000.0f);
|
||||
// addAura(246, wpCreature);
|
||||
units.push_back(wpCreature->GetGUID());
|
||||
|
||||
if (!start)
|
||||
start = wpCreature;
|
||||
}
|
||||
|
||||
//FakeSpell(1064, bot, start, units.front(), units, {}, pos, pos);
|
||||
// FakeSpell(1064, bot, start, units.front(), units, {}, pos, pos);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -312,7 +319,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (float i = 0; i < 60; i++)
|
||||
{
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float dist = i / 60 * 30;
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
@@ -322,7 +329,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
FakeSpell(spellEffect, wpCreature, wpCreature, prev->GetGUID(), {}, {}, botPos, botPos);
|
||||
|
||||
@@ -338,7 +346,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (float i = 0; i < 60; i++)
|
||||
{
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float dist = i / 60 * 30;
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
@@ -348,13 +356,14 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
|
||||
data << wpCreature->GetGUID();
|
||||
data << uint32(spellEffect); // index from SpellVisualKit.dbc
|
||||
data << uint32(spellEffect); // index from SpellVisualKit.dbc
|
||||
wpCreature->SendMessageToSet(&data, true);
|
||||
}
|
||||
}
|
||||
@@ -368,7 +377,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (float i = 0; i < 60; i++)
|
||||
{
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float dist = i / 60 * 30;
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
@@ -378,7 +387,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 5000.0f + i * 100.0f);
|
||||
wpCreature->SetObjectScale(0.5f);
|
||||
|
||||
if (wpCreature)
|
||||
@@ -396,7 +406,7 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
for (float i = 0; i < 60; i++)
|
||||
{
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float ang = i / 60 * static_cast<float>(M_PI) * 4;
|
||||
float dist = i / 60 * 30;
|
||||
|
||||
WorldPosition botPos(bot);
|
||||
@@ -405,7 +415,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + sin(ang) * dist);
|
||||
botPos.setZ(botPos.getHeight() + 2);
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
units.push_back(wpCreature->GetGUID());
|
||||
}
|
||||
@@ -438,12 +449,12 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
|
||||
{
|
||||
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
|
||||
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
|
||||
data << bot->GetPackGUID();
|
||||
data << bot->GetPackGUID();
|
||||
data << uint32(spellEffect); // spellID
|
||||
data << uint8(0) << uint8(1); // flags
|
||||
data << uint8(1); // amount of targets
|
||||
data << uint32(spellEffect); // spellID
|
||||
data << uint8(0) << uint8(1); // flags
|
||||
data << uint8(1); // amount of targets
|
||||
data << master->GetGUID();
|
||||
data << uint8(0);
|
||||
data << uint16(2);
|
||||
@@ -465,15 +476,17 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
@@ -495,15 +508,16 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(effect, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@@ -514,8 +528,8 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
@@ -534,26 +548,28 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4); // visual effect on guid
|
||||
data << wpCreature->GetGUID();
|
||||
data << uint32(effect);
|
||||
; // index from SpellVisualKit.dbc
|
||||
; // index from SpellVisualKit.dbc
|
||||
// wpCreature->SendMessageToSet(&data, true);
|
||||
datMap.push_back(data);
|
||||
|
||||
//wpCreature->MonsterMoveWithSpeed(botPos.getX(), botPos.getY() + 80, botPos.getZ(), 8.0f, true, true);
|
||||
// wpCreature->MonsterMoveWithSpeed(botPos.getX(), botPos.getY() + 80, botPos.getZ(), 8.0f, true,
|
||||
// true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -580,21 +596,23 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4); // visual effect on player
|
||||
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4); // visual effect on player
|
||||
data << wpCreature->GetGUID();
|
||||
data << uint32(effect); // index from SpellVisualKit.dbc
|
||||
data << uint32(effect); // index from SpellVisualKit.dbc
|
||||
// wpCreature->SendMessageToSet(&data, true);
|
||||
datMap.push_back(data);
|
||||
}
|
||||
@@ -619,20 +637,21 @@ bool DebugAction::Execute(Event event)
|
||||
else if (text.find("cspellmap") != std::string::npos)
|
||||
{
|
||||
Creature* wpCreature = nullptr;
|
||||
Creature* lCreature = nullptr;
|
||||
Creature* lCreature = nullptr;
|
||||
for (int32 dx = 0; dx < 10; dx++)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(),
|
||||
botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature && lCreature)
|
||||
{
|
||||
@@ -652,15 +671,16 @@ bool DebugAction::Execute(Event event)
|
||||
{
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
WorldPosition botPos(bot);
|
||||
|
||||
botPos.setX(botPos.getX() + (dx - 5) * 5);
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
if (wpCreature)
|
||||
{
|
||||
@@ -672,7 +692,7 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
else if (text.find("gspellmap") != std::string::npos)
|
||||
{
|
||||
GuidVector all_targets; // = { bot->GetGUID(), master->GetGUID() };
|
||||
GuidVector all_targets; // = { bot->GetGUID(), master->GetGUID() };
|
||||
// std::GuidVector all_dummies = { bot->GetGUID(), master->GetGUID() };
|
||||
|
||||
/*GuidVector a_targets = *context->GetValue<GuidVector >("all targets");
|
||||
@@ -692,7 +712,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
all_targets.push_back(wpCreature->GetGUID());
|
||||
}
|
||||
@@ -709,9 +730,9 @@ bool DebugAction::Execute(Event event)
|
||||
for (int32 dy = 0; dy < 10; dy++)
|
||||
{
|
||||
uint32 spellEffect = stoi(text.substr(10));
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
uint32 effect = dx + dy * 10 + spellEffect * 100;
|
||||
|
||||
uint32 i = dx + dy * 10;
|
||||
uint32 i = dx + dy * 10;
|
||||
GuidVector hits, miss;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effect);
|
||||
@@ -722,21 +743,23 @@ bool DebugAction::Execute(Event event)
|
||||
|
||||
switch (urand(0, 10))
|
||||
{
|
||||
case 0:
|
||||
hits.push_back(tar);
|
||||
break;
|
||||
case 1:
|
||||
miss.push_back(tar);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
case 0:
|
||||
hits.push_back(tar);
|
||||
break;
|
||||
case 1:
|
||||
miss.push_back(tar);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Unit* realCaster = botAI->GetUnit(all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* caster = botAI->GetUnit(all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* target = botAI->GetUnit(all_targets[i + 1]);
|
||||
Unit* realCaster = botAI->GetUnit(
|
||||
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* caster = botAI->GetUnit(
|
||||
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* target = botAI->GetUnit(all_targets[i + 1]);
|
||||
|
||||
if (!realCaster)
|
||||
realCaster = bot;
|
||||
@@ -747,7 +770,8 @@ bool DebugAction::Execute(Event event)
|
||||
if (!target)
|
||||
target = master;
|
||||
|
||||
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster), WorldPosition(target));
|
||||
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster),
|
||||
WorldPosition(target));
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
@@ -768,7 +792,8 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature = bot->SummonCreature(2334, botPos.getX(), botPos.getY(), botPos.getZ(), 0,
|
||||
TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
all_targets.push_back(wpCreature->GetGUID());
|
||||
}
|
||||
@@ -808,8 +833,10 @@ bool DebugAction::Execute(Event event)
|
||||
}
|
||||
}
|
||||
|
||||
Unit* realCaster = botAI->GetUnit(all_targets[i]);//botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* caster = botAI->GetUnit(all_targets[i]);//botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* realCaster = botAI->GetUnit(
|
||||
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* caster = botAI->GetUnit(
|
||||
all_targets[i]); // botAI->GetUnit(all_targets[urand(0, all_targets.size() - 1)]);
|
||||
Unit* target = botAI->GetUnit(all_targets[i + 1]);
|
||||
|
||||
if (!realCaster)
|
||||
@@ -822,13 +849,14 @@ bool DebugAction::Execute(Event event)
|
||||
target = master;
|
||||
|
||||
master->SendPlaySpellVisual(caster->GetGUID(), 5036);
|
||||
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster), WorldPosition(target));
|
||||
FakeSpell(effect, realCaster, caster, target->GetGUID(), hits, miss, WorldPosition(caster),
|
||||
WorldPosition(target));
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
else if (text.find("soundmap") != std::string::npos)
|
||||
{
|
||||
@@ -844,7 +872,9 @@ bool DebugAction::Execute(Event event)
|
||||
botPos.setY(botPos.getY() + (dy - 5) * 5);
|
||||
botPos.setZ(botPos.getHeight());
|
||||
|
||||
Creature* wpCreature = bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(), botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
Creature* wpCreature =
|
||||
bot->SummonCreature((dy == 0 && (dx == 0 || dx == 2)) ? 6 : 2, botPos.getX(), botPos.getY(),
|
||||
botPos.getZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000.0f);
|
||||
|
||||
wpCreature->PlayDistanceSound(effect);
|
||||
}
|
||||
@@ -886,33 +916,35 @@ bool DebugAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target, GuidVector otherTargets, GuidVector missTargets, WorldPosition source, WorldPosition dest, bool forceDest)
|
||||
void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target, GuidVector otherTargets,
|
||||
GuidVector missTargets, WorldPosition source, WorldPosition dest, bool forceDest)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
{
|
||||
uint32 castFlags = CAST_FLAG_HAS_TRAJECTORY;
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) ||
|
||||
spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||
castFlags |= CAST_FLAG_PROJECTILE;
|
||||
|
||||
WorldPacket data(SMSG_SPELL_START, (8 + 8 + 4 + 2 + 4));
|
||||
|
||||
data << truecaster->GetPackGUID(); //truecaster
|
||||
data << truecaster->GetPackGUID(); // truecaster
|
||||
|
||||
if (caster)
|
||||
data << caster->GetPackGUID(); //m_caster->GetPackGUID();
|
||||
data << caster->GetPackGUID(); // m_caster->GetPackGUID();
|
||||
else
|
||||
data << ObjectGuid::Empty;
|
||||
|
||||
data << uint32(spellId); // spellId
|
||||
data << uint16(castFlags); // cast flags
|
||||
data << uint32(1000.0f); // delay?
|
||||
data << uint32(spellId); // spellId
|
||||
data << uint16(castFlags); // cast flags
|
||||
data << uint32(1000.0f); // delay?
|
||||
|
||||
SpellCastTargets m_targets;
|
||||
|
||||
m_targets.Write(data);
|
||||
|
||||
//projectile info
|
||||
// projectile info
|
||||
if (castFlags & CAST_FLAG_PROJECTILE)
|
||||
{
|
||||
data << uint32(5996);
|
||||
@@ -935,16 +967,18 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
|
||||
m_targets.SetSrc(source.getX(), source.getY(), source.getZ());
|
||||
|
||||
if (!forceDest && target)
|
||||
if (!spellInfo || !(spellInfo->Targets & TARGET_FLAG_DEST_LOCATION && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION))
|
||||
if (!spellInfo ||
|
||||
!(spellInfo->Targets & TARGET_FLAG_DEST_LOCATION && spellInfo->Targets & TARGET_FLAG_SOURCE_LOCATION))
|
||||
m_targets.SetUnitTarget(botAI->GetUnit(target));
|
||||
|
||||
uint32 castFlags = CAST_FLAG_UNKNOWN_9;
|
||||
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) || spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||
castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR0_USES_RANGED_SLOT) ||
|
||||
spellInfo->HasAttribute(SPELL_ATTR0_CU_NEEDS_AMMO_DATA))
|
||||
castFlags |= CAST_FLAG_PROJECTILE; // arrows/bullets visual
|
||||
|
||||
if (spellInfo->HasEffect(SPELL_EFFECT_ACTIVATE_RUNE))
|
||||
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
|
||||
castFlags |= CAST_FLAG_RUNE_LIST; // rune cooldowns list
|
||||
|
||||
if (m_targets.HasTraj())
|
||||
castFlags |= CAST_FLAG_ADJUST_MISSILE;
|
||||
@@ -952,43 +986,43 @@ void DebugAction::FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, Obje
|
||||
if (!spellInfo->StartRecoveryTime)
|
||||
castFlags |= CAST_FLAG_NO_GCD;
|
||||
|
||||
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
|
||||
WorldPacket data(SMSG_SPELL_GO, 53); // guess size
|
||||
|
||||
data << truecaster->GetPackGUID(); //truecaster
|
||||
data << truecaster->GetPackGUID(); // truecaster
|
||||
|
||||
if (caster)
|
||||
data << caster->GetPackGUID(); //m_caster->GetPackGUID();
|
||||
data << caster->GetPackGUID(); // m_caster->GetPackGUID();
|
||||
else
|
||||
data << ObjectGuid::Empty;
|
||||
|
||||
data << uint32(spellId); // spellId
|
||||
data << uint16(castFlags); // cast flags
|
||||
data << uint32(spellId); // spellId
|
||||
data << uint16(castFlags); // cast flags
|
||||
|
||||
//WriteSpellGoTargets
|
||||
// WriteSpellGoTargets
|
||||
uint32 hits = otherTargets.size() + (target ? 1 : 0);
|
||||
|
||||
data << uint8(hits); // Hits
|
||||
data << uint8(hits); // Hits
|
||||
|
||||
if (target)
|
||||
data << target;
|
||||
|
||||
//Hit targets here.
|
||||
// Hit targets here.
|
||||
for (auto otherTarget : otherTargets)
|
||||
data << otherTarget;
|
||||
|
||||
data << (uint8)missTargets.size(); //miss
|
||||
data << (uint8)missTargets.size(); // miss
|
||||
|
||||
for (auto missTarget : missTargets)
|
||||
{
|
||||
data << missTarget;
|
||||
|
||||
data << uint8(SPELL_MISS_RESIST); //Miss condition
|
||||
data << uint8(SPELL_MISS_NONE); //Miss condition
|
||||
data << uint8(SPELL_MISS_RESIST); // Miss condition
|
||||
data << uint8(SPELL_MISS_NONE); // Miss condition
|
||||
}
|
||||
|
||||
m_targets.Write(data);
|
||||
|
||||
//projectile info
|
||||
// projectile info
|
||||
if (castFlags & CAST_FLAG_PROJECTILE)
|
||||
{
|
||||
data << uint32(5996);
|
||||
@@ -1011,7 +1045,8 @@ void DebugAction::addAura(uint32 spellId, Unit* target)
|
||||
if (!spellInfo)
|
||||
return;
|
||||
|
||||
if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
|
||||
if (!target->IsAlive() && !spellInfo->HasAttribute(SPELL_ATTR0_PASSIVE) &&
|
||||
!spellInfo->HasAttribute(SPELL_ATTR2_ALLOW_DEAD_TARGET))
|
||||
return;
|
||||
|
||||
target->AddAura(spellInfo, MAX_EFFECT_MASK, target);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_DEBUGACTION_H
|
||||
@@ -14,13 +15,15 @@ class Unit;
|
||||
|
||||
class DebugAction : public Action
|
||||
{
|
||||
public:
|
||||
DebugAction(PlayerbotAI* botAI) : Action(botAI, "Debug") { }
|
||||
public:
|
||||
DebugAction(PlayerbotAI* botAI) : Action(botAI, "Debug") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
void FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target = ObjectGuid::Empty, GuidVector otherTargets = {}, GuidVector missTargets = {}, WorldPosition source = WorldPosition(), WorldPosition dest = WorldPosition(), bool forceDest = false);
|
||||
void addAura(uint32 spellId, Unit* target);
|
||||
void FakeSpell(uint32 spellId, Unit* truecaster, Unit* caster, ObjectGuid target = ObjectGuid::Empty,
|
||||
GuidVector otherTargets = {}, GuidVector missTargets = {}, WorldPosition source = WorldPosition(),
|
||||
WorldPosition dest = WorldPosition(), bool forceDest = false);
|
||||
void addAura(uint32 spellId, Unit* target);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "DelayAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
|
||||
@@ -15,7 +17,4 @@ bool DelayAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DelayAction::isUseful()
|
||||
{
|
||||
return !botAI->AllowActivity(ALL_ACTIVITY);
|
||||
}
|
||||
bool DelayAction::isUseful() { return !botAI->AllowActivity(ALL_ACTIVITY); }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_DELAYACTION_H
|
||||
@@ -11,11 +12,11 @@ class PlayerbotAI;
|
||||
|
||||
class DelayAction : public Action
|
||||
{
|
||||
public:
|
||||
DelayAction(PlayerbotAI* botAI) : Action(botAI, "delay") { }
|
||||
public:
|
||||
DelayAction(PlayerbotAI* botAI) : Action(botAI, "delay") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "DestroyItemAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "ItemCountValue.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -25,20 +27,17 @@ void DestroyItemAction::DestroyItem(FindItemVisitor* visitor)
|
||||
{
|
||||
IterateItems(visitor);
|
||||
std::vector<Item*> items = visitor->GetResult();
|
||||
for (Item* item : items)
|
||||
for (Item* item : items)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << chat->FormatItem(item->GetTemplate()) << " destroyed";
|
||||
botAI->TellMaster(out);
|
||||
|
||||
bot->DestroyItem(item->GetBagSlot(),item->GetSlot(), true);
|
||||
bot->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||
}
|
||||
}
|
||||
|
||||
bool SmartDestroyItemAction::isUseful()
|
||||
{
|
||||
return !botAI->HasActivePlayerMaster();
|
||||
}
|
||||
bool SmartDestroyItemAction::isUseful() { return !botAI->HasActivePlayerMaster(); }
|
||||
|
||||
bool SmartDestroyItemAction::Execute(Event event)
|
||||
{
|
||||
@@ -68,19 +67,23 @@ bool SmartDestroyItemAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<uint32> bestToDestroy = { ITEM_USAGE_NONE }; //First destroy anything useless.
|
||||
std::vector<uint32> bestToDestroy = {ITEM_USAGE_NONE}; // First destroy anything useless.
|
||||
|
||||
if (!AI_VALUE(bool, "can sell") && AI_VALUE(bool, "should get money")) // We need money so quest items are less important since they can't directly be sold.
|
||||
if (!AI_VALUE(bool, "can sell") &&
|
||||
AI_VALUE(
|
||||
bool,
|
||||
"should get money")) // We need money so quest items are less important since they can't directly be sold.
|
||||
bestToDestroy.push_back(ITEM_USAGE_QUEST);
|
||||
else // We don't need money so destroy the cheapest stuff.
|
||||
else // We don't need money so destroy the cheapest stuff.
|
||||
{
|
||||
bestToDestroy.push_back(ITEM_USAGE_VENDOR);
|
||||
bestToDestroy.push_back(ITEM_USAGE_AH);
|
||||
}
|
||||
|
||||
// If we still need room
|
||||
bestToDestroy.push_back(ITEM_USAGE_SKILL); // Items that might help tradeskill are more important than above but still expenable.
|
||||
bestToDestroy.push_back(ITEM_USAGE_USE); // These are more likely to be usefull 'soon' but still expenable.
|
||||
bestToDestroy.push_back(
|
||||
ITEM_USAGE_SKILL); // Items that might help tradeskill are more important than above but still expenable.
|
||||
bestToDestroy.push_back(ITEM_USAGE_USE); // These are more likely to be usefull 'soon' but still expenable.
|
||||
|
||||
for (auto& usage : bestToDestroy)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_DESTROYITEMACTION_H
|
||||
@@ -12,22 +13,22 @@ class PlayerbotAI;
|
||||
|
||||
class DestroyItemAction : public InventoryAction
|
||||
{
|
||||
public:
|
||||
DestroyItemAction(PlayerbotAI* botAI, std::string const name = "destroy") : InventoryAction(botAI, name) { }
|
||||
public:
|
||||
DestroyItemAction(PlayerbotAI* botAI, std::string const name = "destroy") : InventoryAction(botAI, name) {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
|
||||
protected:
|
||||
void DestroyItem(FindItemVisitor* visitor);
|
||||
protected:
|
||||
void DestroyItem(FindItemVisitor* visitor);
|
||||
};
|
||||
|
||||
class SmartDestroyItemAction : public DestroyItemAction
|
||||
{
|
||||
public:
|
||||
SmartDestroyItemAction(PlayerbotAI* botAI) : DestroyItemAction(botAI, "smart destroy") { }
|
||||
public:
|
||||
SmartDestroyItemAction(PlayerbotAI* botAI) : DestroyItemAction(botAI, "smart destroy") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
bool Execute(Event event) override;
|
||||
bool isUseful() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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 "DropQuestAction.h"
|
||||
|
||||
#include "ChatHelper.h"
|
||||
#include "Event.h"
|
||||
#include "Playerbots.h"
|
||||
@@ -56,32 +58,32 @@ bool CleanQuestLogAction::Execute(Event event)
|
||||
|
||||
uint8 totalQuests = 0;
|
||||
|
||||
DropQuestType(totalQuests); //Count the total quests
|
||||
DropQuestType(totalQuests); // Count the total quests
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 6)
|
||||
return true;
|
||||
|
||||
if (AI_VALUE(bool, "can fight equal")) // Only drop gray quests when able to fight proper lvl quests.
|
||||
if (AI_VALUE(bool, "can fight equal")) // Only drop gray quests when able to fight proper lvl quests.
|
||||
{
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6); // Drop gray/red quests.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true); // Drop gray/red quests with progress.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true, true); // Drop gray/red completed quests.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6); // Drop gray/red quests.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true); // Drop gray/red quests with progress.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 6, false, true, true); // Drop gray/red completed quests.
|
||||
}
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 4)
|
||||
return true;
|
||||
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 4, true); //Drop quests without progress.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 4, true); // Drop quests without progress.
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 2)
|
||||
return true;
|
||||
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 2, true, true); //Drop quests with progress.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 2, true, true); // Drop quests with progress.
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 0)
|
||||
return true;
|
||||
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 1, true, true, true); //Drop completed quests.
|
||||
DropQuestType(totalQuests, MAX_QUEST_LOG_SIZE - 1, true, true, true); // Drop completed quests.
|
||||
|
||||
if (MAX_QUEST_LOG_SIZE - totalQuests > 0)
|
||||
return true;
|
||||
@@ -101,23 +103,26 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
|
||||
if (!quest)
|
||||
continue;
|
||||
|
||||
if (quest->GetRequiredClasses() && (quest->GetRewSpellCast() || quest->GetRewSpell())) //Do not drop class specific quests that learn spells.
|
||||
if (quest->GetRequiredClasses() &&
|
||||
(quest->GetRewSpellCast() || quest->GetRewSpell())) // Do not drop class specific quests that learn spells.
|
||||
continue;
|
||||
|
||||
if (quest->GetRequiredClasses() && (quest->GetRewSpellCast() || quest->GetRewSpell())) // Do not drop class specific quests that learn spells.
|
||||
if (quest->GetRequiredClasses() &&
|
||||
(quest->GetRewSpellCast() || quest->GetRewSpell())) // Do not drop class specific quests that learn spells.
|
||||
continue;
|
||||
|
||||
if (wantNum == 100)
|
||||
numQuest++;
|
||||
|
||||
int32 lowLevelDiff = sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF);
|
||||
if (lowLevelDiff < 0 || bot->GetLevel() <= bot->GetQuestLevel(quest) + uint32(lowLevelDiff)) // Quest is not gray
|
||||
if (lowLevelDiff < 0 ||
|
||||
bot->GetLevel() <= bot->GetQuestLevel(quest) + uint32(lowLevelDiff)) // Quest is not gray
|
||||
{
|
||||
if (bot->GetLevel() + 5 > bot->GetQuestLevel(quest)) // Quest is not red
|
||||
if (bot->GetLevel() + 5 > bot->GetQuestLevel(quest)) // Quest is not red
|
||||
if (!isGreen)
|
||||
continue;
|
||||
}
|
||||
else // Quest is gray
|
||||
else // Quest is gray
|
||||
{
|
||||
if (isGreen)
|
||||
continue;
|
||||
@@ -129,13 +134,13 @@ void CleanQuestLogAction::DropQuestType(uint8& numQuest, uint8 wantNum, bool isG
|
||||
if (bot->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE && !isComplete)
|
||||
continue;
|
||||
|
||||
if (numQuest <= wantNum && bot->GetQuestStatus(questId) != QUEST_STATUS_FAILED) // Always drop failed quests
|
||||
if (numQuest <= wantNum && bot->GetQuestStatus(questId) != QUEST_STATUS_FAILED) // Always drop failed quests
|
||||
continue;
|
||||
|
||||
//Drop quest.
|
||||
// Drop quest.
|
||||
bot->SetQuestSlot(slot, 0);
|
||||
|
||||
//We ignore unequippable quest items in this case, its' still be equipped
|
||||
// We ignore unequippable quest items in this case, its' still be equipped
|
||||
bot->TakeQuestSourceItem(questId, false);
|
||||
|
||||
bot->SetQuestStatus(questId, QUEST_STATUS_NONE);
|
||||
@@ -163,7 +168,7 @@ bool CleanQuestLogAction::HasProgress(Player* bot, Quest const* quest)
|
||||
|
||||
if (quest->RequiredItemId[i])
|
||||
{
|
||||
int required = quest->RequiredItemCount[i];
|
||||
int required = quest->RequiredItemCount[i];
|
||||
int available = questStatus.ItemCount[i];
|
||||
if (available > 0 && required > 0)
|
||||
return true;
|
||||
@@ -171,7 +176,7 @@ bool CleanQuestLogAction::HasProgress(Player* bot, Quest const* quest)
|
||||
|
||||
if (quest->RequiredNpcOrGo[i])
|
||||
{
|
||||
int required = quest->RequiredNpcOrGoCount[i];
|
||||
int required = quest->RequiredNpcOrGoCount[i];
|
||||
int available = questStatus.CreatureOrGOCount[i];
|
||||
|
||||
if (available > 0 && required > 0)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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_DROPQUESTACTION_H
|
||||
@@ -13,22 +14,22 @@ class Quest;
|
||||
|
||||
class DropQuestAction : public Action
|
||||
{
|
||||
public:
|
||||
DropQuestAction(PlayerbotAI* botAI) : Action(botAI, "drop quest") { }
|
||||
public:
|
||||
DropQuestAction(PlayerbotAI* botAI) : Action(botAI, "drop quest") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
bool Execute(Event event) override;
|
||||
};
|
||||
|
||||
class CleanQuestLogAction : public Action
|
||||
{
|
||||
public:
|
||||
CleanQuestLogAction(PlayerbotAI* botAI) : Action(botAI, "clean quest log") { }
|
||||
public:
|
||||
CleanQuestLogAction(PlayerbotAI* botAI) : Action(botAI, "clean quest log") {}
|
||||
|
||||
bool Execute(Event event) override;
|
||||
void DropQuestType(uint8& numQuest, uint8 wantNum = 100, bool isGreen = false, bool hasProgress = false, bool isComplete = false);
|
||||
bool Execute(Event event) override;
|
||||
void DropQuestType(uint8& numQuest, uint8 wantNum = 100, bool isGreen = false, bool hasProgress = false,
|
||||
bool isComplete = false);
|
||||
|
||||
static bool HasProgress(Player* bot, Quest const* quest);
|
||||
static bool HasProgress(Player* bot, Quest const* quest);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user