]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
Version v2.6.2
authorEisbison <eisbison.creator@gmail.com>
Tue, 11 May 2021 09:04:37 +0000 (11:04 +0200)
committerEisbison <eisbison.creator@gmail.com>
Tue, 11 May 2021 09:04:37 +0000 (11:04 +0200)
README.md
Source Code/AUFixes.cs
Source Code/ChatCommands.cs
Source Code/CustomColors.cs
Source Code/IntroPatch.cs
Source Code/Main.cs
Source Code/MeetingPatch.cs
Source Code/TheOtherRoles.csproj

index 22a0fd95205beef868375ba772c935c7f26b2ec8..1a893101f7b42805292d96b9efe1e781b6071a6d 100644 (file)
--- a/README.md
+++ b/README.md
@@ -33,6 +33,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 # Releases\r
 | Among Us - Version| Mod Version | Link |\r
 |----------|-------------|-----------------|\r
+| 2021.5.10s| v2.6.2| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.2/TheOtherRoles.zip)\r
 | 2021.4.14s| v2.6.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.1/TheOtherRoles.zip)\r
 | 2021.4.14s| v2.6.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.0/TheOtherRoles.zip)\r
 | 2021.4.14s| v2.5.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.5.1/TheOtherRoles.zip)\r
@@ -60,6 +61,10 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 <details>\r
   <summary>Click to show the Changelog</summary>\r
 \r
+**Version 2.6.2**\r
+- The Other Roles now supports the new Among Us version **2021.5.10s**\r
+- Added a chat command to kick players as the host of a lobby (/kick playerName)\r
+\r
 **Version 2.6.1**\r
 - Fixed a bug where the Sheriff was unable to kill the Arsonist\r
 - Fixed a bug in the role assignment system\r
