mirror of
https://github.com/Gurge44/EndlessHostRoles.git
synced 2026-11-19 13:16:56 +00:00
Disable handshake patches if Reactor is present (#586)
* Change unload to deactivate only current plugin * only replicate handshake if reactor is not present * prevent server authority incompatibility
This commit is contained in:
1 parent
cc49983601
commit
08fe4d01cf
4 files changed
+29
-16
No files matched your search
@@ -270,6 +270,7 @@ public enum CustomRoles
|
||||
Spy,
|
||||
SuperStar,
|
||||
Swapper,
|
||||
Tar,
|
||||
TaskManager,
|
||||
Telekinetic,
|
||||
Tether,
|
||||
@@ -529,8 +530,8 @@ public enum CustomRoles
|
||||
Commited,
|
||||
Compelled,
|
||||
Composter,
|
||||
Concealer,
|
||||
Constricted,
|
||||
Concealer,
|
||||
Contagious,
|
||||
Damocles,
|
||||
Deadlined,
|
||||
@@ -610,6 +611,7 @@ public enum CustomRoles
|
||||
Undead,
|
||||
Underdog,
|
||||
Unlucky,
|
||||
Urgent,
|
||||
Venom,
|
||||
Warden, // Ghost role
|
||||
Watcher,
|
||||
|
||||
@@ -173,6 +173,8 @@ public class Main : BasePlugin
|
||||
private static readonly List<string> NameSnacksEn = ["Ice cream", "Milk tea", "Chocolate", "Cake", "Donut", "Coke", "Lemonade", "Candied haws", "Jelly", "Candy", "Milk", "Matcha", "Burning Grass Jelly", "Pineapple Bun", "Pudding", "Coconut Jelly", "Cookies", "Red Bean Toast", "Three Color Dumplings", "Wormwood Dumplings", "Puffs", "Can be Crepe", "Peach Crisp", "Mochi", "Egg Waffle", "Macaron", "Snow Plum Niang", "Fried Yogurt", "Egg Tart", "Muffin", "Sago Dew", "panna cotta", "soufflé", "croissant", "toffee"];
|
||||
private Coroutines coroutines;
|
||||
|
||||
public static bool HasReactorPlugin;
|
||||
|
||||
private static HashAuth DebugKeyAuth { get; set; }
|
||||
private static ConfigEntry<string> DebugKeyInput { get; set; }
|
||||
|
||||
@@ -304,6 +306,8 @@ public class Main : BasePlugin
|
||||
ShowClientControlGUI = Config.Bind("Client Options", "ShowClientControlGUI", true);
|
||||
UIScaleFactor = Config.Bind("Client Options", "UIScaleFactor", 1f);
|
||||
|
||||
HasReactorPlugin = IL2CPPChainloader.Instance.Plugins.ContainsKey("gg.reactor.api");
|
||||
|
||||
AddComponent<ClientControlGUI>();
|
||||
Log.LogInfo("ClientControlGUI registered");
|
||||
|
||||
|
||||
+17
-14
@@ -78,23 +78,26 @@ public static class HandshakePatch
|
||||
|
||||
public static void Postfix(ref Il2CppStructArray<byte> __result)
|
||||
{
|
||||
var handshake = new MessageWriter(1000);
|
||||
if (!Main.HasReactorPlugin)
|
||||
{
|
||||
var handshake = new MessageWriter(1000);
|
||||
|
||||
// Original data
|
||||
handshake.Write(__result);
|
||||
// Original data
|
||||
handshake.Write(__result);
|
||||
|
||||
// Reactor Header
|
||||
const byte version = (byte)ReactorProtocolVersion.Latest;
|
||||
const ulong value = (MAGIC << 8) | version;
|
||||
handshake.Write(value);
|
||||
// Reactor Header
|
||||
const byte version = (byte)ReactorProtocolVersion.Latest;
|
||||
const ulong value = (MAGIC << 8) | version;
|
||||
handshake.Write(value);
|
||||
|
||||
// ModdedHandshakeC2S
|
||||
handshake.WritePacked(1);
|
||||
handshake.Write(Main.PluginGuid);
|
||||
handshake.Write(Main.PluginVersion);
|
||||
handshake.Write((ushort)(ModFlags.RequireOnHost | ModFlags.DisableServerAuthority));
|
||||
// ModdedHandshakeC2S
|
||||
handshake.WritePacked(1);
|
||||
handshake.Write(Main.PluginGuid);
|
||||
handshake.Write(Main.PluginVersion);
|
||||
handshake.Write((ushort)(ModFlags.RequireOnHost | ModFlags.DisableServerAuthority));
|
||||
|
||||
__result = handshake.ToByteArray(true);
|
||||
handshake.Recycle();
|
||||
__result = handshake.ToByteArray(true);
|
||||
handshake.Recycle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,11 @@ internal static class ServerUpdatePatch
|
||||
if (GameStates.IsOnlineGame)
|
||||
{
|
||||
// Changing server version for AU mods
|
||||
__result += 25;
|
||||
var revision = __result % 50;
|
||||
if (revision < 25)
|
||||
{
|
||||
__result += 25;
|
||||
}
|
||||
Logger.Info($"IsOnlineGame: {__result}", "VersionServer");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user