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

            try
            {
                switch (opcode)
                {
                case 11:     //Request to sync a specific friend or clan info
                    int     type      = p.readC();
                    int     isConnect = p.readC();
                    long    pid       = p.readQ();
                    Account player    = AccountManager.getInstance().getAccount(pid, true);
                    if (player != null)
                    {
                        Account friend = AccountManager.getInstance().getAccount(p.readQ(), true);
                        if (friend != null)
                        {
                            FriendState state = isConnect == 1 ? FriendState.Online : FriendState.Offline;
                            if (type == 0)
                            {
                                int    idx = -1;
                                Friend frP = friend.FriendSystem.GetFriend(player.player_id, out idx);
                                if (idx != -1 && frP != null)
                                {
                                    friend.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, frP, state, idx));
                                }
                            }
                            else
                            {
                                friend.SendPacket(new CLAN_MEMBER_INFO_CHANGE_PAK(player, state));
                            }
                        }
                    }
                    break;

                case 13:
                    long    playerId = p.readQ();
                    byte    typee    = p.readC();
                    byte[]  data     = p.readB(p.readUH());
                    Account playerr  = AccountManager.getInstance().getAccount(playerId, true);
                    if (playerr != null)
                    {
                        if (typee == 0)
                        {
                            playerr.SendPacket(data);
                        }
                        else
                        {
                            playerr.SendCompletePacket(data);
                        }
                    }
                    break;

                case 15:
                    short           serverId = p.readH();
                    short           count    = p.readH();
                    GameServerModel gs       = ServersXML.getServer(serverId);
                    if (gs != null)
                    {
                        gs._LastCount = count;
                    }
                    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;

                default:
                    Printf.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    SaveLog.warning("[Auth_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    break;
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal("[Crash/Auth_SyncNet] opcode: " + opcode + "\r\n" + ex.ToString());
                Printf.b_danger("[Auth_SyncNet.LoadPacket] Erro fatal!");
            }
        }
예제 #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;
            }
        }
예제 #3
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()));
            }
        }
예제 #4
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceiveGPacket p      = new ReceiveGPacket(buffer);
            short          opcode = p.readH();

            //Printf.warnDark("Receive SYNC - " + opcode.ToString());
            try
            {
                switch (opcode)
                {
                case 1:
                    Net_Room_Pass_Portal.Load(p);
                    break;

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

                case 3:     //Death
                    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 player = AccountManager.getAccount(p.readQ(), true);
                    if (player != null)
                    {
                        player.SendPacket(new AUTH_ACCOUNT_KICK_PAK(1));
                        player.SendPacket(new SERVER_MESSAGE_ERROR_PAK(0x80001000));
                        player.Close(1000);
                    }
                    break;

                case 11:      //Request to sync a specific friend or clan info
                    int     type      = p.readC();
                    int     isConnect = p.readC();
                    Account player11  = AccountManager.getAccount(p.readQ(), 0);
                    if (player11 != null)
                    {
                        Account friendAcc = AccountManager.getAccount(p.readQ(), true);
                        if (friendAcc != null)
                        {
                            FriendState state = isConnect == 1 ? FriendState.Online : FriendState.Offline;
                            if (type == 0)
                            {
                                int    idx    = -1;
                                Friend friend = friendAcc.FriendSystem.GetFriend(player11.player_id, out idx);
                                if (idx != -1 && friend != null && friend.state == 0)
                                {
                                    friendAcc.SendPacket(new FRIEND_UPDATE_PAK(FriendChangeState.Update, friend, state, idx));
                                }
                            }
                            else
                            {
                                friendAcc.SendPacket(new CLAN_MEMBER_INFO_CHANGE_PAK(player11, state));
                            }
                        }
                    }
                    break;

                case 13:
                    long    playerId = p.readQ();
                    byte    type13   = p.readC();
                    byte[]  data     = p.readB(p.readUH());
                    Account player13 = AccountManager.getAccount(playerId, true);
                    if (player13 != null)
                    {
                        if (type13 == 0)
                        {
                            player13.SendPacket(data);
                        }
                        else
                        {
                            player13.SendCompletePacket(data);
                        }
                    }
                    break;

                case 15:
                    short           serverId = p.readH();
                    short           count    = p.readH();
                    GameServerModel gs       = ServersXML.getServer(serverId);
                    if (gs != null)
                    {
                        gs._LastCount = count;
                    }
                    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 21:
                    Net_Clan_Servers_Sync.Load(p);
                    break;

                case 100:
                    ReadAPI_Cash.Load(p);
                    break;

                default:
                    Printf.warning("[Game_SyncNet] Tipo de conexão não encontrada: " + opcode);
                    break;
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal("[Game_SyncNet.LoadPacket] Tipo: " + opcode + "\r\n" + ex.ToString());
                Printf.b_danger("[GameSyncNet.LoadPacket] Erro fatal!");
            }
        }