Exemplo n.º 1
0
        public static int GetPatchCategory(SaintCoinach.Xiv.Item item)
        {
            if (Hacks.IsItemSkipped(item.Name, item.Key))
            {
                return(-1);
            }

            if (item.ItemAction is SaintCoinach.Xiv.ItemActions.MountUnlock)
            {
                return(17);
            }

            if (item.ItemAction is SaintCoinach.Xiv.ItemActions.CompanionUnlock)
            {
                return(11);
            }

            var equipment = item as SaintCoinach.Xiv.Items.Equipment;

            // PvP Equipment
            if (equipment != null && equipment.IsPvP)
            {
                return(18);
            }

            // Fixed categories
            if (ItemPatchCategoryByUICategory.TryGetValue(item.ItemUICategory.Key, out var category))
            {
                return(category);
            }

            // Equipment by parameters
            if (equipment != null)
            {
                // Check parameters for accessories.
                foreach (var param in equipment.AllParameters)
                {
                    var attrCategory = GetAttributePatchCategory(param.BaseParam);
                    if (attrCategory != null && attrCategory.Value != 19)
                    {
                        return(attrCategory.Value);
                    }
                }

                // Remaining soul crystals
                if (equipment.ItemUICategory.Key == 62)
                {
                    return(0);
                }

                // No discernable parameters - Glamour.
                return(3);
            }

            // If you're reading this update the ItemPatchCategoryByUICategory map at the top of this file.
            throw new NotImplementedException($"Unknown patch category for {item.Name} ({item.Key}), ItemUICategory {item.ItemUICategory.Key}");
        }
Exemplo n.º 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();
            }
        }