using System; using NTERA.EmuEra.Game.EraEmu.GameData.Variable; namespace NTERA.EmuEra.Game.EraEmu.GameData.Expression { internal sealed class NullTerm : IOperandTerm { public NullTerm(Int64 i) : base(typeof(Int64)) { } public NullTerm(string s) : base(typeof(string)) { } } /// /// 項。一単語だけ。 /// internal sealed class SingleTerm : IOperandTerm { public SingleTerm(bool i) : base(typeof(Int64)) { if (i) iValue = 1; else iValue = 0; } public SingleTerm(Int64 i) : base(typeof(Int64)) { iValue = i; } public SingleTerm(string s) : base(typeof(string)) { sValue = s; } readonly Int64 iValue; string sValue; public override long GetIntValue(ExpressionMediator exm) { return iValue; } public override string GetStrValue(ExpressionMediator exm, bool translate=false) { //Modified by Bartoum //PRINTS go through here. if (exm != null && exm.Process != null && exm.Process.getCurrentLine != null) { string name = exm.Process.getCurrentLine.ToString(); name = Translation.searchParentFile(name); sValue = Translation.translate(sValue, name, translate); } return sValue; } public override SingleTerm GetValue(ExpressionMediator exm, bool tryTranslate =false) { return this; } public string Str { get => sValue; set // JVN: Set method needed to make things work smoother for PARAM stuff { sValue = value; } } public Int64 Int => iValue; public override string ToString() { if (GetOperandType() == typeof(Int64)) return iValue.ToString(); if (GetOperandType() == typeof(string)) return sValue; return base.ToString(); } public override IOperandTerm Restructure(ExpressionMediator exm, bool tryTranslate=false) { return this; } } /// /// 項。一単語だけ。 /// internal sealed class StrFormTerm : IOperandTerm { public StrFormTerm(StrForm sf) : base(typeof(string)) { sfValue = sf; } readonly StrForm sfValue; public StrForm StrForm => sfValue; public override string GetStrValue(ExpressionMediator exm, bool translate=false) { // Bartoum: If the current line containts