Example #1
0
        private static bool OnReceiveRandomSeed(ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            int seed = byteArray.ReadInt();

            clientService.OnReceiveRandomSeed(seed);
            return(true);
        }
Example #2
0
        private static bool OnExit(ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            string identity = byteArray.ReadUTF();

            clientService.OnExit(identity);
            return(true);
        }
Example #3
0
        private static bool OnRegistObsever(ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            int identity = byteArray.ReadInt();

            clientService.OnRegistObsever(identity);
            return(true);
        }
Example #4
0
        private static bool OnReceiveTieMessage(ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            string     identity = byteArray.ReadUTF();
            TieMessage message  = TieMessageHelper.ReadFromByteArray(byteArray);

            clientService.OnReceiveTieMessage(identity, message);
            return(true);
        }
Example #5
0
        private static bool OnReceiveRules(ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            BattleRuleSequence rules = new BattleRuleSequence();

            rules.ReadFromByteArray(byteArray);
            clientService.OnReceiveRules(rules);
            return(true);
        }
Example #6
0
        private static bool OnReceiveMove(ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            PlayerMove move = new PlayerMove();

            move.ReadFromByteArray(byteArray);
            clientService.OnReceiveMove(move);
            return(true);
        }
Example #7
0
        private static bool OnReceiveBattleSnapshot(ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            BattleSnapshot snapshot = new BattleSnapshot();

            snapshot.ReadFromByteArray(byteArray);
            clientService.OnReceiveBattleSnapshot(snapshot);
            return(true);
        }
Example #8
0
        private static bool OnReceiveTeam(ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            byte         position = byteArray.ReadByte();
            string       identity = byteArray.ReadUTF();
            ByteSequence team     = new ByteSequence();

            team.ReadFromByteArray(byteArray);
            clientService.OnReceiveTeam(position, identity, team);
            return(true);
        }
Example #9
0
        public static bool InterpretMessage(int sessionID, ByteArray byteArray, IPokemonBattleClientService clientService)
        {
            byteArray.BypassHeader();
            switch (byteArray.ReadInt())
            {
            case -774376481:
                return(OnRegistObsever(byteArray, clientService));

            case -632492989:
                return(OnLogonFail(byteArray, clientService));

            case -274250105:
                return(OnReceiveRules(byteArray, clientService));

            case -1287328945:
                return(OnReceiveTeam(byteArray, clientService));

            case -1158854104:
                return(OnExit(byteArray, clientService));

            case -1110713650:
                return(OnTimeUp(byteArray, clientService));

            case 0x823c9f1:
                return(OnReceiveTieMessage(byteArray, clientService));

            case 0x18789bab:
                return(OnReceiveRandomSeed(byteArray, clientService));

            case 0x49fd3e0f:
                return(OnReceiveBattleSnapshot(byteArray, clientService));

            case 0x51a0a8fc:
                return(OnReceiveBattleInfo(byteArray, clientService));

            case 0x6615466d:
                return(OnReceiveMove(byteArray, clientService));

            case 0x7ada52ee:
                return(OnLogonSuccess(byteArray, clientService));
            }
            byteArray.Rewind();
            return(false);
        }