Example #1
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);
            }
        }
Example #2
0
        private void HandleChatMsg(ChatMsg type, string channel, string user, string msg)
        {
            ChatTab found = new ChatTab();

            if (type == ChatMsg.Say || type == ChatMsg.Yell)
            {
                found = Tabs.Find(s => s.Type == ChatMsg.Say);
            }

            else if (type == ChatMsg.System || type == ChatMsg.System2)
            {
                type  = ChatMsg.System;
                found = Tabs.Find(s => s.Type == ChatMsg.System);
            }

            else if (type == ChatMsg.Guild)
            {
                found = Tabs.Find(s => s.Type == type);
            }

            else if (type == ChatMsg.Channel)
            {
                found = Tabs.Find(s => s.Identificator == channel);
            }

            else if (type == ChatMsg.Whisper)
            {
                found = Tabs.Find(s => s.Identificator == user);
            }
            if (found == null)
            {
                ChatTab nTab = new ChatTab();
                if (type == ChatMsg.Channel)
                {
                    nTab = new ChatTab(channel, type);
                }
                else
                {
                    nTab = new ChatTab(user, type);
                }
                nTab.AddMessage(msg, user);
                tabs.TabPages.Add(nTab);
                Tabs.Add(nTab);
            }
            else
            {
                found.AddMessage(msg, user);
            }
        }
Example #3
0
 public void RemoveTab(ChatTab tab)
 {
     Tabs.Remove(tab);
     tabs.Controls.Remove(tab);
 }
Example #4
0
 public void AddTab(ChatTab tab)
 {
     Tabs.Add(tab);
     tabs.Controls.Add(tab);
 }
Example #5
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);
            }
        }
Example #6
0
 public void RemoveTab(ChatTab tab)
 {
     Tabs.Remove(tab);
     tabs.Controls.Remove(tab);
 }
Example #7
0
 public void AddTab(ChatTab tab)
 {
     Tabs.Add(tab);
     tabs.Controls.Add(tab);
 }
Example #8
0
        private void HandleChatMsg(ChatMsg type, string channel, string user, string msg)
        {
            ChatTab found = new ChatTab();

            if (type == ChatMsg.Say || type == ChatMsg.Yell)
            {
                found = Tabs.Find(s => s.Type == ChatMsg.Say);
            }

            else if (type == ChatMsg.System || type == ChatMsg.System2)
            {
                type = ChatMsg.System;
                found = Tabs.Find(s => s.Type == ChatMsg.System);
            }

            else if (type == ChatMsg.Guild)
            {
                found = Tabs.Find(s => s.Type == type);
            }

            else if (type == ChatMsg.Channel)
            {
                found = Tabs.Find(s => s.Identificator == channel);
            }

            else if (type == ChatMsg.Whisper)
            {
                found = Tabs.Find(s => s.Identificator == user);
            }
            if (found == null)
            {
                ChatTab nTab = new ChatTab();
                if (type == ChatMsg.Channel)
                {
                    nTab = new ChatTab(channel, type);
                }
                else
                {
                    nTab = new ChatTab(user, type);
                }
                nTab.AddMessage(msg, user);
                tabs.TabPages.Add(nTab);
                Tabs.Add(nTab);
            }
            else
            {
                found.AddMessage(msg, user);
            }
        }