public void TestGetConditionString(string input, string expected) { ExpressionBase error; InterpreterScope scope = new InterpreterScope(AchievementScriptInterpreter.GetGlobalScope()); scope.Context = new TriggerBuilderContext(); var expression = Parse(input); ExpressionBase processed; Assert.That(expression.ReplaceVariables(scope, out processed), Is.True); var result = TriggerBuilderContext.GetConditionString(processed, scope, out error); if (error != null) { Assert.That(((ParseErrorExpression)error).InnermostError.Message, Is.EqualTo(expected)); } else { Assert.That(error, Is.Null); Assert.That(result, Is.EqualTo(expected)); } }
private string ProcessTrigger(InterpreterScope scope, string parameter, out ExpressionBase result) { var expression = GetParameter(scope, parameter, out result); if (expression == null) { return(null); } return(TriggerBuilderContext.GetConditionString(expression, scope, out result)); }
protected override bool SetDisplayString(RichPresenceBuilder richPresence, string displayString, InterpreterScope scope, out ExpressionBase result) { var expression = GetParameter(scope, "condition", out result); if (expression == null) { return(false); } var condition = TriggerBuilderContext.GetConditionString(expression, scope, out result); if (condition == null) { return(false); } richPresence.AddConditionalDisplayString(condition, displayString); return(true); }