mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 10:56:38 +01:00
Core/SAI: Fixed SMART_ACTION_MOVE_TO_POS using target coordinates as destination if requested WorldObject target was not found
(cherry picked from commit 888ccd1e44)
# Conflicts:
# src/server/game/AI/SmartScripts/SmartScript.cpp
This commit is contained in:
14
sql/updates/world/master/2024_02_15_00_world.sql
Normal file
14
sql/updates/world/master/2024_02_15_00_world.sql
Normal file
@@ -0,0 +1,14 @@
|
||||
UPDATE `smart_scripts` SET `target_type`=8 WHERE
|
||||
(`entryorguid`=137300 AND `source_type`=9 AND `id`=19 AND `link`=0) OR
|
||||
(`entryorguid`=137300 AND `source_type`=9 AND `id`=20 AND `link`=0) OR
|
||||
(`entryorguid`=1433800 AND `source_type`=9 AND `id`=4 AND `link`=0) OR
|
||||
(`entryorguid`=2129100 AND `source_type`=9 AND `id`=1 AND `link`=0) OR
|
||||
(`entryorguid`=2129100 AND `source_type`=9 AND `id`=13 AND `link`=0) OR
|
||||
(`entryorguid`=2711300 AND `source_type`=9 AND `id`=1 AND `link`=0) OR
|
||||
(`entryorguid`=2711300 AND `source_type`=9 AND `id`=3 AND `link`=0) OR
|
||||
(`entryorguid`=2711400 AND `source_type`=9 AND `id`=1 AND `link`=0) OR
|
||||
(`entryorguid`=2711400 AND `source_type`=9 AND `id`=3 AND `link`=0) OR
|
||||
(`entryorguid`=2711500 AND `source_type`=9 AND `id`=1 AND `link`=0) OR
|
||||
(`entryorguid`=2711600 AND `source_type`=9 AND `id`=3 AND `link`=0) OR
|
||||
(`entryorguid`=2875000 AND `source_type`=9 AND `id`=3 AND `link`=0) OR
|
||||
(`entryorguid`=3019000 AND `source_type`=9 AND `id`=13 AND `link`=0);
|
||||
@@ -1443,29 +1443,11 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
WorldObject* target = nullptr;
|
||||
|
||||
/*if (e.GetTargetType() == SMART_TARGET_CREATURE_RANGE || e.GetTargetType() == SMART_TARGET_CREATURE_GUID ||
|
||||
e.GetTargetType() == SMART_TARGET_CREATURE_DISTANCE || e.GetTargetType() == SMART_TARGET_GAMEOBJECT_RANGE ||
|
||||
e.GetTargetType() == SMART_TARGET_GAMEOBJECT_GUID || e.GetTargetType() == SMART_TARGET_GAMEOBJECT_DISTANCE ||
|
||||
e.GetTargetType() == SMART_TARGET_CLOSEST_CREATURE || e.GetTargetType() == SMART_TARGET_CLOSEST_GAMEOBJECT ||
|
||||
e.GetTargetType() == SMART_TARGET_OWNER_OR_SUMMONER || e.GetTargetType() == SMART_TARGET_ACTION_INVOKER ||
|
||||
e.GetTargetType() == SMART_TARGET_CLOSEST_ENEMY || e.GetTargetType() == SMART_TARGET_CLOSEST_FRIENDLY ||
|
||||
e.GetTargetType() == SMART_TARGET_SELF || e.GetTargetType() == SMART_TARGET_STORED)*/
|
||||
{
|
||||
// we want to move to random element
|
||||
if (!targets.empty())
|
||||
target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
}
|
||||
// we want to move to random element
|
||||
if (!targets.empty())
|
||||
target = Trinity::Containers::SelectRandomContainerElement(targets);
|
||||
|
||||
if (!target)
|
||||
{
|
||||
G3D::Vector3 dest(e.target.x, e.target.y, e.target.z);
|
||||
if (e.action.moveToPos.transport)
|
||||
if (TransportBase* trans = me->GetDirectTransport())
|
||||
trans->CalculatePassengerPosition(dest.x, dest.y, dest.z);
|
||||
|
||||
me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, dest.x, dest.y, dest.z, e.action.moveToPos.disablePathfinding == 0);
|
||||
}
|
||||
else
|
||||
if (target)
|
||||
{
|
||||
float x, y, z;
|
||||
target->GetPosition(x, y, z);
|
||||
@@ -1473,6 +1455,16 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
target->GetContactPoint(me, x, y, z, e.action.moveToPos.ContactDistance);
|
||||
me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, x + e.target.x, y + e.target.y, z + e.target.z, e.action.moveToPos.disablePathfinding == 0);
|
||||
}
|
||||
|
||||
if (e.GetTargetType() != SMART_TARGET_POSITION)
|
||||
break;
|
||||
|
||||
Position dest(e.target.x, e.target.y, e.target.z);
|
||||
if (e.action.moveToPos.transport)
|
||||
if (TransportBase* trans = me->GetDirectTransport())
|
||||
trans->CalculatePassengerPosition(dest.m_positionX, dest.m_positionY, dest.m_positionZ);
|
||||
|
||||
me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, dest, e.action.moveToPos.disablePathfinding == 0);
|
||||
break;
|
||||
}
|
||||
case SMART_ACTION_ENABLE_TEMP_GOBJ:
|
||||
|
||||
Reference in New Issue
Block a user