Exemple #1
0
        /// <summary>
        /// Clicks the given menu item
        /// </summary>
        /// <param name="menuItem">The text of the menu item to click</param>
        /// <returns>True if success, false otherwise</returns>
        public bool click(string menuItem)
        {
            if (!comm.connect())
            {
                return(false);
            }


            InterfaceResponse resp = (InterfaceResponse)comm.sendCall(FunctionCallFactory.CALLS.FINDBYTEXTMENU, menuItem, Response.RESPONSES.INTERFACERESPONSE);

            if (resp == null)
            {
                return(false);
            }


            pm.MissChance = 100;
            pm.Speed      = 5;

            Random random = new Random();


            pm.move(10, resp.X + 5, pm.getY(), 0, 0, 0);
            pm.move(10, resp.X + 5, resp.Y + 6, 0, 0, 0);


            //Synchronize both mouse devices
            m.synchronize(pm);

            Thread.Sleep(600);

            pm.click(true);
            return(true);
        }
Exemple #2
0
        private void populateEdit(InterfaceResponse edit, string text)
        {
            string currText = edit.Name;

            if (!currText.Equals(text))
            {
                if (currText != "")
                {
                    m.move(new Point(ran.Next(edit.X + 5, edit.X + edit.Width - 15), ran.Next(edit.Y + 5, edit.Y + edit.Height - 5)));
                    Thread.Sleep(ran.Next(300, 500));
                    m.click(true);
                    Thread.Sleep(ran.Next(100, 300));
                    for (int i = 0; i < currText.Length; i++)
                    {
                        kb.sendChar((char)KeyBoard.VKeys.VK_BACK);
                        Thread.Sleep(ran.Next(150, 190));
                    }
                    pm.synchronize(m);
                }

                if (currText == "")
                {
                    m.move(new Point(ran.Next(edit.X + 5, edit.X + edit.Width - 5), ran.Next(edit.Y + 5, edit.Y + edit.Height - 5)));
                    Thread.Sleep(ran.Next(300, 500));
                    m.click(true);
                    Thread.Sleep(ran.Next(100, 300));
                    kb.sendKeyPresses(text);
                    pm.synchronize(m);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Load the ammo with the given name in the given highslot
        /// </summary>
        /// <param name="i">The number of the highslot to load the ammo into</param>
        /// <param name="ammoName">The name of the ammo to load</param>
        /// <returns></returns>
        public Boolean loadAmmo(int i, string ammoName)
        {
            if (!hasHighSlot(i))
            {
                return(false);
            }

            InterfaceResponse activateResp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETHIGHSLOT, i + "", Response.RESPONSES.INTERFACERESPONSE);

            if (activateResp == null)
            {
                Console.WriteLine("Can't find module item");
                return(false);
            }
            m.move(new Point(ran.Next(activateResp.X + 10, activateResp.X + activateResp.Width - 10), ran.Next(activateResp.Y + 20, activateResp.Y + activateResp.Height - 10)));
            Thread.Sleep(200);
            m.click(false);
            Thread.Sleep(ran.Next(500, 700));
            pm.synchronize(m);
            if (!menu.click(ammoName))
            {
                return(menu.click(MenuHandler.MENUITEMS.Reload + " (" + ammoName));
            }

            return(true);
        }
Exemple #4
0
        /// <summary>
        /// Deposits all items in your cargo to the station hangar
        /// </summary>
        /// <returns>True if sucess, false otherwise</returns>
        public Boolean depositAll()
        {
            ItemResponse items = (ItemResponse)com.sendCall(FunctionCallFactory.CALLS.GETCARGOLIST, Response.RESPONSES.ITEMRESPONSE);

            if (items == null)
            {
                Console.WriteLine("cargolist is null");
                return(false);
            }

            InterfaceResponse stationHangar = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETSTATIONHANGAR, Response.RESPONSES.INTERFACERESPONSE);

            if (stationHangar == null)
            {
                Console.WriteLine("stationHangar is null");
                return(false);
            }

            if (((List <Item>)items.Data).Count > 0)
            {
                Item it = ((List <Item>)items.Data)[0];
                selectAllCargo();
                m.move(new Point(ran.Next(it.X, it.X + it.Width), ran.Next(it.Y, it.Y + it.Height)));
                Thread.Sleep(500);
                m.drag(new Point(ran.Next(stationHangar.X, stationHangar.X + stationHangar.Width), ran.Next(stationHangar.Y, stationHangar.Y + stationHangar.Height)));
            }

            pm.synchronize(m);

            return(true);
        }
Exemple #5
0
        /// <summary>
        /// Find an open area in the inflight interface
        /// </summary>
        /// <returns>An empty point in space</returns>
        public Point getOpenSpace()
        {
            List <Rectangle> recs  = new List <Rectangle>();
            OverViewResponse items = (OverViewResponse)com.sendCall(FunctionCallFactory.CALLS.GETINTERFACEWINDOWS, Response.RESPONSES.OVERVIEWRESPONSE);

            if (items == null)
            {
                Console.WriteLine("cargolist is null");
                return(new Point(-1, -1));
            }

            InterfaceResponse inflight = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETINFLIGHTINTERFACE, Response.RESPONSES.INTERFACERESPONSE);

            if (inflight == null)
            {
                Console.WriteLine("inflight is null");
                return(new Point(-1, -1));
            }

            Point pt = new Point(ran.Next(inflight.X, inflight.X + inflight.Width), ran.Next(inflight.Y, inflight.Y + inflight.Height));

            foreach (OverViewEntry it in (List <OverViewEntry>)items.Data)
            {
                recs.Add(new Rectangle(it.X, it.Y, it.Width, it.Height));
            }

            while (!isEmpty(recs, pt))
            {
                pt = new Point(ran.Next(inflight.X, inflight.X + inflight.Width), ran.Next(inflight.Y, inflight.Y + inflight.Height));
            }

            return(pt);
        }
