Пример #1
0
 static void Main(string[] args)
 {
     if (args == null || args.Length == 0)
     {
         InnerSpace.Echo(" ");
         InnerSpace.Echo("AttachWindbg v1 by CyberTech");
         InnerSpace.Echo(" Description:");
         InnerSpace.Echo("    Attaches windbg to a launched process immediately after Inner Space");
         InnerSpace.Echo("    starts it, without additional clicks");
         InnerSpace.Echo(" Instructions:");
         InnerSpace.Echo("    1) Place the .cs and .xml in Scripts\\AttachWindbg\\");
         InnerSpace.Echo("    2) Add the following to Pre-Startup for the game you wish to attach:");
         InnerSpace.Echo("        \"<Setting Name=\"AttachWindbg\">execute ${If[${LavishScript.Executable.Find[ExeFile.exe](exists)},run AttachWindbg exefile.exe]}</Setting>\"");
         InnerSpace.Echo("    3) Be sure to updat ethe executable name in the above command");
         InnerSpace.Echo(" ");
         InnerSpace.Echo("Error: Executable to attach to must be specified on the command line");
         return;
     }
     try
     {
         ProcessStartInfo startInfo = new ProcessStartInfo("C:\\Program Files (x86)\\Windows Kits\\8.0\\Debuggers\\x86\\windbg.exe", "-pb -loga d:\\windbg.log -p " + args[0]);
         System.Diagnostics.Process.Start(startInfo);
     }
     catch (Exception e)
     {
         ProcessStartInfo startInfo = new ProcessStartInfo("C:\\Program Files (x86)\\Debugging Tools for Windows (x86)\\windbg.exe", "-pb -loga d:\\windbg.log -p " + args[0]);
         System.Diagnostics.Process.Start(startInfo);
     }
 }
Пример #2
0
        /* Pulse method that will execute on our OnFrame, which in turn executes on the lavishscript OnFrame */
        static void ISXEVE_OnFrame(object sender, LSEventArgs e)
        {
            using (new FrameLock(true))
            {
                /* Update my Me reference */
                /* Note that this is being updated both OnFrame and in a FrameLock, this is how it has to be done. */
                Globals.Me = new EVE.ISXEVE.Me();

                InnerSpace.Echo("Your character's name is " + Globals.Me.Name);
                InnerSpace.Echo("Your active ship has " + Globals.Me.Ship.HighSlots + " high slots.");
                InnerSpace.Echo("Your active ship has " + Globals.Me.Ship.MediumSlots + " medium slots.");
                InnerSpace.Echo("Your active ship has " + Globals.Me.Ship.LowSlots + " low slots.");
                if (Globals.Me.InStation)
                {
                    // Uncomment the line below to actually undock
                    //Globals.Me.Execute(ExecuteCommand.CmdExitStation);
                }
                else
                {
                    InnerSpace.Echo("You are in space.");
                }

                LavishScript.Events.DetachEventTarget("ISXEVE_OnFrame", ISXEVE_OnFrame);
                InnerSpace.Echo("Detached from ISXEVE_OnFrame");
            }
        }
Пример #3
0
        private static void SysScan()
        {
            Frame.Wait(true);

            var ext = new EVE.ISXEVE.Extension();
            var eve = ext.EVE();
            var me  = ext.Me;

            var sysScanner = me.Ship.Scanners.System;

            var sigs = sysScanner.GetSignatures();

            foreach (var sig in sigs)
            {
                InnerSpace.Echo(sig.Name + " " + sig.IsWarpable + " " + sig.Difficulty + " " + sig.Deviation);
            }

            var anoms = sysScanner.GetAnomalies();

            foreach (var anom in anoms)
            {
                InnerSpace.Echo(anom.Name);
            }

            eve.Execute(ExecuteCommand.CmdToggleMap);

            Frame.Unlock();
        }
Пример #4
0
        private void btnMoveItemsTo_Click(object sender, EventArgs e)
        {
            InnerSpace.Echo("ISXEVEWrapperTest (MoveItemsTo): Begin");
            using (new FrameLock(true))
            {
                Extension Ext = new Extension();

                // move all the items from your ship to the hangar

                /*
                 *                              List<Item> itemList;
                 *                              List<long> itemIdxList;
                 *                              itemList = Ext.Me.Ship.GetCargo();
                 *
                 *                              InnerSpace.Echo("You have " + itemList.Count + " items in your ship's cargo bay.");
                 *
                 *                              itemIdxList = new List<long>(itemList.Count);
                 *                              foreach (Item item in itemList)
                 *                              {
                 *                                      itemIdxList.Add(item.ID);
                 *                              }
                 *
                 *                              InnerSpace.Echo("Moving " + itemIdxList.Count + " items in your hangar.");
                 *                              Ext.EVE().MoveItemsTo(itemIdxList, "MyStationHangar", "Hangar");
                 */
            }
            InnerSpace.Echo("ISXEVEWrapperTest (MoveItemsTo): End");
        }
