From 5f8863e77abeb34944b5407eebd69b984c230f11 Mon Sep 17 00:00:00 2001 From: Ian Lucas Date: Sun, 20 Oct 2024 18:25:39 -0300 Subject: [PATCH] feat: add `invsim_ws_print_full_url` convar --- README.md | 6 ++++++ source/InventorySimulator/InventorySimulator.Commands.cs | 3 ++- source/InventorySimulator/InventorySimulator.State.cs | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8b22092..e22ea1a 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,12 @@ Submit a PR or open an issue if you happen to know a workaround for them. * **Type:** `int` * **Default:** `30` +#### `invsim_ws_print_full_url` ConVar + +* Whether print full URL when the player uses `!ws` command. +* **Type:** `bool` +* **Default:** `true` + #### `invsim_spraychanger_enabled` ConVar * Whether to change player vanilla spray if they have a graffiti equipped. diff --git a/source/InventorySimulator/InventorySimulator.Commands.cs b/source/InventorySimulator/InventorySimulator.Commands.cs index 30feee9..2cdb01d 100644 --- a/source/InventorySimulator/InventorySimulator.Commands.cs +++ b/source/InventorySimulator/InventorySimulator.Commands.cs @@ -14,7 +14,8 @@ public partial class InventorySimulator [ConsoleCommand("css_ws", "Refreshes player's inventory.")] public void OnWSCommand(CCSPlayerController? player, CommandInfo _) { - player?.PrintToChat(Localizer["invsim.announce", GetApiUrl()]); + var url = invsim_ws_print_full_url.Value ? GetApiUrl() : invsim_hostname.Value; + player?.PrintToChat(Localizer["invsim.announce", url]); if (!invsim_ws_enabled.Value || player == null) return; if (PlayerCooldownManager.TryGetValue(player.SteamID, out var timestamp)) diff --git a/source/InventorySimulator/InventorySimulator.State.cs b/source/InventorySimulator/InventorySimulator.State.cs index e45873d..d0b3c5a 100644 --- a/source/InventorySimulator/InventorySimulator.State.cs +++ b/source/InventorySimulator/InventorySimulator.State.cs @@ -16,6 +16,7 @@ public partial class InventorySimulator public readonly FakeConVar invsim_stattrak_ignore_bots = new("invsim_stattrak_ignore_bots", "Whether to ignore StatTrak increments for bot kills.", true); public readonly FakeConVar invsim_spraychanger_enabled = new("invsim_spraychanger_enabled", "Whether to change player vanilla spray if they have a graffiti equipped.", false); public readonly FakeConVar invsim_ws_enabled = new("invsim_ws_enabled", "Whether players can refresh their inventory using !ws.", false); + public readonly FakeConVar invsim_ws_print_full_url = new("invsim_ws_print_full_url", "Whether print full URL when the player uses !ws.", true); public readonly FakeConVar invsim_minmodels = new("invsim_minmodels", "Allows agents or use specific models for each team.", 0, flags: ConVarFlags.FCVAR_NONE, new RangeValidator(0, 2)); public readonly FakeConVar invsim_ws_cooldown = new("invsim_ws_cooldown", "Cooldown in seconds between player inventory refreshes.", 30); public readonly FakeConVar invsim_spray_cooldown = new("invsim_spray_cooldown", "Cooldown in seconds between player sprays.", 30);