From bf574ddc2e105f6336700b553977fc4f3db848d8 Mon Sep 17 00:00:00 2001 From: data-bomb Date: Thu, 11 Jul 2024 18:03:53 -0700 Subject: [PATCH] v0.8.64 Silica Admin Mod Patches --- Si_AdminMod/Event_Roles.cs | 28 ++++++++++++++-------------- Si_AdminMod/ModAttributes.cs | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Si_AdminMod/Event_Roles.cs b/Si_AdminMod/Event_Roles.cs index 23f9884..80c005f 100644 --- a/Si_AdminMod/Event_Roles.cs +++ b/Si_AdminMod/Event_Roles.cs @@ -55,13 +55,13 @@ public static bool Prefix(MP_Strategy __instance, ref GameByteStreamReader __0, } // only look at RPC_RequestRole - if (__1 != (byte)MP_Strategy.ERPCs.REQUEST_ROLE) + if (__1 != (byte)GameModeExt.ERPCs.REQUEST_ROLE) { return true; } Player requestingPlayer = Player.FindPlayer((CSteamID)__0.ReadUInt64(), (int)__0.ReadByte()); - MP_Strategy.ETeamRole eRole = (MP_Strategy.ETeamRole)__0.ReadByte(); + GameModeExt.ETeamRole eRole = (GameModeExt.ETeamRole)__0.ReadByte(); if (requestingPlayer == null) { @@ -70,15 +70,15 @@ public static bool Prefix(MP_Strategy __instance, ref GameByteStreamReader __0, } // would the game code treat it as an infantry/no role request? - if (eRole != MP_Strategy.ETeamRole.COMMANDER || __instance.GetCommanderForTeam(requestingPlayer.Team)) + if (eRole != GameModeExt.ETeamRole.COMMANDER || __instance.GetCommanderForTeam(requestingPlayer.Team)) { __0 = RestoreRPC_RequestRoleReader(requestingPlayer, eRole); FireOnRoleChangedEvent(requestingPlayer, eRole); return true; } - StrategyTeamSetup strategyTeamSetup = __instance.GetStrategyTeamSetup(requestingPlayer.Team); - if (strategyTeamSetup == null) + BaseTeamSetup baseTeamSetup = __instance.GetTeamSetup(requestingPlayer.Team); + if (baseTeamSetup == null) { return false; } @@ -92,7 +92,7 @@ public static bool Prefix(MP_Strategy __instance, ref GameByteStreamReader __0, { MelonLogger.Msg("Preventing Spawn"); __instance.SpawnUnitForPlayer(requestingPlayer, requestingPlayer.Team); - FireOnRoleChangedEvent(requestingPlayer, MP_Strategy.ETeamRole.INFANTRY); + FireOnRoleChangedEvent(requestingPlayer, GameModeExt.ETeamRole.INFANTRY); } return false; @@ -100,18 +100,18 @@ public static bool Prefix(MP_Strategy __instance, ref GameByteStreamReader __0, MelonLogger.Msg("Allowing to join commander"); #if NET6_0 - __instance.SetCommander(strategyTeamSetup.Team, requestingPlayer); - __instance.RPC_SynchCommander(strategyTeamSetup.Team); + __instance.SetCommander(baseTeamSetup.Team, requestingPlayer); + __instance.RPC_SynchCommander(baseTeamSetup.Team); #else Type strategyType = typeof(MP_Strategy); MethodInfo setCommanderMethod = strategyType.GetMethod("SetCommander", BindingFlags.Instance | BindingFlags.NonPublic); - setCommanderMethod.Invoke(__instance, parameters: new object?[] { strategyTeamSetup.Team, requestingPlayer }); + setCommanderMethod.Invoke(__instance, parameters: new object?[] { baseTeamSetup.Team, requestingPlayer }); MethodInfo synchCommanderMethod = strategyType.GetMethod("RPC_SynchCommander", BindingFlags.Instance | BindingFlags.NonPublic); - synchCommanderMethod.Invoke(__instance, new object[] { strategyTeamSetup.Team }); + synchCommanderMethod.Invoke(__instance, new object[] { baseTeamSetup.Team }); #endif - FireOnRoleChangedEvent(requestingPlayer, MP_Strategy.ETeamRole.COMMANDER); + FireOnRoleChangedEvent(requestingPlayer, GameModeExt.ETeamRole.COMMANDER); return false; } @@ -124,12 +124,12 @@ public static bool Prefix(MP_Strategy __instance, ref GameByteStreamReader __0, } } - public static GameByteStreamReader RestoreRPC_RequestRoleReader(Player requestingPlayer, MP_Strategy.ETeamRole role) + public static GameByteStreamReader RestoreRPC_RequestRoleReader(Player requestingPlayer, GameModeExt.ETeamRole role) { GameByteStreamWriter gameByteStreamWriter = GameByteStreamWriter.GetGameByteStreamWriter(0U, "Si_AdminMod::RestoreRPC_RequestRoleReader", true); gameByteStreamWriter.WriteByte((byte)ENetworkPacketType.GameModeRPC); gameByteStreamWriter.WriteByte(0); - gameByteStreamWriter.WriteByte((byte)MP_Strategy.ERPCs.REQUEST_ROLE); + gameByteStreamWriter.WriteByte((byte)GameModeExt.ERPCs.REQUEST_ROLE); gameByteStreamWriter.WriteUInt64((ulong)requestingPlayer.PlayerID); gameByteStreamWriter.WriteByte((byte)requestingPlayer.PlayerChannel); gameByteStreamWriter.WriteByte((byte)role); @@ -140,7 +140,7 @@ public static GameByteStreamReader RestoreRPC_RequestRoleReader(Player requestin return gameByteStreamReader; } - public static void FireOnRoleChangedEvent(Player player, MP_Strategy.ETeamRole role) + public static void FireOnRoleChangedEvent(Player player, GameModeExt.ETeamRole role) { MelonLogger.Msg("Firing Role Change Event for " + player.PlayerName + " to role " + role.ToString()); diff --git a/Si_AdminMod/ModAttributes.cs b/Si_AdminMod/ModAttributes.cs index 8764c17..7f955eb 100644 --- a/Si_AdminMod/ModAttributes.cs +++ b/Si_AdminMod/ModAttributes.cs @@ -21,7 +21,7 @@ You should have received a copy of the GNU General Public License using SilicaAdminMod; using System.Drawing; -[assembly: MelonInfo(typeof(SiAdminMod), "Admin Mod", "2.0.873", "databomb", "https://github.com/data-bomb/Silica")] +[assembly: MelonInfo(typeof(SiAdminMod), "Admin Mod", "2.0.878", "databomb", "https://github.com/data-bomb/Silica")] [assembly: MelonGame("Bohemia Interactive", "Silica")] // Color.Cyan