mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-15 09:50:27 +00:00
Run clang-format
This commit is contained in:
@@ -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 "PositionAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "PositionValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "PositionValue.h"
|
||||
|
||||
void TellPosition(PlayerbotAI* botAI, std::string const name, PositionInfo pos)
|
||||
{
|
||||
@@ -28,8 +30,8 @@ void TellPosition(PlayerbotAI* botAI, std::string const name, PositionInfo pos)
|
||||
bool PositionAction::Execute(Event event)
|
||||
{
|
||||
std::string const param = event.getParam();
|
||||
if (param.empty())
|
||||
return false;
|
||||
if (param.empty())
|
||||
return false;
|
||||
|
||||
Player* master = GetMaster();
|
||||
if (!master)
|
||||
@@ -56,12 +58,12 @@ bool PositionAction::Execute(Event event)
|
||||
|
||||
std::string const name = params[0];
|
||||
std::string const action = params[1];
|
||||
PositionInfo pos = posMap[name];
|
||||
if (action == "?")
|
||||
{
|
||||
TellPosition(botAI, name, pos);
|
||||
return true;
|
||||
}
|
||||
PositionInfo pos = posMap[name];
|
||||
if (action == "?")
|
||||
{
|
||||
TellPosition(botAI, name, pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<std::string> coords = split(action, ',');
|
||||
if (coords.size() == 3)
|
||||
@@ -75,34 +77,34 @@ bool PositionAction::Execute(Event event)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == "set")
|
||||
{
|
||||
pos.Set( bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), botAI->GetBot()->GetMapId());
|
||||
posMap[name] = pos;
|
||||
if (action == "set")
|
||||
{
|
||||
pos.Set(bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), botAI->GetBot()->GetMapId());
|
||||
posMap[name] = pos;
|
||||
|
||||
std::ostringstream out;
|
||||
out << "Position " << name << " is set";
|
||||
botAI->TellMaster(out);
|
||||
return true;
|
||||
}
|
||||
botAI->TellMaster(out);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (action == "reset")
|
||||
{
|
||||
pos.Reset();
|
||||
posMap[name] = pos;
|
||||
if (action == "reset")
|
||||
{
|
||||
pos.Reset();
|
||||
posMap[name] = pos;
|
||||
|
||||
std::ostringstream out;
|
||||
out << "Position " << name << " is reset";
|
||||
botAI->TellMaster(out);
|
||||
return true;
|
||||
}
|
||||
botAI->TellMaster(out);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MoveToPositionAction::Execute(Event event)
|
||||
{
|
||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
||||
PositionInfo pos = context->GetValue<PositionMap&>("position")->Get()[qualifier];
|
||||
if (!pos.isSet())
|
||||
{
|
||||
std::ostringstream out;
|
||||
@@ -121,7 +123,6 @@ bool MoveToPositionAction::isUseful()
|
||||
return pos.isSet() && distance > sPlayerbotAIConfig->followDistance && distance < sPlayerbotAIConfig->reactDistance;
|
||||
}
|
||||
|
||||
|
||||
bool SetReturnPositionAction::Execute(Event event)
|
||||
{
|
||||
PositionMap& posMap = context->GetValue<PositionMap&>("position")->Get();
|
||||
|
||||
Reference in New Issue
Block a user