int spawnitem(PacketStream ps)
        {
            byte  wpn_id = ps.ReadByte();
            short tilex  = ps.ReadShort();
            short tiley  = ps.ReadShort();
            short uk1    = ps.ReadShort();

            return(1);
        }
        int positionUpdate(PacketStream ps)
        {
            byte         id  = ps.ReadByte();
            short        px  = ps.ReadShort();
            short        py  = ps.ReadShort();
            PlayerObject tmp = players[id];

            tmp.X = px; tmp.Y = py;
            return(1);
        }
        int setpos(PacketStream ps)
        {
            byte  id = ps.ReadByte();
            short x  = ps.ReadShort();
            short y  = ps.ReadShort();

            players[id].X = x;
            players[id].Y = y;
            return(1);
        }
        int roundstart(PacketStream ps)
        {
            ps.ReadByte();//unknown
            int count = ps.ReadByte();

            for (int i = 0; i < count; i++)
            {
                byte id = ps.ReadByte();

                if (id == own_id)
                {
                    botLogics.OnRoundStart();
                }

                short sx     = ps.ReadShort();
                short sy     = ps.ReadShort();
                float rot    = ps.ReadFloat();
                byte  wpn_id = ps.ReadByte();

                /*if (team == 1)
                 *  team = 2;
                 * else if (team == 2)
                 *  team = 1;*/
                byte uk2 = ps.ReadByte();
                byte uk3 = ps.ReadByte();


                if (id > 0 && id < 33)
                {
                    PlayerObject tmp = players[id];
                    tmp.Id = id;
                    //LogConsole(String.Format("mass spawn {0} wpn:{1} uk:{2} uk:{3}", tmp.Name, wpn_id, uk2, uk3));

                    tmp.X      = sx; tmp.Y = sy; tmp.Rotation = rot; tmp.Currentweapon = wpn_id;
                    tmp.Health = 100;
                }
                else
                {
                    return(0);
                }
            }

            short money = ps.ReadShort();

            byte wpnCount = ps.ReadByte();

            for (int j = 0; j < wpnCount; j++)
            {
                ps.ReadByte();
            }

            return(1);
        }
        int projectile(PacketStream ps)
        {
            byte  player_id = ps.ReadByte();//one who throws the nade
            byte  wpn_id    = ps.ReadByte();
            short x_origin  = ps.ReadShort();
            short y_origin  = ps.ReadShort();
            float angle     = ps.ReadFloat();
            byte  uk0       = ps.ReadByte();

            ps.ReadByte(); // discard 0
            return(1);
        }
        int spray(PacketStream ps)
        {
            int   tt = ps.ReadByte();
            byte  id = ps.ReadByte();
            short x  = ps.ReadShort();
            short y  = ps.ReadShort();
            byte  c  = ps.ReadByte();

            //LogConsole(tt + " " + players[id].Name + " sprayed at " + x + " " + y + " with " + c);
            ps.SkipAll(); // i dont wanna see there
            return(1);
        }
        int usepress(PacketStream ps)
        {
            //LogConsole("Using or sth? " + ps);
            byte id  = ps.ReadByte();
            byte uk2 = ps.ReadByte();

            ps.ReadByte(); ps.ReadByte(); ps.ReadByte(); ps.ReadByte();
            short x = ps.ReadShort();
            short y = ps.ReadShort();

            //LogConsole("Defuse bomb: " + ps.ToString());
            return(1);
        }
        int spawnmsg(PacketStream ps)
        {
            byte id = ps.ReadByte();

            short spawnx = ps.ReadShort();
            short spawny = ps.ReadShort();

            // float rot = ps.ReadFloat();

            ps.ReadByte();
            ps.ReadByte();
            ps.ReadByte();
            ps.ReadByte();



            byte wpns = ps.ReadByte(); // 50?

            for (int j = 0; j < wpns; j++)
            {
                ps.ReadByte();
                ps.ReadByte();
            }
            //byte uk = ps.ReadByte(); // 0
            //byte uk2 = ps.ReadByte();
            //short money = ps.ReadShort(); // 200
            //byte numweapons = ps.ReadByte(); // 1

            //LogConsole(String.Format("{0} spawned at {1}/{2}", id, spawnx, spawny));

            if (id > 0 && id < 33)
            {
                PlayerObject tmp = players[id];
                tmp.X = spawnx;
                tmp.Y = spawny;
                return(1);
            }
            else
            {
                return(0);
            }
            //tmp.Currentweapon = wpn;
            //tmp.Money = money;

            //if (id == own_id)
            //{
            //LogConsole(String.Format("{0} spawned with: {1} / {2} / {3} / {4} / {5} {6}", tmp.Name, spawnx, spawny,wpn,rot,wpn,uk,uk2));
            //}
        }
