More tweaks

This commit is contained in:
MSWS
2024-08-03 07:43:26 -07:00
parent 8d989e22a8
commit e0d0e3452e
6 changed files with 72 additions and 4 deletions

View File

@@ -46,7 +46,8 @@ public class SpeedrunDayLocale() : SoloDayLocale("Speedrunners",
return new SimpleView {
{
PREFIX, $"Round #{ChatColors.Yellow}{round} begins! The slowest",
PREFIX,
$"Round {ChatColors.Yellow}#{round}{ChatColors.Default} begins! The slowest",
eliminationCount, "players to reach the goal will be eliminated!"
},
SimpleView.NEWLINE,
@@ -66,6 +67,12 @@ public class SpeedrunDayLocale() : SoloDayLocale("Speedrunners",
};
}
public IView RunnerReassigned(CCSPlayerController player) {
return new SimpleView {
PREFIX, "The speedrunner left, so", player, "is now the speedrunner!"
};
}
public IView PlayerTime(CCSPlayerController player, int position,
float time) {
var place = position switch {

View File

@@ -0,0 +1,50 @@
using CounterStrikeSharp.API.Core;
using Jailbreak.Public.Extensions;
using Jailbreak.Public.Utils;
namespace Jailbreak.Debug.Subcommands;
public class Color(IServiceProvider services) : AbstractCommand(services) {
public override void OnCommand(CCSPlayerController? executor,
WrappedInfo info) {
if (info.ArgCount == 1 || executor == null) {
info.ReplyToCommand("css_color [<alpha>| [red] [green] [blue]]");
return;
}
var alpha = 255;
var red = 255;
var green = 255;
var blue = 255;
switch (info.ArgCount) {
case 2:
int.TryParse(info.GetArg(1), out alpha);
break;
case <= 4:
info.ReplyToCommand("Invalid number of arguments.");
break;
default: {
var currentColor = executor.GetColor();
if (currentColor == null) {
info.ReplyToCommand("Failed to get color.");
return;
}
red = currentColor.Value.R;
green = currentColor.Value.G;
blue = currentColor.Value.B;
break;
}
}
if (info.ArgCount > 3) {
int.TryParse(info.GetArg(info.ArgCount - 3), out red);
int.TryParse(info.GetArg(info.ArgCount - 2), out green);
int.TryParse(info.GetArg(info.ArgCount - 1), out blue);
}
executor.SetColor(System.Drawing.Color.FromArgb(alpha, red, green, blue));
executor.PrintToChat($"Color set to {alpha} {red} {green} {blue}");
}
}

View File

@@ -18,7 +18,7 @@ public class BulletForBullet : TeleportingRequest {
];
private static readonly string[] GUN_NAMES = [
"Desert Eagle", "USP-S", "Tec9", "CZ75", "Scout", "Nova"
"Desert Eagle", "USP-S", "Tec9", "Scout", "Nova"
];
private readonly ChatMenu chatMenu;

View File

@@ -136,7 +136,7 @@ public class SpeedrunDay(BasePlugin plugin, IServiceProvider provider)
base.Setup();
foreach (var player in PlayerUtil.GetAlive()) {
player.SetColor(Color.FromArgb(65, 255, 255, 255));
player.SetColor(Color.FromArgb(100, 255, 255, 255));
player.RemoveWeapons();
}
@@ -425,6 +425,10 @@ public class SpeedrunDay(BasePlugin plugin, IServiceProvider provider)
<= 4 => 1,
<= 8 => 2,
<= 12 => 3,
<= 20 => 4,
<= 30 => 5,
<= 40 => 8,
<= 64 => 12,
_ => 4
};
}

View File

@@ -126,6 +126,13 @@ public static class PlayerExtensions {
Utilities.SetStateChanged(pawn, "CBaseModelEntity", "m_clrRender");
}
public static Color? GetColor(this CCSPlayerController player) {
var pawn = player.PlayerPawn.Value;
if (!player.IsReal() || pawn == null) return null;
return pawn.Render;
}
public static CBasePlayerWeapon?
GetWeaponBase(this CCSPlayerController player, string designerName) {
return player.PlayerPawn.Value?.WeaponServices?.MyWeapons

View File

@@ -146,7 +146,7 @@ public abstract class AbstractSpecialDay(BasePlugin plugin,
spawnPositions = getAtLeastRandom(PlayerUtil.GetAlive().Count());
break;
case SpecialDaySettings.TeleportType.RANDOM_STACKED:
spawnPositions = getAtLeastRandom(1);
spawnPositions = [getAtLeastRandom(1).First()];
break;
default:
return;