Skip to content

Commit

Permalink
Item count should now be considered in cost calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnchyDev committed Jun 9, 2024
1 parent d45d498 commit 99e608f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/RecycledItems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ double GetExpMultiplier(uint32 itemLevel)
return 1 + (pow(static_cast<double>(itemLevel) / 300.0, 10) * 100.0);
}

uint32 GetRecycleSaleCost(uint32 initialCost, uint32 itemLevel)
uint32 GetRecycleSaleCost(Item* item)
{
return (initialCost * sConfigMgr->GetOption<uint32>("RecycledItems.Auction.BuyoutMultiplier", 10)) // Initial Buyout
* GetExpMultiplier(itemLevel); // Exponential Cost
auto itemProto = item->GetTemplate();

return ((itemProto->SellPrice * sConfigMgr->GetOption<uint32>("RecycledItems.Auction.BuyoutMultiplier", 10)) // Initial Buyout
* GetExpMultiplier(itemProto->ItemLevel)) * item->GetCount(); // Exponential Cost
}

void RecycleItems()
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/RecycledItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct RecycleItemInfo {
std::vector<RecycleItemInfo> 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();
Expand Down

0 comments on commit 99e608f

Please sign in to comment.