/// <summary> /// The parse function set. /// </summary> /// <param name="retlist"> /// The retlist. /// </param> private void ParseFunctionSet(List <AOEvents> retlist) { int eventNum = this.br.ReadInt32(); int num = this.br.Read3F1(); List <AOFunctions> list = new List <AOFunctions>(); 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; } AOFunctions func = new AOFunctions(); func.FunctionType = this.br.ReadInt32(); this.br.Skip(8); int num5 = this.br.ReadInt32(); // Reqs bool flag = num5 > 0; if (flag) { foreach (AORequirements 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)) { func.Arguments.Values.Add(oo); } list.Add(func); num3++; } AOEvents aoe = new AOEvents(); aoe.EventType = eventNum; foreach (AOFunctions ff in list) { aoe.Functions.Add(ff); } retlist.Add(aoe); }
/// <summary> /// The parse shop hash. /// </summary> /// <param name="events"> /// The events. /// </param> private void ParseShopHash(List <AOEvents> events) { int eventNum = this.br.ReadInt32(); int num = this.br.Read3F1(); int arg_2D_0 = 1; int num2 = num; int num3 = arg_2D_0; AOEvents aoe = new AOEvents(); 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); AOFunctions aof = new AOFunctions(); 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 = Constants.FunctiontypeShophash; aoe.Functions.Add(aof); num3++; } } events.Add(aoe); }
public bool ExecuteEvent( Character ch, Character caller, AOEvents eve, bool dolocalstats, bool tosocialtab, int location, CheckReqs doreqs) { Character chartarget = (Character)FindDynel.FindDynelById(ch.Target.Type, ch.Target.Instance); Boolean reqs_met; if (ch != null) { foreach (AOFunctions aof in eve.Functions) { if (doreqs == CheckReqs.doCheckReqs) { reqs_met = this.CheckRequirements(ch, aof, true); } else if (doreqs == CheckReqs.doEquipCheckReqs) { reqs_met = this.CheckRequirements(ch, aof, false); ch.AddTimer(-9, DateTime.Now, aof, true); continue; } else { reqs_met = true; } if (reqs_met) { if (eve.EventType == Constants.EventtypeOnWear) { AOFunctions aofcopy = aof.ShallowCopy(); aofcopy.Arguments.Add(location); ch.AddTimer(-9, DateTime.Now, aofcopy, dolocalstats); } else { ch.AddTimer(-9, DateTime.Now, aof, dolocalstats); } } } } return true; }
public Item(int ID) { ItemAttributes = new List<AOItemAttribute>(); ItemEvents = new List<AOEvents>(); SqlWrapper ms = new SqlWrapper(); DataTable dt = ms.ReadDT("SELECT * FROM items WHERE AOID='" + ID.ToString() + "'"); if (dt.Rows.Count > 0) { AOID = (Int32)dt.Rows[0]["AOID"]; isnano = (Int32)dt.Rows[0]["IsNano"]; QL = (Int32)dt.Rows[0]["QL"]; itemtype = (Int32)dt.Rows[0]["ItemType"]; byte[] blob = (byte[])dt.Rows[0]["EFR"]; int blobc = 0; // Read Attack Stat/Values int cc = BitConverter.ToInt32(blob, blobc); AOItemAttribute mm_a; blobc += 4; while (cc > 0) { mm_a = new AOItemAttribute(); mm_a.Stat = BitConverter.ToInt32(blob, blobc); blobc += 4; mm_a.Value = BitConverter.ToInt32(blob, blobc); blobc += 4; attack.Add(mm_a); cc--; } // Read Defend Stat/Values cc = BitConverter.ToInt32(blob, blobc); blobc += 4; while (cc > 0) { mm_a = new AOItemAttribute(); mm_a.Stat = BitConverter.ToInt32(blob, blobc); blobc += 4; mm_a.Value = BitConverter.ToInt32(blob, blobc); blobc += 4; defend.Add(mm_a); cc--; } // Read Item Attributes int c = BitConverter.ToInt32(blob, blobc); blobc += 4; AOItemAttribute tempa; while (c > 0) { tempa = new AOItemAttribute(); tempa.Stat = BitConverter.ToInt32(blob, blobc); blobc += 4; tempa.Value = BitConverter.ToInt32(blob, blobc); blobc += 4; ItemAttributes.Add(tempa); c--; } // Read Item Events AOEvents tempe; c = BitConverter.ToInt32(blob, blobc); blobc += 4; while (c > 0) { tempe = new AOEvents(); blobc = tempe.readEventfromBlob(ref blob, blobc); ItemEvents.Add(tempe); c--; } /* // Read Item Actions AOActions tempac; c = BitConverter.ToInt32(blob, blobc); blobc += 4; while (c > 0) { tempac = new AOActions(); blobc = tempac.readActionfromBlob(ref blob, blobc); c--; } */ } else { // Setting QL to -1 as "invalid item" flag QL = -1; } }