index 74dc6b923073d56787c62b7aae1eaed39a3b8ccb..89548c460757eb5b13ab2fcbb1e1e3849facd4de 100644 (file)
@@ -5,8 +5,9 @@ using TMPro;
 using System;
 
 namespace TheOtherRoles {
+
     [HarmonyPatch(typeof(OpenDoorConsole), nameof(OpenDoorConsole.Use))]
-    class ToiletDoorFix {
+    class ToiletDoorFix { // Synchronize opening toilet doors among clients
         public static void Prefix(OpenDoorConsole __instance) {
             MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.OpenToiletDoor, SendOption.None, -1);
             writer.Write(__instance.MyDoor.Id);
@@ -14,30 +15,14 @@ namespace TheOtherRoles {
         }
     }
 
-    [HarmonyPatch(typeof(MatchMaker), nameof(MatchMaker.Start))]
-    public static class MatchMakerPatch { // Reactor Region Fix
-        public static void Prefix(MatchMaker __instance) {
-            var parent = __instance.GetComponentInParent<Transform>().parent;
-            if (parent == null) return; // Local
-            var tmps = parent.GetComponentsInChildren<TextMeshPro>();
-            foreach (var tmp in tmps) {
-                if (tmp.name == "RegionText_TMP") {
-                    var region = DestroyableSingleton<ServerManager>.Instance.CurrentRegion;
-                    var name = DestroyableSingleton<TranslationController>.Instance.GetStringWithDefault(region.TranslateName, region.Name, Array.Empty<Il2CppSystem.Object>());
-                    tmp.text = name;
-                    break;
-                }
-            }
-        }
-    }
-
     [HarmonyPatch(typeof(NotificationPopper), nameof(NotificationPopper.Update))]
-    public static class NotificationPopperUpdatePatch { // Reactor Region Fix
+    public static class NotificationPopperUpdatePatch { // Fix position of notifications (e.g. player disconnected)
         public static void Postfix(NotificationPopper __instance) {
             if (__instance.alphaTimer > 0f) {
                 var pos = __instance.transform.localPosition;
-                __instance.transform.localPosition = new Vector3(pos.x + 0.5f, pos.y, pos.z);
+                __instance.transform.localPosition += new Vector3(0.5f, 0f, 0f);
             }
         }
     }
+
 }
\ No newline at end of file
index 0ff3db2e8ed31a624506329d270409c59094f80d..98823d3cadb1c7dee8899630c0a45881739122b6 100644 (file)
@@ -6,6 +6,7 @@ using BepInEx.Configuration;
 using BepInEx.IL2CPP;
 using HarmonyLib;
 using UnityEngine;
+using System.Linq;
 using UnhollowerBaseLib;
 
 namespace TheOtherRoles {
@@ -55,7 +56,17 @@ namespace TheOtherRoles {
                             SaveManager.BodyColor = (byte)colorId;
                             if (PlayerControl.LocalPlayer)
                                 PlayerControl.LocalPlayer.CmdCheckColor(colorId);
-                        } 
+                        } else if (text.ToLower().StartsWith("/kick ")) {
+                            string playerName = text.Substring(6);
+                            PlayerControl target = PlayerControl.AllPlayerControls.ToArray().ToList().FirstOrDefault(x => x.Data.PlayerName.Equals(playerName));
+                            if (target != null && AmongUsClient.Instance != null && AmongUsClient.Instance.CanBan()) {
+                                var client = AmongUsClient.Instance.GetClient(target.OwnerId);
+                                if (client != null) {
+                                    AmongUsClient.Instance.KickPlayer(client.Id, false);
+                                    handled = true;
+                                }
+                            }
+                        }
                     }
                 }
                 if (handled) {
index cab1fbc24879953ba82fd351afd2a44139b7e015..88c51db51066629ff710c4411253ce8cd841c8c4 100644 (file)
@@ -12,7 +12,7 @@ namespace TheOtherRoles {
     public class CustomColors {
         protected static Dictionary<int, string> ColorStrings = new Dictionary<int, string>();
         public static List<int> lighterColors = new List<int>(){ 3, 4, 5, 7, 10, 11};
-        public static int pickableColors = 12;
+        public static uint pickableColors = 12;
 
         public static void Load() {
             List<StringNames> longlist = Enumerable.ToList<StringNames>(Palette.ColorNames);
@@ -71,7 +71,7 @@ namespace TheOtherRoles {
                                         shadow = new Color32(0, 61, 54, byte.MaxValue),
                                         isLighterColor = false });
 
-            pickableColors += colors.Count; // Colors to show in Tab
+            pickableColors += (uint)colors.Count; // Colors to show in Tab
             /** Hidden Colors **/
             colors.Add(new CustomColor { longname = "Panda", shortname = "PANDA", 
                                         color = new Color32(255, 255, 255, 0), 
@@ -172,7 +172,7 @@ namespace TheOtherRoles {
                 }
                 public static void Postfix() {
                     if (!needsPatch) return;
-                    SaveManager.colorConfig %= (uint)CustomColors.pickableColors;
+                    SaveManager.colorConfig %= CustomColors.pickableColors;
                     needsPatch = false;
                 }
             }
@@ -189,7 +189,7 @@ namespace TheOtherRoles {
                    if (isTaken(__instance, color) || color >= Palette.PlayerColors.Length) {
                         int num = 0;
                         while (num++ < 50 && (color >= CustomColors.pickableColors || isTaken(__instance, color))) {
-                            color = (color + 1) % (uint)CustomColors.pickableColors;
+                            color = (color + 1) % CustomColors.pickableColors;
                         }
                     }
                     __instance.RpcSetColor((byte)color);
index c95696a93088fc6eb12fdfce228ef055437b27b0..50a2c1bf346bd379b18f753bed464cf6cb13a1bb 100644 (file)
@@ -36,10 +36,10 @@ namespace TheOtherRoles
         }
     }
 
-    [HarmonyPatch(typeof(IntroCutscene.Nested_0), nameof(IntroCutscene.Nested_0.MoveNext))]
+    [HarmonyPatch(typeof(IntroCutscene._CoBegin_d__11), nameof(IntroCutscene._CoBegin_d__11.MoveNext))]
     class IntroPatch
     {
-        static void Prefix(IntroCutscene.Nested_0 __instance)
+        static void Prefix(IntroCutscene._CoBegin_d__11 __instance)
         {
             // Intro solo teams
             if (PlayerControl.LocalPlayer == Jester.jester || PlayerControl.LocalPlayer == Jackal.jackal || PlayerControl.LocalPlayer == Arsonist.arsonist) {
@@ -61,7 +61,7 @@ namespace TheOtherRoles
         }
 
         // Intro display role
-        static void Postfix(IntroCutscene.Nested_0 __instance)
+        static void Postfix(IntroCutscene._CoBegin_d__11 __instance)
         {
             List<RoleInfo> infos = RoleInfo.getRoleInfoForPlayer(PlayerControl.LocalPlayer);
             if (infos.Count == 0) return;
@@ -70,19 +70,19 @@ namespace TheOtherRoles
             if (PlayerControl.LocalPlayer == Lovers.lover1 || PlayerControl.LocalPlayer == Lovers.lover2)
             {
                 PlayerControl otherLover = PlayerControl.LocalPlayer == Lovers.lover1 ? Lovers.lover2 : Lovers.lover1;
-                __instance.__this.Title.text = PlayerControl.LocalPlayer.Data.IsImpostor ? "<color=#FF1919FF>Imp</color><color=#FC03BEFF>Lover</color>" : "<color=#FC03BEFF>Lover</color>";
-                __instance.__this.Title.color = PlayerControl.LocalPlayer.Data.IsImpostor ? Color.white : Lovers.color;
-                __instance.__this.ImpostorText.text = "You are in <color=#FC03BEFF>Love</color><color=#FFFFFFFF> with </color><color=#FC03BEFF>" + (otherLover?.Data?.PlayerName ?? "") + "</color>";
-                __instance.__this.ImpostorText.gameObject.SetActive(true);
-                __instance.__this.BackgroundBar.material.color = Lovers.color;
+                __instance.__4__this.Title.text = PlayerControl.LocalPlayer.Data.IsImpostor ? "<color=#FF1919FF>Imp</color><color=#FC03BEFF>Lover</color>" : "<color=#FC03BEFF>Lover</color>";
+                __instance.__4__this.Title.color = PlayerControl.LocalPlayer.Data.IsImpostor ? Color.white : Lovers.color;
+                __instance.__4__this.ImpostorText.text = "You are in <color=#FC03BEFF>Love</color><color=#FFFFFFFF> with </color><color=#FC03BEFF>" + (otherLover?.Data?.PlayerName ?? "") + "</color>";
+                __instance.__4__this.ImpostorText.gameObject.SetActive(true);
+                __instance.__4__this.BackgroundBar.material.color = Lovers.color;
             }
             else if (roleInfo.name == "Crewmate" || roleInfo.name == "Impostor") {}
             else {
-                __instance.__this.Title.text = roleInfo.name;
-                __instance.__this.Title.color = roleInfo.color;
-                __instance.__this.ImpostorText.gameObject.SetActive(true);
-                __instance.__this.ImpostorText.text = roleInfo.introDescription;
-                __instance.__this.BackgroundBar.material.color = roleInfo.color;
+                __instance.__4__this.Title.text = roleInfo.name;
+                __instance.__4__this.Title.color = roleInfo.color;
+                __instance.__4__this.ImpostorText.gameObject.SetActive(true);
+                __instance.__4__this.ImpostorText.text = roleInfo.introDescription;
+                __instance.__4__this.BackgroundBar.material.color = roleInfo.color;
             }
         }
     }
index a51e8db6e867bc4144d143e0870b6e0398f4f102..3420c3d88e8543c6122d30844226dcd11b412a09 100644 (file)
@@ -19,7 +19,7 @@ namespace TheOtherRoles
     public class TheOtherRolesPlugin : BasePlugin
     {
         public const string Id = "me.eisbison.theotherroles";
-        public const string VersionString = "2.6.1";
+        public const string VersionString = "2.6.2";
         public static System.Version Version = System.Version.Parse(VersionString);
 
         public Harmony Harmony { get; } = new Harmony(Id);
index f65d4c86074322b207ebb77075040d2e521631dc..2e5d81585312d3f9b9c2364ffdc52d4392ca6f50 100644 (file)
@@ -494,7 +494,7 @@ namespace TheOtherRoles
                     foreach (PlayerControl p in PlayerControl.AllPlayerControls) {
                         if (!Arsonist.dousedIcons.ContainsKey(p.PlayerId)) continue;
                         if (p.Data.IsDead || p.Data.Disconnected) {
-                            Arsonist.dousedIcons[p.PlayerId].gameObject.SetActive(true);
+                            Arsonist.dousedIcons[p.PlayerId].gameObject.SetActive(false);
                         } else {
                             Arsonist.dousedIcons[p.PlayerId].transform.localPosition = bottomLeft + Vector3.right * visibleCounter * 0.35f;
                             visibleCounter++;
index ac8e6a2a1290e47bbc613bc67ad2389bd303ab7b..0e55cd61c5cac455d146c7ee52190e23731d6019 100644 (file)
@@ -1,14 +1,13 @@
 <Project Sdk="Microsoft.NET.Sdk">
     <PropertyGroup>
         <TargetFramework>netstandard2.1</TargetFramework>
-        <Version>2.6.1</Version>
+        <Version>2.6.2</Version>
         <Description>TheOtherRoles</Description>
         <Authors>Eisbison</Authors>
     </PropertyGroup>
 
     <PropertyGroup>
-        <GameVersion>2021.4.14s</GameVersion>
-        <Mappings>EoF-1141/Mappings:0.4.1</Mappings>
+        <GameVersion>2021.5.10s</GameVersion>
         <DefineConstants>$(DefineConstants);STEAM</DefineConstants>
         <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     </PropertyGroup>
     </ItemGroup>
 
     <ItemGroup>
-        <PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="*" />
+        <Reference Include="$(AmongUs)/BepInEx/core/*.dll"/>
+        <Reference Include="$(AmongUs)/BepInEx/unhollowed/*.dll"/>
     </ItemGroup>
 
-    <Target Name="Copy" AfterTargets="Reobfuscate">
-        <Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="$(AmongUs)/BepInEx/plugins/" />
+    <Target Name="CopyCustomContent" AfterTargets="AfterBuild">
+        <Message Text="Second occurrence" />
+        <Copy SourceFiles="$(ProjectDir)\bin\$(Configuration)\netstandard2.1\TheOtherRoles.dll" DestinationFolder="$(AmongUs)/BepInEx/plugins/" />
     </Target>
+
     <!-- il2cpp newtonsoft -->
        <ItemGroup>
                <Reference Include="Newtonsoft.Json, Version=3.7.1.6">