public PathPoint(int x, int y, int z, int maxspeed, ePathType type) : base(x, y, z)
		{
			m_maxspeed = maxspeed;
			m_type = type;
			m_flag = false;
			m_waitTime = 0;
		}
        public override void Prepare(string[] splits)
        {
            if (splits.Length != 6)
            {
                throw new InvalidArgsNumberException(splits.Length, 6);
            }

            if (!Enum.TryParse(splits[1], out this._import))
            {
                throw new Exception($"Unable to recognize {splits[1]} serialization type");
            }

            this._type_from = EnumConverter.StringToPathType(splits[2]);
            if (this._type_from == ePathType.Invalid)
            {
                throw new Exception($"Path type {splits[2]} is an invalid type");
            }

            this._type_to = EnumConverter.StringToPathType(splits[3]);
            if (this._type_to == ePathType.Invalid)
            {
                throw new Exception($"Path type {splits[3]} is an invalid type");
            }

            this._path_from = splits[4];
            this._path_to   = splits[5];
        }
Example #3
0
        /// <summary>
        /// loads a path from the cache
        /// </summary>
        /// <param name="pathID">path to load</param>
        /// <returns>first pathpoint of path or null if not found</returns>
        public static PathPoint LoadPath(string pathID)
        {
            lock (LockObject)
            {
                if (m_pathCache.Count == 0)
                {
                    FillPathCache();
                }

                DBPath dbpath = null;

                if (m_pathCache.ContainsKey(pathID))
                {
                    dbpath = m_pathCache[pathID];
                }

                // even if path entry not found see if pathpoints exist and try to use it
                ePathType pathType = ePathType.Once;

                if (dbpath != null)
                {
                    pathType = (ePathType)dbpath.PathType;
                }

                SortedList <int, DBPathPoint> pathPoints = null;

                if (m_pathpointCache.ContainsKey(pathID))
                {
                    pathPoints = m_pathpointCache[pathID];
                }
                else
                {
                    pathPoints = new SortedList <int, DBPathPoint>();
                }

                PathPoint prev  = null;
                PathPoint first = null;

                foreach (DBPathPoint pp in pathPoints.Values)
                {
                    PathPoint p = new PathPoint(pp.X, pp.Y, pp.Z, pp.MaxSpeed, pathType);
                    p.WaitTime = pp.WaitTime;

                    if (first == null)
                    {
                        first = p;
                    }

                    p.Prev = prev;
                    if (prev != null)
                    {
                        prev.Next = p;
                    }

                    prev = p;
                }

                return(first);
            }
        }
Example #4
0
 public PathPoint(int x, int y, int z, int maxspeed, ePathType type) : base(x, y, z)
 {
     m_maxspeed = maxspeed;
     m_type     = type;
     m_flag     = false;
     m_waitTime = 0;
 }
Example #5
0
 public PathPoint(float x, float y, float z, int maxspeed, ePathType type)
 {
     Position   = new Vector3(x, y, z);
     m_maxspeed = maxspeed;
     m_type     = type;
     m_flag     = false;
     m_waitTime = 0;
 }
Example #6
0
 public aiPath(ePathType in_type, double in_offset, double in_height, double in_width, int in_direction)
 {
     type      = (int)in_type;
     offset    = in_offset;
     height    = in_height;
     width     = in_width;
     direction = in_direction;
 }
        /// <summary>
        /// Method to retrieve the Patrol Path from the Patrol ID and Component
        ///
        /// We need this because we store this all using our offset system
        /// </summary>
        /// <param name="pathID">The path ID, which is the Patrol ID</param>
        /// <param name="component">The Component object</param>
        /// <returns>The Patrol path</returns>
        public static PathPoint LoadPatrolPath(string pathID, GameKeepComponent component)
        {
            SortedList sorted = new SortedList();

            pathID.Replace('\'', '/'); // we must replace the ', found no other way yet
            DBPath dbpath = GameServer.Database.SelectObjects <DBPath>("`PathID` = @PathID", new QueryParameter("@PathID", pathID)).FirstOrDefault();
            IList <DBPathPoint> pathpoints = null;
            ePathType           pathType   = ePathType.Once;

            if (dbpath != null)
            {
                pathType = (ePathType)dbpath.PathType;
            }

            if (pathpoints == null)
            {
                pathpoints = GameServer.Database.SelectObjects <DBPathPoint>("`PathID` = @PathID", new QueryParameter("@PathID", pathID));
            }

            foreach (DBPathPoint point in pathpoints)
            {
                sorted.Add(point.Step, point);
            }

            PathPoint prev  = null;
            PathPoint first = null;

            for (int i = 0; i < sorted.Count; i++)
            {
                DBPathPoint pp = (DBPathPoint)sorted.GetByIndex(i);
                PathPoint   p  = new PathPoint(pp.X, pp.Y, pp.Z, pp.MaxSpeed, pathType);

                int x, y;
                LoadXY(component, pp.X, pp.Y, out x, out y);
                p.X = x;
                p.Y = y;
                p.Z = component.AbstractKeep.Z + p.Z;

                p.WaitTime = pp.WaitTime;

                if (first == null)
                {
                    first = p;
                }

                p.Prev = prev;
                if (prev != null)
                {
                    prev.Next = p;
                }

                prev = p;
            }

            return(first);
        }
		public PathPoint(Point3D p, int maxspeed, ePathType type) : this(p.X,  p.Y,  p.Z, maxspeed, type) {}
Example #9
0
 public PathPoint(Vector3 p, int maxspeed, ePathType type) : this(p.X, p.Y, p.Z, maxspeed, type)
 {
 }
Example #10
0
 public PathPoint(Point3D p, int maxspeed, ePathType type) : this(p.X, p.Y, p.Z, maxspeed, type)
 {
 }
 public RequestStartUploadHeader()
 {
     this.PathType = ePathType.File;
 }
Example #12
0
 public DBPath(string pathid, ePathType type)
 {
     m_pathID = pathid;
     m_type = (int)type;
 }