internal void method_14()
 {
     this.GotoTown = false;
     this.class46_0 = null;
     this.method_11(null);
     this.stack_0.Clear();
 }
 internal void method_17(string string_2)
 {
     GClass0.Class62 @class = new GClass0.Class62();
     @class.string_0 = string_2;
     @class.gclass0_0 = this;
     if (GClass0.bool_4)
     {
         this.method_4("LogoutAndStartNewQuest:  Questchange is already in progress");
     }
     else
     {
         GClass0.bool_4 = true;
         GClass0.bool_3 = false;
         this.method_11(null);
         this.class46_0 = null;
         Task.Factory.StartNew(new Action(@class.method_0));
     }
 }
        internal void method_13()
        {
            ThreadStart threadStart = null;
            if (this.int_1++ < 20)
            {
                ContainerA.AddToFileLog("Frame #" + this.int_1);
            }
            if (this.bool_1)
            {
                Framework.ActivateGame();
            }
            if (this.method_10() != null && !this.method_8() && Framework.IsIngame)
            {
                Framework.ActivateGame();
                if (Framework.IsDisconnected())
                {
                    if (threadStart == null)
                    {
                        threadStart = new ThreadStart(this.method_21);
                    }
                    new Thread(threadStart).Start();
                    if (GClass0.threadStart_0 == null)
                    {
                        GClass0.threadStart_0 = new ThreadStart(GClass0.smethod_1);
                    }
                    new Thread(GClass0.threadStart_0).Start();
                    this.method_9(true);
                    string string_ = "Connection to gameserver lost, terminating game in 5s";
                    this.method_5(string_);
                    InjectedWindow.Instance.method_16(string_);
                }
                else
                {
                    if (Framework.Hero.CurrentHP < 0.005f)
                    {
                        if (Environment.TickCount - this.int_0 >= 1000)
                        {
                            this.method_10().DeathCounter++;
                            this.method_18();
                            int restartOnXDeaths = InjectedWindow.Instance.class71_0.RestartOnXDeaths;
                            if (restartOnXDeaths > 0 && this.method_10().DeathCounter >= restartOnXDeaths)
                            {
                                this.method_17(this.method_10().LoadedFromFileName);
                            }
                            else
                            {
                                this.int_0 = Environment.TickCount;
                                this.method_5("Reviving at checkpoint...");
                                Framework.ReviveAtCheckpointButton();
                                this.method_10().RewindToLastSavepoint();
                            }
                        }
                    }
                    else
                    {
                        if (!Framework.IsInAnimation())
                        {
                            Class96.smethod_3();
                            try
                            {
                                IEnumerable<Class44> arg_1C9_0 = this.list_0;
                                if (GClass0.func_0 == null)
                                {
                                    GClass0.func_0 = new Func<Class44, int>(GClass0.smethod_2);
                                }
                                foreach (Class44 current in arg_1C9_0.OrderBy(GClass0.func_0))
                                {
                                    if (current.vmethod_0())
                                    {
                                        if (current != this.object_0)
                                        {
                                            this.object_0 = current;
                                            if (this.bool_2)
                                            {
                                                this.method_5(current.ToString());
                                            }
                                            return;
                                        }
                                        GClass0.CurrentStateName = ((CoreStatePriority)current.vmethod_2()).ToString();
                                        GClass0.CurrentStateTarget = current.vmethod_3();
                                        current.vmethod_1();
                                        return;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Error in Core:\n" + ex.Message);
                                Debugger.Break();
                            }
                            Class94 @class;
                            while (true)
                            {
                                bool flag = false;
                                if ((@class = this.list_1.FirstOrDefault<Class94>()) != null)
                                {
                                    break;
                                }
                                if (!flag)
                                {

                                }
                            }
                            if (@class.vmethod_1())
                            {
                                this.list_1.Remove(@class);
                            }
                            @class.vmethod_0();
                            return;
                            try
                            {
                                IL_2D0:
                                if (this.class46_0 != null)
                                {
                                    if (this.class46_0.vmethod_0())
                                    {
                                        if (this.class46_0 != this.object_0)
                                        {
                                            this.object_0 = this.class46_0;
                                            if (this.bool_2)
                                            {
                                                this.method_5(this.class46_0.ToString());
                                            }
                                            return;
                                        }
                                        this.class46_0.vmethod_1();
                                        return;
                                    }
                                    else
                                    {
                                        this.class46_0 = null;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Error in Searcher: " + ex.Message);
                                Debugger.Break();
                            }
                            try
                            {
                                if (this.stack_0.Count > 0)
                                {
                                    Class57 class2 = this.stack_0.Peek();
                                    if (class2.vmethod_1())
                                    {
                                        if (this.bool_2 && class2 != this.object_0)
                                        {
                                            this.object_0 = class2;
                                            this.method_5(class2.ToString());
                                        }
                                        class2.vmethod_2();
                                        return;
                                    }
                                    this.list_2.Remove(class2);
                                    this.list_2.Add((Class57)Activator.CreateInstance(class2.GetType()));
                                    this.stack_0.Pop();
                                    return;
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Error in Event: " + ex.Message);
                                Debugger.Break();
                            }
                            try
                            {
                                if (this.method_10() != null && !this.method_10().ScriptFinished)
                                {
                                    if (this.method_10() != this.object_0)
                                    {
                                        this.object_0 = this.method_10();
                                        if (this.bool_2)
                                        {
                                            this.method_5("Script: " + this.method_10().CurrentIndex.ToString());
                                        }
                                    }
                                    else
                                    {
                                        GClass0.CurrentStateName = "Script";
                                        if (this.script_0.CurrentIndex >= 0 && this.script_0.CurrentIndex < this.script_0.ScriptActions.Count)
                                        {
                                            string str = "";
                                            if (Environment.TickCount - this.int_2 > 500)
                                            {
                                                this.int_2 = Environment.TickCount;
                                                Move move = this.script_0.ScriptActions[this.script_0.CurrentIndex] as Move;
                                                if (move != null)
                                                {
                                                    float num = Vector3.Distance(move.Target, Framework.Hero.Position);
                                                    str = " (dist: " + num + ")";
                                                }
                                            }
                                            GClass0.CurrentStateTarget = this.script_0.ScriptActions[this.script_0.CurrentIndex].ToString() + str;
                                        }
                                        else
                                        {
                                            GClass0.CurrentStateTarget = "Script index out of range";
                                        }
                                        this.method_10().Run();
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("Error in Quest: " + ex.Message);
                                Debugger.Break();
                            }
                        }
                    }
                }
            }
        }