diff options
author | Shauren <shauren.trinity@gmail.com> | 2020-04-23 14:03:17 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2020-04-23 14:03:17 +0200 |
commit | fb0a29131d30e15d8d323271490069860580817d (patch) | |
tree | 9e1b8f60607c63350318f9993ea36c766123316a /src | |
parent | 68c4e4a513a7c5623e2383cb2295a3367c558576 (diff) |
Core/AuctionHouse: Add separate auction house throttle period for requests from auction house addons tainting default ui
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 6 | ||||
-rw-r--r-- | src/server/game/AuctionHouse/AuctionHouseMgr.h | 2 | ||||
-rw-r--r-- | src/server/game/Handlers/AuctionHouseHandler.cpp | 28 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 8 | ||||
-rw-r--r-- | src/server/game/World/World.h | 3 | ||||
-rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 22 |
6 files changed, 42 insertions, 27 deletions
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index ca8691bb8ec..e6a33a15a07 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -811,7 +811,7 @@ uint32 AuctionHouseMgr::GenerateReplicationId() return ++_replicateIdGenerator; } -AuctionThrottleResult AuctionHouseMgr::CheckThrottle(Player* player, AuctionCommand command) +AuctionThrottleResult AuctionHouseMgr::CheckThrottle(Player* player, bool addonTainted, AuctionCommand command /*= AuctionCommand::SellItem*/) { std::chrono::steady_clock::time_point now = GameTime::GetGameTimeSteadyPoint(); auto itr = _playerThrottleObjects.emplace(std::piecewise_construct, std::forward_as_tuple(player->GetGUID()), std::forward_as_tuple()); @@ -830,7 +830,7 @@ AuctionThrottleResult AuctionHouseMgr::CheckThrottle(Player* player, AuctionComm if (!--itr.first->second.QueriesRemaining) return { std::chrono::duration_cast<Milliseconds>(itr.first->second.PeriodEnd - now), false }; else - return { Milliseconds(sWorld->getIntConfig(CONFIG_AUCTION_SEARCH_DELAY)), false }; + return { Milliseconds(sWorld->getIntConfig(addonTainted ? CONFIG_AUCTION_TAINTED_SEARCH_DELAY : CONFIG_AUCTION_SEARCH_DELAY)), false }; } AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTemplateId, uint32* houseId) @@ -1503,7 +1503,7 @@ void AuctionHouseObject::BuildReplicate(WorldPackets::AuctionHouse::AuctionRepli else { throttleItr = _replicateThrottleMap.emplace(player->GetGUID(), PlayerReplicateThrottleData{}).first; - throttleItr->second.NextAllowedReplication = curTime + Seconds(sWorld->getIntConfig(CONFIG_AUCTION_GETALL_DELAY)); + throttleItr->second.NextAllowedReplication = curTime + Seconds(sWorld->getIntConfig(CONFIG_AUCTION_REPLICATE_DELAY)); throttleItr->second.Global = sAuctionMgr->GenerateReplicationId(); } diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index 9381b90ce5a..22f9dce7c7f 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -380,7 +380,7 @@ class TC_GAME_API AuctionHouseMgr uint32 GenerateReplicationId(); - AuctionThrottleResult CheckThrottle(Player* player, AuctionCommand command = AuctionCommand::SellItem); + AuctionThrottleResult CheckThrottle(Player* player, bool addonTainted, AuctionCommand command = AuctionCommand::SellItem); private: diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 593405627c2..e4ccc62f5dc 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -37,7 +37,7 @@ void WorldSession::HandleAuctionBrowseQuery(WorldPackets::AuctionHouse::AuctionBrowseQuery& browseQuery) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, browseQuery.TaintedBy.is_initialized()); if (throttle.Throttled) return; @@ -99,7 +99,7 @@ void WorldSession::HandleAuctionBrowseQuery(WorldPackets::AuctionHouse::AuctionB void WorldSession::HandleAuctionCancelCommoditiesPurchase(WorldPackets::AuctionHouse::AuctionCancelCommoditiesPurchase& cancelCommoditiesPurchase) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, AuctionCommand::PlaceBid); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, cancelCommoditiesPurchase.TaintedBy.is_initialized(), AuctionCommand::PlaceBid); if (throttle.Throttled) return; @@ -121,7 +121,7 @@ void WorldSession::HandleAuctionCancelCommoditiesPurchase(WorldPackets::AuctionH void WorldSession::HandleAuctionConfirmCommoditiesPurchase(WorldPackets::AuctionHouse::AuctionConfirmCommoditiesPurchase& confirmCommoditiesPurchase) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, AuctionCommand::PlaceBid); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, confirmCommoditiesPurchase.TaintedBy.is_initialized(), AuctionCommand::PlaceBid); if (throttle.Throttled) return; @@ -175,7 +175,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPackets::AuctionHouse::AuctionH void WorldSession::HandleAuctionListBidderItems(WorldPackets::AuctionHouse::AuctionListBidderItems& listBidderItems) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listBidderItems.TaintedBy.is_initialized()); if (throttle.Throttled) return; @@ -202,7 +202,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPackets::AuctionHouse::Auct void WorldSession::HandleAuctionListBucketsByBucketKeys(WorldPackets::AuctionHouse::AuctionListBucketsByBucketKeys& listBucketsByBucketKeys) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listBucketsByBucketKeys.TaintedBy.is_initialized()); if (throttle.Throttled) return; @@ -233,7 +233,7 @@ void WorldSession::HandleAuctionListBucketsByBucketKeys(WorldPackets::AuctionHou void WorldSession::HandleAuctionListItemsByBucketKey(WorldPackets::AuctionHouse::AuctionListItemsByBucketKey& listItemsByBucketKey) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listItemsByBucketKey.TaintedBy.is_initialized()); if (throttle.Throttled) return; @@ -264,7 +264,7 @@ void WorldSession::HandleAuctionListItemsByBucketKey(WorldPackets::AuctionHouse: void WorldSession::HandleAuctionListItemsByItemID(WorldPackets::AuctionHouse::AuctionListItemsByItemID& listItemsByItemID) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listItemsByItemID.TaintedBy.is_initialized()); if (throttle.Throttled) return; @@ -296,7 +296,7 @@ void WorldSession::HandleAuctionListItemsByItemID(WorldPackets::AuctionHouse::Au //this void sends player info about his auctions void WorldSession::HandleAuctionListOwnerItems(WorldPackets::AuctionHouse::AuctionListOwnerItems& listOwnerItems) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, listOwnerItems.TaintedBy.is_initialized()); if (throttle.Throttled) return; @@ -323,7 +323,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPackets::AuctionHouse::Aucti // this function is called when client bids or buys out auction void WorldSession::HandleAuctionPlaceBid(WorldPackets::AuctionHouse::AuctionPlaceBid& placeBid) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, AuctionCommand::PlaceBid); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, placeBid.TaintedBy.is_initialized(), AuctionCommand::PlaceBid); if (throttle.Throttled) return; @@ -452,7 +452,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPackets::AuctionHouse::AuctionPlac void WorldSession::HandleAuctionRemoveItem(WorldPackets::AuctionHouse::AuctionRemoveItem& removeItem) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, AuctionCommand::Cancel); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, removeItem.TaintedBy.is_initialized(), AuctionCommand::Cancel); if (throttle.Throttled) return; @@ -543,7 +543,7 @@ void WorldSession::HandleAuctionReplicateItems(WorldPackets::AuctionHouse::Aucti void WorldSession::HandleAuctionSellCommodity(WorldPackets::AuctionHouse::AuctionSellCommodity& sellCommodity) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, AuctionCommand::SellItem); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, sellCommodity.TaintedBy.is_initialized(), AuctionCommand::SellItem); if (throttle.Throttled) return; @@ -755,7 +755,7 @@ void WorldSession::HandleAuctionSellCommodity(WorldPackets::AuctionHouse::Auctio void WorldSession::HandleAuctionSellItem(WorldPackets::AuctionHouse::AuctionSellItem& sellItem) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, AuctionCommand::SellItem); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, sellItem.TaintedBy.is_initialized(), AuctionCommand::SellItem); if (throttle.Throttled) return; @@ -903,7 +903,7 @@ void WorldSession::HandleAuctionSellItem(WorldPackets::AuctionHouse::AuctionSell void WorldSession::HandleAuctionSetFavoriteItem(WorldPackets::AuctionHouse::AuctionSetFavoriteItem& setFavoriteItem) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, false); if (throttle.Throttled) return; @@ -931,7 +931,7 @@ void WorldSession::HandleAuctionSetFavoriteItem(WorldPackets::AuctionHouse::Auct void WorldSession::HandleAuctionStartCommoditiesPurchase(WorldPackets::AuctionHouse::AuctionStartCommoditiesPurchase& startCommoditiesPurchase) { - AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, AuctionCommand::PlaceBid); + AuctionThrottleResult throttle = sAuctionMgr->CheckThrottle(_player, startCommoditiesPurchase.TaintedBy.is_initialized(), AuctionCommand::PlaceBid); if (throttle.Throttled) return; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 950a59d80fc..e1e71ce01e2 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -666,13 +666,19 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_ADDON_CHANNEL] = sConfigMgr->GetBoolDefault("AddonChannel", true); m_bool_configs[CONFIG_CLEAN_CHARACTER_DB] = sConfigMgr->GetBoolDefault("CleanCharacterDB", false); m_int_configs[CONFIG_PERSISTENT_CHARACTER_CLEAN_FLAGS] = sConfigMgr->GetIntDefault("PersistentCharacterCleanFlags", 0); - m_int_configs[CONFIG_AUCTION_GETALL_DELAY] = sConfigMgr->GetIntDefault("Auction.GetAllScanDelay", 900); + m_int_configs[CONFIG_AUCTION_REPLICATE_DELAY] = sConfigMgr->GetIntDefault("Auction.ReplicateItemsCooldown", 900); m_int_configs[CONFIG_AUCTION_SEARCH_DELAY] = sConfigMgr->GetIntDefault("Auction.SearchDelay", 300); if (m_int_configs[CONFIG_AUCTION_SEARCH_DELAY] < 100 || m_int_configs[CONFIG_AUCTION_SEARCH_DELAY] > 10000) { TC_LOG_ERROR("server.loading", "Auction.SearchDelay (%i) must be between 100 and 10000. Using default of 300ms", m_int_configs[CONFIG_AUCTION_SEARCH_DELAY]); m_int_configs[CONFIG_AUCTION_SEARCH_DELAY] = 300; } + m_int_configs[CONFIG_AUCTION_TAINTED_SEARCH_DELAY] = sConfigMgr->GetIntDefault("Auction.TaintedSearchDelay", 3000); + if (m_int_configs[CONFIG_AUCTION_TAINTED_SEARCH_DELAY] < 100 || m_int_configs[CONFIG_AUCTION_TAINTED_SEARCH_DELAY] > 10000) + { + TC_LOG_ERROR("server.loading", "Auction.TaintedSearchDelay (%i) must be between 100 and 10000. Using default of 3s", m_int_configs[CONFIG_AUCTION_SEARCH_DELAY]); + m_int_configs[CONFIG_AUCTION_TAINTED_SEARCH_DELAY] = 3000; + } m_int_configs[CONFIG_CHAT_CHANNEL_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Channel", 1); m_int_configs[CONFIG_CHAT_WHISPER_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Whisper", 1); m_int_configs[CONFIG_CHAT_EMOTE_LEVEL_REQ] = sConfigMgr->GetIntDefault("ChatLevelReq.Emote", 1); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 0384ce86174..18c684771fb 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -396,8 +396,9 @@ enum WorldIntConfigs CONFIG_CHARTER_COST_ARENA_5v5, CONFIG_NO_GRAY_AGGRO_ABOVE, CONFIG_NO_GRAY_AGGRO_BELOW, - CONFIG_AUCTION_GETALL_DELAY, + CONFIG_AUCTION_REPLICATE_DELAY, CONFIG_AUCTION_SEARCH_DELAY, + CONFIG_AUCTION_TAINTED_SEARCH_DELAY, CONFIG_TALENTS_INSPECTING, CONFIG_BLACKMARKET_MAXAUCTIONS, CONFIG_BLACKMARKET_UPDATE_PERIOD, diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 3432e0c0e75..b191e9858c2 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -515,13 +515,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 @@ -533,6 +532,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 + +# ################################################################################################### ################################################################################################### @@ -1248,7 +1256,7 @@ BirthdayTime = 1222964635 # # CacheDataQueries -# Description: Server caches data queries at startup. +# Description: Server caches data queries at startup. # Can be disabled if not enough memory is available. # Default: 1 - (Enabled) # 0 - (Disabled) @@ -1256,7 +1264,7 @@ BirthdayTime = 1222964635 # CacheDataQueries = 1 - + # # FeatureSystem.BpayStore.Enabled # Description: Not yet implemented |