public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments functionArguments = function.Arguments;
            //Simple implementation without looking.
            TES5ObjectCallArguments arguments = new TES5ObjectCallArguments();

            //if (calledOn.TES5Type != TES5BasicType.T_OBJECTREFERENCE)
            //{
            //    TES5Castable calledOnCastable = calledOn as TES5Reference;
            //    if (calledOn != null && TES5InheritanceGraphAnalyzer.IsExtending(TES5BasicType.T_ACTOR, calledOn.TES5Type))
            //    {
            //        calledOnCastable.ManualCastTo = TES5BasicType.T_OBJECTREFERENCE;
            //    }
            //}
            //arguments.Add(calledOn);
            arguments.Add(this.valueFactory.CreateValue(functionArguments[0], codeScope, globalScope, multipleScriptsScope));
            ITES5Value argument1 = this.valueFactory.CreateValue(functionArguments[1], codeScope, globalScope, multipleScriptsScope);

            //WTM:  Change:  Why is the below necessary?

            /*if (argument1.TES5Type != TES5BasicType.T_TOPIC)
             * {
             *  TES5Reference? argument1Reference = argument1 as TES5Reference;
             *  if (argument1Reference != null && TES5InheritanceGraphAnalyzer.IsExtending(TES5BasicType.T_TOPIC, argument1.TES5Type))
             *  {
             *      argument1Reference.ManualCastTo = TES5BasicType.T_TOPIC;
             *  }
             * }*/
            arguments.Add(argument1);
            arguments.Add(new TES5Bool(true));

            //TES5LocalScope localScope = codeScope.LocalScope;
            //ITES5Referencer timerReference = this.referenceFactory.CreateTimerReadReference(globalScope, multipleScriptsScope, localScope);
            return(this.objectCallFactory.CreateObjectCall(calledOn, "LegacySayTo", arguments));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            //GetInCell checks if a cell name starts with the argument string:  https://cs.elderscrolls.com/index.php?title=GetInCell
            //The below will probably not always work.
            TES4FunctionArguments functionArguments    = function.Arguments;
            ITES4StringValue      apiToken             = functionArguments[0];
            string                  cellName           = apiToken.StringValue;
            TES5ObjectCall          getParentCell      = this.objectCallFactory.CreateObjectCall(calledOn, "GetParentCell", multipleScriptsScope);
            TES5ObjectCall          getParentCellName  = this.objectCallFactory.CreateObjectCall(getParentCell, "GetName", multipleScriptsScope);
            int                     length             = cellName.Length;
            TES5ObjectCallArguments substringArguments = new TES5ObjectCallArguments()
            {
                getParentCellName,
                new TES5Integer(0),
                new TES5Integer(length)
            };
            TES5ObjectCall   substring          = this.objectCallFactory.CreateObjectCall(TES5StaticReference.StringUtil, "Substring", multipleScriptsScope, substringArguments);
            TES4LoadedRecord cellRecord         = ESMAnalyzer._instance().FindInTES4Collection(cellName, false);
            string           cellNameWithSpaces = cellRecord.GetSubrecordTrim("FULL");

            if (cellNameWithSpaces == null)
            {
                cellNameWithSpaces = cellName;
            }
            TES5String cellNameTES5String = new TES5String(cellNameWithSpaces);

            return(TES5ExpressionFactory.CreateComparisonExpression(substring, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, cellNameTES5String));
        }
Exemplo n.º 3
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;
            int arg;

            switch (((TES4Integer)functionArguments[1]).IntValue)
            {
            case 0:
            {
                arg = 0;
                break;
            }

            case 1:
            {
                arg = 1000;
                break;
            }

            default:
            {
                throw new ConversionException("SetPCFactionMurder/SetPCFactionAttack argument unknown");
            }
            }

            TES5ObjectCallArguments constantArgument = new TES5ObjectCallArguments()
            {
                new TES5Integer(arg)
            };
            ITES5Referencer faction     = this.referenceFactory.CreateReadReference(functionArguments[0].StringValue, globalScope, multipleScriptsScope, localScope);
            TES5ObjectCall  newFunction = this.objectCallFactory.CreateObjectCall(faction, "SetCrimeGoldViolent", constantArgument);

            return(newFunction);
        }
