more support for v18.0

This commit is contained in:
Gurge44 committed 2026-08-21 16:05:40 +02:00
1 parent 89139ff9b8
commit e71fd450ff
50 files changed
+326 -133

No files matched your search

+1 -1
View File
@@ -226,7 +226,7 @@ public enum CustomRoles
Inquisitor, Inquisitor,
Jailor, Jailor,
Journalist, Journalist,
JudgeOld, Prosecutor,
LazyGuy, LazyGuy,
Leery, Leery,
Lighter, Lighter,
+1 -1
View File
@@ -226,7 +226,7 @@ public enum CustomRoles
Inquisitor, Inquisitor,
Jailor, Jailor,
Journalist, Journalist,
JudgeOld, Prosecutor,
LazyGuy, LazyGuy,
Leery, Leery,
Lighter, Lighter,
+1 -1
View File
@@ -581,7 +581,7 @@ public class Main : BasePlugin
{ CustomRoles.Medic, "#00ff97" }, { CustomRoles.Medic, "#00ff97" },
{ CustomRoles.FortuneTeller, "#882c83" }, { CustomRoles.FortuneTeller, "#882c83" },
{ CustomRoles.Glitch, "#39FF14" }, { CustomRoles.Glitch, "#39FF14" },
{ CustomRoles.JudgeOld, "#f8d85a" }, { CustomRoles.Prosecutor, "#f8d85a" },
{ CustomRoles.Mortician, "#333c49" }, { CustomRoles.Mortician, "#333c49" },
{ CustomRoles.Medium, "#a200ff" }, { CustomRoles.Medium, "#a200ff" },
{ CustomRoles.Observer, "#a8e0fa" }, { CustomRoles.Observer, "#a8e0fa" },
+2 -2
View File
@@ -352,7 +352,7 @@ internal static class CustomRolesHelper
CustomRoles.Hangman => CustomRoles.Shapeshifter, CustomRoles.Hangman => CustomRoles.Shapeshifter,
CustomRoles.Sunnyboy => CustomRoles.Scientist, CustomRoles.Sunnyboy => CustomRoles.Scientist,
CustomRoles.Specter => Options.PhantomCanVent.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate, CustomRoles.Specter => Options.PhantomCanVent.GetBool() ? CustomRoles.Engineer : CustomRoles.Crewmate,
CustomRoles.JudgeOld => CustomRoles.Crewmate, CustomRoles.Prosecutor => CustomRoles.Crewmate,
CustomRoles.Councillor => CustomRoles.Impostor, CustomRoles.Councillor => CustomRoles.Impostor,
CustomRoles.Mortician => CustomRoles.Crewmate, CustomRoles.Mortician => CustomRoles.Crewmate,
CustomRoles.Medium => CustomRoles.Crewmate, CustomRoles.Medium => CustomRoles.Crewmate,
@@ -1492,7 +1492,7 @@ internal static class CustomRolesHelper
CustomRoles.Ventguard => RoleOptionType.Crewmate_Support, CustomRoles.Ventguard => RoleOptionType.Crewmate_Support,
CustomRoles.Wizard => RoleOptionType.Crewmate_Support, CustomRoles.Wizard => RoleOptionType.Crewmate_Support,
CustomRoles.Drainer => RoleOptionType.Crewmate_Killing, CustomRoles.Drainer => RoleOptionType.Crewmate_Killing,
CustomRoles.JudgeOld => RoleOptionType.Crewmate_Killing, CustomRoles.Prosecutor => RoleOptionType.Crewmate_Killing,
CustomRoles.NiceGuesser => RoleOptionType.Crewmate_Killing, CustomRoles.NiceGuesser => RoleOptionType.Crewmate_Killing,
CustomRoles.Retributionist => RoleOptionType.Crewmate_Killing, CustomRoles.Retributionist => RoleOptionType.Crewmate_Killing,
CustomRoles.Sentinel => RoleOptionType.Crewmate_Killing, CustomRoles.Sentinel => RoleOptionType.Crewmate_Killing,
+2 -2
View File
@@ -57,14 +57,14 @@ internal static class ExtendedPlayerControl
public bool UsesMeetingShapeshift() public bool UsesMeetingShapeshift()
{ {
CustomRoles role = player.GetCustomRole(); CustomRoles role = player.GetCustomRole();
// if (player.IsModdedClient() && role is CustomRoles.Councillor or CustomRoles.Inspector or CustomRoles.JudgeOld or CustomRoles.Retributionist or CustomRoles.Starspawn or CustomRoles.Swapper or CustomRoles.Ventriloquist) return false; // if (player.IsModdedClient() && role is CustomRoles.Councillor or CustomRoles.Inspector or CustomRoles.Prosecutor or CustomRoles.Retributionist or CustomRoles.Starspawn or CustomRoles.Swapper or CustomRoles.Ventriloquist) return false;
return role.UsesMeetingShapeshift(); return role.UsesMeetingShapeshift();
} }
public bool UsesJudgeAbilityAsTrigger() public bool UsesJudgeAbilityAsTrigger()
{ {
CustomRoles role = player.GetCustomRole(); CustomRoles role = player.GetCustomRole();
if (player.IsModdedClient() && role is CustomRoles.Councillor or CustomRoles.Inspector or CustomRoles.JudgeOld or CustomRoles.Retributionist or CustomRoles.Starspawn or CustomRoles.Swapper or CustomRoles.Ventriloquist) return false; if (player.IsModdedClient() && role is CustomRoles.Councillor or CustomRoles.Inspector or CustomRoles.Prosecutor or CustomRoles.Retributionist or CustomRoles.Starspawn or CustomRoles.Swapper or CustomRoles.Ventriloquist) return false;
return role.UsesJudgeAbilityAsTrigger(); return role.UsesJudgeAbilityAsTrigger();
} }
@@ -644,6 +644,9 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS
AURoleOptions.JudgeTaskRequirementPercentage = CrewmateVanillaRoles.JudgeTaskRequirementPercentage.GetFloat(); AURoleOptions.JudgeTaskRequirementPercentage = CrewmateVanillaRoles.JudgeTaskRequirementPercentage.GetFloat();
break; break;
} }
if (player.UsesJudgeAbilityAsTrigger())
AURoleOptions.JudgeTaskRequirementPercentage = 0f;
// When impostor alert is off, and the player is a desync crewmate, set impostor alert as true // When impostor alert is off, and the player is a desync crewmate, set impostor alert as true
if (role.IsDesyncRole() && role.IsCrewmate() && !CrewmateVanillaRoles.NoiseMakerImpostorAlert.GetBool()) if (role.IsDesyncRole() && role.IsCrewmate() && !CrewmateVanillaRoles.NoiseMakerImpostorAlert.GetBool())
+1 -1
View File
@@ -65,7 +65,7 @@ public static class GuessManager
if (!AmongUsClient.Instance.AmHost) return false; if (!AmongUsClient.Instance.AmHost) return false;
if (!GameStates.IsMeeting || MeetingHud.Instance.state is MeetingHud.MeetingStates.Results or MeetingHud.MeetingStates.Proceeding || !pc) return false; if (!GameStates.IsMeeting || MeetingHud.Instance.state is MeetingHud.MeetingStates.Results or MeetingHud.MeetingStates.Proceeding || !pc) return false;
bool hasGuessingRole = pc.GetCustomRole() is CustomRoles.NiceGuesser or CustomRoles.EvilGuesser or CustomRoles.Doomsayer or CustomRoles.JudgeOld or CustomRoles.Swapper or CustomRoles.Councillor or CustomRoles.NecroGuesser or CustomRoles.Augur; bool hasGuessingRole = pc.GetCustomRole() is CustomRoles.NiceGuesser or CustomRoles.EvilGuesser or CustomRoles.Doomsayer or CustomRoles.Prosecutor or CustomRoles.Swapper or CustomRoles.Councillor or CustomRoles.NecroGuesser or CustomRoles.Augur;
if (!hasGuessingRole && !pc.Is(CustomRoles.Guesser) && !Options.GuesserMode.GetBool()) return false; if (!hasGuessingRole && !pc.Is(CustomRoles.Guesser) && !Options.GuesserMode.GetBool()) return false;
int operate; // 1: ID, 2: Guess int operate; // 1: ID, 2: Guess
+4 -4
View File
@@ -10,7 +10,7 @@ internal static class LoadingScreen
{ {
private const int HintCount = 40; private const int HintCount = 40;
private const int JokeHintCount = 6; private const int JokeHintCount = 6;
private static Vector3 Position; private static Camera Camera;
private static SpriteRenderer LoadingAnimation; private static SpriteRenderer LoadingAnimation;
private static readonly HashSet<int> ToldHints = []; private static readonly HashSet<int> ToldHints = [];
private static float HintHideTimer; private static float HintHideTimer;
@@ -26,8 +26,8 @@ internal static class LoadingScreen
LoadingAnimation.sprite = Utils.LoadSprite("EHR.Resources.Loading.png", 300f); LoadingAnimation.sprite = Utils.LoadSprite("EHR.Resources.Loading.png", 300f);
LoadingAnimation.sortingOrder = 100; LoadingAnimation.sortingOrder = 100;
var camera = HudManager.Instance.GetComponentInChildren<Camera>(); Camera = HudManager.Instance.GetComponentInChildren<Camera>();
LoadingAnimation.transform.position = Position = AspectPosition.ComputeWorldPosition(camera, AspectPosition.EdgeAlignments.LeftBottom, new Vector3(0.6f, 0.6f, camera.nearClipPlane + 0.1f)); LoadingAnimation.transform.position = AspectPosition.ComputeWorldPosition(Camera, AspectPosition.EdgeAlignments.LeftBottom, new Vector3(0.6f, 0.6f, Camera.nearClipPlane + 0.1f));
} }
catch (Exception ex) { Logger.Error(ex.ToString(), "LoadingScreen.UpdateLoadingAnimation"); } catch (Exception ex) { Logger.Error(ex.ToString(), "LoadingScreen.UpdateLoadingAnimation"); }
} }
@@ -87,7 +87,7 @@ internal static class LoadingScreen
if (LoadingAnimation) if (LoadingAnimation)
{ {
LoadingAnimation.transform.position = Position; LoadingAnimation.transform.position = AspectPosition.ComputeWorldPosition(Camera, AspectPosition.EdgeAlignments.LeftBottom, new Vector3(0.6f, 0.6f, Camera.nearClipPlane + 0.1f));
LoadingAnimation.transform.Rotate(Vector3.back, 200f * Time.deltaTime); LoadingAnimation.transform.Rotate(Vector3.back, 200f * Time.deltaTime);
} }
+1 -1
View File
@@ -181,7 +181,7 @@ public static class Options
"TempBan" "TempBan"
]; ];
private static readonly string[] ConfirmEjectionsMode = public static readonly string[] ConfirmEjectionsMode =
[ [
"ConfirmEjections.None", "ConfirmEjections.None",
"ConfirmEjections.Team", "ConfirmEjections.Team",
+1 -42
View File
@@ -156,47 +156,6 @@ public static class Utils
try { LoadingBarManager.Instance.ToggleLoadingBar(false); } try { LoadingBarManager.Instance.ToggleLoadingBar(false); }
catch (Exception e) { ThrowException(e); } catch (Exception e) { ThrowException(e); }
} }
public static IEnumerator SendGameDataContinuously()
{
float waitTime = GameData.Instance.AllPlayers.Count switch
{
<= 15 => 1f,
<= 20 => 0.8f,
_ => 0.5f
};
while (GameStates.InGame && !GameStates.IsEnded && ShipStatus.Instance)
{
if (ReportDeadBodyPatch.MeetingStarted || GameStates.IsMeeting || ExileController.Instance || AntiBlackout.SkipTasks)
{
yield return new WaitForSecondsRealtime(10f);
continue;
}
for (var index = 0; index < GameData.Instance.AllPlayers.Count; index++)
{
NetworkedPlayerInfo playerInfo = GameData.Instance.AllPlayers[index];
if (!playerInfo || (Astral.On && Main.PlayerStates.TryGetValue(playerInfo.PlayerId, out PlayerState state) && state.Role is Astral { Timer: not null }) || (SoulCollector.On && Main.PlayerStates.Values.Any(x => x.Role is SoulCollector sc && sc.ToExile.Contains(playerInfo.PlayerId)))) continue;
playerInfo.IsDead = !playerInfo.Object.IsAlive();
var qa = playerInfo.SendGameData(SendOption.None);
yield return qa.Wait();
if (qa.Dropped || !GameStates.InGame || GameStates.IsEnded || !ShipStatus.Instance)
{
Logger.Msg("Coroutine finished", nameof(SendGameDataContinuously));
yield break;
}
yield return new WaitForSecondsRealtime(waitTime);
}
}
Logger.Msg("Coroutine finished", nameof(SendGameDataContinuously));
}
public static void CheckAndSetVentInteractions() public static void CheckAndSetVentInteractions()
{ {
@@ -1103,7 +1062,7 @@ public static class Utils
(pc.Is(CustomRoles.Mayor) && !Options.MayorCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Mayor) && !Options.MayorCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.NiceGuesser) && !Options.NGuesserCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.NiceGuesser) && !Options.NGuesserCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.Snitch) && !Options.SnitchCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Snitch) && !Options.SnitchCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.JudgeOld) && !Options.JudgeCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Prosecutor) && !Options.JudgeCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.Marshall) && !Options.MarshallCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Marshall) && !Options.MarshallCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.Investigator) && !Options.InvestigatorCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Investigator) && !Options.InvestigatorCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.President) && !Options.PresidentCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.President) && !Options.PresidentCanBeMadmate.GetBool()) ||
+1 -1
View File
@@ -985,7 +985,7 @@ internal static class ChatCommands
{ {
if (Starspawn.IsDayBreak) return; if (Starspawn.IsDayBreak) return;
if (!player.IsAlive() || Main.PlayerStates[player.PlayerId].Role is not Markseeker { IsEnable: true } ms || ms.MarkedId != byte.MaxValue) return; if (!player.IsAlive() || Main.PlayerStates[player.PlayerId].Role is not Markseeker { IsEnable: true, MarkedId: byte.MaxValue } ms) return;
ms.MarkedId = args.Length < 2 ? byte.MaxValue : byte.TryParse(args[1], out byte targetId) ? targetId : byte.MaxValue; ms.MarkedId = args.Length < 2 ? byte.MaxValue : byte.TryParse(args[1], out byte targetId) ? targetId : byte.MaxValue;
+1 -1
View File
@@ -18,7 +18,7 @@ static class ChatControllerAwakePatch
private static SpriteRenderer OpenBanMenuIcon; private static SpriteRenderer OpenBanMenuIcon;
private static SpriteRenderer OpenKeyboardIcon; private static SpriteRenderer OpenKeyboardIcon;
private static readonly Color32 DarkBackgroundColor = new(40, 40, 40, byte.MaxValue); public static readonly Color32 DarkBackgroundColor = new(40, 40, 40, byte.MaxValue);
public static void Postfix(ChatController __instance) public static void Postfix(ChatController __instance)
{ {
+19
View File
@@ -1370,6 +1370,10 @@ public static class GameSettingMenuPatch
field.transform.SetParent(parentLeftPanel.parent, false); field.transform.SetParent(parentLeftPanel.parent, false);
field.gameObject.SetActive(true); field.gameObject.SetActive(true);
} }
else
{
Main.Instance.StartCoroutine(KeepSearchBarDarkThemed());
}
field.transform.localScale = new(0.3f, 0.59f, 1); field.transform.localScale = new(0.3f, 0.59f, 1);
field.transform.localPosition = new(-0.47f, 2.15f, -5f); field.transform.localPosition = new(-0.47f, 2.15f, -5f);
field.textArea.outputText.transform.localScale = new(3.5f, 2f, 1f); field.textArea.outputText.transform.localScale = new(3.5f, 2f, 1f);
@@ -1443,6 +1447,21 @@ public static class GameSettingMenuPatch
GameOptionsMenuPatch.ReCreateSettings(gameSettings); GameOptionsMenuPatch.ReCreateSettings(gameSettings);
textField.Clear(); textField.Clear();
} }
IEnumerator KeepSearchBarDarkThemed()
{
while (InputField)
{
if (Main.DarkTheme.Value && GameSettingMenu.Instance && InputField.gameObject.activeSelf)
{
InputField.background.color = ChatControllerAwakePatch.DarkBackgroundColor;
InputField.textArea.compoText.Color(Color.white);
InputField.textArea.outputText.color = Color.white;
}
yield return null;
}
}
} }
private static void SetDefaultButton(GameSettingMenu __instance) private static void SetDefaultButton(GameSettingMenu __instance)
+1 -1
View File
@@ -428,7 +428,7 @@ internal static class HudManagerPatch
ActionButton button; ActionButton button;
Type type = state.Role.GetType(); Type type = state.Role.GetType();
if (type.GetMethod("OnVote").DeclaringType == type || role is CustomRoles.Adrenaline or CustomRoles.Battery or CustomRoles.Dad or CustomRoles.Grappler or CustomRoles.Inquirer or CustomRoles.JudgeOld or CustomRoles.Mechanic or CustomRoles.Medium or CustomRoles.Swapper or CustomRoles.Inspector or CustomRoles.Spy or CustomRoles.Councillor or CustomRoles.CursedWolf or CustomRoles.Forger or CustomRoles.Generator or CustomRoles.Ventriloquist or CustomRoles.Bargainer or CustomRoles.Technician or CustomRoles.Virus) if (type.GetMethod("OnVote").DeclaringType == type || role is CustomRoles.Adrenaline or CustomRoles.Battery or CustomRoles.Dad or CustomRoles.Grappler or CustomRoles.Inquirer or CustomRoles.Prosecutor or CustomRoles.Mechanic or CustomRoles.Medium or CustomRoles.Swapper or CustomRoles.Inspector or CustomRoles.Spy or CustomRoles.Councillor or CustomRoles.CursedWolf or CustomRoles.Forger or CustomRoles.Generator or CustomRoles.Ventriloquist or CustomRoles.Bargainer or CustomRoles.Technician or CustomRoles.Virus)
button = null; button = null;
else if (role is CustomRoles.Coroner or CustomRoles.Occultist or CustomRoles.Vulture) else if (role is CustomRoles.Coroner or CustomRoles.Occultist or CustomRoles.Vulture)
button = __instance.ReportButton; button = __instance.ReportButton;
+1 -1
View File
@@ -134,7 +134,7 @@ public static class HudSpritePatch
newAbilityButton = CustomButton.Get("Kill"); newAbilityButton = CustomButton.Get("Kill");
break; break;
} }
case CustomRoles.JudgeOld: case CustomRoles.Prosecutor:
{ {
newAbilityButton = CustomButton.Get("JudgeIcon"); newAbilityButton = CustomButton.Get("JudgeIcon");
break; break;
+1 -2
View File
@@ -814,7 +814,7 @@ internal static class BeginCrewmatePatch
CustomRoles.Judge CustomRoles.Judge
or CustomRoles.JudgeEHR or CustomRoles.JudgeEHR
or CustomRoles.JudgeOld or CustomRoles.Prosecutor
=> GetIntroSound(RoleTypes.Judge), => GetIntroSound(RoleTypes.Judge),
CustomRoles.Phantom CustomRoles.Phantom
@@ -1400,7 +1400,6 @@ internal static class IntroCutsceneDestroyPatch
LateTask.New(() => Main.Instance.StartCoroutine(Utils.NotifyEveryoneAsync()), 6f, "NotifyEveryoneAsync On Game Start"); LateTask.New(() => Main.Instance.StartCoroutine(Utils.NotifyEveryoneAsync()), 6f, "NotifyEveryoneAsync On Game Start");
LateTask.New(Utils.MarkEveryoneDirtySettings, 0.5f, "SyncAllSettings On Game Start"); LateTask.New(Utils.MarkEveryoneDirtySettings, 0.5f, "SyncAllSettings On Game Start");
LateTask.New(() => Main.Instance.StartCoroutine(ShipStatusFixedUpdatePatch.Postfix()), 5f, "ShipStatusFixedUpdatePatch Postfix Start"); LateTask.New(() => Main.Instance.StartCoroutine(ShipStatusFixedUpdatePatch.Postfix()), 5f, "ShipStatusFixedUpdatePatch Postfix Start");
LateTask.New(() => Main.Instance.StartCoroutine(Utils.SendGameDataContinuously()), 10f, "SendGameDataContinuously Start");
Utils.CheckAndSetVentInteractions(); Utils.CheckAndSetVentInteractions();
} }
+143
View File
@@ -0,0 +1,143 @@
using System.Globalization;
using AmongUs.GameOptions;
using HarmonyLib;
using TMPro;
using UnityEngine;
namespace EHR.Patches;
[HarmonyPatch]
public static class MatchInfoGuidePatch
{
[HarmonyPatch(typeof(MatchInfoGuide), nameof(MatchInfoGuide.CreateNormalModeSettings)), HarmonyPrefix]
public static bool CreateModdedSettings(MatchInfoGuide __instance)
{
int num = 6;
(OptionItem MinSetting, OptionItem MaxSetting) impSettings = Options.FactionMinMaxSettings[Team.Impostor];
__instance.CreateSettingsEntry(StringNames.GameNumImpostors, $"{impSettings.MinSetting.GetInt()}-{impSettings.MaxSetting.GetInt()}");
__instance.CreateSettingsEntry(StringNames.GameKillCooldown, GameManager.Instance.AllGameSettingData[StringNames.GameKillCooldown].GetValueString(GameManager.Instance.LogicOptions.GetKillCooldown()));
__instance.CreateSettingsEntry(StringNames.GameEmergencyCooldown, GameManager.Instance.AllGameSettingData[StringNames.GameEmergencyCooldown].GetValueString(GameManager.Instance.LogicOptions.GetEmergencyCooldown()));
__instance.CreateSettingsEntry(StringNames.GameVisualTasks, __instance.GetBoolString(GameManager.Instance.LogicOptions.GetVisualTasks()));
__instance.CreateSettingsEntry(StringNames.GameAnonymousVotes, __instance.GetBoolString(GameManager.Instance.LogicOptions.GetAnonymousVotes()));
__instance.CreateSettingsEntry(StringNames.GameTaskBarMode, GameManager.Instance.LogicOptions.GetTaskBarMode().ToString());
CreateModdedSettingEntries(Options.GroupedOptions[TabGroup.GameSettings], __instance, ref num);
CreateModdedSettingEntries(Options.GroupedOptions[TabGroup.TaskSettings], __instance, ref num);
__instance.transform.FindChild("MatchInfoParent").FindChild("SettingsPanel").GetComponentInChildren<Scroller>().SetYBoundsMax(Mathf.Clamp(Mathf.Ceil(num / 4f), 0.0f, 999f));
num = CreateModdedRoleEntries(__instance);
if (num == 0) __instance.rolesEnabledMessage.SetActive(true);
__instance.MatchInfoRoleScroller.SetYBoundsMax(Mathf.Clamp(Mathf.Ceil(num / 2f) + __instance.RoleEntryBoundsModifier, 0.0f, 999f));
__instance.MatchInfoRoleMaskArea.material.SetInt(PlayerMaterial.MaskLayer, 50);
__instance.matchInfoSettingsMaskArea.material.SetInt(PlayerMaterial.MaskLayer, 50);
__instance.CreatePlayerEntries();
ReColorTabButtons(__instance);
return false;
}
private static int CreateModdedRoleEntries(MatchInfoGuide __instance)
{
int num = 0;
foreach (CustomRoles role in Main.CustomRoleValues)
{
if (!role.IsVanilla() && !role.IsForOtherGameMode() && role.IsEnable())
{
CreateModdedRoleEntry(__instance, role);
++num;
}
}
return num;
}
private static void CreateModdedSettingEntries(OptionItem[] settings, MatchInfoGuide __instance, ref int num)
{
foreach (OptionItem optionItem in settings)
{
if (optionItem.IsCurrentlyHidden(checkCollapsedSection: false) || optionItem.Parent != null || optionItem is PresetOptionItem or TextOptionItem) continue;
string value = optionItem switch
{
BooleanOptionItem b => __instance.GetBoolString(b.GetBool()),
FloatOptionItem f => f.GetFloat().ToString(CultureInfo.CurrentCulture),
IntegerOptionItem i => i.GetInt().ToString(),
StringOptionItem s => s.noTranslation ? s.Selections[s.GetValue()] : Translator.GetString(s.Selections[s.GetValue()]),
_ => string.Empty
};
CreateModdedSettingEntry(__instance, optionItem.GetName(), value);
++num;
}
}
private static void CreateModdedSettingEntry(MatchInfoGuide __instance, string settingName, string value)
{
GameObject gameObject = Object.Instantiate(__instance.MatchInfoSettingPrefab, __instance.settingsScrollArea);
MatchInfoGuideSettingLabel component = gameObject.GetComponent<MatchInfoGuideSettingLabel>();
if (component != null) component.SetInfo(settingName, value);
__instance.NormalModeSettings.Add(gameObject);
}
private static void CreateModdedRoleEntry(MatchInfoGuide __instance, CustomRoles role)
{
MatchInfoRolePanel matchInfoRolePanel = Object.Instantiate(__instance.MatchInfoRolePanelPrefab, __instance.settingsTabs[2].GetComponent<Scroller>().Inner);
matchInfoRolePanel.roleName.text = role.ToColoredString();
matchInfoRolePanel.roleDescription.text = Translator.GetString($"{role}Info");
matchInfoRolePanel.roleIcon.sprite = GetRoleBehaviourFromBasis(role).RoleIconColor;
int roleCount = role.GetCount();
string roleChance = Translator.GetString(Options.Rates[role.GetMode() / 5]);
matchInfoRolePanel.roleCount.text = roleCount > 1 ? $"{roleCount}x {roleChance}" : roleChance;
matchInfoRolePanel.roleIcon.material.SetInt(PlayerMaterial.MaskLayer, 50);
matchInfoRolePanel.roleName.fontMaterial.SetFloat(matchInfoRolePanel.STENCIL_NAME, 50f);
matchInfoRolePanel.roleDescription.fontMaterial.SetFloat(matchInfoRolePanel.STENCIL_NAME, 50f);
matchInfoRolePanel.roleCount.fontMaterial.SetFloat(matchInfoRolePanel.STENCIL_NAME, 50f);
}
private static RoleBehaviour GetRoleBehaviourFromBasis(CustomRoles role)
{
var roleBehaviours = RoleManager.Instance.AllRoles;
RoleTypes roleTypes = role.IsGhostRole() ? RoleTypes.GuardianAngel : role switch
{
CustomRoles.Aid or CustomRoles.Doctor or CustomRoles.Medic => RoleTypes.Scientist,
CustomRoles.Captain or CustomRoles.Catcher or CustomRoles.Coroner or CustomRoles.Druid or CustomRoles.EvilTracker or CustomRoles.Hacker or CustomRoles.Scout or CustomRoles.Lookout => RoleTypes.Tracker,
CustomRoles.Beehive or CustomRoles.Demon or CustomRoles.Pelican or CustomRoles.Scavenger or CustomRoles.Spider or CustomRoles.Vampire or CustomRoles.Vulture or CustomRoles.Wasp => RoleTypes.Viper,
CustomRoles.Markseeker or CustomRoles.Soothsayer or CustomRoles.Specter or CustomRoles.SuperStar or CustomRoles.Sunnyboy or CustomRoles.Vacuum => RoleTypes.Noisemaker,
CustomRoles.Prosecutor or CustomRoles.Mayor or CustomRoles.Dictator or CustomRoles.Swapper or CustomRoles.President => RoleTypes.Judge,
_ when role.IsCoven() => RoleTypes.Shapeshifter,
_ when role.IsCrewmate() && role.IsDesyncRole() => RoleTypes.Engineer,
_ when role.GetCrewmateRoleCategory() == RoleOptionType.Crewmate_Investigate => RoleTypes.Detective,
_ => role.GetRoleTypes()
};
roleTypes = roleTypes switch
{
RoleTypes.Crewmate => RoleTypes.Engineer,
RoleTypes.CrewmateGhost => RoleTypes.GuardianAngel,
RoleTypes.Impostor => RoleTypes.Viper,
RoleTypes.ImpostorGhost => RoleTypes.GuardianAngel,
_ => roleTypes
};
foreach (RoleBehaviour roleBehaviour in roleBehaviours)
if (roleBehaviour.Role == roleTypes)
return roleBehaviour;
return roleBehaviours[0];
}
private static void ReColorTabButtons(MatchInfoGuide __instance)
{
Color32 color = new Color32(0, 165, 255, 255);
string[] stateNames = ["Highlight", "Inactive", "Selected"];
foreach (MatchInfoGuideTabButton matchInfoGuideTabButton in __instance.TabButtons)
{
matchInfoGuideTabButton.GetComponentInChildren<TextMeshPro>().color = Color.white;
foreach (string stateName in stateNames)
{
var child = matchInfoGuideTabButton.transform.FindChild(stateName);
child.GetComponent<SpriteRenderer>().color = color;
if (child.childCount > 0) child.DestroyChildren();
}
}
}
}
+17 -2
View File
@@ -1316,7 +1316,7 @@ internal static class MeetingHudUpdatePatch
switch (myRole) switch (myRole)
{ {
case CustomRoles.NiceGuesser or CustomRoles.EvilGuesser or CustomRoles.JudgeOld or CustomRoles.Swapper or CustomRoles.Councillor or CustomRoles.Guesser when !PlayerControl.LocalPlayer.IsAlive(): case CustomRoles.NiceGuesser or CustomRoles.EvilGuesser or CustomRoles.Prosecutor or CustomRoles.Swapper or CustomRoles.Councillor or CustomRoles.Guesser when !PlayerControl.LocalPlayer.IsAlive():
ClearShootButton(__instance, true); ClearShootButton(__instance, true);
break; break;
case CustomRoles.Nemesis when !PlayerControl.LocalPlayer.IsAlive() && !GameObject.Find("ShootButton"): case CustomRoles.Nemesis when !PlayerControl.LocalPlayer.IsAlive() && !GameObject.Find("ShootButton"):
@@ -1632,7 +1632,22 @@ internal static class MeetingHudHandleRpcPatch
PlayerControl target = targetPlayerId.GetPlayer(); PlayerControl target = targetPlayerId.GetPlayer();
if (judge && target && judge.UsesJudgeAbilityAsTrigger() && Main.PlayerStates.TryGetValue(judgePlayerId, out PlayerState state)) if (judge && target && judge.UsesJudgeAbilityAsTrigger() && Main.PlayerStates.TryGetValue(judgePlayerId, out PlayerState state))
return !state.Role.OnJudge(judge, target); {
state.Role.OnJudge(judge, target);
var meetingHud = MeetingHud.Instance;
if (meetingHud && meetingHud.playerStates.FindFirst(x => x.PlayerId == judgePlayerId, out PlayerVoteArea pva))
{
pva.UnsetVote();
meetingHud.RpcClearVote(pva.PlayerId);
meetingHud.UpdateForeground();
pva.VotedForId = byte.MaxValue;
}
return false;
}
break; break;
} }
case (byte)RpcCalls.CloseMeeting when AmongUsClient.Instance.AmHost: case (byte)RpcCalls.CloseMeeting when AmongUsClient.Instance.AmHost:
+3 -3
View File
@@ -993,9 +993,9 @@
"JournalistError.IndexOutOfRange": "You didn't provide enough arguments.", "JournalistError.IndexOutOfRange": "You didn't provide enough arguments.",
"JournalistError.InvalidArgument": "Invalid argument. Use <b>/cmd note {add/remove/clear/view} [value]</b>", "JournalistError.InvalidArgument": "Invalid argument. Use <b>/cmd note {add/remove/clear/view} [value]</b>",
"JournalistError.Unknown": "An unknown error occurred.", "JournalistError.Unknown": "An unknown error occurred.",
"JudgeOld": "Judge", "Prosecutor": "Judge",
"JudgeOldInfo": "Silence in the courtroom!", "ProsecutorInfo": "Silence in the courtroom!",
"JudgeOldInfoLong": "(Crewmates):\\nThe Judge can judge a player during the meeting. If the target is evil, it's killed; if it's wrong, the Judge dies. Use the <b>/cmd tl [player id]</b> command to judge and <b>/cmd id</b> to view player IDs. Judges can judge all players when they're Madmate.", "ProsecutorInfoLong": "(Crewmates):\\nThe Judge can judge a player during the meeting. If the target is evil, it's killed; if it's wrong, the Judge dies. Use the <b>/cmd tl [player id]</b> command to judge and <b>/cmd id</b> to view player IDs. Judges can judge all players when they're Madmate.",
"JudgeCanBeMadmate": "<color=#f8d85a>Judge</color> can become <color=#ff1919>Madmate</color>", "JudgeCanBeMadmate": "<color=#f8d85a>Judge</color> can become <color=#ff1919>Madmate</color>",
"JudgeCanTrialContagious": "Can trial <color=#2E8B57>Contagious</color>", "JudgeCanTrialContagious": "Can trial <color=#2E8B57>Contagious</color>",
"JudgeCanTrialConverted": "Can trial <#ffab1b>Converted</color> players", "JudgeCanTrialConverted": "Can trial <#ffab1b>Converted</color> players",
+1
View File
@@ -111,6 +111,7 @@ public class Empress : CovenBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
if (Starspawn.IsDayBreak) return;
Empower(shapeshifter); Empower(shapeshifter);
} }
@@ -83,7 +83,7 @@ internal class Analyst : RoleBase
CustomRoles.Noisemaker or CustomRoles.NoisemakerEHR => CustomRoles.Bubble.ColoredTextByRole(GetString("Noisemaker")), CustomRoles.Noisemaker or CustomRoles.NoisemakerEHR => CustomRoles.Bubble.ColoredTextByRole(GetString("Noisemaker")),
CustomRoles.Tracker or CustomRoles.TrackerEHR => CustomRoles.Scout.ColoredTextByRole(GetString("Tracker")), CustomRoles.Tracker or CustomRoles.TrackerEHR => CustomRoles.Scout.ColoredTextByRole(GetString("Tracker")),
CustomRoles.Detective or CustomRoles.DetectiveEHR => CustomRoles.Forensic.ColoredTextByRole(GetString("Detective")), CustomRoles.Detective or CustomRoles.DetectiveEHR => CustomRoles.Forensic.ColoredTextByRole(GetString("Detective")),
CustomRoles.Judge or CustomRoles.JudgeEHR => CustomRoles.JudgeOld.ColoredTextByRole(GetString("Judge")), CustomRoles.Judge or CustomRoles.JudgeEHR => CustomRoles.Prosecutor.ColoredTextByRole(GetString("Judge")),
_ => string.Empty _ => string.Empty
} }
: string.Empty; : string.Empty;
@@ -53,7 +53,7 @@ public class Captain : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public override void OnGlobalFixedUpdate(PlayerControl pc, bool lowLoad) public override void OnGlobalFixedUpdate(PlayerControl pc, bool lowLoad)
@@ -134,7 +134,7 @@ public class FortuneTeller : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public static void OnRoleChange(byte id, CustomRoles previousRole, CustomRoles newRole) public static void OnRoleChange(byte id, CustomRoles previousRole, CustomRoles newRole)
@@ -68,6 +68,6 @@ public class Inquisitor : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
} }
@@ -368,6 +368,13 @@ public class Inspector : RoleBase
return true; return true;
} }
public override bool OnJudge(PlayerControl pc, PlayerControl target)
{
if (Starspawn.IsDayBreak) return false;
PickForCompare(target.PlayerId, pc.PlayerId);
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
if (Starspawn.IsDayBreak) return; if (Starspawn.IsDayBreak) return;
@@ -44,24 +44,18 @@ internal class Markseeker : RoleBase
{ {
MarkedId = reader.ReadByte(); MarkedId = reader.ReadByte();
} }
/*
public override bool OnJudge(PlayerControl player, PlayerControl target) public override bool OnJudge(PlayerControl player, PlayerControl target)
{ {
if (Starspawn.IsDayBreak) return false; if (Starspawn.IsDayBreak || !player || !target) return false;
if (player == null || target == null || player.PlayerId == target.PlayerId || MarkedId != byte.MaxValue || Main.DontCancelVoteList.Contains(player.PlayerId)) return false; var command = $"/mark {target.PlayerId}";
ChatCommands.MarkCommand(player, command, command.Split(' '));
MarkedId = target.PlayerId;
Main.DontCancelVoteList.Add(player.PlayerId);
return true; return true;
} }
*/
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
var command = $"/mark {target.PlayerId}"; OnJudge(shapeshifter, target);
ChatCommands.MarkCommand(shapeshifter, command, command.Split(' '));
} }
public static void OnDeath(PlayerControl player) public static void OnDeath(PlayerControl player)
@@ -48,7 +48,7 @@ public class MeetingManager : RoleBase
{ {
if (PlayerIdList == null) return; if (PlayerIdList == null) return;
foreach (byte id in PlayerIdList) foreach (byte id in PlayerIdList)
LateTask.New(() => Utils.SendMessage(dp == pc ? string.Format(GetString("MeetingManagerMessageAboutJudgeSuicide"), dp.GetRealName().Replace("\n", " + "), CustomRoles.JudgeOld.ToColoredString()) : string.Format(GetString("MeetingManagerMessageAboutGuessedRole"), dp.GetAllRoleName().Replace("\n", " + ")), id, CustomRoles.MeetingManager.ColoredTextByRole(GetString("MeetingManagerMessageTitle")), importance: MessageImportance.High), 1f, "Meeting Manager Messages"); LateTask.New(() => Utils.SendMessage(dp == pc ? string.Format(GetString("MeetingManagerMessageAboutJudgeSuicide"), dp.GetRealName().Replace("\n", " + "), CustomRoles.Prosecutor.ToColoredString()) : string.Format(GetString("MeetingManagerMessageAboutGuessedRole"), dp.GetAllRoleName().Replace("\n", " + ")), id, CustomRoles.MeetingManager.ColoredTextByRole(GetString("MeetingManagerMessageTitle")), importance: MessageImportance.High), 1f, "Meeting Manager Messages");
} }
public static void OnSwap(PlayerControl tg1, PlayerControl tg2) public static void OnSwap(PlayerControl tg1, PlayerControl tg2)
@@ -95,6 +95,6 @@ public class Oracle : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
} }
+1 -1
View File
@@ -115,7 +115,7 @@ public class Scout : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false) public override string GetSuffix(PlayerControl seer, PlayerControl target, bool hud = false, bool meeting = false)
@@ -119,7 +119,7 @@ public class Socialite : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public void ReceiveRPC(MessageReader reader) public void ReceiveRPC(MessageReader reader)
@@ -55,7 +55,7 @@ public class Soothsayer : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public static void OnAnyoneDeath(PlayerControl killer) public static void OnAnyoneDeath(PlayerControl killer)
+24 -18
View File
@@ -34,19 +34,19 @@ public class Judge : RoleBase
public override void SetupCustomOption() public override void SetupCustomOption()
{ {
Options.SetupRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.JudgeOld); Options.SetupRoleOptions(Id, TabGroup.CrewmateRoles, CustomRoles.Prosecutor);
TrialLimitPerMeeting = new FloatOptionItem(Id + 10, "TrialLimitPerMeeting", new(0f, 15f, 1f), 1f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]).SetValueFormat(OptionFormat.Times); TrialLimitPerMeeting = new FloatOptionItem(Id + 10, "TrialLimitPerMeeting", new(0f, 15f, 1f), 1f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]).SetValueFormat(OptionFormat.Times);
TrialLimitPerGame = new FloatOptionItem(Id + 9, "TrialLimitPerGame", new(0f, 30f, 1f), 3f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]).SetValueFormat(OptionFormat.Times); TrialLimitPerGame = new FloatOptionItem(Id + 9, "TrialLimitPerGame", new(0f, 30f, 1f), 3f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]).SetValueFormat(OptionFormat.Times);
AbilityUseLimit = new FloatOptionItem(Id + 18, "AbilityUseLimit", new(0f, 30f, 0.5f), 1f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]).SetValueFormat(OptionFormat.Times); AbilityUseLimit = new FloatOptionItem(Id + 18, "AbilityUseLimit", new(0f, 30f, 0.5f), 1f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]).SetValueFormat(OptionFormat.Times);
CanTrialMadmate = new BooleanOptionItem(Id + 12, "JudgeCanTrialMadmate", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]); CanTrialMadmate = new BooleanOptionItem(Id + 12, "JudgeCanTrialMadmate", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]);
CanTrialConverted = new BooleanOptionItem(Id + 16, "JudgeCanTrialConverted", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]); CanTrialConverted = new BooleanOptionItem(Id + 16, "JudgeCanTrialConverted", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]);
CanTrialCrewKilling = new BooleanOptionItem(Id + 13, "JudgeCanTrialnCrewKilling", false, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]); CanTrialCrewKilling = new BooleanOptionItem(Id + 13, "JudgeCanTrialnCrewKilling", false, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]);
CanTrialNeutralB = new BooleanOptionItem(Id + 14, "JudgeCanTrialNeutralB", false, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]); CanTrialNeutralB = new BooleanOptionItem(Id + 14, "JudgeCanTrialNeutralB", false, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]);
CanTrialNeutralE = new BooleanOptionItem(Id + 17, "JudgeCanTrialNeutralE", false, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]); CanTrialNeutralE = new BooleanOptionItem(Id + 17, "JudgeCanTrialNeutralE", false, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]);
CanTrialNeutralK = new BooleanOptionItem(Id + 15, "JudgeCanTrialNeutralK", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]); CanTrialNeutralK = new BooleanOptionItem(Id + 15, "JudgeCanTrialNeutralK", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]);
CanTrialCoven = new BooleanOptionItem(Id + 21, "JudgeCanTrialCoven", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]); CanTrialCoven = new BooleanOptionItem(Id + 21, "JudgeCanTrialCoven", true, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]);
JudgeAbilityUseGainWithEachTaskCompleted = new FloatOptionItem(Id + 19, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 0.3f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]).SetValueFormat(OptionFormat.Times); JudgeAbilityUseGainWithEachTaskCompleted = new FloatOptionItem(Id + 19, "AbilityUseGainWithEachTaskCompleted", new(0f, 5f, 0.05f), 0.3f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]).SetValueFormat(OptionFormat.Times);
AbilityChargesWhenFinishedTasks = new FloatOptionItem(Id + 20, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.05f), 0.2f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.JudgeOld]).SetValueFormat(OptionFormat.Times); AbilityChargesWhenFinishedTasks = new FloatOptionItem(Id + 20, "AbilityChargesWhenFinishedTasks", new(0f, 5f, 0.05f), 0.2f, TabGroup.CrewmateRoles).SetParent(Options.CustomRoleSpawnChances[CustomRoles.Prosecutor]).SetValueFormat(OptionFormat.Times);
} }
public override void Init() public override void Init()
@@ -77,7 +77,7 @@ public class Judge : RoleBase
public static bool TrialMsg(PlayerControl pc, string msg, bool isUI = false) public static bool TrialMsg(PlayerControl pc, string msg, bool isUI = false)
{ {
if (!AmongUsClient.Instance.AmHost || !GameStates.IsInGame || !pc || !pc.Is(CustomRoles.JudgeOld)) return false; if (!AmongUsClient.Instance.AmHost || !GameStates.IsInGame || !pc || !pc.Is(CustomRoles.Prosecutor)) return false;
int operate; // 1:ID 2:Trial int operate; // 1:ID 2:Trial
msg = msg.ToLower().TrimStart().TrimEnd(); msg = msg.ToLower().TrimStart().TrimEnd();
@@ -187,7 +187,7 @@ public class Judge : RoleBase
MeetingManager.OnTrial(dp, pc); MeetingManager.OnTrial(dp, pc);
Utils.AfterPlayerDeathTasks(dp, true); Utils.AfterPlayerDeathTasks(dp, true);
LateTask.New(() => Utils.SendMessage(string.Format(GetString("TrialKill"), name), 255, CustomRoles.JudgeOld.ColoredTextByRole(GetString("TrialKillTitle")), importance: MessageImportance.High), 0.6f, "Guess Msg"); LateTask.New(() => Utils.SendMessage(string.Format(GetString("TrialKill"), name), 255, CustomRoles.Prosecutor.ColoredTextByRole(GetString("TrialKillTitle")), importance: MessageImportance.High), 0.6f, "Guess Msg");
}, 0.2f, "Trial Kill"); }, 0.2f, "Trial Kill");
} }
@@ -228,10 +228,16 @@ public class Judge : RoleBase
return true; return true;
} }
public override bool OnJudge(PlayerControl pc, PlayerControl target)
{
if (Starspawn.IsDayBreak) return false;
TrialMsg(pc, $"/tl {target.PlayerId}");
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
if (Starspawn.IsDayBreak) return; OnJudge(shapeshifter, target);
TrialMsg(shapeshifter, $"/tl {target.PlayerId}");
} }
private static void SendRPC(byte playerId) private static void SendRPC(byte playerId)
@@ -283,7 +289,7 @@ public class Judge : RoleBase
{ {
public static void Postfix(MeetingHud __instance) public static void Postfix(MeetingHud __instance)
{ {
if (PlayerControl.LocalPlayer.Is(CustomRoles.JudgeOld) && PlayerControl.LocalPlayer.IsAlive()) if (PlayerControl.LocalPlayer.Is(CustomRoles.Prosecutor) && PlayerControl.LocalPlayer.IsAlive())
CreateJudgeButton(__instance); CreateJudgeButton(__instance);
} }
} }
@@ -57,11 +57,11 @@ public class Retributionist : RoleBase
public override void AfterMeetingTasks() public override void AfterMeetingTasks()
{ {
if (RetributionistPC == null || !RetributionistPC.IsAlive() || CanUseKillButton(RetributionistPC)) return; if (!RetributionistPC || !RetributionistPC.IsAlive() || CanUseKillButton(RetributionistPC)) return;
PlayerControl campTarget = Camping.GetPlayer(); PlayerControl campTarget = Camping.GetPlayer();
if (ResetCampedPlayerAfterEveryMeeting.GetBool() || campTarget == null || !campTarget.IsAlive()) if (ResetCampedPlayerAfterEveryMeeting.GetBool() || !campTarget || !campTarget.IsAlive())
{ {
Notified = false; Notified = false;
Camping = byte.MaxValue; Camping = byte.MaxValue;
@@ -104,10 +104,17 @@ public class Retributionist : RoleBase
} }
} }
public override bool OnJudge(PlayerControl pc, PlayerControl target)
{
if (Starspawn.IsDayBreak) return false;
var command = $"/retribute {target.PlayerId}";
ChatCommands.RetributeCommand(pc, command, command.Split(' '));
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
var command = $"/retribute {target.PlayerId}"; OnJudge(shapeshifter, target);
ChatCommands.RetributeCommand(shapeshifter, command, command.Split(' '));
} }
public void ReceiveRPC(MessageReader reader) public void ReceiveRPC(MessageReader reader)
@@ -111,7 +111,7 @@ public class Ricochet : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public override void OnReportDeadBody() public override void OnReportDeadBody()
@@ -133,7 +133,7 @@ public class Tether : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public override void OnReportDeadBody() public override void OnReportDeadBody()
+1 -1
View File
@@ -135,7 +135,7 @@ public class CopyCat : RoleBase
CustomRoles.Workaholic or CustomRoles.Pawn => CustomRoles.Snitch, CustomRoles.Workaholic or CustomRoles.Pawn => CustomRoles.Snitch,
CustomRoles.Sunnyboy or CustomRoles.Fabricator => new[] {CustomRoles.Doctor, CustomRoles.ScientistEHR}.RandomElement(), CustomRoles.Sunnyboy or CustomRoles.Fabricator => new[] {CustomRoles.Doctor, CustomRoles.ScientistEHR}.RandomElement(),
CustomRoles.Vindicator or CustomRoles.Pickpocket => CustomRoles.Mayor, CustomRoles.Vindicator or CustomRoles.Pickpocket => CustomRoles.Mayor,
CustomRoles.Councillor or CustomRoles.Magistrate => CustomRoles.JudgeOld, CustomRoles.Councillor or CustomRoles.Magistrate => CustomRoles.Prosecutor,
CustomRoles.EvilGuesser or CustomRoles.Doomsayer or CustomRoles.NecroGuesser or CustomRoles.Augur => CustomRoles.NiceGuesser, CustomRoles.EvilGuesser or CustomRoles.Doomsayer or CustomRoles.NecroGuesser or CustomRoles.Augur => CustomRoles.NiceGuesser,
CustomRoles.Vengeance => CustomRoles.Adrenaline, CustomRoles.Vengeance => CustomRoles.Adrenaline,
CustomRoles.Occultist => CustomRoles.Altruist, CustomRoles.Occultist => CustomRoles.Altruist,
+1 -1
View File
@@ -96,7 +96,7 @@ internal class NiceEraser : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public override void OnReportDeadBody() public override void OnReportDeadBody()
+1 -1
View File
@@ -263,7 +263,7 @@ public class President : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public void ReceiveRPC(MessageReader reader) public void ReceiveRPC(MessageReader reader)
+7
View File
@@ -220,6 +220,13 @@ public class Swapper : RoleBase
catch (Exception e) { Utils.ThrowException(e); } catch (Exception e) { Utils.ThrowException(e); }
} }
public override bool OnJudge(PlayerControl voter, PlayerControl target)
{
if (Starspawn.IsDayBreak) return false;
SwapMsg(voter, $"/sw {target.PlayerId}");
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
if (Starspawn.IsDayBreak) return; if (Starspawn.IsDayBreak) return;
+1 -1
View File
@@ -118,7 +118,7 @@ public class Cleanser : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public override void AfterMeetingTasks() public override void AfterMeetingTasks()
@@ -144,7 +144,7 @@ public class Negotiator : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public static void ReceiveCommand(PlayerControl pc, int index) public static void ReceiveCommand(PlayerControl pc, int index)
@@ -206,7 +206,7 @@ public class Councillor : RoleBase
LateTask.New(() => LateTask.New(() =>
{ {
if (!MakeEvilJudgeClear.GetBool()) if (!MakeEvilJudgeClear.GetBool())
Utils.SendMessage(string.Format(GetString("TrialKill"), name), 255, CustomRoles.JudgeOld.ColoredTextByRole(GetString("TrialKillTitle")), importance: MessageImportance.High); Utils.SendMessage(string.Format(GetString("TrialKill"), name), 255, CustomRoles.Prosecutor.ColoredTextByRole(GetString("TrialKillTitle")), importance: MessageImportance.High);
else else
Utils.SendMessage(string.Format(GetString("MurderKill"), name), 255, CustomRoles.Councillor.ColoredTextByRole(GetString("MurderKillTitle")), importance: MessageImportance.High); Utils.SendMessage(string.Format(GetString("MurderKill"), name), 255, CustomRoles.Councillor.ColoredTextByRole(GetString("MurderKillTitle")), importance: MessageImportance.High);
}, 0.6f, "Guess Msg"); }, 0.6f, "Guess Msg");
@@ -256,10 +256,16 @@ public class Councillor : RoleBase
Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat(); Main.AllPlayerKillCooldown[id] = KillCooldown.GetFloat();
} }
public override bool OnJudge(PlayerControl pc, PlayerControl target)
{
if (Starspawn.IsDayBreak) return false;
MurderMsg(pc, $"/tl {target.PlayerId}");
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
if (Starspawn.IsDayBreak) return; OnJudge(shapeshifter, target);
MurderMsg(shapeshifter, $"/tl {target.PlayerId}");
} }
private static void SendRPC(byte playerId) private static void SendRPC(byte playerId)
@@ -36,10 +36,17 @@ public class Exorcist : RoleBase
playerId.SetAbilityUseLimit(AbilityUseLimit.GetFloat()); playerId.SetAbilityUseLimit(AbilityUseLimit.GetFloat());
} }
public override bool OnJudge(PlayerControl pc, PlayerControl target)
{
if (Starspawn.IsDayBreak) return false;
const string command = "/exo";
ChatCommands.ExoCommand(pc, command, command.Split(' '));
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
const string command = "/exo"; OnJudge(shapeshifter, target);
ChatCommands.ExoCommand(shapeshifter, command, command.Split(' '));
} }
private static void ExorcistOnClick(GameObject exorcistButton) private static void ExorcistOnClick(GameObject exorcistButton)
+11 -5
View File
@@ -34,23 +34,29 @@ public class Loner : RoleBase
Done = false; Done = false;
} }
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override bool OnJudge(PlayerControl pc, PlayerControl target)
{ {
if (Starspawn.IsDayBreak) return; if (Starspawn.IsDayBreak) return false;
if (shapeshifter == null || target == null || shapeshifter.PlayerId == target.PlayerId || Done) return; if (pc == null || target == null || pc.PlayerId == target.PlayerId || Done) return false;
PickedPlayer = target.PlayerId; PickedPlayer = target.PlayerId;
PickedRole = Main.CustomRoleValues.Where(x => x.IsImpostor() && !x.IsVanilla() && !CustomRoleSelector.RoleResult.ContainsValue(x) && x.GetMode() != 0).RandomElement(); PickedRole = Main.CustomRoleValues.Where(x => x.IsImpostor() && !x.IsVanilla() && !CustomRoleSelector.RoleResult.ContainsValue(x) && x.GetMode() != 0).RandomElement();
if (PickedRole == CustomRoles.Crewmate) PickedRole = CustomRoles.ImpostorEHR; if (PickedRole == CustomRoles.Crewmate) PickedRole = CustomRoles.ImpostorEHR;
Utils.SendMessage("\n", shapeshifter.PlayerId, string.Format(Translator.GetString("Loner.Picked"), PickedPlayer.ColoredPlayerName(), PickedRole.ToColoredString()), importance: MessageImportance.High); Utils.SendMessage("\n", pc.PlayerId, string.Format(GetString("Loner.Picked"), PickedPlayer.ColoredPlayerName(), PickedRole.ToColoredString()), importance: MessageImportance.High);
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{
OnJudge(shapeshifter, target);
} }
public override void AfterMeetingTasks() public override void AfterMeetingTasks()
{ {
var pc = PickedPlayer.GetPlayer(); var pc = PickedPlayer.GetPlayer();
if (!Done && PickedPlayer != byte.MaxValue && PickedRole != CustomRoles.Crewmate && pc != null) if (!Done && PickedPlayer != byte.MaxValue && PickedRole != CustomRoles.Crewmate && pc)
{ {
Done = true; Done = true;
pc.RpcSetCustomRole(PickedRole); pc.RpcSetCustomRole(PickedRole);
@@ -135,7 +135,7 @@ internal class EvilEraser : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public override void OnReportDeadBody() public override void OnReportDeadBody()
+1 -1
View File
@@ -121,7 +121,7 @@ public class Gangster : RoleBase
(pc.Is(CustomRoles.Sheriff) && !SheriffCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Sheriff) && !SheriffCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.Mayor) && !MayorCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Mayor) && !MayorCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.NiceGuesser) && !NGuesserCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.NiceGuesser) && !NGuesserCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.JudgeOld) && !JudgeCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Prosecutor) && !JudgeCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.Marshall) && !MarshallCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Marshall) && !MarshallCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.Investigator) && !InvestigatorCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.Investigator) && !InvestigatorCanBeMadmate.GetBool()) ||
(pc.Is(CustomRoles.President) && !PresidentCanBeMadmate.GetBool()) || (pc.Is(CustomRoles.President) && !PresidentCanBeMadmate.GetBool()) ||
+1 -1
View File
@@ -34,6 +34,6 @@ internal class Godfather : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
} }
@@ -38,10 +38,17 @@ public class Ventriloquist : RoleBase
playerId.SetAbilityUseLimit(UseLimit.GetFloat()); playerId.SetAbilityUseLimit(UseLimit.GetFloat());
} }
public override bool OnJudge(PlayerControl pc, PlayerControl target)
{
if (Starspawn.IsDayBreak) return false;
var command = $"/target {target.PlayerId}";
ChatCommands.TargetCommand(pc, command, command.Split(' '));
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
var command = $"/target {target.PlayerId}"; OnJudge(shapeshifter, target);
ChatCommands.TargetCommand(shapeshifter, command, command.Split(' '));
} }
private static void VentriloquistOnClick(byte playerId /*, MeetingHud __instance*/) private static void VentriloquistOnClick(byte playerId /*, MeetingHud __instance*/)
+1 -1
View File
@@ -79,7 +79,7 @@ public class Clerk : RoleBase
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
OnVote(shapeshifter, target); OnJudge(shapeshifter, target);
} }
public override void AfterMeetingTasks() public override void AfterMeetingTasks()
+9 -2
View File
@@ -77,10 +77,17 @@ public class Starspawn : RoleBase
return false; return false;
} }
public override bool OnJudge(PlayerControl pc, PlayerControl target)
{
if (IsDayBreak) return false;
const string command = "/daybreak";
ChatCommands.DayBreakCommand(pc, command, command.Split(' '));
return true;
}
public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target) public override void OnMeetingShapeshift(PlayerControl shapeshifter, PlayerControl target)
{ {
const string command = "/daybreak"; OnJudge(shapeshifter, target);
ChatCommands.DayBreakCommand(shapeshifter, command, command.Split(' '));
} }
public void ReceiveRPC(MessageReader reader) public void ReceiveRPC(MessageReader reader)