Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 6002534

Browse files
committed
Tweaked config and added duration refreshing for items with no active bid.
1 parent db9a845 commit 6002534

File tree

2 files changed

+93
-59
lines changed

2 files changed

+93
-59
lines changed

conf/recycleditems.conf.dist

Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -9,116 +9,127 @@
99
########################################
1010
#
1111
# RecycledItems.Enable
12-
# Description: Enable/disable item recycling.
13-
# Default: 0 - Disabled
14-
# 1 - Enabled
15-
# Type: bool
12+
# Description: Enable/disable item recycling.
13+
# Default: 0 - Disabled
14+
# 1 - Enabled
15+
# Type: bool
1616
#
1717

1818
RecycledItems.Enable = 0
1919

2020
#
2121
# RecycledItems.Entry
22-
# Description: The entry of the recycler npc.
23-
# Note: Only change this if you have entry conflicts.
24-
# Default: 888999
25-
# Type: uint32
22+
# Description: The entry of the recycler npc.
23+
# Note: Only change this if you have entry conflicts.
24+
# Default: 888999
25+
# Type: uint32
2626
#
2727

2828
RecycledItems.Entry = 888999
2929

3030
#
3131
# RecycledItems.UpdateFrequency
32-
# Description: How often the server posts the pool of items on the auction house.
33-
# Note: This is measured in milliseconds.
34-
# Default: 5000
35-
# Type: uint32
32+
# Description: How often the server posts the pool of items on the auction house.
33+
# Note: This is measured in milliseconds.
34+
# Default: 30000
35+
# Type: uint32
3636
#
3737

38-
RecycledItems.UpdateFrequency = 5000
38+
RecycledItems.UpdateFrequency = 30000
3939

4040
#
4141
# RecycledItems.Filter.MinimumItemLevel
42-
# Description: The minimum item level an item must be to be recycled.
43-
# Default: 1
44-
# Type: uint32
42+
# Description: The minimum item level an item must be to be recycled.
43+
# Default: 0
44+
# Type: uint32
4545
#
4646

47-
RecycledItems.Filter.MinimumItemLevel = 1
47+
RecycledItems.Filter.MinimumItemLevel = 0
4848

4949
#
5050
# RecycledItems.Filter.MinimumQuality
51-
# Description: The minimum quality an item must be to be recycled.
52-
# 0 - ITEM_QUALITY_POOR
53-
# 1 - ITEM_QUALITY_NORMAL
54-
# Default: 2 - ITEM_QUALITY_UNCOMMON
55-
# 3 - ITEM_QUALITY_RARE
56-
# 4 - ITEM_QUALITY_EPIC
57-
# 5 - ITEM_QUALITY_LEGENDARY
58-
# Type: uint32
51+
# Description: The minimum quality an item must be to be recycled.
52+
# 0 - ITEM_QUALITY_POOR
53+
# Default: 1 - ITEM_QUALITY_NORMAL
54+
# 2 - ITEM_QUALITY_UNCOMMON
55+
# 3 - ITEM_QUALITY_RARE
56+
# 4 - ITEM_QUALITY_EPIC
57+
# 5 - ITEM_QUALITY_LEGENDARY
58+
# Type: uint32
5959
#
6060

61-
RecycledItems.Filter.MinimumQuality = 2
61+
RecycledItems.Filter.MinimumQuality = 1
6262

6363
#
6464
# RecycledItems.Filter.OnlyTradable
65-
# Description: Allow only tradable items to be recycles.
66-
# Note: This avoids issues where high level quest items end up for auction.
67-
# Default: 0 - Disabled
68-
# 1 - Enabled
69-
# Type: bool
65+
# Description: Allow only tradable items to be recycles.
66+
# Note: This avoids issues where high level quest items end up for auction.
67+
# Default: 0 - Disabled
68+
# 1 - Enabled
69+
# Type: bool
7070
#
7171

7272
RecycledItems.Filter.OnlyTradable = 1
7373

