public StaticDynel(Identity parent, Identity id, ItemTemplate template)
     : base(parent, id)
 {
     this.Template = template;
     this.Events = this.Template.Events;
     this.Actions = this.Template.Actions;
     foreach (KeyValuePair<int, int> s in this.Template.Stats)
     {
         this.Stats.Add(s.Key, s.Value);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// </summary>
 /// <param name="template">
 /// </param>
 private static void GetItemRelations(ItemTemplate template)
 {
     try
     {
         string html = webClient.DownloadString("http://www.aoitems.com/item/" + template.ID + "/");
         int pos;
         if ((pos = html.IndexOf("<select class=\"TemplateSelector\">")) != -1)
         {
             // found template selector
             // now narrow down to the links
             html = html.Substring(pos + 33);
             html = html.Substring(0, html.IndexOf("</select"));
             foreach (Match r in reg.Matches(html))
             {
                 int id = int.Parse(r.Groups[1].Value);
                 template.Relations.Add(id);
             }
         }
         else
         {
             template.Relations.Add(template.ID);
         }
     }
     catch (Exception)
     {
         template.Relations.Add(template.ID);
     }
 }
Esempio n. 3
0
        /// <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 item.
        /// </summary>
        /// <param name="rectype">
        /// The rectype.
        /// </param>
        /// <param name="recnum">
        /// The recnum.
        /// </param>
        /// <param name="data">
        /// The data.
        /// </param>
        /// <param name="itemNamesSqlList">
        /// </param>
        /// <returns>
        /// The <see cref="AOItem"/>.
        /// </returns>
        public ItemTemplate ParseItem(Extractor.RecordType recordType, int recnum, byte[] data, List<string> itemNamesSqlList)
        {
            int rectype = (int)recordType;
            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 (itemNamesSqlList != null)
            {
                itemNamesSqlList.Add(string.Format("( {0} , '{1}' , '{2}', '{3}' ) ",
                    recnum,
                    itemname.Replace("'", "''"),
                    Enum.GetName(typeof(Extractor.RecordType), recordType),
                    aoi.getItemAttribute(79)));
            }

            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()) // what are these ints ?
                    {
                        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;
        }
        /// <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>
        /// </summary>
        /// <returns>
        /// </returns>
        public ItemTemplate Copy()
        {
            ItemTemplate copy = new ItemTemplate();
            copy.ID = this.ID;
            copy.Flags = this.Flags;
            copy.ItemType = this.ItemType;
            copy.MultipleCount = this.MultipleCount;
            copy.Nothing = this.Nothing;
            copy.Quality = this.Quality;

            foreach (KeyValuePair<int, int> kv in this.Attack)
            {
                copy.Attack.Add(kv.Key, kv.Value);
            }

            foreach (AOAction actions in this.Actions)
            {
                copy.Actions.Add(actions.Copy());
            }

            foreach (KeyValuePair<int, int> kv in this.Defend)
            {
                copy.Defend.Add(kv.Key, kv.Value);
            }

            foreach (Event events in this.Events)
            {
                copy.Events.Add(events.Copy());
            }

            foreach (KeyValuePair<int, int> kv in this.Stats)
            {
                copy.Stats.Add(kv.Key, kv.Value);
            }

            return copy;
        }
 /// <summary>
 /// </summary>
 /// <param name="slot">
 /// </param>
 /// <param name="item">
 /// </param>
 /// <exception cref="NotImplementedException">
 /// </exception>
 public void Removed(int slot, ItemTemplate item)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// </summary>
 /// <param name="slot">
 /// </param>
 /// <param name="templ">
 /// </param>
 /// <param name="err">
 /// </param>
 /// <exception cref="NotImplementedException">
 /// </exception>
 public void CheckRemove(int slot, ItemTemplate templ, InventoryError err)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// </summary>
 /// <param name="slot">
 /// </param>
 /// <param name="item">
 /// </param>
 /// <param name="err">
 /// </param>
 /// <exception cref="NotImplementedException">
 /// </exception>
 public void CheckAdd(int slot, ItemTemplate item, InventoryError err)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// </summary>
 /// <param name="item">
 /// </param>
 /// <exception cref="NotImplementedException">
 /// </exception>
 public void Added(ItemTemplate item)
 {
     throw new NotImplementedException();
 }