/// <summary> /// </summary> /// <param name="QL"> /// </param> /// <param name="lowID"> /// </param> /// <param name="highID"> /// </param> /// <exception cref="ArgumentOutOfRangeException"> /// </exception> public Item(int QL, int lowID, int highID) { // Checks: if ((!ItemLoader.ItemList.ContainsKey(lowID)) || (!ItemLoader.ItemList.ContainsKey(highID))) { throw new ArgumentOutOfRangeException("No Item found with ID " + lowID); } this.templateLow = ItemLoader.ItemList[lowID]; this.templateHigh = ItemLoader.ItemList[highID]; this.Quality = QL < this.templateLow.Quality ? this.templateLow.Quality : (QL > this.templateHigh.Quality ? this.templateHigh.Quality : QL); this.Identity = new Identity(); }
/// <summary> /// The parse anim sound set. /// </summary> /// <param name="typeN"> /// The type n. /// </param> /// <param name="ITEM"> /// The item. /// </param> public void ParseAnimSoundSet(int typeN, ItemTemplate ITEM) { int num = this.br.ReadInt32(); int num2 = this.br.Read3F1(); int arg_27_0 = 1; int num3 = num2; int num4 = arg_27_0; checked { while (true) { int arg_13B_0 = num4; int num5 = num3; if (arg_13B_0 > num5) { break; } List<int> list = new List<int>(); int actionNum = this.br.ReadInt32(); int num6 = this.br.Read3F1(); int arg_5C_0 = 1; int num7 = num6; int num8 = arg_5C_0; while (true) { int arg_96_0 = num8; num5 = num7; if (arg_96_0 > num5) { break; } int item = this.br.ReadInt32(); list.Add(item); num8++; } // TODO: Add to item class num4++; } } }
/// <summary> /// The parse item. /// </summary> /// <param name="rectype"> /// The rectype. /// </param> /// <param name="recnum"> /// The recnum. /// </param> /// <param name="data"> /// The data. /// </param> /// <param name="sqlFile"> /// The sql file. /// </param> /// <returns> /// The <see cref="AOItem"/>. /// </returns> public ItemTemplate ParseItem(int rectype, int recnum, byte[] data, List<string> itemnamessql) { this.br = new BufferedReader(rectype, recnum, data); ItemTemplate aoi = new ItemTemplate(); aoi.ID = recnum; this.br.Skip(16); int num = this.br.Read3F1(); int argc0 = 0; int num2 = num - 1; int num3 = argc0; while (true) { int arg1c2 = num3; int num4 = num2; if (arg1c2 > num4) { break; } int attrkey = this.br.ReadInt32(); int attrval = this.br.ReadInt32(); if (attrkey == 54) { aoi.Quality = attrval; } else { aoi.Stats.Add(attrkey, attrval); } num3++; } this.br.Skip(8); short num5 = this.br.ReadInt16(); short num6 = this.br.ReadInt16(); string itemname = string.Empty; if (num5 > 0) { itemname = this.br.ReadString(num5); } if (itemnamessql != null) { itemnamessql.Add("(" + recnum + ",'" + itemname.Replace("'", "''") + "')"); } if (num6 > 0) { this.br.ReadString(num6); // Read and discard Description } bool flag4 = true; checked { while (this.br.Ptr < this.br.Buffer.Length - 8 && flag4) { switch (this.br.ReadInt32()) { case 2: this.ParseFunctionSet(aoi.Events); break; case 3: case 5: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 15: case 16: case 17: case 18: case 19: case 21: goto IL_4BF; case 4: this.ParseAtkDefSet(aoi.Attack, aoi.Defend); break; case 6: { this.br.Skip(4); int count = this.br.Read3F1() * 8; this.br.Skip(count); break; } case 14: this.ParseAnimSoundSet(1, aoi); break; case 20: this.ParseAnimSoundSet(2, aoi); break; case 22: this.ParseActionSet(aoi.Actions); break; case 23: this.ParseShopHash(aoi.Events); break; default: goto IL_4BF; } continue; IL_4BF: flag4 = false; } } return aoi; }