Exemplo n.º 4
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            const string            functionName = "Disable";
            TES5ObjectCallArguments newArguments = new TES5ObjectCallArguments();

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, newArguments));
        }
Exemplo n.º 5
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments   functionArguments = function.Arguments;
            TES5ObjectCallArguments args;
            string functionName;

            if (functionArguments.Any())
            {
                args = this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope);
                ITES5Type arg0Type = analyzer.GetFormTypeByEDID(functionArguments[0].StringValue);
                if (arg0Type == TES5BasicType.T_ACTOR)
                {
                    functionName = "SetActorOwner";
                }
                else if (arg0Type == TES5BasicType.T_FACTION)
                {
                    functionName = "SetFactionOwner";
                }
                else
                {
                    throw new ConversionException("Unknown setOwnership() param");
                }
            }
            else
            {
                functionName = "SetActorOwner";
                args         = new TES5ObjectCallArguments()
                {
                    this.objectCallFactory.CreateGetActorBaseOfPlayer(multipleScriptsScope)
                };
            }

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, multipleScriptsScope, args));
        }
Exemplo n.º 6
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments   oldArguments = function.Arguments;
            TES5ObjectCallArguments newArguments = this.objectCallArgumentsFactory.CreateArgumentList(oldArguments, codeScope, globalScope, multipleScriptsScope);

            return(this.objectCallFactory.CreateObjectCall(calledOn, this.newFunctionName, newArguments));
        }
Exemplo n.º 7
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments functionArguments = function.Arguments;
            int    arg0 = (int)functionArguments.Pop(0).Data;
            string functionName;

            switch (arg0)
            {
            case 0:
            {
                functionName = "SheatheWeapon";
                break;
            }

            case 1:
            {
                functionName = "DrawWeapon";
                break;
            }

            default:
            {
                throw new ConversionException("Unknown setAlert value, must be 0 or 1");
            }
            }
            TES5ObjectCallArguments newArguments = this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope);

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, newArguments));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5PlayerReference     player    = TES5ReferenceFactory.CreateReferenceToPlayer(globalScope);
            TES5ObjectCallArguments arguments = objectCallArgumentsFactory.CreateArgumentList(function.Arguments, codeScope, globalScope, multipleScriptsScope);

            return(objectCallFactory.CreateObjectCall(player, "SetDisplayName", arguments));
        }
Exemplo n.º 9
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5StaticReference     newCalledOn = TES5StaticReferenceFactory.Game;
            TES5ObjectCallArguments arguments   = objectCallArgumentsFactory.CreateArgumentList(function.Arguments, codeScope, globalScope, multipleScriptsScope);

            return(this.objectCallFactory.CreateObjectCall(newCalledOn, "PlayBink", arguments));
        }
