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 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; } } }