zio fork 1.8.2b-zio7: guardian rank tag, ranks on private messages
#rank/guardian shows as G, after the staff ranks so a staff rank wins. css_psay from a player
reads "(PM) [RANK] name: message" ("(PM) name: message" without a rank group); console's is
unchanged. New lang keys sa_psay_template and sa_psay_template_norank.
This commit is contained in:
parent
e2b6670c5a
commit
703893a908
5 changed files with 19 additions and 5 deletions
|
|
@ -22,7 +22,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
|||
public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)");
|
||||
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
|
||||
public override string ModuleAuthor => "daffyy";
|
||||
public override string ModuleVersion => "1.8.2b-zio6";
|
||||
public override string ModuleVersion => "1.8.2b-zio7";
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -128,9 +128,16 @@ public partial class CS2_SimpleAdmin
|
|||
var utf8BytesString = Encoding.UTF8.GetBytes(message);
|
||||
var utf8String = Encoding.UTF8.GetString(utf8BytesString);
|
||||
|
||||
// zio: from a player, "(PM) [RANK] name: message".
|
||||
var rank = caller == null ? null : Helper.GetStaffRankTag(caller);
|
||||
var line = caller == null || _localizer == null
|
||||
? $"({callerName}) {utf8String}".ReplaceColorTags()
|
||||
: rank == null
|
||||
? _localizer["sa_psay_template_norank", callerName, utf8String.Trim()]
|
||||
: _localizer["sa_psay_template", rank, callerName, utf8String.Trim()];
|
||||
playersToTarget.ForEach(player =>
|
||||
{
|
||||
player.PrintToChat($"({callerName}) {utf8String}".ReplaceColorTags());
|
||||
player.PrintToChat(line);
|
||||
});
|
||||
|
||||
command.ReplyToCommand($" Private message sent!");
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ internal static class Helper
|
|||
return string.Join(" ", parts);
|
||||
}
|
||||
|
||||
// zio: staff rank groups, highest first, and their chat abbreviations.
|
||||
// zio: rank groups, highest first, and their chat abbreviations. Guardian (VIP) is last, so a
|
||||
// staff rank wins.
|
||||
private static readonly (string Group, string Tag)[] StaffRanks =
|
||||
[
|
||||
("#rank/owner", "O"),
|
||||
|
|
@ -154,9 +155,10 @@ internal static class Helper
|
|||
("#rank/mod", "M"),
|
||||
("#rank/trialmod", "TM"),
|
||||
("#rank/helper", "H"),
|
||||
("#rank/guardian", "G"),
|
||||
];
|
||||
|
||||
// zio: the player's highest staff rank abbreviation, or null if they're in no rank group.
|
||||
// zio: the player's highest rank abbreviation, or null if they're in no rank group.
|
||||
internal static string? GetStaffRankTag(CCSPlayerController player)
|
||||
{
|
||||
var groups = AdminManager.GetPlayerAdminData(new SteamID(player.SteamID))?.Groups;
|
||||
|
|
|
|||
|
|
@ -146,6 +146,8 @@
|
|||
"sa_staffchat_template_player": "{default}>[{purple}STAFF{default}] {purple}{0}{default}: {purple}{1}{default}",
|
||||
"sa_staffsay_template": "[{lime}{0}{default}] {darkred}{1}{default}: {red}{2}{default}",
|
||||
"sa_staffsay_template_norank": "{darkred}{0}{default}: {red}{1}{default}",
|
||||
"sa_psay_template": "{default}(PM) [{lime}{0}{default}] {yellow}{1}{default}: {grey}{2}{default}",
|
||||
"sa_psay_template_norank": "{default}(PM) {yellow}{0}{default}: {grey}{1}{default}",
|
||||
"sa_adminchat_template_player": "{SILVER}(PLAYER) {lightred}{0}{default}: {lightred}{1}{default}",
|
||||
"sa_discord_log_command": "**{0}** issued command `{1}` on server `HOSTNAME`",
|
||||
"sa_menu_pluginsmanager_loaded": "{lime}Enabled {default}plugin {lime}{0}",
|
||||
|
|
|
|||
|
|
@ -15,12 +15,15 @@ from the `build-1.8.2b` tag). Changes, all marked `zio:` in the code:
|
|||
that share their IP, don't apply to them; a ban on their own SteamID still does. `@css/root`
|
||||
has it, as it has every `@css` flag.
|
||||
- Staff chat shows the sender's rank, from their highest `#rank/...` group (O, SA, A, TA, M, TM,
|
||||
H for helper): `@message` in team chat and `css_asay` read `>[STAFF][RANK] name: message`, and
|
||||
H for helper, G for guardian): `@message` in team chat and `css_asay` read
|
||||
`>[STAFF][RANK] name: message`, and
|
||||
`@message` in all chat and `css_say` from a player read `[RANK] name: message` (`name: message`
|
||||
if they have no rank group). A non-staff player's `@message` in team chat reads
|
||||
`>[STAFF] name: message`, all in purple. Console's `css_say`/`css_asay` are unchanged. New lang keys
|
||||
`sa_staffchat_template`, `sa_staffsay_template`, their `_norank` variants and
|
||||
`sa_staffchat_template_player`, in `lang/en.json` only.
|
||||
- `css_psay` from a player reads `(PM) [RANK] name: message` (`(PM) name: message` without a rank
|
||||
group); console's is unchanged. Lang keys `sa_psay_template` and `sa_psay_template_norank`.
|
||||
|
||||
Publish with `FORGEJO_TOKEN=... ./release.sh v<ModuleVersion>` (ModuleVersion is `1.8.2b-zioN`).
|
||||
It rebuilds from the committed source and uploads `SimpleAdmin-<tag>.tar.gz` to git.zio.sh
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue