public override void AddItemToPanel(CharacterItemRecord obj, uint quantity)
 {
     if (obj.IsNull())
     {
         return;
     }
     if (quantity == obj.Quantity)  // on ajoute toute la quantité d'items
     {
         var addedItem = obj.CloneWithUID();
         Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
         CraftedItems.Add(addedItem);
         return;
     }
     else // on doit cut
     {
         var existing = CraftedItems.ExistingItem(obj);
         if (existing != null)
         {
             existing.Quantity += (uint)quantity;
             Client.Send(new ExchangeObjectModifiedMessage(false, existing.GetObjectItem()));
             return;
         }
         else
         {
             var addedItem = obj.CloneWithUID();
             addedItem.Quantity = (uint)quantity;
             Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
             CraftedItems.Add(addedItem);
             return;
         }
     }
 }
Esempio n. 2
0
 public override void AddItemToPanel(CharacterItemRecord obj, uint quantity)
 {
     if (obj.IsNull())
         return;
     if (quantity == obj.Quantity)  // on ajoute toute la quantité d'items
     {
         var addedItem = obj.CloneWithUID();
         Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
         CraftedItems.Add(addedItem);
         return;
     }
     else // on doit cut
     {
         var existing = CraftedItems.ExistingItem(obj);
         if (existing != null)
         {
             existing.Quantity += (uint)quantity;
             Client.Send(new ExchangeObjectModifiedMessage(false, existing.GetObjectItem()));
             return;
         }
         else
         {
             var addedItem = obj.CloneWithUID();
             addedItem.Quantity = (uint)quantity;
             Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
             CraftedItems.Add(addedItem);
             return;
         }
     }
 }
 public override void AddItemToPanel(CharacterItemRecord obj, uint quantity)
 {
     if (obj.IsNull())  // il ajoute a son propre panel
     {
         return;
     }
     if (quantity == obj.Quantity)
     {
         var existing = BankItems.ExistingItem(obj);
         if (!existing.IsNull())
         {
             existing.Quantity += quantity;
             SaveTask.UpdateElement(existing);
             Client.Character.Inventory.RemoveItem(obj.UID, obj.Quantity);
             Client.Send(new StorageObjectUpdateMessage(existing.GetObjectItem()));
             return;
         }
         else
         {
             var newBankItem = obj.GetBankItem(Client.Account.Id);
             Client.Send(new StorageObjectUpdateMessage(newBankItem.GetObjectItem()));
             SaveTask.AddElement(newBankItem);
             Client.Character.Inventory.RemoveItem(obj.UID, obj.Quantity);
             return;
         }
     }
     else
     {
         var existing = BankItems.ExistingItem(obj);
         if (existing != null)
         {
             existing.Quantity += (uint)quantity;
             Client.Send(new StorageObjectUpdateMessage(existing.GetObjectItem()));
             Client.Character.Inventory.RemoveItem(obj.UID, quantity);
             SaveTask.UpdateElement(existing);
             return;
         }
         else
         {
             var addedItem = obj.CloneWithUID(); // fonctionne
             addedItem.Quantity = (uint)quantity;
             Client.Send(new StorageObjectUpdateMessage(addedItem.GetObjectItem()));
             SaveTask.AddElement(addedItem.GetBankItem(Client.Account.Id));
             Client.Character.Inventory.RemoveItem(obj.UID, quantity);
             return;
         }
     }
 }
