public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null) { throw new ArgumentNullException(nameof(values)); } int mod = 0; if (values.Length > 3 && values[0] is LaborID lab1 && values[1] is LaborID lab2 && values[2] is bool chym) { mod = Trank.CalculateLaborMod(lab1, lab2) + (chym ? -1 : 0); for (int i = 3; i < values.Length; i++) { mod += System.Convert.ToInt32(values[i], culture); } } return(mod); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { if (values == null) { throw new ArgumentNullException(nameof(values)); } if (values.Length >= 3 && values[0] is int mod && values[1] is LaborID lab1 && values[2] is LaborID lab2) { return((int)Math.Max(0, Math.Ceiling(System.Convert.ToDouble(mod) * 1.5) - Trank.CalculateLaborMod(lab1, lab2))); } return(0); }