Пример #1
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments functionArguments = function.Arguments;
            TES5ObjectCall        functionThis      = this.objectCallFactory.CreateObjectCall(this.objectCallFactory.CreateGetActorBase(calledOn, multipleScriptsScope), "GetSex", multipleScriptsScope);
            int operand;

            switch ((functionArguments[0].StringValue).ToLower())
            {
            case "male":
            {
                operand = 0;
                break;
            }

            case "female":
            {
                operand = 1;
                break;
            }

            default:
            {
                throw new ConversionException("GetIsSex used with unknown gender.");
            }
            }

            TES5ComparisonExpression expression = TES5ExpressionFactory.CreateComparisonExpression(functionThis, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, new TES5Integer(operand));

            return(expression);
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;
            string          dataString      = functionArguments[0].StringValue;
            ITES5Referencer targetReference = this.referenceFactory.CreateReadReference(dataString, globalScope, multipleScriptsScope, localScope);
            ITES5Type       dataType        = this.analyzer.GetFormTypeByEDID(dataString);
            TES5ObjectCall  owner;
            ITES5Referencer baseReference;

            if (dataType == TES5BasicType.T_FACTION)
            {
                owner         = this.objectCallFactory.CreateObjectCall(calledOn, "GetFactionOwner", multipleScriptsScope);
                baseReference = targetReference;
            }
            else
            {
                owner         = this.objectCallFactory.CreateObjectCall(calledOn, "GetActorOwner", multipleScriptsScope);
                baseReference = this.objectCallFactory.CreateGetActorBase(targetReference, multipleScriptsScope);
            }

            TES5ComparisonExpression expression = TES5ExpressionFactory.CreateComparisonExpression(owner, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, baseReference);

            return(expression);
        }
        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));
        }
Пример #4
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;
            string          arg0String      = functionArguments[0].StringValue;
            ITES5Referencer targetReference = this.referenceFactory.CreateReadReference(arg0String, globalScope, multipleScriptsScope, localScope);
            var             arg0Type        = targetReference.TES5Type;
            string          functionName;
            ITES5Referencer baseReference;

            if (TES5InheritanceGraphAnalyzer.IsTypeOrExtendsType(arg0Type, TES5BasicType.T_ACTORBASE))
            {
                functionName  = "GetActorOwner";
                baseReference = targetReference;
            }
            else if (TES5InheritanceGraphAnalyzer.IsTypeOrExtendsType(arg0Type, TES5BasicType.T_ACTOR))
            {
                functionName  = "GetActorOwner";
                baseReference = this.objectCallFactory.CreateGetActorBase(targetReference);
            }
            else if (TES5InheritanceGraphAnalyzer.IsTypeOrExtendsType(arg0Type, TES5BasicType.T_FACTION))
            {
                functionName  = "GetFactionOwner";
                baseReference = targetReference;
            }
            else
            {
                throw new ConversionException(function.FunctionCall.FunctionName + " should be called with either an ActorBase or a Faction.");
            }
            TES5ObjectCall           owner      = this.objectCallFactory.CreateObjectCall(calledOn, functionName);
            TES5ComparisonExpression expression = TES5ExpressionFactory.CreateComparisonExpression(owner, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, baseReference);

            return(expression);
        }
Пример #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));
        }
Пример #6
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            string functionName = function.FunctionCall.FunctionName;
            TES4FunctionArguments functionArguments = function.Arguments;

            return(this.objectCallFactory.CreateObjectCall(TES5StaticReference.Game, functionName, multipleScriptsScope, this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
        }
Пример #7
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));
        }
Пример #8
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);
        }
Пример #9
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)
        {
            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));
        }
Пример #11
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));
        }
Пример #12
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;

            //todo Refactor - add floating point vars .
            if (functionArguments.Count == 1)
            {
                TES5StaticReference calledOnRef = TES5StaticReferenceFactory.Debug;
                return(this.objectCallFactory.CreateObjectCall(calledOnRef, "MessageBox", this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
            }
            else
            {
                string[]             stringArguments  = functionArguments.Select(v => v.StringValue).ToArray();
                string               edid             = messageBoxData.GetEDID(stringArguments);
                IEnumerable <string> messageArguments = (new string[] { edid }).Concat(functionArguments.Select(a => a.StringValue));
                this.metadataLogService.WriteLine("ADD_MESSAGE", messageArguments);
                Nullable <int> tes5FormIDNullable = messageBoxData.GetTES5FormID(edid);
                TES5Property   messageBoxProperty = TES5PropertyFactory.ConstructWithTES5FormID(edid, TES5BasicType.T_MESSAGE, edid, tes5FormIDNullable);
                globalScope.AddProperty(messageBoxProperty);
                ITES5Referencer messageBoxReference = TES5ReferenceFactory.CreateReferenceToVariableOrProperty(messageBoxProperty);
                TES5ObjectCall  messageBoxShow      = this.objectCallFactory.CreateObjectCall(messageBoxReference, "Show");
                ITES5Referencer messageBoxResult    = this.referenceFactory.CreateReadReference(TES5ReferenceFactory.MESSAGEBOX_VARIABLE_CONST, globalScope, multipleScriptsScope, localScope);
                return(TES5VariableAssignationFactory.CreateAssignation(messageBoxResult, messageBoxShow));
            }
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;
            ITES5Referencer       newCalledOn       = this.referenceFactory.CreateReadReference(functionArguments.Pop(0).StringValue, globalScope, multipleScriptsScope, localScope);

            return(this.objectCallFactory.CreateObjectCall(newCalledOn, this.newFunctionName, multipleScriptsScope, this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
        }
Пример #14
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.CreateCyrodiilCrimeFactionReadReference(globalScope, multipleScriptsScope, localScope);

            return(this.objectCallFactory.CreateObjectCall(newCalledOn, "SetCrimeGold", multipleScriptsScope, this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            const string            functionName      = "Disable";
            TES4FunctionArguments   functionArguments = function.Arguments;
            TES5ObjectCallArguments newArguments      = new TES5ObjectCallArguments();

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, multipleScriptsScope, newArguments));
        }
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            string functionName = function.FunctionCall.FunctionName;
            TES4FunctionArguments functionArguments = function.Arguments;

            //@INCONSISTENCE @TODO: Entering an interior Cell and then exiting to an exterior will reset Fast Travel to the enabled state.
            return(this.objectCallFactory.CreateObjectCall(TES5StaticReferenceFactory.Game, functionName, this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
        }
Пример #17
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));
        }
