/// <summary> /// </summary> /// <returns> /// </returns> internal Events ToEvents() { Events ev = new Events(); ev.EventType = this.EventType; foreach (HLFlatFunction flf in this.Functions) { ev.Functions.Add(flf.ToFunctions()); } return ev; }
/// <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; }
/// <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); }
/// <summary> /// </summary> /// <returns> /// </returns> public Events Copy() { Events copy = new Events(); copy.EventType = this.EventType; foreach (Functions functions in this.Functions) { copy.Functions.Add(functions.Copy()); } return copy; }
/// <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); }