public bool IsEquivalent(BonusItemViewModel bonus)
 {
     return(!string.IsNullOrEmpty(this.TypeBonus) && bonus.TypeBonus == this.TypeBonus && !string.IsNullOrEmpty(this.Bonus) && bonus.Bonus == this.Bonus);
 }
예제 #2
0
        private void UpdateBonuses(bool fromLoot)
        {
            if (fromLoot)
            {
                this._IsLegendaryWeapon = false;
            }
            else
            {
                this._IsLoot = false;
            }

            this.Bonus1 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus2 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus3 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus4 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus5 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot, IsFifthBonus = true
            };
            this.Bonus6 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus7 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus8 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus9 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus10 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus11 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus12 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus13 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus14 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };
            this.Bonus15 = new BonusItemViewModel()
            {
                IsLoot = this.IsLoot
            };

            if (this.IsLegendaryWeapon)
            {
                LegendaryWeaponModel legend = null;
                if (this.Slot == "MH" || this.Slot == "OH")
                {
                    legend = DataProvider.Current.LegendaryWeapons.FirstOrDefault(o => o.Code == "MELEE");
                }
                else if (this.Slot == "RANGE")
                {
                    legend = DataProvider.Current.LegendaryWeapons.FirstOrDefault(o => o.Code == "MAGIC");
                }
                else if (this.Slot == "TWO")
                {
                    var classe = DataProvider.Current.Classes.First(o => o.Code == ServiceLocator.Current.GetInstance <MainViewModel>().SelectedTemplate.Class);
                    if (classe != null)
                    {
                        legend = DataProvider.Current.LegendaryWeapons.FirstOrDefault(o => o.Code == classe.LegendWeaponType);
                        if (legend == null)
                        {
                            legend = DataProvider.Current.LegendaryWeapons.FirstOrDefault(o => o.Code == "MELEE");
                        }
                    }
                }

                if (legend != null)
                {
                    var i = 5;
                    foreach (var bonus in legend.Bonuses)
                    {
                        var bonusItem = new BonusItemViewModel();
                        bonusItem.Bonus     = bonus.Code;
                        bonusItem.IsLoot    = true;
                        bonusItem.TypeBonus = bonus.Type;
                        bonusItem.Value     = bonus.Value;

                        if (i == 5)
                        {
                            this.Bonus5 = bonusItem;
                        }
                        else if (i == 6)
                        {
                            this.Bonus6 = bonusItem;
                        }
                        else if (i == 7)
                        {
                            this.Bonus7 = bonusItem;
                        }
                        i += 1;
                    }
                }
            }

            RaisePropertyChanged("IsLoot");
            RaisePropertyChanged("IsNotLoot");
            RaisePropertyChanged("ShowFithBonus");
            RaisePropertyChanged("ShowExtraBonus");
            RaisePropertyChanged("IsLegendaryWeapon");
            RaisePropertyChanged("NotIsLegendaryWeapon");
        }