Fix Meeting abilities with UI working during Daybreak (#448)

* Update Inspector.cs

* Update Nemesis.cs

* Update Councillor.cs

* Update Judge.cs

* Update Swapper.cs

Add condition to check if it's daytime before allowing swap.

* Update Imitator.cs

* Update Retributionist.cs

* Update Ventriloquist.cs

* Update GuessManager.cs

* Update PlayerJoinAndLeftPatch.cs

* Update ChatCommandPatch.cs

* Update EACList.txt

Removed a cheater entry and added a new section for griefers and toxic players.

* Update Ventriloquist.cs

* Update Nemesis.cs

* Update Imitator.cs

* Update ChatCommandPatch.cs

* Update GuessManager.cs

* Fix Role buttons not working on discussion when setting is on

* Update GuessManager.cs

* fix

---------

Co-authored-by: Gurge44 <90392754+Gurge44@users.noreply.github.com>
This commit is contained in:
PEPPERculaandGurge44 authored and GitHub committed 2025-12-27 09:46:56 +01:00
1 parent 2f18e65a65
commit 837b5b75f0
12 files changed
+39 -26

No files matched your search

+18 -12
View File
@@ -328,15 +328,17 @@ public static class GuessManager
case CustomRoles.Ankylosaurus:
ShowMessage("GuessAnkylosaurus");
return true;
case CustomRoles.Speedrunner when target.Is(CustomRoles.Speedrunner) && !pc.Is(Team.Crewmate) && target.GetTaskState().CompletedTasksCount >= Speedrunner.SpeedrunnerNotifyAtXTasksLeft.GetInt() && Speedrunner.SpeedrunnerNotifyKillers.GetBool():
case CustomRoles.Car:
case CustomRoles.DonutDelivery when DonutDelivery.IsUnguessable(pc, target):
case CustomRoles.Shifter:
case CustomRoles.Car:
case CustomRoles.Speedrunner when target.Is(CustomRoles.Speedrunner) && !pc.Is(Team.Crewmate) && target.GetTaskState().CompletedTasksCount >= Speedrunner.SpeedrunnerNotifyAtXTasksLeft.GetInt() && Speedrunner.SpeedrunnerNotifyKillers.GetBool():
case CustomRoles.Goose when !Goose.CanBeGuessed.GetBool():
case CustomRoles.BananaMan:
case CustomRoles.Disco:
case CustomRoles.Flashman:
case CustomRoles.Giant:
case CustomRoles.Glow:
case CustomRoles.LastImpostor:
case CustomRoles.BananaMan:
ShowMessage("GuessObviousAddon");
return true;
case CustomRoles.GM:
@@ -781,7 +783,7 @@ public static class GuessManager
private static void GuesserOnClick(byte playerId, MeetingHud __instance)
{
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || GuesserUI != null || !GameStates.IsVoting) return;
if (pc == null || !pc.IsAlive() || GuesserUI != null || MeetingHud.Instance.state is MeetingHud.VoteStates.Results or MeetingHud.VoteStates.Proceeding || Starspawn.IsDayBreak) return;
try
{
@@ -1003,7 +1005,7 @@ public static class GuessManager
}
else
{
if (__instance.state is not (MeetingHud.VoteStates.Voted or MeetingHud.VoteStates.NotVoted) || !PlayerControl.LocalPlayer.IsAlive()) return;
if (MeetingHud.Instance.state is MeetingHud.VoteStates.Results or MeetingHud.VoteStates.Proceeding || !PlayerControl.LocalPlayer.IsAlive()) return;
Logger.Msg($"Click: {pc.GetNameWithRole()} => {role}", "Guesser UI");
@@ -1038,20 +1040,23 @@ public static class GuessManager
{
if (role is
CustomRoles.GM or
CustomRoles.Oblivious or
CustomRoles.Flashman or
CustomRoles.Ankylosaurus or
CustomRoles.BananaMan or
CustomRoles.Car or
CustomRoles.Disco or
CustomRoles.Flashman or
CustomRoles.Giant or
CustomRoles.LastImpostor or
CustomRoles.NotAssigned or
CustomRoles.SoloPVP_Player or
CustomRoles.Paranoid or
CustomRoles.SuperStar or
CustomRoles.GuardianAngelEHR
CustomRoles.Shifter or
CustomRoles.Specter or
CustomRoles.SuperStar
)
return false;
if (role.IsForOtherGameMode()) return false;
if (!role.IsEnable() && !role.RoleExist(true) && !CanMakeRoleSpawn(role)) return false;
return Options.CurrentGameMode == CustomGameMode.Standard && !CustomHnS.AllHnSRoles.Contains(role) && !role.IsVanilla();
return Options.CurrentGameMode == CustomGameMode.Standard && !CustomHnS.AllHnSRoles.Contains(role) && !role.IsGhostRole() && !role.IsVanilla();
bool CanMakeRoleSpawn(CustomRoles r)
{
@@ -1646,3 +1651,4 @@ public static class GuessManager
}
}
+6 -1
View File
@@ -699,17 +699,20 @@ internal static class ChatCommands
if (!targetState.IsDead)
{
RPC.PlaySoundRPC(player.PlayerId, Sounds.SabotageSound);
Utils.SendMessage("\n", player.PlayerId, GetString("Imitator.TargetMustBeDead"));
return;
}
if (!targetState.MainRole.Is(Team.Crewmate) || targetState.MainRole == CustomRoles.GM)
{
RPC.PlaySoundRPC(player.PlayerId, Sounds.SabotageSound);
Utils.SendMessage("\n", player.PlayerId, GetString("Imitator.TargetMustBeCrew"));
return;
}
Imitator.ImitatingRole[player.PlayerId] = targetState.MainRole;
RPC.PlaySoundRPC(player.PlayerId, Sounds.TaskComplete);
Logger.Info($"{player.GetRealName()} will be imitating as {targetState.MainRole}", "Imitator");
Utils.SendMessage("\n", player.PlayerId, string.Format(GetString("Imitator.Success"), targetId.ColoredPlayerName()));
@@ -1336,7 +1339,7 @@ internal static class ChatCommands
() => Utils.EnterQuickSetupRoles(false));
}
private static void ReadyCheckCommand(PlayerControl player, string commandKey, string text, string[] args)
public static void ReadyCheckCommand(PlayerControl player, string commandKey, string text, string[] args)
{
if (!AmongUsClient.Instance.AmHost)
{
@@ -2278,6 +2281,8 @@ internal static class ChatCommands
var vl = (Ventriloquist)Main.PlayerStates[player.PlayerId].Role;
vl.Target = args.Length < 2 ? byte.MaxValue : byte.TryParse(args[1], out byte targetId) ? targetId : byte.MaxValue;
player.RPCPlayCustomSound("Line");
MeetingManager.SendCommandUsedMessage(args[0]);
}
+1
View File
@@ -183,6 +183,7 @@ internal static class OnGameJoinedPatch
if (Options.AutoDraftStartCommandAfterJoin.GetBool())
ChatCommands.DraftStartCommand(PlayerControl.LocalPlayer, "Command.DraftStart", "/draftstart", ["/draftstart"]);
}
}
if (Options.AutoReadyCheckCommandAfterJoin.GetBool())
{
+2 -2
View File
@@ -94,8 +94,8 @@ byechic#6270 | 91e0145f1 | (Contains n word) | Harassing a streamer with a slur
waiverfore#0496 | b493df896 | | Cheating in Syl's lobby |
whaleutter#4768 | 9e04dc5d5 | | Cheating in Syl's lobby | No name cheater
whimrecent#6558 | f8452a9d1 | | Cheating | No name cheater
pureplot#2423 | ed4c7bdf6 | hdrzz | Cheater | Cheated in Sarha's lobby
## Griefers, Toxic, harrasing, morons
setmolar#4374 | | 藏族顶针 | Toxic |
overtfeast#5802 | | 黑影 | Toxic |
@@ -127,4 +127,4 @@ primesnow#4272 | 65b98a6de | HiverXM | Toxic | The n word
tenthrope#3476 | | Oldishwire | Other |
greencorps#9587 | 4a403fe31 | ellsbells | Other |
finlucky#6381 | 433b2e672 | Wuwu | Other |
nattertame#9540 | 0abd54784 | Wuwu | Other | Alt account
nattertame#9540 | 0abd54784 | Wuwu | Other | Alt account
+2 -1
View File
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using EHR.Modules;
using EHR.Neutral;
using Hazel;
using UnityEngine;
@@ -70,7 +71,7 @@ public class Imitator : RoleBase
{
Logger.Msg($"Click: ID {playerId}", "Imitator UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || pc.IsAlive() || !GameStates.IsVoting) return;
if (pc == null || pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
if (AmongUsClient.Instance.AmHost)
{
+1 -2
View File
@@ -8,7 +8,6 @@ using UnityEngine;
using static EHR.Options;
using static EHR.Translator;
namespace EHR.Crewmate;
public class Inspector : RoleBase
@@ -435,7 +434,7 @@ public class Inspector : RoleBase
private static void PickForCompare(byte playerId, byte lpcId)
{
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting) return;
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
if (FirstPick.TryGetValue(lpcId, out byte firstPick))
{
+1 -1
View File
@@ -287,7 +287,7 @@ public class Judge : RoleBase
{
Logger.Msg($"Click: ID {playerId}", "Judge UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting) return;
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
if (AmongUsClient.Instance.AmHost)
TrialMsg(PlayerControl.LocalPlayer, $"/tl {playerId}", true);
+1 -1
View File
@@ -119,7 +119,7 @@ public class Retributionist : RoleBase
{
Logger.Msg($"Click: ID {playerId}", "Retributionist UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting) return;
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
if (AmongUsClient.Instance.AmHost)
{
+2 -3
View File
@@ -7,7 +7,6 @@ using Hazel;
using UnityEngine;
using static EHR.Translator;
namespace EHR.Crewmate;
public class Swapper : RoleBase
@@ -280,7 +279,7 @@ public class Swapper : RoleBase
Logger.Msg($"Click: ID {playerId}", "Swapper UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting) return;
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
if (AmongUsClient.Instance.AmHost)
SwapMsg(PlayerControl.LocalPlayer, $"/sw {playerId}", true);
@@ -345,4 +344,4 @@ public class Swapper : RoleBase
keepGameGoing = true;
countsAs = 1;
}
}
}
+1 -1
View File
@@ -319,7 +319,7 @@ public class Councillor : RoleBase
{
Logger.Msg($"Click: ID {playerId}", "Councillor UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting) return;
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
if (AmongUsClient.Instance.AmHost)
MurderMsg(PlayerControl.LocalPlayer, $"/tl {playerId}", true);
+2 -1
View File
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using AmongUs.GameOptions;
using EHR.Modules;
using EHR.Neutral;
using Hazel;
using UnityEngine;
using static EHR.Options;
@@ -191,7 +192,7 @@ internal class Nemesis : RoleBase
{
Logger.Msg($"Click: ID {playerId}", "Nemesis UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting) return;
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
if (AmongUsClient.Instance.AmHost)
NemesisMsgCheck(PlayerControl.LocalPlayer, $"/rv {playerId}", true);
+2 -1
View File
@@ -1,6 +1,7 @@
using System;
using System.Linq;
using EHR.Modules;
using EHR.Neutral;
using Hazel;
using UnityEngine;
@@ -58,7 +59,7 @@ public class Ventriloquist : RoleBase
{
Logger.Msg($"Click: ID {playerId}", "Ventriloquist UI");
PlayerControl pc = Utils.GetPlayerById(playerId);
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting) return;
if (pc == null || !pc.IsAlive() || !GameStates.IsVoting || Starspawn.IsDayBreak) return;
if (AmongUsClient.Instance.AmHost)
{