forked from conan513/mangosbot-bots
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* move style +wait - do not rush to mob if it is moving towards the bot * noedge move style * Fix bad merge * Prevent copying --------- Co-authored-by: ike3 <[email protected]>
- Loading branch information
Showing
11 changed files
with
124 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#include "botpch.h" | ||
#include "../../playerbot.h" | ||
#include "MoveStyleAction.h" | ||
#include "../values/SubStrategyValue.h" | ||
#include "../values/MoveStyleValue.h" | ||
#include "PlayerbotAIAware.h" | ||
|
||
using namespace ai; | ||
|
||
bool MoveStyleAction::Execute(Event& event) | ||
{ | ||
string strategy = event.getParam(); | ||
Player* requester = event.getOwner() ? event.getOwner() : GetMaster(); | ||
|
||
MoveStyleValue* value = (MoveStyleValue*)context->GetValue<string>("move style"); | ||
|
||
if (strategy == "?") | ||
{ | ||
{ | ||
ostringstream out; | ||
out << "Move style: " << value->Get(); | ||
ai->TellPlayer(requester, out); | ||
} | ||
} | ||
else | ||
{ | ||
value->Set(strategy); | ||
|
||
{ | ||
ostringstream out; | ||
out << "Move style set to: " << value->Get(); | ||
ai->TellPlayer(requester, out); | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#pragma once | ||
#include "../../LootObjectStack.h" | ||
#include "GenericActions.h" | ||
|
||
namespace ai | ||
{ | ||
class MoveStyleAction : public ChatCommandAction | ||
{ | ||
public: | ||
MoveStyleAction(PlayerbotAI* ai) : ChatCommandAction(ai, "move style") {} | ||
virtual bool Execute(Event& event) override; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "botpch.h" | ||
#include "../../playerbot.h" | ||
#include "MoveStyleValue.h" | ||
#include "../values/ItemUsageValue.h" | ||
|
||
using namespace ai; | ||
using namespace std; | ||
|
||
bool MoveStyleValue::HasValue(PlayerbotAI* ai, const string& value) | ||
{ | ||
string styles = ai->GetAiObjectContext()->GetValue<string>("move style")->Get(); | ||
return styles.find(value) != string::npos; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
#include "../../LootObjectStack.h" | ||
#include "../Value.h" | ||
#include "SubStrategyValue.h" | ||
|
||
namespace ai | ||
{ | ||
class MoveStyleValue : public SubStrategyValue | ||
{ | ||
public: | ||
MoveStyleValue(PlayerbotAI* ai, const string& defaultValue = "", const string& name = "move style", const string& allowedValues = "wait,noedge") : SubStrategyValue(ai, defaultValue, name, allowedValues) {} | ||
|
||
static bool WaitForEnemy(PlayerbotAI* ai) { return HasValue(ai, "wait"); } | ||
static bool CheckForEdges(PlayerbotAI* ai) { return HasValue(ai, "noedge"); } | ||
|
||
private: | ||
static bool HasValue(PlayerbotAI* ai, const string& value); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters