public static Boolean validConditions(Player perso, String req) { if ((req == null) || (req.Equals(""))) { return(true); } if (req.Contains("BI")) { return(false); } JepInstance jep = new JepInstance(); if (req.Contains("PO")) { req = havePO(req, perso); } req = req.Replace("&", "&&").Replace("=", "==").Replace("|", "||").Replace("!", "!="); try { jep.AddVariable("CI", perso.myStats.GetEffect(EffectEnum.AddIntelligence).Total); jep.AddVariable("CV", perso.myStats.GetEffect(EffectEnum.AddVitalite).Total); jep.AddVariable("CA", perso.myStats.GetEffect(EffectEnum.AddAgilite).Total); jep.AddVariable("CW", perso.myStats.GetEffect(EffectEnum.AddSagesse).Total); jep.AddVariable("CC", perso.myStats.GetEffect(EffectEnum.AddChance).Total); jep.AddVariable("CS", perso.myStats.GetEffect(EffectEnum.AddForce).Total); jep.AddVariable("Ci", perso.myStats.GetEffect(126).Base); jep.AddVariable("Cs", perso.myStats.GetEffect(118).Base); jep.AddVariable("Cv", perso.myStats.GetEffect(125).Base); jep.AddVariable("Ca", perso.myStats.GetEffect(119).Base); jep.AddVariable("Cw", perso.myStats.GetEffect(124).Base); jep.AddVariable("Cc", perso.myStats.GetEffect(123).Base); jep.AddVariable("Ps", perso.Alignement); jep.AddVariable("Pa", perso.AlignementLevel); jep.AddVariable("PP", perso.getGrade()); jep.AddVariable("PL", perso.Level); jep.AddVariable("PK", perso.Kamas); jep.AddVariable("PG", perso.Classe); jep.AddVariable("PS", perso.Sexe); jep.AddVariable("PZ", true); jep.AddVariable("MiS", perso.ID); jep.Parse(req); Object result = jep.Evaluate(); Boolean ok = false; if (result != null) { ok = Boolean.Parse(result.ToString()); } return(ok); } catch (JepException e) { Logger.Error("An error occurred: " + e.ToString()); } return(true); }
public MathExpr() { this.jeb = new JepInstance(); this.jeb.AddFunction("exp", new MathExp_exp()); this.jeb.AddFunction("sgn", new MathExp_sgn()); this.jeb.AddFunction("acot", new MathExp_acot()); this.jeb.AddFunction("sinh", new MathExp_sinh()); this.jeb.AddFunction("cosh", new MathExp_cosh()); this.jeb.AddFunction("tanh", new MathExp_tanh()); this.jeb.AddFunction("coth", new MathExp_coth()); this.jeb.AddFunction("log10", new MathExp_log10()); this.jeb.AddFunction("step", new MathExp_step()); this.jeb.AddStandardConstants(); // jeb.addStandardFunctions(); this.variables = new Dictionary <Variable, int>(); }
public void Init(JepInstance jep) { this.jep = jep; foreach (ITokenMatcher matcher in this.m) { matcher.Init(jep); } foreach (ITokenFilter filter in this.filters) { filter.Init(jep); } foreach (IGrammarMatcher matcher2 in this.g) { matcher2.Init(jep); } }
public virtual void Init(JepInstance jep) { }
public void Init(JepInstance jep) { }
public void Init(JepInstance jep) { this.nf = jep.NodeFac; }
public override void Init(JepInstance j) { }
public void init(JepInstance jep) { this.nf = jep.NumFac; }
public BooleanExpression(String expression) { this.expression = expression; jep = new JepInstance(); variableNames = GetVariableNamesFromString();//.ToList(); }
public void Init(JepInstance jep) { this.nf = jep.NodeFac; this.list = jep.OpTab.GetOperator(0x16); }
public ShuntingYard(JepInstance jep, List <IGrammarMatcher> gm) { this.jep = jep; this.matchers = gm; }
public void Init(JepInstance j) { this.Init(j.OpTab); }
public void Init(JepInstance j) { this.startMatcher.Init(j); this.endMatcher.Init(j); this.completeMatcher.Init(j); }
public override void Init(JepInstance j) { this.ft = j.FunTab; }
public override void Init(JepInstance jep) { this.nf = jep.NumFac; }
public void Init(JepInstance jep) { this.nf = jep.NodeFac; this.ot = jep.OpTab; }