Skip to content

Commit

Permalink
Compatibility with Among Us v2021.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Brybry16 committed Mar 9, 2021
1 parent 9d3ed0c commit 52ab013
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 26 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,19 @@ Every player in your lobby need to install Reactor-Sheriff Mod. There are two wa

| Among Us Version | Mod Version | All-in-one pack | DLL file |
| :--------------: | :---------: | :-------------: | :------: |
| v2020.12.9s | Ver. 1.2-R |[**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.2/ReactorSheriff-v1.2.zip) | [**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.2/ReactorSheriff-2020.12.9s.dll) |
| v2020.12.9s | Ver. 1.1-R |[**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.1/ReactorSheriff-v1.1.zip) | [**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.1/ReactorSheriff-2020.12.9s.dll) |
| v2021.3.5s | Ver. 1.2.1-R |[**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.2.1/ReactorSheriff-v1.2.1.zip) | [**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.2.1/ReactorSheriff-2021.3.5s.dll) |
| v2020.12.9s | Ver. 1.2-R |[**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.2/ReactorSheriff-v1.2.zip) | [**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.2/ReactorSheriff-2020.12.9s.dll) |
| v2020.12.9s | Ver. 1.1-R |[**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.1/ReactorSheriff-v1.1.zip) | [**Download**](https://github.com/Brybry16/Reactor-Sheriff/releases/download/v1.1/ReactorSheriff-2020.12.9s.dll) |

<details>
<summary><b>Changelog</b></summary>
<h3>v1.2.1-R</h3>
<ul>
<li>The mod is now compatible with Among Us v2021.3.5</li>
<li>Fixed Sheriff being able use the Kill Button while in meeting</li>
<li>Stability improvements</li>
</ul>

<h3>v1.2-R</h3>
<ul>
<li>Fixed Sheriff being able to kill impostors in vent</li>
Expand Down
2 changes: 1 addition & 1 deletion ReactorSheriff/GameOptionsMenuPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static bool Prefix(ToggleOption __instance)
CustomGameOptions.ShowSheriff = !CustomGameOptions.ShowSheriff;
PlayerControl.LocalPlayer.RpcSyncSettings(PlayerControl.GameOptions);

__instance.Field_2 = CustomGameOptions.ShowSheriff;
__instance.oldValue = CustomGameOptions.ShowSheriff;
__instance.CheckMark.enabled = CustomGameOptions.ShowSheriff;

return false;
Expand Down
13 changes: 5 additions & 8 deletions ReactorSheriff/HudManagerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public static void updateMeetingHud(MeetingHud __instance)
{
foreach (PlayerVoteArea playerVoteArea in __instance.playerStates)
{
if (PlayerControlPatch.Sheriff == null)
{
SheriffReactorMod.log.LogMessage("PlayerControlPatch.Sheriff IS NULL CT CA MDR");
}
if (PlayerControlPatch.Sheriff != null && playerVoteArea.NameText.Text == PlayerControlPatch.Sheriff.name)
{
if (CustomGameOptions.ShowSheriff | PlayerControlPatch.isSheriff(PlayerControl.LocalPlayer))
Expand All @@ -85,12 +81,13 @@ public static void Postfix(HudManager __instance)

if (PlayerControl.AllPlayerControls.Count > 1 & PlayerControlPatch.Sheriff != null)
{

if (PlayerControlPatch.isSheriff(PlayerControl.LocalPlayer))
{

PlayerControl.LocalPlayer.nameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
if (PlayerControl.LocalPlayer.Field_6.IsDead || PlayerControlPatch.sheriffInTask || isMeetingHudActive)


if (false || PlayerControlPatch.sheriffInTask || isMeetingHudActive)
{
KillButton.gameObject.SetActive(false);
KillButton.isActive = false;
Expand All @@ -113,9 +110,9 @@ public static void Postfix(HudManager __instance)
}
}
}
else if (PlayerControl.LocalPlayer.Field_6.IsImpostor)
else if (PlayerControl.LocalPlayer.Data.LGEGJEHCFOG) // isImpostor
{
if (PlayerControl.LocalPlayer.Field_6.IsDead)
if (PlayerControl.LocalPlayer.Data.AKOHOAJIHBE) // isDead
{
KillButton.gameObject.SetActive(false);
KillButton.isActive = false;
Expand Down
6 changes: 3 additions & 3 deletions ReactorSheriff/IntroCutScenePatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

namespace ReactorSheriff
{
[HarmonyPatch(typeof(IntroCutscene.CoBegin__d))]
[HarmonyPatch(typeof(IntroCutscene.Nested_0))]
public static class IntroCutScenePatch
{
[HarmonyPatch(nameof(IntroCutscene.CoBegin__d.MoveNext))]
public static void Postfix(IntroCutscene.CoBegin__d __instance)
[HarmonyPatch(nameof(IntroCutscene.Nested_0.MoveNext))]
public static void Postfix(IntroCutscene.Nested_0 __instance)
{
if (PlayerControlPatch.isSheriff(PlayerControl.LocalPlayer))
{
Expand Down
2 changes: 1 addition & 1 deletion ReactorSheriff/KillButtonPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static bool Prefix(MethodBase __originalMethod)

if (dist < GameOptionsData.KillDistances[PlayerControl.GameOptions.KillDistance])
{
if (PlayerControlPatch.closestPlayer.Field_6.IsImpostor == false)
if (PlayerControlPatch.closestPlayer.Data.LGEGJEHCFOG == false) // isImpostor
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SheriffKill, Hazel.SendOption.None, -1);
writer.Write(PlayerControl.LocalPlayer.PlayerId);
Expand Down
14 changes: 7 additions & 7 deletions ReactorSheriff/PlayerControlPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,18 @@ public static float SheriffKillTimer()

return (KillCoolDown - (float)diff.TotalMilliseconds) / 1000.0f;
}
public static List<PlayerControl> getCrewMates(Il2CppReferenceArray<GameData.PlayerInfo> infection)
public static List<PlayerControl> getCrewMates(Il2CppReferenceArray<GameData.Nested_1> infection)
{
List<PlayerControl> CrewmateIds = new List<PlayerControl>();

foreach (PlayerControl player in PlayerControl.AllPlayerControls)
{

bool isInfected = false;
foreach (GameData.PlayerInfo infected in infection)
foreach (GameData.Nested_1 infected in infection)
{

if (player.PlayerId == infected.Object.PlayerId)
if (player.PlayerId == infected.CBEJMNMADDB.PlayerId)
{
isInfected = true;

Expand All @@ -198,7 +198,7 @@ public static PlayerControl getClosestPlayer(PlayerControl refplayer)
PlayerControl closestplayer = null;
foreach (PlayerControl player in PlayerControl.AllPlayerControls)
{
if (player.Field_6.IsDead || player.inVent)
if (player.Data.AKOHOAJIHBE || player.inVent) // player.Data.isDead
continue;

if (player.PlayerId != refplayer.PlayerId)
Expand Down Expand Up @@ -227,7 +227,7 @@ public static double getDistBetweenPlayers(PlayerControl player, PlayerControl r
}

[HarmonyPatch(nameof(PlayerControl.RpcSetInfected))]
public static void Postfix([HarmonyArgument(0)] Il2CppReferenceArray<GameData.PlayerInfo> PlayerInfos)
public static void Postfix([HarmonyArgument(0)] Il2CppReferenceArray<GameData.Nested_1> PlayerInfos)
{
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetSheriff, Hazel.SendOption.None, -1);
List<PlayerControl> crewmates = getCrewMates(PlayerInfos);
Expand All @@ -254,7 +254,7 @@ public static bool Prefix(PlayerControl __instance)
{
if (__instance.PlayerId == Sheriff.PlayerId)
{
__instance.Field_6.IsImpostor = true;
__instance.Data.LGEGJEHCFOG = true; // isImpostor

}
}
Expand All @@ -268,7 +268,7 @@ public static void Postfix(PlayerControl __instance)
{
if (__instance.PlayerId == Sheriff.PlayerId)
{
__instance.Field_6.IsImpostor = false;
__instance.Data.LGEGJEHCFOG = false; // isImpostor
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions ReactorSheriff/ReactorSheriff.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.2</Version>
<GameVersion>2020.12.9s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.1.0-alpha.2</Mappings>
<Version>1.2.1</Version>
<GameVersion>2021.3.5s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.2.0</Mappings>

<Description>Reimplementation of Woodi's Sheriff Mod in Reactor</Description>
<Authors>Brybry</Authors>
Expand Down
2 changes: 1 addition & 1 deletion ReactorSheriff/VersionShowerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public static class VersionShowerPatch
// Methods
public static void Postfix(VersionShower __instance)
{
__instance.text.Text += "\nLoaded [F7C600FF]Sheriff Mod v1.2-R[] by Brybry";
__instance.text.Text += "\nLoaded [F7C600FF]Sheriff Mod v1.2.1-R[] by Brybry";
}
}

Expand Down

0 comments on commit 52ab013

Please sign in to comment.