Skip to content

Commit

Permalink
Version v2.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisbison committed May 11, 2021
1 parent d9f9a18 commit db9394d
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 46 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -60,6 +61,10 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
<details>
<summary>Click to show the Changelog</summary>

**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
Expand Down
25 changes: 5 additions & 20 deletions Source Code/AUFixes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,24 @@
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);
AmongUsClient.Instance.FinishRpcImmediately(writer);
}
}

[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);
}
}
}

}
13 changes: 12 additions & 1 deletion Source Code/ChatCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using BepInEx.IL2CPP;
using HarmonyLib;
using UnityEngine;
using System.Linq;
using UnhollowerBaseLib;

namespace TheOtherRoles {
Expand Down Expand Up @@ -55,7 +56,17 @@ static bool Prefix(ChatController __instance) {
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) {
Expand Down
8 changes: 4 additions & 4 deletions Source Code/CustomColors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -71,7 +71,7 @@ public static void Load() {
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),
Expand Down Expand Up @@ -172,7 +172,7 @@ public static void Prefix([HarmonyArgument(0)] bool overrideLoad) {
}
public static void Postfix() {
if (!needsPatch) return;
SaveManager.colorConfig %= (uint)CustomColors.pickableColors;
SaveManager.colorConfig %= CustomColors.pickableColors;
needsPatch = false;
}
}
Expand All @@ -189,7 +189,7 @@ public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte bo
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);
Expand Down
26 changes: 13 additions & 13 deletions Source Code/IntroPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public static void Prefix(IntroCutscene __instance) {
}
}

[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) {
Expand All @@ -61,7 +61,7 @@ static void Prefix(IntroCutscene.Nested_0 __instance)
}

// 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;
Expand All @@ -70,19 +70,19 @@ static void Postfix(IntroCutscene.Nested_0 __instance)
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;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source Code/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion Source Code/MeetingPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ static void Prefix(UnityEngine.Object obj)
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++;
Expand Down
14 changes: 8 additions & 6 deletions Source Code/TheOtherRoles.csproj
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -20,12 +19,15 @@
</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">
Expand Down

0 comments on commit db9394d

Please sign in to comment.