Exemplo n.º 10
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope          localScope        = codeScope.LocalScope;
            string                  functionName      = function.FunctionCall.FunctionName;
            TES4FunctionArguments   functionArguments = function.Arguments;
            TES5ObjectCallArguments newArgs           = new TES5ObjectCallArguments();
            string                  dataString        = functionArguments[0].StringValue;

            newArgs.Add(this.referenceFactory.CreateReference("Effect" + dataString, globalScope, multipleScriptsScope, localScope));

            /*switch (dataString)
             * {
             *
             *  case "INVI":
             *      {
             *          newArgs.add(this.referenceFactory.createReference("InvisibillityFFSelf", globalScope, multipleScriptsScope, localScope));
             *          break;
             *      }
             *
             *  case "REFA":
             *      {
             *          newArgs.add(this.referenceFactory.createReference("PerkRestoreStaminaFFSelf", globalScope, multipleScriptsScope, localScope));
             *          break;
             *      }
             *
             *  default:
             *      {
             *          newArgs.add(this.referenceFactory.createReference("Effect" + dataString, globalScope, multipleScriptsScope, localScope));
             *          break;
             *      }
             * }*/
            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, multipleScriptsScope, newArgs));
        }
        public TES5CodeChunkCollection CreateCodeChunk(TES4VariableAssignation chunk, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5CodeChunkCollection codeChunkCollection = new TES5CodeChunkCollection();
            string          referenceName = chunk.Reference.StringValue;
            ITES5Referencer reference     = this.referenceFactory.CreateReference(referenceName, globalScope, multipleScriptsScope, codeScope.LocalScope);
            ITES5Value      value         = this.valueFactory.CreateValue(chunk.Value, codeScope, globalScope, multipleScriptsScope);

            if (reference.TES5Type == TES5BasicType.T_GLOBALVARIABLE)
            { //if the reference is in reality a global variable, we will need to convert it by creating a Reference.SetValue(value); call
                //Object call creation
                TES5ObjectCallArguments objectCallArguments = new TES5ObjectCallArguments()
                {
                    value
                };
                TES5ObjectCall objectCall = this.objectCallFactory.CreateObjectCall(reference, "SetValue", objectCallArguments);
                codeChunkCollection.Add(objectCall);
            }
            else
            {
                if (reference.ReferencesTo == null)
                {
                    throw new NullableException(nameof(reference.ReferencesTo));
                }
                if (!reference.ReferencesTo.TES5Type.IsPrimitive && value.TES5Type.IsPrimitive)
                {
                    //Hacky!
                    TES5IntegerOrFloat?valueNumber = value as TES5IntegerOrFloat;
                    if (valueNumber != null && valueNumber.ConvertedIntValue == 0)
                    {
                        value = new TES5None();
                    }
                }

                TES5VariableAssignation assignation = TES5VariableAssignationFactory.CreateAssignation(reference, value);
                this.typeInferencer.InferenceObjectByAssignation(reference, value);
                codeChunkCollection.Add(assignation);
                //post analysis.
                //Todo - rethink the prefix here
                ITES5Referencer?referencerValue = value as ITES5Referencer;
                if (referencerValue != null && referencerValue.Name == TES5Property.AddPropertyNameSuffix(TES5ReferenceFactory.MESSAGEBOX_VARIABLE_CONST))
                {
                    /*
                     * Create block:
                     * variable = this.TES4_MESSAGEBOX_RESULT; ; assignation
                     * if(variable != -1) ; branch, expression
                     *   this.TES4_MESSAGEBOX_RESULT = -1; ; reassignation
                     * endIf
                     */
                    TES5Integer negativeOne                = new TES5Integer(-1);
                    TES5ComparisonExpression expression    = TES5ExpressionFactory.CreateComparisonExpression(reference, TES5ComparisonExpressionOperator.OPERATOR_NOT_EQUAL, negativeOne);
                    TES5VariableAssignation  reassignation = TES5VariableAssignationFactory.CreateAssignation(referencerValue, negativeOne);
                    TES5Branch branch = TES5BranchFactory.CreateSimpleBranch(expression, codeScope.LocalScope);
                    branch.MainBranch.CodeScope.AddChunk(reassignation);
                    codeChunkCollection.Add(branch);
                }
            }

            return(codeChunkCollection);
        }