74+
#
75+
# RecycledItems.Auction.Refresh
76+
# Description: Refreshes auctions posted by the server with no active bid.
77+
# Note: Only items posted by the server are refreshed, this is ignored with UseOriginalSeller.
78+
# 0 - Disabled
79+
# Default: 1 - Enabled
80+
# Type: bool
81+
#
82+
83+
RecycledItems.Auction.Refresh = 1
84+
7485
#
7586
# RecycledItems.Auction.UseOriginalSeller
76-
# Description: When an item is recycled it is posted on the auction house on behalf of the player.
77-
# Note: It is recommended to leave this disabled to prevent auction house abuse.
78-
# Default: 0 - Disabled
79-
# 1 - Enabled
80-
# Type: bool
87+
# Description: When an item is recycled it is posted on the auction house on behalf of the player.
88+
# Note: It is recommended to leave this disabled to prevent auction house abuse.
89+
# Default: 0 - Disabled
90+
# 1 - Enabled
91+
# Type: bool
8192
#
8293

83-
RecyclesItems.Auction.UseOriginalSeller = 0
94+
RecycledItems.Auction.UseOriginalSeller = 0
8495

8596
#
8697
# RecycledItems.Auction.SellerGuid
87-
# Description: The GUID of the player who will sell/recycle the items in auction house.
88-
# Note: This is ignored if UseOriginalOwner is enabled.
89-
# Default: 0
90-
# Type: uint64
98+
# Description: The GUID of the player who will sell/recycle the items in auction house.
99+
# Note: This lets you control who is selling the item. This is ignored if UseOriginalOwner is enabled.
100+
# Default: 0
101+
# Type: uint64
91102
#
92103

93104
RecycledItems.Auction.SellerGuid = 0
94105

95106

96107
#
97108
# RecycledItems.Auction.BidMultiplier
98-
# Description: The multiplier for the initial bid cost.
99-
# Note: Formula is (itemSellAmount * BidMultiplier)
100-
# Default: 5
101-
# Type: uint32
109+
# Description: The multiplier for the initial bid cost.
110+
# Note: Formula is (itemSellAmount * BidMultiplier)
111+
# Default: 5
112+
# Type: uint32
102113
#
103114

104115
RecycledItems.Auction.BidMultiplier = 5
105116

106117
#
107118
# RecycledItems.Auction.BuyoutMultiplier
108-
# Description: The multiplier for the buyout cost.
109-
# Note: Formula is (itemSellAmount * BuyoutMultiplier)
110-
# Default: 10
111-
# Type: uint32
119+
# Description: The multiplier for the buyout cost.
120+
# Note: Formula is (itemSellAmount * BuyoutMultiplier)
121+
# Default: 10
122+
# Type: uint32
112123
#
113124

114125
RecycledItems.Auction.BuyoutMultiplier = 10
115126

116127
#
117128
# RecycledItems.Vendor.CashMultiplier
118-
# Description: Controls how much extra money you get for recycling.
119-
# Note: Formula is (itemSellAmount + (itemSellAmount / CashMultiplier))
120-
# Default: 10
121-
# Type: uint32
129+
# Description: Controls how much extra money you get for recycling.
130+
# Note: Formula is (itemSellAmount + (itemSellAmount / CashMultiplier))
131+
# Default: 10
132+
# Type: uint32
122133
#
123134

124135
RecycledItems.Vendor.CashMultiplier = 10

src/RecycledItems.cpp

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ void RecycleItems()
1818

1919
uint32 bidMultiplier = sConfigMgr->GetOption<uint32>("RecycledItems.Auction.BidMultiplier", 5);
2020
uint32 buyoutMultiplier = sConfigMgr->GetOption<uint32>("RecycledItems.Auction.BuyoutMultiplier", 10);
21+
ObjectGuid sellerGuid = ObjectGuid(sConfigMgr->GetOption<uint64>("RecycledItems.Auction.SellerGuid", 0));
2122

