diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index 6913c2bf5..2cac0974c 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -1047,9 +1047,10 @@ namespace Framework.Constants ArenaWinRatingModifier2, ArenaLoseRatingModifier, ArenaMatchmakerRatingModifier, - AuctionGetallDelay, AuctionLevelReq, + AuctionReplicateDelay, AuctionSearchDelay, + AuctionTaintedSearchDelay, AutoBroadcast, AutoBroadcastCenter, AutoBroadcastInterval, diff --git a/Source/Game/AuctionHouse/AuctionManager.cs b/Source/Game/AuctionHouse/AuctionManager.cs index 0c7260349..cb648072b 100644 --- a/Source/Game/AuctionHouse/AuctionManager.cs +++ b/Source/Game/AuctionHouse/AuctionManager.cs @@ -34,7 +34,6 @@ namespace Game { public class AuctionManager : Singleton { - const int AH_MINIMUM_DEPOSIT = 100; const int MIN_AUCTION_TIME = 12 * Time.Hour; AuctionHouseObject mHordeAuctions; @@ -367,7 +366,7 @@ namespace Game player.ModifyMoney(-(long)totaldeposit); } - void UpdatePendingAuctions() + public void UpdatePendingAuctions() { foreach (var pair in _pendingAuctionsByPlayer) { @@ -429,7 +428,7 @@ namespace Game 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(); @@ -452,7 +451,7 @@ namespace Game if ((--throttleObject.QueriesRemaining) == 0) return new AuctionThrottleResult(throttleObject.PeriodEnd - now, false); 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) @@ -1073,7 +1072,7 @@ namespace Game if (throttleData == null) { 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(); } else diff --git a/Source/Game/Handlers/AuctionHandler.cs b/Source/Game/Handlers/AuctionHandler.cs index c7cd9e598..548192e30 100644 --- a/Source/Game/Handlers/AuctionHandler.cs +++ b/Source/Game/Handlers/AuctionHandler.cs @@ -34,7 +34,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionBrowseQuery)] void HandleAuctionBrowseQuery(AuctionBrowseQuery browseQuery) { - AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); + AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, browseQuery.TaintedBy.HasValue); if (throttle.Throttled) return; @@ -90,7 +90,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionCancelCommoditiesPurchase)] 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) return; @@ -112,7 +112,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionConfirmCommoditiesPurchase)] 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) return; @@ -168,7 +168,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionListBidderItems)] void HandleAuctionListBidderItems(AuctionListBidderItems listBidderItems) { - AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); + AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listBidderItems.TaintedBy.HasValue); if (throttle.Throttled) return; @@ -196,7 +196,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionListBucketsByBucketKeys)] void HandleAuctionListBucketsByBucketKeys(AuctionListBucketsByBucketKeys listBucketsByBucketKeys) { - AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); + AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listBucketsByBucketKeys.TaintedBy.HasValue); if (throttle.Throttled) return; @@ -227,7 +227,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionListItemsByBucketKey)] void HandleAuctionListItemsByBucketKey(AuctionListItemsByBucketKey listItemsByBucketKey) { - AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); + AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listItemsByBucketKey.TaintedBy.HasValue); if (throttle.Throttled) return; @@ -259,7 +259,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionListItemsByItemId)] void HandleAuctionListItemsByItemID(AuctionListItemsByItemID listItemsByItemID) { - AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); + AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listItemsByItemID.TaintedBy.HasValue); if (throttle.Throttled) return; @@ -291,7 +291,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionListOwnerItems)] void HandleAuctionListOwnerItems(AuctionListOwnerItems listOwnerItems) { - AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); + AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, listOwnerItems.TaintedBy.HasValue); if (throttle.Throttled) return; @@ -318,7 +318,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionPlaceBid)] 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) return; @@ -448,7 +448,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionRemoveItem)] 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) return; @@ -540,7 +540,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionSellCommodity)] 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) return; @@ -753,7 +753,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionSellItem)] 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) return; @@ -899,7 +899,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionSetFavoriteItem)] void HandleAuctionSetFavoriteItem(AuctionSetFavoriteItem setFavoriteItem) { - AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player); + AuctionThrottleResult throttle = Global.AuctionHouseMgr.CheckThrottle(_player, false); if (throttle.Throttled) return; @@ -928,7 +928,7 @@ namespace Game [WorldPacketHandler(ClientOpcodes.AuctionStartCommoditiesPurchase)] 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) return; diff --git a/Source/Game/Server/WorldConfig.cs b/Source/Game/Server/WorldConfig.cs index 457fb19e8..b5bc0e32e 100644 --- a/Source/Game/Server/WorldConfig.cs +++ b/Source/Game/Server/WorldConfig.cs @@ -209,13 +209,19 @@ namespace Game Values[WorldCfg.AddonChannel] = GetDefaultValue("AddonChannel", true); Values[WorldCfg.CleanCharacterDb] = GetDefaultValue("CleanCharacterDB", false); 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); 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]); 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.ChatWhisperLevelReq] = GetDefaultValue("ChatLevelReq.Whisper", 1); Values[WorldCfg.ChatEmoteLevelReq] = GetDefaultValue("ChatLevelReq.Emote", 1); diff --git a/Source/Game/Server/WorldManager.cs b/Source/Game/Server/WorldManager.cs index 3929c694d..37f1b3d20 100644 --- a/Source/Game/Server/WorldManager.cs +++ b/Source/Game/Server/WorldManager.cs @@ -1188,7 +1188,7 @@ namespace Game { m_timers[WorldTimers.AuctionsPending].Reset(); - //Global.AuctionMgr.UpdatePendingAuctions(); + Global.AuctionHouseMgr.UpdatePendingAuctions(); } if (m_timers[WorldTimers.Blackmarket].Passed()) diff --git a/Source/WorldServer/WorldServer.conf.dist b/Source/WorldServer/WorldServer.conf.dist index 7b9d60992..ad7ed5754 100644 --- a/Source/WorldServer/WorldServer.conf.dist +++ b/Source/WorldServer/WorldServer.conf.dist @@ -490,13 +490,12 @@ CleanCharacterDB = 0 PersistentCharacterCleanFlags = 0 # -# Auction.GetAllScanDelay -# Description: Sets the minimum time in seconds, a single player character can perform a getall scan. +# Auction.ReplicateItemsCooldown +# 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. -# Setting this to zero, will disable GetAll functions completely. -# Default: 900 - (GetAll scan limited to once every 15mins per player character) +# Default: 900 - (Replicate scan limited to once every 15mins per player character) -Auction.GetAllScanDelay = 900 +Auction.ReplicateItemsCooldown = 900 # # Auction.SearchDelay @@ -507,6 +506,15 @@ Auction.GetAllScanDelay = 900 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 + # ###################################################################################################