コード例 #1
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;
		}
コード例 #2
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];
        }
コード例 #3
0
ファイル: MovementMgr.cs プロジェクト: Los-Ojos/DOLSharp-1127
        /// <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);
            }
        }
コード例 #4
0
ファイル: PathPoint.cs プロジェクト: Los-Ojos/DOLSharp-1127
 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;
 }
コード例 #5
0
ファイル: PathPoint.cs プロジェクト: JVirant/DOLSharp
 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;
 }
コード例 #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;
 }
コード例 #7
0
        /// <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);
        }
コード例 #8
0
		public PathPoint(Point3D p, int maxspeed, ePathType type) : this(p.X,  p.Y,  p.Z, maxspeed, type) {}
コード例 #9
0
ファイル: PathPoint.cs プロジェクト: JVirant/DOLSharp
 public PathPoint(Vector3 p, int maxspeed, ePathType type) : this(p.X, p.Y, p.Z, maxspeed, type)
 {
 }
コード例 #10
0
ファイル: PathPoint.cs プロジェクト: Los-Ojos/DOLSharp-1127
 public PathPoint(Point3D p, int maxspeed, ePathType type) : this(p.X, p.Y, p.Z, maxspeed, type)
 {
 }
コード例 #11
0
 public RequestStartUploadHeader()
 {
     this.PathType = ePathType.File;
 }
コード例 #12
0
ファイル: Path.cs プロジェクト: uvbs/Dawn-of-Light-core
 public DBPath(string pathid, ePathType type)
 {
     m_pathID = pathid;
     m_type = (int)type;
 }