]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
v2.8.1
authorEisbison <eisbison.creator@gmail.com>
Sat, 7 Aug 2021 16:09:32 +0000 (18:09 +0200)
committerEisbison <eisbison.creator@gmail.com>
Sat, 7 Aug 2021 16:09:32 +0000 (18:09 +0200)
README.md
TheOtherRoles/Helpers.cs
TheOtherRoles/Main.cs
TheOtherRoles/Patches/PlayerControlPatch.cs
TheOtherRoles/RPC.cs
TheOtherRoles/TheOtherRoles.csproj

index ab1ef2b98a5a5277e3583d62d2cb7aaa0123a763..8716ba9c2e875fc560d691a41b73cf27155fffb7 100644 (file)
--- 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
 <details>
   <summary>Click to show the Changelog</summary>
 
+**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))
index 5446ec83d7619eff03de99fc55a1f8d0ef0fcef7..6c0ee82aa865d7871c605745929faed408b324cf 100644 (file)
@@ -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;
 
index 65b06faed4d8f84c95c1fd0716abe333f9870de3..87054a5e4b512646226d871339aac785fd819b63 100644 (file)
@@ -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);
index a15210f32d6de78c7a66274459ed03273a3ac4ec..96f07872adb64e37f62acf8d6cd6bb4691fe6bef 100644 (file)
@@ -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))]
index 740376f84bbb455ba3d85fd090b5ef588b6e2bd3..7f361c037663ca83006ed45735f7ca6bab4f4f30 100644 (file)
@@ -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
 
index cc663b5d60dee99a619158cf6d8daa1c9afc0053..c80314bfc141b1ba356310c209bd206ca1a74b1c 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
     <PropertyGroup>
         <TargetFramework>netstandard2.1</TargetFramework>
-        <Version>2.8.0</Version>
+        <Version>2.8.1</Version>
         <Description>TheOtherRoles</Description>
         <Authors>Eisbison</Authors>
     </PropertyGroup>