public void RemoveCondition(PropertyComparisonInfo property) { if (Conditions.Contains(property)) { Conditions.Remove(property); } }
public void AddCondition(PropertyInfo propertyInfo, ConditionInfo conditionInfo, object value) { var newComparison = new PropertyComparisonInfo(propertyInfo, this); newComparison.ConditionInfo = conditionInfo; newComparison.Value = value; Conditions.Add(newComparison); }
private bool IsConditionSatisfied(PropertyComparisonInfo variable, CraftingSim sim) { object propertyValue = GetPropertyValue(variable, sim); object comparisonValue = variable.Value; switch (variable.PropertyTypeInfo) { case PropertyTypeInfo.Int: return(Compare(propertyValue, comparisonValue, variable.ConditionInfo)); case PropertyTypeInfo.Bool: return(Compare(propertyValue, comparisonValue, variable.ConditionInfo)); case PropertyTypeInfo.RecipeConditionEnum: return(Compare(propertyValue, comparisonValue, variable.ConditionInfo)); } throw new Exception(); }
private Object GetPropertyValue(PropertyComparisonInfo variable, CraftingSim sim) { switch (variable.PropertyInfo) { case PropertyInfo.TimesUsed: return(ActionSettings.TimesUsed); case PropertyInfo.PlayerLevel: return(sim.Level); case PropertyInfo.Step: return(sim.Step); case PropertyInfo.RecipeCondition: return(sim.StepSettings[sim.Step].RecipeCondition); case PropertyInfo.CP: return(sim.CurrentCP); case PropertyInfo.CurrentDurability: return(sim.CurrentDurability); case PropertyInfo.MaxDurability: return(sim.CurrentRecipe.Durability); case PropertyInfo.CurrentProgress: return(sim.CurrentProgress); case PropertyInfo.MaxProgress: return(sim.CurrentRecipe.MaxProgress); case PropertyInfo.CurrentQuality: return(sim.CurrentQuality); case PropertyInfo.CurrentQualityPercentage: return((int)(sim.CurrentQuality * 100d / sim.CurrentRecipe.MaxQuality)); case PropertyInfo.Craftsmanship: return(sim.Craftsmanship); case PropertyInfo.CurrentControl: return((int)sim.ActualControl); case PropertyInfo.LastSkillUsed: return(null); case PropertyInfo.IQStack: if (sim.InnerQuietBuff != null) { return(sim.InnerQuietBuff.Stack); } return(0); case PropertyInfo.WasteNotStack: if (sim.WasteNotBuff != null) { return(sim.WasteNotBuff.Stack); } return(0); case PropertyInfo.ManipulationStack: if (sim.ManipulationBuff != null) { return(sim.ManipulationBuff.Stack); } return(0); case PropertyInfo.InnovationStack: if (sim.InnovationBuff != null) { return(sim.InnovationBuff.Stack); } return(0); case PropertyInfo.VenerationStack: if (sim.InnovationBuff != null) { return(sim.InnovationBuff.Stack); } return(0); } throw new Exception(); }
public void AddCondition(PropertyInfo propertyInfo) { var newComparison = new PropertyComparisonInfo(propertyInfo, this); Conditions.Add(newComparison); }