mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-26 06:56:24 +00:00
[HOT FIX] MS build issues regarding folder / command lenght usage or rc.exe (#2038)
This commit is contained in:
81
src/Ai/Base/Actions/AreaTriggerAction.cpp
Normal file
81
src/Ai/Base/Actions/AreaTriggerAction.cpp
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
||||
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
||||
*/
|
||||
|
||||
#include "AreaTriggerAction.h"
|
||||
|
||||
#include "Event.h"
|
||||
#include "LastMovementValue.h"
|
||||
#include "Playerbots.h"
|
||||
#include "Transport.h"
|
||||
|
||||
bool ReachAreaTriggerAction::Execute(Event event)
|
||||
{
|
||||
if (botAI->IsRealPlayer()) // Do not trigger own area trigger.
|
||||
return false;
|
||||
|
||||
uint32 triggerId;
|
||||
WorldPacket p(event.getPacket());
|
||||
p.rpos(0);
|
||||
p >> triggerId;
|
||||
|
||||
AreaTrigger const* at = sObjectMgr->GetAreaTrigger(triggerId);
|
||||
if (!at)
|
||||
return false;
|
||||
|
||||
if (!sObjectMgr->GetAreaTriggerTeleport(triggerId))
|
||||
{
|
||||
WorldPacket p1(CMSG_AREATRIGGER);
|
||||
p1 << triggerId;
|
||||
p1.rpos(0);
|
||||
bot->GetSession()->HandleAreaTriggerOpcode(p1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (bot->GetMapId() != at->map)
|
||||
{
|
||||
botAI->TellError("I won't follow: too far away");
|
||||
return true;
|
||||
}
|
||||
|
||||
bot->GetMotionMaster()->MovePoint(
|
||||
/*id*/ at->map,
|
||||
/*coords*/ at->x, at->y, at->z,
|
||||
/*forcedMovement*/ FORCED_MOVEMENT_NONE,
|
||||
/*speed*/ 0.0f, // default speed (not handled here)
|
||||
/*orientation*/ 0.0f, // keep current orientation of bot
|
||||
/*generatePath*/ true, // true => terrain path (2d mmap); false => straight spline (3d vmap)
|
||||
/*forceDestination*/ false);
|
||||
|
||||
float distance = bot->GetDistance(at->x, at->y, at->z);
|
||||
float delay = 1000.0f * distance / bot->GetSpeed(MOVE_RUN) + sPlayerbotAIConfig->reactDelay;
|
||||
botAI->TellError("Wait for me");
|
||||
botAI->SetNextCheckDelay(delay);
|
||||
context->GetValue<LastMovement&>("last area trigger")->Get().lastAreaTrigger = triggerId;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AreaTriggerAction::Execute(Event event)
|
||||
{
|
||||
LastMovement& movement = context->GetValue<LastMovement&>("last area trigger")->Get();
|
||||
|
||||
uint32 triggerId = movement.lastAreaTrigger;
|
||||
movement.lastAreaTrigger = 0;
|
||||
|
||||
if (!sObjectMgr->GetAreaTrigger(triggerId))
|
||||
return false;
|
||||
|
||||
if (!sObjectMgr->GetAreaTriggerTeleport(triggerId))
|
||||
return true;
|
||||
|
||||
WorldPacket p(CMSG_AREATRIGGER);
|
||||
p << triggerId;
|
||||
p.rpos(0);
|
||||
bot->GetSession()->HandleAreaTriggerOpcode(p);
|
||||
|
||||
botAI->TellMaster("Hello");
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user