コード例 #1
0
        public static void Calculate(DatabaseBuilder builder, ItemSourceComplexity complexity)
        {
            var rareItemsById = builder.Db.Items
                                .Where(i => i.craft == null)
                                .Where(i => ((JToken)i.id).Type == JTokenType.Integer)
                                .Where(i => complexity.GetNqComplexity((int)i.id) >= 80)
                                .ToDictionary(i => (int)i.id);

            var candidateItems = builder.Db.Items
                                 .Where(i => i.craft != null)
                                 .Where(i => i.desynthSkill != null)
                                 .Where(i => ((JToken)i.id).Type == JTokenType.Integer)
                                 .Where(i => complexity.GetNqComplexity((int)i.id) <= 75);

            var lines = new List <string>();

            foreach (var item in candidateItems)
            {
                foreach (var recipe in item.craft)
                {
                    foreach (var ingredient in recipe.ingredients)
                    {
                        if (rareItemsById.TryGetValue((int)ingredient.id, out var rareIngredientItem))
                        {
                            lines.Add($"{rareIngredientItem.en.name} appears in recipe list of {item.en.name}.");
                        }
                    }
                }
            }

            File.WriteAllLines("rare-desynth.txt", lines);
        }
コード例 #2
0
        public void Build(bool fetchIconsOnly)
        {
            OneTimeExports.Run(_realm);

            // Miscellaneous initialization
            ItemsToImport = Sheet <Saint.Item>()
                            .Where(i => !Hacks.IsItemSkipped(i.Name, i.Key))
                            .ToArray();

            NpcsToImport = _realm.GameData.ENpcs
                           .Where(n => n.Resident != null)
                           .Where(n => !string.IsNullOrWhiteSpace(n.Singular))
                           .ToArray();

            _libraNpcIndex = _libra.Table <Libra.ENpcResident>().ToDictionary(e => e.Key);

            FileDatabase.Initialize();
            IconDatabase.Initialize();
            ItemIconDatabase.Initialize(ItemsToImport);
            PatchDatabase.Initialize();

            if (fetchIconsOnly)
            {
                new Lodestone.LodestoneIconScraper().FetchIcons();
                PrintLine("All icons fetched.  Stopping.");
                return;
            }

            var itemSourceComplexityModule = new ItemSourceComplexity();

            // All the modules.
            var modules = new Queue <Module>(new Module[]
            {
                new Indexes(),
                new Miscellaneous(),
                new Locations(),
                new Items(),
                //new ItemSets(),
                new Orchestrion(),
                new Actions(),
                new Emotes(),
                new Weather(),
                new Instances(),
                new Nodes(),
                new NPCs(),
                new SpecialShops(),
                new DisposalShops(),
                new Recipes(),
                new Specializations(),
                new Mounts(),
                new Minions(),
                new TripleTriad(),
                new Customize(),
                new Mobs(),
                new Quests(),
                new Talk(),
                new FishingSpots(),
                new Leves(),
                new Achievements(),
                new Fates(),
                new JobCategories(),
                new Ventures(),
                new Materia(),
                new WondrousTails(),
                new OtherItemSources(),
                new Relics(),
                itemSourceComplexityModule,
                new SupplyDuties(itemSourceComplexityModule),
                new Maps(),
                new EquipmentScorer(),
                new Jobs(),
                new Dyes(),
                new NpcEquipment(itemSourceComplexityModule),
                new NpcAlternates(), // Has to be the very end.
                new StatisticsModule(itemSourceComplexityModule),
            });

            itemSourceComplexityModule = null;

            var total = modules.Count;

            while (modules.Count > 0)
            {
                var module = modules.Dequeue();
                PrintLine($"* {module.Name}... {total - modules.Count}/{total}");
                module.Start();
            }
        }