Пример #5
0
        public static void Log(string line)
        {
            InnerSpace.Echo(string.Format("{0:HH:mm:ss} {1}", DateTime.Now, line));
            Cache.Instance.ExtConsole += string.Format("{0:HH:mm:ss} {1}", DateTime.Now, line + "\r\n");
            Cache.Instance.ConsoleLog += string.Format("{0:HH:mm:ss} {1}", DateTime.Now, line + "\r\n");
            if (Settings.Instance.SaveConsoleLog)
            {
                if (!Cache.Instance.ConsoleLogOpened)
                {
                    if (Settings.Instance.ConsoleLogPath != null && Settings.Instance.ConsoleLogFile != null)
                    {
                        if (!Directory.Exists(Settings.Instance.ConsoleLogPath))
                        {
                            Directory.CreateDirectory(Settings.Instance.ConsoleLogPath);
                        }

                        line = "Questor: Writing to Daily Console Log ";
                        InnerSpace.Echo(string.Format("{0:HH:mm:ss} {1}", DateTime.Now, line));
                        Cache.Instance.ExtConsole      += string.Format("{0:HH:mm:ss} {1}", DateTime.Now, line + "\r\n");
                        Cache.Instance.ConsoleLog      += string.Format("{0:HH:mm:ss} {1}", DateTime.Now, line + "\r\n");
                        Cache.Instance.ConsoleLogOpened = true;
                        line = "";
                    }
                }
                if (Cache.Instance.ConsoleLogOpened)
                {
                    File.AppendAllText(Settings.Instance.ConsoleLogFile, Cache.Instance.ConsoleLog);
                    Cache.Instance.ConsoleLog = null;
                }
            }
        }
Пример #6
0
        private void btn_MyOrderTest_Click(object sender, EventArgs e)
        {
            Extension Ext;

            InnerSpace.Echo("ISXEVEWrapperTest (MyOrder): Begin");
            using (new FrameLock(true))
            {
                Ext = new Extension();

                Ext.Me.UpdateMyOrders();
            }
            System.Threading.Thread.Sleep(1000);
            using (new FrameLock(true))
            {
                List <MyOrder> orderList;
                orderList = Ext.Me.GetMyOrders();

                InnerSpace.Echo("You have " + orderList.Count + " open orders.");

                foreach (MyOrder order in orderList)
                {
                    InnerSpace.Echo("  - " + order.Name + ": " + order.QuantityRemaining +
                                    " @ " + order.Price + " ISK.");
                }
            }
            InnerSpace.Echo("ISXEVEWrapperTest (MyOrder): End");
        }
Пример #7
0
        static void Main()
        {
            /* This doesn't do anything useful except give me a place to test wrapper functions -- CyberTech */

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());

            InnerSpace.Echo("ISXEVEWrapperTest: Begin");

            using (new FrameLock(true))
            {
                LavishScriptObject _Me = LavishScript.Objects.GetObject("Me");
                InnerSpace.Echo("Name: " + _Me.GetMember("Name"));

                //Extension Ext = new Extension();
                //InnerSpace.Echo("Name: " + Ext.Me.Name);
                //    InnerSpace.Echo("Nearest Stargate (fails in station): " + Ext.Entity("Stargate").Name);

                //    InnerSpace.Echo("Undocking Method 1...");
                //    //Ext.EVE().Execute(ExecuteCommand.CmdExitStation);

                //    InnerSpace.Echo("Undocking Method 2...");
                //    //Ext.EVE().Execute("CmdExitStation");

                //    InnerSpace.Echo(Ext.ISXEVE().SecsToString(500));

                //Extension Ext = new Extension();
                //InnerSpace.Echo(Ext.Me.Name.ToString(CultureInfo.CurrentCulture));
                //InnerSpace.Echo(Me.Ship.ToString(CultureInfo.CurrentCulture));
            }
            InnerSpace.Echo("ISXEVEWrapperTest: End");
        }
