Esempio n. 1
0
        public static bool BuildAuctionPacket(Auction auction, RealmPacketOut packet)
        {
            ItemRecord auctionItem = Singleton <AuctionMgr> .Instance.AuctionItems[auction.ItemLowId];

            if (auctionItem == null)
            {
                return(false);
            }
            TimeSpan timeSpan = auction.TimeEnds - DateTime.Now;

            if (timeSpan.TotalMilliseconds < 0.0)
            {
                return(false);
            }
            packet.Write(auction.ItemLowId);
            packet.Write(auctionItem.Template.Id);
            for (int index = 0; index < 7; ++index)
            {
                if (auctionItem.EnchantIds != null)
                {
                    packet.Write(auctionItem.EnchantIds[index]);
                    packet.Write(index);
                    packet.Write(auctionItem.GetEnchant((EnchantSlot)index).Charges);
                }
                else
                {
                    packet.Write(0);
                    packet.Write(0);
                    packet.Write(0);
                }
            }

            packet.Write(auctionItem.RandomProperty);
            packet.Write(auctionItem.RandomSuffix);
            packet.Write(auctionItem.Amount);
            packet.Write((uint)auctionItem.Charges);
            packet.WriteUInt(0);
            packet.WriteULong(auction.OwnerLowId);
            packet.Write(auction.CurrentBid);
            packet.WriteUInt(AuctionMgr.GetMinimumNewBidIncrement(auction));
            packet.Write(auction.BuyoutPrice);
            packet.Write((int)timeSpan.TotalMilliseconds);
            packet.WriteULong(auction.BidderLowId);
            packet.Write(auction.CurrentBid);
            return(true);
        }