示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inputPath"></param>
        public void Read(string inputPath)
        {
            // For each GAME_MASTER file in PokeRef, in order of timestamp:
            foreach (var file in GetFileList(inputPath))
            {
                GameMasterTemplate gameMasterTemplate = new GameMasterTemplate(file);
                if (gameMasterTemplate.GameMaster == null)
                {
                    continue;
                }

                if (gameMasterTemplate.GameMaster.item_templates.Count == 0)
                {
                    ConsoleOutput.OutputError($"JSON failed to Deserialize: {file}");
                }

                if (GameMasterTemplate == null)
                {
                    GameMasterTemplate = gameMasterTemplate;
                }
                else
                {
                    LegacyGameMasterTemplates.Add(gameMasterTemplate);
                }
            }
        }
示例#2
0
        /// <summary>
        /// ctor
        /// </summary>
        /// <param name="gameMaster"></param>
        /// <param name="legacyGameMasters"></param>
        /// <param name="rootFolder"></param>
        public GameMasterDataWriter(GameMasterTemplate gameMasterTemplate, IEnumerable <GameMasterTemplate> legacyGameMasterTemplates)
        {
            // Read the config.
            ManualDataSettings = new ManualDataSettings(Utils.InputManualDataFileFolder);

            GameMasterStatsCalculator = new GameMasterStatsCalculator(gameMasterTemplate.FileName);

            CollectData(gameMasterTemplate, legacyGameMasterTemplates);

            PokeFormulas.Init(PlayerLevel);
            ManualDataSettings.RaidBosses.Init(Pokemon);
            ManualDataSettings.Encounters.Init(Pokemon);
            ManualDataSettings.SpecialResearch.Init(Pokemon);
            ManualDataSettings.EventResearch.Init(Pokemon);
        }
示例#3
0
        /// <summary>
        /// Goes through the GAME_MASTERs and collects the data we want to leverage for the PokeRef site.
        /// </summary>
        /// <param name="gameMaster"></param>
        /// <param name="legacyGameMasters"></param>
        private void CollectData(GameMasterTemplate gameMasterTemplate, IEnumerable <GameMasterTemplate> legacyGameMasterTemplates)
        {
            // Get a list of all of the GAME_MASTER files.
            CurrentGameMaster = gameMasterTemplate;
            GameMasters.Add(gameMasterTemplate.FileName, gameMasterTemplate.HaveRawGameMaster);
            foreach (var legacyGameMasterTemplate in legacyGameMasterTemplates)
            {
                GameMasters.Add(legacyGameMasterTemplate.FileName, legacyGameMasterTemplate.HaveRawGameMaster);
            }

            // Process the current GameMaster
            foreach (var itemTemplate in gameMasterTemplate.GameMaster.item_templates)
            {
                try
                {
                    if (itemTemplate.pokemon_settings != null)
                    {
                        PokemonTranslator pokemon = new PokemonTranslator(itemTemplate);
                        Pokemon.Add(pokemon.Key, pokemon);
                    }
                    else if (itemTemplate.move_settings != null)
                    {
                        MoveTranslator move = new MoveTranslator(itemTemplate);
                        PokeMoves.Add(move.Key, move);
                    }
                    else if (itemTemplate.gender_settings != null)
                    {
                        GenderRatioTranslator genderRatio = new GenderRatioTranslator(itemTemplate);

                        // Some Pokemon are duplicated and should be ignored. (E.G. Castform for each of the weathers.)
                        if (GenderRatios.ContainsKey(genderRatio.Key))
                        {
                            continue;
                        }

                        GenderRatios.Add(genderRatio.Key, genderRatio);
                    }
                    else if (itemTemplate.player_level != null)
                    {
                        PlayerLevel = new PlayerLevelTranslator(itemTemplate);
                    }
                    else if (itemTemplate.form_settings != null)
                    {
                        if (itemTemplate.form_settings.forms != null)
                        {
                            FormSettingsTranslator formSettings = new FormSettingsTranslator(itemTemplate);
                            Forms.Add(formSettings.Key, formSettings);
                        }
                    }
                    else if (itemTemplate.friendship_milestone_settings != null)
                    {
                        Friendships.Add(new FriendshipTranslator(itemTemplate));
                    }

                    #region Data I am currently not using.

                    //else if (itemTemplate.avatarCustomization != null)
                    //{
                    //}
                    //else if (itemTemplate.badgeSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.battleSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.camera != null)
                    //{
                    //}
                    //else if (itemTemplate.encounterSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.gymBadgeSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.gymLevel != null)
                    //{
                    //}
                    //else if (itemTemplate.iapItemDisplay != null)
                    //{
                    //}
                    //else if (itemTemplate.iapSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.itemSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.moveSequenceSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.pokemonUpgrades != null)
                    //{
                    //}
                    //else if (itemTemplate.questSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.typeEffective != null)
                    //{
                    //}

                    #endregion Data I am currently not using.
                }
                catch (Exception ex)
                {
                    ConsoleOutput.OutputException(ex, $"Error processing {itemTemplate.template_id} ({gameMasterTemplate.FileName})");
                }
            }

            Legacy.Initialize(gameMasterTemplate, legacyGameMasterTemplates, ManualDataSettings.PokemonAvailability, ManualDataSettings.SpecialMoves);
            foreach (var pokemon in Pokemon.Values)
            {
                pokemon.AssignProperties(Pokemon,
                                         GenderRatios.ContainsKey(pokemon.PokemonSettings.pokemon_id) ? GenderRatios[pokemon.PokemonSettings.pokemon_id] : null,
                                         Legacy.FastMoves.ContainsKey(pokemon.TemplateId) ? Legacy.FastMoves[pokemon.TemplateId] : null,
                                         Legacy.ChargedMoves.ContainsKey(pokemon.TemplateId) ? Legacy.ChargedMoves[pokemon.TemplateId] : null);
            }
        }
