/* * Returns a called-on reference for the called function. */ private ITES5Referencer CreateCalledOnReferenceOfCalledFunction(ITES4Callable chunk, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope) { TES4ApiToken calledOn = chunk.CalledOn; if (calledOn != null) { return(this.referenceFactory.CreateReference(calledOn.StringValue, globalScope, multipleScriptsScope, codeScope.LocalScope)); } else { return(this.referenceFactory.ExtractImplicitReference(globalScope, multipleScriptsScope, codeScope.LocalScope)); } }
public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope) { TES4FunctionArguments functionArguments = function.Arguments; //We move the called upon to function arg ( cloned object ) and we replace placed upon to player TES4ApiToken newToken = new TES4ApiToken(calledOn.Name); ITES5Referencer newCalledOn = TES5ReferenceFactory.CreateReferenceToPlayer(); const string functionName = "PlaceAtMe"; TES5ObjectCallArguments arguments = new TES5ObjectCallArguments() { this.valueFactory.CreateValue(newToken, codeScope, globalScope, multipleScriptsScope), new TES5Integer(1),//WTM: Change: I added this argument. new TES5Bool(true) }; return(this.objectCallFactory.CreateObjectCall(newCalledOn, functionName, multipleScriptsScope, //this.objectCallArgumentsFactory.createArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)//WTM: Change: Previously, the above arguments variable was not used. It probably should be. arguments)); }
public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope) { TES4FunctionArguments functionArguments = function.Arguments; TES5LocalScope localScope = codeScope.LocalScope; TES5ObjectCallArguments arguments = new TES5ObjectCallArguments() { calledOn }; ITES5Value argument1 = this.valueFactory.CreateValue(functionArguments[0], codeScope, globalScope, multipleScriptsScope); if (argument1.TES5Type != TES5BasicType.T_TOPIC) { TES5Castable argument1Castable = argument1 as TES5Reference; if (argument1Castable != null && TES5InheritanceGraphAnalyzer.IsExtending(TES5BasicType.T_TOPIC, argument1.TES5Type)) { argument1Castable.ManualCastTo = TES5BasicType.T_TOPIC; } } arguments.Add(argument1); ITES4StringValue optionalFlag = functionArguments.GetOrNull(2); if (optionalFlag != null) { string optionalFlagDataString = optionalFlag.StringValue; if (this.analyzer.GetFormTypeByEDID(optionalFlagDataString).Value != TES4RecordType.REFR.Name) { this.metadataLogService.WriteLine("ADD_SPEAK_AS_ACTOR", new string[] { optionalFlagDataString }); optionalFlag = new TES4ApiToken(optionalFlag.Data + "Ref"); } arguments.Add(this.valueFactory.CreateValue(optionalFlag, codeScope, globalScope, multipleScriptsScope)); } else { arguments.Add(new TES5None()); } arguments.Add(new TES5Bool(true)); ITES5Referencer timerReference = this.referenceFactory.CreateTimerReadReference(globalScope, multipleScriptsScope, localScope); return(this.objectCallFactory.CreateObjectCall(timerReference, "LegacySay", multipleScriptsScope, arguments)); }
public TES4ObjectCall(TES4ApiToken apiToken, TES4Function function) { this.CalledOn = apiToken; this.Function = function; }
public TES4ObjectProperty(TES4ApiToken parentReference, TES4ApiToken accessField) { this.parentReference = parentReference; this.accessField = accessField; }