示例#1
0
        public void RemoveLockerItem(LockerItem li, BaseItem item, bool deleteFromDB)
        {
            _cashItems.RemoveItem(li, item);
            if (item != null)
            {
                RemoveItem(item);
            }

            if (deleteFromDB && li.SavedToDatabase)
            {
                _cashItems.DeletedCashItems.Add(li.CashId);
            }
        }
        public void AddItem(LockerItem lockerItem, BaseItem baseItem)
        {
            Items.Add(lockerItem);

            if (baseItem is EquipItem ei)
            {
                Equips.Add(ei);
            }
            else if (baseItem is BundleItem bi)
            {
                Bundles.Add(bi);
            }
            else if (baseItem is PetItem pi)
            {
                Pets.Add(pi);
            }
        }
        public void RemoveItem(LockerItem lockerItem, BaseItem baseItem)
        {
            Items.Remove(lockerItem);

            if (baseItem is EquipItem ei)
            {
                Equips.Remove(ei);
            }
            else if (baseItem is BundleItem bi)
            {
                Bundles.Remove(bi);
            }
            else if (baseItem is PetItem pi)
            {
                Pets.Remove(pi);
            }
        }
 private static IEnumerable <LockerItem> GetLocker(int userId, int characterId)
 {
     using (var data = Connection.RunQuery(
                "SELECT * FROM itemlocker WHERE userid = @userid AND characterid = @charid AND worldid = @worldid ORDER BY slot ASC LIMIT 400",
                "@userid", userId,
                "@worldid", WorldID,
                "@charid", characterId
                ) as MySqlDataReader)
     {
         while (data.Read())
         {
             var lockerItem = new LockerItem(data);
             lockerItem.SavedToDatabase = true;
             Console.WriteLine("Loading item {0} cashid {1}", lockerItem.ItemId, lockerItem.CashId);
             yield return(lockerItem);
         }
     }
 }
示例#5
0
 public void AddLockerItem(LockerItem item)
 {
     _cashItems.Items.Add(item);
 }