From db9394dc0186138a9813d87ed5ba06e541bceb7f Mon Sep 17 00:00:00 2001 From: Eisbison Date: Tue, 11 May 2021 11:04:37 +0200 Subject: [PATCH] Version v2.6.2 --- README.md | 5 +++++ Source Code/AUFixes.cs | 25 +++++-------------------- Source Code/ChatCommands.cs | 13 ++++++++++++- Source Code/CustomColors.cs | 8 ++++---- Source Code/IntroPatch.cs | 26 +++++++++++++------------- Source Code/Main.cs | 2 +- Source Code/MeetingPatch.cs | 2 +- Source Code/TheOtherRoles.csproj | 14 ++++++++------ 8 files changed, 49 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 22a0fd9..1a89310 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein # Releases | Among Us - Version| Mod Version | Link | |----------|-------------|-----------------| +| 2021.5.10s| v2.6.2| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.2/TheOtherRoles.zip) | 2021.4.14s| v2.6.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.1/TheOtherRoles.zip) | 2021.4.14s| v2.6.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.0/TheOtherRoles.zip) | 2021.4.14s| v2.5.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.5.1/TheOtherRoles.zip) @@ -60,6 +61,10 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
Click to show the Changelog +**Version 2.6.2** +- The Other Roles now supports the new Among Us version **2021.5.10s** +- Added a chat command to kick players as the host of a lobby (/kick playerName) + **Version 2.6.1** - Fixed a bug where the Sheriff was unable to kill the Arsonist - Fixed a bug in the role assignment system diff --git a/Source Code/AUFixes.cs b/Source Code/AUFixes.cs index 74dc6b9..89548c4 100644 --- a/Source Code/AUFixes.cs +++ b/Source Code/AUFixes.cs @@ -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().parent; - if (parent == null) return; // Local - var tmps = parent.GetComponentsInChildren(); - foreach (var tmp in tmps) { - if (tmp.name == "RegionText_TMP") { - var region = DestroyableSingleton.Instance.CurrentRegion; - var name = DestroyableSingleton.Instance.GetStringWithDefault(region.TranslateName, region.Name, Array.Empty()); - 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 diff --git a/Source Code/ChatCommands.cs b/Source Code/ChatCommands.cs index 0ff3db2..98823d3 100644 --- a/Source Code/ChatCommands.cs +++ b/Source Code/ChatCommands.cs @@ -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) { diff --git a/Source Code/CustomColors.cs b/Source Code/CustomColors.cs index cab1fbc..88c51db 100644 --- a/Source Code/CustomColors.cs +++ b/Source Code/CustomColors.cs @@ -12,7 +12,7 @@ namespace TheOtherRoles { public class CustomColors { protected static Dictionary ColorStrings = new Dictionary(); public static List lighterColors = new List(){ 3, 4, 5, 7, 10, 11}; - public static int pickableColors = 12; + public static uint pickableColors = 12; public static void Load() { List longlist = Enumerable.ToList(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); diff --git a/Source Code/IntroPatch.cs b/Source Code/IntroPatch.cs index c95696a..50a2c1b 100644 --- a/Source Code/IntroPatch.cs +++ b/Source Code/IntroPatch.cs @@ -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 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 ? "ImpLover" : "Lover"; - __instance.__this.Title.color = PlayerControl.LocalPlayer.Data.IsImpostor ? Color.white : Lovers.color; - __instance.__this.ImpostorText.text = "You are in Love with " + (otherLover?.Data?.PlayerName ?? "") + ""; - __instance.__this.ImpostorText.gameObject.SetActive(true); - __instance.__this.BackgroundBar.material.color = Lovers.color; + __instance.__4__this.Title.text = PlayerControl.LocalPlayer.Data.IsImpostor ? "ImpLover" : "Lover"; + __instance.__4__this.Title.color = PlayerControl.LocalPlayer.Data.IsImpostor ? Color.white : Lovers.color; + __instance.__4__this.ImpostorText.text = "You are in Love with " + (otherLover?.Data?.PlayerName ?? "") + ""; + __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; } } } diff --git a/Source Code/Main.cs b/Source Code/Main.cs index a51e8db..3420c3d 100644 --- a/Source Code/Main.cs +++ b/Source Code/Main.cs @@ -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); diff --git a/Source Code/MeetingPatch.cs b/Source Code/MeetingPatch.cs index f65d4c8..2e5d815 100644 --- a/Source Code/MeetingPatch.cs +++ b/Source Code/MeetingPatch.cs @@ -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++; diff --git a/Source Code/TheOtherRoles.csproj b/Source Code/TheOtherRoles.csproj index ac8e6a2..0e55cd6 100644 --- a/Source Code/TheOtherRoles.csproj +++ b/Source Code/TheOtherRoles.csproj @@ -1,14 +1,13 @@ netstandard2.1 - 2.6.1 + 2.6.2 TheOtherRoles Eisbison - 2021.4.14s - EoF-1141/Mappings:0.4.1 + 2021.5.10s $(DefineConstants);STEAM true @@ -20,12 +19,15 @@ - + + - - + + + + -- 2.39.5