diff --git a/INSTALLATION.md b/INSTALLATION.md index 982a285..384ace7 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -3,7 +3,6 @@ # 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 @@ -35,9 +34,9 @@ library then selecting `Manage > Browse local files`. └── winhttp.dll ``` -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: +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: ``` . @@ -61,17 +60,3 @@ 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 98d1b6e..6bfd912 100644 --- a/README.md +++ b/README.md @@ -24,15 +24,9 @@ The following regions have been added: > > This mod only has compiled releases for the steam release of the game. -> 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. +> This mod requires you to have BepInEx installed. You can install BepInEx by following [this guide](INSTALLATION.md). -> 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). +1. Ensure that BepInEx is 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 d34e04f..49af462 100644 --- a/Unify/Patches/Regions.cs +++ b/Unify/Patches/Regions.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; using BepInEx.Configuration; +using HarmonyLib; +using UnityEngine; using Array = System.Array; using String = System.String; @@ -7,23 +9,15 @@ namespace Unify.Patches { public static class RegionsPatch { - private static IRegionInfo[] _newRegions = new IRegionInfo[] + private static readonly 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 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 readonly IRegionInfo[] CustomRegions = MergeRegions(NewRegions, LoadCustomUserRegions()); + private static readonly IRegionInfo[] PatchedRegions = MergeRegions(ServerManager.DefaultRegions, CustomRegions); private static IRegionInfo[] MergeRegions(IRegionInfo[] oldRegions, IRegionInfo[] newRegions) { @@ -56,5 +50,19 @@ 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 ab05b09..8d2325b 100644 --- a/Unify/Unify.cs +++ b/Unify/Unify.cs @@ -3,19 +3,17 @@ 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.1"; + private const string Version = "2.0.2"; public static readonly ConfigFile ConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg"), true); @@ -24,8 +22,6 @@ namespace Unify public override void Load() { - RegionsPatch.Patch(); - Harmony.PatchAll(); } } diff --git a/Unify/Unify.csproj b/Unify/Unify.csproj index 2b16178..281e31b 100644 --- a/Unify/Unify.csproj +++ b/Unify/Unify.csproj @@ -1,36 +1,45 @@ netstandard2.1 - 2.0.1 - NuclearPowered/Mappings:0.2.0 + 2.0.2 + 2021.3.5s - Region mod for Reactor + Region mod Daemon - - - 2021.3.5s - $(DefineConstants);STEAM + + + $(AssemblyName)-$(GameVersion) - - - 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 f9e2d50..a76515a 100644 Binary files a/build/Unify-2021.3.5s.dll and b/build/Unify-2021.3.5s.dll differ