Esempio n. 4
0
 public override void AddItemToPanel(CharacterItemRecord obj, uint quantity)
 {
     if (obj.IsNull())  // il ajoute a son propre panel
         return;
     if (quantity == obj.Quantity)
     {
         var existing = BankItems.ExistingItem(obj);
         if (!existing.IsNull())
         {
             existing.Quantity += quantity;
             SaveTask.UpdateElement(existing);
             Client.Character.Inventory.RemoveItem(obj.UID,obj.Quantity);
             Client.Send(new StorageObjectUpdateMessage(existing.GetObjectItem()));
             return;
         }
         else
         {
             var newBankItem = obj.GetBankItem(Client.Account.Id);
             Client.Send(new StorageObjectUpdateMessage(newBankItem.GetObjectItem()));
             SaveTask.AddElement(newBankItem);
             Client.Character.Inventory.RemoveItem(obj.UID, obj.Quantity);
             return;
         }
     }
     else
     {
         var existing = BankItems.ExistingItem(obj);
         if (existing != null)
         {
             existing.Quantity += (uint)quantity;
             Client.Send(new StorageObjectUpdateMessage(existing.GetObjectItem()));
             Client.Character.Inventory.RemoveItem(obj.UID, quantity);
             SaveTask.UpdateElement(existing);
             return;
         }
         else
         {
             var addedItem = obj.CloneWithUID(); // fonctionne
             addedItem.Quantity = (uint)quantity;
             Client.Send(new StorageObjectUpdateMessage(addedItem.GetObjectItem()));
             SaveTask.AddElement(addedItem.GetBankItem(Client.Account.Id));
             Client.Character.Inventory.RemoveItem(obj.UID, quantity);
             return;
         }
     }
 }
 public override void RemoveItemFromPanel(CharacterItemRecord obj, int quantity)
 {
     if (obj.IsNull())
     {
         return;
     }
     if (obj.Quantity == (uint)-quantity)
     {
         Client.Send(new ExchangeObjectRemovedMessage(false, obj.UID));
         obj = null;
         return;
     }
     else
     {
         obj.Quantity = (uint)(obj.Quantity + quantity);
         Client.Send(new ExchangeObjectModifiedMessage(false, obj.GetObjectItem()));
     }
 }
        public override void AddItemToPanel(CharacterItemRecord obj, uint quantity)
        {
            #region BackgroundCheck
            ItemRecord template = ItemRecord.GetItem(obj.GID);
            if (obj.IsNull())
            {
                return;
            }
            #endregion

            if (template.Type == ItemTypeEnum.SMITHMAGIC_RUNE)
            {
                #region Ajout de Rune
                if (UsedRune != null) // bizzare de devoir faire ça, le client devrait s'en charger
                {
                    if (obj.Quantity - UsedRune.Quantity <= 0)
                    {
                        return;
                    }
                }
                if (quantity == obj.Quantity)
                {
                    var addedItem = obj.CloneWithUID();
                    Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
                    UsedRune = addedItem;
                    return;
                }
                else
                {
                    if (UsedRune != null)
                    {
                        UsedRune.Quantity += (uint)quantity;
                        Client.Send(new ExchangeObjectModifiedMessage(false, UsedRune.GetObjectItem()));
                        return;
                    }
                    else
                    {
                        var addedItem = obj.CloneWithUID();
                        addedItem.Quantity = (uint)quantity;
                        Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
                        UsedRune = addedItem;
                        return;
                    }
                }
                #endregion
            }
            else
            {
                if (quantity == obj.Quantity)
                {
                    var addedItem = obj.CloneWithUID();
                    Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
                    UsedItem = addedItem;
                    return;
                }
                else
                {
                    if (UsedItem == null)
                    {
                        var addedItem = obj.CloneWithUID();
                        addedItem.Quantity = (uint)quantity;
                        Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
                        UsedItem = addedItem;
                        return;
                    }
                    else
                    {
                        Client.Send(new ExchangeObjectRemovedMessage(false, UsedItem.UID));
                        UsedItem = null;
                        AddItemToPanel(obj, quantity);
                    }
                }
            }
        }
Esempio n. 7
0
        public override void AddItemToPanel(CharacterItemRecord obj, uint quantity)
        {
            #region BackgroundCheck
            ItemRecord template = ItemRecord.GetItem(obj.GID);
            if (obj.IsNull())
                return;
            #endregion

            if (template.Type == ItemTypeEnum.SMITHMAGIC_RUNE)
            {
                #region Ajout de Rune
                if (UsedRune != null) // bizzare de devoir faire ça, le client devrait s'en charger
                {
                    if (obj.Quantity - UsedRune.Quantity <= 0)
                        return;
                }
                if (quantity == obj.Quantity)
                {
                    var addedItem = obj.CloneWithUID();
                    Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
                    UsedRune = addedItem;
                    return;
                }
                else
                {
                    if (UsedRune != null)
                    {
                        UsedRune.Quantity += (uint)quantity;
                        Client.Send(new ExchangeObjectModifiedMessage(false, UsedRune.GetObjectItem()));
                        return;
                    }
                    else
                    {
                        var addedItem = obj.CloneWithUID();
                        addedItem.Quantity = (uint)quantity;
                        Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
                        UsedRune = addedItem;
                        return;
                    }
                }
                #endregion
            }
            else
            {
                if (quantity == obj.Quantity)
                {
                    var addedItem = obj.CloneWithUID();
                    Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
                    UsedItem = addedItem;
                    return;
                }
                else
                {
                    if (UsedItem == null)
                    {
                        var addedItem = obj.CloneWithUID();
                        addedItem.Quantity = (uint)quantity;
                        Client.Send(new ExchangeObjectAddedMessage(false, addedItem.GetObjectItem()));
                        UsedItem = addedItem;
                        return;
                    }
                    else
                    {
                        Client.Send(new ExchangeObjectRemovedMessage(false, UsedItem.UID));
                        UsedItem = null;
                        AddItemToPanel(obj, quantity);
                    }
                }
            }
        }
Esempio n. 8
0
 public override void RemoveItemFromPanel(CharacterItemRecord obj, int quantity)
 {
     if (obj.IsNull())
         return;
     if (obj.Quantity == (uint)-quantity)
     {
         Client.Send(new ExchangeObjectRemovedMessage(false, obj.UID));
         obj = null;
         return;
     }
     else
     {
         obj.Quantity = (uint)(obj.Quantity + quantity);
         Client.Send(new ExchangeObjectModifiedMessage(false, obj.GetObjectItem()));
     }
 }