Exemplo n.º 1
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceivePacket p = new ReceivePacket(buffer);

            switch (p.readH())
            {
            case 1:
                RespawnSync.Load(p);
                break;

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

            case 3:
                uint UniqueRoomId = p.readUD();
                int  gen2         = p.readD();
                int  num          = (int)p.readC();
                Room room         = RoomsManager.getRoom(UniqueRoomId, gen2);
                if (room != null)
                {
                    room._serverRound = num;
                }
                break;
            }
        }
Exemplo n.º 2
0
        private static void LoadPacket(byte[] buffer)
        {
            ReceivePacket p      = new ReceivePacket(buffer);
            short         opcode = p.readH();

            try
            {
                switch (opcode)
                {
                case 1:
                    RespawnSync.Load(p);
                    break;

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

                case 3:
                    uint UniqueRoomId = p.readUD();
                    int  gen2         = p.readD();
                    int  round        = p.readC();
                    Room room         = RoomsManager.getRoom(UniqueRoomId, gen2);
                    if (room != null)
                    {
                        room._serverRound = round;
                    }
                    break;

                default:
                    Console.WriteLine("[BattleSync]\n Opcode invalido: " + opcode);
                    break;
                }
            }
            catch (Exception ex)
            {
                SaveLog.fatal(ex.ToString() + "\nOpcode: " + opcode);
                if (p != null)
                {
                    SaveLog.fatal("[Crash/Battle_SyncNet] COMP: " + BitConverter.ToString(p.getBuffer()));
                }
                Printf.b_danger("[Battle_SyncNet.LoadPacket] Erro fatal!");
            }
        }