Пример #1
0
        /// <summary>
        /// Copy Function
        /// </summary>
        /// <returns>new copy</returns>
        public IFunctions ShallowCopy()
        {
            IFunctions newAOF = new Functions();
            foreach (Requirements aor in this.Requirements)
            {
                Requirements newAOR = new Requirements();
                newAOR.ChildOperator = aor.ChildOperator;
                newAOR.Operator = aor.Operator;
                newAOR.Statnumber = aor.Statnumber;
                newAOR.Target = aor.Target;
                newAOR.Value = aor.Value;
                newAOF.Requirements.Add(newAOR);
            }

            foreach (object ob in this.Arguments.Values)
            {
                if (ob.GetType() == typeof(string))
                {
                    string z = (string)ob;
                    newAOF.Arguments.Values.Add(z);
                }

                if (ob.GetType() == typeof(int))
                {
                    int i = (int)ob;
                    newAOF.Arguments.Values.Add(i);
                }

                if (ob.GetType() == typeof(Single))
                {
                    float s = (Single)ob;
                    newAOF.Arguments.Values.Add(s);
                }
            }

            newAOF.dolocalstats = this.dolocalstats;
            newAOF.FunctionType = this.FunctionType;
            newAOF.Target = this.Target;
            newAOF.TickCount = this.TickCount;
            newAOF.TickInterval = this.TickInterval;

            return newAOF;
        }
Пример #2
0
        /// <summary>
        /// </summary>
        /// <returns>
        /// </returns>
        internal Functions Copy()
        {
            Functions copy = new Functions();

            foreach (Requirements requirements in this.Requirements)
            {
                copy.Requirements.Add(requirements.Copy());
            }

            foreach (MessagePackObject ob in this.Arguments.Values)
            {
                if (ob.IsTypeOf(typeof(string)) == true)
                {
                    MessagePackObject z = new MessagePackObject();
                    z = ob.ToString();
                    copy.Arguments.Values.Add(z);
                }

                if (ob.IsTypeOf(typeof(int)) == true)
                {
                    MessagePackObject i = new MessagePackObject();
                    i = ob.AsInt32();
                    copy.Arguments.Values.Add(i);
                }

                if (ob.IsTypeOf(typeof(Single)) == true)
                {
                    MessagePackObject s = new MessagePackObject();
                    s = ob.AsSingle();
                    copy.Arguments.Values.Add(s);
                }
            }

            copy.dolocalstats = this.dolocalstats;
            copy.FunctionType = this.FunctionType;
            copy.Target = this.Target;
            copy.TickCount = this.TickCount;
            copy.TickInterval = this.TickInterval;

            return copy;
        }
Пример #3
0
        /// <summary>
        /// </summary>
        /// Methods to do:
        /// Read Item
        /// Write Item
        /// Return Dynel Item (placing on the ground)
        /// <returns>
        /// </returns>
        public NanoFormula ShallowCopy()
        {
            NanoFormula nanoFormula = new NanoFormula();
            nanoFormula.ID = this.ID;

            foreach (KeyValuePair<int, int> nanoFormulaAttribute in this.Attack)
            {
                nanoFormula.Attack.Add(nanoFormulaAttribute.Key, nanoFormulaAttribute.Value);
            }

            foreach (KeyValuePair<int, int> nanoFormulaAttribute in this.Defend)
            {
                nanoFormula.Defend.Add(nanoFormulaAttribute.Key, nanoFormulaAttribute.Value);
            }

            foreach (KeyValuePair<int, int> nanoFormulaAttribute in this.Stats)
            {
                nanoFormula.Stats.Add(nanoFormulaAttribute.Key, nanoFormulaAttribute.Value);
            }

            foreach (Events aoEvents in this.Events)
            {
                Events newEvent = new Events();
                foreach (Functions aoFunctions in aoEvents.Functions)
                {
                    Functions newAOFunctions = new Functions();
                    foreach (Requirements aor in aoFunctions.Requirements)
                    {
                        Requirements newRequirement = new Requirements();
                        newRequirement.ChildOperator = aor.ChildOperator;
                        newRequirement.Operator = aor.Operator;
                        newRequirement.Statnumber = aor.Statnumber;
                        newRequirement.Target = aor.Target;
                        newRequirement.Value = aor.Value;
                        newAOFunctions.Requirements.Add(newRequirement);
                    }

                    foreach (object argument in aoFunctions.Arguments.Values)
                    {
                        if (argument.GetType() == typeof(string))
                        {
                            string z = (string)argument;
                            newAOFunctions.Arguments.Values.Add(z);
                        }

                        if (argument.GetType() == typeof(int))
                        {
                            int i = (int)argument;
                            newAOFunctions.Arguments.Values.Add(i);
                        }

                        if (argument.GetType() == typeof(Single))
                        {
                            float s = (Single)argument;
                            newAOFunctions.Arguments.Values.Add(s);
                        }
                    }

                    newAOFunctions.dolocalstats = aoFunctions.dolocalstats;
                    newAOFunctions.FunctionType = aoFunctions.FunctionType;
                    newAOFunctions.Target = aoFunctions.Target;
                    newAOFunctions.TickCount = aoFunctions.TickCount;
                    newAOFunctions.TickInterval = aoFunctions.TickInterval;
                    newEvent.Functions.Add(newAOFunctions);
                }

                newEvent.EventType = aoEvents.EventType;
                nanoFormula.Events.Add(newEvent);
            }

            nanoFormula.flags = this.flags;
            nanoFormula.Instance = this.Instance;
            nanoFormula.ItemType = this.ItemType;

            return nanoFormula;
        }
