diff --git a/INSTALLATION.md b/INSTALLATION.md index 384ace7..982a285 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -3,6 +3,7 @@ # Table of Contents - [Locating the Among Us game files directory](#locating-the-among-us-game-files-directory) - [Installing BepInEx](#installing-bepinex) +- [Installing Reactor](#installing-reactor) ## Locating the Among Us game files directory @@ -34,9 +35,9 @@ library then selecting `Manage > Browse local files`. └── winhttp.dll ``` -3. Launch the game so that BepInEx can generate the necessary files - (this may take a while), then close the game after. The Among Us game - files should now look something like this: +3. Launch the game so that BepInEx can generate the necessary files, + then close the game after. The Among Us game files should now look + something like this: ``` . @@ -60,3 +61,17 @@ library then selecting `Manage > Browse local files`. ├── UnityPlayer.dll └── winhttp.dll ``` + +## Installing Reactor + +1. Go to the + [Reactor CI](https://github.com/NuclearPowered/Reactor/actions) + page. +2. Click on the top workflow run. +3. Download the `Reactor.dll` artifact. +4. Move the `Reactor.dll` file to the + `(Among Us game files)/BepInEx/plugins` folder. +5. Launch the game. The top left of the game menu should look + something like this: + +![Mod text](images/ModText.jpg) \ No newline at end of file diff --git a/README.md b/README.md index 6bfd912..0838c9b 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,17 @@ The following regions have been added: > **⚠ WARNING** > -> This mod only has compiled releases for the steam release of the game. +> This mod is only compatible with the steam release of the game. -> This mod requires you to have BepInEx installed. You can install BepInEx by following [this guide](INSTALLATION.md). +> This mod requires you to have BepInEx and Reactor installed. You can install BepInEx and Reactor by following [this guide](INSTALLATION.md) or by following the steps on the +> following two pages: https://docs.reactor.gg/docs/basic/install_bepinex and https://docs.reactor.gg/docs/basic/install_reactor. -1. Ensure that BepInEx is installed (more information above). +> If you are still using 2020.12.9s and Reactor fails to load, try using the Reactor version located +> here: https://github.com/NuclearPowered/Reactor/actions/runs/593649307. + +> If you are using 2021.3.5s and Reactor fails to load, ensure you have the latest version of Reactor installed. + +1. Ensure that BepInEx and Reactor are installed (more information above). 2. Download the latest mod on the [releases](https://github.com/DaemonBeast/Unify/releases) page. 3. Move the mod to the `(Among Us game files)/BepInEx/plugins` folder. 4. Launch the game. diff --git a/Unify/Patches/Regions.cs b/Unify/Patches/Regions.cs index 49af462..d34e04f 100644 --- a/Unify/Patches/Regions.cs +++ b/Unify/Patches/Regions.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; using BepInEx.Configuration; -using HarmonyLib; -using UnityEngine; using Array = System.Array; using String = System.String; @@ -9,15 +7,23 @@ namespace Unify.Patches { public static class RegionsPatch { - private static readonly IRegionInfo[] NewRegions = new IRegionInfo[] + private static IRegionInfo[] _newRegions = new IRegionInfo[] { new DnsRegionInfo("192.241.154.115", "skeld.net", StringNames.NoTranslation, "192.241.154.115") .Duplicate(), new DnsRegionInfo("localhost", "localhost", StringNames.NoTranslation, "127.0.0.1") .Duplicate() }; - private static readonly IRegionInfo[] CustomRegions = MergeRegions(NewRegions, LoadCustomUserRegions()); - private static readonly IRegionInfo[] PatchedRegions = MergeRegions(ServerManager.DefaultRegions, CustomRegions); + private static IRegionInfo[] _customRegions = MergeRegions(_newRegions, LoadCustomUserRegions()); + + public static void Patch() + { + IRegionInfo[] patchedRegions = MergeRegions(ServerManager.DefaultRegions, _customRegions); + + ServerManager.DefaultRegions = patchedRegions; + ServerManager.Instance.AvailableRegions = patchedRegions; + ServerManager.Instance.SaveServers(); + } private static IRegionInfo[] MergeRegions(IRegionInfo[] oldRegions, IRegionInfo[] newRegions) { @@ -50,19 +56,5 @@ namespace Unify.Patches return customRegions.ToArray(); } - - [HarmonyPatch(typeof(ServerManager), nameof(ServerManager.Awake))] - public static class AddRegionsPatch - { - public static void Prefix(ServerManager __instance) - { - ServerManager.DefaultRegions = PatchedRegions; - - // ServerManager.AvailableRegions - __instance.JIJNOHCGPHM = PatchedRegions; - - __instance.SaveServers(); - } - } } } \ No newline at end of file diff --git a/Unify/Unify.cs b/Unify/Unify.cs index 8d2325b..ab05b09 100644 --- a/Unify/Unify.cs +++ b/Unify/Unify.cs @@ -3,17 +3,19 @@ using BepInEx; using BepInEx.Configuration; using BepInEx.IL2CPP; using HarmonyLib; +using Reactor; using Unify.Patches; namespace Unify { [BepInPlugin(Id, Name, Version)] [BepInProcess("Among Us.exe")] + [BepInDependency(ReactorPlugin.Id)] public class UnifyPlugin : BasePlugin { public const string Id = "daemon.unify.reactor"; private const string Name = "Unify"; - private const string Version = "2.0.2"; + private const string Version = "2.0.1"; public static readonly ConfigFile ConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg"), true); @@ -22,6 +24,8 @@ namespace Unify public override void Load() { + RegionsPatch.Patch(); + Harmony.PatchAll(); } } diff --git a/Unify/Unify.csproj b/Unify/Unify.csproj index 281e31b..2b16178 100644 --- a/Unify/Unify.csproj +++ b/Unify/Unify.csproj @@ -1,45 +1,36 @@ netstandard2.1 - 2.0.2 - 2021.3.5s + 2.0.1 + NuclearPowered/Mappings:0.2.0 - Region mod + Region mod for Reactor Daemon - - - $(AssemblyName)-$(GameVersion) + + + 2021.3.5s + $(DefineConstants);STEAM - + + + 2021.11.17i + $(DefineConstants);ITCH + + - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\0Harmony.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Assembly-CSharp.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\BepInEx.Core.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\BepInEx.IL2CPP.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2Cppmscorlib.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\UnhollowerBaseLib.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unity-libs\UnityEngine.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.CoreModule.dll - + - - + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + \ No newline at end of file diff --git a/build/Unify-2021.3.5s.dll b/build/Unify-2021.3.5s.dll index a76515a..f9e2d50 100644 Binary files a/build/Unify-2021.3.5s.dll and b/build/Unify-2021.3.5s.dll differ