Debugging Messages For AutoRTD

Added some debugging messages to chat so that I can view the state of the variable values at runtime
This commit is contained in:
Kaleb Schmenk
2025-04-05 15:34:02 -04:00
parent b7cf0af6c1
commit a28eb746a8
3 changed files with 28 additions and 0 deletions

View File

@@ -57,4 +57,13 @@ public class RTDLocale : IRTDLocale, ILanguage<Formatting.Languages.English> {
" credits!"
};
}
/// <summary>
/// Debug prints a message to chat. For testing purposes ONLY.
/// </summary>
/// <param name="message">Message to print to chat.</param>
/// <returns></returns>
public IView DebugPrintMessage(string message) {
return new SimpleView { PREFIX, message };
}
}

View File

@@ -5,6 +5,7 @@ using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Cvars;
using Jailbreak.Formatting.Base;
using Jailbreak.Formatting.Extensions;
using Jailbreak.Formatting.Views;
using Jailbreak.Formatting.Views.RTD;
@@ -90,7 +91,23 @@ public class AutoRTD(IRTDRewarder rewarder, IAutoRTDLocale locale,
var steam = executor.SteamID;
Task.Run(async () => {
var value = await cookie.Get(steam);
// Debugging value return from cookie.Get
if (value != null) {
rtdLocale.DebugPrintMessage($"Value was: {value}!").ToChat(executor);
} else {
rtdLocale.DebugPrintMessage($"Value was: null!").ToChat(executor);
}
var enable = value is not (null or "Y");
// Debugging enable value
if (enable != null) {
rtdLocale.DebugPrintMessage($"Enable was: {enable}!").ToChat(executor);
} else {
rtdLocale.DebugPrintMessage($"Enable was: null!").ToChat(executor);
}
await cookie.Set(steam, enable ? "Y" : "N");
await Server.NextFrameAsync(() => {
if (!executor.IsValid) return;

View File

@@ -10,4 +10,6 @@ public interface IRTDLocale {
public IView CannotRollYet();
public IView RollingDisabled();
public IView JackpotReward(CCSPlayerController winner, int credits);
public IView DebugPrintMessage(string message);
}