Beispiel #9
0
        /// <summary>
        /// This function parses the packet
        /// </summary>
        /// <param name="ar"></param>
        private void OnReceive(IAsyncResult ar)
        {
            EndPoint     ep     = new IPEndPoint(IPAddress.Any, 0);
            int          length = serverlistSocket.EndReceiveFrom(ar, ref ep);
            IPEndPoint   ipe    = (IPEndPoint)ep;
            PacketStream ps     = new PacketStream(buffer, length);
            short        pkt    = ps.ReadShort();
            byte         type   = ps.ReadByte();
            int          retn;

            switch (type)
            {
            case 0x14:
                retn = OnUsgnServerPacket(ps);
                break;

            case 0xfb:
                ServerInformation svi = GetServerFromList(ep);
                if (svi != null)
                {
                    OnServerInformationReceive(ps, svi);
                }
                break;

            default:
                break;
            }
            ReceiveMessages(); // start receivin' the shizzle again
        }
        int weaponpickup(PacketStream ps)
        {
            byte  id       = ps.ReadByte();
            byte  uk0      = ps.ReadByte();
            byte  uk1      = ps.ReadByte(); // 2 0
            byte  wpn_id   = ps.ReadByte();
            short ammon_in = ps.ReadShort();
            short ammo     = ps.ReadShort();

            if (id == own_id)
            {
                botLogics.OnWeaponPickup(wpn_id, ammo, ammon_in);
            }
            ps.ReadByte();
            return(1);
        }
        int positionRotationUpdate(PacketStream ps)
        {
            byte  id  = ps.ReadByte();
            short x   = ps.ReadShort();
            short y   = ps.ReadShort();
            float rot = ps.ReadFloat();

            if (id >= 0 && id <= 32)
            {
                PlayerObject tmp = players[id];
                tmp.Id       = id;
                tmp.X        = x;
                tmp.Y        = y;
                tmp.Rotation = rot;
                return(1);
            }
            return(0);
        }
        int weapondrop(PacketStream ps)
        {
            byte  id      = ps.ReadByte();
            byte  wpn_id  = ps.ReadByte();
            short ammo_in = ps.ReadShort();
            short ammo    = ps.ReadShort();
            byte  uk0     = ps.ReadByte(); //mode?
            byte  uk1     = ps.ReadByte(); //mode?
            byte  uk2     = ps.ReadByte(); //mode?
            int   tilex   = ps.ReadInt();
            int   tiley   = ps.ReadInt();

            ps.ReadByte();


            botLogics.OnWeaponDrop((int)wpn_id, tilex, tiley, ammo, ammo_in);

            return(1);
        }
