Ejemplo n.º 1
0
        protected override void ExecuteAction()
        {
            var me = new Me();
            var directionalScanner = me.Ship.Scanners.Directional;
            InnerSpace.Echo("Scanners is valid: " + me.Ship.Scanners.IsValid);
           
            InnerSpace.Echo("DScanner is valid: " + directionalScanner.IsValid);
            InnerSpace.Echo("SystemScanner is valid: " + me.Ship.Scanners.System.IsValid);

            if (directionalScanner.IsValid)
            {
                var angle = defaultAngle;
                var range = defaultRange;

                directionalScanner.StartScan(angle, range);
            }

            //var results = directionalScanner.GetScanResults(angle, range);

            //InnerSpaceAPI.InnerSpace.Echo(results.Count.ToString());

            ////foreach (var directionalScannerResult in results)
            ////{
            ////    InnerSpaceAPI.InnerSpace.Echo(directionalScannerResult.Name);
            ////}
        }
Ejemplo n.º 2
0
        private static void Pulse(object sender, LSEventArgs e)
        {
            using (new FrameLock(true))
            {
                if (DateTime.Now > NextPulse)
                {
                    DebugUI.Text = "VNI - " + Me.Name + " " + m_RoutineController.ActiveRoutine + " " + Constants.VERSION + " " + VNI.Me.ToEntity.Type;

                    NextPulse = DateTime.Now.AddSeconds(PulseRate);
                    Eve       = new EVE.ISXEVE.EVE();
                    Me        = new EVE.ISXEVE.Me();
                    MyShip    = new EVE.ISXEVE.Ship();

                    //Update standings
                    if (!refreshCompleted)
                    {
                        refreshCompleted = true;
                        Initialise();
                    }

                    if (DateTime.Now > EndTime)
                    {
                        f_Anomalies.lastAnomaly = true;
                    }



                    if (f_Ship.CheckIfCapsule())
                    {
                        VNI.DebugUI.NewConsoleMessage("No ship, staying docked!");
                        InCapsule = true;
                    }
                    //Update shield Percentage label every pulse
                    if (VNI.Me.InSpace)
                    {
                        DebugUI.updateShieldPctLabel((int)f_Ship.shieldPct());
                    }

                    //Check if local is clear every pulse
                    if (!f_Social.isSafe())
                    {
                        m_RoutineController.ActiveRoutine = Routine.Flee;
                    }
                    //If shield pct is low flee station
                    if (f_Ship.shieldPct() < 30)
                    {
                        m_RoutineController.ActiveRoutine = Routine.Flee;
                    }

                    //If bot is not paused begin ratting
                    if (!Paused)
                    {
                        b_Ratting.Pulse();
                        DebugUI.updateTimeAndDateLabel(NextPulse);
                    }
                }
                return;
            }
        }
