Ejemplo n.º 1
0
        public static InventoryItemModel Load(long id)
        {
            var reader = DatabaseManager.Provider.ExecuteReader("SELECT * FROM inventory_item WHERE guid = " + id);
            InventoryItemModel itemToReturn = null;

            while (reader.Read())
            {
                itemToReturn = new InventoryItemModel()
                {
                    ID         = reader.GetInt64("guid"),
                    TemplateID = reader.GetInt32("template"),
                    Quantity   = reader.GetInt32("qua"),
                    Position   = reader.GetInt32("pos"),
                    Effects    = reader.GetString("stats"),
                    SpeakingID = reader.GetInt64("speaking"),
                };
                addItem(itemToReturn, false);
            }
            reader.Close();
            if (itemToReturn.SpeakingID != 0)
            {
                SpeakingTable.Load(itemToReturn.ID);
            }
            return(itemToReturn);
        }
Ejemplo n.º 2
0
        public static void Load(string ids)
        {
            var         reader     = DatabaseManager.Provider.ExecuteReader("SELECT * FROM inventory_item WHERE guid IN (" + ids + ");");
            List <long> LivingItem = new List <long>();

            while (reader.Read())
            {
                var item = new InventoryItemModel()
                {
                    ID         = reader.GetInt64("guid"),
                    TemplateID = reader.GetInt32("template"),
                    Quantity   = reader.GetInt32("qua"),
                    Position   = reader.GetInt32("pos"),
                    Effects    = reader.GetString("stats"),
                    SpeakingID = reader.GetInt64("speaking"),
                };
                if (item.SpeakingID != 0)
                {
                    LivingItem.Add(item.SpeakingID);
                }
                addItem(item, false);
            }

            reader.Close();

            if (LivingItem.Count > 0)
            {
                SpeakingTable.Load(LivingItem);
            }
        }