Пример #8
0
        /* Pulse method that will execute on our OnFrame, which in turn executes on the lavishscript OnFrame */

        private static void ISXEVE_OnFrame(object sender, LSEventArgs e)
        {
            //using (new FrameLock(true))
            //{
            //  var ext = new Extension();
            //  var eve = ext.EVE();
            //  var me = ext.Me;

            //  TestGetLocalGridEntities(me, eve, logger);
            //  //CombatHelper.ActivateModules(me,eve, new EngageRules() {UseRepairer = false});
            //}

            using (new FrameLock(true))
            {
                var ext = new Extension();
                var eve = ext.EVE();
                var me  = ext.Me;

                InnerSpace.Echo("Your character's name is " + me.Name);
                InnerSpace.Echo("Your active ship has " + me.Ship.HighSlots + " high slots.");
                InnerSpace.Echo("Your active ship has " + me.Ship.MediumSlots + " medium slots.");
                InnerSpace.Echo("Your active ship has " + me.Ship.LowSlots + " low slots.");

                TestGetLocalGridEntities(me, eve, _logger);

                LavishScript.Events.DetachEventTarget("ISXEVE_OnFrame", ISXEVE_OnFrame);
            }
        }
Пример #9
0
        /// <summary>
        ///   Does the work.
        /// </summary>
        /// <param name="myMe">My me.</param>
        /// <param name="myEVE">My eve.</param>
        private void DoWork(Character myMe, EVE.ISXEVE.EVE myEVE)
        {
            if (CurrentBotState == BotState.Active)
            {
                try
                {
                    var allEntities = EntityRepository.GetLocalGridEntities(myMe, myEVE).ToArray();

                    var engageableTargets = CombatHelper.FindEngageableTargets(myMe, myEVE, allEntities, EngageRules).ToList();

                    Entities = new ObservableCollection <EntityViewModel>(allEntities);

                    foreach (var engageableTarget in engageableTargets)
                    {
                        logger.Log(engageableTarget.EntityName + " " + " Corp: " + engageableTarget.Entity.Owner.Corp.Name + " " + engageableTarget.Entity.Owner.Corp.ID +
                                   " AllyId: " + engageableTarget.Entity.Owner.AllianceID + " isFleet" + engageableTarget.Entity.FleetTag);
                    }

                    CombatHelper.Engage(myMe, myEVE, engageableTargets, EngageRules);
                }

                catch (Exception exc)
                {
                    InnerSpace.Echo("DO WORK ERROR: " + exc.Message);
                }
            }
        }
Пример #10
0
 static void Main(string[] args)
 {
     if (args == null || args.Length == 0)
     {
         InnerSpace.Echo(" ");
         InnerSpace.Echo("SetProcessPriority v1 by CyberTech");
         InnerSpace.Echo(" Description:");
         InnerSpace.Echo("    Set the app priority for an app just launched by Inner Space");
         InnerSpace.Echo(" Instructions:");
         InnerSpace.Echo("    1) Place the .cs and .xml in Scripts\\SetProcessPriority\\");
         InnerSpace.Echo("    2) Add the following to Pre-Startup for the game you wish to attach:");
         InnerSpace.Echo("        \"<Setting Name=\"SetProcessPriority\">execute ${If[${LavishScript.Executable.Find[ExeFile.exe](exists)},run SetProcessPriority ${System.APICall[${System.GetProcAddress[\"kernel32.dll\",\"GetCurrentProcessId\"]}]}]}</Setting>\"");
         InnerSpace.Echo("    3) Be sure to update the executable name (ExeFile.exe) in the above command");
         InnerSpace.Echo(" ");
         InnerSpace.Echo("Error: Executable to attach to must be specified on the command line");
         return;
     }
     try
     {
         // See http://msdn.microsoft.com/en-us/library/system.diagnostics.processpriorityclass%28v=vs.110%29.aspx for priorities
         Int32 pid = Int32.parse(args0);
         System.Diagnostics.Process.GetProcessById(pid).PriorityClass = System.Diagnostics.ProcessPriorityClass.Normal;
     }
     catch (Exception e)
     {
         InnerSpace.Echo("SetProcessPriority Error: Unable to set priority");
     }
 }
Пример #11
0
        static void Main()
        {
            InnerSpace.Echo("Attaching to ISXEVE_OnFrame");
            LavishScript.Events.AttachEventTarget("ISXEVE_OnFrame", ISXEVE_OnFrame);

            InnerSpace.Echo("Pausing for 1 minute...");
            System.Threading.Thread.Sleep(60000);
            InnerSpace.Echo("Exiting program.");

            return;
        }
