Esempio n. 1
0
        private static void LoopThread()
        {
// ReSharper disable ConvertToConstant.Local
            bool lalala = true;

// ReSharper restore ConvertToConstant.Local
            try
            {
                bool lastResult = true;
                IsConnected = true;
                StartTime   = Others.Times;

                if (!_trial)
                {
                    Thread.Sleep(10000);
                    while (true)
                    {
                        while (!Memory.WowMemory.ThreadHooked)
                        {
                            Thread.Sleep(3000);
                            lastResult = true;
                        }
                        while (!Usefuls.InGame)
                        {
                            Thread.Sleep(3000);
                            lastResult = true;
                        }

                        // Statistique
                        string reqStatistique = "?";
                        try
                        {
                            if (_levelStat == 0)
                            {
                                if (Usefuls.InGame && !Usefuls.IsLoading && Usefuls.GetHonorPoint >= 0)
                                {
                                    _honnorStat = Usefuls.GetHonorPoint;
                                }
                                else
                                {
                                    _honnorStat = -1;
                                }
                                _expStat   = nManager.Wow.ObjectManager.ObjectManager.Me.Experience;
                                _farmStat  = (int)Statistics.Farms;
                                _killStat  = (int)Statistics.Kills;
                                _levelStat = (int)nManager.Wow.ObjectManager.ObjectManager.Me.Level;
                            }
                            // Level
                            if (nManager.Wow.ObjectManager.ObjectManager.Me.Level - _levelStat > 0)
                            {
                                reqStatistique += "level=" +
                                                  (nManager.Wow.ObjectManager.ObjectManager.Me.Level - _levelStat);
                                _levelStat = (int)nManager.Wow.ObjectManager.ObjectManager.Me.Level;
                            }
                            else
                            {
                                reqStatistique += "level=0";
                            }
                            // Honnor
                            if (!Usefuls.InGame || Usefuls.IsLoading || Usefuls.GetHonorPoint < 0)
                            {
                                reqStatistique += "&honnor=0";
                            }
                            else if (Usefuls.GetHonorPoint >= 0)
                            {
                                if (_honnorStat >= 0)
                                {
                                    if (Usefuls.GetHonorPoint < _honnorStat)
                                    {
                                        _honnorStat     = Usefuls.GetHonorPoint;
                                        reqStatistique += "&honnor=0";
                                    }
                                    else if (Usefuls.GetHonorPoint - _honnorStat > 0)
                                    {
                                        reqStatistique += "&honnor=" + (Usefuls.GetHonorPoint - _honnorStat);
                                        _honnorStat     = Usefuls.GetHonorPoint;
                                    }
                                }
                                else if (_honnorStat < 0)
                                {
                                    _honnorStat     = Usefuls.GetHonorPoint;
                                    reqStatistique += "&honnor=0";
                                }
                            }
                            // Exp
                            if (nManager.Wow.ObjectManager.ObjectManager.Me.Experience - _expStat > 0)
                            {
                                reqStatistique += "&exp=" +
                                                  (nManager.Wow.ObjectManager.ObjectManager.Me.Experience - _expStat);
                                _expStat = nManager.Wow.ObjectManager.ObjectManager.Me.Experience;
                            }
                            else
                            {
                                if (nManager.Wow.ObjectManager.ObjectManager.Me.Experience < _expStat)
                                {
                                    _expStat = nManager.Wow.ObjectManager.ObjectManager.Me.Experience;
                                }

                                reqStatistique += "&exp=0";
                            }
                            // Farm
                            if (Statistics.Farms - _farmStat > 0)
                            {
                                reqStatistique += "&farm=" + (Statistics.Farms - _farmStat);
                                _farmStat       = (int)Statistics.Farms;
                            }
                            else
                            {
                                if (Statistics.Farms < _farmStat)
                                {
                                    _farmStat = (int)Statistics.Farms;
                                }

                                reqStatistique += "&farm=0";
                            }
                            // Kill
                            if (Statistics.Kills - _killStat > 0)
                            {
                                reqStatistique += "&kill=" + (Statistics.Kills - _killStat);
                                _killStat       = (int)Statistics.Kills;
                            }
                            else
                            {
                                if (Statistics.Kills < _killStat)
                                {
                                    _killStat = (int)Statistics.Kills;
                                }

                                reqStatistique += "&kill=0";
                            }
                        }
                        catch
                        {
                            reqStatistique = "";
                        }

                        if (!LoginThread.IsAlive)
                        {
                            LoginThread.Start();
                        }

                        // End Statistique

                        string resultReqLoop =
                            GetReqWithAuthHeader(Others.GetAuthScriptLink + reqStatistique + "&HardwareKey=" + HardwareKey, Login, Password)[0];
                        if (TrueResultLoop != resultReqLoop)
                        {
                            if (!lastResult)
                            {
                                break;
                            }
                            if (_ip != GetReqWithAuthHeader(Others.GetClientIPScriptLink, Login, Password)[1])
                            {
                                while (!ServerIsOnline())
                                {
                                    InteractGame.Sleep(10000);
                                }
                                Connect(Login, Password);
                                return;
                            }
                            lastResult = false;
                        }
                        else
                        {
                            lastResult = true;
                        }
                        Others.LUAGlobalVarDestructor();
                        InteractGame.Sleep(55000);
                    }
                }
                else
                {
                    DoLoginCheck();

                    int i = 0;
                    do
                    {
                        InteractGame.Sleep(0x3E8);
                        i++;
                        if (!LoginThread.IsAlive)
                        {
                            LoginThread.Start();
                        }
                    } while (i < (0x98B >> 1));
                }
            }
            catch (Exception e)
            {
                Logging.WriteError("DSfi^sdfDSOfijfze#1" + e);
            }
            IsConnected = false;
// ReSharper disable ConditionIsAlwaysTrueOrFalse
            if (lalala && IsFreeVersion)
// ReSharper restore ConditionIsAlwaysTrueOrFalse
            {
                Others.OpenWebBrowserOrApplication("http://goo.gl/Fzdgc");
            }
            else
            {
                Logging.WriteError("#tuk51t6#Connection error, close The Noob Bot. #sdffzFsd");
            }

            EndInformation();
        }