Example #1
0
        public static Item Instantiate(ItemTemplate it)
        {
            // Setup the item
            Item item = new Item();
            item._id = 0;
            item._model = it.Model;
            item._durability = it.GenerateDurability();
            item._remainingTime = 0;
            item._type = (Type)it.Type;
            item._slot = 0xFF;
            item._templateID = it.ID;
            item._template = it;

            return item;
        }
Example #2
0
 public void AddItemTemplate(ItemTemplate it)
 {
     _itemTemplates[it.ID] = it;
 }
Example #3
0
        public static ItemTemplate ReadFromDB(object[] row)
        {
            // 0: item_template_id    int(10) unsigned
            // 1: model   smallint(5) unsigned
            // 2: type    tinyint(3) unsigned
            // 3: gen_dq_min  tinyint(3) unsigned
            // 4: gen_dq_max  tinyint(3) unsigned
            // 5: dq_max  tinyint(3) unsigned
            // 6: use_func    tinyint(3) unsigned
            // 7: use_func_param  int(11)
            // 8: use_func_cooldown   float

            ItemTemplate it = new ItemTemplate();
            it._id = (uint)row[0];
            it._model = (ushort)row[1];
            it._type = (byte)row[2];
            it._genDQMin = (byte)row[3];
            it._genDQMax = (byte)row[4];
            it._dqMax = (byte)row[5];
            it._useFunc = (ItemUseFunction)((byte)row[6]);
            it._useFuncParam = (int)row[7];
            it._useFuncCooldown = (float)row[8];

            return it;
        }