Пример #12
0
        static void Main()
        {
            LavishVMAPI.Frame.Lock();

            Extension Ext = new Extension();

            string MyNameIs = "My Name is " + Ext.Me().FName + " " + Ext.Me().LName;

            InnerSpace.Echo(MyNameIs);

            LavishVMAPI.Frame.Unlock();
            return;
        }
Пример #13
0
        public void vgevent_IncomingText(object sender, LSEventArgs e)
        {
            string Text          = e.Args[0];
            string ChannelNumber = e.Args[1];
            string ChannelName   = e.Args[2];

            // Uncomment these two lines if you wish to see it in action.
            string Output = "Incoming Text -> [" + Text + "]  {Channel: " + ChannelName + " (" + ChannelNumber + ")}";

            InnerSpace.Echo(Output);

            return;
        }
Пример #14
0
        private static void echoLogToInnerSpaceConsole(Object evt)
        {
            Debug.Assert((evt is string) || (evt is Exception));

            if (evt is string)
            {
                InnerSpace.Echo(evt as string);
            }
            else if (evt is Exception)
            {
                InnerSpace.Echo("Exception: " + (evt as Exception).Message);
            }
        }
Пример #15
0
        /// <summary>
        ///   Gets the local grid entities.
        /// </summary>
        /// <param name="myMe"></param>
        /// <param name="myEVE">My eve.</param>
        /// <returns></returns>
        public static IEnumerable <EntityViewModel> GetLocalGridEntities(Character myMe, EVE.ISXEVE.EVE myEVE)
        {
            try
            {
                var entities = myEVE.QueryEntities().Where(entity => entity.IsPC && myMe.CharID != entity.CharID).ToArray();

                var oEntities = new List <EntityViewModel>();

                foreach (var entity in entities)
                {
                    var standings = EntityHelper.ComputeStandings(myMe, entity);

                    var newEntity = new EntityViewModel {
                        Entity = entity, EntityStandings = standings
                    };

                    var cachedEntity = EntityCache.Get(newEntity);

                    if (cachedEntity == null)
                    {
                        EntityCache.Add(newEntity);
                    }
                    else
                    {
                        if (cachedEntity.EntityStandings != newEntity.EntityStandings)
                        {
                            if (newEntity.EntityStandings > cachedEntity.EntityStandings)
                            {
                                EntityCache.Remove(newEntity);
                                EntityCache.Add(newEntity);
                            }

                            if (newEntity.EntityStandings == 0 && cachedEntity.EntityStandings != 0)
                            {
                                newEntity.EntityStandings = cachedEntity.EntityStandings;
                            }
                        }
                    }

                    oEntities.Add(newEntity);
                }

                return(oEntities);
            }
            catch (Exception e)
            {
                InnerSpace.Echo("GET LOCAL GRID ENTITIES ERROR :" + e.Message);

                return(new List <EntityViewModel>());
            }
        }
Пример #16
0
 /// <summary>
 ///   Gets the data.
 /// </summary>
 /// <param name="callback">The callback.</param>
 public void GetData(Action <Player, Exception> callback)
 {
     try
     {
         var item = RetrieveEVEPlayer();
         callback(item, null);
     }
     catch (Exception e)
     {
         InnerSpace.Echo("Unable to retrieve char name");
         InnerSpace.Echo(e.ToString());
         callback(null, e);
     }
 }
Пример #17
0
        public void event_EVE_OnChannelMessage(object sender, LSEventArgs e)
        {
            string Output = "Incoming Text -> [";

            foreach (string arg in e.Args)
            {
                Output += arg + ",";
            }
            Output = Output.Substring(0, Output.Length - 1) + "]";

            // Uncomment this line if you wish to see it in action.
            InnerSpace.Echo(Output);

            return;
        }
Пример #18
0
        /// <summary>
        ///   Retrieves the eve player.
        /// </summary>
        /// <returns></returns>
        private Player RetrieveEVEPlayer()
        {
            var player = new Player();

            Frame.Wait(true);

            var me = new Me();

            player.Name = me.Name;

            InnerSpace.Echo(me.Name);

            Frame.Unlock();

            return(player);
        }
