public override bool OnTrigger(Player player, AreaTriggerRecord areaTrigger) { if (player.GetQuestStatus(QuestIds.TheLonesomeWatcher) != QuestStatus.Incomplete) { return(false); } Creature stormforgedMonitor = ObjectAccessor.GetCreature(player, stormforgedMonitorGUID); if (stormforgedMonitor) { return(false); } Creature stormforgedEradictor = ObjectAccessor.GetCreature(player, stormforgedEradictorGUID); if (stormforgedEradictor) { return(false); } stormforgedMonitor = player.SummonCreature(CreatureIds.StormforgedMonitor, Misc.StormforgedMonitorPosition, TempSummonType.TimedDespawnOutOfCombat, 60000); if (stormforgedMonitor) { stormforgedMonitorGUID = stormforgedMonitor.GetGUID(); stormforgedMonitor.SetWalk(false); /// The npc would search an alternative way to get to the last waypoint without this unit state. stormforgedMonitor.AddUnitState(UnitState.IgnorePathfinding); stormforgedMonitor.GetMotionMaster().MovePath(CreatureIds.StormforgedMonitor * 100, false); } stormforgedEradictor = player.SummonCreature(CreatureIds.StormforgedEradictor, Misc.StormforgedEradictorPosition, TempSummonType.TimedDespawnOutOfCombat, 60000); if (stormforgedEradictor) { stormforgedEradictorGUID = stormforgedEradictor.GetGUID(); stormforgedEradictor.GetMotionMaster().MovePath(CreatureIds.StormforgedEradictor * 100, false); } return(true); }
bool StartMove(Creature creature) { if (path == null || path.Empty()) { return(false); } if (Stopped()) { return(true); } bool transportPath = creature.GetTransport() != null; if (isArrivalDone) { if ((currentNode == path.Count - 1) && !repeating) // If that's our last waypoint { float x = path[(int)currentNode].x; float y = path[(int)currentNode].y; float z = path[(int)currentNode].z; float o = path[(int)currentNode].orientation; if (!transportPath) { creature.SetHomePosition(x, y, z, o); } else { Transport trans = creature.GetTransport(); if (trans) { o -= trans.GetOrientation(); creature.SetTransportHomePosition(x, y, z, o); trans.CalculatePassengerPosition(ref x, ref y, ref z, ref o); creature.SetHomePosition(x, y, z, o); } else { transportPath = false; } // else if (vehicle) - this should never happen, vehicle offsets are const } creature.GetMotionMaster().Initialize(); return(false); } currentNode = (uint)((currentNode + 1) % path.Count); } WaypointData node = path.LookupByIndex((int)currentNode); isArrivalDone = false; creature.AddUnitState(UnitState.RoamingMove); MoveSplineInit init = new MoveSplineInit(creature); Position formationDest = new Position(node.x, node.y, node.z); //! If creature is on transport, we assume waypoints set in DB are already transport offsets if (transportPath) { init.DisableTransportPathTransformations(); ITransport trans = creature.GetDirectTransport(); if (trans != null) { trans.CalculatePassengerPosition(ref formationDest.posX, ref formationDest.posY, ref formationDest.posZ, ref formationDest.Orientation); } } init.MoveTo(formationDest.posX, formationDest.posY, formationDest.posZ); //! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table if (node.orientation != 0 && node.delay != 0) { init.SetFacing(formationDest.Orientation); } switch (node.movetype) { case WaypointMoveType.Land: init.SetAnimation(AnimType.ToGround); break; case WaypointMoveType.Takeoff: init.SetAnimation(AnimType.ToFly); break; case WaypointMoveType.Run: init.SetWalk(false); break; case WaypointMoveType.Walk: init.SetWalk(true); break; } init.Launch(); //Call for creature group update if (creature.GetFormation() != null && creature.GetFormation().getLeader() == creature) { creature.SetWalk(node.movetype != WaypointMoveType.Run); creature.GetFormation().LeaderMoveTo(formationDest.posX, formationDest.posY, formationDest.posZ); } return(true); }