diff --git a/Source/Game/AuctionHouse/AuctionManager.cs b/Source/Game/AuctionHouse/AuctionManager.cs index 5a043579a..730889f33 100644 --- a/Source/Game/AuctionHouse/AuctionManager.cs +++ b/Source/Game/AuctionHouse/AuctionManager.cs @@ -1138,7 +1138,11 @@ namespace Game public CommodityQuote CreateCommodityQuote(Player player, uint itemId, uint quantity) { - var bucketData = _buckets.LookupByKey(AuctionsBucketKey.ForCommodity(itemId)); + ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemId); + if (itemTemplate == null) + return null; + + var bucketData = _buckets.LookupByKey(AuctionsBucketKey.ForCommodity(itemTemplate)); if (bucketData == null) return null; @@ -1181,7 +1185,11 @@ namespace Game public bool BuyCommodity(SQLTransaction trans, Player player, uint itemId, uint quantity, TimeSpan delayForNextAction) { - var bucketItr = _buckets.LookupByKey(AuctionsBucketKey.ForCommodity(itemId)); + ItemTemplate itemTemplate = Global.ObjectMgr.GetItemTemplate(itemId); + if (itemTemplate == null) + return false; + + var bucketItr = _buckets.LookupByKey(AuctionsBucketKey.ForCommodity(itemTemplate)); if (bucketItr == null) { player.GetSession().SendAuctionCommandResult(0, AuctionCommand.PlaceBid, AuctionResult.CommodityPurchaseFailed, delayForNextAction); @@ -1966,12 +1974,12 @@ namespace Game (ushort)item.GetModifier(ItemModifier.BattlePetSpeciesId), (ushort)item.GetBonus().Suffix); } else - return ForCommodity(item.GetEntry()); + return ForCommodity(itemTemplate); } - public static AuctionsBucketKey ForCommodity(uint itemId) + public static AuctionsBucketKey ForCommodity(ItemTemplate itemTemplate) { - return new AuctionsBucketKey(itemId, 0, 0, 0); + return new AuctionsBucketKey(itemTemplate.GetId(), (ushort)itemTemplate.GetBaseItemLevel(), 0, 0); } } diff --git a/Source/Game/Handlers/AuctionHandler.cs b/Source/Game/Handlers/AuctionHandler.cs index ec260f82f..06ba0372e 100644 --- a/Source/Game/Handlers/AuctionHandler.cs +++ b/Source/Game/Handlers/AuctionHandler.cs @@ -954,6 +954,7 @@ namespace Game commodityQuoteResult.QuoteDuration.Set((int)(quote.ValidTo - GameTime.GetGameTimeSteadyPoint()).TotalMilliseconds); } + commodityQuoteResult.ItemID = getCommodityQuote.ItemID; commodityQuoteResult.DesiredDelay = (uint)throttle.DelayUntilNext.TotalSeconds; SendPacket(commodityQuoteResult); diff --git a/Source/Game/Networking/Packets/AuctionHousePackets.cs b/Source/Game/Networking/Packets/AuctionHousePackets.cs index 826856b68..1dc5b5ed8 100644 --- a/Source/Game/Networking/Packets/AuctionHousePackets.cs +++ b/Source/Game/Networking/Packets/AuctionHousePackets.cs @@ -465,7 +465,7 @@ namespace Game.Networking.Packets public Optional TotalPrice; public Optional Quantity; public Optional QuoteDuration; - public int Unknown830; + public int ItemID; public uint DesiredDelay; public AuctionGetCommodityQuoteResult() : base(ServerOpcodes.AuctionGetCommodityQuoteResult) { } @@ -475,7 +475,7 @@ namespace Game.Networking.Packets _worldPacket.WriteBit(TotalPrice.HasValue); _worldPacket.WriteBit(Quantity.HasValue); _worldPacket.WriteBit(QuoteDuration.HasValue); - _worldPacket.WriteInt32(Unknown830); + _worldPacket.WriteInt32(ItemID); _worldPacket.WriteUInt32(DesiredDelay); if (TotalPrice.HasValue)