Example #1
0
        public Skills(Client _c, GameServer _gs)
        {
            InitializeComponent();
            c = _c;
            gs = _gs;
            condition.Items.Add("Always");
            condition.Items.Add("HP");
            condition.Items.Add("Distance");

            compare.Items.Add("=");
            compare.Items.Add(">");
            compare.Items.Add("<");

            condition.SelectedIndex = 0;
            compare.SelectedIndex = 0;
            value.Text = "0";

            //skill s = new skill();
            //s.name = "f**k";
            //s.id = 12203;
            //skill s1 = new skill();
            //s1.name = "suck";
            //s1.id = 12205;
            //skill s2 = new skill();
            //s2.name = "duck";
            //s2.id = 12204;

            //sl.Items.Add(s1);
            //sl.Items.Add(s2);
            //sl.Items.Add(s);
        }
Example #2
0
        public Fight(Client _c, GameServer _gs)
        {
            buffid = 0;
            c = _c;
            gs = _gs;

            InitializeComponent();
        }
Example #3
0
 public BotView(GameServer _gs)
 {
     gs = _gs;
     newplayers = new List<uint>();
     deletedplayer = new List<uint>();
     players = new List<uint>();
     listlock = new Object();
     InitializeComponent();
 }
Example #4
0
        public BuffForm(Client _c, GameServer _gs)
        {
            c = _c;
            gs = _gs;
            InitializeComponent();

            c.doafterskill.Clear();
            c.doonskill.Clear();

            foreach (skillmap s in gs.skills.Values)
            {
                cbOn.Items.Add(s);
                cbAfter.Items.Add(s);
            }
        }
Example #5
0
        public BuffForm(Client _c, GameServer _gs)
        {
            c = _c;
            gs = _gs;
            InitializeComponent();
            onbufflist = new ComboBox[4];
            doonbufflist = new ComboBox[4];
            afterbufflist = new ComboBox[4];
            doafterbufflist = new ComboBox[4];
            onbufflist[0] = comboBox1;
            onbufflist[1] = comboBox4;
            onbufflist[2] = comboBox6;
            onbufflist[3] = comboBox8;

            doonbufflist[0] = comboBox2;
            doonbufflist[1] = comboBox3;
            doonbufflist[2] = comboBox5;
            doonbufflist[3] = comboBox7;

            afterbufflist[0] = comboBox10;
            afterbufflist[1] = comboBox12;
            afterbufflist[2] = comboBox16;
            afterbufflist[3] = comboBox14;

            doafterbufflist[0] = comboBox9;
            doafterbufflist[1] = comboBox11;
            doafterbufflist[2] = comboBox15;
            doafterbufflist[3] = comboBox13;

            c.doafterskill.Clear();
            c.doonskill.Clear();

            foreach (ComboBox d in onbufflist)
            {
                foreach (string s in gs.skills.Values)
                    d.Items.Add(s);

            }
            foreach (ComboBox d in afterbufflist)
            {
                foreach (string s in gs.skills.Values)
                    d.Items.Add(s);

            }
        }
Example #6
0
        public Defense(Client _c, GameServer _gs)
        {
            InitializeComponent();
            c = _c;
            gs = _gs;
            condition.Items.Add("Always");
            condition.Items.Add("HP");
            condition.Items.Add("Distance");

            compare.Items.Add("=");
            compare.Items.Add(">");
            compare.Items.Add("<");

            Effects sleep, hold, medusa, poison;

            medusa = new Effects();
            medusa.name = "Medusa";
            medusa.id = 2048;

            sleep = new Effects();
            sleep.name = "Sleep";
            sleep.id = 128;

            hold = new Effects();
            hold.name = "Root";
            hold.id = 512;

            poison = new Effects();
            poison.name = "Poison";
            poison.id = 2;

            eff.Items.Add(medusa);
            eff.Items.Add(sleep);
            eff.Items.Add(hold);
            eff.Items.Add(poison);

            condition.SelectedIndex = 0;
            compare.SelectedIndex = 0;
            value.Text = "0";
            eff.SelectedIndex = 0;
            tb_mp.Text = "1500";
        }
Example #7
0
 public ItemUseForm(Client _c, GameServer _gs)
 {
     InitializeComponent();
     c = _c;
     _gs = gs;
 }