Beispiel #13
0
        /// <summary>
        /// Constructs the list of servers, based on the packet received from usgn.de
        /// </summary>
        /// <param name="ps"></param>
        /// <returns></returns>
        private int OnUsgnServerPacket(PacketStream ps)
        {
            short num_servers = ps.ReadShort();

            for (int i = 0; i < num_servers; i++)
            {
                byte[] ipdata = new byte[4];
                for (int j = 0; j < 4; j++)
                {
                    ipdata[3 - j] = ps.ReadByte();
                }

                IPAddress ipa  = new IPAddress(ipdata);
                ushort    port = (ushort)ps.ReadShort();
                RequestServerInformation(ipa, port);
                ServerInformation svi = new ServerInformation(ipa, port);
                serverList.Add(svi);
            }
            return(num_servers);
        }
        int pinglist(PacketStream ps)
        {
            byte count = ps.ReadByte();

            for (int i = 0; i < count; i++)
            {
                byte   id   = ps.ReadByte();
                ushort ping = (ushort)ps.ReadShort();
            }
            return(1);
        }
        int killmsg(PacketStream ps)
        {
            byte  victim = ps.ReadByte();
            byte  source = ps.ReadByte();
            byte  wpn_id = ps.ReadByte();
            short sx     = ps.ReadShort();
            short sy     = ps.ReadShort();

            PlayerObject tmp = players[victim];

            tmp.Health = 0;

            if (victim == own_id)
            {
                botLogics.OnDeath();
            }

            if (source == own_id)
            {
                botLogics.OnKill(victim);
            }
            return(1);
        }
        int weaponbuy(PacketStream ps)
        {
            byte player_id = ps.ReadByte();
            byte wpn_id    = ps.ReadByte();

            if (player_id == own_id)
            {
                botLogics.OnWeaponBuy(wpn_id);
            }
            short money = ps.ReadShort();
            byte  uk0   = ps.ReadByte(); // 0

            players[player_id].Money = money;

            //LogConsole("Weaponbuy: " + wpn_id + " " + money);

            return(1);
        }
        private void OnReceive(IAsyncResult ar)
        {
            try
            {
                int          length    = clientSocket.EndReceive(ar);
                PacketStream ps        = new PacketStream(buffer, length);
                int          pktNumber = ps.ReadShort();

                /*if (pktNumber % 2 == 0)
                 *  important_received.Add(ps);*/
                ph.process_packet(ps, pktNumber);
                clientSocket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(OnReceive), null);
            }
            catch (SocketException ex)
            {
                ph.LogConsole("Error in socket: " + ex.Message);
            }
            catch (ObjectDisposedException ex)
            {
            }
        }
        int handshake(PacketStream ps)
        {
            short packetNumConfirmed = ps.ReadShort();

            return(1); // need to check return value
        }
        int joinroutine_known(PacketStream ps)
        {
            int type2 = ps.ReadByte();

            if (type2 == 0)
            {
                String serverKey = ps.ReadString();
                send_join_packet_252_1(local_player, serverKey);
            }
            else if (type2 == 2)
            {
                byte state = ps.ReadByte();
                if (state == 0)
                {
                    own_id = ps.ReadByte();
                    String mapName = ps.ReadString();
                    String skey    = ps.ReadString();
                    send_map_confirmation(mapName, skey);
                }
                else
                {
                    if (state == 1)
                    {
                        LogConsole("Error: wrong password!");
                    }
                    else if (state == 3)
                    {
                        LogConsole("Error: server is full!");
                    }
                    else if (state == 4)
                    {
                        LogConsole("Error: banned!");
                    }
                    else if (state == 23)
                    {
                        LogConsole("Error: maximum number of clients reached!");
                    }
                    else if (state == 22)
                    {
                        LogConsole("Error: invalid precon send to server!");
                    }
                    else
                    {
                        LogConsole("Error on joining: " + state);
                    }

                    cl.Close();
                }
            }
            else if (type2 == 3)
            {
            }
            else if (type2 == 4)
            {
                ps.ReadByte();
                send_map_name_252_05();
            }
            else if (type2 == 6)
            {
                ps.SkipAll();//server data
            }
            else if (type2 == 7)
            {
                //Player data
                int type3 = ps.ReadByte();
                if (type3 == 1)
                {
                    int onlinePlayer = ps.ReadByte();
                    for (int i = 0; i < onlinePlayer; i++)
                    {
                        PlayerObject temp;

                        byte id = ps.ReadByte();
                        temp = players[id];

                        temp.Id   = id;
                        temp.Name = StringHelper.DecodePlayerName(ps.ReadString());

                        string lulz = StringHelper.DecodePlayerName(ps.ReadString());

                        lulz += 'a';

                        //ps.ReadByte();//uk
                        temp.Team = ps.ReadByte();
                        ps.ReadByte(); ps.ReadByte(); //uks
                        temp.Score = ps.ReadShort();
                        temp.Death = ps.ReadShort();
                        temp.X     = ps.ReadShort();
                        ps.ReadShort(); //uk tile_x
                        temp.Y = ps.ReadShort();
                        ps.ReadShort(); // uk tile_y?
                        ps.ReadShort(); // rotation??
                        temp.Health = ps.ReadByte();
                        temp.Armor  = ps.ReadByte();
                        ps.ReadByte();//uk
                        temp.Currentweapon = ps.ReadByte();
                        ps.ReadByte();

                        players[temp.Id] = temp;
                    }

                    LogConsole("Own player: " + players[own_id].ToString());
                }
                else if (type3 == 2)
                {
                    //hostage data
                    ps.SkipAll();
                }
                else if (type3 == 3)
                {
                    // item data
                    //ps.SkipAll();
                    int count = ps.ReadByte();
                    for (int i = 0; i < count; i++)
                    {
                        ps.ReadByte();
                        ps.ReadByte();
                        byte  wpn_id = ps.ReadByte();
                        short tilex  = ps.ReadShort();
                        short tiley  = ps.ReadShort();
                        short ammoin = ps.ReadShort();
                        short ammo   = ps.ReadShort();

                        botLogics.OnWeaponDrop(wpn_id, tilex, tiley, ammo, ammoin);
                    }
                }
                else if (type3 == 4) //entity data
                {
                    ps.SkipAll();
                }
                else if (type3 == 5) //DynamicObjectData
                {
                    ps.SkipAll();
                }
                else if (type3 == 6) // ProjectileData
                {
                    ps.SkipAll();
                }
                else if (type3 == 7) //DynamicObjectImageData
                {
                    ps.SkipAll();
                }
                else if (type3 == 8)
                {
                    ps.SkipAll();
                }
                else if (type3 == 200) // final ack
                {
                    LogConsole("Connected!");
                    ps.ReadString();
                    ps.ReadByte(); ps.ReadByte(); ps.ReadByte();
                    send_unknown_packet_28();
                    //send_spec_pos_32(440, 660);
                }
            }
            else if (type2 == 50) // okay wtf?
            {
                ps.SkipAll();
            }
            return(1);
        }
        int spawnmsg(PacketStream ps)
        {
            byte id = ps.ReadByte();

            short spawnx = ps.ReadShort();
            short spawny = ps.ReadShort();

               // float rot = ps.ReadFloat();

            ps.ReadByte();
            ps.ReadByte();
            ps.ReadByte();
            ps.ReadByte();

            byte wpns = ps.ReadByte(); // 50?

            for (int j = 0; j < wpns; j++)
            {
                ps.ReadByte();
                ps.ReadByte();
            }
            //byte uk = ps.ReadByte(); // 0
            //byte uk2 = ps.ReadByte();
            //short money = ps.ReadShort(); // 200
            //byte numweapons = ps.ReadByte(); // 1

            //LogConsole(String.Format("{0} spawned at {1}/{2}", id, spawnx, spawny));

            if (id > 0 && id < 33)
            {
                PlayerObject tmp = players[id];
                tmp.X = spawnx;
                tmp.Y = spawny;
                return 1;
            }
            else
                return 0;
            //tmp.Currentweapon = wpn;
            //tmp.Money = money;

            //if (id == own_id)
            //{
            //LogConsole(String.Format("{0} spawned with: {1} / {2} / {3} / {4} / {5} {6}", tmp.Name, spawnx, spawny,wpn,rot,wpn,uk,uk2));
            //}
        }
        int weaponbuy(PacketStream ps)
        {
            byte player_id = ps.ReadByte();
            byte wpn_id = ps.ReadByte();
            if (player_id == own_id)
            {
                botLogics.OnWeaponBuy(wpn_id);
            }
            short money = ps.ReadShort();
            byte uk0 = ps.ReadByte(); // 0

            players[player_id].Money = money;

            //LogConsole("Weaponbuy: " + wpn_id + " " + money);

            return 1;
        }
        int weapondrop(PacketStream ps)
        {
            byte id = ps.ReadByte();
            byte wpn_id = ps.ReadByte();
            short ammo_in = ps.ReadShort();
            short ammo = ps.ReadShort();
            byte uk0 = ps.ReadByte();//mode?
            byte uk1 = ps.ReadByte();//mode?
            byte uk2 = ps.ReadByte();//mode?
            int tilex = ps.ReadInt();
            int tiley = ps.ReadInt();
            ps.ReadByte();

            botLogics.OnWeaponDrop((int)wpn_id, tilex, tiley, ammo, ammo_in);

            return 1;
        }
        int weaponpickup(PacketStream ps)
        {
            byte id = ps.ReadByte();
            byte uk0 = ps.ReadByte();
            byte uk1 = ps.ReadByte(); // 2 0
            byte wpn_id = ps.ReadByte();
            short ammon_in = ps.ReadShort();
            short ammo = ps.ReadShort();

            if (id == own_id)
            {
                botLogics.OnWeaponPickup(wpn_id, ammo, ammon_in);
            }
            ps.ReadByte();
            return 1;
        }
        int handshake(PacketStream ps)
        {
            short packetNumConfirmed = ps.ReadShort();

            return 1; // need to check return value
        }
 int spawnitem(PacketStream ps)
 {
     byte wpn_id = ps.ReadByte();
     short tilex = ps.ReadShort();
     short tiley = ps.ReadShort();
     short uk1 = ps.ReadShort();
     return 1;
 }
 int pinglist(PacketStream ps)
 {
     byte count = ps.ReadByte();
     for (int i = 0; i < count; i++)
     {
         byte id = ps.ReadByte();
         ushort ping = (ushort)ps.ReadShort();
     }
     return 1;
 }
