Esempio n. 1
0
        /// <summary>
        /// The parse reqs.
        /// </summary>
        /// <param name="rreqs">
        /// The rreqs.
        /// </param>
        /// <returns>
        /// The <see cref="List"/>.
        /// </returns>
        public List <AORequirements> ParseReqs(List <rawreqs> rreqs)
        {
            int numreqs = rreqs.Count;

            List <AORequirements> output = new List <AORequirements>();

            for (int i = 0; i < numreqs; i++)
            {
                rawreqs        rr  = rreqs[i];
                AORequirements aor = new AORequirements();

                aor.Target        = 0x13;
                aor.Statnumber    = rr.stat;
                aor.Operator      = rr.ops;
                aor.Value         = rr.val;
                aor.ChildOperator = 255;

                if ((i < numreqs - 1) &&
                    ((aor.Operator == 0x12) || (aor.Operator == 0x13) || (aor.Operator == 0x1a) ||
                     (aor.Operator == 0x1b) || (aor.Operator == 0x1c) || (aor.Operator == 0x1d) ||
                     (aor.Operator == 0x1e) || (aor.Operator == 0x25) || (aor.Operator == 0x64) ||
                     (aor.Operator == 110)))
                {
                    aor.Target = aor.Operator;
                    i++;
                    rr             = rreqs[i];
                    aor.Statnumber = rr.stat;
                    aor.Value      = rr.val;
                    aor.Operator   = rr.ops;
                }

                if (!((i >= numreqs - 1) || (numreqs == 2)))
                {
                    int anum = rreqs[i + 1].stat;
                    int aval = rreqs[i + 1].val;
                    int aop  = rreqs[i + 1].ops;

                    if ((((aop == 3) || (aop == 4)) || (aop == 0x2a)) && (anum == 0))
                    {
                        aor.ChildOperator = aop;
                        i++;
                    }
                }

                output.Add(aor);
            }

            for (int i = 0; i < output.Count - 2; i++)
            {
                output[i].ChildOperator = output[i + 1].ChildOperator;
            }

            return(output);
        }
Esempio n. 2
0
        public int ReadFunctionfromBlob(ref byte[] blob, int offset)
        {
            int c = offset;
            FunctionType = BitConverter.ToInt32(blob, c);
            c += 4;
            Target = BitConverter.ToInt32(blob, c);
            c += 4;
            TickCount = BitConverter.ToInt32(blob, c);
            c += 4;
            TickInterval = BitConverter.ToUInt32(blob, c);
            c += 4;

            // Function Arguments
            int c2 = BitConverter.ToInt32(blob, c);
            int c4;
            string temps;
            byte tb;
            Single tempf;
            c += 4;
            while (c2 > 0)
            {
                tb = blob[c++];
                switch (tb)
                {
                    case 0x53:
                        temps = "";
                        c4 = BitConverter.ToInt32(blob, c);
                        c += 4;
                        while (c4 > 0)
                        {
                            temps += (char)blob[c++];
                            c4--;
                        }
                        Arguments.Add(new object());
                        Arguments[Arguments.Count - 1] = temps;
                        break;
                    case 0x49:
                        Arguments.Add(new object());
                        Arguments[Arguments.Count - 1] = BitConverter.ToInt32(blob, c);
                        c += 4;
                        break;
                    case 0x73:
                        tempf = BitConverter.ToSingle(blob, c);
                        Arguments.Add(new object());
                        Arguments[Arguments.Count - 1] = tempf;
                        c += 4;
                        break;
                }
                c2--;
            }
            c2 = BitConverter.ToInt32(blob, c);
            c += 4;
            AORequirements m_a;
            while (c2 > 0)
            {
                m_a = new AORequirements();
                c = m_a.readRequirementfromBlob(ref blob, c);
                Requirements.Add(m_a);
                c2--;
            }
            return c;
        }