19 Commits
Author SHA1 Message Date
Daemon a7b0774f9d Restructured code and added AddRegion() method 2021-03-19 21:49:09 +00:00
Daemon ab57814ee3 Added new AddRegion() method for external mods
`AddRegion()` method allows mods to add new regions
2021-03-19 21:43:43 +00:00
Daemon c861abbb4f Modified modded handshake disable patch
Stopped reactor handshake option getting set true automatically
2021-03-19 19:26:51 +00:00
Daemon d2a59980b0 Changed use of .Duplicate() method to .Cast<IRegionInfo>() 2021-03-19 19:10:44 +00:00
Daemon be49899a27 Added matux.fr to regions menu 2021-03-18 21:49:51 +00:00
Daemon 071b49f85d Added matux.fr to regions menu 2021-03-18 21:45:39 +00:00
Daemon fbc1751172 Removed outdated notice 2021-03-18 09:29:37 +00:00
Daemon 25ccc7124c Merge branch 'dev' 2021-03-14 15:49:43 +00:00
Daemon cd5093407a Merge branch '2021' of https://github.com/DaemonBeast/Unify into 2021 2021-03-14 15:46:45 +00:00
Daemon 489d1c85a7 Merge branch 'dev' into 2021 2021-03-14 15:45:08 +00:00
DaemonBeast c0d8638a27 Merge branch 'dev' into 2021 2021-03-14 15:25:55 +00:00
DaemonBeast 50c678901f Fixed modded handshake issue 2021-03-14 15:15:14 +00:00
DaemonBeast 3dbf2befc1 Revert "Modified mod to remove Reactor as a dependency"
This reverts commit af6e7f4b4c.
2021-03-14 12:40:21 +00:00
Daemon 3b9db051c9 Revert "Modified mod to remove Reactor as a dependency" 2021-03-14 12:29:00 +00:00
Daemon 6d18d01eb9 Revert "Modified mod to remove Reactor as a dependency" 2021-03-14 12:28:46 +00:00
Daemon e91ea01777 Revert "Modified mod to remove Reactor as a dependency" 2021-03-14 12:28:18 +00:00
Daemon bb69bbddfd Revert "Modified mod to remove Reactor as a dependency" 2021-03-14 12:27:47 +00:00
Daemon 5668255792 Modified mod to remove Reactor as a dependency 2021-03-14 12:10:51 +00:00
Daemon 7fc26d8b92 Fixed custom regions
Merged stable dev branch with 2021 branch
2021-03-13 15:22:53 +00:00
6 changed files with 119 additions and 68 deletions

No files matched your search