Exemple #6
0
        /// <summary>
        /// Check if we have drones available to launch
        /// </summary>
        /// <returns>True if we do, false otherwise</returns>
        public bool hasAvailableDrones()
        {
            InterfaceResponse tresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETDRONESINSPACETAB, Response.RESPONSES.INTERFACERESPONSE);

            if (tresp == null)
            {
                Console.WriteLine("Couldn't retrieve drone tab");
                return(false);
            }

            Regex  reg   = new Regex("[0-9]");
            string nums  = reg.Match(tresp.Name).Value;
            int    digit = 0;

            if (nums != "")
            {
                digit = Convert.ToInt32(nums);
                if (digit == 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }
Exemple #7
0
        /// <summary>
        /// Open a menu on the overview item with the given name
        /// </summary>
        /// <param name="entryName">The name of the overview item to open a menu on</param>
        /// <returns>True on success, false otherwise</returns>
        public bool openMenu(string entryName)
        {
            int           passes    = 0;
            bool          direction = false;
            bool          found     = false;
            OverViewEntry entry     = getEntry(entryName);

            while (passes < 2 && entry != null)
            {
                InterfaceResponse overv = overviewScrollbar();
                if (overv != null)
                {
                    if (entry.X != 0)
                    {
                        found = true;
                        break;
                    }

                    //Console.WriteLine("Overview Bottom: " + overviewBottom());
                    //Console.WriteLine("O.Y+O.Height+50: " + (overv.Y + overv.Height + 50));
                    if (overv.Y + overv.Height + 30 >= overviewBottom())
                    {
                        //  Console.WriteLine("GOING UP!");
                        //  Console.WriteLine("PASSES INCREMENTED");
                        passes++;
                        direction = false;
                    }

                    //Console.WriteLine("Overview Top: " + EOverViewHandler.overviewTop());
                    //Console.WriteLine("Overview.Y-3: " + (overv.Y - 30));
                    if (overv.Y - 30 <= overviewTop())
                    {
                        // Console.WriteLine("GOING DOWN!!!!");
                        // Console.WriteLine("PASSES INCREMENTED");
                        passes++;
                        direction = true;
                    }

                    if (!direction)
                    {
                        scrollUp();
                    }

                    else
                    {
                        scrollDown();
                    }

                    entry = getEntry(entryName);
                    Thread.Sleep(200);
                }
            }
            if (found)
            {
                mh.open(entry);
            }
            return(found);
        }
Exemple #8
0
        /// <summary>
        /// Login
        /// </summary>
        /// <param name="username">The username to login with</param>
        /// <param name="password">The password to login with</param>
        /// <returns>True on succes, false otherwise</returns>
        public bool login(string username, string password)
        {
            InterfaceResponse pentry = getPasswordBox();

            if (pentry == null)
            {
                return(false);
            }

            while (!checkEdit(pentry, password))
            {
                populateEdit(pentry, password);

                pentry = getPasswordBox();
                if (pentry == null)
                {
                    return(false);
                }
            }


            InterfaceResponse uentry = getUsernameBox();

            if (uentry == null)
            {
                return(false);
            }

            while (!checkEdit(uentry, username))
            {
                populateEdit(uentry, username);

                uentry = getUsernameBox();
                if (uentry == null)
                {
                    return(false);
                }
            }

            Button connect = getConnectButton();

            if (connect == null)
            {
                return(false);
            }


            if (!click(connect))
            {
                return(false);
            }



            return(true);
        }
Exemple #9
0
        /// <summary>
        /// Get a character entry on the userlist
        /// </summary>
        /// <param name="charname">The name of the char to get</param>
        /// <returns>The entry for the char on success, null on failure</returns>
        public override InterfaceEntry userlistGetEntry(string charname)
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.FINDPLAYERINLOCAL, charname, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(null);
            }
            return(new InterfaceEntry(iresp.X, iresp.Y, iresp.Width, iresp.Height));
        }
Exemple #10
0
        /// <summary>
        /// Get the connect button of the login interface
        /// </summary>
        /// <returns>The button, null on failure</returns>
        public Button getConnectButton()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETCONNECTBUTTON, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(null);
            }

            return(new Button(iresp.Name, iresp.X, iresp.Y, iresp.Height, iresp.Width));
        }
Exemple #11
0
        /// <summary>
        /// Get the username box of the login interface
        /// </summary>
        /// <returns>The box, null on failure</returns>
        public InterfaceResponse getUsernameBox()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETUSERNAMEBOX, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(null);
            }

            return(iresp);
        }
Exemple #12
0
        private Button getSubmitButton()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETMODALSUBMITBUTTON, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(null);
            }

            return(new Button("Submit", iresp.X, iresp.Y, iresp.Height, iresp.Width));
        }
Exemple #13
0
        /// <summary>
        /// Get the coordinates of the overview scrollbar
        /// </summary>
        /// <returns>An interface response object with the scrollbar information or null on failure</returns>
        public InterfaceResponse overviewScrollbar()
        {
            InterfaceResponse iresp = (InterfaceResponse)comm.sendCall(FunctionCallFactory.CALLS.GETOVERVIEWSCROLL, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(null);
            }

            return(iresp);
        }
Exemple #14
0
        /// <summary>
        /// Get the password box of the login interface
        /// </summary>
        /// <returns></returns>
        public InterfaceResponse getPasswordBox()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETPASSWORDBOX, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(null);
            }

            return(iresp);
        }
Exemple #15
0
        /// <summary>
        /// Get the scrollbar to the userlist
        /// </summary>
        /// <returns>The scrollbar or null on failure</returns>
        public override InterfaceEntry userlistScrollBar()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETLOCALCHATSCROLLBAR, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(null);
            }

            return(new InterfaceEntry(iresp.X, iresp.Y, iresp.Width, iresp.Height));
        }
Exemple #16
0
        /// <summary>
        /// Get the No button of an interface if it exists
        /// </summary>
        /// <returns>The No button or null on failure</returns>

        public Button getNoButton()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETMODALYESBUTTON, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(null);
            }

            return(new Button("NO", iresp.X, iresp.Y, iresp.Height, iresp.Width));
        }
Exemple #17
0
        /// <summary>
        /// Check if the addressbook is open
        /// </summary>
        /// <returns>True if open, false otherwise</returns>
        public bool isOpen()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETADDRESSBOOKWINDOW, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                Console.WriteLine("addressbook is closed");
                return(false);
            }

            return(true);
        }
