public void LoadModifier(CompoundModifier cm, string modValue, string modValue2 = "", string baseValue = "") { txtTotal.Text = cm.Total == null ? "0" : cm.Total; txtMagic.Text = cm.MagicModifier; txtMisc.Text = cm.MiscModifier; txtOther.Text = cm.OtherModifiers; txtSize.Text = cm.SizeModifier; txtModifier.Text = modValue; if (!editBase) { txtBase.Text = baseValue; } else { txtBase.Text = cm.Base; } if (string.IsNullOrEmpty(modValue2)) { txtModifier2.Visibility = Visibility.Collapsed; lblModifier2.Visibility = Visibility.Collapsed; txtModifier2.Text = ""; } else { txtModifier2.Visibility = Visibility.Visible; lblModifier2.Visibility = Visibility.Visible; txtModifier2.Text = modValue2; } }
public CompoundModifier GetModifier() { CompoundModifier cm = new CompoundModifier(); cm.Total = GetStringOrNull(txtTotal.Text, true); cm.Base = GetStringOrNull(editBase ? txtBase.Text : "0", true); cm.MagicModifier = GetStringOrNull(txtMagic.Text, true); cm.MiscModifier = GetStringOrNull(txtMisc.Text, true); cm.OtherModifiers = GetStringOrNull(txtOther.Text, true); cm.SizeModifier = GetStringOrNull(txtSize.Text, true); return(cm); }