Example #1
0
        public static void Init()
        {
            foreach (var cat in Enum.GetValues(typeof(Asda2ItemAuctionCategory)).Cast <Asda2ItemAuctionCategory>())
            {
                var byLevelItems = new Dictionary <AuctionLevelCriterion, SortedSet <Asda2ItemRecord> >();
                foreach (
                    var levelCriterion in Enum.GetValues(typeof(AuctionLevelCriterion)).Cast <AuctionLevelCriterion>())
                {
                    byLevelItems.Add(levelCriterion, new SortedSet <Asda2ItemRecord>(ItemsComparer));
                }
                CategorizedItemsById.Add(cat, byLevelItems);
            }
            var items = Asda2ItemRecord.LoadAuctionedItems();

            foreach (var item in items)
            {
                RegisterItem(item);
            }
            var sr = AuctionSelledRecord.FindAll();

            foreach (var rec in sr)
            {
                if (!SelledRecords.ContainsKey(rec.ReciverCharacterId))
                {
                    SelledRecords.Add(rec.ReciverCharacterId, new List <AuctionSelledRecord>());
                }
                SelledRecords[rec.ReciverCharacterId].Add(rec);
            }
        }
Example #2
0
        private static void SendMoneyToSeller(Asda2ItemRecord item)
        {
            var chr = World.GetCharacter(item.OwnerId);

            if (chr != null)
            {
                SendMoneyToSeller(item.Template.Name, item.AuctionPrice, item.Amount, chr);
            }
            else
            {
                var newRec = new AuctionSelledRecord(item.OwnerId, item.AuctionPrice, item.Amount, item.ItemId);
                newRec.Create();
            }
        }