Пример #19
0
        private void btnTargeting_Click(object sender, EventArgs e)
        {
            InnerSpace.Echo("ISXEVEWrapperTest (GetTargeting): Begin");

            using (new FrameLock(true))
            {
                Extension Ext = new Extension();

                List <Entity> getTargets   = Ext.Me.GetTargets();
                List <Entity> getTargeting = Ext.Me.GetTargeting();

                InnerSpace.Echo("You have currently " + getTargets.Count + " targets.");
                InnerSpace.Echo("You are currently targeting " + getTargeting.Count + " targets.");
            }

            InnerSpace.Echo("ISXEVEWrapperTest (GetTargeting): End");
        }
Пример #20
0
        /************************************************************************************/
        public static void Log(string strFormat, params object[] aobjParams)
        {
            string strOutput = DateTime.Now.ToLongTimeString() + " - ";

            if (aobjParams.Length == 0)
            {
                strOutput += string.Format("{0}", strFormat);
            }
            else
            {
                strOutput += string.Format(strFormat, aobjParams);
            }

            InnerSpace.Echo(strOutput);

            /// TODO: Optionally push this out to a file or separate text console.
            return;
        }
Пример #21
0
        /// <summary>
        ///   Does the this on frame.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="LSEventArgs" /> instance containing the event data.</param>
        private void DoThisOnFrame(object sender, LSEventArgs e)
        {
            if (FrameActionScheduler.TryExecute())
            {
                try
                {
                    var ext = new Extension();
                    MyEve = ext.EVE();
                    MyMe  = ext.Me;

                    DoWork(MyMe, MyEve);
                }
                catch (Exception exp)
                {
                    InnerSpace.Echo(exp.Message);
                }
            }
        }
Пример #22
0
        private static void ObjectScan()
        {
            Frame.Wait(true);

            var ext = new Extension();
            var eve = ext.EVE();

            var entities = eve.QueryEntities();

            foreach (var entity in entities)
            {
                if (entity.Name.ToLower().Contains("corp"))
                {
                    InnerSpace.Echo(entity.ID + " " + entity.Name);
                }
            }

            Frame.Unlock();
        }