Пример #4
0
 /// <summary>
 /// </summary>
 /// <returns>
 /// </returns>
 internal Functions ToFunctions()
 {
     Functions f = new Functions();
     f.FunctionType = this.FunctionType;
     f.Target = this.Target;
     f.TickCount = this.TickCount;
     f.TickInterval = this.TickInterval;
     f.Arguments = this.Arguments;
     f.Requirements = this.Requirements;
     return f;
 }
Пример #5
0
        /// <summary>
        /// The parse shop hash.
        /// </summary>
        /// <param name="events">
        /// The events.
        /// </param>
        private void ParseShopHash(List<Events> events)
        {
            int eventNum = this.br.ReadInt32();
            int num = this.br.Read3F1();
            int arg_2D_0 = 1;
            int num2 = num;
            int num3 = arg_2D_0;
            Events aoe = new Events();
            aoe.EventType = eventNum;
            checked
            {
                while (true)
                {
                    int arg_151_0 = num3;
                    int num4 = num2;
                    if (arg_151_0 > num4)
                    {
                        break;
                    }

                    string text = this.br.ReadString(4);
                    int num5 = this.br.ReadByte();
                    int num6 = this.br.ReadByte();
                    bool flag = num5 == 0 && num6 == 0;
                    if (flag)
                    {
                        num5 = this.br.ReadInt16();
                        num6 = this.br.ReadInt16();
                    }

                    int count = Math.Min(11, this.br.Buffer.Length - this.br.Ptr);
                    this.br.Skip(count);

                    Functions aof = new Functions();
                    aof.Arguments.Values.Add(text);
                    aof.Arguments.Values.Add(num5);
                    aof.Arguments.Values.Add(num6);
                    aof.Target = 255;
                    aof.TickCount = 1;
                    aof.TickInterval = 0;
                    aof.FunctionType = (int)FunctionType.Shophash;
                    aoe.Functions.Add(aof);

                    num3++;
                }
            }

            if (events == null)
            {
                events = new List<Events>();
            }

            events.Add(aoe);
        }
Пример #6
0
        /// <summary>
        /// The parse function set.
        /// </summary>
        /// <param name="retlist">
        /// The retlist.
        /// </param>
        private void ParseFunctionSet(List<Events> retlist)
        {
            int eventNum = this.br.ReadInt32();
            int num = this.br.Read3F1();
            List<Functions> list = new List<Functions>();
            int arg_2F_0 = 0;
            bool R;
            int num2 = num - 1;
            int num3 = arg_2F_0;
            while (true)
            {
                int arg_1C3_0 = num3;
                int num4 = num2;
                if (arg_1C3_0 > num4)
                {
                    break;
                }

                Functions func = new Functions();

                func.FunctionType = this.br.ReadInt32();
                this.br.Skip(8);
                int num5 = this.br.ReadInt32(); // Reqs
                bool flag = num5 > 0;
                if (flag)
                {
                    foreach (Requirements ur in this.ReadReqs(num5))
                    {
                        func.Requirements.Add(ur);
                    }
                }

                func.TickCount = this.br.ReadInt32();
                func.TickInterval = (uint)this.br.ReadInt32();
                func.Target = this.br.ReadInt32();

                this.br.Skip(4);
                R = false;
                foreach (object oo in this.ParseArgs(func.FunctionType, ref R))
                {
                    MessagePackObject x = MessagePackObject.FromObject(oo);
                    func.Arguments.Values.Add(x);
                }

                list.Add(func);
                num3++;
            }

            Events aoe = new Events();
            aoe.EventType = eventNum;
            foreach (Functions ff in list)
            {
                aoe.Functions.Add(ff);
            }

            if (retlist == null)
            {
                retlist = new List<Events>();
            }

            retlist.Add(aoe);
        }
 /// <summary>
 /// </summary>
 /// <param name="function">
 /// </param>
 /// <param name="user">
 /// </param>
 public IMExecuteFunction(Functions function, Identity user)
 {
     this.User = user;
     this.Function = function;
 }