protected void prasecmd(int cmd, String packet)
    {
        try
        {
            Packet pack = new Packet();
            String[] packanwser = new String[2];
            switch (cmd)
            {
                case 0xF82A:
                    //debug("parse f8");
                    byte[] spacketb =
                    {
                        0x01, 0x00, 0x01, 0x00
                    };
                    socketOut.write(new String(ChannelServer.CLIENT_NUMBER_HEADER));
                    socketOut.flush();
                    //debug("send cnumberhead");
                    socketOut.write(new String(spacketb));
                    socketOut.flush();
                    //debug("send cnumberpacket");
                    break;

                case 0xF92A:
                    debug("parsing bots");
                    pack.addHeader((byte) 0x28, (byte) 0x27);
                    pack.addInt(1, 2, false);
                    send(pack);
                    pack.clean();
                    if (bot.checkbot())
                    {
                        bot.loadchar();
                        charname = bot.getName();
                        bottype = bot.getBot();
                        socketOut.write(new String(ChannelServer.CHARACTER_INFORMATION_HEADER));
                        socketOut.flush();
                        socketOut.write(bot.getpacketcinfo());
                        socketOut.flush();
                        byte[] bytearr =
                        {
                            (byte) 0x4E, (byte) 0x95, (byte) 0xDD, (byte) 0x29, (byte) 0xCE,
                            (byte) 0x3A, (byte) 0x55, (byte) 0xDB, (byte) 0x20, (byte) 0xB6, (byte) 0xAD,
                            (byte) 0x97, (byte) 0xA6, (byte) 0x5C, (byte) 0xC0, (byte) 0x1C
                        };
                        pack.addHeader((byte) 0x53, (byte) 0x2F);
                        pack.addByteArray(bytearr);
                        send(pack);
                        pack.clean();
                        pack.addHeader((byte) 0x27, (byte) 0x27);
                        pack.addInt(1, 2, false);
                        pack.addString(charname);
                        pack.addByte((byte) 0x00);
                        pack.addByte4((byte) 0xCC, (byte) 0xCC, (byte) 0x01, (byte) 0x01);
                        send(pack);
                        pack.clean();
                        pack.addHeader((byte) 0x4F, (byte) 0x2F);
                        pack.addInt(1, 2, false);
                        pack.addByte4((byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00);
                        send(pack);
                        pack.clean();

                    }
                    else
                    {
                        socketOut.write(new String(ChannelServer.CHARACTER_INFORMATION_HEADER));
                        socketOut.flush();
                        //debug("send cinfohead");
                        byte[] cinfopackbyte =
                        {
                            (byte) 0x00, (byte) 0x35
                        };
                        String cinfopack = new String(cinfopackbyte);
                        cinfopack += ChannelServer.longnullbyte;
                        socketOut.write(cinfopack);
                        socketOut.flush();
                    }
                    //debug("send cinfopack");
                    break;

                case 0xFA2A:
                {
                    //debug("parse fa");
                    //Packet pack = new Packet();
                    pack.setPacket(packet);
                    pack.removeHeader();
                    int client_num = pack.getInt(2);
                    int bottype = pack.getInt(2);
                    int unknown = pack.getInt(2);
                    String accountname = pack.getString(1, 23, false);
                    String charname = pack.getString(0, 15, false);
                    pack.clean();

                    if (this.account.equals("a"))
                    {
                        byte[] loginhack =
                        {
                            (byte) 0x00, (byte) 0x32
                        };
                        this.socket.getOutputStream().write(ChannelServer.BOT_CREATION_HEADER);
                        this.socket.getOutputStream().flush();
                        this.socket.getOutputStream().write(loginhack);
                        this.socket.getOutputStream().flush();
                        this.finalize();
                    }
                    else
                    {

                        if (!checkexist(charname, accountname))
                        {
                            if (charname.matches("[a-zA-Z0-9.~_!\\x2d]+"))
                            {
                                bot.createbot(accountname, charname, bottype);
                                socketOut.write(new String(ChannelServer.BOT_CREATION_HEADER));
                                socketOut.flush();
                                socketOut.write(new String(ChannelServer.CREATE_BOT_CREATED));
                                socketOut.flush();
                            }
                            else
                            {
                                socketOut.write(new String(ChannelServer.BOT_CREATION_HEADER));
                                socketOut.flush();
                                socketOut.write(new String(ChannelServer.CREATE_BOT_USERNAME_ERROR));
                                socketOut.flush();
                                this.finalize();
                            }
                        }
                        else
                        {
                            socketOut.write(new String(ChannelServer.BOT_CREATION_HEADER));
                            socketOut.flush();
                            socketOut.write(new String(ChannelServer.CREATE_BOT_USERNAME_TAKEN));
                            socketOut.flush();
                            this.finalize();
                        }
                    }
                    break;
                }

                case 0x742B:
                {
                    //Packet packs = new Packet();
                    if (firstlog)
                    {
                        lobby.adduser(this.charname, this.bottype, socketOut, socket);
                        firstlog = false;
                    }
                    //packs = lobby.getlobbypacket();
                    send(lobby.getlobbypacket());
                    // lobby.g
                    send(lobby.getroompacket(1, 0));
                    sendChatMsg("Welcome Secured's Test Server!", 4);
                    sendChatMsg("Have fun :)", 4);

                    this.socketOut.write(new String(ChannelServer.OK_HEADER));
                    this.socketOut.flush();
                    this.socketOut.write(new String(ChannelServer.OK_PACKET));
                    this.socketOut.flush();
                    break;
                }

                case 0x1A27:
                    pack.setPacket(packet);
                    pack.removeHeader();
                    String chatpack = pack.getPacket();
                    int a = func.compareChat(chatpack, this.charname, false, isGM());
                    if (a == -1)
                    {
                        lobby.kickPlayer(this.charname, "Player " + this.charname + " has been kick for wrong chatname(hacking)");
                    }
                    else
                    {
                        chatpack = chatpack.substring((a + this.charname.length() + 3));
                        chatpack = chatpack.substring(0, (chatpack.length() - 1));
                        debug(chatpack);
                        if (chatpack.startsWith("@"))
                        {
                            String command = chatpack.substring(1, chatpack.length());
                            parsechatcmd(command);
                        }
                        else
                        {
                            lobby.writeMessage(pack.getPacket(), this.charname, isGM());
                        }
                    }
                    pack.clean();
                    break;

                case 0x442B:
                    lobby.whisper(packet, this.charname);
                    break;

                case 0x222B:
                    sendBye(1);
                    this.finalize();
                    break;

                case 0xFB2A:
                    int anwser = bot.deleteBot(this.charname, this.account);
                    sendBye(anwser);
                    break;

                case 0x512B:
                    pack.addHeader((byte) 0x37, (byte) 0x2F);
                    pack.addPacketHead((byte) 0x01, (byte) 0x00);
                    pack.addInt(bot.getCoins(), 4, false);
                    send(pack);
                    send(bot.getInventPacket(0xEB));
                    break;

                case 0x022B:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 42, true);
                    int itemid = pack.getInt(4);
                    send(shop.buy(itemid));
                    //Main.sql.doupdate("UPDATE `bout_items` SET `buyable` = 1 WHERE id="+itemid);
                    break;
                }

                case 0x032B:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 42, true);
                    int slotnum = pack.getInt(2);
                    pack.getInt(2);
                    int itemid = pack.getInt(4);
                    send(shop.sell(itemid, slotnum));
                    break;
                }

                case 0x042B:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 42, true);
                    pack.getInt(2);
                    int itemid = pack.getInt(4);

                    send(shop.buycoin(itemid));
                    //Main.sql.doupdate("UPDATE `bout_items` SET `buyable` = 1 WHERE id="+itemid);
                    break;
                }

                case 0xFC2A:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 29, false);
                    int slot = pack.getInt(2);
                    pack.getInt(2);
                    send(bot.equip(slot, 1));
                    break;
                }

                case 0xFD2A:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 29, false);
                    int slot = pack.getInt(2);
                    pack.getInt(2);
                    send(bot.deequip(slot, 1));
                    break;
                }

                case 0x322B:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 6, false);
                    int slot = pack.getInt(2);
                    pack.clean();
                    send(bot.equip(slot, 2));
                    break;
                }

                case 0x332B:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 6, false);
                    int slot = pack.getInt(2);
                    pack.clean();
                    send(bot.deequip(slot, 2));
                    break;
                }

                case 0x342B:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 6, false);
                    int slot = pack.getInt(2);
                    pack.clean();
                    send(bot.equip(slot, 3));
                    break;
                }

                case 0x352B:
                {
                    pack.setPacket(packet);
                    pack.getString(0, 6, false);
                    int slot = pack.getInt(2);
                    pack.clean();
                    send(bot.deequip(slot, 3));
                    break;
                }


                case 0x412B:
                {
                    pack.setPacket(packet);
                    pack.removeHeader();
                    send(bot.getEquipByName(pack.getPacket()));
                    break;
                }

                case 0x0A2B:
                {
                    pack.setPacket(packet);
                    pack.removeHeader();
                    pack.getInt(2);
                    int page = pack.getInt(2);
                    int mode = pack.getInt(2);
                    send(lobby.getroompacket(mode, page));
                    pack.clean();
                    break;
                }

                case 0x092B:
                {
                    pack.setPacket(packet);
                    pack.removeHeader();
                    String cname = pack.getString(0, 27, false);
                    String cpass = pack.getString(0, 10, false);
                    pack.getInt(2);
                    int roommode = pack.getInt(1);
                    switch (roommode)
                    {
                        case 2:
                            roommode = 0;
                            break;

                        case 0:
                            roommode = 1;
                            break;

                        case 3:
                            roommode = 2;
                            break;
                    }
                    int num = lobby.addroom(roommode, cname, cpass, bot.getName(), bot.getLevel(), Main.getip(this.socket), this.socketOut, bot);
                    //lobby.setStatus(bot.getName(),0);
                    int[] room =
                    {
                        roommode, num
                    };
                    bot.setRoom(room);
                    break;
                }

                case 0x652B:
                {
                    int[] room = lobby.haveRoom(bot.getName());
                    if (room[0] == -1)
                    {
                        lobby.kickPlayer(this.charname, "Player " + this.charname + " has been kick for try to change map of not owning room(hacking)");
                    }
                    else
                    {
                        pack.setPacket(packet);
                        pack.removeHeader();
                        pack.getInt(2);
                        lobby.setRoomMap(room, pack.getInt(2));
                        pack.clean();
                    }
                    break;
                }

                case 0x062B:
                {
                    pack.setPacket(packet);
                    pack.removeHeader();
                    int roomnum = pack.getInt(1) - 89;
                    int roommode = pack.getInt(1);
                    switch (roommode)
                    {
                        case 2:
                            roommode = 0;
                            break;

                        case 0:
                            roommode = 1;
                            break;

                        case 3:
                            roommode = 2;
                            break;
                    }
                    String rname = pack.getString(0, 27, false);
                    String rpass = pack.getString(0, 10, false);
                    int[] room =
                    {
                        roommode, roomnum
                    };
                    Packet npacket = lobby.addRoomPlayer(room, rpass, ip, socketOut, bot);
                    if (npacket.getLen() == 1715)
                    {
                        bot.setRoom(room);
                        send(npacket);
                        //lobby.setStatus(bot.getName(),0);
                        ResultSet rs;
                        int port = 0;
                        while (port == 0)
                        {
                            rs = sql.doquery("SELECT `port` FROM `rooms` WHERE `ip`='" + ip + "'");
                            rs.next();
                            port = rs.getInt("port");
                        }

                        sql.doupdate("DELETE FROM `rooms` WHERE `ip` = '" + ip + "' and `port` = '" + port + "'");
                        lobby.isConnected(room, bot.getName(), port);
                    }
                    else
                    {
                        send(npacket);
                    }
                    break;
                }

                case 0x422B:
                {
                    int[] room = bot.getRoom();
                    if (room[0] == -1)
                    {
                        lobby.kickPlayer(this.charname, "Player " + this.charname + " has been kick for try to exit a room while he isn't in a room(hacking)");
                        break;
                    }
                    lobby.removeRoomPlayer(room, bot.getName());
                    break;
                }

                case 0x0B2B:
                {
                    int[] room = lobby.haveRoom(bot.getName());
                    if (room[0] == -1)
                    {
                        lobby.kickPlayer(this.charname, "Player " + this.charname + " has been kick for try to start not owning room(hacking)");
                    }
                    pack.setPacket(packet);
                    pack.removeHeader();
                    pack.getInt(2);
                    int map = pack.getInt(2);
                    int unknown = pack.getInt(2);
                    lobby.startRoom(room, map);
                    pack.clean();
                    break;
                }

                case 0x3E2B:
                {
                    if (bot.getRoom()[0] != -1)
                    {
                        lobby.readyToPlay(bot.getRoom(), bot.getName());
                    }
                    break;
                }

                case 0x392B:
                {
                    int slot = lobby.getSlot(bot.getRoom(), bot.getName());
                    if (slot == -1)
                    {
                        lobby.kickPlayer(this.charname, "Player " + this.charname + " has been kick for try to be ready and not being in a room(hacking)");
                    }
                    lobby.setRoomStatus(bot.getRoom(), slot);
                    break;
                }

                case 0x6F2B:
                {
                    pack.addHeader((byte)0x54, (byte)0x2F);
                    pack.addByte4((byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00);
                    send(pack);
                }

                case 0x3A2B:
                {
                    int[] room = lobby.haveRoom(bot.getName());
                    if (room[0] == -1)
                    {
                        break;
                    }
                    pack.setPacket(packet);
                    pack.removeHeader();
                    int monsternum = pack.getInt(2);
                    int monstertyp = pack.getInt(2);
                    int who = pack.getInt(2);
                    lobby.roomMonsterDead(room, monstertyp, monsternum, who);
                }

                case 0x3C2B:
                {
                    if (bot.getRoom()[0] == -1)
                    {
                        break;
                    }
                    pack.setPacket(packet);
                    pack.removeHeader();
                    pack.getInt(2);
                    int typ = pack.getInt(1);
                    int num = pack.getInt(1);
                    lobby.useItem(bot.getRoom(), bot.getName(), typ, num);
                }



                default:
                    debug("parse unknown packet");
            }
        } catch (Exception e)
        {
            debug("Error aa" + e);
        }
    }