From 941d1f29af17726e77298bfd28be96f8ac54a043 Mon Sep 17 00:00:00 2001 From: Astra Date: Sat, 3 Oct 2026 00:18:05 +0100 Subject: [PATCH 1/2] setstaticskill, next: target by part of a name, @me, #userid, ... Same rules as setskill, but only when one player matches. Bump to 1.2.4.b3-panorama5. --- .../src/command/Command.cs | 19 ++++++++++++------- .../src/jRandomSkills.cs | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/jRandomSkills - SRC Files/src/command/Command.cs b/jRandomSkills - SRC Files/src/command/Command.cs index 11db0db..c4f9bcf 100644 --- a/jRandomSkills - SRC Files/src/command/Command.cs +++ b/jRandomSkills - SRC Files/src/command/Command.cs @@ -228,6 +228,15 @@ namespace src.command Reply("error_setskill"); } + // zio: one player for commands that take a single target (css_setstaticskill, css_next): the + // css_setskill rules, so part of a name works, but only when it picks out one player. + private static CCSPlayerController? GetSinglePlayerTarget(CCSPlayerController? caller, string arg) + { + if (string.IsNullOrEmpty(arg)) return null; + var targets = GetSetSkillTargets(caller, arg, _ => true); + return targets.Count == 1 ? targets[0] : null; + } + // zio: css_setskill targets. An exact name or SteamID64 as before, CSS's own selectors // (@me, @all, @ct, @t, @alive, #userid, ...), or @random/@randomct/@randomt: one random // alive player, drawn only from players the skill's team restriction allows. @@ -574,9 +583,7 @@ namespace src.command { Debug.WriteToDebug($"Player {player?.PlayerName} used the css_setstaticskill {command.ArgString} command."); if (!string.IsNullOrEmpty(config.NormalCommands.SetStaticSkillCommand.Permissions) && !AdminManager.PlayerHasPermissions(player, config.NormalCommands.SetStaticSkillCommand.Permissions)) return; - var targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => p != null && p.IsValid - && (p.SteamID.ToString().Equals(command.GetArg(1), StringComparison.CurrentCultureIgnoreCase) - || p.PlayerName.Equals(command.GetArg(1), StringComparison.OrdinalIgnoreCase))); + var targetPlayer = GetSinglePlayerTarget(player, command.GetArg(1)); if (command.ArgCount < 2) { @@ -723,10 +730,8 @@ namespace src.command if (!string.IsNullOrEmpty(playerString)) { - targetPlayer = Utilities.GetPlayers().FirstOrDefault(p => p != null && p.IsValid - && (p.SteamID.ToString().Equals(playerString, StringComparison.CurrentCultureIgnoreCase) - || p.PlayerName.Equals(playerString, StringComparison.OrdinalIgnoreCase))); - + targetPlayer = GetSinglePlayerTarget(player, playerString); + if (targetPlayer == null) { if (player == null) diff --git a/jRandomSkills - SRC Files/src/jRandomSkills.cs b/jRandomSkills - SRC Files/src/jRandomSkills.cs index 48523e6..0053b3e 100644 --- a/jRandomSkills - SRC Files/src/jRandomSkills.cs +++ b/jRandomSkills - SRC Files/src/jRandomSkills.cs @@ -44,7 +44,7 @@ namespace src public override string ModuleName => "[CS2] [ jRandomSkills ]"; public override string ModuleAuthor => "D3X (Original), Juzlus (Modifier), ByDexterTR (Contributor)"; public override string ModuleDescription => "Plugin adds random skills every round for CS2 by D3X. Modified by Juzlus."; - public override string ModuleVersion => "1.2.4.b3-panorama4"; + public override string ModuleVersion => "1.2.4.b3-panorama5"; public override void Load(bool hotReload) { From df4f39ffd397b380e64a38c671119f28cb48aa24 Mon Sep 17 00:00:00 2001 From: Astra Date: Sun, 4 Oct 2026 18:34:13 +0100 Subject: [PATCH 2/2] release.sh: read the Forgejo token from ../../.forgejo-token when FORGEJO_TOKEN isn't set --- release.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/release.sh b/release.sh index c02fb80..9b76855 100755 --- a/release.sh +++ b/release.sh @@ -29,8 +29,13 @@ set -euo pipefail FORGEJO_URL="https://git.zio.sh" OWNER="cs2" REPO="jRandomSkills" -# Placeholder - replace, or set FORGEJO_TOKEN in the environment instead. Needs write:repository. -# Only uploading needs it; downloading from the public repo doesn't. Don't commit a real token. +# Needs write:repository. Only uploading needs it; downloading from the public repo doesn't. From the +# environment, or else from .forgejo-token in the cs2/ folder above every plugin (outside their +# repos, mode 600). Don't commit a real token. +TOKEN_FILE="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/../../.forgejo-token" +if [[ -z "${FORGEJO_TOKEN:-}" && -r "$TOKEN_FILE" ]]; then + FORGEJO_TOKEN="$(tr -d '[:space:]' < "$TOKEN_FILE")" +fi FORGEJO_TOKEN="${FORGEJO_TOKEN:-CHANGE_ME_FORGEJO_TOKEN}" # CS2 client used to compile the Panorama layouts, and the Workshop Tools addon compiled into. @@ -60,7 +65,7 @@ if [[ -z "$TAG" ]]; then exit 1 fi if [[ "$FORGEJO_TOKEN" == "CHANGE_ME_FORGEJO_TOKEN" ]]; then - echo "Set FORGEJO_TOKEN (edit release.sh or export it) first." >&2 + echo "Set FORGEJO_TOKEN (export it, or put it in $TOKEN_FILE) first." >&2 exit 1 fi