Beispiel #27
0
 /// <summary>
 /// This function parses the packet
 /// </summary>
 /// <param name="ar"></param>
 private void OnReceive(IAsyncResult ar)
 {
     EndPoint ep = new IPEndPoint(IPAddress.Any, 0);
     int length = serverlistSocket.EndReceiveFrom(ar, ref ep);
     IPEndPoint ipe = (IPEndPoint)ep;
     PacketStream ps = new PacketStream(buffer, length);
     short pkt = ps.ReadShort();
     byte type = ps.ReadByte();
     int retn;
     switch (type)
     {
         case 0x14:
             retn = OnUsgnServerPacket(ps);
             break;
         case 0xfb:
             ServerInformation svi = GetServerFromList(ep);
             if(svi != null)
                 OnServerInformationReceive(ps,svi);
             break;
         default:
             break;
     }
     ReceiveMessages(); // start receivin' the shizzle again
 }
        int positionRotationUpdate(PacketStream ps)
        {
            byte id = ps.ReadByte();
            short x = ps.ReadShort();
            short y = ps.ReadShort();
            float rot = ps.ReadFloat();

            if (id >= 0 && id <= 32)
            {
                PlayerObject tmp = players[id];
                tmp.Id = id;
                tmp.X = x;
                tmp.Y = y;
                tmp.Rotation = rot;
                return 1;
            }
            return 0;
        }
 int usepress(PacketStream ps)
 {
     //LogConsole("Using or sth? " + ps);
     byte id = ps.ReadByte();
     byte uk2 = ps.ReadByte();
     ps.ReadByte(); ps.ReadByte(); ps.ReadByte(); ps.ReadByte();
     short x = ps.ReadShort();
     short y = ps.ReadShort();
     //LogConsole("Defuse bomb: " + ps.ToString());
     return 1;
 }
 int positionUpdate(PacketStream ps)
 {
     byte id = ps.ReadByte();
     short px = ps.ReadShort();
     short py = ps.ReadShort();
     PlayerObject tmp = players[id];
     tmp.X = px; tmp.Y = py;
     return 1;
 }
 int projectile(PacketStream ps)
 {
     byte player_id = ps.ReadByte();//one who throws the nade
     byte wpn_id = ps.ReadByte();
     short x_origin = ps.ReadShort();
     short y_origin = ps.ReadShort();
     float angle = ps.ReadFloat();
     byte uk0 = ps.ReadByte();
     ps.ReadByte(); // discard 0
     return 1;
 }
        int roundstart(PacketStream ps)
        {
            ps.ReadByte();//unknown
            int count = ps.ReadByte();
            for (int i = 0; i < count; i++)
            {
                byte id = ps.ReadByte();

                if (id == own_id)
                    botLogics.OnRoundStart();

                short sx = ps.ReadShort();
                short sy = ps.ReadShort();
                float rot = ps.ReadFloat();
                byte wpn_id = ps.ReadByte();
                /*if (team == 1)
                    team = 2;
                else if (team == 2)
                    team = 1;*/
                byte uk2 = ps.ReadByte();
                byte uk3 = ps.ReadByte();

                if (id > 0 && id < 33)
                {
                    PlayerObject tmp = players[id];
                    tmp.Id = id;
                    //LogConsole(String.Format("mass spawn {0} wpn:{1} uk:{2} uk:{3}", tmp.Name, wpn_id, uk2, uk3));

                    tmp.X = sx; tmp.Y = sy; tmp.Rotation = rot; tmp.Currentweapon = wpn_id;
                    tmp.Health = 100;
                }
                else
                    return 0;

            }

            short money = ps.ReadShort();

            byte wpnCount = ps.ReadByte();
            for (int j = 0; j < wpnCount; j++)
            {
                ps.ReadByte();
            }

            return 1;
        }