Example #8
0
        public Client(Socket _socket, GameServer _gs)
        {
            try
            {
                gs = _gs;
                proxy2client = _socket;
                cv = new ClientView(this);
                gs.bwindow.SuspendLayout();
                gs.bwindow.d_addClient(cv);
                gs.bwindow.ResumeLayout(true);

                askills = new List<AttackSkills>();
                dskills = new List<DefenseSkills>();
                skilllist = new List<uint>();
                doafterskill = new Dictionary<uint, uint>();
                doonskill = new Dictionary<uint, uint>();
                buffform = new BuffForm(this, gs);
                m_lock = new Object();
                mq = new Queue();
                updateq = new Queue();
                updateq_lock = new Object();
                hpmq = new Queue();
                q_mre = new ManualResetEvent(false);
                update_mre = new ManualResetEvent(false);
                asform = new Skills(this, gs);
                dsform = new Defense(this, gs);
                x = new Random();
                pinfo = new Player_Info();
                aslock = new object();
                dslock = new object();

                PeriodicThread = new Thread(PeriodicFunction);
                updatestatusthread = new Thread(this.updatestatefunc);
                skillthread = new Thread(this.skillfunction);
                defendthread = new Thread(this.defendfunction);
                attackthread = new Thread(this.attackfunction);
                movethread = new Thread(this.movepawnthread);
                statusmonitor = new Thread(this.statusmonthread);

                inthread = new Thread(this.dataIn);
                outthread = new Thread(this.dataOut);
                sendthread = new Thread(this.sendData);

                IPEndPoint remoteGS = new IPEndPoint(IPAddress.Parse(gs.gsIP), gs.gsPort);
                proxy2server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                proxy2server.Connect(remoteGS);

                p2c =new NetworkStream(proxy2client,FileAccess.ReadWrite, true);
                p2s =new NetworkStream(proxy2server, FileAccess.ReadWrite, true);

                {
                    Client c = (Client)this;
                    byte[] buffer;
                    int length = 0;
                    int lenlo = c.p2c.ReadByte();
                    int lenhi = c.p2c.ReadByte();

                    length = lenhi * 256 + lenlo;

                    buffer = new byte[length];
                    buffer[0] = (byte)lenlo;
                    buffer[1] = (byte)lenhi;
                    buffer[2] = (byte)10;
                    c.p2c.Read(buffer, 2, length - 2);
                    c.p2s.Write(buffer, 0, length);

                    lenlo = c.p2s.ReadByte();
                    lenhi = c.p2s.ReadByte();
                    length = lenhi * 256 + lenlo;
                    buffer = new byte[length];
                    buffer[0] = (byte)lenlo;
                    buffer[1] = (byte)lenhi;

                    c.p2s.Read(buffer, 2, length - 2);

                    byte[] key = new byte[16];

                    key[0] = buffer[4];
                    key[1] = buffer[5];
                    key[2] = buffer[6];
                    key[3] = buffer[7];
                    key[4] = buffer[8];
                    key[5] = buffer[9];
                    key[6] = buffer[10];
                    key[7] = buffer[11];
                    key[8] = (byte)0xc8;
                    key[9] = (byte)0x27;
                    key[10] = (byte)0x93;
                    key[11] = (byte)0x01;
                    key[12] = (byte)0xa1;
                    key[13] = (byte)0x6c;
                    key[14] = (byte)0x31;
                    key[15] = (byte)0x97;

                    c.crypt_in = new Crypt();
                    c.crypt_out = new Crypt();
                    c.crypt_client_in = new Crypt();
                    c.crypt_client_out = new Crypt();

                    //crypt for data from server
                    c.crypt_in.setKey(key);
                    //crypt for data to server
                    c.crypt_out.setKey(key);
                    //crypt for data from client
                    c.crypt_client_out.setKey(key);
                    //crypt for data to client
                    c.crypt_client_in.setKey(key);

                    // Console.WriteLine(length);
                    c.p2c.Write(buffer, 0, length);

                }
                System.Console.WriteLine("got keys");
                if (gs.leader == null)
                    gs.leader = this;

                //inthread.Priority = ThreadPriority.BelowNormal;
                //outthread.Priority = ThreadPriority.BelowNormal;

                outthread.Name = "outthread";
                inthread.Name = "inthread";
                sendthread.Name = "sendthread";

                outthread.Start();
                inthread.Start();
                sendthread.Start();
                updatestatusthread.Start();

                statusmonitor.Start();
                movethread.Start();
                attackthread.Start();
                defendthread.Start();
                skillthread.Start();

                PeriodicThread.Start();
            }
            catch
            {
                if (gs.leader == this)
                {
                    gs.leader = null;
                }
                proxy2client.Close();
                proxy2server.Close();

                gs.bwindow.d_removeClient(cv);
                inthread.Abort();
                outthread.Abort();
                sendthread.Abort();
                updatestatusthread.Abort();
                movethread.Abort();
                statusmonitor.Abort();
                if(cv != null)
                    gs.bwindow.d_removeClient(cv);

            }
        }