mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-23 05:26:22 +00:00
Merge branch 'liyunfan1223:master' into bot_questing
This commit is contained in:
@@ -194,7 +194,7 @@ bool AutoUpgradeEquipAction::Execute(Event event)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE);
|
||||
PlayerbotFactory factory(bot, bot->GetLevel());
|
||||
if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel)
|
||||
{
|
||||
factory.InitEquipment(true);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,11 +11,11 @@
|
||||
#include "Playerbots.h"
|
||||
#include "PossibleRpgTargetsValue.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "PvpTriggers.h"
|
||||
|
||||
bool AttackEnemyPlayerAction::isUseful()
|
||||
{
|
||||
// if carry flag, do not start fight
|
||||
if (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976))
|
||||
if (PlayerHasFlag::IsCapturingFlag(bot))
|
||||
return false;
|
||||
|
||||
return !sPlayerbotAIConfig->IsPvpProhibited(bot->GetZoneId(), bot->GetAreaId());
|
||||
@@ -25,7 +25,7 @@ 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));
|
||||
PlayerHasFlag::IsCapturingFlag(bot);
|
||||
}
|
||||
|
||||
bool AttackAnythingAction::isUseful()
|
||||
@@ -124,8 +124,7 @@ bool AttackAnythingAction::isPossible() { return AttackAction::isPossible() && G
|
||||
|
||||
bool DpsAssistAction::isUseful()
|
||||
{
|
||||
// if carry flag, do not start fight
|
||||
if (bot->HasAura(23333) || bot->HasAura(23335) || bot->HasAura(34976))
|
||||
if (PlayerHasFlag::IsCapturingFlag(bot))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
@@ -177,6 +177,7 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// if (bot->Unit::IsFalling()) {
|
||||
// bot->Say("I'm falling!, flag:" + std::to_string(bot->m_movementInfo.GetMovementFlags()), LANG_UNIVERSAL);
|
||||
// return false;
|
||||
@@ -190,7 +191,28 @@ bool MovementAction::MoveTo(uint32 mapId, float x, float y, float z, bool idle,
|
||||
bool generatePath = !bot->IsFlying() && !bot->isSwimming();
|
||||
bool disableMoveSplinePath = sPlayerbotAIConfig->disableMoveSplinePath >= 2 ||
|
||||
(sPlayerbotAIConfig->disableMoveSplinePath == 1 && bot->InBattleground());
|
||||
if (exact_waypoint || disableMoveSplinePath || !generatePath)
|
||||
if (Vehicle* vehicle = bot->GetVehicle())
|
||||
{
|
||||
VehicleSeatEntry const* seat = vehicle->GetSeatForPassenger(bot);
|
||||
Unit* vehicleBase = vehicle->GetBase();
|
||||
if (!vehicleBase || !seat || !seat->CanControl()) // is passenger and cant move anyway
|
||||
return false;
|
||||
|
||||
float distance = vehicleBase->GetExactDist(x, y, z); // use vehicle distance, not bot
|
||||
if (distance > sPlayerbotAIConfig->contactDistance)
|
||||
{
|
||||
MotionMaster& mm = *vehicleBase->GetMotionMaster(); // need to move vehicle, not bot
|
||||
mm.Clear();
|
||||
mm.MovePoint(mapId, x, y, z, generatePath);
|
||||
float delay = 1000.0f * (distance / vehicleBase->GetSpeed(MOVE_RUN)) - sPlayerbotAIConfig->reactDelay;
|
||||
delay = std::max(.0f, delay);
|
||||
delay = std::min((float)sPlayerbotAIConfig->maxWaitForMove, delay);
|
||||
AI_VALUE(LastMovement&, "last movement").Set(mapId, x, y, z, bot->GetOrientation(), delay);
|
||||
// TODO: is botAI->SetNextCheckDelay() meant to go here or is setting "last movement" value enough? (same question goes for below)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (exact_waypoint || disableMoveSplinePath || !generatePath)
|
||||
{
|
||||
float distance = bot->GetExactDist(x, y, z);
|
||||
if (distance > sPlayerbotAIConfig->contactDistance)
|
||||
|
||||
@@ -119,7 +119,11 @@ bool AutoReleaseSpiritAction::Execute(Event event)
|
||||
}
|
||||
if (bot->GetDistance(unit) >= INTERACTION_DISTANCE)
|
||||
{
|
||||
bot->GetMotionMaster()->MoveChase(unit);
|
||||
// bot needs to actually click spirit-healer in BG to get res timer going
|
||||
// and in IOC it's not within clicking range when they res in own base
|
||||
MotionMaster& mm = *bot->GetMotionMaster();
|
||||
mm.Clear();
|
||||
mm.MovePoint(bot->GetMapId(), unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,11 +5,16 @@
|
||||
|
||||
#include "VehicleActions.h"
|
||||
|
||||
#include "BattlegroundIC.h"
|
||||
#include "ItemVisitors.h"
|
||||
#include "Playerbots.h"
|
||||
#include "ServerFacade.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
// TODO methods to enter/exit vehicle should be added to BGTactics or MovementAction (so that we can better control
|
||||
// whether bot is in vehicle, eg: get out of vehicle to cap flag, if we're down to final boss, etc),
|
||||
// right now they will enter vehicle based only what's available here, then they're stuck in vehicle until they die
|
||||
// (LeaveVehicleAction doesnt do much seeing as they, or another bot, will get in immediately after exit)
|
||||
bool EnterVehicleAction::Execute(Event event)
|
||||
{
|
||||
// do not switch vehicles yet
|
||||
@@ -21,21 +26,30 @@ bool EnterVehicleAction::Execute(Event event)
|
||||
{
|
||||
Unit* vehicleBase = botAI->GetUnit(*i);
|
||||
if (!vehicleBase)
|
||||
return false;
|
||||
continue;
|
||||
|
||||
// dont let them get in the cannons as they'll stay forever and do nothing useful
|
||||
// dont let them in catapult they cant use them at all
|
||||
if (NPC_KEEP_CANNON == vehicleBase->GetEntry() || NPC_CATAPULT == vehicleBase->GetEntry())
|
||||
continue;
|
||||
|
||||
if (!vehicleBase->IsFriendlyTo(bot))
|
||||
return false;
|
||||
continue;
|
||||
|
||||
if (!vehicleBase->GetVehicleKit()->GetAvailableSeatCount())
|
||||
return false;
|
||||
continue;
|
||||
|
||||
if (fabs(bot->GetPositionZ() - vehicleBase->GetPositionZ()) < 20.0f)
|
||||
// this will avoid adding passengers (which dont really do much for the IOC vehicles which is the only place
|
||||
// this code is used)
|
||||
if (vehicleBase->GetVehicleKit()->IsVehicleInUse())
|
||||
continue;
|
||||
|
||||
// if (sServerFacade->GetDistance2d(bot, vehicle) > 100.0f)
|
||||
// continue;
|
||||
float dist = sServerFacade->GetDistance2d(bot, vehicleBase);
|
||||
if (dist > 40.0f)
|
||||
continue;
|
||||
|
||||
if (sServerFacade->GetDistance2d(bot, vehicleBase) > 10.0f)
|
||||
return MoveTo(vehicleBase, INTERACTION_DISTANCE);
|
||||
if (dist > INTERACTION_DISTANCE)
|
||||
return MoveTo(vehicleBase);
|
||||
|
||||
bot->EnterVehicle(vehicleBase);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user