/// <summary> /// </summary> /// <param name="rreqs"> /// </param> /// <returns> /// </returns> public List <Requirement> ParseReqs(List <rawreqs> rreqs) { int numreqs = rreqs.Count; List <Requirement> output = new List <Requirement>(); for (int i = 0; i < numreqs; i++) { rawreqs rr = rreqs[i]; Requirement aor = new Requirement(); aor.Target = ItemTarget.Self; aor.Statnumber = rr.stat; aor.Operator = (Operator)Enum.ToObject(typeof(Operator), rr.ops); aor.Value = rr.val; aor.ChildOperator = Operator.Unknown; if ((i < numreqs - 1) && ((aor.Operator == Operator.OnTarget) || (aor.Operator == Operator.OnSelf) || (aor.Operator == Operator.OnUser) || (aor.Operator == Operator.OnValidTarget) || (aor.Operator == Operator.OnInvalidUser) || (aor.Operator == Operator.OnValidUser) || (aor.Operator == Operator.OnInvalidUser) || (aor.Operator == Operator.OnGeneralBeholder) || (aor.Operator == Operator.OnCaster) || (aor.Operator == Operator.Unknown3))) { aor.Target = (ItemTarget)Enum.ToObject(typeof(ItemTarget), aor.Operator); i++; rr = rreqs[i]; aor.Statnumber = rr.stat; aor.Value = rr.val; aor.Operator = (Operator)Enum.ToObject(typeof(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 = (Operator)Enum.ToObject(typeof(Operator), aop); i++; } } output.Add(aor); } for (int i = 0; i < output.Count - 2; i++) { output[i].ChildOperator = output[i + 1].ChildOperator; } return(output); }
/// <summary> /// </summary> /// <param name="rreqs"> /// </param> /// <returns> /// </returns> public List <Requirements> ParseReqs(List <rawreqs> rreqs) { int numreqs = rreqs.Count; List <Requirements> output = new List <Requirements>(); for (int i = 0; i < numreqs; i++) { rawreqs rr = rreqs[i]; Requirements aor = new Requirements(); 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); }
/// <summary> /// </summary> /// <param name="stream"> /// </param> public void ReadFromStream(Stream stream) { BinaryReader br = new BinaryReader(stream); this.FunctionType = IPAddress.NetworkToHostOrder(br.ReadInt32()); // Skip 8 br.ReadInt64(); int reqCount = IPAddress.NetworkToHostOrder(br.ReadInt32()); List <rawreqs> raws = new List <rawreqs>(); while (reqCount > 0) { int stat = IPAddress.NetworkToHostOrder(br.ReadInt32()); int val = IPAddress.NetworkToHostOrder(br.ReadInt32()); int ops = IPAddress.NetworkToHostOrder(br.ReadInt32()); rawreqs r = new rawreqs(); r.ops = ops; r.stat = stat; r.val = val; raws.Add(r); reqCount--; } foreach (Requirement req in this.ParseReqs(raws)) { this.Requirements.Add(req); } this.TickCount = IPAddress.NetworkToHostOrder(br.ReadInt32()); this.TickInterval = (uint)IPAddress.NetworkToHostOrder(br.ReadInt32()); this.Target = IPAddress.NetworkToHostOrder(br.ReadInt32()); br.ReadInt32(); bool bool1 = false; foreach (object oo in this.ParseArgs(this.FunctionType, ref bool1, br)) { MessagePackObject x = MessagePackObject.FromObject(oo); this.Arguments.Values.Add(x); } }
/// <summary> /// </summary> /// <param name="stream"> /// </param> public void ReadFromStream(Stream stream) { BinaryReader br = new BinaryReader(stream); this.FunctionType = IPAddress.NetworkToHostOrder(br.ReadInt32()); // Skip 8 br.ReadInt64(); int reqCount = IPAddress.NetworkToHostOrder(br.ReadInt32()); List<rawreqs> raws = new List<rawreqs>(); while (reqCount > 0) { int stat = IPAddress.NetworkToHostOrder(br.ReadInt32()); int val = IPAddress.NetworkToHostOrder(br.ReadInt32()); int ops = IPAddress.NetworkToHostOrder(br.ReadInt32()); rawreqs r = new rawreqs(); r.ops = ops; r.stat = stat; r.val = val; raws.Add(r); reqCount--; } foreach (Requirements req in this.ParseReqs(raws)) { this.Requirements.Add(req); } this.TickCount = IPAddress.NetworkToHostOrder(br.ReadInt32()); this.TickInterval = (uint)IPAddress.NetworkToHostOrder(br.ReadInt32()); this.Target = IPAddress.NetworkToHostOrder(br.ReadInt32()); br.ReadInt32(); bool bool1 = false; foreach (object oo in this.ParseArgs(this.FunctionType, ref bool1, br)) { MessagePackObject x = MessagePackObject.FromObject(oo); this.Arguments.Values.Add(x); } }