示例#1
0
    public static StatsTransmission ReadStatsTransmission(this NetworkReader reader)
    {
        string[] names = reader.ReadArray <string>();

        int[]           readCharacterTypes = reader.ReadArray <int>();
        CharacterType[] types = new CharacterType[readCharacterTypes.Length];
        for (int i = 0; i < types.Length; i++)
        {
            types[i] = (CharacterType)readCharacterTypes[i];
        }

        string[][] stats = new string[names.Length][];
        for (int i = 0; i < names.Length; i++)
        {
            stats[i] = reader.ReadArray <string>();
        }

        return(new StatsTransmission(names, types, stats));
    }
示例#2
0
        public static PBS.Player.Command ReadPlayerCommand(this NetworkReader reader)
        {
            return(new PBS.Player.Command
            {
                commandType = (BattleCommandType)reader.ReadInt32(),
                commandUser = reader.ReadString(),
                commandTrainer = reader.ReadInt32(),
                inProgress = reader.ReadBoolean(),
                completed = reader.ReadBoolean(),
                commandPriority = reader.ReadInt32(),
                isExplicitlySelected = reader.ReadBoolean(),

                moveID = reader.ReadString(),
                consumePP = reader.ReadBoolean(),
                targetPositions = reader.ReadArray <BattlePosition>(),
                displayMove = reader.ReadBoolean(),
                forceOneHit = reader.ReadBoolean(),
                bypassRedirection = reader.ReadBoolean(),
                bypassStatusInterrupt = reader.ReadBoolean(),
                isDanceMove = reader.ReadBoolean(),
                isMoveCalled = reader.ReadBoolean(),
                isMoveReflected = reader.ReadBoolean(),
                isMoveHijacked = reader.ReadBoolean(),
                isFutureSightMove = reader.ReadBoolean(),
                isPursuitMove = reader.ReadBoolean(),
                isMoveSnatched = reader.ReadBoolean(),
                isMagicCoatMove = reader.ReadBoolean(),

                isMegaEvolving = reader.ReadBoolean(),
                isZMove = reader.ReadBoolean(),
                isDynamaxing = reader.ReadBoolean(),

                switchPosition = reader.ReadInt32(),
                switchingTrainer = reader.ReadInt32(),
                switchInPokemon = reader.ReadString(),

                itemID = reader.ReadString(),
                itemTrainer = reader.ReadInt32()
            });
        }
 internal static IUser Create(NetworkReader reader)
 {
     return(new SteamUser(reader.ReadULong(), reader.ReadArray <byte>()));
 }
