diff --git a/README.md b/README.md index 11b0f91..604014e 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,14 @@ > **⚠ WARNING** > -> Impostor currently doesn't support the 2021.3.31.3s release of the -> game, so custom servers will give an outdated error when you try to -> connect. The 3.0.0-pre.1 release of Unify doesn't use Reactor, since -> Reactor is currently outdated and Unify will not actually work until -> Impostor has been updated to support the 2021.3.31.3s release of the -> game. A new stable version of Unify will be released once Reactor is -> up-to-date, but it should be functional with or without Reactor once -> Impostor is up-to-date. +> To play on a custom server on 2021.3.31.3s, you must compile the +> *airship* branch of Impostor located here: +> https://github.com/Impostor/Impostor/tree/airship. # Unify An Among Us mod to add extra regions to the regions menu. -![Regions menu](images/RegionsMenu.jpg) +![Regions menu](images/RegionsMenu.png) # Table of Contents - [Features](#features) @@ -27,22 +22,26 @@ The following regions have been added: - localhost *(for playing on a server running on your computer)* - matux.fr +Regions can be connected to directly using an IP address. + +Custom regions can be added as detailed below in the +[configuration](#configuration) section. + ## Installation > **⚠ WARNING** > > 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. - > 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. +> If you are still using 2021.3.5s and Reactor fails to load, try using the Reactor version located +> here: https://github.com/NuclearPowered/Reactor/actions/runs/636023321. -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. +1. Ensure that BepInEx and Reactor are installed ([installation guide](INSTALLATION.md)). +2. Download the latest mod on the [releases](https://github.com/DaemonBeast/Unify/releases) page + for the version of Among Us you are using. 3. Move the mod to the `(Among Us game files)/BepInEx/plugins` folder. 4. Launch the game. @@ -56,13 +55,13 @@ The following regions have been added: > file creates itself. The configuration file is located at -`(Among Us game files)/BepInEx/config/daemon.unify.reactor.cfg`. +`(Among Us game files)/BepInEx/config/daemon.unify.cfg`. ### Custom regions Custom regions can be added by modifying the `[Region 1]`, -`[Region 2]` ... `[Region 5]` sections of the configuration file. -The sections allow you to modify the display name of the region and -the IP address of the region. +`[Region 2]` ... `[Region 10]` sections of the configuration file. +You can modify the display name of the region, +the IP address of the region and the port of the region. If the IP field is left empty, the region will not show up in game. diff --git a/Unify/Patches/Regions.cs b/Unify/Patches/Regions.cs index dec7375..fa220f8 100644 --- a/Unify/Patches/Regions.cs +++ b/Unify/Patches/Regions.cs @@ -11,9 +11,9 @@ namespace Unify.Patches { public static class RegionsPatch { - private static IRegionInfo[] _oldRegions = ServerManager.DefaultRegions; + private static IRegionInfo[] _oldRegions { get; } = ServerManager.DefaultRegions; - private static IRegionInfo[] _newRegions = new IRegionInfo[] + private static IRegionInfo[] _newRegions { get; } = new IRegionInfo[] { new DnsRegionInfo("192.241.154.115", "skeld.net", StringNames.NoTranslation, "192.241.154.115", 22023) .Cast(), @@ -23,15 +23,15 @@ namespace Unify.Patches .Cast() }; - public static List ModRegions = new List(); + public static List ModRegions { get; } = new List(); - public static IRegionInfo DirectRegion; + public static IRegionInfo DirectRegion { get; set; } - private static TextBox directConnect; + private static TextBox directConnect { get; set; } public static void Patch() { - ServerManager serverManager = DestroyableSingleton.CMJOLNCMAPD; + ServerManager serverManager = ServerManager.Instance; IRegionInfo[] customRegions = UnifyPlugin.MergeRegions(_newRegions, ModRegions.ToArray()); customRegions = UnifyPlugin.MergeRegions(customRegions, LoadCustomUserRegions()); @@ -39,7 +39,7 @@ namespace Unify.Patches IRegionInfo[] patchedRegions = UnifyPlugin.MergeRegions(_oldRegions, customRegions); ServerManager.DefaultRegions = patchedRegions; - serverManager.GDOLGIJJLBL = patchedRegions; + serverManager.AvailableRegions = patchedRegions; serverManager.SaveServers(); } @@ -47,17 +47,19 @@ namespace Unify.Patches { List customRegions = new List(); - for (int x = 0; x < 5; x++) + for (int x = 0; x < 10; x++) { ConfigEntry regionName = UnifyPlugin.ConfigFile.Bind( $"Region {x + 1}", $"Name", "custom region"); ConfigEntry regionIp = UnifyPlugin.ConfigFile.Bind( $"Region {x + 1}", "IP", ""); + ConfigEntry regionPort = UnifyPlugin.ConfigFile.Bind( + $"Region {x + 1}", "Port", (ushort) 22023); if (String.IsNullOrWhiteSpace(regionIp.Value)) continue; IRegionInfo regionInfo = new DnsRegionInfo( - regionIp.Value, regionName.Value, StringNames.NoTranslation, regionIp.Value, 22023) + regionIp.Value, regionName.Value, StringNames.NoTranslation, regionIp.Value, regionPort.Value) .Cast(); customRegions.Add(regionInfo); @@ -74,7 +76,7 @@ namespace Unify.Patches if (!success) { - directConnect.StartCoroutine(HLPCBNMDEHF.FIJHCJMBGFP(directConnect.transform, 0.75f, 0.25f)); + directConnect.StartCoroutine(Effects.FIJHCJMBGFP(directConnect.transform, 0.75f, 0.25f)); return; } @@ -87,8 +89,8 @@ namespace Unify.Patches { public static void Postfix() { - JoinGameButton joinGameButton = DestroyableSingleton.CMJOLNCMAPD; - RegionMenu regionMenu = DestroyableSingleton.CMJOLNCMAPD; + JoinGameButton joinGameButton = DestroyableSingleton.Instance; + RegionMenu regionMenu = DestroyableSingleton.Instance; directConnect = Object.Instantiate(joinGameButton.GameIdText, regionMenu.transform); directConnect.gameObject.SetActive(false); @@ -112,7 +114,7 @@ namespace Unify.Patches directConnect.gameObject.SetActive(true); var regionButtons = __instance.ButtonPool.activeChildren.ToArray(); - int half = regionButtons.Length / 2; + int half = (regionButtons.Length + 1) / 2; for (int x = 0; x < regionButtons.Length; x++) { @@ -155,31 +157,7 @@ namespace Unify.Patches } } } - - /*[HarmonyPatch(typeof(UdpConnection), nameof(UdpConnection.HandleSend))] - public static class DisableModdedHandshakePatch - { - [HarmonyBefore(new string[] { "gg.reactor.api" })] - public static void Prefix() - { - if (UnifyPlugin.HandshakeDisabled) return; - if (!UnifyPlugin.NormalHandshake.Contains(ServerManager.Instance.CurrentRegion.Name)) return; - - PluginSingleton.Instance.ModdedHandshake.Value = false; - } - - public static void Postfix() - { - if (UnifyPlugin.HandshakeDisabled) return; - - PluginSingleton.Instance.ModdedHandshake.Value = true; - } - }*/ } -/* - -Change fields to properties -Change how custom region is detected - -*/ \ No newline at end of file +// TODO: +// Store custom servers in a JSON file \ No newline at end of file diff --git a/Unify/Unify.cs b/Unify/Unify.cs index 48b8352..8cdb028 100644 --- a/Unify/Unify.cs +++ b/Unify/Unify.cs @@ -6,19 +6,22 @@ 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)] + [ReactorPluginSide(PluginSide.ClientOnly)] public class UnifyPlugin : BasePlugin { public const string Id = "daemon.unify"; private const string Name = "Unify"; - private const string Version = "3.0.0-pre.1"; + private const string Version = "3.0.0"; - public static ConfigFile ConfigFile; + public static ConfigFile ConfigFile { get; private set; } // public static readonly bool HandshakeDisabled = !PluginSingleton.Instance.ModdedHandshake.Value; @@ -43,6 +46,8 @@ namespace Unify // ===================================== RegionsPatch.Patch(); + + Harmony.UnpatchAll(ReactorPlugin.Id); Harmony.PatchAll(); } @@ -58,8 +63,7 @@ namespace Unify public static IRegionInfo AddRegion(string name, string ip) { - if (Uri.CheckHostName(ip) != UriHostNameType.IPv4) - return DestroyableSingleton.CMJOLNCMAPD.KIDDJMGEOKK; + if (Uri.CheckHostName(ip) != UriHostNameType.IPv4) return ServerManager.Instance.CurrentRegion; IRegionInfo existingRegion = ServerManager.DefaultRegions.ToArray().FirstOrDefault(region => region.PingServer == ip); diff --git a/Unify/Unify.csproj b/Unify/Unify.csproj index 9df40c2..8b029dc 100644 --- a/Unify/Unify.csproj +++ b/Unify/Unify.csproj @@ -1,227 +1,36 @@ netstandard2.1 - 3.0.0-pre.1 + 3.0.0 + NuclearPowered/Mappings:0.3.0 Region mod Daemon + + + 2021.3.31.3s + $(DefineConstants);STEAM + + + + 2021.3.31.3i + $(DefineConstants);ITCH + + - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\0Harmony.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Apple.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\AppleCore.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\AppleMacos.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Assembly-CSharp.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Assembly-CSharp-firstpass.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\FacebookStore.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Hazel.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppMono.Security.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2Cppmscorlib.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.Configuration.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.Core.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.Data.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.Net.Http.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.Numerics.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.Runtime.Serialization.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.Xml.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2CppSystem.Xml.Linq.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Newtonsoft.Json.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Purchasing.Common.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\QRCoder.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Rewired_Core.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Rewired_Windows.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Security.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Stores.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\UnhollowerBaseLib.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Unity.Addressables.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Unity.Analytics.DataPrivacy.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Unity.ResourceManager.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Unity.TextMeshPro.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.AIModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.AndroidJNIModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.AnimationModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.AssetBundleModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.AudioModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.CoreModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.DirectorModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.GridModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.ImageConversionModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.IMGUIModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.InputLegacyModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.InputModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.JSONSerializeModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.ParticleSystemModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.Physics2DModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.PhysicsModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.Purchasing.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.ScreenCaptureModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.SharedInternalsModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.SpriteMaskModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.SpriteShapeModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.SubsystemsModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.TerrainModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.TextCoreModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.TextRenderingModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.TilemapModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.UI.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.UIElementsNativeModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.UIModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.UnityAnalyticsModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.UnityWebRequestAssetBundleModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.UnityWebRequestModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.UnityWebRequestWWWModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.VFXModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.VideoModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.VRModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.XRModule.dll - - - ..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\winrt.dll - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + \ No newline at end of file diff --git a/build/Unify-2021.3.31.3s.dll b/build/Unify-2021.3.31.3s.dll new file mode 100644 index 0000000..61b6280 Binary files /dev/null and b/build/Unify-2021.3.31.3s.dll differ diff --git a/images/RegionsMenu.jpg b/images/RegionsMenu.jpg deleted file mode 100644 index 5ad7fb7..0000000 Binary files a/images/RegionsMenu.jpg and /dev/null differ diff --git a/images/RegionsMenu.png b/images/RegionsMenu.png new file mode 100644 index 0000000..cefd9e0 Binary files /dev/null and b/images/RegionsMenu.png differ