예제 #1
0
 public void LoadFromMod(ModViewModel mod)
 {
     settingInternally = true;
     try
     {
         tbxAbsolute.Text = mod.Absolute.ToString();
         //lbAddModifier.SelectedValue = entry.ModAddAbilityModifier.Value;
         lbConditions.SelectedValue = mod.ModConditions.Value;
         CheckEnumList.SetValue(lbDamageEdit.ItemsSource, mod.DamageTypeFilter.DamageType.Value);
         CheckEnumList.SetValue(lbConditions.ItemsSource, mod.ModConditions.Value);
         RadioEnumList.SetValue(lbAttackFilter.ItemsSource, mod.DamageTypeFilter.AttackKind.Value);
         RadioEnumList.SetValue(lbAddModifier.ItemsSource, mod.ModAddAbilityModifier.Value);
         RadioEnumList.SetValue(lbModType.ItemsSource, mod.ModType.Value);
         lbModType.SelectedValue      = mod.ModType.Value;
         tbxMultiplier.Text           = mod.Multiplier.ToString();
         tbxOffset.Text               = mod.Offset.ToString();
         txbModifierLimit.Text        = mod.ModifierLimit.ToString();
         tmRepeats.TimeMeasure        = mod.Repeats.TimeMeasure;
         tmRepeats.Amount             = mod.Repeats.Count;
         ckRequiresConsumed.IsChecked = mod.RequiresConsumption;
         ckRequiresEquipped.IsChecked = mod.RequiresEquipped;
         SelectCombo(cbTargetName, mod.TargetName);
         SelectCombo(cbVantageSkillFilter, mod.VantageSkillFilter);
         ckbAddsAdvantage.IsChecked    = mod.AddsAdvantage;
         ckbAddsDisadvantage.IsChecked = mod.AddsDisadvantage;
     }
     finally
     {
         settingInternally = false;
     }
 }
예제 #2
0
        public void SaveToMod(ModViewModel mod, string propertyName)
        {
            if (settingInternally)
            {
                return;
            }
            mod.Absolute         = MathUtils.GetDouble(tbxAbsolute.Text);
            mod.AddsAdvantage    = ckbAddsAdvantage.IsChecked ?? false;
            mod.AddsDisadvantage = ckbAddsDisadvantage.IsChecked ?? false;
            mod.ModifierLimit    = MathUtils.GetInt(txbModifierLimit.Text);
            mod.Multiplier       = MathUtils.GetDouble(tbxMultiplier.Text, 1);
            //mod.Name = vm.Name;
            mod.Offset              = MathUtils.GetDouble(tbxOffset.Text);
            mod.Repeats             = new DndTimeSpan(tmRepeats.TimeMeasure, (int)tmRepeats.Amount);
            mod.RequiresConsumption = ckRequiresConsumed.IsChecked == true;
            mod.RequiresEquipped    = ckRequiresEquipped.IsChecked == true;
            mod.DamageTypeFilter.AttackKind.Value = RadioEnumList.CalcValue(lbAttackFilter.ItemsSource, typeof(AttackType));
            mod.AddAbilityModifier = (Ability)RadioEnumList.CalcValue(lbAddModifier.ItemsSource, typeof(Ability));
            mod.DamageTypeFilter.DamageType.Value = CheckEnumList.CalcValue(lbDamageEdit.ItemsSource, typeof(DamageType));
            mod.ModConditions.Value = CheckEnumList.CalcValue(lbConditions.ItemsSource, typeof(Conditions));

            if (cbTargetName.SelectedValue != null)
            {
                mod.TargetName = cbTargetName.SelectedValue.ToString();
            }
            else
            {
                mod.TargetName = string.Empty;
            }

            mod.ModType.Value = RadioEnumList.CalcValue(lbModType.ItemsSource, typeof(ModType));;
            if (cbVantageSkillFilter.SelectedValue != null)
            {
                mod.VantageSkillFilter = (Skills)cbVantageSkillFilter.SelectedValue;
            }
            else
            {
                mod.VantageSkillFilter = Skills.none;
            }
        }