From ad57ec13b450a66e348f04c40230136d5e999b38 Mon Sep 17 00:00:00 2001 From: AconiteGodOfSWG Date: Wed, 13 Jan 2021 02:37:27 -0500 Subject: [PATCH] Add Configuration Support for Bazaar Auction Times --- .../src/shared/AuctionMarket.cpp | 15 ++++++++------ .../src/shared/ConfigCommodityServer.cpp | 14 +++++++------ .../src/shared/ConfigCommodityServer.h | 20 +++++++++++++++++-- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp index 328f189e..6f966f52 100644 --- a/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/AuctionMarket.cpp @@ -1426,6 +1426,9 @@ void AuctionMarket::AddImmediateAuction(const AddImmediateAuctionMessage &messag // force the expire timer to be 30 days after the auction timer has finished // The expire timer should be large to allow for time to sit in the stockroom before it is deleted. int expireTimer = auctionTimer + (ConfigCommodityServer::getMinutesVendorItemTimer() * 60); + // bazaar timers + int bazaarAuctionTimer = (ConfigCommodityServer::getMinutesBazaarAuctionTimer() * 60) + time(0); + int bazaarItemTimer = bazaarAuctionTimer + (ConfigCommodityServer::getMinutesBazaarItemTimer() * 60); if (message.GetFlags() & AUCTION_VENDOR_TRANSFER) { @@ -1481,11 +1484,11 @@ void AuctionMarket::AddImmediateAuction(const AddImmediateAuctionMessage &messag return; } } - // If this is not a player vendor, then use the values sent in from the message + // If this is not a player vendor, use bazaar settings for auction and expiration time else { - auctionTimer = message.GetAuctionTimer(); - expireTimer = message.GetExpireTimer(); + auctionTimer = bazaarAuctionTimer; + expireTimer = bazaarItemTimer; } // cannot use "relist" on an item bought as a vendor offer; @@ -1638,11 +1641,11 @@ void AuctionMarket::AddImmediateAuction(const AddImmediateAuctionMessage &messag return; } - // If this is not a player vendor, then use the values sent in from the message + // If this is not a player vendor, use bazaar settings for auction and expiration time if( !auctionLocation.IsVendorMarket() ) { - auctionTimer = message.GetAuctionTimer(); - expireTimer = message.GetExpireTimer(); + auctionTimer = bazaarAuctionTimer; + expireTimer = bazaarItemTimer; } static Unicode::String const emptyUnicodeString; diff --git a/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.cpp b/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.cpp index 8e73017b..46e3145a 100755 --- a/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.cpp +++ b/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.cpp @@ -54,13 +54,15 @@ void ConfigCommodityServer::install(void) KEY_INT (centralServerPort, 44456); KEY_STRING (centralServerAddress, "localhost"); KEY_INT (sleepTimePerFrameMs, 1); - KEY_INT (minutesActiveToUnaccessed, 7 * 24 * 60); - KEY_INT (minutesEmptyToEndangered, 7 * 24 * 60); - KEY_INT (minutesUnaccessedToEndangered, 7 * 24 * 60); - KEY_INT (minutesEndangeredToRemoved, 7 * 24 * 60); - KEY_INT (minutesVendorAuctionTimer, 30 * 24 * 60); - KEY_INT (minutesVendorItemTimer, 30 * 24 * 60); + KEY_INT (minutesActiveToUnaccessed, 10080); // 7 days + KEY_INT (minutesEmptyToEndangered, 10080); + KEY_INT (minutesUnaccessedToEndangered, 10080); + KEY_INT (minutesEndangeredToRemoved, 10080); + KEY_INT (minutesVendorAuctionTimer, 43200); // 30 days + KEY_INT (minutesVendorItemTimer, 43200); KEY_INT (maxAuctionsPerPage, 100); + KEY_INT (minutesBazaarAuctionTimer, 10080); + KEY_INT (minutesBazaarItemTimer, 10080); } //----------------------------------------------------------------------- diff --git a/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.h b/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.h index 9bdff873..d281e670 100755 --- a/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.h +++ b/engine/server/application/CommoditiesServer/src/shared/ConfigCommodityServer.h @@ -43,9 +43,11 @@ class ConfigCommodityServer int minutesEmptyToEndangered; int minutesUnaccessedToEndangered; int minutesEndangeredToRemoved; - int minutesVendorAuctionTimer; - int minutesVendorItemTimer; + int minutesVendorAuctionTimer; // max time an item is listed on a vendor + int minutesVendorItemTimer; // max time a vendor item is held in stockroom after it expires for pickup by the seller (auction time + item time) int maxAuctionsPerPage; + int minutesBazaarAuctionTimer; // max time an item is listed on bazaar + int minutesBazaarItemTimer; // max time a bazaar item is held by system after it expires for pickup by the seller (auction time + item time) }; static uint16 getCMServerServiceBindPort (); @@ -78,6 +80,8 @@ class ConfigCommodityServer static int getMinutesVendorAuctionTimer (); static int getMinutesVendorItemTimer (); static int getMaxAuctionsPerPage (); + static int getMinutesBazaarAuctionTimer (); + static int getMinutesBazaarItemTimer (); static void install (); static void remove (); @@ -296,4 +300,16 @@ inline int ConfigCommodityServer::getMaxAuctionsPerPage() return data->maxAuctionsPerPage; } +//----------------------------------------------------------------------- + +inline int ConfigCommodityServer::getMinutesBazaarAuctionTimer() { + return data->minutesBazaarAuctionTimer; +} + +//----------------------------------------------------------------------- + +inline int ConfigCommodityServer::getMinutesBazaarItemTimer() { + return data->minutesBazaarItemTimer; +} + #endif // _ConfigCommodityServer_H