Example #1
0
        public bool StoreItem(BasePlayerItem item, int amount, uint price)
        {
            if (!Owner.Inventory.HasItem(item) || amount <= 0)
            {
                return(false);
            }

            if (item.IsLinkedToPlayer() || item.IsLinkedToAccount())
            {
                return(false);
            }

            if (amount > item.Stack)
            {
                amount = (int)item.Stack;
            }

            var merchantItem = ItemManager.Instance.CreateMerchantItem(Owner, item, amount, price);

            AddItem(merchantItem);

            Owner.Inventory.RemoveItem(item, amount);

            return(true);
        }
Example #2
0
File: Bank.cs Project: Mixi59/Stump
        public BankItem StoreItem(BasePlayerItem item, int amount, bool sendMessage)
        {
            if (!Owner.Inventory.HasItem(item) || amount <= 0)
            {
                return(null);
            }

            if (item.IsLinkedToPlayer())
            {
                return(null);
            }

            if (item.IsEquiped())
            {
                return(null);
            }

            if (amount > item.Stack)
            {
                amount = (int)item.Stack;
            }

            Owner.Inventory.RemoveItem(item, amount, sendMessage: sendMessage);

            var bankItem = ItemManager.Instance.CreateBankItem(Owner, item, amount);

            bankItem = AddItem(bankItem, sendMessage);

            return(bankItem);
        }
        public bool MoveToInventory(MerchantItem item, uint quantity)
        {
            bool result;

            if (quantity == 0u)
            {
                result = false;
            }
            else
            {
                if (quantity > item.Stack)
                {
                    quantity = item.Stack;
                }
                this.RemoveItem(item, quantity, true);
                BasePlayerItem item2 = Singleton <ItemManager> .Instance.CreatePlayerItem(this.Owner, item.Template, quantity, item.Effects);

                this.Owner.Inventory.AddItem(item2);
                result = true;
            }
            return(result);
        }
Example #4
0
 public bool MustStackWith(BasePlayerItem compared)
 {
     return(compared.Template.Id == Template.Id &&
            compared.Effects.CompareEnumerable(Effects));
 }
Example #5
0
 public virtual bool Drop(BasePlayerItem dropOnItem) => false;
Example #6
0
 public virtual bool CanDrop(BasePlayerItem item) => false;
Example #7
0
 public virtual bool Feed(BasePlayerItem food) => false;
Example #8
0
 public virtual bool CanFeed(BasePlayerItem item) => false;
 public virtual bool Drop(BasePlayerItem dropOnItem)
 {
     return(false);
 }
 public virtual bool Feed(BasePlayerItem food)
 {
     return(false);
 }
 public virtual bool MustStackWith(BasePlayerItem compared)
 {
     return(compared.Template.Id == this.Template.Id && compared.Position == CharacterInventoryPositionEnum.INVENTORY_POSITION_NOT_EQUIPED && compared.Position == this.Position && compared.Effects.CompareEnumerable(this.Effects));
 }