Exemple #18
0
        /// <summary>
        /// Find out if we're docked
        /// </summary>
        /// <returns>True if docked, false otherwise</returns>
        public Boolean isDocked()
        {
            InterfaceResponse dockbutton = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETUNDOCKBUTTON, Response.RESPONSES.INTERFACERESPONSE);

            if (dockbutton == null)
            {
                Console.WriteLine("dockbutton is null");
                return(false);
            }

            return(true);
        }
Exemple #19
0
        /// <summary>
        /// Open the cargo
        /// </summary>
        /// <returns>Return true on success, false otherwise</returns>
        public Boolean openCargo()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETSHIPHANGAR, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp != null)
            {
                return(true);
            }

            kb.sendAltCharacter('c');
            return(true);
        }
Exemple #20
0
        /// <summary>
        /// Get an injured drone if any. Needs the drone tab expanded to work
        /// </summary>
        /// <returns>The drone interface resposne on success, null on failure</returns>
        public InterfaceResponse getInjuredDrone()
        {
            InterfaceResponse drone = (InterfaceResponse)com.sendCall("getInjuredDrone", Response.RESPONSES.INTERFACERESPONSE);

            if (drone == null)
            {
                Console.WriteLine("drone is null");
                return(null);
            }

            return(drone);
        }
Exemple #21
0
        /// <summary>
        /// Open the scanning window
        /// </summary>
        /// <returns>True on success, false otherwise</returns>
        public Boolean openScanner()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETPROBERESULT, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp != null)
            {
                return(true);
            }

            kb.sendAltCharacter('d');
            return(true);
        }
Exemple #22
0
        /// <summary>
        /// Recovers the probes in space
        /// </summary>
        public void recoverProbe()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETRECOVERPROBESBUTTON, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return;
            }

            m.move(new Point(ran.Next(iresp.X + 5, iresp.X + iresp.Width - 5), ran.Next(iresp.Y + 5, iresp.Y + iresp.Height - 5)));
            Thread.Sleep(ran.Next(200, 300));
            m.click(true);
            pm.synchronize(m);
        }
Exemple #23
0
        /// <summary>
        /// Undock from station
        /// </summary>
        /// <returns>True if suceeded, false otherwise</returns>
        public Boolean undock()
        {
            InterfaceResponse dockbutton = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETUNDOCKBUTTON, Response.RESPONSES.INTERFACERESPONSE);

            if (dockbutton == null)
            {
                Console.WriteLine("dockbutton is null");
                return(false);
            }

            m.move(new Point(ran.Next(dockbutton.X, dockbutton.X + dockbutton.Width), ran.Next(dockbutton.Y, dockbutton.Y + dockbutton.Height)));
            pm.synchronize(m);
            return(true);
        }
Exemple #24
0
        public InterfaceResponse UpdateRegister(RegisterUpdateRequest request)
        {
            Logger.Debug("Registration details received: {0}",
                         JsonConvert.SerializeObject(request, Formatting.Indented));

            var userPrincipal = new UserPrincipal(ClaimsPrincipal.Current);

            if (userPrincipal.Id.HasValue)
            {
                InterfaceResponse response;
                //use in built data annotations to ensure model has
                //binded correctly
                if (!ModelState.IsValid)
                {
                    var errors = ModelState.Keys.SelectMany(key =>
                                                            ModelState[key].Errors.Select(x => x.ErrorMessage));
                    response = new InterfaceResponse
                    {
                        Success = false,
                        Message = "Form has validation errors",
                        Errors  = errors.ToArray()
                    };
                }
                else
                {
                    //send request to the user service and return the
                    //response (success or fail)
                    response = UserService.UpdateRegistration(
                        request, userPrincipal.Id.Value);
                }
                Logger.Debug("Registration update sent Response: {0}",
                             JsonConvert.SerializeObject(
                                 response, Formatting.Indented));
                return(response);
            }
            else
            {
                var response = new InterfaceResponse
                {
                    Success = false,
                    Message = "Invalid user ID",
                    Errors  = new[] { "No user is logged on" }
                };
                Logger.Debug("The user ID session is invalid",
                             JsonConvert.SerializeObject(
                                 response, Formatting.Indented));
                return(response);
            }
        }
