Exemple #1
0
 public BidHouseCategory(int id, BidHouseItem item)
 {
     Id         = id;
     ItemType   = (ItemTypeEnum)item.Template.TypeId;
     TemplateId = item.Template.Id;
     Effects    = item.Effects;
     ItemLevel  = (int)item.Template.Level;
     Items      = new ConcurrentList <BidHouseItem>();
 }
Exemple #2
0
        public void RemoveBidHouseItem(BidHouseItem item, bool removeOnly = false)
        {
            if (!item.Sold || removeOnly)
            {
                WorldServer.Instance.IOTaskPool.AddMessage(
                    () => Database.Delete(item.Record));

                m_bidHouseItems.Remove(item);
            }

            if (removeOnly)
            {
                return;
            }

            var category = GetBidHouseCategory(item);

            if (category == null)
            {
                return;
            }

            var categoryDeleted = false;

            category.Items.Remove(item);

            if (category.IsEmpty())
            {
                m_bidHouseCategories.Remove(category);
                categoryDeleted = true;
            }

            var handler = ItemRemoved;

            if (handler != null)
            {
                handler(item, category, categoryDeleted);
            }
        }
Exemple #3
0
        public void AddBidHouseItem(BidHouseItem item)
        {
            m_bidHouseItems.Add(item);

            var category    = GetBidHouseCategory(item);
            var newCategory = false;

            if (category == null)
            {
                category = new BidHouseCategory(m_idProvider.Pop(), item);
                m_bidHouseCategories.Add(category);

                newCategory = true;
            }

            category.Items.Add(item);

            var handler = ItemAdded;

            if (handler != null)
            {
                handler(item, category, newCategory);
            }
        }
Exemple #4
0
 public BidHouseCategory GetBidHouseCategory(BidHouseItem item) => m_bidHouseCategories.FirstOrDefault(x => x.IsValidForThisCategory(item));
Exemple #5
0
 public bool IsValidForThisCategory(BidHouseItem item) => item.Template.Id == TemplateId && Effects.CompareEnumerable(item.Effects);