Example #1
0
        public static void setMode(string KeyChar)
        {
            if (KeyChar == "1")
            {
                mode      = BaseSkill.Mode.Fishing;
                currSkill = new Fishing();
            }
            else if (KeyChar == "2")
            {
                mode      = BaseSkill.Mode.Mining;
                currSkill = new Mining();
            }
            else if (KeyChar == "3")
            {
                mode      = BaseSkill.Mode.Builder;
                currSkill = new Builder();
            }
            else if (KeyChar == "4")
            {
                mode      = BaseSkill.Mode.Auto;
                currSkill = new Auto();
            }
            else
            {
                Console.WriteLine("No valid mode");

                DxInput.input.Unload();
                Console.ReadKey();
                Environment.Exit(0);
            }
        }
Example #2
0
        public static int animDelay           = 250; //Ticks to secs

        static void Main(string[] args)
        {
            handler = new ConsoleEventDelegate(ConsoleEventCallback);
            SetConsoleCtrlHandler(handler, true);
            var CoreCount  = System.Environment.ProcessorCount / 2;
            var maxThreads = (Environment.ProcessorCount * CoreCount);

            DxInput.initInput();
            var sw = new Stopwatch();

            Console.Title = $"Max concurrent threads {maxThreads}";
            askMode();

            running = true;
            new Task(() => { ScreenDrawer.printDebug(); }).Start();
            while (running)
            {
                sw.Restart();

                if (!Program.paused)
                {
                    currSkill.takeAction();
                }

                sw.Stop();
                var ticks = sw.ElapsedTicks;
                if (ticks < 3000)
                {
                    avgTicks.Add(ticks);

                    avgTicks.Sort();

                    var Ispaused = Program.paused ? "paused" : "running";
                    Console.Title = $"{currSkill.getSkillName()} - {avgTicks.Average().ToString("#,##0")}Avg. {avgTicks.First()}min {avgTicks.Last()}max {animChar[animCount]} {Ispaused}";
                    if (avgTicks.Count > 20000)
                    {
                        avgTicks = new List <long>();
                    }
                }

                if (lastAnimTick.AddMilliseconds(animDelay) < DateTime.Now)
                {
                    lastAnimTick = DateTime.Now;
                    animCount   += 1;
                    if (animCount >= animChar.Length)
                    {
                        animCount = 0;
                    }
                }
            }

            DxInput.Unload();
            Console.ReadKey();
        }
Example #3
0
        public static void askMode()
        {
            Console.WriteLine("Which mode?");
            Console.WriteLine("");
            Console.WriteLine("1. Fishing");
            Console.WriteLine("2. Mining");
            Console.WriteLine("3. Builder");
            Console.WriteLine("4. Auto");
            Console.WriteLine("");

            var confirm = Console.ReadKey();

            Console.Clear();
            setMode(confirm.KeyChar.ToString());
        }