Exemplo n.º 12
0
 public TES5ObjectCallCustom CreateObjectCallCustom(ITES5Referencer callable, string functionName, ITES5Type returnType, TES5ObjectCallArguments?arguments = null)
 {
     if (arguments == null)
     {
         arguments = new TES5ObjectCallArguments();
     }
     return(new TES5ObjectCallCustom(callable, functionName, returnType, arguments));
 }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            //WTM:  Note:  This always uses the player to send the tresspass alarm.  This might mean the player ultimately sends the trespass alarm for the player.
            //Oblivion doesn't seem to have a sender, only a trespasser.
            TES5ObjectCallArguments arguments = objectCallArgumentsFactory.CreateArgumentList(function.Arguments, codeScope, globalScope, multipleScriptsScope);

            return(objectCallFactory.CreateObjectCall(TES5ReferenceFactory.CreateReferenceToPlayer(globalScope), function.FunctionCall.FunctionName, arguments));
        }
Exemplo n.º 14
0
        public TES5ObjectCall CreateGotoState(string stateName, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5ObjectCallArguments arguments = new TES5ObjectCallArguments()
            {
                new TES5String(stateName)
            };

            return(CreateObjectCall(TES5ReferenceFactory.CreateReferenceToSelf(globalScope), "GotoState", multipleScriptsScope, arguments));
        }
Exemplo n.º 15
0
        public List <ITES5CodeChunk> GenerateObjectiveHandling(ITES5CodeBlock codeBlock, TES5GlobalScope globalScope, List <int> stageMap)
        {
            TES5LocalVariable     castedToQuest   = new TES5LocalVariable("__temp", TES5BasicType.T_QUEST);
            TES5Reference         referenceToTemp = TES5ReferenceFactory.CreateReferenceToVariable(castedToQuest);
            List <ITES5CodeChunk> result          = new List <ITES5CodeChunk>()
            {
                TES5VariableAssignationFactory.CreateAssignation(referenceToTemp, TES5ReferenceFactory.CreateReferenceToSelf(globalScope))
            };
            TES5LocalScope localScope = codeBlock.CodeScope.LocalScope;

            localScope.AddVariable(castedToQuest);
            int i = 0;

            foreach (var stageTargetState in stageMap)
            {
                TES5Integer targetIndex = new TES5Integer(i);
                if (stageTargetState != 0)
                {
                    //Should be visible
                    TES5ObjectCallArguments displayedArguments = new TES5ObjectCallArguments()
                    {
                        targetIndex
                    };
                    TES5ObjectCall           isObjectiveDisplayed = new TES5ObjectCall(referenceToTemp, "IsObjectiveDisplayed", displayedArguments);
                    TES5ComparisonExpression expression           = TES5ExpressionFactory.CreateComparisonExpression(isObjectiveDisplayed, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, new TES5Integer(0));
                    TES5ObjectCallArguments  arguments            = new TES5ObjectCallArguments()
                    {
                        targetIndex, new TES5Integer(1)
                    };
                    TES5ObjectCall showTheObjective = new TES5ObjectCall(referenceToTemp, "SetObjectiveDisplayed", arguments);
                    TES5Branch     branch           = TES5BranchFactory.CreateSimpleBranch(expression, localScope);
                    branch.MainBranch.CodeScope.AddChunk(showTheObjective);
                    result.Add(branch);
                }
                else
                {
                    TES5ObjectCallArguments displayedArguments = new TES5ObjectCallArguments()
                    {
                        targetIndex
                    };
                    TES5ObjectCall           isObjectiveDisplayed = new TES5ObjectCall(referenceToTemp, "IsObjectiveDisplayed", displayedArguments);
                    TES5ComparisonExpression expression           = TES5ExpressionFactory.CreateComparisonExpression(isObjectiveDisplayed, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, new TES5Integer(1));
                    TES5ObjectCallArguments  arguments            = new TES5ObjectCallArguments()
                    {
                        targetIndex, new TES5Integer(1)
                    };
                    TES5ObjectCall completeTheObjective = new TES5ObjectCall(referenceToTemp, "SetObjectiveCompleted", arguments);
                    TES5Branch     branch = TES5BranchFactory.CreateSimpleBranch(expression, localScope);
                    branch.MainBranch.CodeScope.AddChunk(completeTheObjective);
                    result.Add(branch);
                }

                ++i;
            }

            return(result);
        }