2223
uint32 count = 0;
2324
for (auto itemInfo : itemsToRecycle)
@@ -32,7 +33,6 @@ void RecycleItems()
3233
auctionItem->item_template = item->GetEntry();
3334
auctionItem->itemCount = item->GetCount();
3435

35-
ObjectGuid sellerGuid = ObjectGuid(sConfigMgr->GetOption<uint64>("RecycledItems.Auction.SellerGuid", 0));
3636
if (sConfigMgr->GetOption<bool>("RecycledItems.Auction.UseOriginalSeller", false))
3737
{
3838
sellerGuid = ObjectGuid(itemInfo.owner);
@@ -54,6 +54,31 @@ void RecycleItems()
5454
}
5555

5656
itemsToRecycle.clear();
57+
58+
if (sConfigMgr->GetOption<bool>("RecycledItems.Auction.Refresh", true) &&
59+
!sConfigMgr->GetOption<bool>("RecycledItems.Auction.UseOriginalSeller", false))
60+
{
61+
auto& auctions = auctionHouse->GetAuctions();
62+
63+
for (const auto& auction : auctions)
64+
{
65+
auto auctionInfo = auction.second;
66+
67+
// Do not extend auction with active bids (otherwise they wont ever receive the item!!)
68+
if (auctionInfo->bidder)
69+
{
70+
continue;
71+
}
72+
73+
// Only extend server auctions.
74+
if (auctionInfo->owner != sellerGuid)
75+
{
76+
continue;
77+
}
78+
79+
auctionInfo->expire_time = GameTime::GetGameTime().count() + (HOUR * 48);
80+
}
81+
}
5782
}
5883

5984
Language RecycledItemsPlayerScript::GetLanguageForTarget(Player* player)
@@ -80,8 +105,8 @@ bool RecycledItemsPlayerScript::CanSellItem(Player* player, Item* item, Creature
80105

81106
auto itemProto = item->GetTemplate();
82107

83-
uint32 minItemLevel = sConfigMgr->GetOption<uint32>("RecycledItems.Filter.MinimumItemLevel", 1);
84-
uint32 minQuality = sConfigMgr->GetOption<uint32>("RecycledItems.Filter.MinimumQuality", ITEM_QUALITY_UNCOMMON);
108+
uint32 minItemLevel = sConfigMgr->GetOption<uint32>("RecycledItems.Filter.MinimumItemLevel", 0);
109+
uint32 minQuality = sConfigMgr->GetOption<uint32>("RecycledItems.Filter.MinimumQuality", ITEM_QUALITY_NORMAL);
85110

86111
if (itemProto->ItemLevel < minItemLevel || itemProto->Quality < minQuality)
87112
{
@@ -115,8 +140,6 @@ bool RecycledItemsPlayerScript::CanSellItem(Player* player, Item* item, Creature
115140
uint32 bonusMultiplier = sConfigMgr->GetOption<uint32>("RecycledItems.Vendor.CashMultiplier", 10);
116141
player->ModifyMoney(itemProto->SellPrice + (itemProto->SellPrice / bonusMultiplier));
117142

118-
ChatHandler(player->GetSession()).SendSysMessage(Acore::StringFormatFmt("|cff00FF00{}|cffFFFFFF recycled for |cff00FF0010%|cffFFFFFF extra.|r", itemProto->Name1));
119-
120143
return false;
121144
}
122145

@@ -158,7 +181,7 @@ void RecycledItemsWorldScript::OnUpdate(uint32 diff)
158181

159182
counter += diff;
160183

161-
uint32 updateFrequency = sConfigMgr->GetOption<uint32>("RecycledItems.UpdateFrequency", 5000);
184+
uint32 updateFrequency = sConfigMgr->GetOption<uint32>("RecycledItems.UpdateFrequency", 30000);
162185

163186
if (counter >= updateFrequency)
164187
{

0 commit comments

Comments
 (0)