mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 09:07:19 +00:00
[Fix] teleport to invalid map or invalid coordinates (x , y , z 200000, o ) given when teleporting player (g UI d full type player low , name , map , x , y , z , o ) (#1538)
* MoveSplineInitArgs::Validate: expression 'velocity > 0.01f' failed for GUID Full * Update BotMovementUtils.h * Playerbots: guard against invalid-Z teleports
This commit is contained in:
@@ -721,6 +721,7 @@ void PlayerbotAI::HandleTeleportAck()
|
|||||||
bot->GetSession()->HandleMoveWorldportAck();
|
bot->GetSession()->HandleMoveWorldportAck();
|
||||||
}
|
}
|
||||||
// SetNextCheckDelay(urand(2000, 5000));
|
// SetNextCheckDelay(urand(2000, 5000));
|
||||||
|
SetNextCheckDelay(urand(500, 1500)); // short delay to break bursts without hindering gameplay
|
||||||
if (sPlayerbotAIConfig->applyInstanceStrategies)
|
if (sPlayerbotAIConfig->applyInstanceStrategies)
|
||||||
ApplyInstanceStrategies(bot->GetMapId(), true);
|
ApplyInstanceStrategies(bot->GetMapId(), true);
|
||||||
EvaluateHealerDpsStrategy();
|
EvaluateHealerDpsStrategy();
|
||||||
|
|||||||
@@ -49,4 +49,46 @@ int strcmpi(char const* s1, char const* s2);
|
|||||||
#define GAI_VALUE(type, name) sSharedValueContext->getGlobalValue<type>(name)->Get()
|
#define GAI_VALUE(type, name) sSharedValueContext->getGlobalValue<type>(name)->Get()
|
||||||
#define GAI_VALUE2(type, name, param) sSharedValueContext->getGlobalValue<type>(name, param)->Get()
|
#define GAI_VALUE2(type, name, param) sSharedValueContext->getGlobalValue<type>(name, param)->Get()
|
||||||
|
|
||||||
|
// ---- Safe teleport wrappers (module-only) ----
|
||||||
|
#include "Map.h"
|
||||||
|
#include <cmath>
|
||||||
|
#include "TravelMgr.h"
|
||||||
|
|
||||||
|
inline bool TeleportToSafe(Player* p, uint32 mapId, float x, float y, float z, float o)
|
||||||
|
{
|
||||||
|
if (!p) return false;
|
||||||
|
|
||||||
|
// If the height is invalid (-200000) or not finite, attempt ONE correction on the same map.
|
||||||
|
if (z <= -199000.0f || !std::isfinite(z))
|
||||||
|
{
|
||||||
|
if (p->GetMapId() == mapId && p->GetMap())
|
||||||
|
{
|
||||||
|
float hz = p->GetMap()->GetHeight(p->GetPhaseMask(), x, y, p->GetPositionZ(), true);
|
||||||
|
if (hz > -199000.0f && std::isfinite(hz))
|
||||||
|
z = hz;
|
||||||
|
else
|
||||||
|
return false; // still invalid -> cancel the TP
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false; // different map: do not "guess" the height here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return p->TeleportTo(mapId, x, y, z, o);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool TeleportToSafe(Player* p, Position const& pos)
|
||||||
|
{
|
||||||
|
// Position doesn't have mapId: we keep actual bot map
|
||||||
|
return TeleportToSafe(p, p->GetMapId(),
|
||||||
|
pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(),
|
||||||
|
pos.GetOrientation());
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool TeleportToSafe(Player* p, WorldPosition pos)
|
||||||
|
{
|
||||||
|
return TeleportToSafe(p, pos.getMapId(), pos.getX(), pos.getY(), pos.getZ(), pos.getO());
|
||||||
|
}
|
||||||
|
// ---- /Safe teleport wrappers ----
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1772,7 +1772,8 @@ void RandomPlayerbotMgr::RandomTeleport(Player* bot, std::vector<WorldLocation>&
|
|||||||
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
PlayerbotAI* botAI = GET_PLAYERBOT_AI(bot);
|
||||||
if (botAI)
|
if (botAI)
|
||||||
botAI->Reset(true);
|
botAI->Reset(true);
|
||||||
bot->TeleportTo(loc.GetMapId(), x, y, z, 0);
|
//bot->TeleportTo(loc.GetMapId(), x, y, z, 0);
|
||||||
|
TeleportToSafe(bot, loc.GetMapId(), x, y, z, 0); // [Fix] Avoid silly teleports
|
||||||
bot->SendMovementFlagUpdate();
|
bot->SendMovementFlagUpdate();
|
||||||
|
|
||||||
if (pmo)
|
if (pmo)
|
||||||
@@ -3047,7 +3048,8 @@ void RandomPlayerbotMgr::OnPlayerLogin(Player* player)
|
|||||||
} while (true);
|
} while (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
player->TeleportTo(botPos);
|
// player->TeleportTo(botPos);
|
||||||
|
TeleportToSafe(player, botPos); // [Fix] Avoid silly teleports
|
||||||
|
|
||||||
// player->Relocate(botPos.getX(), botPos.getY(), botPos.getZ(), botPos.getO());
|
// player->Relocate(botPos.getX(), botPos.getY(), botPos.getZ(), botPos.getO());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ bool BGJoinAction::gatherArenaTeam(ArenaType type)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
memberBotAI->Reset();
|
memberBotAI->Reset();
|
||||||
member->TeleportTo(bot->GetMapId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), 0);
|
// member->TeleportTo(bot->GetMapId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), 0);
|
||||||
|
TeleportToSafe(member, bot->GetMapId(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), 0);
|
||||||
|
|
||||||
LOG_INFO("playerbots", "Bot {} <{}>: Member of <{}>", member->GetGUID().ToString().c_str(),
|
LOG_INFO("playerbots", "Bot {} <{}>: Member of <{}>", member->GetGUID().ToString().c_str(),
|
||||||
member->GetName().c_str(), arenateam->GetName().c_str());
|
member->GetName().c_str(), arenateam->GetName().c_str());
|
||||||
|
|||||||
@@ -4289,9 +4289,11 @@ bool ArenaTactics::moveToCenter(Battleground* bg)
|
|||||||
{
|
{
|
||||||
// they like to hang around at the tip of the pipes doing nothing, so we just teleport them down
|
// they like to hang around at the tip of the pipes doing nothing, so we just teleport them down
|
||||||
if (bot->GetDistance(1333.07f, 817.18f, 13.35f) < 4)
|
if (bot->GetDistance(1333.07f, 817.18f, 13.35f) < 4)
|
||||||
bot->TeleportTo(bg->GetMapId(), 1330.96f, 816.75f, 3.2f, bot->GetOrientation());
|
// bot->TeleportTo(bg->GetMapId(), 1330.96f, 816.75f, 3.2f, bot->GetOrientation());
|
||||||
|
TeleportToSafe(bot, bg->GetMapId(), 1330.96f, 816.75f, 3.2f, bot->GetOrientation()); // [Fix] Avaid silly teleport
|
||||||
if (bot->GetDistance(1250.13f, 764.79f, 13.34f) < 4)
|
if (bot->GetDistance(1250.13f, 764.79f, 13.34f) < 4)
|
||||||
bot->TeleportTo(bg->GetMapId(), 1252.19f, 765.41f, 3.2f, bot->GetOrientation());
|
// bot->TeleportTo(bg->GetMapId(), 1252.19f, 765.41f, 3.2f, bot->GetOrientation());
|
||||||
|
TeleportToSafe(bot, bg->GetMapId(), 1252.19f, 765.41f, 3.2f, bot->GetOrientation()); // [Fix] Avaid silly teleport
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BATTLEGROUND_RV:
|
case BATTLEGROUND_RV:
|
||||||
|
|||||||
@@ -147,7 +147,8 @@ bool AutoReleaseSpiritAction::HandleBattlegroundSpiritHealer()
|
|||||||
// and in IOC it's not within clicking range when they res in own base
|
// and in IOC it's not within clicking range when they res in own base
|
||||||
|
|
||||||
// Teleport to nearest friendly Spirit Healer when not currently in range of one.
|
// Teleport to nearest friendly Spirit Healer when not currently in range of one.
|
||||||
bot->TeleportTo(bot->GetMapId(), spiritHealer->GetPositionX(), spiritHealer->GetPositionY(), spiritHealer->GetPositionZ(), 0.f);
|
// bot->TeleportTo(bot->GetMapId(), spiritHealer->GetPositionX(), spiritHealer->GetPositionY(), spiritHealer->GetPositionZ(), 0.f);
|
||||||
|
TeleportToSafe(bot, bot->GetMapId(), spiritHealer->GetPositionX(), spiritHealer->GetPositionY(), spiritHealer->GetPositionZ(), 0.f); // [Fix] Avoid silly teleport
|
||||||
RESET_AI_VALUE(bool, "combat::self target");
|
RESET_AI_VALUE(bool, "combat::self target");
|
||||||
RESET_AI_VALUE(WorldPosition, "current position");
|
RESET_AI_VALUE(WorldPosition, "current position");
|
||||||
}
|
}
|
||||||
@@ -244,7 +245,8 @@ int64 RepopAction::CalculateDeadTime() const
|
|||||||
|
|
||||||
void RepopAction::PerformGraveyardTeleport(const GraveyardStruct* graveyard) const
|
void RepopAction::PerformGraveyardTeleport(const GraveyardStruct* graveyard) const
|
||||||
{
|
{
|
||||||
bot->TeleportTo(graveyard->Map, graveyard->x, graveyard->y, graveyard->z, 0.f);
|
// bot->TeleportTo(graveyard->Map, graveyard->x, graveyard->y, graveyard->z, 0.f);
|
||||||
|
TeleportToSafe(bot, graveyard->Map, graveyard->x, graveyard->y, graveyard->z, 0.f); // [Fix] Avoid Silly teleport
|
||||||
RESET_AI_VALUE(bool, "combat::self target");
|
RESET_AI_VALUE(bool, "combat::self target");
|
||||||
RESET_AI_VALUE(WorldPosition, "current position");
|
RESET_AI_VALUE(WorldPosition, "current position");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,8 @@ bool FindCorpseAction::Execute(Event event)
|
|||||||
if (deadTime > delay)
|
if (deadTime > delay)
|
||||||
{
|
{
|
||||||
bot->GetMotionMaster()->Clear();
|
bot->GetMotionMaster()->Clear();
|
||||||
bot->TeleportTo(moveToPos.getMapId(), moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), 0);
|
// bot->TeleportTo(moveToPos.getMapId(), moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), 0);
|
||||||
|
TeleportToSafe(bot, moveToPos.getMapId(), moveToPos.getX(), moveToPos.getY(), moveToPos.getZ(), 0); // [fix] Avoid Silly Teleport
|
||||||
}
|
}
|
||||||
|
|
||||||
moved = true;
|
moved = true;
|
||||||
@@ -350,7 +351,8 @@ bool SpiritHealerAction::Execute(Event event)
|
|||||||
// if (!botAI->HasActivePlayerMaster())
|
// if (!botAI->HasActivePlayerMaster())
|
||||||
// {
|
// {
|
||||||
context->GetValue<uint32>("death count")->Set(dCount + 1);
|
context->GetValue<uint32>("death count")->Set(dCount + 1);
|
||||||
return bot->TeleportTo(ClosestGrave->Map, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, 0.f);
|
// return bot->TeleportTo(ClosestGrave->Map, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, 0.f);
|
||||||
|
return TeleportToSafe(bot, ClosestGrave->Map, ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, 0.f); // [Fix] Avoid Silly teleport
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// LOG_INFO("playerbots", "Bot {} {}:{} <{}> can't find a spirit healer", bot->GetGUID().ToString().c_str(),
|
// LOG_INFO("playerbots", "Bot {} {}:{} <{}> can't find a spirit healer", bot->GetGUID().ToString().c_str(),
|
||||||
|
|||||||
@@ -957,7 +957,8 @@ bool IccGunshipTeleportHordeAction::Execute(Event event)
|
|||||||
|
|
||||||
bool IccGunshipTeleportHordeAction::TeleportTo(const Position& position)
|
bool IccGunshipTeleportHordeAction::TeleportTo(const Position& position)
|
||||||
{
|
{
|
||||||
return bot->TeleportTo(bot->GetMapId(), position.GetPositionX(), position.GetPositionY(), position.GetPositionZ(),
|
// return bot->TeleportTo(bot->GetMapId(), position.GetPositionX(), position.GetPositionY(), position.GetPositionZ(),
|
||||||
|
return TeleportToSafe(bot, bot->GetMapId(), position.GetPositionX(), position.GetPositionY(), position.GetPositionZ(),// [Fix]Avoid silly teleport
|
||||||
bot->GetOrientation());
|
bot->GetOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1357,10 +1357,14 @@ bool KologarnMarkDpsTargetAction::Execute(Event event)
|
|||||||
|
|
||||||
bool KologarnFallFromFloorAction::Execute(Event event)
|
bool KologarnFallFromFloorAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
return bot->TeleportTo(bot->GetMapId(), ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionX(),
|
/*return bot->TeleportTo(bot->GetMapId(), ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionX(),
|
||||||
ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionY(),
|
ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionY(),
|
||||||
ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionZ(),
|
ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionZ(),
|
||||||
ULDUAR_KOLOGARN_RESTORE_POSITION.GetOrientation());
|
ULDUAR_KOLOGARN_RESTORE_POSITION.GetOrientation());*/
|
||||||
|
return TeleportToSafe(bot, bot->GetMapId(), ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionX(), // [Fix] Avoid silly teleport
|
||||||
|
ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionY(),
|
||||||
|
ULDUAR_KOLOGARN_RESTORE_POSITION.GetPositionZ(),
|
||||||
|
ULDUAR_KOLOGARN_RESTORE_POSITION.GetOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KologarnFallFromFloorAction::isUseful()
|
bool KologarnFallFromFloorAction::isUseful()
|
||||||
@@ -1407,14 +1411,18 @@ bool KologarnEyebeamAction::Execute(Event event)
|
|||||||
KologarnEyebeamTrigger kologarnEyebeamTrigger(botAI);
|
KologarnEyebeamTrigger kologarnEyebeamTrigger(botAI);
|
||||||
if (runToLeftSide)
|
if (runToLeftSide)
|
||||||
{
|
{
|
||||||
teleportedToPoint = bot->TeleportTo(bot->GetMapId(), ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetPositionX(),
|
// teleportedToPoint = bot->TeleportTo(bot->GetMapId(), ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetPositionX(),
|
||||||
|
teleportedToPoint = TeleportToSafe(bot, bot->GetMapId(),
|
||||||
|
ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetPositionX(),
|
||||||
ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetPositionY(),
|
ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetPositionY(),
|
||||||
ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetPositionZ(),
|
ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetPositionZ(),
|
||||||
ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetOrientation());
|
ULDUAR_KOLOGARN_EYEBEAM_LEFT_POSITION.GetOrientation());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
teleportedToPoint = bot->TeleportTo(bot->GetMapId(), ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetPositionX(),
|
// teleportedToPoint = bot->TeleportTo(bot->GetMapId(), ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetPositionX(),
|
||||||
|
teleportedToPoint = TeleportToSafe(bot, bot->GetMapId(),
|
||||||
|
ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetPositionX(),
|
||||||
ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetPositionY(),
|
ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetPositionY(),
|
||||||
ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetPositionZ(),
|
ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetPositionZ(),
|
||||||
ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetOrientation());
|
ULDUAR_KOLOGARN_EYEBEAM_RIGHT_POSITION.GetOrientation());
|
||||||
|
|||||||
@@ -175,9 +175,13 @@ bool EmalonOverchargeAction::isUseful()
|
|||||||
|
|
||||||
bool EmalonFallFromFloorAction::Execute(Event event)
|
bool EmalonFallFromFloorAction::Execute(Event event)
|
||||||
{
|
{
|
||||||
return bot->TeleportTo(bot->GetMapId(), VOA_EMALON_RESTORE_POSITION.GetPositionX(),
|
/*return bot->TeleportTo(bot->GetMapId(), VOA_EMALON_RESTORE_POSITION.GetPositionX(),
|
||||||
VOA_EMALON_RESTORE_POSITION.GetPositionY(), VOA_EMALON_RESTORE_POSITION.GetPositionZ(),
|
VOA_EMALON_RESTORE_POSITION.GetPositionY(), VOA_EMALON_RESTORE_POSITION.GetPositionZ(),
|
||||||
VOA_EMALON_RESTORE_POSITION.GetOrientation());
|
VOA_EMALON_RESTORE_POSITION.GetOrientation());*/
|
||||||
|
return TeleportToSafe(bot, bot->GetMapId(), VOA_EMALON_RESTORE_POSITION.GetPositionX(), //[Fix] Avoid Silly Teleport
|
||||||
|
VOA_EMALON_RESTORE_POSITION.GetPositionY(),
|
||||||
|
VOA_EMALON_RESTORE_POSITION.GetPositionZ(),
|
||||||
|
VOA_EMALON_RESTORE_POSITION.GetOrientation());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmalonFallFromFloorAction::isUseful()
|
bool EmalonFallFromFloorAction::isUseful()
|
||||||
|
|||||||
@@ -67,7 +67,8 @@ bool NewRpgBaseAction::MoveFarTo(WorldPosition dest)
|
|||||||
bot->GetName(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), bot->GetMapId(),
|
bot->GetName(), bot->GetPositionX(), bot->GetPositionY(), bot->GetPositionZ(), bot->GetMapId(),
|
||||||
dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.getMapId(), bot->GetZoneId(),
|
dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.getMapId(), bot->GetZoneId(),
|
||||||
zone_name);
|
zone_name);
|
||||||
return bot->TeleportTo(dest);
|
// return bot->TeleportTo(dest);
|
||||||
|
return TeleportToSafe(bot, dest); //[Fix] Avoid Silly teleport
|
||||||
}
|
}
|
||||||
|
|
||||||
float dis = bot->GetExactDist(dest);
|
float dis = bot->GetExactDist(dest);
|
||||||
|
|||||||
Reference in New Issue
Block a user