Esempio n. 1
0
        public void network_exception()
        {
            if (Globals.dc_on_ig_close)
            {
                Globals.l2net_home.Add_Error("Terminating all connections as due to break in client connection");
                Util.Stop_Connections();
            }

            if (Globals.dump_pbuff_on_ig_close)
            {
                ByteBuffer bbtmp;
                System.Text.StringBuilder dumpbuilder;

                for (int pkt = 0; pkt < Globals.gamedata.stc_buffer.Count; pkt++)
                {
                    bbtmp = (ByteBuffer)Globals.gamedata.stc_buffer.Pop();
                    // Globals.l2net_home.Add_Error("pkt: " + pkt + "bbtmp.length: " + bbtmp.Length());
                    dumpbuilder = new System.Text.StringBuilder();
                    int z = 0;
                    for (int i = 0; i < bbtmp.Length(); i++)
                    {
                        z = bbtmp.ReadByte();
                        dumpbuilder.Append(z.ToString("X2"));
                        dumpbuilder.Append(" ");
                    }
                    Globals.l2net_home.Add_Dump(dumpbuilder.ToString(), true);
                }
            }
        }
Esempio n. 2
0
        public void KillEverything()
        {
            if (this.label_target_name.InvokeRequired)
            {
                KillEverything_Callback d = new KillEverything_Callback(KillEverything);
                label_target_name.Invoke(d);
                return;
            }

            //try to kill everything...
            Globals.gamedata.running = false;

            Util.Stop_Connections();

            Util.KillThreads();

            System.Threading.Thread.Sleep(Globals.SLEEP_KillReset);

            Util.Setup_Threads();

            if (Globals.gamedata.login_failed)
            {
                Globals.gamedata.login_failed = false;
                menuItem_cmd_logon_Click(null, null);
            }
        }
Esempio n. 3
0
        private void UpdateKeyboard()
        {
            KeyboardState state = keyboard.GetCurrentState();

            bool pressed = false;

            foreach (Key k in state.PressedKeys)
            {
                if (k.ToString() == Globals.DirectInputKey)
                {
                    pressed = true;

                    if (Globals.DirectInputLast == false)
                    {
                        Globals.l2net_home.Toggle_Botting();
                        //Util.KillThreads();
                        Globals.DirectInputLast = true;
                    }
                    else
                    {
                    }
                }
                else if (Globals.DirectInputSetup == true)
                {
                    Globals.DirectInputSetupValue = k.ToString();

                    try
                    {
                        Globals.DirectInputSetup = false;
                        Globals.setupwindow.label_toggle_key.Text        = Globals.DirectInputSetupValue;
                        Globals.setupwindow.button_change_toggle.Enabled = true;

                        Globals.setupwindow.button_change_kill.Enabled   = true;
                        Globals.setupwindow.comboBox_voice.Enabled       = true;
                        Globals.setupwindow.textBox_l2path.Enabled       = true;
                        Globals.setupwindow.textBox_key.Enabled          = true;
                        Globals.setupwindow.comboBox_texturemode.Enabled = true;
                        Globals.setupwindow.comboBox_viewrange.Enabled   = true;
                    }
                    catch
                    {
                    }
                }
                else if (k.ToString() == Globals.DirectInputKey2)
                {
                    pressed = true;

                    if (Globals.DirectInputLast2 == false)
                    {
                        Globals.DirectInputLast2 = true;
                        Util.KillThreads();
                        Util.Stop_Connections();
                    }
                    else
                    {
                    }
                }
                else if (Globals.DirectInputSetup2 == true)
                {
                    Globals.DirectInputSetupValue2 = k.ToString();

                    try
                    {
                        Globals.DirectInputSetup2 = false;
                        Globals.setupwindow.label_kill_key.Text        = Globals.DirectInputSetupValue2;
                        Globals.setupwindow.button_change_kill.Enabled = true;

                        Globals.setupwindow.button_change_toggle.Enabled = true;
                        Globals.setupwindow.comboBox_voice.Enabled       = true;
                        Globals.setupwindow.textBox_l2path.Enabled       = true;
                        Globals.setupwindow.textBox_key.Enabled          = true;
                        Globals.setupwindow.comboBox_texturemode.Enabled = true;
                        Globals.setupwindow.comboBox_viewrange.Enabled   = true;
                    }
                    catch
                    {
                    }
                }
            }

            if (pressed == false)
            {
                Globals.DirectInputLast  = false;
                Globals.DirectInputLast2 = false;
            }
        }
