This commit is contained in:
Gurge44 committed 2024-06-06 15:16:49 +02:00
1 parent d06853e4e9
commit 7faccc41bf
24 files changed
+161 -106

No files matched your search

+2 -2
View File
@@ -24,9 +24,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2024.3.5" PrivateAssets="all" />
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2024.6.4" PrivateAssets="all"/>
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" />
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.688" Private="false" ExcludeAssets="runtime;native" />
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.691" Private="false" ExcludeAssets="runtime;native"/>
<PackageReference Include="Samboy063.Cpp2IL.Core" Version="2022.1.0-pre-release.14" />
</ItemGroup>
+25 -28
View File
@@ -36,19 +36,16 @@ class DisableDevice
public static bool DoDisable => Options.DisableDevices.GetBool();
public static float UsableDistance()
public static float UsableDeviceDistance => Main.CurrentMap switch
{
return (MapNames)Main.NormalOptions.MapId switch
{
MapNames.Skeld => 1.8f,
MapNames.Mira => 2.4f,
MapNames.Polus => 1.8f,
MapNames.Dleks => 1.5f,
MapNames.Airship => 1.8f,
MapNames.Fungle => 1.8f,
_ => 0.0f
};
}
MapNames.Skeld => 1.8f,
MapNames.Mira => 2.4f,
MapNames.Polus => 1.8f,
MapNames.Dleks => 1.5f,
MapNames.Airship => 1.8f,
MapNames.Fungle => 1.8f,
_ => 0.0f
};
public static void FixedUpdate()
{
@@ -78,49 +75,49 @@ class DisableDevice
{
case 0:
if (Options.DisableSkeldAdmin.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["SkeldAdmin"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["SkeldAdmin"]) <= UsableDeviceDistance;
if (Options.DisableSkeldCamera.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["SkeldCamera"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["SkeldCamera"]) <= UsableDeviceDistance;
break;
case 1:
if (Options.DisableMiraHQAdmin.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["MiraHQAdmin"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["MiraHQAdmin"]) <= UsableDeviceDistance;
if (Options.DisableMiraHQDoorLog.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["MiraHQDoorLog"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["MiraHQDoorLog"]) <= UsableDeviceDistance;
break;
case 2:
if (Options.DisablePolusAdmin.GetBool() || rogueForce)
{
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusLeftAdmin"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusRightAdmin"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusLeftAdmin"]) <= UsableDeviceDistance;
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusRightAdmin"]) <= UsableDeviceDistance;
}
if (Options.DisablePolusCamera.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusCamera"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusCamera"]) <= UsableDeviceDistance;
if (Options.DisablePolusVital.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusVital"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["PolusVital"]) <= UsableDeviceDistance;
break;
case 3:
if (Options.DisableSkeldAdmin.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["DleksAdmin"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["DleksAdmin"]) <= UsableDeviceDistance;
if (Options.DisableSkeldCamera.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["DleksCamera"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["DleksCamera"]) <= UsableDeviceDistance;
break;
case 4:
if (Options.DisableAirshipCockpitAdmin.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipCockpitAdmin"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipCockpitAdmin"]) <= UsableDeviceDistance;
if (Options.DisableAirshipRecordsAdmin.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipRecordsAdmin"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipRecordsAdmin"]) <= UsableDeviceDistance;
if (Options.DisableAirshipCamera.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipCamera"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipCamera"]) <= UsableDeviceDistance;
if (Options.DisableAirshipVital.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipVital"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["AirshipVital"]) <= UsableDeviceDistance;
break;
case 5:
if (Options.DisableFungleCamera.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["FungleCamera"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["FungleCamera"]) <= UsableDeviceDistance;
if (Options.DisableFungleVital.GetBool() || rogueForce)
doComms |= Vector2.Distance(PlayerPos, DevicePos["FungleVital"]) <= UsableDistance();
doComms |= Vector2.Distance(PlayerPos, DevicePos["FungleVital"]) <= UsableDeviceDistance;
break;
}
}
+11
View File
@@ -157,6 +157,8 @@ public class PlayerState(byte playerId)
countTypes = CountTypes.Bloodlust;
break;
case CustomRoles.Madmate:
TaskState.hasTasks = false;
TaskState.AllTasksCount = 0;
countTypes = Options.MadmateCountMode.GetInt() switch
{
0 => CountTypes.OutOfGame,
@@ -172,6 +174,8 @@ public class PlayerState(byte playerId)
SubRoles.Remove(CustomRoles.Undead);
break;
case CustomRoles.Charmed:
TaskState.hasTasks = false;
TaskState.AllTasksCount = 0;
countTypes = Succubus.CharmedCountMode.GetInt() switch
{
0 => CountTypes.OutOfGame,
@@ -187,6 +191,8 @@ public class PlayerState(byte playerId)
SubRoles.Remove(CustomRoles.Undead);
break;
case CustomRoles.Undead:
TaskState.hasTasks = false;
TaskState.AllTasksCount = 0;
countTypes = Necromancer.UndeadCountMode.GetInt() switch
{
0 => CountTypes.OutOfGame,
@@ -205,6 +211,8 @@ public class PlayerState(byte playerId)
SubRoles.Remove(CustomRoles.Mare);
break;
case CustomRoles.Recruit:
TaskState.hasTasks = false;
TaskState.AllTasksCount = 0;
countTypes = Jackal.SidekickCountMode.GetInt() switch
{
0 => CountTypes.Jackal,
@@ -221,6 +229,8 @@ public class PlayerState(byte playerId)
SubRoles.Remove(CustomRoles.Undead);
break;
case CustomRoles.Contagious:
TaskState.hasTasks = false;
TaskState.AllTasksCount = 0;
countTypes = Virus.ContagiousCountMode.GetInt() switch
{
0 => CountTypes.OutOfGame,
@@ -258,6 +268,7 @@ public class PlayerState(byte playerId)
if (AmongUsClient.Instance.AmHost)
{
RPC.SendDeathReason(PlayerId, deathReason);
Utils.CheckAndSpawnAdditionalRefugee(Utils.GetPlayerInfoById(PlayerId));
}
}
+3
View File
@@ -576,6 +576,7 @@ public static class GuessManager
public static void RpcGuesserMurderPlayer(this PlayerControl pc /*, float delay = 0f*/)
{
// DEATH STUFF //
GameEndChecker.ShouldNotCheck = true;
var amOwner = pc.AmOwner;
pc.Data.IsDead = true;
pc.RpcExileV2();
@@ -615,6 +616,8 @@ public static class GuessManager
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.GuessKill, SendOption.Reliable);
writer.Write(pc.PlayerId);
AmongUsClient.Instance.FinishRpcImmediately(writer);
GameEndChecker.ShouldNotCheck = false;
}
public static void RpcClientGuess(PlayerControl pc)
+4 -4
View File
@@ -1682,7 +1682,7 @@ public static class Utils
{
if (Options.CurrentGameMode != CustomGameMode.Standard || deadPlayer == null || deadPlayer.Object.Is(CustomRoles.Refugee) || !Options.SpawnAdditionalRefugeeOnImpsDead.GetBool() || Main.AllAlivePlayerControls.Length < Options.SpawnAdditionalRefugeeMinAlivePlayers.GetInt() || CustomRoles.Refugee.RoleExist(countDead: true) || Main.AllAlivePlayerControls.Any(x => x.PlayerId != deadPlayer.PlayerId && (x.Is(CustomRoleTypes.Impostor) || (x.IsNeutralKiller() && !Options.SpawnAdditionalRefugeeWhenNKAlive.GetBool())))) return;
PlayerControl[] ListToChooseFrom = Options.UsePets.GetBool() ? Main.AllAlivePlayerControls.Where(x => x.PlayerId != deadPlayer.PlayerId && x.Is(CustomRoleTypes.Crewmate)).ToArray() : Main.AllAlivePlayerControls.Where(x => x.PlayerId != deadPlayer.PlayerId && x.Is(CustomRoleTypes.Crewmate) && x.GetCustomRole().GetRoleTypes() == RoleTypes.Impostor).ToArray();
PlayerControl[] ListToChooseFrom = Options.UsePets.GetBool() ? Main.AllAlivePlayerControls.Where(x => x.PlayerId != deadPlayer.PlayerId && x.Is(CustomRoleTypes.Crewmate) && !x.Is(CustomRoles.Loyal)).ToArray() : Main.AllAlivePlayerControls.Where(x => x.PlayerId != deadPlayer.PlayerId && x.Is(CustomRoleTypes.Crewmate) && x.GetCustomRole().GetRoleTypes() == RoleTypes.Impostor && !x.Is(CustomRoles.Loyal)).ToArray();
if (ListToChooseFrom.Length > 0)
{
@@ -1892,7 +1892,7 @@ public static class Utils
//if (Options.DeepLowLoad.GetBool()) await Task.Run(() => { DoNotifyRoles(isForMeeting, SpecifySeer, NoCache, ForceLoop, CamouflageIsForMeeting, GuesserIsForMeeting); });
/*else */
if ((SpecifySeer != null && SpecifySeer.IsModClient()) || !AmongUsClient.Instance.AmHost || Main.AllPlayerControls == null || GameStates.IsMeeting || GameStates.IsLobby) return;
if (!SetUpRoleTextPatch.IsInIntro && ((SpecifySeer != null && SpecifySeer.IsModClient()) || !AmongUsClient.Instance.AmHost || Main.AllPlayerControls == null || GameStates.IsMeeting || GameStates.IsLobby)) return;
await DoNotifyRoles(isForMeeting, SpecifySeer, SpecifyTarget, NoCache, ForceLoop, CamouflageIsForMeeting, GuesserIsForMeeting, MushroomMixup);
}
@@ -1921,14 +1921,14 @@ public static class Utils
// During intro scene, set team name for non-modded clients and skip the rest.
string SelfName;
Team seerTeam = seer.GetTeam();
if (SetUpRoleTextPatch.IsInIntro && seer.GetCustomRole().IsDesyncRole() || seer.Is(CustomRoles.Bloodlust))
if (SetUpRoleTextPatch.IsInIntro && (seer.GetCustomRole().IsDesyncRole() || seer.Is(CustomRoles.Bloodlust)))
{
const string iconTextLeft = "<color=#ffffff>\u21e8</color>";
const string iconTextRight = "<color=#ffffff>\u21e6</color>";
const string roleNameUp = "</size><size=1350%>\n \n</size>";
string selfTeamName = $"<size=450%>{iconTextLeft} <font=\"VCR SDF\" material=\"VCR Black Outline\">{ColorString(seerTeam.GetTeamColor(), $"{seerTeam}")}</font> {iconTextRight}</size><size=900%>\n \n</size>";
SelfName = $"{selfTeamName}\r\n{seer.GetCustomRole().ToColoredString()}{roleNameUp}";
SelfName = $"{selfTeamName}\r\n{seer.GetCustomRole().ToColoredString()}";
seer.RpcSetNamePrivate(SelfName, true, seer);
continue;
+13 -8
View File
@@ -984,19 +984,24 @@ internal class ChatCommands
var title = $"<{Main.RoleColors[rl]}>{roleName}</color> {Utils.GetRoleMode(rl)}";
_ = sb.Append($"{GetString($"{rl}InfoLong")}");
var settings = new StringBuilder();
if (Options.CustomRoleSpawnChances.TryGetValue(rl, out StringOptionItem chance))
{
settings.AppendLine($"<size=70%><u>{GetString("SettingsForRoleText")} <{Main.RoleColors[rl]}>{roleName}</color>:</u>");
Utils.ShowChildrenSettings(chance, ref settings, disableColor: false);
settings.Append("</size>");
var txt = $"<size=90%>{sb}</size>";
_ = sb.Clear().Append(txt);
}
if (Options.CustomRoleSpawnChances.TryGetValue(rl, out StringOptionItem chance)) AddSettings(chance);
if (rl is CustomRoles.LovingCrewmate or CustomRoles.LovingImpostor && Options.CustomRoleSpawnChances.TryGetValue(CustomRoles.Lovers, out chance)) AddSettings(chance);
var txt = $"<size=90%>{sb}</size>";
sb.Clear().Append(txt);
if (rl.PetActivatedAbility() && sb.Length < 1000) sb.Append($"<size=50%>{GetString("SupportsPetMessage")}</size>");
Utils.SendMessage(text: "\n", sendTo: playerId, title: settings.ToString());
Utils.SendMessage(text: sb.ToString(), sendTo: playerId, title: title);
return;
void AddSettings(StringOptionItem stringOptionItem)
{
settings.AppendLine($"<size=70%><u>{GetString("SettingsForRoleText")} <{Main.RoleColors[rl]}>{roleName}</color>:</u>");
Utils.ShowChildrenSettings(stringOptionItem, ref settings, disableColor: false);
settings.Append("</size>");
}
}
}
+2 -1
View File
@@ -23,12 +23,13 @@ class GameEndChecker
{
private const float EndGameDelay = 0.2f;
private static GameEndPredicate Predicate;
public static bool ShouldNotCheck = false;
public static bool Prefix()
{
if (!AmongUsClient.Instance.AmHost) return true;
if (Predicate == null) return false;
if (Predicate == null || ShouldNotCheck) return false;
if (Options.NoGameEnd.GetBool() && WinnerTeam is not CustomWinner.Draw and not CustomWinner.Error) return false;
+2 -1
View File
@@ -142,7 +142,8 @@ internal class TitleLogoPatch
__instance.playButton.transform.gameObject.SetActive(false);
}
if ((Ambience = GameObject.Find("Ambience")) != null)
Ambience = GameObject.Find("Ambience");
if (Ambience != null)
{
try
{
+5 -5
View File
@@ -309,11 +309,11 @@ public class StringOptionEnablePatch
__instance.OnValueChanged = new Action<OptionBehaviour>(_ => { });
__instance.TitleText.text = option.GetName();
if (option.Id == Options.UsePets.Id) LoadLangs();
else if (!Options.UsePets.GetBool() && CustomRolesHelper.OnlySpawnsWithPetsRoleList.Any(role => role.ToString().Equals(option.GetName().RemoveHtmlTags().Replace(" ", string.Empty))))
else if (!Options.UsePets.GetBool() && CustomRolesHelper.OnlySpawnsWithPetsRoleList.Any(role => GetString(role.ToString()).RemoveHtmlTags().Equals(option.GetName().RemoveHtmlTags())))
__instance.TitleText.text += GetString("RequiresPetIndicator");
else if (Options.UsePets.GetBool() && Enum.TryParse(option.GetName().RemoveHtmlTags().Replace(" ", string.Empty), true, out CustomRoles petRole) && petRole.PetActivatedAbility())
else if (Options.UsePets.GetBool() && Enum.TryParse(option.Name, true, out CustomRoles petRole) && petRole.PetActivatedAbility())
__instance.TitleText.text += GetString("SupportsPetIndicator");
if (CustomRolesHelper.ExperimentalRoleList.Any(role => role.ToString().Equals(option.GetName().RemoveHtmlTags().Replace(" ", string.Empty))))
if (CustomRolesHelper.ExperimentalRoleList.Any(role => GetString(role.ToString()).RemoveHtmlTags().Equals(option.GetName().RemoveHtmlTags())))
__instance.TitleText.text += GetString("ExperimentalRoleIndicator");
__instance.Value = __instance.oldValue = option.CurrentValue;
__instance.ValueText.text = option.GetString();
@@ -330,7 +330,7 @@ public class StringOptionIncreasePatch
var option = OptionItem.AllOptions.FirstOrDefault(opt => opt.OptionBehaviour == __instance);
if (option == null) return true;
option.SetValue(option.CurrentValue + (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) ? 5 : 1));
option.SetValue(option.CurrentValue + (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) ? 5 : (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) ? 10 : 1)));
return false;
}
@@ -345,7 +345,7 @@ public class StringOptionDecreasePatch
var option = OptionItem.AllOptions.FirstOrDefault(opt => opt.OptionBehaviour == __instance);
if (option == null) return true;
option.SetValue(option.CurrentValue - (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) ? 5 : 1));
option.SetValue(option.CurrentValue - (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift) ? 5 : (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) ? 10 : 1)));
return false;
}
+4 -7
View File
@@ -21,11 +21,8 @@ class SetUpRoleTextPatch
if (!GameStates.IsModHost) return;
// After showing team for non-modded clients update player names.
LateTask.New(() =>
{
IsInIntro = false;
Utils.NotifyRoles(NoCache: true);
}, 1f);
IsInIntro = false;
Utils.NotifyRoles(NoCache: true);
LateTask.New(() =>
{
@@ -193,11 +190,11 @@ class BeginCrewmatePatch
{
teamToDisplay = new();
teamToDisplay.Add(PlayerControl.LocalPlayer);
teamToDisplay.Add(Main.LoversPlayers.First(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId));
teamToDisplay.Add(Main.LoversPlayers.FirstOrDefault(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId));
}
else if (PlayerControl.LocalPlayer.GetCustomRole() == CustomRoles.LovingImpostor)
{
teamToDisplay.Add(Main.LoversPlayers.First(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId));
teamToDisplay.Add(Main.LoversPlayers.FirstOrDefault(x => x.PlayerId != PlayerControl.LocalPlayer.PlayerId));
}
if (CustomTeamManager.EnabledCustomTeams.Count > 0)
+10 -11
View File
@@ -16,6 +16,15 @@ public static class CredentialsPatch
[HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))]
public static class LogoPatch
{
public static string BoosterData = string.Empty;
public static string SponsersData = string.Empty;
public static string DevsData = string.Empty;
public static string TransData = string.Empty;
public static GameObject CreditsPopup;
public static MainMenuManager instance;
static IEnumerator ViewCredentialsCoro(MainMenuManager __instance)
{
while (true)
@@ -30,11 +39,6 @@ public static class CredentialsPatch
}
}
public static string BoosterData = string.Empty;
public static string SponsersData = string.Empty;
public static string DevsData = string.Empty;
public static string TransData = string.Empty;
public static void InitCredentialsData()
{
BoosterData = string.Empty;
@@ -42,7 +46,7 @@ public static class CredentialsPatch
DevsData = string.Empty;
TransData = string.Empty;
DevsData += $"<color={Main.ModColor}>♥咔皮呆</color> - <size=75%>{GetString("MainDev")}</size>";
DevsData += $"<color={Main.ModColor}>♥咔皮呆 & Gurge44</color> - <size=75%>{GetString("MainDev")}</size>";
DevsData += $"\n<color={Main.ModColor}>♥IRIDESCENT</color> - <size=75%>{GetString("Art")}</size>";
DevsData += $"\nNCSIMON - <size=75%>{GetString("RoleDev")}</size>";
DevsData += $"\n天寸梦初 - <size=75%>{GetString("RoleDev")}&{GetString("TechSup")}</size>";
@@ -63,7 +67,6 @@ public static class CredentialsPatch
BoosterData += "\nNamra";
BoosterData += "\nKNIGHT";
BoosterData += "\nSolarFlare";
//BoosterData += $"\nLoonie";
SponsersData += "罗寄";
SponsersData += "\n鬼";
@@ -80,8 +83,6 @@ public static class CredentialsPatch
SponsersData += $"\n\n<size=60%>({GetString("OnlyShowPart")})</size>";
}
public static GameObject CreditsPopup;
static void ViewBoosterPatch(MainMenuManager __instance)
{
var template = __instance.transform.FindChild("StatsPopup");
@@ -147,8 +148,6 @@ public static class CredentialsPatch
obj.transform.FindChild("CloseButton").localPosition = new(-3.75f, 2.65f, 0);
}
public static MainMenuManager instance;
public static void Postfix(MainMenuManager __instance)
{
InitCredentialsData();
+1
View File
@@ -24,6 +24,7 @@ internal class ChangeRoleSettings
public static void Postfix(AmongUsClient __instance)
{
SetUpRoleTextPatch.IsInIntro = true;
Utils.NotifyRoles(NoCache: true);
Main.OverrideWelcomeMsg = string.Empty;
try
+1 -1
View File
@@ -2655,7 +2655,7 @@
"Sentry.CannotSeeInfoDuringComms": "Cannot See Info During Comms Sabotages",
"Sentry.Suffix.MonitoredRoom": "<size=80%>This room is monitored by the {0}</size>",
"Sentry.Suffix.Self": "<size=70%>Monitoring: <#00ffa5>{0}</color></size>",
"Sentry.Notify.Info": "<u>Info about your monitored room:</u>\\nPlayers: {0}\\nDead players: {1}",
"Sentry.Notify.Info": "<u>Info about {0}:</u>\\nPlayers: {1}\\nDead players: {2}",
"Sentry.Notify.Info.NoData": "<#ff0000>none</color>",
"Sentry.Notify.Shapeshifted": "{0} shapeshifted into {1} in your monitored room",
"Sentry.Notify.Vented": "{0} vented in your monitored room",
+1 -1
View File
@@ -8,7 +8,7 @@ namespace EHR.Roles.Crewmate
public class Enigma : RoleBase
{
private const int Id = 8460;
private static List<byte> playerIdList = [];
public static List<byte> playerIdList = [];
private static Dictionary<byte, List<EnigmaClue>> ShownClues = [];
public static OptionItem EnigmaClueStage1Tasks;
+1 -1
View File
@@ -7,7 +7,7 @@ namespace EHR.Roles.Crewmate;
public class Mortician : RoleBase
{
private const int Id = 7400;
private static List<byte> playerIdList = [];
public static List<byte> playerIdList = [];
private static OptionItem ShowArrows;
+24 -10
View File
@@ -32,6 +32,8 @@ namespace EHR.Roles.Impostor
public PlainShipRoom MonitoredRoom;
private PlayerControl SentryPC;
private HashSet<byte> UsingDevice = [];
public override bool IsEnable => On;
public static void SetupCustomOption()
@@ -72,6 +74,7 @@ namespace EHR.Roles.Impostor
MonitoredRoom = null;
DeadBodiesInRoom = [];
playerId.SetAbilityUseLimit(AbilityUseLimit.GetInt());
UsingDevice = [];
}
public override void Init()
@@ -129,9 +132,13 @@ namespace EHR.Roles.Impostor
{
if (CannotSeeInfoDuringComms.GetBool() && Utils.IsActive(SystemTypes.Comms)) return;
if (pc.GetAbilityUseLimit() < 1) return;
pc.RpcRemoveAbilityUse();
if (pc.Is(CustomRoles.Sentry))
{
if (pc.GetAbilityUseLimit() < 1) return;
pc.RpcRemoveAbilityUse();
}
var roomName = Translator.GetString(MonitoredRoom.RoomId.ToString());
var players = Main.AllAlivePlayerControls.Where(IsInMonitoredRoom).Select(x => Utils.GetPlayerById(x.shapeshiftTargetPlayerId) ?? x).Select(x => Utils.ColorString(Main.PlayerColors[x.PlayerId], x.GetRealName())).Join();
var bodies = GetColoredNames(DeadBodiesInRoom);
@@ -139,7 +146,7 @@ namespace EHR.Roles.Impostor
if (players.Length == 0) players = noDataString;
if (bodies.Length == 0) bodies = noDataString;
pc.Notify(string.Format(Translator.GetString("Sentry.Notify.Info"), players, bodies), ShowInfoDuration.GetInt());
pc.Notify(string.Format(Translator.GetString("Sentry.Notify.Info"), roomName, players, bodies), ShowInfoDuration.GetInt());
return;
static string GetColoredNames(IEnumerable<byte> ids) => ids.Where(x => Utils.GetPlayerById(x) != null).Select(x => Utils.ColorString(Main.PlayerColors[x], Utils.GetPlayerById(x).GetRealName())).Join();
@@ -251,21 +258,28 @@ namespace EHR.Roles.Impostor
public override void OnCheckPlayerPosition(PlayerControl pc)
{
var usableDevices = (UsableDevicesStrings)UsableDevicesForInfoView.GetValue();
var additionalDevices = (AdditionalDevicesStrings)AdditionalDevicesForInfoView.GetValue();
if (usableDevices == UsableDevicesStrings.None) return;
if (MonitoredRoom == null || MonitoredRoom == default || MonitoredRoom == default(PlainShipRoom)) return;
if (LastInfoSend.TryGetValue(pc.PlayerId, out var ts) && ts == Utils.TimeStamp) return;
LastInfoSend[pc.PlayerId] = Utils.TimeStamp;
if (!CheckTeam(pc)) return;
var pos = pc.Pos();
var range = DisableDevice.UsableDistance();
if (!AvailableDevices.Any(x => Vector2.Distance(pos, x) <= range)) return;
var range = DisableDevice.UsableDeviceDistance - 1f;
if (!AvailableDevices.Any(x => Vector2.Distance(pos, x) <= range))
{
if (UsingDevice.Contains(pc.PlayerId))
{
NameNotifyManager.Notice.Remove(pc.PlayerId);
Utils.NotifyRoles(SpecifySeer: pc, SpecifyTarget: pc);
UsingDevice.Remove(pc.PlayerId);
}
return;
}
DisplayRoomInfo(pc);
UsingDevice.Add(pc.PlayerId);
}
static bool CheckTeam(PlayerControl pc)
+6 -2
View File
@@ -113,8 +113,6 @@ public class Sheriff : RoleBase
public override bool OnCheckMurder(PlayerControl killer, PlayerControl target)
{
killer.RpcRemoveAbilityUse();
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} : Number of kills left: {killer.GetAbilityUseLimit()}", "Sheriff");
if (CanBeKilledBySheriff(target)
|| (killer.Is(CustomRoles.Recruit) && SidekickSheriffCanGoBerserk.GetBool())
|| (SetNonCrewCanKill.GetBool() &&
@@ -135,6 +133,12 @@ public class Sheriff : RoleBase
return MisfireKillsTarget.GetBool();
}
public override void OnMurder(PlayerControl killer, PlayerControl target)
{
killer.RpcRemoveAbilityUse();
Logger.Info($"{killer.GetNameWithRole().RemoveHtmlTags()} : Number of kills left: {killer.GetAbilityUseLimit()}", "Sheriff");
}
public static bool CanBeKilledBySheriff(PlayerControl player)
{
var cRole = player.GetCustomRole();
+1 -1
View File
@@ -9,7 +9,7 @@ namespace EHR.Roles.Crewmate
{
private const int Id = 8100;
private static List<byte> playerIdList = [];
public static List<byte> playerIdList = [];
public static OptionItem ShowGhostArrowEverySeconds;
public static OptionItem ShowGhostArrowForSeconds;
+1 -1
View File
@@ -133,7 +133,7 @@ internal class AntiAdminer : RoleBase
PlayersNearDevices = [];
bool Admin = false, Camera = false, DoorLog = false, Vital = false;
float usableDistance = DisableDevice.UsableDistance();
float usableDistance = DisableDevice.UsableDeviceDistance;
foreach (PlayerControl pc in Main.AllAlivePlayerControls)
{
if (Pelican.IsEaten(pc.PlayerId) || pc.inVent || pc.GetCustomRole().IsImpostor()) continue;
-5
View File
@@ -58,7 +58,6 @@ public class Amnesiac : RoleBase
public override void Add(byte playerId)
{
playerIdList.Add(playerId);
playerId.SetAbilityUseLimit(1);
if (!AmongUsClient.Instance.AmHost) return;
if (!Main.ResetCamPlayerList.Contains(playerId))
@@ -93,8 +92,6 @@ public class Amnesiac : RoleBase
public static void RememberRole(PlayerControl killer, PlayerControl target)
{
if (killer.GetAbilityUseLimit() < 1) return;
CustomRoles? RememberedRole = null;
string killerNotifyString = string.Empty;
@@ -149,8 +146,6 @@ public class Amnesiac : RoleBase
var role = (CustomRoles)RememberedRole;
killer.RpcRemoveAbilityUse();
killer.RpcSetCustomRole(role);
killer.Notify(killerNotifyString);
+1 -1
View File
@@ -273,7 +273,7 @@ namespace EHR.Roles.Neutral
}
var wasInShop = InShop;
InShop = ShopLocations.Any(x => Vector2.Distance(pc.Pos(), x) < DisableDevice.UsableDistance());
InShop = ShopLocations.Any(x => Vector2.Distance(pc.Pos(), x) < DisableDevice.UsableDeviceDistance);
Utils.SendRPC(CustomRPC.SyncBargainer, pc.PlayerId, 1, InShop);
switch (wasInShop)
+18 -14
View File
@@ -24,13 +24,6 @@ public class Jackal : RoleBase
public static OptionItem CanVentSK;
public static OptionItem CanSabotageSK;
public static readonly string[] SidekickAssignModeStrings =
[
"SidekickAssignMode.SidekickAndRecruit",
"SidekickAssignMode.Sidekick",
"SidekickAssignMode.Recruit"
];
public static bool On;
public override bool IsEnable => PlayerIdList.Count > 0;
@@ -56,19 +49,21 @@ public class Jackal : RoleBase
.SetValueFormat(OptionFormat.Seconds);
JackalCanKillSidekick = new BooleanOptionItem(Id + 15, "JackalCanKillSidekick", false, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Jackal]);
var SKOpts = new BooleanOptionItem(Id + 17, "SidekickSettings", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Jackal]);
KillCooldownSK = new FloatOptionItem(Id + 20, "KillCooldown", new(0f, 180f, 2.5f), 20f, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Jackal])
.SetParent(SKOpts)
.SetValueFormat(OptionFormat.Seconds);
CanVentSK = new BooleanOptionItem(Id + 21, "CanVent", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Jackal]);
.SetParent(SKOpts);
CanSabotageSK = new BooleanOptionItem(Id + 22, "CanSabotage", true, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Jackal]);
.SetParent(SKOpts);
SidekickCanKillJackal = new BooleanOptionItem(Id + 23, "SidekickCanKillJackal", false, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Jackal]);
.SetParent(SKOpts);
SidekickCanKillSidekick = new BooleanOptionItem(Id + 24, "SidekickCanKillSidekick", false, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Jackal]);
.SetParent(SKOpts);
SidekickCountMode = new StringOptionItem(Id + 25, "SidekickCountMode", Options.SidekickCountMode, 0, TabGroup.NeutralRoles)
.SetParent(CustomRoleSpawnChances[CustomRoles.Jackal]);
.SetParent(SKOpts);
}
public override void Init()
@@ -134,10 +129,19 @@ public class Jackal : RoleBase
return false;
}
public static bool CanBeSidekick(PlayerControl pc, out bool needBasisChange, out RoleTypes targetRoleType)
private static bool CanBeSidekick(PlayerControl pc, out bool needBasisChange, out RoleTypes targetRoleType)
{
targetRoleType = pc.GetRoleTypes();
needBasisChange = targetRoleType is not RoleTypes.Impostor and not RoleTypes.Shapeshifter;
return pc != null && !pc.Is(CustomRoles.Sidekick) && !pc.Is(CustomRoles.Recruit) && !pc.Is(CustomRoles.Loyal) && !pc.Is(CustomRoles.Rascal) && !pc.Is(CustomRoles.Madmate) && !pc.Is(CustomRoles.Charmed) && !pc.Is(CustomRoles.Contagious) && pc.GetCustomRole().IsAbleToBeSidekicked();
}
public override void OnFixedUpdate(PlayerControl pc)
{
if (pc.IsAlive()) return;
var sk = Main.AllPlayerControls.FirstOrDefault(x => x.Is(CustomRoles.Sidekick));
if (sk == null) return;
sk.RpcSetCustomRole(CustomRoles.Jackal);
sk.SetAbilityUseLimit(0);
}
}
+6 -1
View File
@@ -32,7 +32,9 @@ public class Romantic : RoleBase
private static readonly Dictionary<CustomRoles, CustomRoles> ConvertingRolesAndAddons = new()
{
[CustomRoles.Jackal] = CustomRoles.Sidekick,
[CustomRoles.Virus] = CustomRoles.Contagious
[CustomRoles.Virus] = CustomRoles.Contagious,
[CustomRoles.Deathknight] = CustomRoles.Undead,
[CustomRoles.Necromancer] = CustomRoles.Undead
};
public static bool HasPickedPartner => PartnerId != byte.MaxValue;
@@ -71,6 +73,9 @@ public class Romantic : RoleBase
{
RomanticId = playerId;
RomanticPC = Utils.GetPlayerById(playerId);
PartnerId = byte.MaxValue;
Partner = null;
IsPartnerProtected = false;
if (!AmongUsClient.Instance.AmHost) return;
if (!Main.ResetCamPlayerList.Contains(playerId))
+19 -1
View File
@@ -3,6 +3,7 @@ using System.Linq;
using AmongUs.GameOptions;
using EHR.Modules;
using EHR.Patches;
using EHR.Roles.Crewmate;
namespace EHR.Neutral
{
@@ -68,7 +69,24 @@ namespace EHR.Neutral
{
if (!base.OnCheckMurder(killer, target)) return false;
killer.RpcSetCustomRole(target.GetCustomRole());
var targetRole = target.GetCustomRole();
switch (targetRole)
{
case CustomRoles.Enigma:
Enigma.playerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Mediumshiper:
Mediumshiper.playerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Mortician:
Mortician.playerIdList.Remove(target.PlayerId);
break;
case CustomRoles.Spiritualist:
Spiritualist.playerIdList.Remove(target.PlayerId);
break;
}
killer.RpcSetCustomRole(targetRole);
if (TryChangeBasis.GetBool())
killer.ChangeRoleBasis(target.GetRoleTypes());