From 7768ceb914a422c118e9e60f2601b1e1990e3fb7 Mon Sep 17 00:00:00 2001 From: Eisbison Date: Sat, 7 Aug 2021 18:09:32 +0200 Subject: [PATCH] v2.8.1 --- README.md | 4 ++++ TheOtherRoles/Helpers.cs | 15 ++++++++++++++ TheOtherRoles/Main.cs | 2 +- TheOtherRoles/Patches/PlayerControlPatch.cs | 22 +++++++++------------ TheOtherRoles/RPC.cs | 13 ++++++++++++ TheOtherRoles/TheOtherRoles.csproj | 2 +- 6 files changed, 43 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index ab1ef2b..8716ba9 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein # Releases | Among Us - Version| Mod Version | Link | |----------|-------------|-----------------| +| 2021.6.30s| v2.8.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.8.1/TheOtherRoles.zip) | 2021.6.30s| v2.8.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.8.0/TheOtherRoles.zip) | 2021.6.30s| v2.7.3| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.7.3/TheOtherRoles.zip) | 2021.6.15s| v2.7.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.7.1/TheOtherRoles.zip) @@ -74,6 +75,9 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
Click to show the Changelog +**Hotfix 2.8.1** +- Fixed a game breaking bug where killing the Bait resulted in a ban of the Bait + **Version 2.8.0** - **New Role:** [Bait](#bait) created by [Mallöris](https://github.com/Mallaris) - Added Tracker Option: "Tracker Reset Target After Meeting" (feature created by [MaximeGillot](https://github.com/MaximeGillot)) diff --git a/TheOtherRoles/Helpers.cs b/TheOtherRoles/Helpers.cs index 5446ec8..6c0ee82 100644 --- a/TheOtherRoles/Helpers.cs +++ b/TheOtherRoles/Helpers.cs @@ -126,6 +126,21 @@ namespace TheOtherRoles { return true; } + public static void handleVampireBiteOnBodyReport() { + // Murder the bitten player before the meeting starts or reset the bitten player + if (Vampire.bitten != null && !Vampire.bitten.Data.IsDead && Helpers.handleMurderAttempt(Vampire.bitten, true)) { + MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireTryKill, Hazel.SendOption.Reliable, -1); + AmongUsClient.Instance.FinishRpcImmediately(killWriter); + RPCProcedure.vampireTryKill(); + } else { + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireSetBitten, Hazel.SendOption.Reliable, -1); + writer.Write(byte.MaxValue); + writer.Write(byte.MaxValue); + AmongUsClient.Instance.FinishRpcImmediately(writer); + RPCProcedure.vampireSetBitten(byte.MaxValue, byte.MaxValue); + } + } + public static void refreshRoleDescription(PlayerControl player) { if (player == null) return; diff --git a/TheOtherRoles/Main.cs b/TheOtherRoles/Main.cs index 65b06fa..87054a5 100644 --- a/TheOtherRoles/Main.cs +++ b/TheOtherRoles/Main.cs @@ -21,7 +21,7 @@ namespace TheOtherRoles public class TheOtherRolesPlugin : BasePlugin { public const string Id = "me.eisbison.theotherroles"; - public const string VersionString = "2.8.0"; + public const string VersionString = "2.8.1"; public static System.Version Version = System.Version.Parse(VersionString); public Harmony Harmony { get; } = new Harmony(Id); diff --git a/TheOtherRoles/Patches/PlayerControlPatch.cs b/TheOtherRoles/Patches/PlayerControlPatch.cs index a15210f..96f0787 100644 --- a/TheOtherRoles/Patches/PlayerControlPatch.cs +++ b/TheOtherRoles/Patches/PlayerControlPatch.cs @@ -525,7 +525,14 @@ namespace TheOtherRoles.Patches { Bait.reportDelay -= Time.fixedDeltaTime; DeadPlayer deadPlayer = deadPlayers?.Where(x => x.player?.PlayerId == Bait.bait.PlayerId)?.FirstOrDefault(); if (deadPlayer.killerIfExisting != null && Bait.reportDelay <= 0f) { - deadPlayer.killerIfExisting.CmdReportDeadBody(Bait.bait.Data); + + Helpers.handleVampireBiteOnBodyReport(); // Manually call Vampire handling, since the CmdReportDeadBody Prefix won't be called + RPCProcedure.uncheckedCmdReportDeadBody(deadPlayer.killerIfExisting.PlayerId, Bait.bait.PlayerId); + + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.UncheckedCmdReportDeadBody, Hazel.SendOption.Reliable, -1); + writer.Write(deadPlayer.killerIfExisting.PlayerId); + writer.Write(Bait.bait.PlayerId); + AmongUsClient.Instance.FinishRpcImmediately(writer); Bait.reported = true; } } @@ -630,18 +637,7 @@ namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CmdReportDeadBody))] class PlayerControlCmdReportDeadBodyPatch { public static void Prefix(PlayerControl __instance) { - // Murder the bitten player before the meeting starts or reset the bitten player - if (Vampire.bitten != null && !Vampire.bitten.Data.IsDead && Helpers.handleMurderAttempt(Vampire.bitten, true)) { - MessageWriter killWriter = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireTryKill, Hazel.SendOption.Reliable, -1); - AmongUsClient.Instance.FinishRpcImmediately(killWriter); - RPCProcedure.vampireTryKill(); - } else { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.VampireSetBitten, Hazel.SendOption.Reliable, -1); - writer.Write(byte.MaxValue); - writer.Write(byte.MaxValue); - AmongUsClient.Instance.FinishRpcImmediately(writer); - RPCProcedure.vampireSetBitten(byte.MaxValue, byte.MaxValue); - } + Helpers.handleVampireBiteOnBodyReport(); } } [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.RpcMurderPlayer))] diff --git a/TheOtherRoles/RPC.cs b/TheOtherRoles/RPC.cs index 740376f..7f361c0 100644 --- a/TheOtherRoles/RPC.cs +++ b/TheOtherRoles/RPC.cs @@ -63,6 +63,7 @@ namespace TheOtherRoles VersionHandshake, UseUncheckedVent, UncheckedMurderPlayer, + UncheckedCmdReportDeadBody, // Role functionality @@ -271,6 +272,13 @@ namespace TheOtherRoles if (source != null && target != null) source.MurderPlayer(target); } + public static void uncheckedCmdReportDeadBody(byte sourceId, byte targetId) { + PlayerControl source = Helpers.playerById(sourceId); + PlayerControl target = Helpers.playerById(targetId); + if (source != null && target != null) source.ReportDeadBody(target.Data); + } + + // Role functionality public static void engineerFixLights() { @@ -752,6 +760,11 @@ namespace TheOtherRoles byte target = reader.ReadByte(); RPCProcedure.uncheckedMurderPlayer(source, target); break; + case (byte)CustomRPC.UncheckedCmdReportDeadBody: + byte reportSource = reader.ReadByte(); + byte reportTarget = reader.ReadByte(); + RPCProcedure.uncheckedCmdReportDeadBody(reportSource, reportTarget); + break; // Role functionality diff --git a/TheOtherRoles/TheOtherRoles.csproj b/TheOtherRoles/TheOtherRoles.csproj index cc663b5..c80314b 100644 --- a/TheOtherRoles/TheOtherRoles.csproj +++ b/TheOtherRoles/TheOtherRoles.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 2.8.0 + 2.8.1 TheOtherRoles Eisbison -- 2.39.5