Core/AuctionHouse: Add separate auction house throttle period for requests from auction house addons tainting default ui

Port From (https://github.com/TrinityCore/TrinityCore/commit/fb0a29131d30e15d8d323271490069860580817d)
This commit is contained in:
hondacrx
2020-04-29 14:24:17 -04:00
parent dc0867ca8b
commit e31ca45d54
6 changed files with 41 additions and 27 deletions
+2 -1
View File
@@ -1047,9 +1047,10 @@ namespace Framework.Constants
ArenaWinRatingModifier2, ArenaWinRatingModifier2,
ArenaLoseRatingModifier, ArenaLoseRatingModifier,
ArenaMatchmakerRatingModifier, ArenaMatchmakerRatingModifier,
AuctionGetallDelay,
AuctionLevelReq, AuctionLevelReq,
AuctionReplicateDelay,
AuctionSearchDelay, AuctionSearchDelay,
AuctionTaintedSearchDelay,
AutoBroadcast, AutoBroadcast,
AutoBroadcastCenter, AutoBroadcastCenter,
AutoBroadcastInterval, AutoBroadcastInterval,
+4 -5
View File
@@ -34,7 +34,6 @@ namespace Game
{ {
public class AuctionManager : Singleton<AuctionManager> public class AuctionManager : Singleton<AuctionManager>
{ {
const int AH_MINIMUM_DEPOSIT = 100;
const int MIN_AUCTION_TIME = 12 * Time.Hour; const int MIN_AUCTION_TIME = 12 * Time.Hour;
AuctionHouseObject mHordeAuctions; AuctionHouseObject mHordeAuctions;
@@ -367,7 +366,7 @@ namespace Game
player.ModifyMoney(-(long)totaldeposit); player.ModifyMoney(-(long)totaldeposit);
} }
void UpdatePendingAuctions() public void UpdatePendingAuctions()
{ {
foreach (var pair in _pendingAuctionsByPlayer) foreach (var pair in _pendingAuctionsByPlayer)
{ {
@@ -429,7 +428,7 @@ namespace Game
return ++_replicateIdGenerator; return ++_replicateIdGenerator;
} }
public AuctionThrottleResult CheckThrottle(Player player, AuctionCommand command = AuctionCommand.SellItem) public AuctionThrottleResult CheckThrottle(Player player, bool addonTainted, AuctionCommand command = AuctionCommand.SellItem)
{ {
DateTime now = GameTime.GetGameTimeSteadyPoint(); DateTime now = GameTime.GetGameTimeSteadyPoint();
@@ -452,7 +451,7 @@ namespace Game
if ((--throttleObject.QueriesRemaining) == 0) if ((--throttleObject.QueriesRemaining) == 0)
return new AuctionThrottleResult(throttleObject.PeriodEnd - now, false); return new AuctionThrottleResult(throttleObject.PeriodEnd - now, false);
else else
return new AuctionThrottleResult(TimeSpan.FromMilliseconds(WorldConfig.GetIntValue(WorldCfg.AuctionSearchDelay)), false); return new AuctionThrottleResult(TimeSpan.FromMilliseconds(WorldConfig.GetIntValue(addonTainted ? WorldCfg.AuctionTaintedSearchDelay : WorldCfg.AuctionSearchDelay)), false);
} }
public AuctionHouseRecord GetAuctionHouseEntry(uint factionTemplateId) public AuctionHouseRecord GetAuctionHouseEntry(uint factionTemplateId)
@@ -1073,7 +1072,7 @@ namespace Game
if (throttleData == null) if (throttleData == null)
{ {
throttleData = new PlayerReplicateThrottleData(); throttleData = new PlayerReplicateThrottleData();
throttleData.NextAllowedReplication = curTime + TimeSpan.FromSeconds(WorldConfig.GetIntValue(WorldCfg.AuctionGetallDelay)); throttleData.NextAllowedReplication = curTime + TimeSpan.FromSeconds(WorldConfig.GetIntValue(WorldCfg.AuctionReplicateDelay));
throttleData.Global = Global.AuctionHouseMgr.GenerateReplicationId(); throttleData.Global = Global.AuctionHouseMgr.GenerateReplicationId();
} }
else else
+14 -14
View File
@@ -34,7 +34,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionBrowseQuery)] [WorldPacketHandler(ClientOpcodes.AuctionBrowseQuery)]
void HandleAuctionBrowseQuery(AuctionBrowseQuery browseQuery) void HandleAuctionBrowseQuery(AuctionBrowseQuery browseQuery)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, browseQuery.TaintedBy.HasValue);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -90,7 +90,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionCancelCommoditiesPurchase)] [WorldPacketHandler(ClientOpcodes.AuctionCancelCommoditiesPurchase)]
void HandleAuctionCancelCommoditiesPurchase(AuctionCancelCommoditiesPurchase cancelCommoditiesPurchase) void HandleAuctionCancelCommoditiesPurchase(AuctionCancelCommoditiesPurchase cancelCommoditiesPurchase)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, AuctionCommand.PlaceBid); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, cancelCommoditiesPurchase.TaintedBy.HasValue, AuctionCommand.PlaceBid);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -112,7 +112,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionConfirmCommoditiesPurchase)] [WorldPacketHandler(ClientOpcodes.AuctionConfirmCommoditiesPurchase)]
void HandleAuctionConfirmCommoditiesPurchase(AuctionConfirmCommoditiesPurchase confirmCommoditiesPurchase) void HandleAuctionConfirmCommoditiesPurchase(AuctionConfirmCommoditiesPurchase confirmCommoditiesPurchase)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, AuctionCommand.PlaceBid); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, confirmCommoditiesPurchase.TaintedBy.HasValue, AuctionCommand.PlaceBid);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -168,7 +168,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionListBidderItems)] [WorldPacketHandler(ClientOpcodes.AuctionListBidderItems)]
void HandleAuctionListBidderItems(AuctionListBidderItems listBidderItems) void HandleAuctionListBidderItems(AuctionListBidderItems listBidderItems)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listBidderItems.TaintedBy.HasValue);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -196,7 +196,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionListBucketsByBucketKeys)] [WorldPacketHandler(ClientOpcodes.AuctionListBucketsByBucketKeys)]
void HandleAuctionListBucketsByBucketKeys(AuctionListBucketsByBucketKeys listBucketsByBucketKeys) void HandleAuctionListBucketsByBucketKeys(AuctionListBucketsByBucketKeys listBucketsByBucketKeys)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listBucketsByBucketKeys.TaintedBy.HasValue);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -227,7 +227,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionListItemsByBucketKey)] [WorldPacketHandler(ClientOpcodes.AuctionListItemsByBucketKey)]
void HandleAuctionListItemsByBucketKey(AuctionListItemsByBucketKey listItemsByBucketKey) void HandleAuctionListItemsByBucketKey(AuctionListItemsByBucketKey listItemsByBucketKey)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listItemsByBucketKey.TaintedBy.HasValue);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -259,7 +259,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionListItemsByItemId)] [WorldPacketHandler(ClientOpcodes.AuctionListItemsByItemId)]
void HandleAuctionListItemsByItemID(AuctionListItemsByItemID listItemsByItemID) void HandleAuctionListItemsByItemID(AuctionListItemsByItemID listItemsByItemID)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listItemsByItemID.TaintedBy.HasValue);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -291,7 +291,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionListOwnerItems)] [WorldPacketHandler(ClientOpcodes.AuctionListOwnerItems)]
void HandleAuctionListOwnerItems(AuctionListOwnerItems listOwnerItems) void HandleAuctionListOwnerItems(AuctionListOwnerItems listOwnerItems)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listOwnerItems.TaintedBy.HasValue);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -318,7 +318,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionPlaceBid)] [WorldPacketHandler(ClientOpcodes.AuctionPlaceBid)]
void HandleAuctionPlaceBid(AuctionPlaceBid placeBid) void HandleAuctionPlaceBid(AuctionPlaceBid placeBid)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, AuctionCommand.PlaceBid); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, placeBid.TaintedBy.HasValue, AuctionCommand.PlaceBid);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -448,7 +448,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionRemoveItem)] [WorldPacketHandler(ClientOpcodes.AuctionRemoveItem)]
void HandleAuctionRemoveItem(AuctionRemoveItem removeItem) void HandleAuctionRemoveItem(AuctionRemoveItem removeItem)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, AuctionCommand.Cancel); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, removeItem.TaintedBy.HasValue, AuctionCommand.Cancel);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -540,7 +540,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionSellCommodity)] [WorldPacketHandler(ClientOpcodes.AuctionSellCommodity)]
void HandleAuctionSellCommodity(AuctionSellCommodity sellCommodity) void HandleAuctionSellCommodity(AuctionSellCommodity sellCommodity)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, AuctionCommand.SellItem); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, sellCommodity.TaintedBy.HasValue, AuctionCommand.SellItem);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -753,7 +753,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionSellItem)] [WorldPacketHandler(ClientOpcodes.AuctionSellItem)]
void HandleAuctionSellItem(AuctionSellItem sellItem) void HandleAuctionSellItem(AuctionSellItem sellItem)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, AuctionCommand.SellItem); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, sellItem.TaintedBy.HasValue, AuctionCommand.SellItem);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -899,7 +899,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionSetFavoriteItem)] [WorldPacketHandler(ClientOpcodes.AuctionSetFavoriteItem)]
void HandleAuctionSetFavoriteItem(AuctionSetFavoriteItem setFavoriteItem) void HandleAuctionSetFavoriteItem(AuctionSetFavoriteItem setFavoriteItem)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, false);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
@@ -928,7 +928,7 @@ namespace Game
[WorldPacketHandler(ClientOpcodes.AuctionStartCommoditiesPurchase)] [WorldPacketHandler(ClientOpcodes.AuctionStartCommoditiesPurchase)]
void HandleAuctionStartCommoditiesPurchase(AuctionStartCommoditiesPurchase startCommoditiesPurchase) void HandleAuctionStartCommoditiesPurchase(AuctionStartCommoditiesPurchase startCommoditiesPurchase)
{ {
AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, AuctionCommand.PlaceBid); AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, startCommoditiesPurchase.TaintedBy.HasValue, AuctionCommand.PlaceBid);
if (throttle.Throttled) if (throttle.Throttled)
return; return;
+7 -1
View File
@@ -209,13 +209,19 @@ namespace Game
Values[WorldCfg.AddonChannel] = GetDefaultValue("AddonChannel", true); Values[WorldCfg.AddonChannel] = GetDefaultValue("AddonChannel", true);
Values[WorldCfg.CleanCharacterDb] = GetDefaultValue("CleanCharacterDB", false); Values[WorldCfg.CleanCharacterDb] = GetDefaultValue("CleanCharacterDB", false);
Values[WorldCfg.PersistentCharacterCleanFlags] = GetDefaultValue("PersistentCharacterCleanFlags", 0); Values[WorldCfg.PersistentCharacterCleanFlags] = GetDefaultValue("PersistentCharacterCleanFlags", 0);
Values[WorldCfg.AuctionGetallDelay] = GetDefaultValue("Auction.GetAllScanDelay", 900); Values[WorldCfg.AuctionReplicateDelay] = GetDefaultValue("Auction.ReplicateItemsCooldown", 900);
Values[WorldCfg.AuctionSearchDelay] = GetDefaultValue("Auction.SearchDelay", 300); Values[WorldCfg.AuctionSearchDelay] = GetDefaultValue("Auction.SearchDelay", 300);
if ((int)Values[WorldCfg.AuctionSearchDelay] < 100 || (int)Values[WorldCfg.AuctionSearchDelay] > 10000) if ((int)Values[WorldCfg.AuctionSearchDelay] < 100 || (int)Values[WorldCfg.AuctionSearchDelay] > 10000)
{ {
Log.outError(LogFilter.ServerLoading, "Auction.SearchDelay ({0}) must be between 100 and 10000. Using default of 300ms", Values[WorldCfg.AuctionSearchDelay]); Log.outError(LogFilter.ServerLoading, "Auction.SearchDelay ({0}) must be between 100 and 10000. Using default of 300ms", Values[WorldCfg.AuctionSearchDelay]);
Values[WorldCfg.AuctionSearchDelay] = 300; Values[WorldCfg.AuctionSearchDelay] = 300;
} }
Values[WorldCfg.AuctionTaintedSearchDelay] = GetDefaultValue("Auction.TaintedSearchDelay", 3000);
if ((int)Values[WorldCfg.AuctionTaintedSearchDelay] < 100 || (int)Values[WorldCfg.AuctionTaintedSearchDelay] > 10000)
{
Log.outError(LogFilter.ServerLoading, $"Auction.TaintedSearchDelay ({Values[WorldCfg.AuctionTaintedSearchDelay]}) must be between 100 and 10000. Using default of 3s");
Values[WorldCfg.AuctionTaintedSearchDelay] = 3000;
}
Values[WorldCfg.ChatChannelLevelReq] = GetDefaultValue("ChatLevelReq.Channel", 1); Values[WorldCfg.ChatChannelLevelReq] = GetDefaultValue("ChatLevelReq.Channel", 1);
Values[WorldCfg.ChatWhisperLevelReq] = GetDefaultValue("ChatLevelReq.Whisper", 1); Values[WorldCfg.ChatWhisperLevelReq] = GetDefaultValue("ChatLevelReq.Whisper", 1);
Values[WorldCfg.ChatEmoteLevelReq] = GetDefaultValue("ChatLevelReq.Emote", 1); Values[WorldCfg.ChatEmoteLevelReq] = GetDefaultValue("ChatLevelReq.Emote", 1);
+1 -1
View File
@@ -1188,7 +1188,7 @@ namespace Game
{ {
m_timers[WorldTimers.AuctionsPending].Reset(); m_timers[WorldTimers.AuctionsPending].Reset();
//Global.AuctionMgr.UpdatePendingAuctions(); Global.AuctionHouseMgr.UpdatePendingAuctions();
} }
if (m_timers[WorldTimers.Blackmarket].Passed()) if (m_timers[WorldTimers.Blackmarket].Passed())
+13 -5
View File
@@ -490,13 +490,12 @@ CleanCharacterDB = 0
PersistentCharacterCleanFlags = 0 PersistentCharacterCleanFlags = 0
# #
# Auction.GetAllScanDelay # Auction.ReplicateItemsCooldown
# Description: Sets the minimum time in seconds, a single player character can perform a getall scan. # Description: Sets the minimum time in seconds, a single player character can perform a complete auction house scan.
# The value is only held in memory so a server restart will clear it. # The value is only held in memory so a server restart will clear it.
# Setting this to zero, will disable GetAll functions completely. # Default: 900 - (Replicate scan limited to once every 15mins per player character)
# Default: 900 - (GetAll scan limited to once every 15mins per player character)
Auction.GetAllScanDelay = 900 Auction.ReplicateItemsCooldown = 900
# #
# Auction.SearchDelay # Auction.SearchDelay
@@ -507,6 +506,15 @@ Auction.GetAllScanDelay = 900
Auction.SearchDelay = 300 Auction.SearchDelay = 300
#
# Auction.TaintedSearchDelay
# Description: Sets the minimum time in milliseconds (seconds x 1000), that the client must wait between
# auction search operations if auction house addon tainted lua environment. This can be increased
# if somehow Auction House activity is causing too much load.
# Default: 3000 - (Time delay between auction searches set to 3secs)
Auction.TaintedSearchDelay = 3000
# #
################################################################################################### ###################################################################################################