/// <summary> /// /// </summary> /// <param name="entry"></param> public void Add(AuctionEntry entry) { var templateId = entry.Item.TemplateId; var itemType = entry.Item.Template.Type; AuctionCategory category = null; if (!m_categoriesByTemplate.ContainsKey(templateId)) { m_categoriesByTemplate.Add(templateId, new List <AuctionCategory>()); } category = m_categoriesByTemplate[templateId].Find(categ => categ.IsValidForThisCategory(entry.Item)); if (category == null) { category = new AuctionCategory(itemType, templateId, m_nextCategoryId++); var type = entry.Item.Template.Type; if (!m_templatesByType.ContainsKey(type)) { m_templatesByType.Add(type, new List <int>()); } if (!m_templatesByType[type].Contains(templateId)) { m_templatesByType[type].Add(templateId); } m_categoriesByTemplate[templateId].Add(category); m_categoryById.Add(category.Id, category); category.Add(entry); base.Dispatch(WorldMessage.AUCTION_HOUSE_CATEGORY_MOVEMENT(OperatorEnum.OPERATOR_ADD, category)); } else { category.Add(entry); } if (!m_auctionsByAccount.ContainsKey(entry.OwnerId)) { m_auctionsByAccount.Add(entry.OwnerId, new List <AuctionEntry>()); } m_auctionsByAccount[entry.OwnerId].Add(entry); UpdateMiddlePrice(category.TemplateId); }
/// <summary> /// /// </summary> /// <param name="entry"></param> public void Add(AuctionEntry entry) { var templateId = entry.Item.TemplateId; var itemType = entry.Item.Template.Type; AuctionCategory category = null; if (!m_categoriesByTemplate.ContainsKey(templateId)) m_categoriesByTemplate.Add(templateId, new List<AuctionCategory>()); category = m_categoriesByTemplate[templateId].Find(categ => categ.IsValidForThisCategory(entry.Item)); if (category == null) { category = new AuctionCategory(itemType, templateId, m_nextCategoryId++); var type = entry.Item.Template.Type; if (!m_templatesByType.ContainsKey(type)) m_templatesByType.Add(type, new List<int>()); if(!m_templatesByType[type].Contains(templateId)) m_templatesByType[type].Add(templateId); m_categoriesByTemplate[templateId].Add(category); m_categoryById.Add(category.Id, category); category.Add(entry); base.Dispatch(WorldMessage.AUCTION_HOUSE_CATEGORY_MOVEMENT(OperatorEnum.OPERATOR_ADD, category)); } else { category.Add(entry); } if (!m_auctionsByAccount.ContainsKey(entry.OwnerId)) m_auctionsByAccount.Add(entry.OwnerId, new List<AuctionEntry>()); m_auctionsByAccount[entry.OwnerId].Add(entry); UpdateMiddlePrice(category.TemplateId); }