Furtherfix ragfair modlimits (#724)

* Further fix to mod limit debug log

* Small improvements on FlagOfferForRemoval to correctly fix logging instead of FromSeconds using the unixtimestamp

---------

Co-authored-by: acidphantasm <acidphantasm@acidphantasm.com>
This commit is contained in:
acidphantasm
2026-01-06 05:52:48 -06:00
committed by GitHub
parent 4e4b608c08
commit 432dd2e733
2 changed files with 12 additions and 6 deletions
@@ -1025,18 +1025,24 @@ public class RagfairController(
} }
// Only reduce time to end if time remaining is greater than what we would set it to // Only reduce time to end if time remaining is greater than what we would set it to
var differenceInSeconds = playerOffer.EndTime - timeUtil.GetTimeStamp(); var now = timeUtil.GetTimeStamp();
if (differenceInSeconds > RagfairConfig.Sell.ExpireSeconds) var configExpireSeconds = RagfairConfig.Sell.ExpireSeconds;
var differenceInSeconds = playerOffer.EndTime - now;
if (differenceInSeconds > configExpireSeconds)
{ {
// `expireSeconds` Default is 71 seconds // `expireSeconds` Default is 71 seconds
var newEndTime = RagfairConfig.Sell.ExpireSeconds + timeUtil.GetTimeStamp(); // TODO: RagfairConfig.Sell.ExpireSeconds should not exist as it should use
// Globals.Configuration.RagFair.OfferDurationTimeInHourAfterRemove (the value actually used by client)
var newEndTime = configExpireSeconds + now;
playerOffer.EndTime = (long?)Math.Round((double)newEndTime); playerOffer.EndTime = (long?)Math.Round((double)newEndTime);
differenceInSeconds = configExpireSeconds;
} }
if (logger.IsLogEnabled(LogLevel.Debug)) if (logger.IsLogEnabled(LogLevel.Debug) && differenceInSeconds is { } remaining)
{ {
logger.Debug( logger.Debug(
$"Flagged player: {sessionId} offer: {offerId} for expiry in: {TimeSpan.FromSeconds(playerOffer.EndTime.Value).ToString()}" $"Flagged player: {sessionId} offer: {offerId} for expiry in: {TimeSpan.FromSeconds(remaining).ToString()}"
); );
} }
@@ -158,7 +158,7 @@ public class BotWeaponModLimitService(ISptLogger<BotWeaponModLimitService> logge
{ {
if (logger.IsLogEnabled(LogLevel.Debug)) if (logger.IsLogEnabled(LogLevel.Debug))
{ {
logger.Debug($"[{botRole}] {modType} limit reached! tried to add: {modTpl} but scope count is: {currentCount.Count}"); logger.Debug($"[{botRole}] {modType} limit reached! tried to add: {modTpl} but {modType} count is: {currentCount.Count}");
} }
return true; return true;