Esempio n. 4
0
 private void forceLogToolStripMenuItem_Click(object sender, EventArgs e)
 {
     Util.Stop_Connections();
 }
Esempio n. 5
0
        private static void PlayAlerts()
        {
            try
            {
                bool beep   = false;
                bool logout = false;

                //check sounds/logout
                if (Globals.gamedata.alertoptions.beepon_2waywar || Globals.gamedata.alertoptions.logouton_2waywar)
                {
                    if (Check_2WayWar())
                    {
                        if (Globals.gamedata.alertoptions.beepon_2waywar)
                        {
                            beep = true;
                            Globals.l2net_home.Add_Alarm("2 way war in range!");
                        }
                        if (Globals.gamedata.alertoptions.logouton_2waywar)
                        {
                            logout = true;
                            Globals.l2net_home.Add_Logout("2 way war in range!");
                        }
                    }
                }
                if (Globals.gamedata.alertoptions.beepon_1waywar || Globals.gamedata.alertoptions.logouton_1waywar)
                {
                    if (Check_1WayWar())
                    {
                        if (Globals.gamedata.alertoptions.beepon_1waywar)
                        {
                            beep = true;
                            Globals.l2net_home.Add_Alarm("1 way war in range!");
                        }
                        if (Globals.gamedata.alertoptions.logouton_1waywar)
                        {
                            logout = true;
                            Globals.l2net_home.Add_Logout("1 way war in range!");
                        }
                    }
                }
                if (Globals.gamedata.alertoptions.beepon_n1waywar || Globals.gamedata.alertoptions.logouton_n1waywar)
                {
                    if (Check_N1WayWar())
                    {
                        if (Globals.gamedata.alertoptions.beepon_n1waywar)
                        {
                            beep = true;
                            Globals.l2net_home.Add_Alarm("-1 way war in range!");
                        }
                        if (Globals.gamedata.alertoptions.logouton_n1waywar)
                        {
                            logout = true;
                            Globals.l2net_home.Add_Logout("-1 way war in range!");
                        }
                    }
                }

                //check if i need to play sounds
                if (Globals.gamedata.alertoptions.beepon_hp)
                {
                    if (Check_HP())
                    {
                        beep = true;
                        Globals.l2net_home.Add_Alarm("hp too low!");
                    }
                }
                if (Globals.gamedata.alertoptions.beepon_mp)
                {
                    if (Check_MP())
                    {
                        beep = true;
                        Globals.l2net_home.Add_Alarm("mp too low!");
                    }
                }
                if (Globals.gamedata.alertoptions.beepon_cp)
                {
                    if (Check_CP())
                    {
                        beep = true;
                        Globals.l2net_home.Add_Alarm("cp too low!");
                    }
                }
                if (Globals.gamedata.alertoptions.beepon_clan)
                {
                    if (Check_Clan())
                    {
                        beep = true;
                        Globals.l2net_home.Add_Alarm("bad clan in range!");
                    }
                }
                if (Globals.gamedata.alertoptions.beepon_player)
                {
                    if (Check_Player())
                    {
                        beep = true;
                        Globals.l2net_home.Add_Alarm("bad player in range!");
                    }
                }

                //check if I need to log out
                if (Globals.gamedata.alertoptions.logouton_hp)
                {
                    if (Check_HP_Logout())
                    {
                        logout = true;
                        Globals.l2net_home.Add_Logout("hp too low!");
                    }
                }
                if (Globals.gamedata.alertoptions.logouton_mp)
                {
                    if (Check_MP_Logout())
                    {
                        logout = true;
                        Globals.l2net_home.Add_Logout("mp too low!");
                    }
                }
                if (Globals.gamedata.alertoptions.logouton_cp)
                {
                    if (Check_CP_Logout())
                    {
                        logout = true;
                        Globals.l2net_home.Add_Logout("cp too low!");
                    }
                }
                if (Globals.gamedata.alertoptions.logouton_clan)
                {
                    if (Check_Clan_Logout())
                    {
                        logout = true;
                        Globals.l2net_home.Add_Logout("bad clan in range!");
                    }
                }
                if (Globals.gamedata.alertoptions.logouton_player)
                {
                    if (Check_Player_Logout())
                    {
                        logout = true;
                        Globals.l2net_home.Add_Logout("bad player in range!");
                    }
                }

                if (beep)
                {
                    VoicePlayer.PlayAlarm();
                }
                if (logout)
                {
                    Util.Stop_Connections();
                }
            }
            catch
            {
                Globals.l2net_home.Add_Error("crash: Sound Alert Thread");
            }
        }