示例#4
0
        public static PBS.Battle.View.Events.Base ReadBattleViewEvent(this NetworkReader reader)
        {
            int type = reader.ReadInt32();

            switch (type)
            {
            case STARTBATTLE:
                return(new PBS.Battle.View.Events.StartBattle
                {
                });

            case ENDBATTLE:
                return(new PBS.Battle.View.Events.EndBattle
                {
                    winningTeam = reader.ReadInt32()
                });


            case MESSAGE:
                return(new PBS.Battle.View.Events.Message
                {
                    message = reader.ReadString()
                });

            case MESSAGEPARAMETERIZED:
                PBS.Battle.View.Events.MessageParameterized messageParameterized = new PBS.Battle.View.Events.MessageParameterized
                {
                    messageCode         = reader.ReadString(),
                    isQueryResponse     = reader.ReadBoolean(),
                    isQuerySuccessful   = reader.ReadBoolean(),
                    playerPerspectiveID = reader.ReadInt32(),
                    teamPerspectiveID   = reader.ReadInt32(),

                    pokemonID       = reader.ReadString(),
                    pokemonUserID   = reader.ReadString(),
                    pokemonTargetID = reader.ReadString(),
                    pokemonListIDs  = reader.ReadList <string>(),

                    trainerID = reader.ReadInt32(),

                    teamID = reader.ReadInt32(),

                    typeID  = reader.ReadString(),
                    typeIDs = reader.ReadList <string>(),

                    moveID  = reader.ReadString(),
                    moveIDs = reader.ReadList <string>(),

                    abilityID  = reader.ReadString(),
                    abilityIDs = reader.ReadList <string>(),

                    itemID  = reader.ReadString(),
                    itemIDs = reader.ReadList <string>(),

                    statusID            = reader.ReadString(),
                    statusTeamID        = reader.ReadString(),
                    statusEnvironmentID = reader.ReadString(),

                    intArgs = reader.ReadList <int>(),
                };

                List <PokemonStats> messageParameterizedStatList = new List <PokemonStats>();
                List <int>          messageParameterizedstatInts = reader.ReadList <int>();
                for (int i = 0; i < messageParameterizedstatInts.Count; i++)
                {
                    messageParameterizedStatList.Add((PokemonStats)messageParameterizedstatInts[i]);
                }

                messageParameterized.statList.AddRange(messageParameterizedStatList);
                return(messageParameterized);


            case MODELUPDATE:
                return(new PBS.Battle.View.Events.ModelUpdate
                {
                    loadAssets = reader.ReadBoolean()
                });

            case MODELUPDATEPOKEMON:
                return(new PBS.Battle.View.Events.ModelUpdatePokemon
                {
                    loadAsset = reader.ReadBoolean(),
                    pokemon = reader.ReadBattleViewCompactPokemon()
                });

            case MODELUPDATETRAINER:
                return(new PBS.Battle.View.Events.ModelUpdateTrainer
                {
                    loadAsset = reader.ReadBoolean(),
                    name = reader.ReadString(),
                    playerID = reader.ReadInt32(),
                    teamID = reader.ReadInt32(),
                    party = reader.ReadList <string>(),
                    items = reader.ReadList <string>(),
                    controlPos = reader.ReadList <int>()
                });

            case MODELUPDATETEAM:
                return(new PBS.Battle.View.Events.ModelUpdateTeam
                {
                    loadAsset = reader.ReadBoolean(),
                    teamID = reader.ReadInt32(),
                    teamMode = (TeamMode)reader.ReadInt32(),
                    trainers = reader.ReadList <int>()
                });


            case COMMANDGENERALPROMPT:
                return(new PBS.Battle.View.Events.CommandGeneralPrompt
                {
                    playerID = reader.ReadInt32(),
                    multiTargetSelection = reader.ReadBoolean(),
                    canMegaEvolve = reader.ReadBoolean(),
                    canZMove = reader.ReadBoolean(),
                    canDynamax = reader.ReadBoolean(),
                    items = reader.ReadList <string>(),
                    pokemonToCommand = reader.ReadList <PBS.Battle.View.Events.CommandAgent>()
                });

            case COMMANDREPLACEMENTPROMPT:
                return(new PBS.Battle.View.Events.CommandReplacementPrompt
                {
                    playerID = reader.ReadInt32(),
                    fillPositions = reader.ReadArray <int>()
                });


            case TRAINERSENDOUT:
                return(new PBS.Battle.View.Events.TrainerSendOut
                {
                    playerID = reader.ReadInt32(),
                    pokemonUniqueIDs = reader.ReadList <string>()
                });

            case TRAINERMULTISENDOUT:
                return(new PBS.Battle.View.Events.TrainerMultiSendOut
                {
                    sendEvents = reader.ReadList <PBS.Battle.View.Events.TrainerSendOut>()
                });

            case TRAINERWITHDRAW:
                return(new PBS.Battle.View.Events.TrainerWithdraw
                {
                    playerID = reader.ReadInt32(),
                    pokemonUniqueIDs = reader.ReadList <string>()
                });

            case TRAINERITEMUSE:
                return(new PBS.Battle.View.Events.TrainerItemUse
                {
                    playerID = reader.ReadInt32(),
                    itemID = reader.ReadString()
                });


            case POKEMONCHANGEFORM:
                return(new PBS.Battle.View.Events.PokemonChangeForm
                {
                    pokemonUniqueID = reader.ReadString(),
                    preForm = reader.ReadString(),
                    postForm = reader.ReadString()
                });

            case POKEMONSWITCHPOSITION:
                return(new PBS.Battle.View.Events.PokemonSwitchPosition
                {
                    pokemonUniqueID1 = reader.ReadString(),
                    pokemonUniqueID2 = reader.ReadString()
                });

            case POKEMONHEALTHDAMAGE:
                return(new PBS.Battle.View.Events.PokemonHealthDamage
                {
                    pokemonUniqueID = reader.ReadString(),
                    preHP = reader.ReadInt32(),
                    postHP = reader.ReadInt32(),
                    maxHP = reader.ReadInt32()
                });

            case POKEMONHEALTHHEAL:
                return(new PBS.Battle.View.Events.PokemonHealthHeal
                {
                    pokemonUniqueID = reader.ReadString(),
                    preHP = reader.ReadInt32(),
                    postHP = reader.ReadInt32(),
                    maxHP = reader.ReadInt32()
                });

            case POKEMONHEALTHFAINT:
                return(new PBS.Battle.View.Events.PokemonHealthFaint
                {
                    pokemonUniqueID = reader.ReadString()
                });

            case POKEMONHEALTHREVIVE:
                return(new PBS.Battle.View.Events.PokemonHealthRevive
                {
                    pokemonUniqueID = reader.ReadString()
                });

            case POKEMONMOVEUSE:
                return(new PBS.Battle.View.Events.PokemonMoveUse
                {
                    pokemonUniqueID = reader.ReadString(),
                    moveID = reader.ReadString()
                });

            case POKEMONMOVEHIT:
                return(new PBS.Battle.View.Events.PokemonMoveHit
                {
                    pokemonUniqueID = reader.ReadString(),
                    moveID = reader.ReadString(),
                    currentHit = reader.ReadInt32(),
                    hitTargets = reader.ReadList <PBS.Battle.View.Events.PokemonMoveHitTarget>()
                });

            case POKEMONABILITYACTIVATE:
                return(new PBS.Battle.View.Events.PokemonAbilityActivate
                {
                    pokemonUniqueID = reader.ReadString(),
                    abilityID = reader.ReadString()
                });

            case POKEMONSTATCHANGE:
                PBS.Battle.View.Events.PokemonStatChange statChange = new PBS.Battle.View.Events.PokemonStatChange
                {
                    pokemonUniqueID = reader.ReadString(),
                    modValue        = reader.ReadInt32(),
                    maximize        = reader.ReadBoolean(),
                    minimize        = reader.ReadBoolean(),
                    statsToMod      = new List <PokemonStats>()
                };
                List <PokemonStats> statsToMod = new List <PokemonStats>();
                List <int>          statInts   = reader.ReadList <int>();
                for (int i = 0; i < statInts.Count; i++)
                {
                    statsToMod.Add((PokemonStats)statInts[i]);
                }
                statChange.statsToMod.AddRange(statsToMod);
                return(statChange);

            case POKEMONSTATUNCHANGEABLE:
                PBS.Battle.View.Events.PokemonStatUnchangeable statUnchangeable = new PBS.Battle.View.Events.PokemonStatUnchangeable
                {
                    pokemonUniqueID = reader.ReadString(),
                    tooHigh         = reader.ReadBoolean(),
                    statsToMod      = new List <PokemonStats>()
                };
                List <PokemonStats> statsToModUnchangeable = new List <PokemonStats>();
                List <int>          statIntsUnchangeable   = reader.ReadList <int>();
                for (int i = 0; i < statIntsUnchangeable.Count; i++)
                {
                    statsToModUnchangeable.Add((PokemonStats)statIntsUnchangeable[i]);
                }
                statUnchangeable.statsToMod.AddRange(statsToModUnchangeable);
                return(statUnchangeable);

            default:
                throw new System.Exception($"Invalid event type {type}");
            }
        }
示例#5
0
 public DefaultEffectsMessage(NetworkReader reader)
 {
     Targets        = reader.ReadArray <Vector3>();
     TargetsNormals = reader.ReadArray <Vector3>();
 }