Ejemplo n.º 1
0
        public static bool BuildAuctionPacket(Auction auction, RealmPacketOut packet)
        {
            var item = AuctionMgr.Instance.AuctionItems[auction.ItemLowId];

            if (item == null)
            {
                return(false);
            }

            var timeleft = auction.TimeEnds - DateTime.Now;

            if (timeleft.TotalMilliseconds < 0)
            {
                return(false);
            }

            packet.Write(auction.ItemLowId);
            packet.Write(item.Template.Id);

            for (var i = 0; i < 7; i++)
            {
                if (item.EnchantIds != null)
                {
                    packet.Write(item.EnchantIds[i]);
                    packet.Write(i);                                                            // enchant duration
                    packet.Write(item.GetEnchant((EnchantSlot)i).Charges);                      // TODO: Fix enchant charges
                }
                else
                {
                    packet.Write(0);
                    packet.Write(0);
                    packet.Write(0);
                }
            }

            packet.Write(item.RandomProperty);
            packet.Write(item.RandomSuffix);
            packet.Write(item.Amount);
            packet.Write((uint)item.Charges);
            packet.WriteUInt(0);                                             //Unknown
            packet.WriteULong(auction.OwnerLowId);
            packet.Write(auction.CurrentBid);                                //auction start bid
            packet.WriteUInt(AuctionMgr.GetMinimumNewBidIncrement(auction)); //amount required to outbid
            packet.Write(auction.BuyoutPrice);
            packet.Write((int)timeleft.TotalMilliseconds);
            packet.WriteULong(auction.BidderLowId);
            packet.Write(auction.CurrentBid);
            return(true);
        }
Ejemplo n.º 2
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);
        }