diff --git a/Main.cs b/Main.cs index 56fea971d..33451a369 100644 --- a/Main.cs +++ b/Main.cs @@ -104,7 +104,7 @@ public class Main : BasePlugin public static Dictionary ShapeshiftTarget = []; public static bool VisibleTasksCount; public static string NickName = ""; - public static bool IntroDestroyed; + public static bool IntroDestroyed = true; public static float DefaultCrewmateVision; public static float DefaultImpostorVision; public static readonly bool IsAprilFools = DateTime.Now.Month == 4 && DateTime.Now.Day == 1; @@ -230,7 +230,7 @@ public class Main : BasePlugin foreach (PlayerControl pc in PlayerControl.AllPlayerControls) { - if (pc == null || pc.PlayerId >= 254 || !pc.IsAlive() || (pc.Data.Disconnected && (CoShowIntroPatch.IntroStarted || IntroDestroyed || GameStates.IsLobby)) || Pelican.IsEaten(pc.PlayerId)) continue; + if (pc == null || pc.PlayerId >= 254 || !pc.IsAlive() || (pc.Data.Disconnected && IntroDestroyed) || Pelican.IsEaten(pc.PlayerId)) continue; result[i++] = pc; } diff --git a/Modules/OptionHolder.cs b/Modules/OptionHolder.cs index da8dd42ab..290d66f43 100644 --- a/Modules/OptionHolder.cs +++ b/Modules/OptionHolder.cs @@ -681,6 +681,7 @@ public static class Options public static OptionItem StoreCompletedAchievementsOnEHRDatabase; public static OptionItem AllCrewRolesHaveVanillaColor; public static OptionItem MessageRpcSizeLimit; + public static OptionItem DraftMaxRolesPerPlayer; public static OptionItem ShowAntiBlackoutWarning; public static OptionItem AllowConsole; public static OptionItem NoGameEnd; @@ -2649,6 +2650,11 @@ public static class Options .SetGameMode(CustomGameMode.Standard) .SetColor(new Color32(193, 255, 209, byte.MaxValue)); + DraftMaxRolesPerPlayer = new IntegerOptionItem(19430, "DraftMaxRolesPerPlayer", new(1, 30, 1), 5, TabGroup.SystemSettings) + .SetHeader(true) + .SetGameMode(CustomGameMode.Standard) + .SetColor(new Color32(193, 255, 209, byte.MaxValue)); + new TextOptionItem(100029, "MenuTitle.Ghost", TabGroup.GameSettings) .SetGameMode(CustomGameMode.Standard) diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs index 5ea213996..87af24a81 100644 --- a/Patches/ChatCommandPatch.cs +++ b/Patches/ChatCommandPatch.cs @@ -963,13 +963,15 @@ internal static class ChatCommands allRoles.RemoveAll(x => x.IsNonNK()); allRoles.RemoveAll(x => x.IsCoven()); + int maxRolesPerPlayer = Options.DraftMaxRolesPerPlayer.GetInt(); + DraftRoles = allRoles - .Take(allPlayerIds.Length * 5) + .Take(allPlayerIds.Length * maxRolesPerPlayer) .CombineWith(impRoles, nkRoles, nnkRoles, covenRoles) .Shuffle() .Partition(allPlayerIds.Length) .Zip(allPlayerIds) - .ToDictionary(x => x.Second, x => x.First.Take(5).ToList()); + .ToDictionary(x => x.Second, x => x.First.Take(maxRolesPerPlayer).ToList()); Main.Instance.StartCoroutine(RepeatedlySendMessage()); return; @@ -989,7 +991,7 @@ internal static class ChatCommands messages.SendMultipleMessages(index == 0 ? SendOption.Reliable : SendOption.None); - yield return new WaitForSeconds(30f); + yield return new WaitForSeconds(20f); if (DraftResult.Count >= DraftRoles.Count || !GameStates.IsLobby || GameStates.InGame) yield break; } } @@ -1031,6 +1033,8 @@ internal static class ChatCommands CustomRoles role = roles[chosenIndex - 1]; DraftResult[player.PlayerId] = role; Utils.SendMessage(string.Format(GetString("DraftChosen"), role.ToColoredString()), player.PlayerId, GetString("DraftTitle")); + + if (DraftResult.Count >= DraftRoles.Count) Utils.SendMessage("\n", PlayerControl.LocalPlayer.PlayerId, GetString("EveryoneDrafted")); } private static void MuteCommand(PlayerControl player, string text, string[] args) diff --git a/Patches/MeetingHudPatch.cs b/Patches/MeetingHudPatch.cs index d69cbe013..baf0fc500 100644 --- a/Patches/MeetingHudPatch.cs +++ b/Patches/MeetingHudPatch.cs @@ -708,7 +708,7 @@ internal static class MeetingHudStartPatch roleDescMsgs.Add(new(sb.Append("").ToString(), pc.PlayerId, titleSb.ToString())); } - LateTask.New(() => roleDescMsgs.SendMultipleMessages(SendOption.None), 6f, "Send Role Descriptions Round 1"); + LateTask.New(() => roleDescMsgs.SendMultipleMessages(SendOption.None), 7f, "Send Role Descriptions Round 1"); } if (Options.MadmateSpawnMode.GetInt() == 2 && CustomRoles.Madmate.IsEnable() && MeetingStates.FirstMeeting) @@ -797,7 +797,7 @@ internal static class MeetingHudStartPatch } } - if (msgToSend.Count > 0) LateTask.New(() => msgToSend.Do(x => Utils.SendMessage(x.Text, x.SendTo, x.Title)), 6f, "Meeting Start Notify"); + if (msgToSend.Count > 0) LateTask.New(() => msgToSend.Do(x => Utils.SendMessage(x.Text, x.SendTo, x.Title)), 8f, "Meeting Start Notify"); Main.CyberStarDead.Clear(); Express.SpeedNormal.Clear(); @@ -934,8 +934,11 @@ internal static class MeetingHudStartPatch Logger.Info("The ship has " + (Options.SyncedButtonCount.GetFloat() - Options.UsedButtonCount) + " buttons left", "SyncButtonMode"); } - TemplateManager.SendTemplate("OnMeeting", noErr: true, sendOption: SendOption.None); - if (MeetingStates.FirstMeeting) TemplateManager.SendTemplate("OnFirstMeeting", noErr: true, sendOption: SendOption.None); + LateTask.New(() => + { + TemplateManager.SendTemplate("OnMeeting", noErr: true, sendOption: SendOption.None); + if (MeetingStates.FirstMeeting) TemplateManager.SendTemplate("OnFirstMeeting", noErr: true, sendOption: SendOption.None); + }, 2f, log: false); NotifyRoleSkillOnMeetingStart(); diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index e12cd42e3..e5c959d76 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -2872,6 +2872,8 @@ "DraftResend": "Your drafting choices are:\\n\\n{0}\\n\\nChat commands to use:\\n- Pick role: /draft [index]\\n- View description of role: /dd [index]\\nReplace [index] with the number of the role you want to pick. Example: /draft 4", "DraftTitle": "<#00a5ff>➡ <#00ffa5>Drafting <#00a5ff>⬅", "DraftChosen": "You have chosen the {0} role for the next game.\\nYou can still change your choice by typing /draft [index] again.", + "DraftMaxRolesPerPlayer": "Max Roles For Each Player To Choose From When Drafting", + "EveryoneDrafted": "<#00ffa5>✓ <#00ff00>Everyone has drafted their role!", "DeathCommand": "<#ffffff>You were killed by {0}<#ffffff>\\nTheir role is {1}", "DeathCommandFail": "<#ff0000>The game could not determine your real killer.", "DefaultSystemMessageTitle": "➡ SYSTEM MESSAGE ⬅", diff --git a/Roles/Crewmate/Snitch.cs b/Roles/Crewmate/Snitch.cs index 5bdd86407..f2c35e166 100644 --- a/Roles/Crewmate/Snitch.cs +++ b/Roles/Crewmate/Snitch.cs @@ -100,7 +100,7 @@ public class Snitch : RoleBase public static void CheckTask(PlayerControl snitch) { - if (!snitch.IsAlive() || snitch.Is(CustomRoles.Madmate)) return; + if (!snitch.IsAlive() || snitch.Is(CustomRoles.Madmate) || snitch.IsConverted()) return; byte snitchId = snitch.PlayerId; TaskState snitchTask = snitch.GetTaskState(); diff --git a/Roles/Neutral/PlagueBearer.cs b/Roles/Neutral/PlagueBearer.cs index 3148f6f7f..30c5180ee 100644 --- a/Roles/Neutral/PlagueBearer.cs +++ b/Roles/Neutral/PlagueBearer.cs @@ -110,7 +110,7 @@ public class PlagueBearer : RoleBase public static bool IsPlaguedAll(PlayerControl player) { - if (!player.Is(CustomRoles.PlagueBearer)) return false; + if (!player.Is(CustomRoles.PlagueBearer) || !Main.IntroDestroyed) return false; (int plagued, int all) = PlaguedPlayerCount(player.PlayerId); return plagued >= all; @@ -128,7 +128,7 @@ public class PlagueBearer : RoleBase Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target); killer.ResetKillCooldown(); killer.SetKillCooldown(); - Logger.Msg($"kill cooldown {PlagueBearerCD[killer.PlayerId]}", "PlagueBearer"); + Logger.Msg($"Kill cooldown: {PlagueBearerCD[killer.PlayerId]}", "PlagueBearer"); return false; } @@ -172,7 +172,8 @@ public class Pestilence : RoleBase public override bool OnCheckMurder(PlayerControl killer, PlayerControl target) { - if (base.OnCheckMurder(killer, target)) killer.Kill(target); + if (base.OnCheckMurder(killer, target)) + killer.Kill(target); return false; }