Exemple #1
0
        public void Close()
        {
            //ph.send_leave_253(); // leave server

            _logicThread.Abort();
            _logicThread.Join();
            chandler.Close();
            ph = null;
            chandler = null;

            form.getClientList().Remove(this);
        }
        public PacketHandler(ConnectionHandler ch, Form1 f, PlayerObject local, PlayerObject[] pl, Client client)
        {
            this.packetNumber = 0;
            this.ch = ch;
            this.form = f;
            this.local_player = local;
            players = pl;
            known_table = new KnownHandler[255];
            cl = client;

            known_table[1] = handshake;
            known_table[2] = failed_handshake;
            known_table[7] = fire;
            known_table[8] = advancedfire;
            known_table[9] = weaponchange;
            known_table[10] = positionUpdate;
            known_table[11] = positionUpdate;
            known_table[12] = rotationUpdate;
            known_table[13] = positionRotationUpdate;
            known_table[14] = positionRotationUpdate;
            known_table[15] = setpos;
            known_table[16] = reload;
            known_table[17] = hit;
            known_table[19] = killmsg;
            known_table[20] = teamchange;
            known_table[21] = spawnmsg;
            known_table[22] = roundstart;
            known_table[23] = weaponbuy;
            known_table[24] = weapondrop;
            known_table[25] = weaponpickup;
            known_table[26] = usepress;
            known_table[27] = projectile;
            known_table[28] = spray;
            known_table[30] = bomb;
            known_table[32] = specpos;
            known_table[33] = spawnitem;

            known_table[41] = unknown1;

            known_table[43] = vote;
            known_table[52] = flare;
            known_table[238] = newname;
            known_table[240] = chatmsg;
            known_table[247] = pinglist;
            known_table[248] = playerjoin;
            known_table[249] = pingstuff;
            known_table[252] = joinroutine_known;
            known_table[253] = playerleave;
        }
Exemple #3
0
        // initializes everything and sends join request to server
        public Client(IPAddress ipAddress, int port, string name, string password, int usgn_id, string sprayname,Form1 form)
        {
            chandler = new ConnectionHandler(ipAddress,port);
            local_player = new PlayerObject();
            players = new PlayerObject[32];
            for (int i = 0; i < 32; i++)
                players[i] = new PlayerObject();

            local_player.Name = name;
            local_player.Password = password;
            local_player.Usgn = usgn_id;
            local_player.Spraylogo = sprayname;

            ph = new PacketHandler(chandler, form, local_player, players,this);
            bl = new BotLogics(ph, players, form.getClientList());
            _logicThread = new Thread(new ThreadStart(bl.Run));
            _logicThread.Start();
            chandler.AddHandler(ph);
            ph.AddLogicHandler(bl);
            chandler.ReceiveMessages();
            ph.send_join_confirmation3();
            this.form = form;
        }