diff --git a/CTA/CustomTeamAssigner/CustomRoles.cs b/CTA/CustomTeamAssigner/CustomRoles.cs index 1f6ecfb8c..a5e87fe8c 100644 --- a/CTA/CustomTeamAssigner/CustomRoles.cs +++ b/CTA/CustomTeamAssigner/CustomRoles.cs @@ -598,6 +598,7 @@ public enum CustomRoles Stressed, Swift, Sunglasses, + Talkative, Taskcounter, TaskMaster, Tiebreaker, diff --git a/CustomRoles.cs b/CustomRoles.cs index a5e87fe8c..2182b8bdd 100644 --- a/CustomRoles.cs +++ b/CustomRoles.cs @@ -609,6 +609,7 @@ public enum CustomRoles Undead, Underdog, Unlucky, + Urgent, Venom, Warden, // Ghost role Watcher, diff --git a/Main.cs b/Main.cs index bc43e7d6b..8369af047 100644 --- a/Main.cs +++ b/Main.cs @@ -675,6 +675,7 @@ public class Main : BasePlugin { CustomRoles.Listener, "#060270" }, { CustomRoles.Unbound, "#DFC57B" }, { CustomRoles.AntiTP, "#fcba03" }, + { CustomRoles.Urgent, "#D49255" }, { CustomRoles.Talkative, "#6ADEDE" }, { CustomRoles.Blessed, "#7bfbff" }, { CustomRoles.Hidden, "#E2EAF4" }, diff --git a/Modules/GameState.cs b/Modules/GameState.cs index 55c01d866..39c8c83f8 100644 --- a/Modules/GameState.cs +++ b/Modules/GameState.cs @@ -204,6 +204,9 @@ public class PlayerState(byte playerId) case CustomRoles.BananaMan when Main.IntroDestroyed && !SubRoles.Contains(CustomRoles.BananaMan): LateTask.New(() => Utils.RpcChangeSkin(Player, new()), 0.2f, log: false); break; + case CustomRoles.Urgent when !SubRoles.Contains(CustomRoles.Urgent): + Main.NumEmergencyMeetingsUsed[PlayerId]--; + break; } if (replaceAll) diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index 9905bc4ea..a2148809e 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -319,6 +319,7 @@ internal static class ChangeRoleSettings Main.DefaultImpostorVision = Main.RealOptionsData.GetFloat(FloatOptionNames.ImpostorLightMod); Main.LastNotifyNames = []; + Main.NumEmergencyMeetingsUsed = []; CheckForEndVotingPatch.EjectionText = string.Empty; @@ -331,41 +332,22 @@ internal static class ChangeRoleSettings Camouflage.BlockCamouflage = false; Camouflage.Init(); - - Main.NumEmergencyMeetingsUsed = Main.EnumeratePlayerControls().ToDictionary(x => x.PlayerId, _ => 0); - - if (AmongUsClient.Instance.AmHost) - { - string[] invalidColor = Main.EnumeratePlayerControls().Where(p => p.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= p.Data.DefaultOutfit.ColorId).Select(p => $"{p.name}").ToArray(); - - if (invalidColor.Length > 0) - { - string msg = GetString("Error.InvalidColor"); - Logger.SendInGame(msg, Color.yellow); - msg += "\n" + string.Join(",", invalidColor); - Utils.SendMessage(msg, importance: MessageImportance.Low); - Logger.Error(msg, "CoStartGame"); - } - } - + RoleResult = []; - foreach (PlayerControl target in Main.EnumeratePlayerControls()) - { - foreach (PlayerControl seer in Main.EnumeratePlayerControls()) - { - (byte, byte) pair = (target.PlayerId, seer.PlayerId); - Main.LastNotifyNames[pair] = target.name; - } - } - foreach (PlayerControl pc in Main.EnumeratePlayerControls()) { + foreach (PlayerControl seer in Main.EnumeratePlayerControls()) + { + (byte, byte) pair = (pc.PlayerId, seer.PlayerId); + Main.LastNotifyNames[pair] = pc.name; + } + int colorId = pc.Data.DefaultOutfit.ColorId; if (AmongUsClient.Instance.AmHost && Options.FormatNameMode.GetInt() == 1) { string colorName = Palette.GetColorName(colorId); - string formattedColorName = char.ToUpper(colorName[0]) + colorName.Substring(1).ToLower(); + string formattedColorName = char.ToUpper(colorName[0]) + colorName[1..].ToLower(); pc.RpcSetName(formattedColorName); } @@ -378,6 +360,7 @@ internal static class ChangeRoleSettings MapNames.Fungle => Options.ExtraKillCooldownOnFungle.GetFloat(), _ => 0f }; + Main.NumEmergencyMeetingsUsed[pc.PlayerId] = 0; ReportDeadBodyPatch.CanReport[pc.PlayerId] = true; ReportDeadBodyPatch.WaitReport[pc.PlayerId] = []; RoleResult[pc.PlayerId] = CustomRoles.NotAssigned; diff --git a/Resources/Lang/en_US.jsonc b/Resources/Lang/en_US.jsonc index 705879923..d026d2863 100644 --- a/Resources/Lang/en_US.jsonc +++ b/Resources/Lang/en_US.jsonc @@ -3832,6 +3832,9 @@ "TalkativeInfoLong": "(Add-ons):\\nAs the Talkative, if you send more messages in a meeting than the specified limit in the settings, you suicide.", "Talkative.MaxMessagesPerMeeting": "Max Messages Per Meeting", "Talkative.Died": "{0} talked too much and died.", + "Urgent": "Urgent", + "UrgentInfo": "You Have +1 Emergency Meeting", + "UrgentInfoLong": "(Add-ons):\\nAs the Urgent, you have an extra emergency meeting.", "TaskMaster": "Task Master", "TaskMasterInfo": "Auto-Completes 1 Task After Every Meeting", "TaskMasterInfoLong": "(Add-ons):\\nAs the Task Master, you automatically complete 1 task after every meeting.", diff --git a/Roles/Standard/Addons/Talkative.cs b/Roles/Standard/Addons/Common/Talkative.cs similarity index 100% rename from Roles/Standard/Addons/Talkative.cs rename to Roles/Standard/Addons/Common/Talkative.cs diff --git a/Roles/Standard/Addons/Common/Urgent.cs b/Roles/Standard/Addons/Common/Urgent.cs new file mode 100644 index 000000000..b8067dee8 --- /dev/null +++ b/Roles/Standard/Addons/Common/Urgent.cs @@ -0,0 +1,11 @@ +namespace EHR.Roles; + +public class Urgent : IAddon +{ + public AddonTypes Type => AddonTypes.Mixed; + + public void SetupCustomOption() + { + Options.SetupAdtRoleOptions(658075, CustomRoles.Urgent, canSetNum: true, teamSpawnOptions: true); + } +} \ No newline at end of file