Ejemplo n.º 1
0
        public void AddWaypoint(uint id, float x, float y, float z, uint waitTime = 0)
        {
            Escort_Waypoint t = new Escort_Waypoint(id, x, y, z, waitTime);

            WaypointList.Add(t);
            ScriptWP = true;
        }
Ejemplo n.º 2
0
        void FillPointMovementListForCreature()
        {
            var movePoints = Global.ScriptMgr.GetPointMoveList(me.GetEntry());

            if (movePoints.Empty())
            {
                return;
            }

            foreach (var point in movePoints)
            {
                Escort_Waypoint wayPoint = new Escort_Waypoint(point.uiPointId, point.fX, point.fY, point.fZ, point.uiWaitTime);
                WaypointList.Add(wayPoint);
            }
        }
Ejemplo n.º 3
0
        bool SetNextWaypoint(uint pointId, bool setPosition, bool resetWaypointsOnFail)
        {
            if (!WaypointList.Empty())
            {
                WaypointList.Clear();
            }

            FillPointMovementListForCreature();

            if (WaypointList.Empty())
            {
                return(false);
            }

            int             size     = WaypointList.Count;
            Escort_Waypoint waypoint = new Escort_Waypoint(0, 0, 0, 0, 0);

            do
            {
                waypoint = WaypointList.First();
                WaypointList.RemoveAt(0);
                if (waypoint.Id == pointId)
                {
                    if (setPosition)
                    {
                        me.UpdatePosition(waypoint.X, waypoint.Y, waypoint.Z, me.GetOrientation());
                    }

                    CurrentWPIndex = 0;
                    return(true);
                }
            }while (!WaypointList.Empty());

            // we failed.
            // we reset the waypoints in the start; if we pulled any, reset it again
            if (resetWaypointsOnFail && size != WaypointList.Count)
            {
                if (!WaypointList.Empty())
                {
                    WaypointList.Clear();
                }

                FillPointMovementListForCreature();
            }

            return(false);
        }