Ejemplo n.º 3
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     using (new FrameLock(true))
     {
         EVE.ISXEVE.Me     me     = new EVE.ISXEVE.Me();
         EVE.ISXEVE.MyShip myship = new EVE.ISXEVE.MyShip();
         foreach (Item i in me.GetHangarItems())
         {
             if (toMove.Contains(i.TypeID))
             {
                 i.MoveTo(myship.ID, "CargoHold");
                 return;
             }
         }
         timer1.Stop();
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Get the information of the character.
        /// </summary>
        public bool LoadCharacterInfo()
        {
            Me me;
            using (new FrameLock(true))
            {
                EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE();

                // me is not persistent, we can't just keep a static reference somewhere,have to renew every frame;
                me = new Me();

                name = me.Name;
                currentStationID = me.StationID;

                // TODO: Support remote modify in future.
                daytradingLevel = 0;
            }

            bool succeed = !string.IsNullOrEmpty(Name);

            return succeed;
        }
        /// <summary>
        ///   Refreshes the and get active pilot.
        /// </summary>
        /// <returns></returns>
        public string RefreshAndGetActivePilot()
        {
            Frame.Wait(true);

              ActivePilot = new Me().Name;

              Frame.Unlock();

              return string.IsNullOrEmpty(ActivePilot) ? "Unknown Pilot Name" : ActivePilot;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Get all skills our character knows.
        /// </summary>
        /// <returns></returns>
        public static List<Skill> GetSkills()
        {
            Me me = new Me();

            if (!LavishScriptObject.IsNullOrInvalid(me))
                return new Me().GetSkills();

            return new List<Skill>();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Return a skill object based on the skill name parameter.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static Skill GetSkill(string name)
        {
            Me me = new Me();

            if (!LavishScriptObject.IsNullOrInvalid(me))
                return new Me().Skill(name);

            return new Skill(null);
        }
Ejemplo n.º 8
0
        public void Modify(double newPrice)
        {
            Debug.Assert(newPrice > 0);

            Log.WriteLog("Trying to confirm order " + this.ID.ToString() + ": \"" + this.Type.ToString() + "\" before modifying.");

            List<MyOrder> retrivedOrders = null;
            Me me;
            bool success;
            using (new FrameLock(true))
            {
                EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE();

                // me is not persistent, we can't just keep a static reference somewhere, have to renew every frame;
                me = new Me();
                success = me.UpdateMyOrders();
            }

            if (success)
            {
                Log.WriteLog("Fired update order request, wait to get result.");

                int counter = 0;

                while (retrivedOrders == null && counter < 100)
                {
                    Frame.Wait(false);
                    using (new FrameLock(true))
                    {
                        counter++;
                        // me is not persistent, we can't just keep a static reference somewhere,have to renew every frame;
                        me = new Me();

                        EVE.ISXEVE.Character.OrderType orderType = this.OrderType == OrderType.Buy ? EVE.ISXEVE.Character.OrderType.Buy : EVE.ISXEVE.Character.OrderType.Sell;

                        // IMPORTANT: This is shallow copy, we need to finish all DEEP copy value operations while locked, otherwise the memory will be flushed;
                        retrivedOrders = me.GetMyOrders(orderType, this.TypeID);

                        if (retrivedOrders != null)
                        {
                            if (MarketOrderSet.ValidateOrderData(retrivedOrders))
                            {
                                MyOrder orderToModify = null;

                                foreach (MyOrder o in retrivedOrders)
                                {
                                    if (o.ID == ID)
                                    {
                                        orderToModify = o;
                                        break;
                                    }
                                }

                                if (orderToModify != null)
                                {
                                    Log.WriteLog("Confirmed order with (" + counter.ToString() + ") attempts.");

                                    DateTime lastModifiedTime = new System.DateTime(1601, 1, 1).AddSeconds(orderToModify.TimeStampWhenIssued / 10000000);

                                    //real cool down takes 5 minutes
                                    if (lastModifiedTime.AddMilliseconds(301000) < System.DateTime.UtcNow)
                                    {
                                        orderToModify.Modify(newPrice);

                                        Price = newPrice;
                                        ModifyCoolDownEndTime = System.DateTime.UtcNow.AddMilliseconds(_config.RandomizedOrderModifyIntervalInMilliSec);
                                        //I think the date, time and timestamp dont need updating.

                                        Log.WriteLog("Order " + this.ID.ToString() + ": \"" + this.Type.ToString() + "\" modified");
                                    }
                                    else
                                    {
                                        ModifyCoolDownEndTime = lastModifiedTime.AddMilliseconds(_config.RandomizedOrderModifyIntervalInMilliSec);
                                        Log.WriteLog("Order cooldown not finished yet. Job \"Modify\" cancelled.");
                                    }
                                }
                                else
                                {
                                    Log.WriteLog("Failed to find order to modify with (" + counter.ToString() + ") attempts. Job \"Modify\" cancelled.");
                                }
                            }
                            else
                            {
                                Log.WriteLog("Found invalid data in retrived order, retrying.");
                                // Enter next loop;
                                retrivedOrders = null;
                            }
                        }
                    }
                }
            }
            else
            {
                Log.WriteLog("Failed to send update order request. Job \"Modify\" cancelled.");
            }
        }
Ejemplo n.º 9
0
        public void LoadMarketOrderInfo()
        {
            Log.WriteLog("Trying to load market orders.");

            List<MyOrder> retrivedOrders = null;
            Me me;
            bool success;
            using (new FrameLock(true))
            {
                EVE.ISXEVE.EVE eve = new EVE.ISXEVE.EVE();

                // me is not persistent, we can't just keep a static reference somewhere, have to renew every frame;
                me = new Me();

                success = me.UpdateMyOrders();
            }

            if (success)
            {
                Log.WriteLog("Fired update order request, wait to get result.");

                int counter = 0;

                while (retrivedOrders == null && counter < 100)
                {
                    Frame.Wait(false);
                    using (new FrameLock(true))
                    {
                        counter++;
                        // me is not persistent, we can't just keep a static reference somewhere,have to renew every frame;
                        me = new Me();

                        // IMPORTANT: This is shallow copy, we need to finish all DEEP copy value operations while locked, otherwise the memory will be flushed;
                        retrivedOrders = me.GetMyOrders();

                        if (retrivedOrders != null)
                        {
                            if (ValidateOrderData(retrivedOrders))
                            {
                                _combineNewOrder(retrivedOrders);
                            }
                            else
                            {
                                Log.WriteLog("Found invalid data in retrived order, retrying.");
                                // Enter next loop;
                                retrivedOrders = null;
                            }
                        }
                    }
                }

                if (retrivedOrders != null)
                {
                    Log.WriteLog("Got " + retrivedOrders.Count.ToString() + " orders with (" + counter.ToString() + ") attempts.");
                }
                else
                {
                    Log.WriteLog("Failed to load orders with (" + counter.ToString() + ") attempts.");
                }
            }
            else
            {
                Log.WriteLog("Failed to send update order request.");
            }

            Log.WriteLog("Done loading market orders.");
        }