Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Commit

Permalink
Latest version
Browse files Browse the repository at this point in the history
Updated code to latest version of Among Us. Release soon
  • Loading branch information
przebor committed Mar 30, 2021
1 parent d03a582 commit f1e0c5c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 23 deletions.
12 changes: 6 additions & 6 deletions CustomServersClient/CustomServersClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.4.0</Version>
<GameVersion>2020.12.9s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.1.2</Mappings>
<GameVersion>2021.3.5s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.2.0</Mappings>

<Authors>andruzzzhka</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.3.5i</GameVersion>
<DefineConstants>$(DefineConstants);ITCH</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Deobfuscate Include="$(AmongUs)\BepInEx\plugins\Reactor-$(GameVersion).dll" />
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.2.5" />
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.2.9" />
</ItemGroup>

<ItemGroup>
Expand All @@ -29,6 +29,6 @@
</Reference>
</ItemGroup>
<Target Name="Copy" AfterTargets="Reobfuscate">
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="$(AmongUs)/BepInEx/plugins/" Condition="'$(Configuration)' == 'Debug'" />
<Copy SourceFiles="$(OutputPath)reobfuscated/$(AssemblyName)-$(GameVersion).dll" DestinationFolder="$(AmongUs)\BepInEx\plugins\" Condition="'$(Configuration)' == 'Debug'" />
</Target>
</Project>
29 changes: 12 additions & 17 deletions CustomServersClient/CustomServersPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System;
using UnhollowerBaseLib;
using CustomServersClient.UI;
using Il2CppSystem.Diagnostics.Tracing;
using Il2CppSystem.Globalization;

namespace CustomServersClient
{
public static class CustomServersPatches
{
public static List<CustomServerInfo> customServers = new List<CustomServerInfo>();

static RegionInfo[] _defaultRegions = new RegionInfo[3];

static bool _firstRun = true;
private static IRegionInfo[] _defaultRegions = ServerManager.DefaultRegions;

static ServersManagementForm _managementForm;

[HarmonyPatch(typeof(RegionMenu), nameof(RegionMenu.OnEnable))]
Expand All @@ -27,16 +29,6 @@ public static bool Prefix(ref RegionMenu __instance)
{
ClearOnClickAction(__instance.ButtonPool);

if (_firstRun)
{
for (int i = 0; i < 3; i++)
{
_defaultRegions[i] = ServerManager.DefaultRegions[i];
}

_firstRun = false;
}

Directory.CreateDirectory(CustomServersPlugin.userDataPath);

if (File.Exists(Path.Combine(CustomServersPlugin.userDataPath, CustomServersPlugin.customServersFilePath)))
Expand All @@ -51,9 +43,10 @@ public static bool Prefix(ref RegionMenu __instance)

if (ServerManager.DefaultRegions.Count != 4 + customServers.Count || forceReloadServers)
{
var regions = new RegionInfo[4 + customServers.Count];
var regions = new IRegionInfo[4 + customServers.Count];

regions[0] = new RegionInfo("Manage servers...", "MANAGE_SERVERS", null);
regions[0] = new DnsRegionInfo("Manage servers...", "Manage servers...", StringNames.NoTranslation,
"Manage servers...").Cast<IRegionInfo>();

for (int i = 0; i < 3; i++)
{
Expand All @@ -64,10 +57,12 @@ public static bool Prefix(ref RegionMenu __instance)
{
Il2CppReferenceArray<ServerInfo> servers = new ServerInfo[1] { new ServerInfo(customServers[i].name, customServers[i].ip, (ushort)customServers[i].port) };

regions[i + 4] = new RegionInfo(customServers[i].name, "0", servers);
regions[i + 4] = new DnsRegionInfo(customServers[i].ip, customServers[i].name, StringNames.NoTranslation, servers).Cast<IRegionInfo>();
}

ServerManager.DefaultRegions = regions;
ServerManager.Instance.AvailableRegions = regions;
ServerManager.Instance.SaveServers();
}

return true;
Expand Down Expand Up @@ -97,7 +92,7 @@ public static class RegionMenuChooseOptionPatch
{
public static bool Prefix(ref RegionMenu.c__DisplayClass2_0 __instance)
{
if (__instance.region.PingServer == "MANAGE_SERVERS")
if (__instance.region.PingServer == "Manage servers...")
{
if (_managementForm == null || _managementForm.IsDisposed)
_managementForm = new ServersManagementForm();
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Works on Itch as of **v2020.11.17i**.
4. Compiled dll should be automatically copied to your `BepInEx/plugins` folder (Reactor feature)
## Screenshot
![screenshot_0](https://cdn.discordapp.com/attachments/759066383090188308/763331715740729364/unknown.png)
## Hall of Fame
- latest version is available thanks to [updated Unify](https://github.com/MoltenMods/Unify)


## TO-DO
- Make the mod work with latest Among Us (v2021.3.5)
Expand Down

0 comments on commit f1e0c5c

Please sign in to comment.