Exemple #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);
        }
Exemple #2
0
        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);
        }