mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
lots of fixes still
This commit is contained in:
1 parent
63a7f197c4
commit
f56649494f
11 files changed
+546
-489
No files matched your search
+1
-1
@@ -7,7 +7,7 @@
|
||||
<Description>EHR</Description>
|
||||
<Authors>Gurge44</Authors>
|
||||
<langVersion>preview</langVersion>
|
||||
<AmongUs>C:\Program Files\Epic Games\AmongUs</AmongUs>
|
||||
<AmongUs>E:\Program Files\AmongUs</AmongUs>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Optimize>True</Optimize>
|
||||
<AssemblyName>$(MSBuildProjectName)</AssemblyName>
|
||||
|
||||
@@ -37,58 +37,58 @@ public static class AllInOneGameMode
|
||||
bool defaultValue = mode is CustomGameMode.HotPotato or CustomGameMode.MoveAndStop or CustomGameMode.NaturalDisasters or CustomGameMode.RoomRush or CustomGameMode.SoloKombat or CustomGameMode.Speedrun;
|
||||
|
||||
GameModeIntegrationSettings[mode] = new BooleanOptionItem(id++, $"AllInOne.{mode}.Integration", defaultValue, TabGroup.GameSettings)
|
||||
.SetHeader((int)mode == 2)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetHeader((int)mode == 2)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
}
|
||||
|
||||
HotPotatoTimerMultiplier = new IntegerOptionItem(id++, "AllInOne.HotPotato.TimerMultiplier", new(1, 10, 1), 3, TabGroup.GameSettings)
|
||||
.SetHeader(true)
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetHeader(true)
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
MoveAndStopMinGreenTimeBonus = new IntegerOptionItem(id++, "AllInOne.MoveAndStop.MinGreenTimeBonus", new(0, 60, 1), 5, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
MoveAndStopMaxGreenTimeBonus = new IntegerOptionItem(id++, "AllInOne.MoveAndStop.MaxGreenTimeBonus", new(0, 60, 1), 20, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetValueFormat(OptionFormat.Seconds)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
NaturalDisastersDisasterSpawnCooldownMultiplier = new IntegerOptionItem(id++, "AllInOne.NaturalDisasters.DisasterSpawnCooldownMultiplier", new(1, 10, 1), 4, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
NaturalDisastersWarningDurationMultiplier = new IntegerOptionItem(id++, "AllInOne.NaturalDisasters.WarningDurationMultiplier", new(1, 10, 1), 6, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
RoomRushTimeLimitMultiplier = new IntegerOptionItem(id++, "AllInOne.RoomRush.TimeLimitMultiplier", new(1, 10, 1), 3, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
RoomRushDontKillLastPlayer = new BooleanOptionItem(id++, "AllInOne.RoomRush.DontKillLastPlayer", true, TabGroup.GameSettings)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
RoomRushDontLowerTimeLimitWhenTwoPlayersEnterCorrectRoom = new BooleanOptionItem(id++, "AllInOne.RoomRush.DontLowerTimeLimitWhenTwoPlayersEnterCorrectRoom", true, TabGroup.GameSettings)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
RoomRushDontKillPlayersOutsideRoomWhenTimeRunsOut = new BooleanOptionItem(id++, "AllInOne.RoomRush.DontKillPlayersOutsideRoomWhenTimeRunsOut", true, TabGroup.GameSettings)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
|
||||
SpeedrunTimeLimitMultiplier = new IntegerOptionItem(id, "AllInOne.Speedrun.TimeLimitMultiplier", new(1, 10, 1), 3, TabGroup.GameSettings)
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
.SetValueFormat(OptionFormat.Multiplier)
|
||||
.SetGameMode(gameMode)
|
||||
.SetColor(color);
|
||||
}
|
||||
|
||||
public static void Init()
|
||||
|
||||
@@ -142,21 +142,22 @@ internal static class CustomRoleSelector
|
||||
}
|
||||
|
||||
var neutralLimits = Options.FactionMinMaxSettings[Team.Neutral];
|
||||
var numNeutrals = IRandom.Instance.Next(neutralLimits.MinSetting.GetInt(), neutralLimits.MaxSetting.GetInt() + 1);
|
||||
|
||||
if (Roles[RoleAssignType.Impostor].Count == 0 && neutralLimits.MaxSetting.GetInt() == 0 && !Main.SetRoles.Values.Any(x => x.IsImpostor() || x.IsNK()))
|
||||
if (Roles[RoleAssignType.Impostor].Count == 0 && numNeutrals == 0 && !Main.SetRoles.Values.Any(x => x.IsImpostor() || x.IsNK()))
|
||||
{
|
||||
Roles[RoleAssignType.Impostor].Add(new(CustomRoles.ImpostorEHR, 100, optImpNum));
|
||||
Logger.Warn("Adding Vanilla Impostor", "CustomRoleSelector");
|
||||
}
|
||||
|
||||
if (Roles[RoleAssignType.Crewmate].Count == 0 && neutralLimits.MaxSetting.GetInt() == 0 && !Main.SetRoles.Values.Any(x => x.IsCrewmate()))
|
||||
if (Roles[RoleAssignType.Crewmate].Count == 0 && numNeutrals == 0 && !Main.SetRoles.Values.Any(x => x.IsCrewmate()))
|
||||
{
|
||||
Roles[RoleAssignType.Crewmate].Add(new(CustomRoles.CrewmateEHR, 100, playerCount));
|
||||
Logger.Warn("Adding Vanilla Crewmates", "CustomRoleSelector");
|
||||
}
|
||||
|
||||
Logger.Info($"Number of Impostors: {optImpNum}", "FactionLimits");
|
||||
Logger.Info($"Number of Neutrals: {neutralLimits.MinSetting.GetInt()} - {neutralLimits.MaxSetting.GetInt()}", "FactionLimits");
|
||||
Logger.Info($"Number of Neutrals: {neutralLimits.MinSetting.GetInt()} - {neutralLimits.MaxSetting.GetInt()} => {numNeutrals}", "FactionLimits");
|
||||
|
||||
Logger.Msg("=====================================================", "AllActiveRoles");
|
||||
Logger.Info(string.Join(", ", Roles[RoleAssignType.Impostor].Select(x => $"{x.Role}: {x.SpawnChance}% - {x.MaxCount}")), "ImpRoles");
|
||||
@@ -166,24 +167,17 @@ internal static class CustomRoleSelector
|
||||
Logger.Msg("=====================================================", "AllActiveRoles");
|
||||
|
||||
Dictionary<RoleOptionType, int> subCategoryLimits = Options.RoleSubCategoryLimits
|
||||
.Where(x => x.Value[0].GetBool())
|
||||
.Where(x => x.Key.GetTabFromOptionType() == TabGroup.NeutralRoles || x.Value[0].GetBool())
|
||||
.ToDictionary(x => x.Key, x => IRandom.Instance.Next(x.Value[1].GetInt(), x.Value[2].GetInt() + 1));
|
||||
|
||||
if (subCategoryLimits.Count > 0) Logger.Info($"Sub-Category Limits: {string.Join(", ", subCategoryLimits.Select(x => $"{x.Key}: {x.Value}"))}", "SubCategoryLimits");
|
||||
|
||||
|
||||
var nkHasLimit = subCategoryLimits.TryGetValue(RoleOptionType.Neutral_Killing, out var nkSetLimit);
|
||||
var nkLimit = nkHasLimit ? nkSetLimit : neutralLimits.MaxSetting.GetInt();
|
||||
|
||||
var neHasLimit = subCategoryLimits.TryGetValue(RoleOptionType.Neutral_Evil, out var neLimit);
|
||||
var nbHasLimit = subCategoryLimits.TryGetValue(RoleOptionType.Neutral_Benign, out var nbLimit);
|
||||
int nkLimit = subCategoryLimits[RoleOptionType.Neutral_Killing];
|
||||
int nnkLimit = subCategoryLimits[RoleOptionType.Neutral_Evil] + subCategoryLimits[RoleOptionType.Neutral_Benign];
|
||||
|
||||
int nnkLimit = neHasLimit && nbHasLimit ? neLimit + nbLimit : neHasLimit ? neLimit : nbHasLimit ? nbLimit : neutralLimits.MaxSetting.GetInt() - (nkHasLimit ? nkSetLimit : 0);
|
||||
|
||||
Logger.Info($"Number of Neutral Killing roles to select: {nkLimit}", "NeutralKillingLimit");
|
||||
Logger.Info($"Number of Non-Killing Neutral roles to select: {nnkLimit}", "NonKillingNeutralLimit");
|
||||
|
||||
|
||||
|
||||
foreach (RoleAssignType type in Roles.Keys.ToArray())
|
||||
{
|
||||
Roles[type] = Roles[type]
|
||||
@@ -191,10 +185,10 @@ internal static class CustomRoleSelector
|
||||
.OrderBy(x => x.SpawnChance != 100)
|
||||
.DistinctBy(x => x.Role)
|
||||
.Select(x => (
|
||||
Info: x,
|
||||
Limit: subCategoryLimits.TryGetValue(x.OptionType, out var limit)
|
||||
? (Exists: true, Value: limit)
|
||||
: (Exists: false, Value: 0)))
|
||||
Info: x,
|
||||
Limit: subCategoryLimits.TryGetValue(x.OptionType, out var limit)
|
||||
? (Exists: true, Value: limit)
|
||||
: (Exists: false, Value: 0)))
|
||||
.GroupBy(x => x.Info.OptionType)
|
||||
.Select(x => (Grouping: x, x.FirstOrDefault().Limit))
|
||||
.SelectMany(x => x.Limit.Exists ? x.Grouping.Take(x.Limit.Value) : x.Grouping)
|
||||
@@ -211,9 +205,16 @@ internal static class CustomRoleSelector
|
||||
.ToList();
|
||||
}
|
||||
|
||||
Logger.Msg("======================================================", "PreSelectedRoles");
|
||||
Logger.Info(string.Join(", ", Roles[RoleAssignType.Impostor].Select(x => x.Role.ToString())), "PreSelectedImpostorRoles");
|
||||
Logger.Info(string.Join(", ", Roles[RoleAssignType.NeutralKilling].Select(x => x.Role.ToString())), "PreSelectedNKRoles");
|
||||
Logger.Info(string.Join(", ", Roles[RoleAssignType.NonKillingNeutral].Select(x => x.Role.ToString())), "PreSelectedNNKRoles");
|
||||
Logger.Info(string.Join(", ", Roles[RoleAssignType.Crewmate].Select(x => x.Role.ToString())), "PreSelectedCrewRoles");
|
||||
Logger.Msg("======================================================", "PreSelectedRoles");
|
||||
|
||||
int attempts = 0;
|
||||
|
||||
while (Roles[RoleAssignType.NeutralKilling].Count + Roles[RoleAssignType.NonKillingNeutral].Count > neutralLimits.MaxSetting.GetInt())
|
||||
while (Roles[RoleAssignType.NeutralKilling].Count + Roles[RoleAssignType.NonKillingNeutral].Count > numNeutrals)
|
||||
{
|
||||
if (attempts++ > 100) break;
|
||||
|
||||
|
||||
@@ -591,7 +591,7 @@ internal static class CustomRolesHelper
|
||||
|
||||
public static bool IsImpostor(this CustomRoles role)
|
||||
{
|
||||
return role is
|
||||
return (role == CustomRoles.DoubleAgent && !Main.IntroDestroyed) || role is
|
||||
CustomRoles.DoubleAgent or
|
||||
CustomRoles.Impostor or
|
||||
CustomRoles.ImpostorEHR or
|
||||
|
||||
+401
-399
File diff suppressed because it is too large.
Load diff
+15
-11
@@ -20,7 +20,7 @@ internal class ControllerManagerUpdatePatch
|
||||
|
||||
public static void Postfix( /*ControllerManager __instance*/)
|
||||
{
|
||||
if (GameStates.IsLobby)
|
||||
if (GameStates.IsLobby && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Tab)) OptionShower.Next();
|
||||
|
||||
@@ -28,10 +28,12 @@ internal class ControllerManagerUpdatePatch
|
||||
if (OrGetKeysDown(KeyCode.Alpha1 + i, KeyCode.Keypad1 + i) && OptionShower.Pages.Count >= i + 1)
|
||||
OptionShower.CurrentPage = i;
|
||||
|
||||
if (KeysDown(KeyCode.Return) && GameSettingMenu.Instance != null && GameSettingMenu.Instance.isActiveAndEnabled) GameSettingMenuPatch.SearchForOptionsAction?.Invoke();
|
||||
if (KeysDown(KeyCode.Return) && GameSettingMenu.Instance != null && GameSettingMenu.Instance.isActiveAndEnabled)
|
||||
GameSettingMenuPatch.SearchForOptionsAction?.Invoke();
|
||||
}
|
||||
|
||||
if (KeysDown(KeyCode.LeftShift, KeyCode.LeftControl, KeyCode.X)) ExileController.Instance?.ReEnableGameplay();
|
||||
if (KeysDown(KeyCode.LeftShift, KeyCode.LeftControl, KeyCode.X))
|
||||
ExileController.Instance?.ReEnableGameplay();
|
||||
|
||||
if (KeysDown(KeyCode.LeftAlt, KeyCode.Return)) LateTask.New(SetResolutionManager.Postfix, 0.01f, "Fix Button Position");
|
||||
|
||||
@@ -172,7 +174,8 @@ internal class ControllerManagerUpdatePatch
|
||||
HudManager.Instance.StartCoroutine(DestroyableSingleton<HudManager>.Instance.CoShowIntro());
|
||||
}
|
||||
|
||||
if (KeysDown(KeyCode.Return, KeyCode.V, KeyCode.LeftShift) && GameStates.IsMeeting) MeetingHud.Instance.RpcClearVote(AmongUsClient.Instance.ClientId);
|
||||
if (KeysDown(KeyCode.Return, KeyCode.V, KeyCode.LeftShift) && GameStates.IsMeeting)
|
||||
MeetingHud.Instance.RpcClearVote(AmongUsClient.Instance.ClientId);
|
||||
|
||||
if (KeysDown(KeyCode.Return, KeyCode.D, KeyCode.LeftShift) && GameStates.IsInGame)
|
||||
{
|
||||
@@ -192,32 +195,32 @@ internal class ControllerManagerUpdatePatch
|
||||
foreach (PlayerTask task in PlayerControl.LocalPlayer.myTasks)
|
||||
PlayerControl.LocalPlayer.RpcCompleteTask(task.Id);
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Y) && !GameStates.IsMeeting)
|
||||
if (Input.GetKeyDown(KeyCode.Y) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
RPC.SyncCustomSettingsRPC();
|
||||
Logger.SendInGame(GetString("SyncCustomSettingsRPC"));
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Equals) && !GameStates.IsMeeting)
|
||||
if (Input.GetKeyDown(KeyCode.Equals) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
Main.VisibleTasksCount = !Main.VisibleTasksCount;
|
||||
DestroyableSingleton<HudManager>.Instance.Notifier.AddDisconnectMessage($"VisibleTaskCount changed to {Main.VisibleTasksCount}.");
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.I) && !GameStates.IsMeeting)
|
||||
if (Input.GetKeyDown(KeyCode.I) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
Logger.SendInGame(PlayerControl.LocalPlayer.Pos().ToString());
|
||||
Logger.SendInGame(PlayerControl.LocalPlayer.GetPlainShipRoom()?.RoomId.ToString() ?? "null");
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.C) && !GameStates.IsMeeting)
|
||||
if (Input.GetKeyDown(KeyCode.C) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
|
||||
if (!pc.AmOwner)
|
||||
pc.MyPhysics.RpcEnterVent(2);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.V) && !GameStates.IsMeeting)
|
||||
if (Input.GetKeyDown(KeyCode.V) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
Vector2 pos = PlayerControl.LocalPlayer.NetTransform.transform.position;
|
||||
|
||||
@@ -231,14 +234,15 @@ internal class ControllerManagerUpdatePatch
|
||||
}
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.B) && !GameStates.IsMeeting)
|
||||
if (Input.GetKeyDown(KeyCode.B) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
{
|
||||
foreach (PlayerControl pc in PlayerControl.AllPlayerControls)
|
||||
if (!pc.AmOwner)
|
||||
pc.MyPhysics.RpcExitVent(2);
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.N) && !GameStates.IsMeeting) VentilationSystem.Update(VentilationSystem.Operation.StartCleaning, 0);
|
||||
if (Input.GetKeyDown(KeyCode.N) && !GameStates.IsMeeting && !HudManager.Instance.Chat.IsOpenOrOpening)
|
||||
VentilationSystem.Update(VentilationSystem.Operation.StartCleaning, 0);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -227,10 +227,13 @@ internal static class CheckMurderPatch
|
||||
return false;
|
||||
case CustomGameMode.AllInOne:
|
||||
if (killer.Is(CustomRoles.Killer)) killer.Kill(target);
|
||||
|
||||
if (CustomGameMode.CaptureTheFlag.IsActiveOrIntegrated())
|
||||
CTFManager.OnCheckMurder(killer, target);
|
||||
|
||||
if (CustomGameMode.HideAndSeek.IsActiveOrIntegrated())
|
||||
HnSManager.OnCheckMurder(killer, target);
|
||||
|
||||
return false;
|
||||
case CustomGameMode.Speedrun:
|
||||
killer.Kill(target);
|
||||
@@ -278,9 +281,9 @@ internal static class CheckMurderPatch
|
||||
return false;
|
||||
case true when killer.GetCustomRole().GetDYRole() == RoleTypes.Impostor:
|
||||
if (killer.CheckDoubleTrigger(target, () =>
|
||||
{
|
||||
if (CheckMurder()) killer.RpcCheckAndMurder(target);
|
||||
}))
|
||||
{
|
||||
if (CheckMurder()) killer.RpcCheckAndMurder(target);
|
||||
}))
|
||||
killer.RpcCheckAndMurder(target);
|
||||
|
||||
return false;
|
||||
@@ -697,7 +700,7 @@ internal static class MurderPlayerPatch
|
||||
delay = Math.Max(delay, 0.15f);
|
||||
if (delay > 0.15f && Options.BaitDelayNotify.GetBool()) killer.Notify(ColorString(GetRoleColor(CustomRoles.Bait), string.Format(GetString("KillBaitNotify"), (int)delay)), delay);
|
||||
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} 击杀诱饵 => {target.GetNameWithRole().RemoveHtmlTags()}", "MurderPlayer");
|
||||
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} killed Bait => {target.GetNameWithRole().RemoveHtmlTags()}", "MurderPlayer");
|
||||
|
||||
LateTask.New(() =>
|
||||
{
|
||||
@@ -1614,9 +1617,9 @@ internal static class FixedUpdatePatch
|
||||
if (seer.IsDousedPlayer(target))
|
||||
Mark.Append($"<color={GetRoleColorCode(CustomRoles.Arsonist)}>▲</color>");
|
||||
else if (
|
||||
Arsonist.CurrentDousingTarget != byte.MaxValue &&
|
||||
Arsonist.CurrentDousingTarget == target.PlayerId
|
||||
)
|
||||
Arsonist.CurrentDousingTarget != byte.MaxValue &&
|
||||
Arsonist.CurrentDousingTarget == target.PlayerId
|
||||
)
|
||||
Mark.Append($"<color={GetRoleColorCode(CustomRoles.Arsonist)}>△</color>");
|
||||
|
||||
break;
|
||||
@@ -1624,9 +1627,9 @@ internal static class FixedUpdatePatch
|
||||
if (seer.IsDrawPlayer(target))
|
||||
Mark.Append($"<color={GetRoleColorCode(CustomRoles.Revolutionist)}>●</color>");
|
||||
else if (
|
||||
Revolutionist.CurrentDrawTarget != byte.MaxValue &&
|
||||
Revolutionist.CurrentDrawTarget == target.PlayerId
|
||||
)
|
||||
Revolutionist.CurrentDrawTarget != byte.MaxValue &&
|
||||
Revolutionist.CurrentDrawTarget == target.PlayerId
|
||||
)
|
||||
Mark.Append($"<color={GetRoleColorCode(CustomRoles.Revolutionist)}>○</color>");
|
||||
|
||||
break;
|
||||
@@ -2353,4 +2356,13 @@ internal static class ShouldProcessRpcPatch
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.RpcBootFromVent))]
|
||||
static class BootFromVentPatch
|
||||
{
|
||||
public static bool Prefix(PlayerPhysics __instance)
|
||||
{
|
||||
return !GameStates.IsInTask || ExileController.Instance || __instance == null || __instance.myPlayer == null || !__instance.myPlayer.IsAlive() || !__instance.myPlayer.Is(CustomRoles.Nimble);
|
||||
}
|
||||
}
|
||||
+44
-5
@@ -22,6 +22,7 @@ internal static class TextBoxTMPSetTextPatch
|
||||
{
|
||||
private static TextMeshPro PlaceHolderText;
|
||||
private static TextMeshPro CommandInfoText;
|
||||
private static TextMeshPro AdditionalInfoText;
|
||||
|
||||
public static bool IsInvalidCommand;
|
||||
|
||||
@@ -130,10 +131,28 @@ internal static class TextBoxTMPSetTextPatch
|
||||
CommandInfoText.transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
if (AdditionalInfoText == null)
|
||||
{
|
||||
HudManager hud = DestroyableSingleton<HudManager>.Instance;
|
||||
AdditionalInfoText = Object.Instantiate(hud.KillButton.cooldownTimerText, hud.transform, true);
|
||||
AdditionalInfoText.name = "AdditionalInfoText";
|
||||
AdditionalInfoText.alignment = TextAlignmentOptions.Left;
|
||||
AdditionalInfoText.verticalAlignment = VerticalAlignmentOptions.Top;
|
||||
AdditionalInfoText.transform.localPosition = new(-5f, 0f, 0f);
|
||||
AdditionalInfoText.overflowMode = TextOverflowModes.Overflow;
|
||||
AdditionalInfoText.enableWordWrapping = false;
|
||||
AdditionalInfoText.color = Color.white;
|
||||
AdditionalInfoText.fontSize = AdditionalInfoText.fontSizeMax = AdditionalInfoText.fontSizeMin = 1.8f;
|
||||
AdditionalInfoText.sortingOrder = 1000;
|
||||
AdditionalInfoText.transform.SetAsLastSibling();
|
||||
}
|
||||
|
||||
string inputForm = input.TrimStart('/');
|
||||
string text = "/" + (exactMatch ? inputForm : command.CommandForms.Where(x => x.All(char.IsAscii) && x.StartsWith(inputForm)).MaxBy(x => x.Length));
|
||||
var info = $"<b>{command.Description}</b>";
|
||||
|
||||
string additionalInfo = string.Empty;
|
||||
|
||||
if (exactMatch && command.Arguments.Length > 0)
|
||||
{
|
||||
bool poll = command.CommandForms.Contains("poll");
|
||||
@@ -151,7 +170,9 @@ internal static class TextBoxTMPSetTextPatch
|
||||
if (command.ArgsDescriptions.Length <= i) break;
|
||||
|
||||
int skip = poll ? input.TakeWhile(x => x != '?').Count(x => x == ' ') - 1 : 0;
|
||||
string arg = poll ? i == 0 ? args[..++skip].Join(delimiter: " ") : args[spaces - 1 < i ? skip + i + spaces : skip + i] : args[spaces > i ? i : i + spaces];
|
||||
string arg = say ? args[0] : poll ? i == 0 ? args[..++skip].Join(delimiter: " ") : args[spaces - 1 < i ? skip + i + spaces : skip + i] : args[spaces > i ? i : i + spaces];
|
||||
|
||||
string argName = command.Arguments.Split(' ')[i];
|
||||
bool current = spaces - 1 == i, invalid = IsInvalidArg(), valid = IsValidArg();
|
||||
|
||||
info += "\n" + (invalid, current, valid) switch
|
||||
@@ -167,11 +188,18 @@ internal static class TextBoxTMPSetTextPatch
|
||||
info += $" - <b>{arg}</b>{GetExtraArgInfo()}: {command.ArgsDescriptions[i]}";
|
||||
if (current || invalid || valid) info += "</color>";
|
||||
|
||||
if (additionalInfo.Length == 0 && argName.Replace('[', '{').Replace(']', '}') is "{id}" or "{id1}" or "{id2}")
|
||||
{
|
||||
var allIds = Main.AllPlayerControls.ToDictionary(x => x.PlayerId.ColoredPlayerName(), x => x.PlayerId);
|
||||
additionalInfo = $"<b><u>{Translator.GetString("PlayerIdList").TrimEnd(' ')}</u></b>\n{string.Join('\n', allIds.Select(x => $"<b>{x.Key}</b> \uffeb <b>{x.Value}</b>"))}";
|
||||
OptionShower.CurrentPage = 0;
|
||||
}
|
||||
|
||||
continue;
|
||||
|
||||
bool IsInvalidArg()
|
||||
{
|
||||
return arg != command.Arguments.Split(' ')[i] && command.Arguments.Split(' ')[i] switch
|
||||
return arg != argName && argName switch
|
||||
{
|
||||
"{id}" or "{id1}" or "{id2}" => !byte.TryParse(arg, out byte id) || Main.AllPlayerControls.All(x => x.PlayerId != id),
|
||||
"{number}" or "{level}" or "{duration}" or "{number1}" or "{number2}" => !int.TryParse(arg, out int num) || num < 0,
|
||||
@@ -186,7 +214,7 @@ internal static class TextBoxTMPSetTextPatch
|
||||
|
||||
bool IsValidArg()
|
||||
{
|
||||
return command.Arguments.Split(' ')[i].Replace('[', '{').Replace(']', '}') switch
|
||||
return argName switch
|
||||
{
|
||||
"{id}" or "{id1}" or "{id2}" => byte.TryParse(arg, out byte id) && Main.AllPlayerControls.Any(x => x.PlayerId == id),
|
||||
"{team}" => arg is "crew" or "imp",
|
||||
@@ -201,7 +229,7 @@ internal static class TextBoxTMPSetTextPatch
|
||||
{
|
||||
return !IsValidArg()
|
||||
? string.Empty
|
||||
: command.Arguments.Split(' ')[i] switch
|
||||
: argName switch
|
||||
{
|
||||
"{id}" or "{id1}" or "{id2}" => $" ({byte.Parse(arg).ColoredPlayerName()})",
|
||||
"{role}" or "{addon}" when ChatCommands.GetRoleByName(arg, out CustomRoles role) => $" ({role.ToColoredString()})",
|
||||
@@ -213,11 +241,17 @@ internal static class TextBoxTMPSetTextPatch
|
||||
|
||||
PlaceHolderText.text = text;
|
||||
CommandInfoText.text = info;
|
||||
AdditionalInfoText.text = additionalInfo;
|
||||
|
||||
PlaceHolderText.enabled = true;
|
||||
CommandInfoText.enabled = true;
|
||||
AdditionalInfoText.enabled = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Utils.ThrowException(e);
|
||||
Destroy();
|
||||
}
|
||||
catch { Destroy(); }
|
||||
|
||||
return;
|
||||
|
||||
@@ -225,6 +259,7 @@ internal static class TextBoxTMPSetTextPatch
|
||||
{
|
||||
if (PlaceHolderText != null) PlaceHolderText.enabled = false;
|
||||
if (CommandInfoText != null) CommandInfoText.enabled = false;
|
||||
if (AdditionalInfoText != null) AdditionalInfoText.enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +269,9 @@ internal static class TextBoxTMPSetTextPatch
|
||||
|
||||
__instance.freeChatField.textArea.SetText(PlaceHolderText.text);
|
||||
__instance.freeChatField.textArea.compoText = "";
|
||||
|
||||
if (AdditionalInfoText != null && AdditionalInfoText.text != "")
|
||||
OptionShower.CurrentPage = 0;
|
||||
}
|
||||
|
||||
public static void Update()
|
||||
@@ -243,6 +281,7 @@ internal static class TextBoxTMPSetTextPatch
|
||||
bool open = HudManager.Instance?.Chat?.IsOpenOrOpening ?? false;
|
||||
PlaceHolderText?.gameObject.SetActive(open);
|
||||
CommandInfoText?.gameObject.SetActive(open);
|
||||
AdditionalInfoText?.gameObject.SetActive(open);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
@@ -2324,6 +2324,7 @@
|
||||
"CommandDescription.Achievements": "See which achievements you have unlocked and which you haven't",
|
||||
"CommandDescription.DeathNote": "Guess someone's real name as the Note Killer.",
|
||||
"CommandDescription.Whisper": "Whisper a message to a player.",
|
||||
"CommandDescription.Spectate": "Makes you a spectator for the next game. You should just enable Game Master as the host.",
|
||||
"CommandArgs.ChangeSetting.Name": "The setting's name to change (leave blank to view all settings)",
|
||||
"CommandArgs.ChangeSetting.UnknownValue": "(leave blank to view what to put here)",
|
||||
"CommandArgs.Rename.Name": "Your new name",
|
||||
@@ -4079,7 +4080,7 @@
|
||||
"GuessBackstabber": "You cannot guess a revealed Backstabber.",
|
||||
"Curser": "Curser",
|
||||
"CurserInfo": "Make Others' Life Worse",
|
||||
"CurserInfoLong": "(Neutrals):\\nAs the Curser, when you use your kill button on someone, they will get one of the following:<size=80%>\\n- -1 ability use\\n- +1 harmful add-on\\n- permanent low vision\\n- permanent low speed</size>\\nYou win if crewmates lose.",
|
||||
"CurserInfoLong": "(Neutrals):\\nAs the Curser, when you use your kill button on someone, you can single click on them to reveal their alignment, and double click to give them one of the following effects:<size=80%>\\n- -1 ability use\\n- +1 harmful add-on\\n- permanent low vision\\n- permanent low speed</size>\\nYou win if crewmates lose.",
|
||||
"Curser.LowerVision": "Permanent Lower Vision",
|
||||
"Curser.LowerSpeed": "Permanent Lower Speed",
|
||||
"Curser.Notify.0": "You've removed an ability use from your target",
|
||||
|
||||
@@ -81,7 +81,7 @@ public class President : RoleBase
|
||||
break;
|
||||
case Decree.GovernmentRecruiting:
|
||||
DecreeSettings[decree].Add(new StringOptionItem(++id, "President.GovernmentRecruiting.RecruitedRole", GovernmentRecruitRoles.Select(x => x.ToColoredString()).ToArray(), 0, tab, noTranslation: true)
|
||||
.SetParent(DecreeSettings[decree][0]));
|
||||
.SetParent(DecreeSettings[decree][0]));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -233,9 +233,10 @@ public class President : RoleBase
|
||||
}
|
||||
|
||||
CustomRoles role = GovernmentRecruitRoles[DecreeSettings[Decree.GovernmentRecruiting][1].GetValue()];
|
||||
if (role.IsDesyncRole() && target.GetRoleTypes() != role.GetDYRole()) role = CustomRoles.NiceGuesser;
|
||||
|
||||
target.RpcSetCustomRole(role);
|
||||
target.RpcChangeRoleBasis(role);
|
||||
|
||||
Utils.SendMessage("\n", target.PlayerId, Translator.GetString("President.Recruit.TargetNotifyMessage"));
|
||||
Main.DontCancelVoteList.Add(voter.PlayerId);
|
||||
return true;
|
||||
|
||||
@@ -73,10 +73,10 @@ public class Curser : RoleBase
|
||||
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
|
||||
{
|
||||
if (killer.CheckDoubleTrigger(target, () =>
|
||||
{
|
||||
KnownFactionPlayers.Add(target.PlayerId);
|
||||
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
|
||||
}))
|
||||
{
|
||||
KnownFactionPlayers.Add(target.PlayerId);
|
||||
Utils.NotifyRoles(SpecifySeer: killer, SpecifyTarget: target);
|
||||
}))
|
||||
{
|
||||
int random = IRandom.Instance.Next(4);
|
||||
|
||||
@@ -86,7 +86,7 @@ public class Curser : RoleBase
|
||||
target.RpcRemoveAbilityUse();
|
||||
break;
|
||||
case 1:
|
||||
var addons = Options.GroupedAddons[AddonTypes.Harmful].Where(x => !target.Is(x) && CustomRolesHelper.CheckAddonConflict(x, target));
|
||||
var addons = Options.GroupedAddons[AddonTypes.Harmful].Where(x => !target.Is(x) && !x.IsNotAssignableMidGame() && CustomRolesHelper.CheckAddonConflict(x, target));
|
||||
target.RpcSetCustomRole(addons.RandomElement());
|
||||
break;
|
||||
case 2:
|
||||
@@ -118,10 +118,7 @@ public class Curser : RoleBase
|
||||
opt.SetFloat(FloatOptionNames.ImpostorLightMod, vision);
|
||||
}
|
||||
|
||||
if (instance.LowerSpeedPlayers.Contains(playerId))
|
||||
{
|
||||
Main.AllPlayerSpeed[playerId] = LowerSpeed.GetFloat();
|
||||
}
|
||||
if (instance.LowerSpeedPlayers.Contains(playerId)) { Main.AllPlayerSpeed[playerId] = LowerSpeed.GetFloat(); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user