From 99e608fa2919c51a3bbdfc6881f3f74412c0cdbf Mon Sep 17 00:00:00 2001 From: AnchyDev Date: Sun, 9 Jun 2024 22:53:17 +1000 Subject: [PATCH] Item count should now be considered in cost calculation. --- src/RecycledItems.cpp | 10 ++++++---- src/RecycledItems.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/RecycledItems.cpp b/src/RecycledItems.cpp index acc01b5..2ccf888 100644 --- a/src/RecycledItems.cpp +++ b/src/RecycledItems.cpp @@ -11,10 +11,12 @@ double GetExpMultiplier(uint32 itemLevel) return 1 + (pow(static_cast(itemLevel) / 300.0, 10) * 100.0); } -uint32 GetRecycleSaleCost(uint32 initialCost, uint32 itemLevel) +uint32 GetRecycleSaleCost(Item* item) { - return (initialCost * sConfigMgr->GetOption("RecycledItems.Auction.BuyoutMultiplier", 10)) // Initial Buyout - * GetExpMultiplier(itemLevel); // Exponential Cost + auto itemProto = item->GetTemplate(); + + return ((itemProto->SellPrice * sConfigMgr->GetOption("RecycledItems.Auction.BuyoutMultiplier", 10)) // Initial Buyout + * GetExpMultiplier(itemProto->ItemLevel)) * item->GetCount(); // Exponential Cost } void RecycleItems() @@ -50,7 +52,7 @@ void RecycleItems() } auctionItem->owner = sellerGuid; - uint32 saleCost = GetRecycleSaleCost(itemProto->SellPrice, itemProto->ItemLevel); + uint32 saleCost = GetRecycleSaleCost(item); auctionItem->startbid = saleCost / 2; auctionItem->bidder = ObjectGuid::Empty; diff --git a/src/RecycledItems.h b/src/RecycledItems.h index 5eceb11..f029fab 100644 --- a/src/RecycledItems.h +++ b/src/RecycledItems.h @@ -11,7 +11,7 @@ struct RecycleItemInfo { std::vector itemsToRecycle; double GetExpMultiplier(uint32 /*itemLevel*/); -uint32 GetRecycleSaleCost(uint32 /*initialCost*/, uint32 /*itemLevel*/); +uint32 GetRecycleSaleCost(Item* /*item*/); bool IsItemRecylable(Item* /*item*/); void RecycleItem(Item* /*item*/, Player* /*player*/); void RecycleItems();