63 Commits
Author SHA1 Message Date
Daemon f44179c040 Merge pull request #29 from MoltenMods/2021
Tidied code, fixed bugs, and added IP and port under custom region names in regions menu
2021-04-21 22:30:39 +01:00
Daemon 9c70216a9f Tidied code and fixed bugs
Tidied code and removed redundant code

Fixed region file getting spam reloaded

Fixed multiple direct connect buttons existing at once

Added IP and port under names of custom regions in regions menu
2021-04-21 22:26:53 +01:00
Daemon a16eb79973 Updated version and README 2021-04-14 12:37:47 +01:00
Daemon 04711c4369 Merge pull request #25 from MoltenMods/2021
Added Reactor back
2021-04-14 12:30:46 +01:00
Daemon f0010bf13e Built project 2021-04-14 12:25:01 +01:00
Daemon 1e7bc25ba8 Revert "Change regions after ServerManager.LoadServers instead of on game load"
This reverts commit d5de86c1e8, reversing
changes made to 7c1e2533b2.
2021-04-14 12:19:58 +01:00
Daemon d5de86c1e8 Change regions after ServerManager.LoadServers instead of on game load 2021-04-14 12:14:51 +01:00
Daemon 7c1e2533b2 Change regions after ServerManager.LoadServers instead of on game load 2021-04-14 12:11:16 +01:00
Daemon 913a02ddb6 Merge pull request #23 from MoltenMods/2021
Updated code for Reactor 0.4.0-ci.53
2021-04-13 19:09:07 +01:00
Daemon 1da6af54a9 Merge branch 'master' into 2021 2021-04-13 19:08:56 +01:00
Daemon e26fbccdb9 Updated code for Reactor 0.4.0-ci.53 2021-04-13 18:59:19 +01:00
Daemon 6f8a657fd0 Merge pull request #21 from MoltenMods/2021-pre
Updated code to work with 2021.4.12s
2021-04-13 14:02:27 +01:00
Daemon 5a4d501b9e Updated code to work with 2021.4.12s 2021-04-13 14:01:13 +01:00
Daemon ea4be527b7 Merge pull request #20 from MoltenMods/2021
Merge features from 2021 branch into 2021-pre branch
2021-04-13 13:47:17 +01:00
Daemon 6f266f7f93 Merge pull request #19 from MoltenMods/2021
Fixed bug caused by reckless code, tidied code and changed way regions menu is displayed
2021-04-11 14:19:39 +01:00
Daemon 1f5736c7f8 Updated version 2021-04-11 14:18:43 +01:00
Daemon 6df20f83c8 Updated README 2021-04-11 14:17:23 +01:00
Daemon 4c8866a33e Reduced custom regions length from 10 to 9 2021-04-11 14:15:53 +01:00
Daemon fd5a11394a Fixed bug caused by reckless code
Changed how regions menu is displayed
2021-04-11 14:15:05 +01:00
Daemon 5b63d7cd0c Tidied code
Removed `MergeRegions` function in favour of `AddRangeToArray` array method

Removed old 'disable modded handshake' code

Renamed `directConnect` field to `DirectConnect`
2021-04-11 12:27:31 +01:00
Daemon 76a25f8107 Merge pull request #18 from MoltenMods/2021
Updated code to work with Reactor and modified custom regions config to allow more regions
2021-04-09 21:10:54 +01:00
Daemon 339f4f2c33 Updated code to use reactor
Updated code to use fields instead of properties

Updated README

Modified custom regions config to allow 10 custom regions instead of 5
2021-04-09 21:03:28 +01:00
Daemon ec7eda2fa7 Merge pull request #17 from MoltenMods/2021-pre
Merge features from pre-release branch
2021-04-04 12:03:47 +01:00
Daemon 8ac9ff247d Merge pull request #16 from MoltenMods/2021-pre
Added direct connect option, restructured regions menu and updated code to work with 2021.3.31.3s
2021-04-02 12:58:47 +01:00
Daemon b22393625f Merge branch 'master' into 2021-pre 2021-04-02 12:58:32 +01:00
Daemon 5f0decd34f Updated code to work with 2021.3.31.3s
Modified way regions menu is displayed

