Beispiel #1
0
        public ConditionControlViewModel(CraftingCondition condition, PoeCrafting.Entities.ItemBase itemBase, List <Affix> affixes)
        {
            _itemBase          = itemBase;
            _affixes           = affixes;
            _craftingCondition = condition;

            SubconditionControls = new ObservableCollection <SubconditionControlView>();

            for (int i = condition.CraftingSubConditions.Count - 1; i >= 0; i--)
            {
                var model = new SubconditionControlViewModel(condition.CraftingSubConditions[i], affixes, GetNextIndex(), _itemBase);
                var subconditionControl = new SubconditionControlView(model);
                model.OnDeleteEvent += (x, y) => RemoveSubcondition(y.Control);
                SubconditionControls.Add(subconditionControl);
            }

            if (SubconditionControls.Count == 0)
            {
                AddSubcondition();
            }

            SelectedSubcondition = SubconditionControls[0];

            OnPropertyChanged(nameof(SelectedSubcondition));
            OnPropertyChanged(nameof(SubconditionControls));
        }
        public SubconditionAffixControlViewModel(ConditionAffix condition, List <Affix> affixes, StatValueType statValueType, AffixType affixType, PoeCrafting.Entities.ItemBase itemBase)
        {
            _statValueType = statValueType;
            _affixes       = affixes;
            _affixType     = affixType;
            _itemBase      = itemBase;

            AffixName = condition.ModType;

            if (condition.Min1.HasValue)
            {
                FirstStatMin = condition.Min1.Value;
            }
            if (condition.Max1.HasValue)
            {
                FirstStatMax = condition.Max1.Value;
            }
            if (condition.Min2.HasValue)
            {
                SecondStatMin = condition.Min2.Value;
            }
            if (condition.Max2.HasValue)
            {
                SecondStatMax = condition.Max2.Value;
            }
            if (condition.Min3.HasValue)
            {
                ThirdStatMin = condition.Min3.Value;
            }
            if (condition.Max3.HasValue)
            {
                ThirdStatMax = condition.Max3.Value;
            }
        }
Beispiel #3
0
        public void Initialize()
        {
            var baseInfo = _configRepository.GetItemConfig();

            if (_baseInfo != null && _baseInfo.Equals(baseInfo))
            {
                return;
            }

            _baseInfo = baseInfo;
            _equipmentFactory.Initialize(baseInfo.ItemBase, baseInfo.Category, baseInfo.ItemLevel);
            _itemBase = _equipmentFactory.GetBaseItem();
            _affixes  = new ObservableCollection <Affix>(_equipmentFactory.GetPossibleAffixes());

            CraftingTree.ClearConditions();
            CraftingTree.Initialize();
            Condition = null;
            _selected = Tree.Tree[0].Value;
            Tree.UpdateTree(CraftingTree, _selected);
            OnPropertyChanged(nameof(Condition));
            OnPropertyChanged(nameof(Tree));
        }
Beispiel #4
0
        private void Initialize(List <ConditionAffix> conditions, List <Affix> affixes, AffixType affixType, PoeCrafting.Entities.ItemBase itemBase, StatValueType valueType)
        {
            var firstCondition  = conditions.Count >= 1 ? conditions[0] : new ConditionAffix();
            var secondCondition = conditions.Count >= 2 ? conditions[1] : new ConditionAffix();
            var thirdCondition  = conditions.Count >= 3 ? conditions[2] : new ConditionAffix();

            FirstAffixModel  = new SubconditionAffixControlViewModel(firstCondition, affixes, valueType, affixType, itemBase);
            SecondAffixModel = new SubconditionAffixControlViewModel(secondCondition, affixes, valueType, affixType, itemBase);
            ThirdAffixModel  = new SubconditionAffixControlViewModel(thirdCondition, affixes, valueType, affixType, itemBase);

            FirstAffix  = new SubconditionAffixControlView(FirstAffixModel);
            SecondAffix = new SubconditionAffixControlView(SecondAffixModel);
            ThirdAffix  = new SubconditionAffixControlView(ThirdAffixModel);
        }
Beispiel #5
0
        public SubconditionAffixesControlViewModel(List <ConditionAffix> conditions, List <Affix> affixes, AffixType affixType, PoeCrafting.Entities.ItemBase itemBase, StatValueType valueType)
        {
            _affixType = affixType;
            Initialize(conditions, affixes, affixType, itemBase, valueType);
            _valueType = valueType;

            OnPropertyChanged(nameof(FirstAffix));
            OnPropertyChanged(nameof(SecondAffix));
            OnPropertyChanged(nameof(ThirdAffix));
        }
Beispiel #6
0
        public SubconditionControlViewModel(CraftingSubcondition subCondition, List <Affix> affixes, int index, PoeCrafting.Entities.ItemBase itemBase)
        {
            SubconditionName = string.IsNullOrEmpty(subCondition.Name) ? "JsonSubcondition " + index : subCondition.Name;

            Index            = index;
            SubCondition     = subCondition;
            AggregateTypeMin = subCondition.AggregateMin;
            AggregateTypeMax = subCondition.AggregateMax;

            PrefixConditionsModel = new SubconditionAffixesControlViewModel(subCondition.PrefixConditions, affixes, AffixType.Prefix, itemBase, subCondition.ValueType);
            SuffixConditionsModel = new SubconditionAffixesControlViewModel(subCondition.SuffixConditions, affixes, AffixType.Suffix, itemBase, subCondition.ValueType);
            MetaConditionsModel   = new SubconditionAffixesControlViewModel(subCondition.MetaConditions, affixes, AffixType.Meta, itemBase, subCondition.ValueType);

            PrefixConditions = new SubconditionAffixesControlView(PrefixConditionsModel);
            SuffixConditions = new SubconditionAffixesControlView(SuffixConditionsModel);
            MetaConditions   = new SubconditionAffixesControlView(MetaConditionsModel);

            SelectedAggregateType = subCondition.AggregateType.ToString();
            SelectedValueType     = subCondition.ValueType.ToString();
        }