mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-10-20 01:46:25 +00:00
1 parent
e7b95537a5
commit
568f1fa253
8 files changed
+36
-88
No files matched your search
+1
-1
@@ -33,7 +33,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2026.3.31" PrivateAssets="all" Condition="'$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug'" />
|
||||
<PackageReference Include="AmongUs.GameLibs.Steam" Version="2026.3.31" PrivateAssets="all" Condition="'$(Configuration)' == 'Release' Or '$(Configuration)' == 'Debug'" />
|
||||
<PackageReference Include="AmongUs.GameLibs.Android" Version="2025.10.14" PrivateAssets="all" Condition="'$(Configuration)' == 'Android'"/>
|
||||
<PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1"/>
|
||||
<PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.735" Private="false" ExcludeAssets="runtime;native"/>
|
||||
|
||||
@@ -126,10 +126,10 @@ public static class AntiBlackout
|
||||
else
|
||||
{
|
||||
if (pc.AmOwner && Utils.TempReviveHostRunning) continue;
|
||||
|
||||
|
||||
// Ensure that the players who are considered dead by the mod are actually dead in the game.
|
||||
pc.RpcSetRoleGlobal(pc.GetGhostRoleBasis());
|
||||
|
||||
pc.RpcExiled();
|
||||
|
||||
if (GhostRolesManager.AssignedGhostRoles.TryGetValue(pc.PlayerId, out var ghostRole) && ghostRole.Instance.RoleTypes == RoleTypes.GuardianAngel)
|
||||
pc.RpcResetAbilityCooldown();
|
||||
}
|
||||
|
||||
@@ -708,13 +708,17 @@ public static class CustomRpcSenderExtensions
|
||||
newSender = sender;
|
||||
return hasValue;
|
||||
}
|
||||
|
||||
public static bool RpcExileV2(this CustomRpcSender sender, PlayerControl player)
|
||||
public static bool RpcExiled(this CustomRpcSender sender, PlayerControl target, bool autoStartRpc = true, int targetClientId = -1, bool exileForHost = true)
|
||||
{
|
||||
player.Exiled();
|
||||
sender.AutoStartRpc(player.NetId, RpcCalls.Exiled);
|
||||
sender.EndRpc();
|
||||
FixedUpdatePatch.LoversSuicide(player.PlayerId);
|
||||
if (exileForHost) target.Exiled();
|
||||
if (autoStartRpc) sender.AutoStartRpc(target.NetId, RpcCalls.Exiled, targetClientId).EndRpc();
|
||||
else sender.StartRpc(target.NetId, RpcCalls.Exiled).EndRpc();
|
||||
return true;
|
||||
}
|
||||
public static bool RpcExileV2(this CustomRpcSender sender, PlayerControl target, bool autoStartRpc = true, int targetClientId = -1, bool exileForHost = true)
|
||||
{
|
||||
sender.RpcExiled(target, autoStartRpc, targetClientId, exileForHost);
|
||||
FixedUpdatePatch.LoversSuicide(target.PlayerId);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1723,10 +1723,7 @@ internal static class ExtendedPlayerControl
|
||||
|
||||
var sender = CustomRpcSender.Create("RpcResetInvisibility", SendOption.Reliable);
|
||||
sender.StartMessage(pc.OwnerId);
|
||||
sender.StartRpc(player.NetId, RpcCalls.SetRole)
|
||||
.Write((ushort)player.GetGhostRoleBasis())
|
||||
.Write(true)
|
||||
.EndRpc();
|
||||
sender.RpcExiled(player, autoStartRpc: false, exileForHost: false);
|
||||
RoleTypes role = Utils.GetRoleMap(pc.PlayerId, player.PlayerId).RoleType;
|
||||
sender.StartRpc(player.NetId, RpcCalls.SetRole)
|
||||
.Write((ushort)role)
|
||||
@@ -1969,11 +1966,15 @@ internal static class ExtendedPlayerControl
|
||||
return count.Item1 >= count.Item2;
|
||||
}
|
||||
|
||||
public static void RpcExileV2(this PlayerControl player)
|
||||
public static void RpcExiled(this PlayerControl player)
|
||||
{
|
||||
player.Exiled();
|
||||
MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(player.NetId, (byte)RpcCalls.Exiled, SendOption.Reliable);
|
||||
AmongUsClient.Instance.FinishRpcImmediately(writer);
|
||||
}
|
||||
public static void RpcExileV2(this PlayerControl player)
|
||||
{
|
||||
player.RpcExiled();
|
||||
FixedUpdatePatch.LoversSuicide(player.PlayerId);
|
||||
}
|
||||
|
||||
|
||||
+13
-11
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using AmongUs.Data;
|
||||
using EHR.Modules;
|
||||
using HarmonyLib;
|
||||
using Il2CppInterop.Runtime.InteropTypes;
|
||||
using InnerNet;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using static EHR.Translator;
|
||||
@@ -169,17 +169,19 @@ static class CheckOnlinePermissionsPatch
|
||||
[HarmonyPatch]
|
||||
internal static class AuthTimeoutPatch
|
||||
{
|
||||
[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]
|
||||
// From Reactor.gg
|
||||
// https://github.com/NuclearPowered/Reactor/blob/master/Reactor/Patches/Miscellaneous/CustomServersPatch.cs
|
||||
public static bool CoWaitforNoncePrefix(ref bool __result)
|
||||
[HarmonyPatch(typeof(AuthManager), nameof(AuthManager.CoConnect))]
|
||||
[HarmonyPrefix]
|
||||
public static bool CoConnect_Prefix()
|
||||
{
|
||||
if (GameStates.CurrentServerType is GameStates.ServerType.Vanilla or GameStates.ServerType.Local) return true;
|
||||
|
||||
__result = false;
|
||||
return false;
|
||||
return GameStates.CurrentServerType is GameStates.ServerType.Vanilla or GameStates.ServerType.Local;
|
||||
}
|
||||
[HarmonyPatch(typeof(AuthManager), nameof(AuthManager.CoWaitForNonce))]
|
||||
[HarmonyPrefix]
|
||||
public static bool CoWaitforNonce_Prefix()
|
||||
{
|
||||
return GameStates.CurrentServerType is GameStates.ServerType.Vanilla or GameStates.ServerType.Local;
|
||||
}
|
||||
|
||||
// If you don't patch this, you still need to wait for 5 s.
|
||||
|
||||
@@ -45,40 +45,6 @@ internal static class AllMapIconsPatch
|
||||
catch (Exception e) { Utils.ThrowException(e); }
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AmongUsClient._CoStartGameHost_d__28), nameof(AmongUsClient._CoStartGameHost_d__28.MoveNext))]
|
||||
public static class DleksPatch
|
||||
{
|
||||
public static bool Prepare()
|
||||
{
|
||||
return !OperatingSystem.IsAndroid();
|
||||
}
|
||||
|
||||
public static bool Prefix(AmongUsClient._CoStartGameHost_d__28 __instance, ref bool __result)
|
||||
{
|
||||
if (__instance.__1__state != 0) return true;
|
||||
|
||||
__instance.__1__state = -1;
|
||||
if (LobbyBehaviour.Instance) LobbyBehaviour.Instance.Despawn();
|
||||
|
||||
if (ShipStatus.Instance)
|
||||
{
|
||||
__instance.__2__current = null;
|
||||
__instance.__1__state = 2;
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// removed dleks check as it's always false
|
||||
int num2 = GameOptionsManager.Instance.CurrentGameOptions.MapId == 6 && SubmergedCompatibility.Loaded ? 6 : Mathf.Clamp(GameOptionsManager.Instance.CurrentGameOptions.MapId, 0, Constants.MapNames.Length - 1);
|
||||
__instance.__2__current = __instance.__4__this.ShipLoadingAsyncHandle = __instance.__4__this.ShipPrefabs[num2].InstantiateAsync();
|
||||
__instance.__1__state = 1;
|
||||
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(StringOption), nameof(StringOption.Start))]
|
||||
public static class AutoselectDleksPatch
|
||||
{
|
||||
|
||||
+1
-23
@@ -220,33 +220,11 @@ internal static class ExileControllerWrapUpPatch
|
||||
[HarmonyPatch(typeof(AirshipExileController), nameof(AirshipExileController.WrapUpAndSpawn))]
|
||||
private static class AirshipExileControllerPatchAndroid
|
||||
{
|
||||
public static bool Prepare()
|
||||
{
|
||||
return OperatingSystem.IsAndroid();
|
||||
}
|
||||
|
||||
public static void Postfix(AirshipExileController __instance)
|
||||
{
|
||||
try { WrapUpPostfix(__instance.initData.networkedPlayer); }
|
||||
finally { WrapUpFinalizer(); }
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AirshipExileController._WrapUpAndSpawn_d__11), nameof(AirshipExileController._WrapUpAndSpawn_d__11.MoveNext))]
|
||||
private static class AirshipExileControllerPatch
|
||||
{
|
||||
public static bool Prepare()
|
||||
{
|
||||
return !OperatingSystem.IsAndroid();
|
||||
}
|
||||
|
||||
public static void Postfix(AirshipExileController._WrapUpAndSpawn_d__11 __instance, ref bool __result)
|
||||
{
|
||||
if (Main.LIMap) return;
|
||||
|
||||
if (__result) return;
|
||||
|
||||
try { WrapUpPostfix(__instance.__4__this.initData.networkedPlayer); }
|
||||
try { WrapUpPostfix(__instance.initData.networkedPlayer); }
|
||||
finally { WrapUpFinalizer(); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ public class SoulCollector : RoleBase
|
||||
{
|
||||
|
||||
var sender = CustomRpcSender.Create("SoulCollector Kill: Target", SendOption.Reliable);
|
||||
sender.RpcSetRole(target, target.GetGhostRoleBasis(), target.OwnerId);
|
||||
sender.RpcExiled(target, targetClientId: target.OwnerId, exileForHost: false);
|
||||
sender.SendMessage();
|
||||
}
|
||||
|
||||
@@ -113,10 +113,7 @@ public class SoulCollector : RoleBase
|
||||
toExile.ForEach(x =>
|
||||
{
|
||||
Main.AllPlayerSpeed[x.PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod);
|
||||
sender.StartRpc(x.NetId, RpcCalls.SetRole)
|
||||
.Write((ushort)x.GetGhostRoleBasis())
|
||||
.Write(true)
|
||||
.EndRpc();
|
||||
sender.RpcExiled(x, autoStartRpc: false);
|
||||
});
|
||||
sender.SendMessage();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user