Exemple #1
0
        public void Save(ItemCategory itemCategory)
        {
            //Check if itemCategory is in DB
            var itemCategoryInDb = itemCategoryContext.Get(itemCategory.Id);

            //If not in DB, create new
            if (itemCategoryInDb == null)
            {
                itemCategoryContext.Add(itemCategory);
            }
            //If in DB, update
            else
            {
                itemCategoryInDb.Name = itemCategory.Name;
            }

            //Commit changes
            itemCategoryContext.Commit();
        }
Exemple #2
0
        public async Task Initialize(Item item)
        {
            Item = item;

            CategoryOptions.Add(Item.TypeLine, null);
            if (Item.Category == Category.Weapon)
            {
                CategoryOptions.Add(PriceResources.Class_Weapon, "weapon");
                CategoryOptions.Add(PriceResources.Class_WeaponOne, "weapon.one");
                CategoryOptions.Add(PriceResources.Class_WeaponOneMelee, "weapon.onemelee");
                CategoryOptions.Add(PriceResources.Class_WeaponTwoMelee, "weapon.twomelee");
                CategoryOptions.Add(PriceResources.Class_WeaponBow, "weapon.bow");
                CategoryOptions.Add(PriceResources.Class_WeaponClaw, "weapon.claw");
                CategoryOptions.Add(PriceResources.Class_WeaponDagger, "weapon.dagger");
                CategoryOptions.Add(PriceResources.Class_WeaponRuneDagger, "weapon.runedagger");
                CategoryOptions.Add(PriceResources.Class_WeaponOneAxe, "weapon.oneaxe");
                CategoryOptions.Add(PriceResources.Class_WeaponOneMace, "weapon.onemace");
                CategoryOptions.Add(PriceResources.Class_WeaponOneSword, "weapon.onesword");
                CategoryOptions.Add(PriceResources.Class_WeaponSceptre, "weapon.sceptre");
                CategoryOptions.Add(PriceResources.Class_WeaponStaff, "weapon.staff");
                CategoryOptions.Add(PriceResources.Class_WeaponWarstaff, "weapon.warstaff");
                CategoryOptions.Add(PriceResources.Class_WeaponTwoAxe, "weapon.twoaxe");
                CategoryOptions.Add(PriceResources.Class_WeaponTwoMace, "weapon.twomace");
                CategoryOptions.Add(PriceResources.Class_WeaponTwoSword, "weapon.twosword");
                CategoryOptions.Add(PriceResources.Class_WeaponWand, "weapon.wand");
                CategoryOptions.Add(PriceResources.Class_WeaponRod, "weapon.rod");
            }

            if (Item.Category == Category.Armour)
            {
                CategoryOptions.Add(PriceResources.Class_Armour, "armour");
                CategoryOptions.Add(PriceResources.Class_ArmourChest, "armour.chest");
                CategoryOptions.Add(PriceResources.Class_ArmourBoots, "armour.boots");
                CategoryOptions.Add(PriceResources.Class_ArmourGloves, "armour.gloves");
                CategoryOptions.Add(PriceResources.Class_ArmourHelmet, "armour.helmet");
                CategoryOptions.Add(PriceResources.Class_ArmourShield, "armour.shield");
                CategoryOptions.Add(PriceResources.Class_ArmourQuiver, "armour.quiver");
            }

            if (Item.Category == Category.Accessory)
            {
                CategoryOptions.Add(PriceResources.Class_Accessory, "accessory");
                CategoryOptions.Add(PriceResources.Class_AccessoryAmulet, "accessory.amulet");
                CategoryOptions.Add(PriceResources.Class_AccessoryBelt, "accessory.belt");
                CategoryOptions.Add(PriceResources.Class_AccessoryRing, "accessory.ring");
            }

            if (Item.Category == Category.Gem)
            {
                CategoryOptions.Add(PriceResources.Class_Gem, "gem");
                CategoryOptions.Add(PriceResources.Class_GemActive, "gem.activegem");
                CategoryOptions.Add(PriceResources.Class_GemSupport, "gem.supportgem");
                CategoryOptions.Add(PriceResources.Class_GemAwakenedSupport, "gem.supportgemplus");
            }

            if (Item.Category == Category.Jewel)
            {
                CategoryOptions.Add(PriceResources.Class_Jewel, "jewel");
                CategoryOptions.Add(PriceResources.Class_JewelBase, "jewel.base");
                CategoryOptions.Add(PriceResources.Class_JewelAbyss, "jewel.abyss");
                CategoryOptions.Add(PriceResources.Class_JewelCluster, "jewel.cluster");
            }

            if (Item.Category == Category.Flask)
            {
                CategoryOptions.Add(PriceResources.Class_Flask, "flask");
            }

            if (Item.Category == Category.Map)
            {
                CategoryOptions.Add(PriceResources.Class_Map, "map");
                CategoryOptions.Add(PriceResources.Class_MapFragment, "map.fragment");
                CategoryOptions.Add(PriceResources.Class_MapScarab, "map.scarab");
            }

            if (Item.Category == Category.Watchstone)
            {
                CategoryOptions.Add(PriceResources.Class_Watchstone, "watchstone");
            }

            if (Item.Category == Category.Leaguestone)
            {
                CategoryOptions.Add(PriceResources.Class_Leaguestone, "leaguestone");
            }

            if (Item.Category == Category.Prophecy)
            {
                CategoryOptions.Add(PriceResources.Class_Prophecy, "prophecy");
            }

            if (Item.Category == Category.DivinationCard)
            {
                CategoryOptions.Add(PriceResources.Class_Card, "card");
            }

            if (Item.Category == Category.ItemisedMonster)
            {
                CategoryOptions.Add(PriceResources.Class_MonsterBeast, "monster.beast");
                CategoryOptions.Add(PriceResources.Class_MonsterSample, "monster.sample");
            }

            if (Item.Category == Category.Currency)
            {
                CategoryOptions.Add(PriceResources.Class_Currency, "currency");
                CategoryOptions.Add(PriceResources.Class_CurrencyPiece, "currency.piece");
                CategoryOptions.Add(PriceResources.Class_CurrencyResonator, "currency.resonator");
                CategoryOptions.Add(PriceResources.Class_CurrencyFossil, "currency.fossil");
                CategoryOptions.Add(PriceResources.Class_CurrencyIncubator, "currency.incubator");
            }

            SelectedCategory = (await itemCategoryRepository.Get(Item.TypeLine))?.Category;
            if (!CategoryOptions.Values.Any(x => x == SelectedCategory))
            {
                SelectedCategory = null;
            }

            ShowCategory = (Item?.Rarity == Rarity.Rare || Item?.Rarity == Rarity.Magic || Item?.Rarity == Rarity.Normal) && CategoryOptions.Count > 2;

            InitializeFilters();

            await UpdateQuery();

            await GetPoeNinjaPrice();

            if (settings.Price_Prediction_Enable)
            {
                await GetPredictionPrice();
            }
        }
        public ItemCategory getById(int id)
        {
            var category = _ItemCategoryRepository.Get(it => it.CategoryId == id);

            return(category);
        }