Beispiel #33
0
        /// <summary>
        /// Constructs the list of servers, based on the packet received from usgn.de
        /// </summary>
        /// <param name="ps"></param>
        /// <returns></returns>
        private int OnUsgnServerPacket(PacketStream ps)
        {
            short num_servers = ps.ReadShort();
            for (int i = 0; i < num_servers; i++)
            {
                byte[] ipdata = new byte[4];
                for (int j = 0;j < 4; j++) { ipdata[3-j] = ps.ReadByte(); }

                IPAddress ipa = new IPAddress(ipdata);
                ushort port = (ushort)ps.ReadShort();
                RequestServerInformation(ipa, port);
                ServerInformation svi = new ServerInformation(ipa,port);
                serverList.Add(svi);

            }
            return num_servers;
        }
        int killmsg(PacketStream ps)
        {
            byte victim = ps.ReadByte();
            byte source = ps.ReadByte();
            byte wpn_id = ps.ReadByte();
            short sx = ps.ReadShort();
            short sy = ps.ReadShort();

            PlayerObject tmp = players[victim];
            tmp.Health = 0;

            if (victim == own_id)
                botLogics.OnDeath();

            if (source == own_id)
                botLogics.OnKill(victim);
            return 1;
        }
        int joinroutine_known(PacketStream ps)
        {
            int type2 = ps.ReadByte();
            if (type2 == 0)
            {
                String serverKey = ps.ReadString();
                send_join_packet_252_1(local_player, serverKey);
            }
            else if (type2 == 2)
            {
                byte state = ps.ReadByte();
                if (state == 0)
                {
                    own_id = ps.ReadByte();
                    String mapName = ps.ReadString();
                    String skey = ps.ReadString();
                    send_map_confirmation(mapName, skey);
                }
                else
                {
                    if (state == 1)
                        LogConsole("Error: wrong password!");
                    else if (state == 3)
                        LogConsole("Error: server is full!");
                    else if (state == 4)
                        LogConsole("Error: banned!");
                    else if (state == 23)
                        LogConsole("Error: maximum number of clients reached!");
                    else if (state == 22)
                        LogConsole("Error: invalid precon send to server!");
                    else
                        LogConsole("Error on joining: " + state);

                    cl.Close();
                }
            }
            else if (type2 == 3)
            {

            }
            else if (type2 == 4)
            {
                ps.ReadByte();
                send_map_name_252_05();
            }
            else if (type2 == 6)
            {
                ps.SkipAll();//server data
            }
            else if (type2 == 7)
            {
                //Player data
                int type3 = ps.ReadByte();
                if (type3 == 1)
                {
                    int onlinePlayer = ps.ReadByte();
                    for (int i = 0; i < onlinePlayer; i++)
                    {
                        PlayerObject temp;

                        byte id = ps.ReadByte();
                        temp = players[id];

                        temp.Id = id;
                        temp.Name = StringHelper.DecodePlayerName(ps.ReadString());

                        string lulz = StringHelper.DecodePlayerName(ps.ReadString());

                        lulz += 'a';

                        //ps.ReadByte();//uk
                        temp.Team = ps.ReadByte();
                        ps.ReadByte(); ps.ReadByte(); //uks
                        temp.Score = ps.ReadShort();
                        temp.Death = ps.ReadShort();
                        temp.X = ps.ReadShort();
                        ps.ReadShort();//uk tile_x
                        temp.Y = ps.ReadShort();
                        ps.ReadShort(); // uk tile_y?
                        ps.ReadShort();// rotation??
                        temp.Health = ps.ReadByte();
                        temp.Armor = ps.ReadByte();
                        ps.ReadByte();//uk
                        temp.Currentweapon = ps.ReadByte();
                        ps.ReadByte();

                        players[temp.Id] = temp;
                    }

                    LogConsole("Own player: " + players[own_id].ToString());
                }
                else if (type3 == 2)
                {
                    //hostage data
                    ps.SkipAll();
                }
                else if (type3 == 3)
                {
                    // item data
                    //ps.SkipAll();
                    int count = ps.ReadByte();
                    for (int i = 0; i < count; i++)
                    {
                        ps.ReadByte();
                        ps.ReadByte();
                        byte wpn_id = ps.ReadByte();
                        short tilex = ps.ReadShort();
                        short tiley = ps.ReadShort();
                        short ammoin = ps.ReadShort();
                        short ammo = ps.ReadShort();

                        botLogics.OnWeaponDrop(wpn_id, tilex, tiley, ammo, ammoin);
                    }
                }
                else if (type3 == 4) //entity data
                {
                    ps.SkipAll();
                }
                else if (type3 == 5) //DynamicObjectData
                {
                    ps.SkipAll();
                }
                else if (type3 == 6) // ProjectileData
                {
                    ps.SkipAll();
                }
                else if (type3 == 7) //DynamicObjectImageData
                {
                    ps.SkipAll();
                }
                else if (type3 == 8)
                {
                    ps.SkipAll();
                }
                else if (type3 == 200) // final ack
                {
                    LogConsole("Connected!");
                    ps.ReadString();
                    ps.ReadByte(); ps.ReadByte(); ps.ReadByte();
                    send_unknown_packet_28();
                    //send_spec_pos_32(440, 660);
                }
            }
            else if (type2 == 50) // okay wtf?
                ps.SkipAll();
            return 1;
        }
 int setpos(PacketStream ps)
 {
     byte id = ps.ReadByte();
     short x = ps.ReadShort();
     short y = ps.ReadShort();
     players[id].X = x;
     players[id].Y = y;
     return 1;
 }
        private void OnReceive(IAsyncResult ar)
        {
            try
            {
                int length = clientSocket.EndReceive(ar);
                PacketStream ps = new PacketStream(buffer, length);
                int pktNumber = ps.ReadShort();

                /*if (pktNumber % 2 == 0)
                    important_received.Add(ps);*/
                ph.process_packet(ps, pktNumber);
                clientSocket.BeginReceive(buffer, 0, buffer.Length, SocketFlags.None, new AsyncCallback(OnReceive), null);
            }
            catch (SocketException ex)
            {
                ph.LogConsole("Error in socket: " + ex.Message);
            }
            catch (ObjectDisposedException ex)
            {
            }
        }
 int spray(PacketStream ps)
 {
     int tt = ps.ReadByte();
     byte id = ps.ReadByte();
     short x = ps.ReadShort();
     short y = ps.ReadShort();
     byte c = ps.ReadByte();
     //LogConsole(tt + " " + players[id].Name + " sprayed at " + x + " " + y + " with " + c);
     ps.SkipAll(); // i dont wanna see there
     return 1;
 }