Esempio n. 1
0
 public static void ConnectToWS(string[] c)
 {
     int x = Convert.ToInt32(c[0]) - 1;
     try
     {
         if (lclient == null || lclient.Connected == false || lclient.Realmlist.Length < 1)
         {
             Log.WriteLine(LogType.Error, "Please connect to the logon server first.");
             return;
         }
         lclient.HardDisconnect();
         wclient = new WorldServerClient(Config.Login, lclient.Realmlist[x], lclient.mKey);
         wclient.Connect();
     }
     catch (Exception ex)
     {
         Log.WriteLine(LogType.Error, "Exception Occured");
         Log.WriteLine(LogType.Error, "Message: {0}", ex.Message);
         Log.WriteLine(LogType.Error, "Stacktrace: {0}", ex.StackTrace);
     }
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (Status == ServiceType.None)
            {
                if (host.Text == "" || login.Text == "" || password.Text == "")
                {
                    MessageBox.Show("Please insert your logon data", "Error!");
                    return;
                }
                cl = new LogonServerClient(host.Text, login.Text, password.Text);

                cl.Connect();
                button1.Enabled = false;
                realmlist.Enabled = true;
            }
            else if (Status == ServiceType.Logon)
            {
                Realm rl = new Realm();
                if (realmlist.SelectedItem != null)
                {
                    rl = cl.Realmlist.First(s => s.Name == realmlist.SelectedItem.ToString());
                }
                else
                {
                    HandleDisconnect();
                    return;
                }
                wl = new WorldServerClient(login.Text, rl, cl.mKey);
                //cl.HardDisconnect();
                wl.Connect();
                button1.Enabled = false;
                charlist.Enabled = true;
                realmlist.Enabled = false;
                this.UseWaitCursor = true;
            }
            else if (Status == ServiceType.World)
            {
                Character rl = wl.Charlist.First(s => s.Name == charlist.SelectedItem.ToString());
                if (rl.Name == null)
                    return;

                wl.LoginPlayer(rl);

                this.Text = String.Format("[{0}][{1}] {2} - {3} on {4}:3724", rl.Race, rl.Class, rl.Name, wl.realm.Name, wl.realm.Address);

                button1.Enabled = false;
                charlist.Enabled = false;
                ChatTab cTab = new ChatTab("", ChatMsg.Say);
                AddTab(cTab);
            }
        }