Пример #18
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES4FunctionArguments functionArguments = function.Arguments;

            calledOn = TES5ReferenceFactory.CreateReferenceToSelf(globalScope);
            const string functionName = "Delete";

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
        }
Пример #19
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope           localScope        = codeScope.LocalScope;
            TES4FunctionArguments    functionArguments = function.Arguments;
            ITES5Referencer          argument          = this.referenceFactory.CreateReadReference(functionArguments[0].StringValue, globalScope, multipleScriptsScope, localScope);
            TES5ComparisonExpression expression        = TES5ExpressionFactory.CreateComparisonExpression(calledOn, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, argument);

            return(expression);
        }
Пример #20
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;
            //This will sum the bounties from all the factions.
            ITES5Referencer newCalledOn = this.referenceFactory.CreateCyrodiilCrimeFactionReadReference(globalScope, multipleScriptsScope, localScope);

            return(this.objectCallFactory.CreateObjectCall(newCalledOn, functionName, multipleScriptsScope, this.objectCallArgumentsFactory.CreateArgumentList(functionArguments, codeScope, globalScope, multipleScriptsScope)));
        }
Пример #21
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;
            //Made in post-analysis
            TES5ObjectCall           race         = this.objectCallFactory.CreateObjectCall(TES5ReferenceFactory.CreateReferenceToPlayer(globalScope), "GetRace");
            ITES5Referencer          checkAgainst = this.referenceFactory.CreateReadReference(functionArguments[0].StringValue, globalScope, multipleScriptsScope, localScope);
            TES5ComparisonExpression expression   = TES5ExpressionFactory.CreateComparisonExpression(race, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, checkAgainst);

            return(expression);
        }
        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));
        }
Пример #23
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope           localScope                 = codeScope.LocalScope;
            TES4FunctionArguments    functionArguments          = function.Arguments;
            ITES5Referencer          functionArgument0Reference = this.referenceFactory.CreateReadReference(functionArguments[0].StringValue, globalScope, multipleScriptsScope, localScope);
            TES5ObjectCall           leftParentCell             = this.objectCallFactory.CreateObjectCall(calledOn, "GetParentCell");
            TES5ObjectCall           rightParentCell            = this.objectCallFactory.CreateObjectCall(functionArgument0Reference, "GetParentCell");
            TES5ComparisonExpression expression                 = TES5ExpressionFactory.CreateComparisonExpression(leftParentCell, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, rightParentCell);

            return(expression);
        }
Пример #24
0
        public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
        {
            TES5LocalScope        localScope        = codeScope.LocalScope;
            TES4FunctionArguments functionArguments = function.Arguments;
            //Made in post-analysis
            TES5ObjectCall           functionThis = this.objectCallFactory.CreateObjectCall(TES5StaticReferenceFactory.Weather, "GetCurrentWeather");
            ITES5Referencer          argument     = this.referenceFactory.CreateReadReference(functionArguments[0].StringValue, globalScope, multipleScriptsScope, localScope);
            TES5ComparisonExpression expression   = TES5ExpressionFactory.CreateComparisonExpression(functionThis, TES5ComparisonExpressionOperator.OPERATOR_EQUAL, argument);

            return(expression);
        }
        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);
        }
Пример #26
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);
        }
Пример #27
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));
        }
Пример #28
0
 public ITES5ValueCodeChunk ConvertFunction(ITES5Referencer calledOn, TES4Function function, TES5CodeScope codeScope, TES5GlobalScope globalScope, TES5MultipleScriptsScope multipleScriptsScope)
 {
     TES5LocalScope localScope = codeScope.LocalScope;
     TES4FunctionArguments functionArguments = function.Arguments;
     ITES5Referencer newCalledOn = this.referenceFactory.CreateReadReference(functionArguments[0].StringValue, globalScope, multipleScriptsScope, localScope);
     const string functionName = "play";
     TES5ObjectCallArguments args = new TES5ObjectCallArguments
     {
         calledOn//this.referenceFactory.createReferenceToSelf(globalScope)//WTM:  Change
     };
     return this.objectCallFactory.CreateObjectCall(newCalledOn, functionName, multipleScriptsScope, args);
 }
Пример #29
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 arguments         = new TES5ObjectCallArguments()
            {
                this.referenceFactory.CreateReadReference(functionArguments[0].StringValue, globalScope, multipleScriptsScope, localScope)
            };

            return(this.objectCallFactory.CreateObjectCall(calledOn, functionName, arguments));
        }
Пример #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));
        }