Пример #23
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var loader = new Loader(Application.ProductVersion, args);

            loader.Load();

            if (loader.LoadedSuccessfully)
            {
                InnerSpace.Echo("Executing StealthBot...");
                Application.Run(new StealthBotForm(args));
                InnerSpace.Echo("StealthBot exiting.");
            }
            else if (loader.LoadErrorMessage != null)
            {
                LavishScript.ExecuteCommand("stealthbotLoaded:Set[TRUE]");
                MessageBox.Show(loader.LoadErrorMessage, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #24
0
        private void btn_MarketOrderTest_Click(object sender, EventArgs e)
        {
            Extension Ext = new Extension();

            InnerSpace.Echo("ISXEVEWrapperTest (MarketOrder): Begin");

            Ext.EVE().FetchMarketOrders(3347);

            System.Threading.Thread.Sleep(1000);
            using (new FrameLock(true))
            {
                List <MarketOrder> orderList;
                orderList = Ext.EVE().GetMarketOrders(3347);
                InnerSpace.Echo("Found " + orderList.Count + " orders for the Amarr Titan skillbook.");

                foreach (MarketOrder order in orderList)
                {
                    InnerSpace.Echo("  - " + order.Name + ": " + order.QuantityRemaining +
                                    " @ " + order.Price + " ISK.");
                }
            }
            InnerSpace.Echo("ISXEVEWrapperTest (MarketOrder): End");
        }
Пример #25
0
        private void btn_AssetTest_Click(object sender, EventArgs e)
        {
            //function main()
            //{
            //        variable int i = 1
            //        variable index:int StationsWithAssets
            //        variable index:asset Assets
            //        variable int StationsWithAssetsCount
            //        variable int AssetsCount
            //        StationsWithAssetsCount:Set[${Me.GetStationsWithAssets[StationsWithAssets]}]
            //        echo Populating StationsWithAssets List:: ${StationsWithAssetsCount} Stations total

            //        do
            //        {
            //          echo Station Number ${i} ${EVE.NumAssetsAtStation[${StationsWithAssets.Get[${i}]}]} items at Station#: ${StationsWithAssets.Get[${i}]} (${EVE.GetLocationNameByID[${StationsWithAssets.Get[${i}]}]})
            //        }
            //        while ${i:Inc} <= ${StationsWithAssetsCount}

            //        i:Set[1]
            //        echo Now Listing Assets:
            //        echo ** Please note that items in the current station (if you're currently docked) will not be on this list **
            //        AssetsCount:Set[${Me.GetAssets[Assets]}]
            //        echo Populating Assets List:: ${AssetsCount} Assets total

            //        do
            //        {
            //          echo Asset Number ${i}: ${Assets.Get[${i}].Name}
            //        }
            //        while ${i:Inc} <= ${AssetsCount}
            //}

            //        *** NOTES ABOUT ASSETS:
            //***
            //*** 1. "GetAssets" will NOT include items that are in the same station you are currently residing (if applicable). However,
            //*** "GetStationsWithAssets" and "NumAssetsAtStation" WILL contain information about your current station.
            //*** 2. ISXEVE cannot override the 5 minute updating delay present in EVE. In other words, the information given by ISXEVE
            //*** will match what you see in your UI.
            //*** 3. StationID#s match the "LocationID" member of the 'asset' datatype as well as the "ID" member of the 'entity' datatype.
            //*** 4. You will need to open the assets window and manually expand each station to have access to the items at that station.
            //***
            InnerSpace.Echo("ISXEVEWrapperTest (Assets): Begin");
//             using (new FrameLock(true))
//             {
//                 Extension Ext = new Extension();
//                 InnerSpace.Echo("Name: " + Ext.Me.Name);
//
//                 List<long> stationList;
//                 stationList = Ext.Me.GetStationsWithAssets();
//
//                 InnerSpace.Echo("You have " + stationList.Count + " stations with assets.");
//
//                 foreach (int station in stationList)
//                 {
//                     List<Asset> assetList;
//                     assetList = Ext.Me.GetAssets(station);
//                     InnerSpace.Echo("  - Station #" + station + " contains " + assetList.Count + " items.");
//                     foreach (Asset asset in assetList)
//                     {
//                         InnerSpace.Echo("  - ID (" + asset.ID + ") " +
//                             "TypeID (" + asset.TypeID + ") " +
//                             "Type (" + asset.Type + ") ");
//                     }
//                 }
//             }
            InnerSpace.Echo("ISXEVEWrapperTest (Assets): End");
        }
Пример #26
0
 /// <summary>
 ///   Log a line to the console
 /// </summary>
 /// <param name = "line"></param>
 public static void Log(string line)
 {
     InnerSpace.Echo(string.Format("{0:HH:mm:ss} {1}", DateTime.Now, line));
 }
Пример #27
0
 public void Log(string message)
 {
     Console.WriteLine(message);
     InnerSpace.Echo(message);
 }
Пример #28
0
        void RunCommand(string command)
        {
            if (command == "clear")
            {
                states.Clear();
            }
            else if (command == "exit")
            {
                InnerSpace.Echo("Exiting...");
                // set up the handler for events coming back from InnerSpace
                LavishScript.Events.DetachEventTarget("OnFrame", OnFrame);
                LavishScript.Commands.RemoveCommand("ee");

                lock (lock_) {
                    Monitor.Pulse(lock_);
                }
            }
            else if (command == "update")
            {
                LavishScript.ExecuteCommand("execute evecmd_update woot");
            }
            else if (command == "undock")
            {
                State state = new UndockState();
                TryToEnterState(state);
            }
            else if (command == "gates")
            {
                List <Entity> entities = g.eve.QueryEntities("GroupID = 10");
                g.Print("Found {0} Stargates:", entities.Count);
                int i = 0;
                foreach (Entity entity in entities)
                {
                    g.Print("#{0}: [{2}] {1}", i, entity.Name, entity.ID);
                    i++;
                }
            }
            else if (command == "agents")
            {
                var agents = g.eve.GetAgents();
                if (agents == null)
                {
                    g.Print("EVE.GetAgents() return null");
                }
                else
                {
                    g.Print("Found {0} Agents:", agents.Count);
                }
            }
            else if (command == "stations")
            {
                List <Entity> entities = g.eve.QueryEntities("GroupID = 15");
                g.Print("Found {0} Stations:", entities.Count);
                int i = 0;
                foreach (Entity entity in entities)
                {
                    g.Print("#{0}: [{2}] {1}", i, entity.Name, entity.ID);
                    i++;
                }
            }
            else if (command == "missions")
            {
                List <AgentMission> missions = g.eve.GetAgentMissions();
                if (missions != null && missions.Count != 0)
                {
                    g.Print("Found {0} Missions:", missions.Count);
                    int i = 0;
                    foreach (AgentMission mission in missions)
                    {
                        g.Print("#{0}: {1}", i, mission.Name);
                        g.Print("    AgentID={0}", mission.AgentID);
                        g.Print("    Expires={0}", mission.Expires);
                        g.Print("    State={0}", mission.State);
                        g.Print("    Type={0}", mission.Type);
                        mission.GetDetails(); //opens details window
                        List <BookMark> bookmarks = mission.GetBookmarks();
                        int             j         = 0;
                        g.Print("    {0} Bookmarks:", bookmarks.Count);
                        foreach (BookMark bookmark in bookmarks)
                        {
                            g.Print("    Bookmark #{0}: [{2}] {1}", j, bookmark.Label, bookmark.ID);
                            g.Print("        Type: [{0}] {1}", bookmark.TypeID, bookmark.TypeID);
                            g.Print("        LocationType: {0}", bookmark.LocationType);
                            g.Print("        SolarSystemID: {0}", bookmark.SolarSystemID);
                            j++;
                        }
                        i++;
                    }
                }
                else if (missions == null)
                {
                    g.Print("Getting missions failed");
                }
                else
                {
                    g.Print("No missions found");
                }
            }
            else if (command.StartsWith("printwindow "))
            {
                string    window_name = command.Substring(12);
                EVEWindow window      = EVEWindow.GetWindowByName(window_name);
                if (window == null || !window.IsValid)
                {
                    window = EVEWindow.GetWindowByCaption(window_name);
                }

                if (window != null && window.IsValid)
                {
                    g.Print(window.Caption);
                    g.Print(window.HTML);

                    try // to parse some basics
                    {
                        MissionPage page = new MissionPage(window.HTML);
                        g.Print("Title: {0}", page.Title);
                        g.Print("CargoID: {0}", page.CargoID);
                        g.Print("Volume: {0}", page.CargoVolume);
                    }
                    catch { }
                }
                else
                {
                    g.Print("window \"{0}\" not found", window_name);
                }
            }
            else if (command == "printitems")
            {
                // print the items in station
                if (!g.me.InStation)
                {
                    g.Print("Not in station...");
                }
                else
                {
                    List <Item> items = g.me.GetHangarItems();
                    if (items == null)
                    {
                        g.Print("Failed to GetHangerItems");
                    }
                    else
                    {
                        int i = 0;
                        g.Print("Found {0} Items:", items.Count);
                        foreach (Item item in items)
                        {
                            g.Print("#{0}: [{2}] {1} x{3}", i, item.Name, item.ID, item.Quantity);
                            g.Print("    Description={0}", item.Description);
                            g.Print("    Type=[{0}] {1}", item.TypeID, item.Type);
                            g.Print("    Category=[{0}] {1}", item.CategoryID, item.Category);
                            g.Print("    BasePrice={0}", item.BasePrice);
                            g.Print("    UsedCargoCapacity={0}", item.UsedCargoCapacity);
                            i++;
                        }
                    }
                }
            }
            else if (command.StartsWith("printagent "))
            {
                int   id    = Int32.Parse(command.Substring(11));
                Agent agent = new Agent("ByID", id);
                if (agent != null && agent.IsValid)
                {
                    g.Print("Name: {0}", agent.Name);
                    g.Print("Station: [{0}] {1}", agent.StationID, agent.Station);
                    g.Print("Division: [{0}] {1}", agent.DivisionID, agent.Division);
                    g.Print("StandingTo: {0}", agent.StandingTo);
                    g.Print("SolarSystemID: {0}", agent.Solarsystem.ID);
                    List <DialogString> responses = agent.GetDialogResponses();
                    int i = 0;
                    g.Print("{0} Dialog Responses:", responses.Count);
                    foreach (DialogString response in responses)
                    {
                        g.Print("    Response #{0}: {1}", i, response.Text);
                        i++;
                    }
                }
                else
                {
                    g.Print("Agent not found");
                }
            }
            else if (command == "printcargo")
            {
                List <Item> items = g.me.Ship.GetCargo();

                g.Print("Found {0} Items:", items.Count);
                int i = 0;
                foreach (Item item in items)
                {
                    g.Print("#{0} {1}", i, item.Name);
                    g.Print("    Category: [{0}] {1} ({2})", item.CategoryID, item.Category, item.CategoryType.ToString());
                    g.Print("    Description: {0}", item.Description);
                    g.Print("    Group: [{0}] {1}", item.GroupID, item.Group);
                    i++;
                }
            }
            else if (command == "printroids")
            {
                List <Entity> roids = g.eve.QueryEntities("CategoryID = 25");
                g.Print("Found {0} Asteroids:", roids.Count);
                int i = 0;
                foreach (Entity roid in roids)
                {
                    if (i >= 10)
                    {
                        break;
                    }
                    g.Print("#{0} {1}", i, roid.Name);
                    g.Print("    Distance: {0}", roid.Distance);
                    g.Print("    Type: [{0}] {1}", roid.TypeID, roid.Type);
                    g.Print("    Category: [{0}] {1} ({2})", roid.CategoryID, roid.Category, roid.CategoryType);
                    g.Print("    Location: {0},{1},{2}", roid.X, roid.Y, roid.Z);
                    g.Print("    IsActiveTarget: {0} IsLockedTarget: {1}", roid.IsActiveTarget ? "Yes" : "No", roid.IsLockedTarget ? "Yes" : "No");
                    i++;
                }
            }
            else if (command.StartsWith("warp "))
            {
                State state = new WarpState(command);
                TryToEnterState(state);
            }
            else if (command.Split(' ')[0] == "dock")
            {
                State state = new DockState(command);
                TryToEnterState(state);
            }
            else if (command.Split(' ')[0] == "goto")
            {
                State state = new GotoState(command);
                TryToEnterState(state);
            }
            else if (command.Split(' ')[0] == "domission")
            {
                State state = new MissionState(command);
                TryToEnterState(state);
            }
            else if (command.Split(' ')[0] == "dodropoff")
            {
                State state = new DoDropoffState(command);
                TryToEnterState(state);
            }
            else if (command.Split(' ')[0] == "mineloop")
            {
                State state = new MineLoopState(command);
                TryToEnterState(state);
            }
            else if (command == "unloadore")
            {
                State state = new UnloadOreState();
                TryToEnterState(state);
            }
            else if (command.StartsWith("travel "))
            {
                State state = new TravelToStationState(command);
                TryToEnterState(state);
            }
            else if (command == "runlasers")
            {
                TryToEnterState(new RunMiningLasersState());
            }
        }
Пример #29
0
        private void OnFrame(object sender, LSEventArgs e)
        {
            try
            {
                using (dynamic pySharp = new PySharp.PySharp())
                {
                    dynamic pyObject = null;

                    if (_doTest)
                    {
                        _doTest = false;

                        pyObject = pySharp.__builtin__.eve.session;

                        var file = pySharp.__builtin__.open("c:/blaat.txt", "wb");
                        file.write("hello world");
                        file.close();

                        //// Make eve reload the compiled code file (stupid DiscardCode function :)
                        //pySharp.Import("nasty").Attribute("nasty").Attribute("compiler").Call("Load", pySharp.Import("nasty").Attribute("nasty").Attribute("compiledCodeFile"));

                        //// Get a reference to all code files
                        //var dict = pySharp.Import("nasty").Attribute("nasty").Attribute("compiler").Attribute("code").ToDictionary();

                        //// Get the magic once
                        //var magic = pySharp.Import("imp").Call("get_magic");

                        //foreach (var item in dict)
                        //{
                        //    // Clean up the path
                        //    var path = (string)item.Key.Item(0);
                        //    if (path.IndexOf(":") >= 0)
                        //        path = path.Substring(path.IndexOf(":") + 1);
                        //    while (path.StartsWith("/.."))
                        //        path = path.Substring(3);
                        //    path = "c:/dump/code" + path + "c";

                        //    // Create the directory
                        //    Directory.CreateDirectory(Path.GetDirectoryName(path));

                        //    var file = pySharp.Import("__builtin__").Call("open", path, "wb");
                        //    var time = pySharp.Import("os").Attribute("path").Call("getmtime", path);

                        //    // Write the magic
                        //    file.Call("write", magic);
                        //    // Write the time
                        //    file.Call("write", pySharp.Import("struct").Call("pack", "<i", time));
                        //    // Write the code
                        //    pySharp.Import("marshal").Call("dump", item.Value.Item(0), file);
                        //    // Close the file
                        //    file.Call("close");
                        //}
                        InnerSpace.Echo("Done");
                    }

                    if (_doEvaluate)
                    {
                        _doEvaluate = false;
                        pyObject    = Evaluate(pySharp, pyObject);
                    }

                    if (pyObject != null)
                    {
                        ListPyObject(pyObject);
                    }
                }
            }
            finally
            {
                _done = true;
            }
        }
Пример #30
0
 private void VGLocationsList_DoubleClick(object sender, EventArgs e)
 {
     InnerSpace.Echo(VGLocationsList.SelectedItem.ToString());
 }