public override async Task <List <Equipment> > FindBlocks(List <string> lines)
        {
            var equipmentList = new List <Equipment>();

            var expandedContentEquipmentProcessor = new ExpandedContentEquipmentProcessor(Localization);

            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseWeapons(lines,
                                                                                        Localization.PHBBlastersTableStart, false, 1, ContentType.Core));
            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseWeapons(lines,
                                                                                        Localization.PHBVibroweaponsTableStart, false, 1, ContentType.Core));
            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseWeapons(lines,
                                                                                        Localization.PHBLightweaponsTableStart, false, 1, ContentType.Core));

            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseArmor(lines,
                                                                                      Localization.PHBArmorAndShieldsTableStart, ContentType.Core));

            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseOtherEquipment(lines,
                                                                                               Localization.PHBArtisansToolsTableStart, true, 1, ContentType.Core));
            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseOtherEquipment(lines,
                                                                                               Localization.PHBAmmunitionTableStart, true, 2, ContentType.Core));
            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseOtherEquipment(lines,
                                                                                               Localization.PHBMedicalTableStart, true, 2, ContentType.Core));

            return(equipmentList);
        }
        public override async Task <List <Equipment> > FindBlocks(List <string> lines)
        {
            var equipmentList = new List <Equipment>();

            var expandedContentEquipmentProcessor = new ExpandedContentEquipmentProcessor(Localization);

            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseWeapons(lines, Localization.WHBlastersStartLine, false, 1, ContentType.Core));
            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseWeapons(lines, Localization.WHVibroweaponsStartLine, false, 1, ContentType.Core));
            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseWeapons(lines, Localization.WHLightweaponsStartLine, false, 1, ContentType.Core));

            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseArmor(lines, Localization.WHArmorAndShieldsStartLine, ContentType.Core));

            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseOtherEquipment(lines, Localization.WHSpecialistsKitStartLine, true, 1, ContentType.Core));
            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseOtherEquipment(lines, Localization.WHAmmunitionStartLine, true, 2, ContentType.Core));
            equipmentList.AddRange(await expandedContentEquipmentProcessor.ParseOtherEquipment(lines, Localization.WHMedicalStartLine, true, 2, ContentType.Core));

            return(equipmentList);
        }
Example #3
0
        public async Task Parse()
        {
            try
            {
                var equipmentProcessor = new ExpandedContentEquipmentProcessor(_localization);
                var equipments         = await equipmentProcessor.Process(_ecEquipmentFileName, _localization);

                foreach (var equipment in equipments)
                {
                    equipment.ContentSourceEnum = ContentSource.EC;

                    switch (equipment.EquipmentCategoryEnum)
                    {
                    case EquipmentCategory.Unknown:
                    case EquipmentCategory.Ammunition:
                    case EquipmentCategory.Explosive:
                    case EquipmentCategory.Storage:
                    case EquipmentCategory.AdventurePack:
                    case EquipmentCategory.Communications:
                    case EquipmentCategory.DataRecordingAndStorage:
                    case EquipmentCategory.LifeSupport:
                    case EquipmentCategory.Medical:
                    case EquipmentCategory.WeaponOrArmorAccessory:
                    case EquipmentCategory.Tool:
                    case EquipmentCategory.Mount:
                    case EquipmentCategory.Vehicle:
                    case EquipmentCategory.TradeGood:
                    case EquipmentCategory.Utility:
                    case EquipmentCategory.GamingSet:
                    case EquipmentCategory.MusicalInstrument:
                    case EquipmentCategory.Droid:
                    case EquipmentCategory.Clothing:
                    case EquipmentCategory.Kit:
                        var equipmentSearchTerm = _globalSearchTermRepository.CreateSearchTerm(equipment.Name,
                                                                                               GlobalSearchTermType.AdventuringGear, ContentType.ExpandedContent,
                                                                                               $"/loot/adventuringGear/?search={equipment.Name}");
                        _globalSearchTermRepository.SearchTerms.Add(equipmentSearchTerm);
                        break;

                    case EquipmentCategory.Weapon:
                        var weaponSearchTerm = _globalSearchTermRepository.CreateSearchTerm(equipment.Name,
                                                                                            GlobalSearchTermType.Weapon, ContentType.ExpandedContent,
                                                                                            $"/loot/weapons/?search={equipment.Name}");
                        _globalSearchTermRepository.SearchTerms.Add(weaponSearchTerm);
                        break;

                    case EquipmentCategory.Armor:
                        var searchTermType = GlobalSearchTermType.Armor;
                        if (equipment.ArmorClassificationEnum == ArmorClassification.Shield)
                        {
                            searchTermType = GlobalSearchTermType.Shield;
                        }

                        var armorSearchTerm = _globalSearchTermRepository.CreateSearchTerm(equipment.Name,
                                                                                           searchTermType, ContentType.ExpandedContent,
                                                                                           $"/loot/armor/?search={equipment.Name}");
                        _globalSearchTermRepository.SearchTerms.Add(armorSearchTerm);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                await _tableStorage.AddBatchAsync <Equipment>($"equipment{_localization.Language}", equipments,
                                                              new BatchOperationOptions { BatchInsertMethod = BatchInsertMethod.InsertOrReplace });
            }
            catch (StorageException)
            {
                Console.WriteLine("Failed to upload EC equipment.");
            }
        }