Exemple #25
0
        /// <summary>
        /// Select the places tab in the addressbook
        /// </summary>
        /// <returns>True on success, false otherwise</returns>
        public bool selectPlacesTab()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETADDRESSBOOKPLACESTAB, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(false);
            }

            m.move(new Point(ran.Next(iresp.X + 10, iresp.X + iresp.Width - 10), ran.Next(iresp.Y + 4, iresp.Y + iresp.Height - 4)));
            Thread.Sleep(ran.Next(200, 300));
            m.click(true);
            pm.synchronize(m);
            return(true);
        }
Exemple #26
0
        public bool toggleDistanceSort()
        {
            InterfaceResponse activateResp = (InterfaceResponse)comm.sendCall(FunctionCallFactory.CALLS.GETOVERVIEWDISTANCEHEADER, Response.RESPONSES.INTERFACERESPONSE);

            if (activateResp == null)
            {
                return(false);
            }

            m.move(new Point(ran.Next(activateResp.X + 10, activateResp.X + activateResp.Width - 10), ran.Next(activateResp.Y + 3, activateResp.Y + activateResp.Height - 3)));
            Thread.Sleep(ran.Next(300, 400));
            m.click(true);
            pm.synchronize(m);
            return(true);
        }
Exemple #27
0
        private bool clickAddressBookBMButton()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETADDRESSBOOKBMBUTTON, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(false);
            }

            m.move(new Point(ran.Next(iresp.X + 10, iresp.X + iresp.Width - 10), ran.Next(iresp.Y + 4, iresp.Y + iresp.Height - 4)));
            Thread.Sleep(ran.Next(200, 300));
            m.click(true);
            pm.synchronize(m);
            return(true);
        }
Exemple #28
0
        /// <summary>
        /// Scroll the overview up
        /// </summary>
        /// <returns>True on success, false otherwise</returns>
        public bool scrollUp()
        {
            InterfaceResponse iresp = (InterfaceResponse)comm.sendCall(FunctionCallFactory.CALLS.GETOVERVIEWSCROLL, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(false);
            }

            m.move(new Point(ran.Next(iresp.X + 3, iresp.X + iresp.Width - 3), ran.Next(iresp.Y + 3, iresp.Y + iresp.Height - 3)));
            Thread.Sleep(300);
            m.drag(new Point(iresp.X, iresp.Y - iresp.Height));
            pm.synchronize(m);
            return(true);
        }
Exemple #29
0
        /// <summary>
        /// Delay the currently offered mission
        /// </summary>
        /// <returns>True on success, false otherwise</returns>
        public bool delayMission()
        {
            InterfaceResponse iresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETAGENTDELAYMISSIONBTN, Response.RESPONSES.INTERFACERESPONSE);

            if (iresp == null)
            {
                return(false);
            }

            m.move(new Point(ran.Next(iresp.X + 10, iresp.X + iresp.Width - 10), ran.Next(iresp.Y + 3, iresp.Y + iresp.Height - 3)));
            Thread.Sleep(ran.Next(300, 400));
            m.click(true);
            pm.synchronize(m);
            return(true);
        }
Exemple #30
0
        /// <summary>
        /// Engage active target with drones in space
        /// </summary>
        /// <returns>True on success, false otherwise</returns>
        public bool engageDrones()
        {
            InterfaceResponse tresp = (InterfaceResponse)com.sendCall(FunctionCallFactory.CALLS.GETDRONESINSPACETAB, Response.RESPONSES.INTERFACERESPONSE);

            if (tresp == null)
            {
                Console.WriteLine("Couldn't retrieve drone tab");
                return(false);
            }
            InterfaceEntry ientry = new InterfaceEntry(tresp.X, tresp.Y, tresp.Width, tresp.Height);

            menu.open(ientry);
            Thread.Sleep(400);
            return(menu.click(MenuHandler.MENUITEMS.ENGAGETARGET));
        }