示例#4
0
        /// <summary>
        /// Process the Legacy GameMasters
        /// </summary>
        /// <param name="legacyGameMasters"></param>
        public static void Initialize(GameMasterTemplate currentGameMasterTemplate, IEnumerable <GameMasterTemplate> legacyGameMasterTemplates, PokemonAvailability pokemonReleases, SpecialMoves specialMoves)
        {
            PokemonReleases = pokemonReleases;

            foreach (var legacyGameMasterTemplate in legacyGameMasterTemplates)
            {
                foreach (var itemTemplate in legacyGameMasterTemplate.GameMaster.item_templates)
                {
                    if (IsValidItemTemplate(itemTemplate, legacyGameMasterTemplate.GameMaster.timestamp_ms))
                    {
                        // Get the Legacy Moves.
                        if (!FastMoves.ContainsKey(itemTemplate.template_id))
                        {
                            FastMoves.Add(itemTemplate.template_id, new List <PokemonMove>());
                        }
                        List <PokemonMove> fastMoves = FastMoves[itemTemplate.template_id];

                        foreach (var move in itemTemplate.pokemon_settings.quick_moves)
                        {
                            if (!fastMoves.Contains(move))
                            {
                                fastMoves.Add(move);
                            }
                        }

                        if (!ChargedMoves.ContainsKey(itemTemplate.template_id))
                        {
                            ChargedMoves.Add(itemTemplate.template_id, new List <PokemonMove>());
                        }
                        List <PokemonMove> chargedMoves = ChargedMoves[itemTemplate.template_id];

                        foreach (var move in itemTemplate.pokemon_settings.cinematic_moves)
                        {
                            if (!chargedMoves.Contains(move))
                            {
                                chargedMoves.Add(move);
                            }
                        }
                    }
                }
            }

            foreach (var specialMove in specialMoves.Move)
            {
                if (specialMove.IsFast)
                {
                    if (!FastMoves.ContainsKey(specialMove.pokemonTemplateId))
                    {
                        FastMoves.Add(specialMove.pokemonTemplateId, new List <PokemonMove>());
                    }
                    List <PokemonMove> fastMoves = FastMoves[specialMove.pokemonTemplateId];
                    if (!fastMoves.Contains(specialMove.movementId))
                    {
                        fastMoves.Add(specialMove.movementId);
                    }
                }
                else
                {
                    if (!ChargedMoves.ContainsKey(specialMove.pokemonTemplateId))
                    {
                        ChargedMoves.Add(specialMove.pokemonTemplateId, new List <PokemonMove>());
                    }
                    List <PokemonMove> chargedMoves = ChargedMoves[specialMove.pokemonTemplateId];
                    if (!chargedMoves.Contains(specialMove.movementId))
                    {
                        chargedMoves.Add(specialMove.movementId);
                    }
                }
            }
        }