Exemplo n.º 16
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments   functionArguments = function.Arguments;
            TES5ObjectCallArguments callArguments     = new TES5ObjectCallArguments();
            TES5ObjectCall          dummyX            = this.objectCallFactory.CreateObjectCall(calledOn, "GetPositionX", multipleScriptsScope);
            TES5ObjectCall          dummyY            = this.objectCallFactory.CreateObjectCall(calledOn, "GetPositionY", multipleScriptsScope);
            TES5ObjectCall          dummyZ            = this.objectCallFactory.CreateObjectCall(calledOn, "GetPositionZ", multipleScriptsScope);

            ITES5Value[] argList;
            switch ((functionArguments[0].StringValue).ToLower())
            {
            case "x":
            {
                argList = new ITES5Value[]
                {
                    this.valueFactory.CreateValue(functionArguments[1], codeScope, globalScope, multipleScriptsScope),
                    dummyY,
                    dummyZ
                };
                break;
            }

            case "y":
            {
                argList = new ITES5Value[]
                {
                    dummyX,
                    this.valueFactory.CreateValue(functionArguments[1], codeScope, globalScope, multipleScriptsScope),
                    dummyZ
                };
                break;
            }

            case "z":
            {
                argList = new ITES5Value[]
                {
                    dummyX,
                    dummyY,
                    this.valueFactory.CreateValue(functionArguments[1], codeScope, globalScope, multipleScriptsScope)
                };
                break;
            }

            default:
            {
                throw new ConversionException("setPos can handle only X,Y,Z parameters.");
            }
            }

            foreach (var argListC in argList)
            {
                callArguments.Add(argListC);
            }

            return(this.objectCallFactory.CreateObjectCall(calledOn, "SetPosition", multipleScriptsScope, callArguments));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5ObjectCallArguments arguments = new TES5ObjectCallArguments()
            {
                new TES5String("Variable01")
            };

            return(this.objectCallFactory.CreateObjectCall(calledOn, "GetActorValue", multipleScriptsScope, arguments));
        }
Exemplo n.º 18
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments   functionArguments = function.Arguments;
            TES5LocalScope          localScope        = codeScope.LocalScope;
            ITES5Referencer         newCalledOn       = this.referenceFactory.CreateReadReference(functionArguments.Pop(0).StringValue, globalScope, multipleScriptsScope, localScope);
            const string            functionName      = "SetActive";
            TES5ObjectCallArguments newArguments      = this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope);

            return(this.objectCallFactory.CreateObjectCall(newCalledOn, functionName, newArguments));
        }
Exemplo n.º 19
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            const string            functionName       = "ForceMovementSpeed";
            TES5ObjectCallArguments convertedArguments = new TES5ObjectCallArguments()
            {
                new TES5Float(2)
            };

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, multipleScriptsScope, convertedArguments));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            const string            functionName    = "SetActorOwner";
            TES5ObjectCallArguments methodArguments = new TES5ObjectCallArguments()
            {
                new TES5None()
            };

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, methodArguments));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            int  willIgnore = ((TES4Integer)function.Arguments[0]).IntValue;
            bool ignore     = willIgnore != 0;
            TES5ObjectCallArguments arguments = new TES5ObjectCallArguments()
            {
                new TES5Bool(ignore)
            };

            return(objectCallFactory.CreateObjectCall(calledOn, "IgnoreFriendlyHits", arguments));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            int  flag       = ((TES4Integer)function.Arguments[0]).IntValue;
            bool restrained = flag != 0;
            TES5ObjectCallArguments arguments = new TES5ObjectCallArguments()
            {
                new TES5Bool(restrained)
            };

            return(objectCallFactory.CreateObjectCall(calledOn, "SetRestrained", arguments));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope           localScope           = codeScope.LocalScope;
            TES4FunctionArguments    functionArguments    = function.Arguments;
            ITES5Referencer          fameReference        = this.referenceFactory.CreateReadReference("Fame", globalScope, multipleScriptsScope, localScope);
            TES5ObjectCallArguments  fameArguments        = new TES5ObjectCallArguments();
            TES5ArithmeticExpression arithmeticExpression = TES5ExpressionFactory.CreateArithmeticExpression(fameReference, TES5ArithmeticExpressionOperator.OPERATOR_ADD, new TES5Integer(((TES4Integer)functionArguments[0]).IntValue));

            fameArguments.Add(arithmeticExpression);
            return(this.objectCallFactory.CreateObjectCall(this.referenceFactory.CreateReference("Fame", globalScope, multipleScriptsScope, localScope), "SetValue", multipleScriptsScope, fameArguments));
        }
