Merge pull request #447 from fuzzdeveloper/wsg-fixes

WSG fixes
This commit is contained in:
fuzzdeveloper
2024-08-08 09:37:13 +10:00
committed by GitHub
5 changed files with 62 additions and 27 deletions

View File

@@ -22,6 +22,7 @@
#include "Event.h"
#include "Playerbots.h"
#include "PositionValue.h"
#include "PvpTriggers.h"
#include "ServerFacade.h"
#include "Vehicle.h"
@@ -1771,7 +1772,10 @@ std::string const BGTactics::HandleConsoleCommandPrivate(WorldSession* session,
Creature* wpCreature = player->SummonCreature(15631, c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 15000u);
wpCreature->SetOwnerGUID(player->GetGUID());
return fmt::format("Showing location of Creature {}", num);
float distance = player->GetDistance(c);
float exactDistance = player->GetExactDist(c);
return fmt::format("Showing Creature {} location={:.3f},{:.3f},{:.3f} distance={} exactDistance={}",
num, c->GetPositionX(), c->GetPositionY(), c->GetPositionZ(), distance, exactDistance);
}
if (!strncmp(cmd, "showobject=", 11))
@@ -1787,7 +1791,10 @@ std::string const BGTactics::HandleConsoleCommandPrivate(WorldSession* session,
Creature* wpCreature = player->SummonCreature(15631, o->GetPositionX(), o->GetPositionY(), o->GetPositionZ(), 0,
TEMPSUMMON_TIMED_DESPAWN, 15000u);
wpCreature->SetOwnerGUID(player->GetGUID());
return fmt::format("Showing location of GameObject {}", num);
float distance = player->GetDistance(o);
float exactDistance = player->GetExactDist(o);
return fmt::format("Showing GameObject {} location={:.3f},{:.3f},{:.3f} distance={} exactDistance={}",
num, o->GetPositionX(), o->GetPositionY(), o->GetPositionZ(), distance, exactDistance);
}
return "usage: showpath(=[num]) / showcreature=[num] / showobject=[num]";
@@ -2053,13 +2060,13 @@ bool BGTactics::wsgPaths()
return true;
}
if (bot->GetPositionX() > 1071.f) // move the ramp up a piece
if (bot->GetPositionX() > 1059.f) // move the ramp up a piece
{
MoveTo(bg->GetMapId(), 1070.089478f, 1538.054443f, 332.460388f);
MoveTo(bg->GetMapId(), 1057.551f, 1546.271f, 326.864f);
return true;
}
if (bot->GetPositionX() > 1050.2f) // move the ramp up a piece
if (bot->GetPositionX() > 1051.2f) // move the ramp up a piece
{
MoveTo(bg->GetMapId(), 1050.089478f, 1538.054443f, 332.460388f);
return true;
@@ -2266,8 +2273,7 @@ bool BGTactics::Execute(Event event)
// NOTE: can't use IsInCombat() when in vehicle as player is stuck in combat forever while in vehicle (ac bug?)
bool inCombat = bot->GetVehicle() ? (bool)AI_VALUE(Unit*, "enemy player target") : bot->IsInCombat();
if (inCombat && !(bot->HasAura(BG_WS_SPELL_WARSONG_FLAG) || bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG) ||
bot->HasAura(BG_EY_NETHERSTORM_FLAG_SPELL)))
if (inCombat && !PlayerHasFlag::IsCapturingFlag(bot))
{
// bot->GetMotionMaster()->MovementExpired();
return false;
@@ -3886,10 +3892,7 @@ bool BGTactics::moveToObjectiveWp(BattleBotPath* const& currentPath, uint32 curr
// NOTE: can't use IsInCombat() when in vehicle as player is stuck in combat forever while in vehicle (ac bug?)
bool inCombat = bot->GetVehicle() ? (bool)AI_VALUE(Unit*, "enemy player target") : bot->IsInCombat();
if ((currentPoint == lastPointInPath) ||
(inCombat && !(bot->HasAura(BG_WS_SPELL_WARSONG_FLAG) || bot->HasAura(BG_WS_SPELL_SILVERWING_FLAG) ||
bot->HasAura(BG_EY_NETHERSTORM_FLAG_SPELL))) ||
!bot->IsAlive())
if (currentPoint == lastPointInPath || (inCombat && !PlayerHasFlag::IsCapturingFlag(bot)) || !bot->IsAlive())
{
// Path is over.
// std::ostringstream out;

View File

@@ -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;

View File

@@ -44,13 +44,12 @@ bool EnterVehicleAction::Execute(Event event)
if (vehicleBase->GetVehicleKit()->IsVehicleInUse())
continue;
// if (fabs(bot->GetPositionZ() - vehicleBase->GetPositionZ()) < 20.0f)
float dist = sServerFacade->GetDistance2d(bot, vehicleBase);
if (dist > 40.0f)
continue;
// if (sServerFacade->GetDistance2d(bot, vehicle) > 100.0f)
// continue;
if (sServerFacade->GetDistance2d(bot, vehicleBase) > INTERACTION_DISTANCE)
return MoveTo(vehicleBase, INTERACTION_DISTANCE - 1.0f);
if (dist > INTERACTION_DISTANCE)
return MoveTo(vehicleBase);
bot->EnterVehicle(vehicleBase);