From 772922aefd379f6ca463bdb206c992fb27f211b6 Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 23 Dec 2024 05:03:12 -0800 Subject: [PATCH] Final tweaks --- Jailbreak.sln | 2 +- mod/Gangs.BaseImpl/AbstractEnumCommand.cs | 2 +- mod/Gangs.Boostrap/Gangs.Boostrap.csproj | 2 +- mod/Gangs.SpecialDayColorPerk/SDColorCommand.cs | 7 +++++-- mod/Gangs.SpecialDayColorPerk/SDColorMenu.cs | 3 ++- .../Gangs.WardenPaintColorPerk.csproj} | 1 + .../WardenColorBootstrap.cs | 0 .../WardenColorCommand.cs | 6 ++++-- .../WardenPaintColor.cs | 0 .../WardenPaintColorMenu.cs | 6 ++++-- .../WardenPaintColorPerk.cs | 0 mod/Jailbreak.Warden/Jailbreak.Warden.csproj | 2 +- mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs | 9 ++++++++- 13 files changed, 28 insertions(+), 12 deletions(-) rename mod/{WardenPaintColorPerk/WardenPaintColorPerk.csproj => Gangs.WardenPaintColorPerk/Gangs.WardenPaintColorPerk.csproj} (89%) rename mod/{WardenPaintColorPerk => Gangs.WardenPaintColorPerk}/WardenColorBootstrap.cs (100%) rename mod/{WardenPaintColorPerk => Gangs.WardenPaintColorPerk}/WardenColorCommand.cs (83%) rename mod/{WardenPaintColorPerk => Gangs.WardenPaintColorPerk}/WardenPaintColor.cs (100%) rename mod/{WardenPaintColorPerk => Gangs.WardenPaintColorPerk}/WardenPaintColorMenu.cs (81%) rename mod/{WardenPaintColorPerk => Gangs.WardenPaintColorPerk}/WardenPaintColorPerk.cs (100%) diff --git a/Jailbreak.sln b/Jailbreak.sln index 9040ef3..ed1957b 100644 --- a/Jailbreak.sln +++ b/Jailbreak.sln @@ -66,7 +66,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gangs.WardenIconPerk", "mod EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gangs.SpecialIconPerk", "mod\Gangs.SpecialIconPerk\Gangs.SpecialIconPerk.csproj", "{7F4BCD17-658C-4928-9AC1-61EFDEABDF5C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WardenPaintColorPerk", "mod\WardenPaintColorPerk\WardenPaintColorPerk.csproj", "{71D8A1A7-EB94-485A-82CC-D2D5124FE690}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gangs.WardenPaintColorPerk", "mod\Gangs.WardenPaintColorPerk\Gangs.WardenPaintColorPerk.csproj", "{71D8A1A7-EB94-485A-82CC-D2D5124FE690}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/mod/Gangs.BaseImpl/AbstractEnumCommand.cs b/mod/Gangs.BaseImpl/AbstractEnumCommand.cs index 4128c6b..f93bdf4 100644 --- a/mod/Gangs.BaseImpl/AbstractEnumCommand.cs +++ b/mod/Gangs.BaseImpl/AbstractEnumCommand.cs @@ -119,7 +119,7 @@ public abstract class AbstractEnumCommand(IServiceProvider provider, await playerStats.SetForPlayer(executor, statId, val); executor.PrintToChat( - $"{localizer.Get(MSG.PREFIX)}Set your {ChatColors.BlueGrey + title}{ChatColors.Grey} to {formatItem(val)}."); + $"{localizer.Get(MSG.PREFIX)}Set your {title} to {formatItem(val)}."); return CommandResult.SUCCESS; } diff --git a/mod/Gangs.Boostrap/Gangs.Boostrap.csproj b/mod/Gangs.Boostrap/Gangs.Boostrap.csproj index cc29a96..cbd05a3 100644 --- a/mod/Gangs.Boostrap/Gangs.Boostrap.csproj +++ b/mod/Gangs.Boostrap/Gangs.Boostrap.csproj @@ -13,7 +13,7 @@ - + diff --git a/mod/Gangs.SpecialDayColorPerk/SDColorCommand.cs b/mod/Gangs.SpecialDayColorPerk/SDColorCommand.cs index 618d398..301f39f 100644 --- a/mod/Gangs.SpecialDayColorPerk/SDColorCommand.cs +++ b/mod/Gangs.SpecialDayColorPerk/SDColorCommand.cs @@ -1,4 +1,6 @@ -using Gangs.BombIconPerk; +using CounterStrikeSharp.API.Modules.Utils; +using Gangs.BaseImpl.Extensions; +using Gangs.BombIconPerk; using GangsAPI; using GangsAPI.Data; using GangsAPI.Data.Command; @@ -124,7 +126,8 @@ public class SDColorCommand(IServiceProvider provider) : ICommand { await gangChat.SendGangChat(player, gang, localizer.Get(MSG.GANG_THING_SET, "SD Color", - color.ToString().ToTitleCase())); + color.GetColor().GetChatColor() + color.ToString().ToTitleCase() + + ChatColors.Grey)); return CommandResult.SUCCESS; } } \ No newline at end of file diff --git a/mod/Gangs.SpecialDayColorPerk/SDColorMenu.cs b/mod/Gangs.SpecialDayColorPerk/SDColorMenu.cs index a390797..bd1fa84 100644 --- a/mod/Gangs.SpecialDayColorPerk/SDColorMenu.cs +++ b/mod/Gangs.SpecialDayColorPerk/SDColorMenu.cs @@ -22,6 +22,7 @@ public class SDColorMenu(IServiceProvider provider, SDColorData data) override protected string formatItem(SDColor item) { if (item == SDColor.RAINBOW) return IRainbowColorizer.RAINBOW; - return $"{item.GetColor().GetChatColor()}{item.ToString().ToTitleCase()}"; + return + $"{item.GetColor().GetChatColor()}{item.ToString().ToTitleCase()}{ChatColors.Grey}"; } } \ No newline at end of file diff --git a/mod/WardenPaintColorPerk/WardenPaintColorPerk.csproj b/mod/Gangs.WardenPaintColorPerk/Gangs.WardenPaintColorPerk.csproj similarity index 89% rename from mod/WardenPaintColorPerk/WardenPaintColorPerk.csproj rename to mod/Gangs.WardenPaintColorPerk/Gangs.WardenPaintColorPerk.csproj index 3cd1f42..d2d54a2 100644 --- a/mod/WardenPaintColorPerk/WardenPaintColorPerk.csproj +++ b/mod/Gangs.WardenPaintColorPerk/Gangs.WardenPaintColorPerk.csproj @@ -4,6 +4,7 @@ net8.0 enable enable + WardenPaintColorPerk diff --git a/mod/WardenPaintColorPerk/WardenColorBootstrap.cs b/mod/Gangs.WardenPaintColorPerk/WardenColorBootstrap.cs similarity index 100% rename from mod/WardenPaintColorPerk/WardenColorBootstrap.cs rename to mod/Gangs.WardenPaintColorPerk/WardenColorBootstrap.cs diff --git a/mod/WardenPaintColorPerk/WardenColorCommand.cs b/mod/Gangs.WardenPaintColorPerk/WardenColorCommand.cs similarity index 83% rename from mod/WardenPaintColorPerk/WardenColorCommand.cs rename to mod/Gangs.WardenPaintColorPerk/WardenColorCommand.cs index da95565..6767877 100644 --- a/mod/WardenPaintColorPerk/WardenColorCommand.cs +++ b/mod/Gangs.WardenPaintColorPerk/WardenColorCommand.cs @@ -1,4 +1,5 @@ -using Gangs.BaseImpl; +using CounterStrikeSharp.API.Modules.Utils; +using Gangs.BaseImpl; using Gangs.BaseImpl.Extensions; using GangsAPI.Data; using Jailbreak.Public.Extensions; @@ -23,6 +24,7 @@ public class WardenColorCommand(IServiceProvider provider) override protected string formatItem(WardenPaintColor item) { if (item == WardenPaintColor.RAINBOW) return IRainbowColorizer.RAINBOW; - return $"{item.GetColor().GetChatColor()}{item.ToString().ToTitleCase()}"; + return + $"{item.GetColor().GetChatColor()}{item.ToString().ToTitleCase()}{ChatColors.Grey}"; } } \ No newline at end of file diff --git a/mod/WardenPaintColorPerk/WardenPaintColor.cs b/mod/Gangs.WardenPaintColorPerk/WardenPaintColor.cs similarity index 100% rename from mod/WardenPaintColorPerk/WardenPaintColor.cs rename to mod/Gangs.WardenPaintColorPerk/WardenPaintColor.cs diff --git a/mod/WardenPaintColorPerk/WardenPaintColorMenu.cs b/mod/Gangs.WardenPaintColorPerk/WardenPaintColorMenu.cs similarity index 81% rename from mod/WardenPaintColorPerk/WardenPaintColorMenu.cs rename to mod/Gangs.WardenPaintColorPerk/WardenPaintColorMenu.cs index 4fd073c..cb8398d 100644 --- a/mod/WardenPaintColorPerk/WardenPaintColorMenu.cs +++ b/mod/Gangs.WardenPaintColorPerk/WardenPaintColorMenu.cs @@ -1,4 +1,5 @@ -using Gangs.BaseImpl; +using CounterStrikeSharp.API.Modules.Utils; +using Gangs.BaseImpl; using Gangs.BaseImpl.Extensions; using Jailbreak.Public.Extensions; using Jailbreak.Public.Mod.Rainbow; @@ -19,6 +20,7 @@ public class WardenPaintColorMenu(IServiceProvider provider, override protected string formatItem(WardenPaintColor item) { if (item == WardenPaintColor.RAINBOW) return IRainbowColorizer.RAINBOW; - return $"{item.GetColor().GetChatColor()}{item.ToString().ToTitleCase()}"; + return + $"{item.GetColor().GetChatColor()}{item.ToString().ToTitleCase()}{ChatColors.Grey}"; } } \ No newline at end of file diff --git a/mod/WardenPaintColorPerk/WardenPaintColorPerk.cs b/mod/Gangs.WardenPaintColorPerk/WardenPaintColorPerk.cs similarity index 100% rename from mod/WardenPaintColorPerk/WardenPaintColorPerk.cs rename to mod/Gangs.WardenPaintColorPerk/WardenPaintColorPerk.cs diff --git a/mod/Jailbreak.Warden/Jailbreak.Warden.csproj b/mod/Jailbreak.Warden/Jailbreak.Warden.csproj index 9cd791f..974868e 100644 --- a/mod/Jailbreak.Warden/Jailbreak.Warden.csproj +++ b/mod/Jailbreak.Warden/Jailbreak.Warden.csproj @@ -13,7 +13,7 @@ - + diff --git a/mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs b/mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs index 292c66b..fd8d990 100644 --- a/mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs +++ b/mod/Jailbreak.Warden/Paint/WardenPaintBehavior.cs @@ -26,6 +26,7 @@ public class WardenPaintBehavior(IWardenService wardenService, provider.GetService(); private WardenPaintColor?[] colors = new WardenPaintColor?[65]; + private bool[] fetched = new bool[65]; public void Start(BasePlugin basePlugin) { parent = basePlugin; @@ -34,7 +35,8 @@ public class WardenPaintBehavior(IWardenService wardenService, [GameEventHandler] public HookResult OnRoundStart(EventRoundStart ev, GameEventInfo info) { - colors = new WardenPaintColor?[65]; + colors = new WardenPaintColor?[65]; + fetched = new bool[65]; return HookResult.Continue; } @@ -83,6 +85,8 @@ public class WardenPaintBehavior(IWardenService wardenService, return color.Value.GetColor() ?? Color.White; } + if (fetched[player.Index]) return Color.White; + fetched[player.Index] = true; var wrapper = new PlayerWrapper(player); Task.Run(async () => { color = await fetchColor(wrapper); @@ -118,6 +122,9 @@ public class WardenPaintBehavior(IWardenService wardenService, var (_, available) = await gangStats.GetForGang(gang, WardenPaintColorPerk.WardenPaintColorPerk.STAT_ID); + if (playerColors == WardenPaintColor.RANDOM) + return playerColors | available; + return playerColors & available; }