Exemple #1
0
 /// <summary>
 /// Adds an item to the tradewindow
 /// </summary>
 /// <param name="itemForTrade">InventoryItem to add</param>
 /// <returns>true if added</returns>
 public bool AddItemToTrade(InventoryItem itemForTrade)
 {
     lock (Sync)
     {
         // allow admin and gm account opened windows to trade any item
         if (this.m_owner.Client.Account.PrivLevel == 1)
         {
             if (!itemForTrade.IsDropable || !itemForTrade.IsPickable || itemForTrade.IsNotLosingDur || !itemForTrade.IsTradable)
             {
                 return(false);
             }
         }
         if (TradeItems.Contains(itemForTrade))
         {
             return(false);
         }
         if (TradeItems.Count >= MAX_ITEMS)
         {
             TradeUpdate();
             return(false);
         }
         TradeItems.Add(itemForTrade);
         TradeUpdate();
         return(true);
     }
 }
        /// <summary>
        /// Adds an item to the tradewindow
        /// </summary>
        /// <param name="itemForTrade">InventoryItem to add</param>
        /// <returns>true if added</returns>
        public bool AddItemToTrade(InventoryItem itemForTrade)
        {
            lock (Sync)
            {
                if (!itemForTrade.IsDropable || !itemForTrade.IsPickable || itemForTrade.IsNotLosingDur)
                {
                    return(false);
                }

                if (TradeItems.Contains(itemForTrade))
                {
                    return(false);
                }

                if (TradeItems.Count >= MAX_ITEMS)
                {
                    TradeUpdate();
                    return(false);
                }

                TradeItems.Add(itemForTrade);
                TradeUpdate();
                return(true);
            }
        }