Example #1
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p    = new ReceiveGPacket(buffer);
            short          num1 = p.readH();

            try
            {
                switch (num1)
                {
                case 1:
                    Net_Room_Pass_Portal.Load(p);
                    break;

                case 2:
                    Net_Room_C4.Load(p);
                    break;

                case 3:
                    Net_Room_Death.Load(p);
                    break;

                case 4:
                    Net_Room_HitMarker.Load(p);
                    break;

                case 5:
                    Net_Room_Sabotage_Sync.Load(p);
                    break;

                case 10:
                    Account account1 = AccountManager.getAccount(p.readQ(), true);
                    if (account1 == null)
                    {
                        break;
                    }
                    account1.SendPacket((SendPacket) new AUTH_ACCOUNT_KICK_PAK(1));
                    account1.SendPacket((SendPacket) new SERVER_MESSAGE_ERROR_PAK(2147487744U));
                    account1.Close(1000, false);
                    break;

                case 11:
                    int     num2     = (int)p.readC();
                    int     num3     = (int)p.readC();
                    Account account2 = AccountManager.getAccount(p.readQ(), 0);
                    if (account2 == null)
                    {
                        break;
                    }
                    Account account3 = AccountManager.getAccount(p.readQ(), true);
                    if (account3 == null)
                    {
                        break;
                    }
                    FriendState friendState = num3 == 1 ? FriendState.Online : FriendState.Offline;
                    if (num2 == 0)
                    {
                        int    index  = -1;
                        Friend friend = account3.FriendSystem.GetFriend(account2.player_id, out index);
                        if (index == -1 || friend == null || friend.state != 0)
                        {
                            break;
                        }
                        account3.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, friendState, index));
                        break;
                    }
                    account3.SendPacket((SendPacket) new CLAN_MEMBER_INFO_CHANGE_PAK(account2, friendState));
                    break;

                case 13:
                    long    id1      = p.readQ();
                    byte    num4     = p.readC();
                    byte[]  data     = p.readB((int)p.readUH());
                    Account account4 = AccountManager.getAccount(id1, true);
                    if (account4 == null)
                    {
                        break;
                    }
                    if (num4 == (byte)0)
                    {
                        account4.SendPacket(data);
                        break;
                    }
                    account4.SendCompletePacket(data);
                    break;

                case 15:
                    int             id2    = p.readD();
                    int             num5   = p.readD();
                    GameServerModel server = ServersXML.getServer(id2);
                    if (server == null)
                    {
                        break;
                    }
                    server._LastCount = num5;
                    break;

                case 16:
                    Net_Clan_Sync.Load(p);
                    break;

                case 17:
                    Net_Friend_Sync.Load(p);
                    break;

                case 18:
                    Net_Inventory_Sync.Load(p);
                    break;

                case 19:
                    Net_Player_Sync.Load(p);
                    break;

                case 20:
                    Net_Server_Warning.LoadGMWarning(p);
                    break;

                case 21:
                    Net_Clan_Servers_Sync.Load(p);
                    break;

                case 22:
                    Net_Server_Warning.LoadShopRestart(p);
                    break;

                case 23:
                    Net_Server_Warning.LoadServerUpdate(p);
                    break;

                case 24:
                    Net_Server_Warning.LoadShutdown(p);
                    break;

                case 31:
                    EventLoader.ReloadEvent((int)p.readC());
                    Logger.warning("[Game_SyncNet] Evento re-carregado.");
                    break;

                case 32:
                    ServerConfigSyncer.GenerateConfig((int)p.readC());
                    Logger.warning("[Game_SyncNet] Configurações (DB) resetadas.");
                    break;

                default:
                    Logger.warning("[Game_SyncNet] Tipo de conexão não encontrada: " + (object)num1);
                    break;
                }
            }
            catch (Exception ex)
            {
                Logger.error("[Crash/Game_SyncNet] Tipo: " + (object)num1 + "\r\n" + ex.ToString());
                if (p == null)
                {
                    return;
                }
                Logger.error("COMP: " + BitConverter.ToString(p.getBuffer()));
            }
        }
Example #2
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p    = new ReceiveGPacket(buffer);
            short          num1 = p.readH();

            switch (num1)
            {
            case 11:
                int     num2     = (int)p.readC();
                int     num3     = (int)p.readC();
                Account account1 = AccountManager.getInstance().getAccount(p.readQ(), true);
                if (account1 == null)
                {
                    break;
                }
                Account account2 = AccountManager.getInstance().getAccount(p.readQ(), true);
                if (account2 == null)
                {
                    break;
                }
                FriendState friendState = num3 == 1 ? FriendState.Online : FriendState.Offline;
                if (num2 == 0)
                {
                    int    index  = -1;
                    Friend friend = account2.FriendSystem.GetFriend(account1.player_id, out index);
                    if (index == -1 || friend == null)
                    {
                        break;
                    }
                    account2.SendPacket((SendPacket) new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, friendState, index));
                    break;
                }
                account2.SendPacket((SendPacket) new CLAN_MEMBER_INFO_CHANGE_PAK(account1, friendState));
                break;

            case 13:
                long    id1      = p.readQ();
                byte    num4     = p.readC();
                byte[]  data     = p.readB((int)p.readUH());
                Account account3 = AccountManager.getInstance().getAccount(id1, true);
                if (account3 == null)
                {
                    break;
                }
                if (num4 == (byte)0)
                {
                    account3.SendPacket(data);
                    break;
                }
                account3.SendCompletePacket(data);
                break;

            case 15:
                int             id2    = p.readD();
                int             num5   = p.readD();
                GameServerModel server = ServersXML.getServer(id2);
                if (server == null)
                {
                    break;
                }
                server._LastCount = num5;
                break;

            case 16:
                Net_Clan_Sync.Load(p);
                break;

            case 17:
                Net_Friend_Sync.Load(p);
                break;

            case 19:
                Net_Player_Sync.Load(p);
                break;

            case 20:
                Net_Server_Warning.LoadGMWarning(p);
                break;

            case 22:
                Net_Server_Warning.LoadShopRestart(p);
                break;

            case 23:
                Net_Server_Warning.LoadServerUpdate(p);
                break;

            case 24:
                Net_Server_Warning.LoadShutdown(p);
                break;

            case 31:
                EventLoader.ReloadEvent((int)p.readC());
                Logger.warning("[Auth_SyncNet] Evento re-carregado.");
                break;

            case 32:
                ServerConfigSyncer.GenerateConfig((int)p.readC());
                Logger.warning("[Auth_SyncNet] Configurações (DB) resetadas.");
                break;

            default:
                Logger.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + (object)num1);
                break;
            }
        }