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

Commit

Permalink
Merge pull request #24 from CrowdedMods/airship
Browse files Browse the repository at this point in the history
Airship update
  • Loading branch information
przebor authored Apr 11, 2021
2 parents 5db025c + db23769 commit 53a78b4
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 49 deletions.
19 changes: 7 additions & 12 deletions CustomServersClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CustomServersClient", "Cust
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Itch-Debug|Any CPU = Itch-Debug|Any CPU
Itch-Release|Any CPU = Itch-Release|Any CPU
Steam-Debug|Any CPU = Steam-Debug|Any CPU
Steam-Release|Any CPU = Steam-Release|Any CPU
Release|Any CPU = Release|Any CPU
Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Itch-Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Itch-Debug|Any CPU.Build.0 = Debug|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Itch-Release|Any CPU.ActiveCfg = Itch-Release|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Itch-Release|Any CPU.Build.0 = Itch-Release|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Steam-Debug|Any CPU.ActiveCfg = Steam-Debug|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Steam-Debug|Any CPU.Build.0 = Steam-Debug|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Steam-Release|Any CPU.ActiveCfg = Debug|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Steam-Release|Any CPU.Build.0 = Debug|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Release|Any CPU.Build.0 = Release|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8424C5D8-334F-4CAB-B3C8-4D7635283B7F}.Release|Any CPU.Deploy.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
21 changes: 6 additions & 15 deletions CustomServersClient/CustomServersClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,21 @@

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Version>1.5.0</Version>
<GameVersion>2021.3.5s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.2.0</Mappings>
<Version>1.6.0</Version>
<GameVersion>2021.3.31.3s</GameVersion>
<Mappings>NuclearPowered/Mappings:0.3.0</Mappings>
<Authors>andruzzzhka</Authors>
</PropertyGroup>
<PropertyGroup Condition="'$(GamePlatform)' == 'Steam'">
<GameVersion>2021.3.5s</GameVersion>
<DefineConstants>$(DefineConstants);STEAM</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(GamePlatform)' == 'Itch'">
<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.9" />
<PackageReference Include="Reactor.OxygenFilter.MSBuild" Version="0.3.0" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Windows.Forms">
<HintPath>$(AmongUs)\mono\Managed\System.Windows.Forms.dll</HintPath>
<HintPath>$(AmongUs)\BepInEx\plugins\CustomServersClient\System.Windows.Forms.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="Copy" AfterTargets="Reobfuscate">
Expand Down
17 changes: 6 additions & 11 deletions CustomServersClient/CustomServersPatches.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using HarmonyLib;
using InnerNet;
using Newtonsoft.Json;
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
{
Expand Down Expand Up @@ -46,7 +41,7 @@ public static bool Prefix(ref RegionMenu __instance)
var regions = new IRegionInfo[4 + customServers.Count];

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

for (int i = 0; i < 3; i++)
{
Expand All @@ -55,7 +50,7 @@ public static bool Prefix(ref RegionMenu __instance)

for (int i = 0; i < customServers.Count; i++)
{
Il2CppReferenceArray<ServerInfo> servers = new ServerInfo[1] { new ServerInfo(customServers[i].name, customServers[i].ip, (ushort)customServers[i].port) };
Il2CppReferenceArray<ServerInfo> servers = new [] { new ServerInfo(customServers[i].name, customServers[i].ip, (ushort)customServers[i].port) };

regions[i + 4] = new DnsRegionInfo(customServers[i].ip, customServers[i].name, StringNames.NoTranslation, servers).Cast<IRegionInfo>();
}
Expand Down Expand Up @@ -87,17 +82,17 @@ public static void ClearOnClickAction(ObjectPoolBehavior buttonPool)
}


[HarmonyPatch(typeof(RegionMenu.c__DisplayClass2_0), "Method_Internal_Void_0")]
[HarmonyPatch(typeof(RegionMenu), nameof(RegionMenu.ChooseOption))]
public static class RegionMenuChooseOptionPatch
{
public static bool Prefix(ref RegionMenu.c__DisplayClass2_0 __instance)
public static bool Prefix(RegionMenu __instance, [HarmonyArgument(0)] IRegionInfo region)
{
if (__instance.region.PingServer == "Manage servers...")
if (region.PingServer == "Manage servers...")
{
if (_managementForm == null || _managementForm.IsDisposed)
_managementForm = new ServersManagementForm();

_managementForm.regionMenu = __instance.__this;
_managementForm.regionMenu = __instance;

if (_managementForm.Visible)
_managementForm.Focus();
Expand Down
9 changes: 5 additions & 4 deletions CustomServersClient/CustomServersPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,25 @@

namespace CustomServersClient
{
[BepInPlugin("com.andruzzzhka.customserversclient")]
[BepInPlugin(Id)]
[BepInProcess("Among Us.exe")]
[BepInDependency(ReactorPlugin.Id)]
[ReactorPluginSide(PluginSide.ClientOnly)]
public class CustomServersPlugin : BasePlugin
{
public const string userDataPath = "UserData";
public const string customServersFilePath = "CustomServers.json";
public const string Id = "com.andruzzzhka.customserversclient";

static internal BepInEx.Logging.ManualLogSource Logger;
internal static BepInEx.Logging.ManualLogSource Logger;

static Harmony _harmony;
static Harmony _harmony = new Harmony(Id);

public override void Load()
{
Logger = Log;

_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.andruzzzhka.customserversclient");
_harmony.PatchAll();

Logger.LogDebug("Applied Harmony patches!");
}
Expand Down
2 changes: 1 addition & 1 deletion CustomServersClient/UI/EditServerForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private void saveBtn_Click(object sender, EventArgs e)
CustomServersPlugin.Logger.LogWarning($"Resolving IP address for domain \"{address}\"...");

var adresses = Dns.GetHostAddresses(address);
if (adresses != null && adresses.Length > 0)
if (adresses.Length > 0)
{
address = adresses[0].ToString();
}
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
[![Our Discord](https://img.shields.io/discord/787008412482797598?color=7289da&label=DISCORD&style=for-the-badge)](https://discord.gg/XEc7PdDTyn)
# Custom Servers Client
An in-game client for custom servers for Among Us. This works on both the Steam and Itch versions of the game.

Works on Steam as of **v2021.3.5s**.
Works (tested) on Steam as of **v2021.3.31.3s**.
Works (tested) on Itch as of **v2020.11.17i**.

## Installation (on Steam)
1. Download latest [BepInEx (Reactor fork)](https://github.com/NuclearPowered/BepInEx/releases)
2. Extract all files from zipped archive and put them in Among Us directory (where Among Us.exe is)
3. Download [latest Reactor.dll for 2021.3.5s](https://nightly.link/NuclearPowered/Reactor/workflows/main/master) and put it in `YourAmongUsDirectory/BepInEx/plugins`
2. Extract all files from zipped archive and put them in `YourAmongUsDirectory` (where Among Us.exe is)
3. Download [latest Reactor.dll for 2021.3.31.3s](https://nightly.link/NuclearPowered/Reactor/workflows/main/master) and put it in `YourAmongUsDirectory/BepInEx/plugins`
4. Download latest CustomServersClient.zip from releases, unzip it.
5. Put unzipped content of `CustomServersClient_v.x.x.x_Steam.zip` in `YourAmongUsDirectory`
5. Put unzipped content of `CustomServersClient_vx.x.x_Steam.zip` in `YourAmongUsDirectory\BepInEx\plugins` (for versions v1.5.0 and lower, just put the content in `YourAmongUsDirectory`)

*`YourAmongUsDirectory` is your Among Us root directory

## Versions
| Mod version | Game version | BepInEx | Downloads |
| ------------- | ------------- | ------- | --------- |
| v1.6.0 | v2021.3.31.3 | [Reactor BepInEx](https://github.com/NuclearPowered/BepInEx/releases/download/6.0.0-reactor.18%2Bstructfix/BepInEx-6.0.0-reactor.18+structfix.zip) | [Releases](https://github.com/CrowdedMods/CustomServersClient/releases/tag/1.6.0) |
| v1.5.0 | v2021.3.5 | [Reactor BepInEx](https://github.com/NuclearPowered/BepInEx/releases/download/6.0.0-reactor.16/BepInEx-6.0.0-reactor.16.zip) | [Releases](https://github.com/CrowdedMods/CustomServersClient/releases/tag/1.5.0) |
| v1.4.0 | v2020.12.9s | [Reactor BepInEx](https://github.com/NuclearPowered/BepInEx/releases/download/6.0.0-reactor.16/BepInEx-6.0.0-reactor.16.zip) | [Releases](https://github.com/CrowdedMods/CustomServersClient/releases/tag/1.4.0) |
| v1.4.0 | v2020.12.9 | [Reactor BepInEx](https://github.com/NuclearPowered/BepInEx/releases/download/6.0.0-reactor.16/BepInEx-6.0.0-reactor.16.zip) | [Releases](https://github.com/CrowdedMods/CustomServersClient/releases/tag/1.4.0) |
| v1.3.0 | v2020.12.9s | [BepInEx IL2CPP #325](https://builds.bepis.io/projects/bepinex_be/325/BepInEx_UnityIL2CPP_x86_3d75179_6.0.0-be.325.zip) | [Releases](https://github.com/CrowdedMods/CustomServersClient/releases/tag/1.3.0) |
| v1.2.1 | v2020.11.11s and i | [BepInEx IL2CPP #297](https://builds.bepis.io/projects/bepinex_be/297/BepInEx_UnityIL2CPP_x86_7801f9e_6.0.0-be.297.zip) | [Releases](https://github.com/CrowdedMods/CustomServersClient/releases/tag/1.2.1) |
| v1.1.0 | v2020.10.22s | [IL2CPP Public Preview](https://cdn.discordapp.com/attachments/754333645199900723/757332321169834134/BepInEx_IL2CPP_Preview_x86.7z) | [Releases](https://github.com/CrowdedMods/CustomServersClient/releases/tag/1.1.0) |
| v1.0.0 | v2020.09.22s | [IL2CPP Public Preview](https://cdn.discordapp.com/attachments/754333645199900723/757332321169834134/BepInEx_IL2CPP_Preview_x86.7z) | [Releases](https://github.com/CrowdedMods/CustomServersClient/releases/tag/1.0.0) |
*Version v1.4.0 theoretically works with Itch, but wasn't tested.
*Versions v1.4.0+ theoretically work with Itch, but weren't tested.
## Building
1. Install [Reactor](https://docs.reactor.gg/docs/) (Quick Start guide)
2. Open `CustomServersClient.sln` in your favorite IDE
Expand Down

0 comments on commit 53a78b4

Please sign in to comment.