/// <summary> /// </summary> /// <returns> /// </returns> internal Event ToEvents() { Event ev = new Event(); ev.EventType = (EventType) Enum.ToObject(typeof(EventType), this.EventType); foreach (HLFlatFunction flf in this.Functions) { ev.Functions.Add(flf.ToFunctions()); } return ev; }
/// <summary> /// </summary> /// <returns> /// </returns> public Event Copy() { Event copy = new Event(); copy.EventType = this.EventType; foreach (Function functions in this.Functions) { copy.Functions.Add(functions.Copy()); } return copy; }
/// <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 (Event aoEvents in this.Events) { Event newEvent = new Event(); foreach (Function aoFunctions in aoEvents.Functions) { Function newAOFunctions = new Function(); foreach (Requirement aor in aoFunctions.Requirements) { Requirement newRequirement = new Requirement(); 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; }