Пример #1
0
        private bool GetBookmarks()
        {
            var methodName = "GetBookmarks";

            LogTrace(methodName);

            //First do pickup bookmark
            if (Core.StealthBot.Config.CargoConfig.PickupLocation.BookmarkLabel != String.Empty)
            {
                _pickupBookmark = null;

                var cachedBookMark = Core.StealthBot.BookMarkCache.FirstBookMarkStartingWith(
                    Core.StealthBot.Config.CargoConfig.PickupLocation.BookmarkLabel, false);

                if (cachedBookMark != null)
                {
                    _pickupBookmark = Core.StealthBot.BookMarkCache.GetBookMarkFor(cachedBookMark);
                }
            }

            //Next, dropoff bookmark
            if (Core.StealthBot.Config.CargoConfig.DropoffLocation.BookmarkLabel != String.Empty)
            {
                _dropoffBookmark = null;

                var cachedBookMark = Core.StealthBot.BookMarkCache.FirstBookMarkStartingWith(
                    Core.StealthBot.Config.CargoConfig.DropoffLocation.BookmarkLabel, false);

                _dropoffBookmark = Core.StealthBot.BookMarkCache.GetBookMarkFor(cachedBookMark);
            }

            return(!LavishScriptObject.IsNullOrInvalid(_pickupBookmark) && !LavishScriptObject.IsNullOrInvalid(_dropoffBookmark));
        }
Пример #2
0
 public bool FindBookMark(int BookMark, out Point Point)
 {
     int num1 = base.FindByIndex(BookMark);
     if (num1 >= 0)
     {
         IBookMark mark1 = (IBookMark) this[num1];
         Point = new Point(mark1.Char, mark1.Line);
         return true;
     }
     Point = new Point(0, 0);
     return false;
 }
Пример #3
0
            public int Compare(object x, object y)
            {
                IBookMark mark1  = (IBookMark)x;
                Point     point1 = (Point)y;
                int       num1   = mark1.Line - point1.Y;

                if (num1 == 0)
                {
                    num1 = mark1.Char - point1.X;
                }
                return(num1);
            }
Пример #4
0
            public int Compare(object x, object y)
            {
                IBookMark mark1  = (IBookMark)x;
                Point     point1 = ((IRange)y).StartPoint;
                Point     point2 = ((IRange)y).EndPoint;

                if ((mark1.Line < point1.Y) || ((mark1.Line == point1.Y) && (mark1.Char < point1.X)))
                {
                    return(-1);
                }
                if ((mark1.Line <= point2.Y) && ((mark1.Line != point2.Y) || (mark1.Char < point2.X)))
                {
                    return(0);
                }
                return(1);
            }
Пример #5
0
            public int Compare(object x, object y)
            {
                IBookMark mark1 = (IBookMark)x;
                IBookMark mark2 = (IBookMark)y;
                int       num1  = mark1.Line - mark2.Line;

                if (num1 == 0)
                {
                    num1 = mark1.Char - mark2.Char;
                }
                if (num1 == 0)
                {
                    num1 = mark1.Index - mark2.Index;
                }
                return(num1);
            }
Пример #6
0
 public void GotoBookMark(int BookMark)
 {
     int num1 = base.FindByIndex(BookMark);
     if (num1 >= 0)
     {
         IBookMark mark1 = (IBookMark) this[num1];
         this.owner.BeginUpdate(UpdateReason.Navigate);
         try
         {
             this.owner.State |= NotifyState.GotoBookMark;
             this.owner.MoveTo(mark1.Char, mark1.Line);
         }
         finally
         {
             this.owner.EndUpdate();
         }
     }
 }
Пример #7
0
 private void GotoBookMarkIndex(bool Direction)
 {
     int num1 = -1;
     if (Direction)
     {
         for (int num2 = 0; num2 < this.Count; num2++)
         {
             IBookMark mark1 = (IBookMark) this[num2];
             if ((mark1.Index == 0x7fffffff) && (mark1.Line > this.owner.Position.Y))
             {
                 num1 = num2;
                 break;
             }
         }
         if (num1 == -1)
         {
             for (int num3 = 0; num3 < this.Count; num3++)
             {
                 if (((IBookMark) this[num3]).Index == 0x7fffffff)
                 {
                     num1 = num3;
                     break;
                 }
             }
         }
     }
     else
     {
         for (int num4 = this.Count - 1; num4 >= 0; num4--)
         {
             IBookMark mark2 = (IBookMark) this[num4];
             if ((mark2.Index == 0x7fffffff) && (mark2.Line < this.owner.Position.Y))
             {
                 num1 = num4;
                 break;
             }
         }
         if (num1 == -1)
         {
             for (int num5 = this.Count - 1; num5 >= 0; num5--)
             {
                 if (((IBookMark) this[num5]).Index == 0x7fffffff)
                 {
                     num1 = num5;
                     break;
                 }
             }
         }
     }
     if ((num1 >= 0) && (num1 < this.Count))
     {
         IBookMark mark3 = (IBookMark) this[num1];
         this.owner.BeginUpdate(UpdateReason.Navigate);
         try
         {
             this.owner.State |= NotifyState.GotoBookMark;
             this.owner.MoveTo(mark3.Char, mark3.Line);
         }
         finally
         {
             this.owner.EndUpdate();
         }
     }
 }
Пример #8
0
 public void Assign(IBookMark Source)
 {
     this.Line  = Source.Line;
     this.Char  = Source.Char;
     this.Index = Source.Index;
 }
Пример #9
0
        public CachedBookMark(IEntityProvider entityProvider, bool isPlayerInStation, IBookMark bookMark)
        {
            Label         = bookMark.Label.TrimEnd('\t');
            Id            = bookMark.ID;
            ItemId        = bookMark.ItemID;
            SolarSystemId = bookMark.SolarSystemID;
            TypeId        = bookMark.TypeID;
            Type          = bookMark.Type;
            OwnerId       = bookMark.OwnerID;
            CreatorId     = bookMark.CreatorID;

            if (ItemId > 0 && entityProvider.EntityWrappersById.ContainsKey(ItemId))
            {
                var entity = entityProvider.EntityWrappersById[ItemId];
                X = entity.X;
                Y = entity.Y;
                Z = entity.Z;
            }
            else
            {
                if (!isPlayerInStation)
                {
                    try
                    {
                        X = bookMark.X;
                        Y = bookMark.Y;
                        Z = bookMark.Z;
                    }
                    catch (FormatException)
                    {
                        X = 0;
                        Y = 0;
                        Z = 0;
                    }
                }
                else
                {
                    X = 0;
                    Y = 0;
                    Z = 0;
                }
            }
        }