public void Arrangement(int[] trackName, int[] coverage, int[] weather)
        {
            Algorithms al = new Algorithms();
            TrackInfo  ti = new TrackInfo();

            Point[] a = { PointsAndRectangles.Finger1, PointsAndRectangles.Finger2, PointsAndRectangles.Finger3, PointsAndRectangles.Finger4, PointsAndRectangles.Finger5 };
            Point[] b = { PointsAndRectangles.Track1position, PointsAndRectangles.Track2position, PointsAndRectangles.Track3position, PointsAndRectangles.Track4position, PointsAndRectangles.Track5position };

            int[]      carpictures = NotePad.ReadCars();
            List <Car> cars        = new List <Car>();

            foreach (int carpicture in carpictures)
            {
                cars.Add(new Car(carpicture));
            }

            string[,] d = ti.TrackPackage(trackName, coverage, weather);//race full info

            int[]  rightarranfement  = new int[5];
            double arrangementPoints = -1000000;

            for (int i1 = 0; i1 < 5; i1++)
            {
                for (int i2 = 0; i2 < 5; i2++)
                {
                    if (i2 != i1)
                    {
                        for (int i3 = 0; i3 < 5; i3++)
                        {
                            if (i3 != i1 && i3 != i2)
                            {
                                for (int i4 = 0; i4 < 5; i4++)
                                {
                                    if (i4 != i1 && i4 != i2 && i4 != i3)
                                    {
                                        for (int i5 = 0; i5 < 5; i5++)
                                        {
                                            if (i5 != i1 && i5 != i2 && i5 != i3 && i5 != i4)
                                            {
                                                double point = al.CalculateCompatibility(d[0, 0], d[1, 0], d[2, 0], cars[i1]) +
                                                               al.CalculateCompatibility(d[0, 1], d[1, 1], d[2, 1], cars[i2]) +
                                                               al.CalculateCompatibility(d[0, 2], d[1, 2], d[2, 2], cars[i3]) +
                                                               al.CalculateCompatibility(d[0, 3], d[1, 3], d[2, 3], cars[i4]) +
                                                               al.CalculateCompatibility(d[0, 4], d[1, 4], d[2, 4], cars[i5]);
                                                if (point > arrangementPoints)
                                                {
                                                    rightarranfement  = new int[] { i1, i2, i3, i4, i5 };
                                                    arrangementPoints = point;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            for (int j = 0; j < 5; j++)//logic for dragndrop
            {
                Thread.Sleep(1000);
                Rat.DragnDropFast(a[rightarranfement[j]], b[j]);//set choosen car on track
            }
        }
        private bool PlayClubs(int i)
        {
            SpecialEvents      se   = new SpecialEvents();
            Waiting            wait = new Waiting();
            FastCheck          fc   = new FastCheck();
            PlayClubsPositions pcp  = new PlayClubsPositions();

            bool eventisactive = pcp.PathToGarage();

            if (eventisactive)
            {
                pcp.PrepareToRace(i);//набор/проверка руки
                wait.ReadytoRace();

                bool foundplace = false;
                do
                {
                    se.CarRepair();
                    se.UniversalErrorDefense();
                    se.UnavailableEvent();
                    //se.CardBug();
                    if (fc.ReadyToRace())
                    {
                        Rat.Clk(PointsAndRectangles.startTheRace);
                        Thread.Sleep(2000);
                    }
                    if (fc.EnemyIsReady())
                    {
                        eventisactive = true;
                        foundplace    = true;
                        Thread.Sleep(1000);
                    }
                    if (fc.Bounty())
                    {
                        NotePad.DoLog("эвент закончен");
                        eventisactive = false;
                        foundplace    = true;
                        Thread.Sleep(1000);
                    }
                    if (fc.ClubMap())
                    {
                        NotePad.DoLog("эвент закончен");
                        eventisactive = false;
                        foundplace    = true;
                        Thread.Sleep(1000);
                    }
                } while (!foundplace);//ожидание противника

                if (eventisactive)
                {
                    pcp.TimeToRace(); //расстановка

                    se.EndRace();     //завершение заезда

                    foundplace = false;
                    do
                    {
                        se.UniversalErrorDefense();

                        if (fc.Upgrade())
                        {
                            NotePad.DoLog("реклама на апгрейд");
                            se.UpgradeAdsKiller();
                            Thread.Sleep(1000);
                        }

                        if (fc.Ending())
                        {
                            Rat.Clk(PointsAndRectangles.passTheTableAfterRace);//Table
                            Thread.Sleep(1000);
                        }

                        if (fc.Bounty())
                        {
                            eventisactive = false;
                            foundplace    = true;
                            Thread.Sleep(1000);
                        }

                        if (fc.ControlScreen())
                        {
                            foundplace = true;
                            Thread.Sleep(1000);
                        }

                        if (fc.BugControlScreen())
                        {
                            Thread.Sleep(500);
                            NotePad.DoLog("Bug with Control Screen");
                            Rat.Clk(PointsAndRectangles.backToClubMap);//Back
                            Thread.Sleep(1000);
                        }

                        if (fc.ClubMap())
                        {
                            eventisactive = false;
                            foundplace    = true;
                            Thread.Sleep(1000);
                        }
                    } while (foundplace == false);//переход на экран контроля
                }
            }

            return(eventisactive);
        }
        public void MakingHand()
        {
            FastCheck fc = new FastCheck();

            int[] classcars = ConditionHandling();
            NotePad.DoLog("Собираю " + classcars[0] + "F, "
                          + classcars[1] + "E, "
                          + classcars[2] + "D, "
                          + classcars[3] + "C, "
                          + classcars[4] + "B, "
                          + classcars[5] + "A, "
                          + classcars[6] + "S");
            Thread.Sleep(1000);

            int emptycars; //недобор
            int conditionAvailableCars;
            int usedhandslots = 0;

            if (Condition.ConditionNumber1 != "empty" &&
                Condition.ConditionNumber1 != "обычная х3" &&
                !fc.ConditionActivated())
            {
                if (Condition.ConditionNumber2 == "empty")
                {
                    Rat.Clk(PointsAndRectangles.commonCondition);
                }
                else
                {
                    Rat.Clk(PointsAndRectangles.commonCondition);
                    Thread.Sleep(1000);
                    Rat.Clk(PointsAndRectangles.cond1);
                    Thread.Sleep(200);
                    Rat.Clk(PointsAndRectangles.cond2);
                    Thread.Sleep(200);
                    Rat.Clk(PointsAndRectangles.commonConditionCross);
                }
            } //включить фильтр условия события.

            Point[] cls = { PointsAndRectangles.f, PointsAndRectangles.e, PointsAndRectangles.d, PointsAndRectangles.c, PointsAndRectangles.b, PointsAndRectangles.a, PointsAndRectangles.s };
            for (int i = 6; i > -1; i--)
            {
                if (classcars[i] > 0)
                {
                    Randomizer();
                    UseFilter(cls[i]);
                    conditionAvailableCars = Condition.AvailableCars(i);

                    if (i == 0)//для серых нет возврата недобора
                    {
                        DragnDpopHand(classcars[i], usedhandslots, conditionAvailableCars);
                    }
                    else
                    {
                        emptycars         = 0;
                        emptycars        += DragnDpopHand(classcars[i], usedhandslots, conditionAvailableCars);
                        usedhandslots    += classcars[i] - emptycars;
                        classcars[i - 1] += emptycars;
                    }
                }
            }//механизм расстановки

            if (VerifyHand())
            {
                int[] carsid = RememberHand();
                NotePad.Saves(carsid);
            } //сохранение руки
        }
        public int DragnDpopHand(int n, int uhl, int caCars)
        {
            //caCars - cond available cars
            //n -needed cars
            FastCheck  fc = new FastCheck();
            HandMaking hm = new HandMaking();

            Point[] a          = new Point[] { PointsAndRectangles.pHandSlot1, PointsAndRectangles.pHandSlot2, PointsAndRectangles.pHandSlot3, PointsAndRectangles.pHandSlot4, PointsAndRectangles.pHandSlot5 };
            Point[] b          = new Point[] { PointsAndRectangles.GarageSlot1, PointsAndRectangles.GarageSlot2, PointsAndRectangles.GarageSlot3, PointsAndRectangles.GarageSlot4, PointsAndRectangles.GarageSlot5, PointsAndRectangles.GarageSlot6, PointsAndRectangles.GarageSlot7, PointsAndRectangles.GarageSlot8 };
            int     drag       = 0; //сдвиги
            int     x          = 0; //слот гаража
            int     h          = 0; //слот руки, uhl использованные слоты в предыдущем подборе
            int     neededcars = n;

            while (n > 0)
            {
                if (x == caCars)
                {
                    break;
                } //x имеет значение и при нуле
                else
                {
                    if (x > 3 && drag == 0)
                    {
                        Rat.DragnDropSlow(PointsAndRectangles.ds1, PointsAndRectangles.de1, 5);
                        drag = 1;
                        Thread.Sleep(1000);
                    }//сдвиг

                    if (x > 5 && drag == 1)
                    {
                        Rat.DragnDropSlow(PointsAndRectangles.ds2, PointsAndRectangles.de2, 5);
                        drag = 2;
                        Thread.Sleep(1000);
                    }//сдвиг

                    if (x > 7)
                    {
                        break;
                    }//прерывание цикла в случае множества сломанных

                    if (hm.CarFixed(x))
                    {
                        NotePad.DoLog("Тачка " + (x + 1) + " исправна");
                        while (!fc.ItsGarage())
                        {
                            Thread.Sleep(2000);
                        }
                        Rat.DragnDropSlow(b[x], a[h + uhl], 8);
                        h++;
                        n--;
                    }
                    else
                    {
                        NotePad.DoLog("Тачка " + x + " не готова");
                    }
                    x++;
                }
            }

            int grayslots = fc.CheckHandSlot(uhl + 1, uhl + neededcars);

            NotePad.DoLog(grayslots + " слотов остались пустыми");
            return(grayslots);
        }
        public void ToClubs()
        {
            bool      needToDragMap = false;
            FastCheck fc            = new FastCheck();
            bool      flag          = false;

            do
            {
                if (fc.NoxRestartMessage())
                {
                    Rat.Clk(PointsAndRectangles.noxRestartMessageAcceptance);
                    Thread.Sleep(1000);
                    Rat.Clk(PointsAndRectangles.edgeOfTheScreen);
                    Thread.Sleep(120000);
                    Process.Start(@"C:\Program Files (x86)\Nox\bin\Nox.exe", "-clone:Nox_1");
                }//nox restart message
                if (fc.StartIcon())//Icon
                {
                    Rat.Clk(PointsAndRectangles.clkTheIcon);
                }
                //if (fc.BrokenInterface()) Rat.Clk(PointsAndRectangles.brokenInterfaceAcceptance);//close notify
                if (fc.LostConnection())
                {
                    Rat.Clk(PointsAndRectangles.reconnectionAfterLostConnection);                     //reconnect
                }
                //if (fc.Google()) Rat.Clk(PointsAndRectangles.googleNotificationAcceptance);//google notify
                if (fc.FBcontinue())
                {
                    Rat.Clk(PointsAndRectangles.fbFucksBrain);                 //fb f***s brain
                }
                if (fc.StartButton())
                {
                    Rat.Clk(PointsAndRectangles.buttonStart);//Start game
                    Thread.Sleep(5000);
                }
                if (fc.HeadPage())
                {
                    Rat.Clk(PointsAndRectangles.toEvents);//Events
                    Thread.Sleep(2000);
                }
                if (fc.DailyBounty())
                {
                    AcceptDailyBounty();
                }
                fc.Bounty();
                if (fc.SeasonEndsBounty())
                {
                    Thread.Sleep(500);
                    Rat.Clk(PointsAndRectangles.seasonEndAcceptance);
                    NotePad.DoLog("получил награду за сезон");
                }
                CheckConnection();
                UniversalErrorDefense();
                if (fc.EventPage())
                {
                    if (fc.InCommonEvent())
                    {
                        Thread.Sleep(500);
                        Rat.Clk(PointsAndRectangles.buttonBack);//back
                    }
                    else
                    {
                        Thread.Sleep(500);
                        Rat.Clk(PointsAndRectangles.toClubs);//Clubs
                        needToDragMap = true;
                    }
                }
                if (fc.ClubMap())
                {
                    flag = true;
                }
                Thread.Sleep(1500);
            } while (!flag);

            if (needToDragMap)
            {
                DragMap();
            }
        }
Exemple #6
0
        public bool PathToGarage()
        {
            FastCheck fc           = new FastCheck();
            bool      positionflag = false;
            bool      continuegame = false;

            do
            {
                if (fc.Bounty())
                {
                    NotePad.DoLog("получил награду");
                    positionflag = true;
                }

                if (fc.SeasonIsEnded())
                {
                    Thread.Sleep(500);
                    Rat.Clk(PointsAndRectangles.acceptSeasonEnd);
                    NotePad.DoLog("сезон окончен");
                }

                if (fc.SeasonEndsBounty())
                {
                    Thread.Sleep(500);
                    Rat.Clk(PointsAndRectangles.bountyForSeason);
                    NotePad.DoLog("получил награду за сезон");
                }

                if (fc.ClubMap())
                {
                    Thread.Sleep(2000);

                    if (fc.ClubMap())
                    {
                        NotePad.DoLog("выкинуло на карту");
                        positionflag = true;
                    }
                }

                if (fc.EventEnds())
                {
                    NotePad.DoLog("эвент окончен");
                    Rat.Clk(PointsAndRectangles.eventIsEnd);//Accept Message
                    Thread.Sleep(3000);
                    positionflag = true;
                }

                if (fc.CarMenu())
                {
                    Thread.Sleep(500);
                    NotePad.DoLog("Закрываю меню автомобиля");
                    Rat.Clk(PointsAndRectangles.closeCarCard);
                    Thread.Sleep(1000);
                }

                if (fc.ControlScreen())
                {
                    Thread.Sleep(500);
                    NotePad.DoLog("Перехожу в гараж");
                    Rat.Clk(PointsAndRectangles.controlScreenToGarage);//Play
                    Thread.Sleep(1000);
                }

                /*
                 * if (fc.BugControlScreen())
                 * {
                 *  Thread.Sleep(500);
                 *  NotePad.DoLog("Bug with Control Screen");
                 *  Rat.Clk(PointsAndRectangles.bugwithControlScreen);//Back
                 *  Thread.Sleep(1000);
                 * }*/

                if (fc.ItsGarage())
                {
                    positionflag = true;
                    NotePad.DoLog("Нахожусь в гараже");
                    continuegame = true;
                }
            } while (!positionflag);

            return(continuegame);
        }
Exemple #7
0
        public void TimeToRace()
        {
            FastCheck        fc = new FastCheck();
            SpecialEvents    se = new SpecialEvents();
            TrackInfo        ti = new TrackInfo();
            GrandArrangement ga = new GrandArrangement();

            int[] a1 = ti.Tracks();   //Track info
            int[] b1 = ti.Grounds();  //Ground info
            int[] c1 = ti.Weathers(); //Weather info

            bool raceIsEnd   = false;
            bool raceIsStart = false;
            int  waiter      = 0;

            do
            {
                if (waiter == 180)
                {
                    se.RestartBot();
                }
                se.UniversalErrorDefense();
                if (fc.ClubMap())
                {
                    NotePad.DoLog("вылетел из заезда");
                    raceIsEnd = true;
                }
                if (fc.Bounty())
                {
                    NotePad.DoLog("вылетел из заезда");
                    raceIsEnd = true;
                }
                if (fc.EnemyIsReady())
                {
                    Thread.Sleep(1000);
                    Rat.Clk(PointsAndRectangles.ChooseAnEnemy);//ChooseanEnemy
                    NotePad.DoLog("противник выбран");
                }
                if (fc.ArrangementWindow())
                {
                    NotePad.DoLog("загрузился экран расстановки");
                    Thread.Sleep(1000);
                    ga.Arrangement(a1, b1, c1);
                    NotePad.DoLog("расстановка выполнена");
                }
                if (fc.RaceOn() && !raceIsStart)
                {
                    raceIsStart = true;
                    NotePad.DoLog("заезд начался");
                    Thread.Sleep(2000);
                    Rat.Clk(PointsAndRectangles.forceTheRace); //ускорить заезд, клик в пусой области
                }
                if (!fc.RaceOn() && raceIsStart)
                {
                    NotePad.DoLog("заезд окончен");
                    raceIsEnd = true;
                }
                Thread.Sleep(1000);
                waiter++;
            } while (!raceIsEnd);
        }