mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-03 02:43:49 +00:00
Closer the original solution, i dont wanna drift to much away without really good reason. At this point i still see NPC and bots moving through the levels or even falling out the levels here and there. I verified whether the MovePoint signature changes and related params itself in playerbots has anything todo with it, even when params are hardcoded the behavior remains. It could be deeper problem, but for now it seems core problem. Therefore i dont wanna change to much until the dust has settled a bit in core itself. I havent implemented moveTakeOff or moveLand which are basically responsible for the transitions phases between ground and air visa versa. I have version where i use takeOff for the animation, which means moving vertical. For now i am gonna leave for what it is. PS: also includes additional movement fix for AreaTriggerAction which we missed first time after the core update on movements. @Wishmaster117 Been testing and trying a lot in the background on find solutions and causes. The general solutions remains removed some tweaks, altered code here and there. With the general idea to keep closer to the original code for now at least. Testing: - Class abilities: Slow fall (priest), Flight Form (druid) : Green - BG: Green - Swimming and walking shallow waters: Green - Takeoff and land when following master: Green - Boat and zeppelins: Green - Flymount and ground walking: Green - Water Walking (shaman), Path of Frost (DK): Green - Water Walking (shaman), Path of Frost (DK) transisions; flying, swimming, water walking: Green Skipping pets when group water walking, path of frost, once core pathing changes has settled more i will add it. Which is easy but i dont wanna add more edge cases and code branches for now.
82 lines
2.3 KiB
C++
82 lines
2.3 KiB
C++
/*
|
|
* 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;
|
|
}
|