diff options
-rw-r--r-- | sql/updates/world/master/2024_02_15_00_world.sql | 14 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScript.cpp | 37 |
2 files changed, 30 insertions, 21 deletions
diff --git a/sql/updates/world/master/2024_02_15_00_world.sql b/sql/updates/world/master/2024_02_15_00_world.sql new file mode 100644 index 00000000000..85ccb8d117a --- /dev/null +++ b/sql/updates/world/master/2024_02_15_00_world.sql @@ -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); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index c1e398bc37f..a7745d62f80 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1466,28 +1466,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)*/ - { - // we want to move to random element - if (!targets.empty()) - target = Trinity::Containers::SelectRandomContainerElement(targets); - } - - if (!target) - { - 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); + // we want to move to random element + if (!targets.empty()) + target = Trinity::Containers::SelectRandomContainerElement(targets); - me->GetMotionMaster()->MovePoint(e.action.moveToPos.pointId, dest, e.action.moveToPos.disablePathfinding == 0); - } - else + if (target) { float x, y, z; target->GetPosition(x, y, z); @@ -1495,6 +1478,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: @@ -1866,6 +1859,8 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u target->GetContactPoint(me, x, y, z, e.action.jump.ContactDistance); pos = Position(x + e.target.x, y + e.target.y, z + e.target.z); } + else if (e.GetTargetType() != SMART_TARGET_POSITION) + break; if (e.action.jump.Gravity || e.action.jump.UseDefaultGravity) { |