public void RemoveItemFromPanel(BankItemRecord obj, int quantity)
 {
     if (obj.IsNull())
     {
         return;
     }
     if (obj.Quantity == (uint)-quantity)
     {
         SaveTask.RemoveElement(obj);
         var existing = Client.Character.Inventory.Items.ExistingItem(obj);
         if (existing != null)
         {
             existing.Quantity += (uint)-quantity;
             SaveTask.UpdateElement(existing);
             Client.Character.Inventory.Refresh();
         }
         else
         {
             Client.Character.Inventory.Add(obj);
         }
         Client.Send(new StorageObjectRemoveMessage(obj.UID));
     }
     else
     {
         obj.Quantity = (uint)(obj.Quantity + quantity);
         SaveTask.UpdateElement(obj);
         Client.Character.Inventory.Add(obj, (uint)-quantity);
         Client.Send(new StorageObjectUpdateMessage(obj.GetObjectItem()));
     }
 }
예제 #2
0
        public void RemoveItem(uint id, uint quantity, bool refresh = true)
        {
            var item = GetItem(id);

            if (item == null)
            {
                Character.NotificationError("Impossible de retirer l'item, il n'éxiste pas...");
                return;
            }

            if (quantity == item.Quantity)
            {
                Items.Remove(item);
                SaveTask.RemoveElement(item);
                CharacterItemRecord.CharactersItems.Remove(item);
                Character.Client.Send(new ObjectDeletedMessage(item.UID));
            }
            else if (quantity < item.Quantity)
            {
                item.Quantity -= (uint)quantity;
                SaveTask.UpdateElement(item);
            }
            if (refresh)
            {
                Refresh();
            }
            Character.RefreshShortcuts();
        }
        public void MoveItem(uint uid, int quantity)
        {
            var item     = CharacterBidItems.Find(x => x.objectUID == uid);
            var realItem = BidShopItemRecord.GetBidShopItem(uid);

            SaveTask.RemoveElement(realItem);
            Client.Character.Inventory.Add(new CharacterItemRecord(realItem.UID, 63, realItem.GID, Client.Character.Id, realItem.Quantity, realItem.GetEffects()));
            OpenSellPanel();
        }
 public static void RemoveShortcut(int characterid, sbyte slot)
 {
     SaveTask.RemoveElement(GetShorcut(characterid, slot));
 }
 public static void RemoveAll(int characterid)
 {
     GeneralShortcuts.FindAll(x => x.CharacterId == characterid).ForEach(x => SaveTask.RemoveElement(x));
 }
예제 #6
0
 public static void RemoveAll(int characterid)
 {
     GetCharacterItems(characterid).ForEach(x => SaveTask.RemoveElement(x));
 }
예제 #7
0
 /// <summary>
 /// Using SaveTask.cs
 /// </summary>
 /// <param name="table"></param>
 /// <param name="addtolist"></param>
 public static void RemoveElement(this ITable table, bool removefromlist = true)
 {
     SaveTask.RemoveElement(table, removefromlist);
 }