mirror of
https://github.com/MoltenMods/Unify.git
synced 2026-10-20 11:40:00 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be49899a27 | ||
|
|
071b49f85d | ||
|
|
fbc1751172 | ||
|
|
25ccc7124c | ||
|
|
cd5093407a | ||
|
|
489d1c85a7 | ||
|
|
c0d8638a27 | ||
|
|
50c678901f | ||
|
|
3dbf2befc1 | ||
|
|
3b9db051c9 | ||
|
|
6d18d01eb9 | ||
|
|
e91ea01777 | ||
|
|
bb69bbddfd | ||
|
|
8560fb6a55 | ||
|
|
5668255792 | ||
|
|
af6e7f4b4c | ||
|
|
f35196d68c | ||
|
|
fe8f24ce98 | ||
|
|
7fc26d8b92 | ||
|
|
80051f9ec2 | ||
|
|
999fb61e5e | ||
|
|
907b2f9fe1 | ||
|
|
5675dab961 | ||
|
|
b426eb5243 |
No files matched your search
@@ -1,4 +1,4 @@
|
||||
# Unify
|
||||
# Unify
|
||||
|
||||
An Among Us mod to add extra regions to the regions menu.
|
||||
|
||||
@@ -19,9 +19,16 @@ The following regions have been added:
|
||||
|
||||
> **⚠ WARNING**
|
||||
>
|
||||
> This mod is only compatible with 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.
|
||||
|
||||
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.
|
||||
|
||||
+49
-31
@@ -1,60 +1,61 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BepInEx.Configuration;
|
||||
using HarmonyLib;
|
||||
using Hazel.Udp;
|
||||
using Reactor;
|
||||
using Array = System.Array;
|
||||
using String = System.String;
|
||||
|
||||
namespace Unify.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public static class RegionsPatch
|
||||
{
|
||||
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(),
|
||||
new DnsRegionInfo("152.228.160.91", "matux.fr", StringNames.NoTranslation, "152.228.160.91")
|
||||
.Duplicate()
|
||||
};
|
||||
private static IRegionInfo[] _customRegions = MergeRegions(_newRegions, LoadCustomUserRegions());
|
||||
|
||||
public static void Patch()
|
||||
{
|
||||
RegionInfo[] newRegions = new RegionInfo[]
|
||||
{
|
||||
new RegionInfo("skeld.net", "192.241.154.115", new ServerInfo[]
|
||||
{
|
||||
new ServerInfo("skeld.net-Master-1", "192.241.154.115", 22023)
|
||||
}),
|
||||
new RegionInfo("localhost", "127.0.0.1", new ServerInfo[]
|
||||
{
|
||||
new ServerInfo("localhost-Master-1", "127.0.0.1", 22023)
|
||||
})
|
||||
};
|
||||
|
||||
RegionInfo[] customRegions = LoadCustomRegions();
|
||||
|
||||
RegionInfo[] patchedRegions = MergeRegions(ServerManager.DefaultRegions, newRegions);
|
||||
patchedRegions = MergeRegions(patchedRegions, customRegions);
|
||||
IRegionInfo[] patchedRegions = MergeRegions(ServerManager.DefaultRegions, _customRegions);
|
||||
|
||||
ServerManager.DefaultRegions = patchedRegions;
|
||||
ServerManager.Instance.AvailableRegions = patchedRegions;
|
||||
ServerManager.Instance.SaveServers();
|
||||
}
|
||||
|
||||
private static RegionInfo[] MergeRegions(RegionInfo[] oldRegions, RegionInfo[] newRegions)
|
||||
private static IRegionInfo[] MergeRegions(IRegionInfo[] oldRegions, IRegionInfo[] newRegions)
|
||||
{
|
||||
RegionInfo[] patchedRegions = new RegionInfo[oldRegions.Length + newRegions.Length];
|
||||
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;
|
||||
}
|
||||
|
||||
private static RegionInfo[] LoadCustomRegions()
|
||||
private static IRegionInfo[] LoadCustomUserRegions()
|
||||
{
|
||||
List<RegionInfo> customRegions = new List<RegionInfo>();
|
||||
List<IRegionInfo> customRegions = new List<IRegionInfo>();
|
||||
|
||||
for (int x = 0; x < 5; x++)
|
||||
{
|
||||
ConfigEntry<string> regionName = UnifyPlugin.ConfigFile.Bind($"Region {x + 1}", $"Name", "custom region");
|
||||
ConfigEntry<string> regionIp = UnifyPlugin.ConfigFile.Bind($"Region {x + 1}", "IP", "");
|
||||
ConfigEntry<ushort> regionPort = UnifyPlugin.ConfigFile.Bind($"Region {x + 1}", "Port", (ushort) 22023);
|
||||
|
||||
ConfigEntry<string> regionName = UnifyPlugin.ConfigFile.Bind(
|
||||
$"Region {x + 1}", $"Name", "custom region");
|
||||
ConfigEntry<string> regionIp = UnifyPlugin.ConfigFile.Bind(
|
||||
$"Region {x + 1}", "IP", "");
|
||||
|
||||
if (String.IsNullOrWhiteSpace(regionIp.Value)) continue;
|
||||
|
||||
RegionInfo regionInfo = new RegionInfo(regionName.Value, regionIp.Value, new ServerInfo[]
|
||||
{
|
||||
new ServerInfo($"{regionName.Value}-Master-1", regionIp.Value, regionPort.Value)
|
||||
});
|
||||
IRegionInfo regionInfo = new DnsRegionInfo(
|
||||
regionIp.Value, regionName.Value, StringNames.NoTranslation, regionIp.Value)
|
||||
.Duplicate();
|
||||
|
||||
customRegions.Add(regionInfo);
|
||||
}
|
||||
@@ -62,4 +63,21 @@ namespace Unify.Patches
|
||||
return customRegions.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(UdpConnection), nameof(UdpConnection.HandleSend))]
|
||||
public static class DisableModdedHandshakePatch
|
||||
{
|
||||
[HarmonyBefore(new string[] { "gg.reactor.api" })]
|
||||
public static void Prefix()
|
||||
{
|
||||
if (!UnifyPlugin.NormalHandshake.Contains(ServerManager.Instance.CurrentRegion.Name)) return;
|
||||
|
||||
PluginSingleton<ReactorPlugin>.Instance.ModdedHandshake.Value = false;
|
||||
}
|
||||
|
||||
public static void Postfix()
|
||||
{
|
||||
PluginSingleton<ReactorPlugin>.Instance.ModdedHandshake.Value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-2
@@ -11,21 +11,25 @@ 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 = "0.1.1";
|
||||
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 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();
|
||||
}
|
||||
}
|
||||
|
||||
+10
-5
@@ -1,27 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<Version>0.1.1</Version>
|
||||
<Mappings>NuclearPowered/Mappings:0.1.2</Mappings>
|
||||
<Version>2.0.3</Version>
|
||||
<Mappings>NuclearPowered/Mappings:0.2.0</Mappings>
|
||||
|
||||
<Description>Region mod for Reactor</Description>
|
||||
<Authors>Daemon</Authors>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(GamePlatform)' == 'Steam'">
|
||||
<GameVersion>2020.12.9s</GameVersion>
|
||||
<GameVersion>2021.3.5s</GameVersion>
|
||||
<DefineConstants>$(DefineConstants);STEAM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(GamePlatform)' == 'Itch'">
|
||||
<GameVersion>2020.11.17i</GameVersion>
|
||||
<GameVersion>2021.11.17i</GameVersion>
|
||||
<DefineConstants>$(DefineConstants);ITCH</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Deobfuscate Include="$(AmongUs)\BepInEx\plugins\Reactor-$(GameVersion).dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.2.5" />
|
||||
<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">
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user