+18 -3
View File
@@ -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)
+9 -6
View File
@@ -1,6 +1,3 @@
> The 2021.3.5s release of this mod requires you to compile an in-development version of Impostor
> [here](https://github.com/Impostor/Impostor/tree/2021.3.5) if you want to host a local server.
# Unify
An Among Us mod to add extra regions to the regions menu.
@@ -22,11 +19,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.
+37 -24
View File
@@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using Hazel.Udp;
using Reactor;
using Array = System.Array;
using String = System.String;
@@ -9,25 +11,30 @@ namespace Unify.Patches
{
public static class RegionsPatch
{
private static readonly IRegionInfo[] NewRegions = new IRegionInfo[]
private static IRegionInfo[] _oldRegions = ServerManager.DefaultRegions;
private static IRegionInfo[] _newRegions = new IRegionInfo[]
{
new DnsRegionInfo("192.241.154.115", "skeld.net", StringNames.NoTranslation, "192.241.154.115")
.Duplicate(),
.Cast<IRegionInfo>(),
new DnsRegionInfo("localhost", "localhost", StringNames.NoTranslation, "127.0.0.1")
.Duplicate()
.Cast<IRegionInfo>(),
new DnsRegionInfo("152.228.160.91", "matux.fr", StringNames.NoTranslation, "152.228.160.91")
.Cast<IRegionInfo>()
};
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)
public static List<IRegionInfo> ModRegions = new List<IRegionInfo>();
public static void Patch()
{
IRegionInfo[] patchedRegions = new IRegionInfo[oldRegions.Length + newRegions.Length];
Array.Copy(oldRegions, patchedRegions, oldRegions.Length);
Array.Copy(newRegions, 0, patchedRegions, oldRegions.Length, newRegions.Length);
IRegionInfo[] customRegions = UnifyPlugin.MergeRegions(_newRegions, ModRegions.ToArray());
customRegions = UnifyPlugin.MergeRegions(customRegions, LoadCustomUserRegions());
IRegionInfo[] patchedRegions = UnifyPlugin.MergeRegions(_oldRegions, customRegions);
return patchedRegions;
ServerManager.DefaultRegions = patchedRegions;
ServerManager.Instance.AvailableRegions = patchedRegions;
ServerManager.Instance.SaveServers();
}
private static IRegionInfo[] LoadCustomUserRegions()
{
List<IRegionInfo> customRegions = new List<IRegionInfo>();
@@ -43,26 +50,32 @@ namespace Unify.Patches
IRegionInfo regionInfo = new DnsRegionInfo(
regionIp.Value, regionName.Value, StringNames.NoTranslation, regionIp.Value)
.Duplicate();
.Cast<IRegionInfo>();
customRegions.Add(regionInfo);
}
return customRegions.ToArray();
}
}
[HarmonyPatch(typeof(ServerManager), nameof(ServerManager.Awake))]
public static class AddRegionsPatch
[HarmonyPatch(typeof(UdpConnection), nameof(UdpConnection.HandleSend))]
public static class DisableModdedHandshakePatch
{
[HarmonyBefore(new string[] { "gg.reactor.api" })]
public static void Prefix()
{
public static void Prefix(ServerManager __instance)
{
ServerManager.DefaultRegions = PatchedRegions;
// ServerManager.AvailableRegions
__instance.JIJNOHCGPHM = PatchedRegions;
__instance.SaveServers();
}
if (UnifyPlugin.HandshakeDisabled) return;
if (!UnifyPlugin.NormalHandshake.Contains(ServerManager.Instance.CurrentRegion.Name)) return;
PluginSingleton<ReactorPlugin>.Instance.ModdedHandshake.Value = false;
}
public static void Postfix()
{
if (UnifyPlugin.HandshakeDisabled) return;
PluginSingleton<ReactorPlugin>.Instance.ModdedHandshake.Value = true;
}
}
}
+31 -2
View File
@@ -1,28 +1,57 @@
using System.IO;
using System;
using System.IO;
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.reactor";
private const string Name = "Unify";
private const string Version = "2.0.2";
private const string Version = "2.0.3";
public static readonly ConfigFile ConfigFile =
new ConfigFile(Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg"), true);
public static readonly bool HandshakeDisabled = !PluginSingleton<ReactorPlugin>.Instance.ModdedHandshake.Value;
public static readonly string[] NormalHandshake =
new string[] {"North America", "Europe", "Asia", "skeld.net"};
public Harmony Harmony { get; } = new Harmony(Id);
public override void Load()
{
RegionsPatch.Patch();
Harmony.PatchAll();
}
public static IRegionInfo[] MergeRegions(IRegionInfo[] oldRegions, IRegionInfo[] newRegions)
{
IRegionInfo[] patchedRegions = new IRegionInfo[oldRegions.Length + newRegions.Length];
Array.Copy(oldRegions, patchedRegions, oldRegions.Length);
Array.Copy(newRegions, 0, patchedRegions, oldRegions.Length, newRegions.Length);
return patchedRegions;
}
public static void AddRegion(string name, string ip)
{
IRegionInfo newRegion = new DnsRegionInfo(ip, name, StringNames.NoTranslation, ip)
.Cast<IRegionInfo>();
RegionsPatch.ModRegions.Add(newRegion);
RegionsPatch.Patch();
}
}
}
+24 -33
View File
@@ -1,45 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>2.0.2</Version>
<GameVersion>2021.3.5s</GameVersion>
<Version>2.0.3</Version>
<Mappings>NuclearPowered/Mappings:0.2.0</Mappings>
<Description>Region mod</Description>
<Description>Region mod for Reactor</Description>
<Authors>Daemon</Authors>
</PropertyGroup>
<PropertyGroup>
<TargetName>$(AssemblyName)-$(GameVersion)</TargetName>
<PropertyGroup Condition="'$(GamePlatform)' == 'Steam'">
<GameVersion>2021.3.5s</GameVersion>
<DefineConstants>$(DefineConstants);STEAM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(GamePlatform)' == 'Itch'">
<GameVersion>2021.11.17i</GameVersion>
<DefineConstants>$(DefineConstants);ITCH</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony, Version=2.3.1.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="BepInEx.Core, Version=6.0.0.16, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\BepInEx.Core.dll</HintPath>
</Reference>
<Reference Include="BepInEx.IL2CPP, Version=6.0.0.16, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\BepInEx.IL2CPP.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="UnhollowerBaseLib, Version=0.4.14.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\core\UnhollowerBaseLib.dll</HintPath>
</Reference>
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unity-libs\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\Program Files\SteamLibrary\steamapps\common\Among Us\BepInEx\unhollowed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Deobfuscate Include="$(AmongUs)\BepInEx\plugins\Reactor-$(GameVersion).dll" />
</ItemGroup>
<Target Name="Copy" AfterTargets="AfterBuild">
<Copy SourceFiles="$(OutputPath)/$(TargetName).dll" DestinationFolder="../build" />
<ItemGroup>
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.2.9">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<Target Name="Copy" AfterTargets="Reobfuscate">
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="$(AmongUs)/BepInEx/plugins/" />
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="../build/" />
</Target>
</Project>
Binary file not shown.