Changed GUID and added code to automatically transfer old config
2021-04-02 12:54:15 +01:00
Daemon c7af5d5c9c Removed attempt to set input placeholder text 2021-03-30 21:36:41 +01:00
Daemon 26142c72d4 Added direct connect in regions menu 2021-03-30 21:15:08 +01:00
Daemon 083ac31586 Updated README 2021-03-19 22:00:09 +00:00
Daemon 81b058178c Updated version number 2021-03-19 21:56:53 +00:00
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 8560fb6a55 Modified mod to remove Reactor as a dependency 2021-03-14 12:11:48 +00:00
Daemon 5668255792 Modified mod to remove Reactor as a dependency 2021-03-14 12:10:51 +00:00
DaemonBeast af6e7f4b4c Modified mod to remove Reactor as a dependency 2021-03-14 12:08:22 +00:00
DaemonBeast f35196d68c Improved wording in README 2021-03-13 22:02:02 +00:00
Daemon fe8f24ce98 Fixed custom regions
Merged stable dev branch with master branch
2021-03-13 15:23:51 +00:00
Daemon 7fc26d8b92 Fixed custom regions
Merged stable dev branch with 2021 branch
2021-03-13 15:22:53 +00:00
DaemonBeast 80051f9ec2 Removed unused using directives 2021-03-13 15:20:06 +00:00
DaemonBeast 999fb61e5e Updated README 2021-03-13 15:17:54 +00:00
DaemonBeast 907b2f9fe1 Fixed custom regions
Changed StaticRegionInfo to DnsRegionInfo
2021-03-13 15:11:39 +00:00
Daemon 5675dab961 Merged pull request from dev branch
Updated code to work with 2021.3.5s
2021-03-11 22:40:11 +00:00
DaemonBeast b426eb5243 Updated code to work with 2021.3.5s
Modified README to add notices
2021-03-11 22:34:22 +00:00
Daemon 8fbb962627 Merged pull request from dev branch
Added config file for custom user regions
2021-03-04 18:50:15 +00:00
DaemonBeast 86cb2dd21b Added config file for custom user regions 2021-03-04 18:47:47 +00:00
Daemon a9a4ef3efa Merged pull request from dev branch
Added README and installation guide
2021-03-02 11:13:07 +00:00
DaemonBeast 908c0dd5c8 Added README and installation guide 2021-03-02 11:10:02 +00:00
DaemonBeast 98210325b0 Modified Harmony id to be more unique 2021-02-19 12:15:46 +00:00
12 changed files with 366 additions and 34 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ContentModelUserStore">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
+77
View File
@@ -0,0 +1,77 @@
# Installing BepInEx and Reactor
# 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
On steam, this can be achieved by right clicking Among Us in the steam
library then selecting `Manage > Browse local files`.
## Installing BepInEx
1. Download the latest release from the NuclearPowered/BepInEx
[releases](https://github.com/NuclearPowered/BepInEx/releases) page.
2. Unzip the files into the Among Us game files directory. It should
look something like this after you add BepInEx:
```
.
├── Among Us_Data
├── Among Us.exe
├── BepInEx
│   ├── core/
│   └── unity-libs/
├── changelog.txt
├── doorstop_config.ini
├── GameAssembly.dll
├── mono
│   ├── Managed/
│   └── MonoBleedingEdge/
├── UnityCrashHandler32.exe
├── UnityPlayer.dll
└── 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:
```
.
├── Among Us_Data
├── Among Us.exe
├── BepInEx
│   ├── cache/
│   ├── config/
│   ├── core/
│   ├── patchers/
│   ├── plugins/
│   ├── unhollowed/
│   └── unity-libs/
├── changelog.txt
├── doorstop_config.ini
├── GameAssembly.dll
├── mono
│   ├── Managed/
│   └── MonoBleedingEdge/
├── UnityCrashHandler32.exe
├── 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)
+65
View File
@@ -0,0 +1,65 @@
# Unify
An Among Us mod to add extra regions to the regions menu.
![Regions menu](images/RegionsMenu.png)
# Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
## Features
The following regions have been added:
- [skeld.net](https://skeld.net/)
- 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.
Other mods can add regions via the
`AddRegion(string name, string ip, ushort port)` method.
## Installation
> **⚠ WARNING**
>
> This mod only has compiled releases for the steam release of the game.
> 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 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 (Reactor is not required for pre releases) 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.
## Configuration
> **⚠ WARNING**
>
> The configuration file will be generated when loading the mod for
> the first time. If the configuration file is not there, try
> launching the game and closing it to see if the configuration
> file creates itself.
The configuration file is located at
`(Among Us game files)/BepInEx/config/daemon.unify.cfg`.
### Custom regions
Custom regions can be added by modifying the `[Region 1]`,
`[Region 2]` ... `[Region 9]` 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.
+145 -18
View File
@@ -1,31 +1,158 @@
using System;
using System.Collections.Generic;
using BepInEx.Configuration;
using HarmonyLib;
using Reactor.Extensions;
using UnityEngine;
using UnityEngine.UI;
using Object = UnityEngine.Object;
using String = System.String;
namespace Unify.Patches
{
[HarmonyPatch]
public static class RegionsPatch
{
private static IRegionInfo[] _oldRegions { get; } = ServerManager.DefaultRegions;
private static IRegionInfo[] _newRegions { get; } = new IRegionInfo[]
{
new DnsRegionInfo("192.241.154.115", "skeld.net", StringNames.NoTranslation, "192.241.154.115", 22023)
.Cast<IRegionInfo>(),
new DnsRegionInfo("localhost", "localhost", StringNames.NoTranslation, "127.0.0.1", 22023)
.Cast<IRegionInfo>(),
new DnsRegionInfo("152.228.160.91", "matux.fr", StringNames.NoTranslation, "152.228.160.91", 22023)
.Cast<IRegionInfo>()
};
public static List<IRegionInfo> ModRegions { get; } = new List<IRegionInfo>();
public static IRegionInfo DirectRegion { get; set; }
private static TextBoxTMP DirectConnect { get; set; }
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[] oldRegions = ServerManager.DefaultRegions;
RegionInfo[] patchedRegions = new RegionInfo[oldRegions.Length + newRegions.Length];
Array.Copy(oldRegions, patchedRegions, oldRegions.Length);
Array.Copy(newRegions, 0, patchedRegions, oldRegions.Length, newRegions.Length);
ServerManager serverManager = ServerManager.Instance;
IRegionInfo[] patchedRegions = _oldRegions
.AddRangeToArray(_newRegions)
.AddRangeToArray(ModRegions.ToArray())
.AddRangeToArray(LoadCustomUserRegions());
if (DirectRegion != null) patchedRegions = patchedRegions.AddToArray(DirectRegion);
ServerManager.DefaultRegions = patchedRegions;
serverManager.AvailableRegions = patchedRegions;
}
private static IRegionInfo[] LoadCustomUserRegions()
{
List<IRegionInfo> customRegions = new List<IRegionInfo>();
for (int x = 0; x < 9; 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);
if (String.IsNullOrWhiteSpace(regionIp.Value)) continue;
IRegionInfo regionInfo = new DnsRegionInfo(
regionIp.Value, $"{regionName.Value}\n{regionIp.Value} {regionPort.Value}",
StringNames.NoTranslation, regionIp.Value, regionPort.Value)
.Cast<IRegionInfo>();
customRegions.Add(regionInfo);
}
return customRegions.ToArray();
}
private static void UpdateRegion()
{
RegionMenu regionMenu = DestroyableSingleton<RegionMenu>.Instance;
bool success = UnifyPlugin.SetDirectRegion(DirectConnect.text, out IRegionInfo newRegion);
if (!success)
{
DirectConnect.StartCoroutine(Effects.SwayX(DirectConnect.transform, 0.75f, 0.25f));
return;
}
regionMenu.ChooseOption(newRegion);
regionMenu.Close();
}
[HarmonyPatch(typeof(ServerManager), nameof(ServerManager.LoadServers))]
public static class LoadNewRegionsPatch
{
public static void Postfix()
{
Patch();
}
}
[HarmonyPatch(typeof(JoinGameButton), nameof(JoinGameButton.OnClick))]
public static class DirectConnectEnterButtonPatch {
public static bool Prefix(JoinGameButton __instance)
{
GameObject regionMenuGameObject = GameObject.Find("RegionMenu");
if (!regionMenuGameObject) return true;
UpdateRegion();
return false;
}
}
[HarmonyPatch(typeof(RegionMenu))]
public static class RegionMenuPatches
{
[HarmonyPatch(nameof(RegionMenu.Open))]
[HarmonyPostfix]
public static void DirectConnectButtonPatch(RegionMenu __instance)
{
if (DirectConnect) DirectConnect.gameObject.Destroy();
JoinGameButton joinGameButton = DestroyableSingleton<JoinGameButton>.Instance;
DirectConnect = Object.Instantiate(joinGameButton.GameIdText, __instance.transform);
DirectConnect.IpMode = true;
DirectConnect.characterLimit = 15;
DirectConnect.ClearOnFocus = false;
DirectConnect.OnEnter = new Button.ButtonClickedEvent();
DirectConnect.OnEnter.AddListener((Action) UpdateRegion);
int offset = _newRegions.Length + ModRegions.Count;
DirectConnect.transform.localPosition = new Vector3(0, 1f - (offset / 2f), -100f);
}
[HarmonyPatch(nameof(RegionMenu.Open))]
[HarmonyPostfix]
public static void RegionMenuLayoutPatch(RegionMenu __instance)
{
var regionButtons = __instance.ButtonPool.activeChildren.ToArray();
for (int i = 0; i < regionButtons.Length; i++)
{
ServerListButton regionButton = regionButtons[i].Cast<ServerListButton>();
bool isCustomRegion = i >= _oldRegions.Length;
bool isCustomUserRegion = i >= _oldRegions.Length + _newRegions.Length + ModRegions.Count;
float x = (isCustomRegion ? 3f : 0) + (isCustomUserRegion ? 3f : 0) - 4.25f;
float y = i - (isCustomRegion ? _oldRegions.Length : 0) -
(isCustomUserRegion ? _newRegions.Length + ModRegions.Count : 0);
regionButton.transform.localPosition = new Vector3(1.25f + x, 2f - 0.5f * y, 0f);
}
}
}
}
}
}
// TODO:
// Store custom servers in a JSON file
+61 -5
View File
@@ -1,6 +1,12 @@
using BepInEx;
using System;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.IL2CPP;
using HarmonyLib;
using Hazel.Udp;
using Reactor;
using Unify.Patches;
@@ -9,19 +15,69 @@ namespace Unify
[BepInPlugin(Id, Name, Version)]
[BepInProcess("Among Us.exe")]
[BepInDependency(ReactorPlugin.Id)]
[ReactorPluginSide(PluginSide.ClientOnly)]
public class UnifyPlugin : BasePlugin
{
public const string Id = "reactor.unify";
public const string Id = "daemon.unify";
private const string Name = "Unify";
private const string Version = "0.1.0";
private const string Version = "4.1.0";
public static ConfigFile ConfigFile { get; private set; }
public Harmony Harmony { get; } = new Harmony(Id);
public override void Load()
{
RegionsPatch.Patch();
// ===== For compatibility reasons =====
string oldConfigPath = Path.Combine(Paths.ConfigPath, "daemon.unify.reactor.cfg");
string newConfigPath = Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg");
bool oldConfigExists = File.Exists(oldConfigPath);
if (oldConfigExists)
{
File.Copy(oldConfigPath, newConfigPath, true);
File.Delete(oldConfigPath);
}
ConfigFile = new ConfigFile(Path.Combine(Paths.ConfigPath, $"{UnifyPlugin.Id}.cfg"), true);
// =====================================
// Unpatches the modded handshake, because Impostor is STILL not fully updated yet
Harmony.Unpatch(typeof(UdpConnection).GetMethod("HandleSend"), HarmonyPatchType.Prefix,
ReactorPlugin.Id);
Harmony.PatchAll();
}
public static IRegionInfo AddRegion(string name, string ip, ushort port)
{
if (Uri.CheckHostName(ip) != UriHostNameType.IPv4) return ServerManager.Instance.CurrentRegion;
IRegionInfo existingRegion =
ServerManager.DefaultRegions.ToArray().FirstOrDefault(region => region.PingServer == ip);
if (existingRegion != null) return existingRegion;
IRegionInfo newRegion = new DnsRegionInfo(ip, $"{name}\n{ip} {port}", StringNames.NoTranslation, ip, port)
.Cast<IRegionInfo>();
RegionsPatch.ModRegions.Add(newRegion);
RegionsPatch.Patch();
return newRegion;
}
public static bool SetDirectRegion(string ip, out IRegionInfo newRegion)
{
newRegion = null;
if (!Regex.IsMatch(ip, @"^(\d{1,3}\.){3}\d{1,3}$")) return false;
newRegion = new DnsRegionInfo(ip, ip, StringNames.NoTranslation, ip, 22023)
.Cast<IRegionInfo>();
RegionsPatch.DirectRegion = newRegion;
RegionsPatch.Patch();
return true;
}
}
}
+17 -10
View File
@@ -1,31 +1,38 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>0.1.0</Version>
<Mappings>NuclearPowered/Mappings:0.1.2</Mappings>
<Version>4.1.0</Version>
<Mappings>NuclearPowered/Mappings:0.4.0</Mappings>
<Description>Region mod for Reactor</Description>
<Description>Region mod</Description>
<Authors>Daemon</Authors>
</PropertyGroup>
<PropertyGroup Condition="'$(GamePlatform)' == 'Steam'">
<GameVersion>2020.12.9s</GameVersion>
<GameVersion>2021.4.12s</GameVersion>
<DefineConstants>$(DefineConstants);STEAM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(GamePlatform)' == 'Itch'">
<GameVersion>2020.11.17i</GameVersion>
<GameVersion>2021.4.12i</GameVersion>
<DefineConstants>$(DefineConstants);ITCH</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Deobfuscate Include="$(AmongUs)\BepInEx\plugins\Reactor-$(GameVersion).dll" />
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.2.5" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.3.0">
<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/" />
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="$(NewAmongUs)/" />
</Target>
</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 145 KiB