Exemplo n.º 24
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments   functionArguments = function.Arguments;
            TES5ObjectCallArguments constantArgument  = new TES5ObjectCallArguments()
            {
                new TES5Bool(((TES4Integer)functionArguments[0]).IntValue == 1)
            };
            TES5ObjectCall newFunction = this.objectCallFactory.CreateObjectCall(calledOn, "SetOpen", multipleScriptsScope, constantArgument);

            return(newFunction);
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            const string            functionName    = "RandomInt";
            TES5ObjectCallArguments methodArguments = new TES5ObjectCallArguments()
            {
                new TES5Integer(0),
                new TES5Integer(99)
            };

            return(this.objectCallFactory.CreateObjectCall(TES5StaticReferenceFactory.Utility, functionName, methodArguments));
        }
Exemplo n.º 26
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            //Healing to full hp?
            const string            functionName       = "RestoreActorValue";
            TES5ObjectCallArguments convertedArguments = new TES5ObjectCallArguments()
            {
                new TES5String("Health"), new TES5Integer(9999)
            };

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, multipleScriptsScope, convertedArguments));
        }
Exemplo n.º 27
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope          localScope = codeScope.LocalScope;
            TES5ObjectCallArguments arguments  = new TES5ObjectCallArguments();
            ITES5Referencer         loc        = this.referenceFactory.CreateReadReference("SEWorldLocation", globalScope, multipleScriptsScope, localScope);

            arguments.Add(loc);
            TES5ObjectCall exp = this.objectCallFactory.CreateObjectCall(TES5ReferenceFactory.CreateReferenceToPlayer(), "IsInLocation", multipleScriptsScope, arguments);

            return(exp);
        }
        public TES5ObjectCallArguments CreateArgumentList(TES4FunctionArguments arguments, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5ObjectCallArguments list = new TES5ObjectCallArguments();

            if (arguments == null)
            {
                return(list);
            }
            list.AddRange(arguments.Select(a => this.valueFactory.CreateValue(a, codeScope, globalScope, multipleScriptsScope)));
            return(list);
        }
Exemplo n.º 29
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments   functionArguments = function.Arguments;
            ITES4StringValue        argument0         = functionArguments[0];
            TES5ObjectCallArguments functionArgs      = new TES5ObjectCallArguments()
            {
                this.valueFactory.CreateValue(argument0, codeScope, globalScope, multipleScriptsScope),
                new TES5Bool(true)
            };

            return(this.objectCallFactory.CreateObjectCall(calledOn, "SetAlpha", functionArgs));
        }
Exemplo n.º 30
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            string functionName = function.FunctionCall.FunctionName;
            TES4FunctionArguments functionArguments = function.Arguments;
            //Sometimes, its referenced as a string in code, so we force cast it to a reference.
            TES5ObjectCallArguments arguments = new TES5ObjectCallArguments()
            {
                this.referenceFactory.CreateReadReference(functionArguments[0].StringValue, globalScope, multipleScriptsScope, codeScope.LocalScope)
            };

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, arguments));
        }