mirror of
https://github.com/NuclearPowered/Reactor.git
synced 2026-10-21 13:37:59 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22550a88ca | ||
|
|
2b98a211bd | ||
|
|
cb799e877e | ||
|
|
fcc8056aaa | ||
|
|
c4a8c8abbe | ||
|
|
7203698222 | ||
|
|
d3fa33aaf0 | ||
|
|
bbcb1abb67 | ||
|
|
9b1211f505 | ||
|
|
e58f8b5aef |
No files matched your search
@@ -44,3 +44,9 @@ jobs:
|
||||
with:
|
||||
name: Reactor.Debugger.dll
|
||||
path: Reactor.Debugger/bin/Release/netstandard2.1/Reactor.Debugger.dll
|
||||
|
||||
- uses: softprops/action-gh-release@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
draft: true
|
||||
files: Reactor/bin/Release/netstandard2.1/Reactor.dll
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<GamePlatform Condition="'$(GamePlatform)' == ''">Steam</GamePlatform>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2022.2.23</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2021.12.15</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Steam'">2022.3.29</GameVersion>
|
||||
<GameVersion Condition="'$(GamePlatform)' == 'Itch'">2022.3.29</GameVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -80,10 +80,11 @@ namespace Reactor.Debugger
|
||||
playerControl.GetComponent<DummyBehaviour>().enabled = true;
|
||||
playerControl.NetTransform.enabled = false;
|
||||
playerControl.SetName($"{TranslationController.Instance.GetString(StringNames.Dummy, Array.Empty<Il2CppSystem.Object>())} {i}");
|
||||
playerControl.SetColor((byte) (i % Palette.PlayerColors.Length));
|
||||
playerControl.SetHat(HatManager.Instance.AllHats.ToArray().ElementAt(i % HatManager.Instance.AllHats.Count).ProdId, playerControl.Data.DefaultOutfit.ColorId);
|
||||
playerControl.SetPet(HatManager.Instance.AllPets.ToArray().ElementAt(i % HatManager.Instance.AllPets.Count).ProdId);
|
||||
playerControl.SetSkin(HatManager.Instance.AllSkins.ToArray().ElementAt(i % HatManager.Instance.AllSkins.Count).ProdId);
|
||||
var color = (byte) (i % Palette.PlayerColors.Length);
|
||||
playerControl.SetColor(color);
|
||||
playerControl.SetHat(HatManager.Instance.allHats[i % HatManager.Instance.allHats.Count].ProdId, playerControl.Data.DefaultOutfit.ColorId);
|
||||
playerControl.SetPet(HatManager.Instance.allPets[i % HatManager.Instance.allPets.Count].ProdId);
|
||||
playerControl.SetSkin(HatManager.Instance.allSkins[i % HatManager.Instance.allSkins.Count].ProdId, color);
|
||||
GameData.Instance.RpcSetTasks(playerControl.PlayerId, new Il2CppStructArray<byte>(0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2022.2.23, )",
|
||||
"resolved": "2022.2.23",
|
||||
"contentHash": "CHMKmYSv00f7bU8pZ/NSfXNSSwKqCtcYyLsBmiFJ8asx+wmLKXHPsUbB9l+Ew2ZdisTt8lU+bQm2jznyWaMtdw=="
|
||||
"requested": "[2022.3.29, )",
|
||||
"resolved": "2022.3.29",
|
||||
"contentHash": "EStKwHGq8MMvSRxIHjlh31VJmCZrGHZ/xoDDN33L5gh7XJLWBFufo6+5ueezndSRpanoCkqLwuTkG73KCS2J1A=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2022.2.23, )",
|
||||
"resolved": "2022.2.23",
|
||||
"contentHash": "CHMKmYSv00f7bU8pZ/NSfXNSSwKqCtcYyLsBmiFJ8asx+wmLKXHPsUbB9l+Ew2ZdisTt8lU+bQm2jznyWaMtdw=="
|
||||
"requested": "[2022.3.29, )",
|
||||
"resolved": "2022.3.29",
|
||||
"contentHash": "EStKwHGq8MMvSRxIHjlh31VJmCZrGHZ/xoDDN33L5gh7XJLWBFufo6+5ueezndSRpanoCkqLwuTkG73KCS2J1A=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
|
||||
@@ -32,14 +32,14 @@ namespace Reactor
|
||||
}
|
||||
|
||||
public static implicit operator StringNames(CustomStringName name) => (StringNames) name.Id;
|
||||
public static explicit operator CustomStringName(StringNames name) => List.SingleOrDefault(x => x.Id == (int) name);
|
||||
public static explicit operator CustomStringName?(StringNames name) => List.SingleOrDefault(x => x.Id == (int) name);
|
||||
|
||||
[HarmonyPatch(typeof(LanguageUnit), nameof(LanguageUnit.GetString), typeof(StringNames), typeof(string), typeof(Il2CppReferenceArray<Il2CppSystem.Object>))]
|
||||
[HarmonyPatch(typeof(TranslationController), nameof(TranslationController.GetString), typeof(StringNames), typeof(Il2CppReferenceArray<Il2CppSystem.Object>))]
|
||||
private static class GetStringPatch
|
||||
{
|
||||
public static bool Prefix(StringNames stringId, Il2CppReferenceArray<Il2CppSystem.Object> parts, ref string __result)
|
||||
public static bool Prefix(StringNames id, Il2CppReferenceArray<Il2CppSystem.Object> parts, ref string __result)
|
||||
{
|
||||
var customStringName = (CustomStringName) stringId;
|
||||
var customStringName = (CustomStringName?) id;
|
||||
|
||||
if (customStringName != null)
|
||||
{
|
||||
|
||||
@@ -154,6 +154,15 @@ namespace Reactor.Networking.Patches
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.GetConnectionData))]
|
||||
public static class HandshakePatch
|
||||
{
|
||||
public static void Prefix(ref bool useDtlsLayout)
|
||||
{
|
||||
// Due to reasons currently unknown, the useDtlsLayout parameter sometimes doesn't reflect whether DTLS
|
||||
// is actually supposed to be enabled. This causes a bad handshake message and a quick disconnect.
|
||||
// The field on AmongUsClient appears to be more reliable, so override this parameter with what it is supposed to be.
|
||||
Logger<ReactorPlugin>.Info($"Currently using dtls: {useDtlsLayout}. Should use dtls: {AmongUsClient.Instance.useDtls}");
|
||||
useDtlsLayout = AmongUsClient.Instance.useDtls;
|
||||
}
|
||||
|
||||
public static void Postfix(ref Il2CppStructArray<byte> __result)
|
||||
{
|
||||
ModList.Update();
|
||||
|
||||
@@ -1,52 +1,17 @@
|
||||
using HarmonyLib;
|
||||
using Hazel.Udp;
|
||||
using Il2CppSystem.Net;
|
||||
using InnerNet;
|
||||
|
||||
namespace Reactor.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal static class CustomServersPatch
|
||||
{
|
||||
/// <summary>
|
||||
/// Send the account id only to Among Us official servers
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.GetConnectionData))]
|
||||
public static class DontSendAccountIdPatch
|
||||
[HarmonyPatch(typeof(AuthManager._CoConnect_d__4), nameof(AuthManager._CoConnect_d__4.MoveNext))]
|
||||
[HarmonyPatch(typeof(AuthManager._CoWaitForNonce_d__6), nameof(AuthManager._CoWaitForNonce_d__6.MoveNext))]
|
||||
[HarmonyPrefix]
|
||||
public static bool DisableAuthServerPatch(out bool __result)
|
||||
{
|
||||
public static void Prefix(ref bool useDtlsLayout)
|
||||
{
|
||||
if (AmongUsClient.Instance.GameMode != GameModes.OnlineGame)
|
||||
{
|
||||
useDtlsLayout = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var serverManager = ServerManager.Instance;
|
||||
if (!serverManager || serverManager.CurrentRegion?.TryCast<DnsRegionInfo>() is not { } regionInfo || !regionInfo.Fqdn.EndsWith("among.us"))
|
||||
{
|
||||
useDtlsLayout = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encrypt connection only to Among Us official servers
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(AuthManager), nameof(AuthManager.CreateDtlsConnection))]
|
||||
public static class DontEncryptCustomServersPatch
|
||||
{
|
||||
public static bool Prefix(ref UnityUdpClientConnection __result, string targetIp, ushort targetPort)
|
||||
{
|
||||
var serverManager = ServerManager.Instance;
|
||||
if (serverManager.CurrentRegion.TryCast<DnsRegionInfo>() is not { } regionInfo || !regionInfo.Fqdn.EndsWith("among.us"))
|
||||
{
|
||||
var remoteEndPoint = new IPEndPoint(IPAddress.Parse(targetIp), targetPort - 3);
|
||||
__result = new UnityUdpClientConnection(null, remoteEndPoint);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
__result = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,12 +57,25 @@ namespace Reactor.Patches
|
||||
[HarmonyPatch(typeof(FileIO), nameof(FileIO.WriteAllText))]
|
||||
private static class WritePatch
|
||||
{
|
||||
public static void Prefix(string path)
|
||||
public static bool Prefix(string path, string contents)
|
||||
{
|
||||
// Among Us' region loading code unfortunately contains a call
|
||||
// to SaveServers, which will write out the region file. This
|
||||
// will lead to a positive feedback loop when detecting writes,
|
||||
// which is undesireable. So we check if the write makes a
|
||||
// change to the file on disk and if it would write the same
|
||||
// file again, stop AU from actually writing it.
|
||||
if (ServerManager.Instance && path == ServerManager.Instance.serverInfoFileJson)
|
||||
{
|
||||
PluginSingleton<ReactorPlugin>.Instance.RegionInfoWatcher.IgnoreNext = true;
|
||||
var currentContents = FileIO.ReadAllText(path);
|
||||
var continueWrite = currentContents != contents;
|
||||
Logger<ReactorPlugin>.Debug($"Continue serverInfoFile write? {continueWrite}");
|
||||
// If we will write, ignore the next change action from the observer.
|
||||
PluginSingleton<ReactorPlugin>.Instance.RegionInfoWatcher.IgnoreNext = continueWrite;
|
||||
return continueWrite;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
using System;
|
||||
using UnityEngine.SceneManagement;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace Reactor.Patches
|
||||
{
|
||||
[HarmonyPatch(typeof(SplashManager), nameof(SplashManager.Start))]
|
||||
internal static class SplashSkip
|
||||
{
|
||||
internal static void Initialize()
|
||||
private static void Prefix(SplashManager __instance)
|
||||
{
|
||||
SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>) ((scene, _) =>
|
||||
{
|
||||
if (scene.name == "SplashIntro")
|
||||
{
|
||||
SceneManager.LoadScene("MainMenu");
|
||||
}
|
||||
}));
|
||||
__instance.minimumSecondsBeforeSceneChange = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
||||
<VersionPrefix>1.2.2</VersionPrefix>
|
||||
<VersionPrefix>1.2.6</VersionPrefix>
|
||||
<VersionSuffix>dev</VersionSuffix>
|
||||
<Description>Core mod and API for Among Us</Description>
|
||||
<Authors>NuclearPowered</Authors>
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace Reactor
|
||||
|
||||
ReactorVersionShower.Initialize();
|
||||
FreeNamePatch.Initialize();
|
||||
SplashSkip.Initialize();
|
||||
DefaultBundle.Load();
|
||||
|
||||
SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>) ((scene, _) =>
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
".NETStandard,Version=v2.1": {
|
||||
"AmongUs.GameLibs.Steam": {
|
||||
"type": "Direct",
|
||||
"requested": "[2022.2.23, )",
|
||||
"resolved": "2022.2.23",
|
||||
"contentHash": "CHMKmYSv00f7bU8pZ/NSfXNSSwKqCtcYyLsBmiFJ8asx+wmLKXHPsUbB9l+Ew2ZdisTt8lU+bQm2jznyWaMtdw=="
|
||||
"requested": "[2022.3.29, )",
|
||||
"resolved": "2022.3.29",
|
||||
"contentHash": "EStKwHGq8MMvSRxIHjlh31VJmCZrGHZ/xoDDN33L5gh7XJLWBFufo6+5ueezndSRpanoCkqLwuTkG73KCS2J1A=="
|
||||
},
|
||||
"BepInEx.AutoPlugin": {
|
||||
"type": "Direct",
|
||||
|
||||
Reference in new issue
Block a user