Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MythicMoons v1.1.0
BepInEx/plugins/mythicmoons/LethalCompanySeichiItems.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanySeichiItems.Kanabo; using LethalCompanySeichiItems.NetcodePatcher; using LethalCompanySeichiItems.Uchiwa; using Microsoft.CodeAnalysis; using Unity.Collections; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("Louis")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Lethal Company Seichi Items")] [assembly: AssemblyFileVersion("3.1.8.0")] [assembly: AssemblyInformationalVersion("3.1.8+a61d759969d5f1c32e1471fb6c37a67a05e01afa")] [assembly: AssemblyProduct("LethalCompanySeichiItems")] [assembly: AssemblyTitle("LethalCompanySeichiItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.1.8.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>(); NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LethalCompanySeichiItems { [BepInPlugin("LethalCompanySeichiItems", "LethalCompanySeichiItems", "3.1.8")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SeichiItemsPlugin : BaseUnityPlugin { internal enum LogLevel { Debug, Info, Warning, Error } public const string ModGuid = "LCM_SeichiItems|3.1.8"; private const string ModName = "Lethal Company Seichi Items Mod"; private const string ModVersion = "3.1.8"; private readonly Harmony _harmony = new Harmony("LCM_SeichiItems|3.1.8"); private static SeichiItemsPlugin _instance; private static readonly ManualLogSource Mls = new ManualLogSource("LCM_SeichiItems|3.1.8"); public static UchiwaConfig UchiwaConfigInstance { get; internal set; } public static KanaboConfig KanaboConfigInstance { get; internal set; } private void Awake() { if ((Object)(object)_instance == (Object)null) { _instance = this; } _harmony.PatchAll(); UchiwaConfigInstance = new UchiwaConfig(((BaseUnityPlugin)this).Config); KanaboConfigInstance = new KanaboConfig(((BaseUnityPlugin)this).Config); _harmony.PatchAll(); _harmony.PatchAll(typeof(SeichiItemsPlugin)); InitializeNetworkStuff(); } internal static void Log(string msg, string prefix = "", LogLevel logLevel = LogLevel.Debug) { msg = prefix + "|" + msg; switch (logLevel) { case LogLevel.Debug: Mls.LogDebug((object)msg); break; case LogLevel.Info: Mls.LogInfo((object)msg); break; case LogLevel.Warning: Mls.LogWarning((object)msg); break; case LogLevel.Error: Mls.LogError((object)msg); break; default: throw new ArgumentOutOfRangeException("logLevel", logLevel, null); } } internal static void ChangeNetworkVar<T>(NetworkVariable<T> networkVariable, T newValue) where T : IEquatable<T> { if (!EqualityComparer<T>.Default.Equals(networkVariable.Value, newValue)) { networkVariable.Value = newValue; } } private static void InitializeNetworkStuff() { IEnumerable<Type> enumerable; try { enumerable = Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException ex) { enumerable = ex.Types.Where((Type t) => t != null); } foreach (Type item in enumerable) { MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } [Serializable] public class SyncedInstance<T> { [CompilerGenerated] private static class <>O { public static HandleNamedMessageDelegate <0>__OnRequestSync; public static HandleNamedMessageDelegate <1>__OnReceiveSync; } [NonSerialized] protected static int IntSize = 4; internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager; internal static bool IsClient => NetworkManager.Singleton.IsClient; internal static bool IsHost => NetworkManager.Singleton.IsHost; public static T Default { get; private set; } public static T Instance { get; private set; } public static bool Synced { get; internal set; } protected void InitInstance(T instance) { Default = instance; Instance = instance; IntSize = 4; } internal static void SyncInstance(byte[] data) { Instance = DeserializeFromBytes(data); Synced = true; } internal static void RevertSync() { Instance = Default; Synced = false; } public static byte[] SerializeToBytes(T val) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream memoryStream = new MemoryStream(); try { binaryFormatter.Serialize(memoryStream, val); return memoryStream.ToArray(); } catch (Exception arg) { Debug.LogError((object)$"Error serializing instance: {arg}"); return null; } } public static T DeserializeFromBytes(byte[] data) { BinaryFormatter binaryFormatter = new BinaryFormatter(); using MemoryStream serializationStream = new MemoryStream(data); try { return (T)binaryFormatter.Deserialize(serializationStream); } catch (Exception arg) { Debug.LogError((object)$"Error deserializing instance: {arg}"); return default(T); } } private static void RequestSync() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) if (!IsClient) { return; } FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(IntSize, (Allocator)2, -1); try { MessageManager.SendNamedMessage("LCM_SeichiItems|3.1.8_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private static void OnRequestSync(ulong clientId, FastBufferReader _) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (!IsHost) { return; } Debug.Log((object)$"Config sync request received from client: {clientId}"); byte[] array = SerializeToBytes(Instance); int num = array.Length; FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(num + IntSize, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0); MessageManager.SendNamedMessage("LCM_SeichiItems|3.1.8_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3); } catch (Exception arg) { Debug.Log((object)$"Error occurred syncing config with client: {clientId}\n{arg}"); } finally { ((IDisposable)(FastBufferWriter)(ref val)).Dispose(); } } private static void OnReceiveSync(ulong _, FastBufferReader reader) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (!((FastBufferReader)(ref reader)).TryBeginRead(IntSize)) { Debug.LogError((object)"Config sync error: Could not begin reading buffer."); return; } int num = default(int); ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives)); if (!((FastBufferReader)(ref reader)).TryBeginRead(num)) { Debug.LogError((object)"Config sync error: Host could not sync."); return; } byte[] data = new byte[num]; ((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0); SyncInstance(data); Debug.Log((object)"Successfully synced config with host."); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeLocalPlayer() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown if (IsHost) { CustomMessagingManager messageManager = MessageManager; object obj = <>O.<0>__OnRequestSync; if (obj == null) { HandleNamedMessageDelegate val = OnRequestSync; <>O.<0>__OnRequestSync = val; obj = (object)val; } messageManager.RegisterNamedMessageHandler("LCM_SeichiItems|3.1.8_OnRequestConfigSync", (HandleNamedMessageDelegate)obj); Synced = true; return; } Synced = false; CustomMessagingManager messageManager2 = MessageManager; object obj2 = <>O.<1>__OnReceiveSync; if (obj2 == null) { HandleNamedMessageDelegate val2 = OnReceiveSync; <>O.<1>__OnReceiveSync = val2; obj2 = (object)val2; } messageManager2.RegisterNamedMessageHandler("LCM_SeichiItems|3.1.8_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2); RequestSync(); } [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")] public static void PlayerLeave() { RevertSync(); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalCompanySeichiItems"; public const string PLUGIN_NAME = "LethalCompanySeichiItems"; public const string PLUGIN_VERSION = "3.1.8"; } } namespace LethalCompanySeichiItems.Uchiwa { public class UchiwaConfig : SyncedInstance<UchiwaConfig> { internal readonly ConfigEntry<int> UchiwaHealAmount; public UchiwaConfig(ConfigFile cfg) { InitInstance(this); UchiwaHealAmount = cfg.Bind<int>("Uchiwa", "Player Heal Amount", 5, "The amount of health a player receives when hit with the Uchiwa."); } } public class UchiwaItem : GrabbableObject { private enum AudioClipTypes { Hit, Swing, HitSurface } private const string LOGPrefix = "Uchiwa"; [Tooltip("The amount of healing the Uchiwa does per swing.")] [SerializeField] private int healAmount = 5; [Header("Audio")] [Space(5f)] [SerializeField] private AudioSource uchiwaAudio; public AudioClip[] hitSfx; public AudioClip[] swingSfx; private PlayerControllerB _previousPlayerHeldBy; private List<RaycastHit> _objectsHitByUchiwaList = new List<RaycastHit>(); private RaycastHit[] _objectsHitByUchiwa; private static readonly int UseHeldItem1 = Animator.StringToHash("UseHeldItem1"); private const int KnifeMask = 11012424; private float _timeAtLastDamageDealt; public override void Start() { ((GrabbableObject)this).Start(); healAmount = Mathf.Clamp(SyncedInstance<UchiwaConfig>.Instance.UchiwaHealAmount.Value, 0, int.MaxValue); } public override void ItemActivate(bool used, bool buttonDown = true) { if (!((Object)(object)base.playerHeldBy == (Object)null)) { _previousPlayerHeldBy = base.playerHeldBy; if (((NetworkBehaviour)base.playerHeldBy).IsOwner) { base.playerHeldBy.playerBodyAnimator.SetTrigger(UseHeldItem1); } if (((NetworkBehaviour)this).IsOwner) { PlayAudioClipTypeServerRpc(AudioClipTypes.Swing); HitUchiwa(); } } } private void HitUchiwa(bool cancel = false) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_previousPlayerHeldBy == (Object)null) { SeichiItemsPlugin.Log("Variable '_previousPlayerHeldBy' is null on this client when HitUchiwa is called.", "Uchiwa", SeichiItemsPlugin.LogLevel.Error); return; } _previousPlayerHeldBy.activatingItem = false; bool flag = false; bool flag2 = false; int num = -1; if (!cancel) { _previousPlayerHeldBy.twoHanded = false; _objectsHitByUchiwa = Physics.SphereCastAll(((Component)_previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)_previousPlayerHeldBy.gameplayCamera).transform.right * 0.1f, 0.3f, ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward, 0.75f, 11012424, (QueryTriggerInteraction)2); _objectsHitByUchiwaList = _objectsHitByUchiwa.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); IHittable val2 = default(IHittable); foreach (RaycastHit objectsHitByUchiwa in _objectsHitByUchiwaList) { RaycastHit val = objectsHitByUchiwa; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8 && ((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = objectsHitByUchiwa; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { continue; } val = objectsHitByUchiwa; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)_previousPlayerHeldBy).transform) { continue; } val = objectsHitByUchiwa; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.position; val = objectsHitByUchiwa; Vector3 point = ((RaycastHit)(ref val)).point; RaycastHit val3 = default(RaycastHit); int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; if (Physics.Linecast(position, point, ref val3, collidersAndRoomMaskAndDefault)) { continue; } } flag = true; Vector3 forward = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward; try { if ((double)Time.realtimeSinceStartup - (double)_timeAtLastDamageDealt > 0.4300000071525574) { _timeAtLastDamageDealt = Time.realtimeSinceStartup; flag2 = true; PlayerControllerB val4 = (PlayerControllerB)(object)((val2 is PlayerControllerB) ? val2 : null); if (val4 != null) { HealPlayerServerRpc(val4.actualClientId); } else { val2.Hit(0, forward, _previousPlayerHeldBy, true, 5); } } } catch (Exception arg) { SeichiItemsPlugin.Log($"Exception when hitting object with uchiwa from player #{_previousPlayerHeldBy.playerClientId}: {arg}", "Uchiwa", SeichiItemsPlugin.LogLevel.Error); } continue; } flag = true; val = objectsHitByUchiwa; for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++) { if (!(StartOfRound.Instance.footstepSurfaces[i].surfaceTag != ((Component)((RaycastHit)(ref val)).collider).gameObject.tag)) { num = i; break; } } } } if (flag) { PlayAudioClipTypeServerRpc(AudioClipTypes.Hit); if (!flag2 && num != -1) { PlayAudioClipTypeClientRpc(AudioClipTypes.HitSurface, num); } } } [ServerRpc(RequireOwnership = false)] private void HealPlayerServerRpc(ulong playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2944637045u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2944637045u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { PlayerControllerB val3; try { val3 = StartOfRound.Instance.allPlayerScripts[playerId]; } catch (IndexOutOfRangeException) { SeichiItemsPlugin.Log($"Tried to heal player with ID: {playerId}, but such player does not exist.", "Uchiwa", SeichiItemsPlugin.LogLevel.Error); return; } if ((Object)(object)val3 == (Object)null) { SeichiItemsPlugin.Log($"Tried to heal player with ID: {playerId}, but the player object is null.", "Uchiwa", SeichiItemsPlugin.LogLevel.Error); } int playerMaxHealth = GetPlayerMaxHealth(val3); int playerNewHealth = ((playerMaxHealth != -1) ? Mathf.Min(val3.health + healAmount, playerMaxHealth) : Mathf.Min(val3.health + healAmount, 100)); HealPlayerClientRpc(playerId, playerNewHealth); } } [ClientRpc] private void HealPlayerClientRpc(ulong playerId, int playerNewHealth) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3245975384u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, playerNewHealth); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3245975384u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerId]; val3.health = playerNewHealth; if ((Object)(object)HUDManager.Instance.localPlayer == (Object)(object)val3) { HUDManager.Instance.UpdateHealthUI(val3.health, false); } } } private int GetPlayerMaxHealth(PlayerControllerB player) { if (UchiwaSharedData.Instance.PlayersMaxHealth.ContainsKey(player)) { return UchiwaSharedData.Instance.PlayersMaxHealth[player]; } SeichiItemsPlugin.Log("Could not get the health of player " + player.playerUsername + ". This should not happen.", "Uchiwa", SeichiItemsPlugin.LogLevel.Error); return -1; } [ServerRpc(RequireOwnership = false)] private void PlayAudioClipTypeServerRpc(AudioClipTypes audioClipType, bool interrupt = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2229229963u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2229229963u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { int num = audioClipType switch { AudioClipTypes.Hit => hitSfx.Length, AudioClipTypes.Swing => swingSfx.Length, _ => -1, }; switch (num) { case 0: SeichiItemsPlugin.Log($"There are no audio clips for audio clip type {audioClipType}.", "Uchiwa", SeichiItemsPlugin.LogLevel.Error); break; case -1: SeichiItemsPlugin.Log($"Audio Clip Type was not listed, cannot play audio clip. Number of audio clips: {num}.", "Uchiwa", SeichiItemsPlugin.LogLevel.Error); break; default: { int clipIndex = Random.Range(0, num); PlayAudioClipTypeClientRpc(audioClipType, clipIndex, interrupt); break; } } } } [ClientRpc] private void PlayAudioClipTypeClientRpc(AudioClipTypes audioClipType, int clipIndex, bool interrupt = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3423178400u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums)); BytePacker.WriteValueBitPacked(val2, clipIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3423178400u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } AudioClip val3 = (AudioClip)(audioClipType switch { AudioClipTypes.Hit => hitSfx[clipIndex], AudioClipTypes.Swing => swingSfx[clipIndex], AudioClipTypes.HitSurface => StartOfRound.Instance.footstepSurfaces[clipIndex].hitSurfaceSFX, _ => null, }); if ((Object)(object)val3 == (Object)null) { SeichiItemsPlugin.Log($"Invalid audio clip with type: {audioClipType} and index: {clipIndex}", "Uchiwa", SeichiItemsPlugin.LogLevel.Error); return; } if (interrupt) { uchiwaAudio.Stop(true); } uchiwaAudio.PlayOneShot(val3); WalkieTalkie.TransmitOneShotAudio(uchiwaAudio, val3, uchiwaAudio.volume); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 8f, 0.4f, 0, false, 0); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_UchiwaItem() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(2944637045u, new RpcReceiveHandler(__rpc_handler_2944637045)); NetworkManager.__rpc_func_table.Add(3245975384u, new RpcReceiveHandler(__rpc_handler_3245975384)); NetworkManager.__rpc_func_table.Add(2229229963u, new RpcReceiveHandler(__rpc_handler_2229229963)); NetworkManager.__rpc_func_table.Add(3423178400u, new RpcReceiveHandler(__rpc_handler_3423178400)); } private static void __rpc_handler_2944637045(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((UchiwaItem)(object)target).HealPlayerServerRpc(playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3245975384(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int playerNewHealth = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerNewHealth); target.__rpc_exec_stage = (__RpcExecStage)2; ((UchiwaItem)(object)target).HealPlayerClientRpc(playerId, playerNewHealth); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2229229963(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { AudioClipTypes audioClipType = default(AudioClipTypes); ((FastBufferReader)(ref reader)).ReadValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums)); bool interrupt = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref interrupt, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((UchiwaItem)(object)target).PlayAudioClipTypeServerRpc(audioClipType, interrupt); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3423178400(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { AudioClipTypes audioClipType = default(AudioClipTypes); ((FastBufferReader)(ref reader)).ReadValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums)); int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); bool interrupt = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref interrupt, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((UchiwaItem)(object)target).PlayAudioClipTypeClientRpc(audioClipType, clipIndex, interrupt); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "UchiwaItem"; } } public class UchiwaSharedData { private static UchiwaSharedData _instance; public static UchiwaSharedData Instance => _instance ?? (_instance = new UchiwaSharedData()); public Dictionary<PlayerControllerB, int> PlayersMaxHealth { get; } = new Dictionary<PlayerControllerB, int>(); public static void FlushDictionaries() { Instance.PlayersMaxHealth.Clear(); } } } namespace LethalCompanySeichiItems.Uchiwa.Patches { [HarmonyPatch(typeof(StartOfRound))] internal class StartOfRoundPatches { [HarmonyPatch("ShipLeave")] [HarmonyPostfix] private static void ResetData(StartOfRound __instance) { UchiwaSharedData.FlushDictionaries(); } [HarmonyPatch("StartGame")] [HarmonyPostfix] private static void GetAllPlayersMaxHealth(StartOfRound __instance) { PlayerControllerB[] allPlayerScripts = __instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (UchiwaSharedData.Instance.PlayersMaxHealth.ContainsKey(val)) { UchiwaSharedData.Instance.PlayersMaxHealth.Remove(val); } UchiwaSharedData.Instance.PlayersMaxHealth.Add(val, val.health); } } } } namespace LethalCompanySeichiItems.Lantern { public class LanternItem : GrabbableObject { private const string LOGPrefix = "Lantern"; [Header("Lantern Stuff")] [Space(15f)] [SerializeField] private Light bulbLightSource; [SerializeField] private Light bulbGlowLightSource; [SerializeField] private AudioSource audioSource; [SerializeField] private AudioClip[] turnOnAudioClips; [SerializeField] private AudioClip[] turnOffAudioClips; [SerializeField] private Material bulbLightMaterial; [SerializeField] private Material bulbDarkMaterial; [SerializeField] private MeshRenderer meshRenderer; [SerializeField] private GameObject lanternHelmetLightPrefab; private GameObject lanternHelmetLightInstance; private Light lanternHelmetLightSource; private readonly NetworkVariable<bool> _isMainLightOn = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable<bool> _isHelmetLightOn = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private readonly NetworkVariable<bool> _isOn = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)1); private bool _subscribedToNetworkEvents; private bool _hasInstantiated; private void OnEnable() { SubscribeToNetworkEvents(); } private void OnDisable() { UnsubscribeFromNetworkEvents(); } public override void OnDestroy() { if ((Object)(object)lanternHelmetLightInstance != (Object)null) { Object.Destroy((Object)(object)lanternHelmetLightInstance); } ((NetworkBehaviour)this).OnDestroy(); } public override void Start() { //IL_0116: Unknown result type (might be due to invalid IL or missing references) SubscribeToNetworkEvents(); if (_hasInstantiated) { return; } if ((Object)(object)meshRenderer == (Object)null) { meshRenderer = ((Component)this).GetComponent<MeshRenderer>(); } if ((Object)(object)meshRenderer == (Object)null) { SeichiItemsPlugin.Log("The mesh renderer component on the lantern is null.", "Lantern", SeichiItemsPlugin.LogLevel.Error); } if ((Object)(object)bulbLightSource == (Object)null) { SeichiItemsPlugin.Log("The bulbLightSource on the lantern is null.", "Lantern", SeichiItemsPlugin.LogLevel.Error); } if ((Object)(object)bulbGlowLightSource == (Object)null) { SeichiItemsPlugin.Log("The bulbGlowLightSource on the lantern is null.", "Lantern", SeichiItemsPlugin.LogLevel.Error); } if ((Object)(object)lanternHelmetLightPrefab == (Object)null) { SeichiItemsPlugin.Log("The lanternHelmetLightPrefab gameobject on this lantern is null.", "Lantern", SeichiItemsPlugin.LogLevel.Error); } lanternHelmetLightInstance = Object.Instantiate<GameObject>(lanternHelmetLightPrefab); lanternHelmetLightSource = lanternHelmetLightInstance.GetComponent<Light>(); if ((Object)(object)lanternHelmetLightSource == (Object)null) { lanternHelmetLightSource = lanternHelmetLightInstance.GetComponentInChildren<Light>(); if ((Object)(object)lanternHelmetLightSource == (Object)null) { SeichiItemsPlugin.Log("The lanternHelmetLightSource light component on this lantern is null.", "Lantern", SeichiItemsPlugin.LogLevel.Error); } } ((Component)lanternHelmetLightSource).gameObject.transform.position = ((Component)this).transform.position; ((Behaviour)lanternHelmetLightSource).enabled = false; ((Behaviour)bulbLightSource).enabled = false; ((Behaviour)bulbGlowLightSource).enabled = false; _hasInstantiated = true; ((GrabbableObject)this).Start(); } public override void LateUpdate() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if ((base.isHeld || base.isPocketed) && _isOn.Value && _isHelmetLightOn.Value) { lanternHelmetLightInstance.transform.position = ((Component)base.playerHeldBy.helmetLight).transform.position; lanternHelmetLightInstance.transform.rotation = ((Component)base.playerHeldBy.helmetLight).transform.rotation; } ((GrabbableObject)this).LateUpdate(); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); base.isBeingUsed = used; bool flag = false; if (!_isOn.Value) { if (turnOnAudioClips.Length != 0) { audioSource.PlayOneShot(turnOnAudioClips[Random.Range(0, turnOnAudioClips.Length)]); flag = true; } } else if (turnOffAudioClips.Length != 0) { audioSource.PlayOneShot(turnOffAudioClips[Random.Range(0, turnOffAudioClips.Length)]); flag = true; } if (flag) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 6f, 0.3f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } if (((NetworkBehaviour)this).IsOwner) { _isOn.Value = !_isOn.Value; _isMainLightOn.Value = !_isMainLightOn.Value; _isHelmetLightOn.Value = !_isHelmetLightOn.Value; } } public override void DiscardItem() { if (((NetworkBehaviour)this).IsOwner) { SeichiItemsPlugin.ChangeNetworkVar(_isHelmetLightOn, newValue: false); SeichiItemsPlugin.ChangeNetworkVar(_isMainLightOn, _isOn.Value); } ((GrabbableObject)this).DiscardItem(); } public override void EquipItem() { if (((NetworkBehaviour)this).IsOwner) { SeichiItemsPlugin.ChangeNetworkVar(_isHelmetLightOn, _isOn.Value); SeichiItemsPlugin.ChangeNetworkVar(_isMainLightOn, _isOn.Value); } ((GrabbableObject)this).EquipItem(); } public override void PocketItem() { if (((NetworkBehaviour)this).IsOwner) { SeichiItemsPlugin.ChangeNetworkVar(_isHelmetLightOn, _isOn.Value); SeichiItemsPlugin.ChangeNetworkVar(_isMainLightOn, newValue: false); } ((GrabbableObject)this).PocketItem(); } private void OnMainLightToggled(bool oldIsTurnedOn, bool newIsTurnedOn) { SeichiItemsPlugin.Log($"Main light on?: {newIsTurnedOn}", "Lantern"); ((Behaviour)bulbLightSource).enabled = newIsTurnedOn; ((Behaviour)bulbGlowLightSource).enabled = newIsTurnedOn; Material[] sharedMaterials = ((Renderer)meshRenderer).sharedMaterials; sharedMaterials[0] = (newIsTurnedOn ? bulbLightMaterial : bulbDarkMaterial); ((Renderer)meshRenderer).sharedMaterials = sharedMaterials; } private void OnHelmetLightToggled(bool oldIsTurnedOn, bool newIsTurnedOn) { SeichiItemsPlugin.Log($"Helmet light on?: {newIsTurnedOn}", "Lantern"); ((Behaviour)lanternHelmetLightSource).enabled = newIsTurnedOn; } private void SubscribeToNetworkEvents() { if (!_subscribedToNetworkEvents) { NetworkVariable<bool> isMainLightOn = _isMainLightOn; isMainLightOn.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isMainLightOn.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnMainLightToggled)); NetworkVariable<bool> isHelmetLightOn = _isHelmetLightOn; isHelmetLightOn.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isHelmetLightOn.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnHelmetLightToggled)); _subscribedToNetworkEvents = true; } } private void UnsubscribeFromNetworkEvents() { if (_subscribedToNetworkEvents) { NetworkVariable<bool> isMainLightOn = _isMainLightOn; isMainLightOn.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isMainLightOn.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnMainLightToggled)); NetworkVariable<bool> isHelmetLightOn = _isHelmetLightOn; isHelmetLightOn.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isHelmetLightOn.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnHelmetLightToggled)); _subscribedToNetworkEvents = false; } } protected override void __initializeVariables() { if (_isMainLightOn == null) { throw new Exception("LanternItem._isMainLightOn cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_isMainLightOn).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_isMainLightOn, "_isMainLightOn"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_isMainLightOn); if (_isHelmetLightOn == null) { throw new Exception("LanternItem._isHelmetLightOn cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_isHelmetLightOn).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_isHelmetLightOn, "_isHelmetLightOn"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_isHelmetLightOn); if (_isOn == null) { throw new Exception("LanternItem._isOn cannot be null. All NetworkVariableBase instances must be initialized."); } ((NetworkVariableBase)_isOn).Initialize((NetworkBehaviour)(object)this); ((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)_isOn, "_isOn"); ((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)_isOn); ((GrabbableObject)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LanternItem"; } } } namespace LethalCompanySeichiItems.Kanabo { public class KanaboConfig : SyncedInstance<KanaboConfig> { public readonly ConfigEntry<int> KanaboDamage; public readonly ConfigEntry<float> KanaboReelUpTime; public KanaboConfig(ConfigFile cfg) { InitInstance(this); KanaboDamage = cfg.Bind<int>("Kanabo", "Damage", 2, "The amount of damage the Kanabo does per hit."); KanaboReelUpTime = cfg.Bind<float>("Kanabo", "Reel Up Time", 0.7f, "The time it takes in seconds for the player to reel up the Kanabo."); } } public class KanaboItem : GrabbableObject { private enum AudioClipTypes { ReelUp, Swing, Hit, HitSurface } private const string LOGPrefix = "Kanabo"; [Tooltip("The amount of damage the Kanabo does on a single hit.")] [SerializeField] private int hitForce = 2; [Tooltip("The reel up time in seconds for the Kanabo.")] [SerializeField] private float reelUpTime = 0.7f; [Header("Audio")] [Space(5f)] [SerializeField] private AudioSource kanaboAudio; public AudioClip[] reelUpSfx; public AudioClip[] swingSfx; public AudioClip[] hitSfx; private const int ShovelMask = 11012424; private static readonly int ShovelHit = Animator.StringToHash("shovelHit"); private static readonly int ReelingUp = Animator.StringToHash("reelingUp"); private bool _reelingUp; private bool _isHoldingButton; private bool _animatorSpeedCurrentlyModified; private float _origionalPlayerAnimatorSpeed; private List<RaycastHit> _objectsHitByKanaboList = new List<RaycastHit>(); private RaycastHit[] _objectsHitByKanabo; private Coroutine _reelingUpCoroutine; private PlayerControllerB _previousPlayerHeldBy; private void OnDisable() { if (_animatorSpeedCurrentlyModified) { base.playerHeldBy.playerBodyAnimator.speed = _origionalPlayerAnimatorSpeed; } } public override void Start() { ((GrabbableObject)this).Start(); hitForce = Mathf.Clamp(SyncedInstance<KanaboConfig>.Instance.KanaboDamage.Value, 0, int.MaxValue); reelUpTime = Mathf.Clamp(SyncedInstance<KanaboConfig>.Instance.KanaboReelUpTime.Value, 0.05f, 2.1474836E+09f); _origionalPlayerAnimatorSpeed = StartOfRound.Instance.allPlayerScripts[0].playerBodyAnimator.speed; } public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null) { return; } _isHoldingButton = buttonDown; if (!_reelingUp && buttonDown) { _reelingUp = true; _previousPlayerHeldBy = base.playerHeldBy; if (_reelingUpCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_reelingUpCoroutine); _reelingUpCoroutine = null; } _reelingUpCoroutine = ((MonoBehaviour)this).StartCoroutine(ReelUpKanabo()); } } private IEnumerator ReelUpKanabo() { try { if ((Object)(object)base.playerHeldBy == (Object)null) { SeichiItemsPlugin.Log("PlayerHeldBy is null at the start of ReelUpKanabo. Aborting.", "Kanabo", SeichiItemsPlugin.LogLevel.Warning); yield break; } ulong playerHeldByClientId = base.playerHeldBy.actualClientId; Animator animator = base.playerHeldBy.playerBodyAnimator; if ((Object)(object)animator == (Object)null) { SeichiItemsPlugin.Log("PlayerBodyAnimator is null. Aborting.", "Kanabo", SeichiItemsPlugin.LogLevel.Warning); yield break; } base.playerHeldBy.activatingItem = true; base.playerHeldBy.twoHanded = true; animator.ResetTrigger(ShovelHit); animator.SetBool(ReelingUp, true); yield return null; RuntimeAnimatorController runtimeAnimatorController = animator.runtimeAnimatorController; AnimationClip val = ((runtimeAnimatorController == null) ? null : runtimeAnimatorController.animationClips?.FirstOrDefault((Func<AnimationClip, bool>)((AnimationClip clip) => ((Object)clip).name == "ShovelReelUp"))); if ((Object)(object)val != (Object)null) { _origionalPlayerAnimatorSpeed = animator.speed; float speed = val.length / reelUpTime; _animatorSpeedCurrentlyModified = true; animator.speed = speed; PlayAudioClipTypeServerRpc(AudioClipTypes.ReelUp); yield return (object)new WaitForSeconds(reelUpTime); if ((Object)(object)animator == (Object)null) { animator = StartOfRound.Instance.allPlayerScripts[playerHeldByClientId].playerBodyAnimator; } animator.speed = _origionalPlayerAnimatorSpeed; _animatorSpeedCurrentlyModified = false; } else { SeichiItemsPlugin.Log("No animation clips found in the runtimeAnimatorController.", "Kanabo", SeichiItemsPlugin.LogLevel.Warning); } yield return (object)new WaitUntil((Func<bool>)(() => !_isHoldingButton || !base.isHeld)); SwingKanabo(!base.isHeld); yield return (object)new WaitForSeconds(0.13f); yield return (object)new WaitForEndOfFrame(); HitKanabo(!base.isHeld); yield return (object)new WaitForSeconds(0.3f); } finally { KanaboItem kanaboItem = this; kanaboItem._reelingUp = false; kanaboItem._reelingUpCoroutine = null; } } public void SwingKanabo(bool cancel = false) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) _previousPlayerHeldBy.playerBodyAnimator.SetBool(ReelingUp, false); if (!cancel) { if (((NetworkBehaviour)this).IsServer) { PlayAudioClipTypeServerRpc(AudioClipTypes.Swing); } _previousPlayerHeldBy.UpdateSpecialAnimationValue(true, (short)((Component)_previousPlayerHeldBy).transform.localEulerAngles.y, 0.4f, false); } } public void HitKanabo(bool cancel = false) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_previousPlayerHeldBy == (Object)null) { SeichiItemsPlugin.Log("Variable '_previousPlayerHeldBy' is null on this client when HitKanabo is called.", "Kanabo", SeichiItemsPlugin.LogLevel.Error); return; } _previousPlayerHeldBy.activatingItem = false; bool flag = false; bool flag2 = false; int num = -1; if (!cancel) { _previousPlayerHeldBy.twoHanded = false; _objectsHitByKanabo = Physics.SphereCastAll(((Component)_previousPlayerHeldBy.gameplayCamera).transform.position + ((Component)_previousPlayerHeldBy.gameplayCamera).transform.right * -0.35f, 0.8f, ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward, 1.5f, 11012424, (QueryTriggerInteraction)2); _objectsHitByKanaboList = _objectsHitByKanabo.OrderBy((RaycastHit x) => ((RaycastHit)(ref x)).distance).ToList(); IHittable val2 = default(IHittable); foreach (RaycastHit objectsHitByKanabo in _objectsHitByKanaboList) { RaycastHit val = objectsHitByKanabo; if (((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 8 && ((Component)((RaycastHit)(ref val)).transform).gameObject.layer != 11) { val = objectsHitByKanabo; if (!((Component)((RaycastHit)(ref val)).transform).TryGetComponent<IHittable>(ref val2)) { continue; } val = objectsHitByKanabo; if ((Object)(object)((RaycastHit)(ref val)).transform == (Object)(object)((Component)_previousPlayerHeldBy).transform) { continue; } val = objectsHitByKanabo; if (!(((RaycastHit)(ref val)).point == Vector3.zero)) { Vector3 position = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.position; val = objectsHitByKanabo; Vector3 point = ((RaycastHit)(ref val)).point; RaycastHit val3 = default(RaycastHit); int collidersAndRoomMaskAndDefault = StartOfRound.Instance.collidersAndRoomMaskAndDefault; if (Physics.Linecast(position, point, ref val3, collidersAndRoomMaskAndDefault)) { continue; } } flag = true; Vector3 forward = ((Component)_previousPlayerHeldBy.gameplayCamera).transform.forward; try { val2.Hit(hitForce, forward, _previousPlayerHeldBy, true, 1); flag2 = true; } catch (Exception arg) { SeichiItemsPlugin.Log($"Exception caught when hitting object with Kanabo from player {_previousPlayerHeldBy.playerUsername}: {arg}", "Kanabo", SeichiItemsPlugin.LogLevel.Error); } continue; } flag = true; val = objectsHitByKanabo; for (int i = 0; i < StartOfRound.Instance.footstepSurfaces.Length; i++) { if (!(StartOfRound.Instance.footstepSurfaces[i].surfaceTag != ((Component)((RaycastHit)(ref val)).collider).gameObject.tag)) { num = i; break; } } } } if (flag) { if (!flag2 && num != -1) { PlayAudioClipTypeClientRpc(AudioClipTypes.HitSurface, num); } base.playerHeldBy.playerBodyAnimator.SetTrigger(ShovelHit); PlayAudioClipTypeServerRpc(AudioClipTypes.Hit); } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.activatingItem = false; } ((GrabbableObject)this).DiscardItem(); } [ServerRpc(RequireOwnership = false)] private void PlayAudioClipTypeServerRpc(AudioClipTypes audioClipType, bool interrupt = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1864931625u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1864931625u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { int num = audioClipType switch { AudioClipTypes.Swing => swingSfx.Length, AudioClipTypes.Hit => hitSfx.Length, AudioClipTypes.ReelUp => reelUpSfx.Length, _ => -1, }; switch (num) { case 0: SeichiItemsPlugin.Log($"There are no audio clips for audio clip type {audioClipType}.", "Kanabo", SeichiItemsPlugin.LogLevel.Error); break; case -1: SeichiItemsPlugin.Log($"Audio Clip Type was not listed, cannot play audio clip. Number of audio clips: {num}.", "Kanabo", SeichiItemsPlugin.LogLevel.Error); break; default: { int clipIndex = Random.Range(0, num); PlayAudioClipTypeClientRpc(audioClipType, clipIndex, interrupt); break; } } } } [ClientRpc] private void PlayAudioClipTypeClientRpc(AudioClipTypes audioClipType, int clipIndex, bool interrupt = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(739090681u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums)); BytePacker.WriteValueBitPacked(val2, clipIndex); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 739090681u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } AudioClip val3 = (AudioClip)(audioClipType switch { AudioClipTypes.Hit => hitSfx[clipIndex], AudioClipTypes.Swing => swingSfx[clipIndex], AudioClipTypes.ReelUp => reelUpSfx[clipIndex], AudioClipTypes.HitSurface => StartOfRound.Instance.footstepSurfaces[clipIndex].hitSurfaceSFX, _ => null, }); if ((Object)(object)val3 == (Object)null) { SeichiItemsPlugin.Log($"Invalid audio clip with type: {audioClipType} and index: {clipIndex}", "Kanabo", SeichiItemsPlugin.LogLevel.Error); return; } if (interrupt) { kanaboAudio.Stop(true); } kanaboAudio.PlayOneShot(val3); WalkieTalkie.TransmitOneShotAudio(kanaboAudio, val3, kanaboAudio.volume); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 8f, 0.4f, 0, false, 0); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_KanaboItem() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1864931625u, new RpcReceiveHandler(__rpc_handler_1864931625)); NetworkManager.__rpc_func_table.Add(739090681u, new RpcReceiveHandler(__rpc_handler_739090681)); } private static void __rpc_handler_1864931625(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { AudioClipTypes audioClipType = default(AudioClipTypes); ((FastBufferReader)(ref reader)).ReadValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums)); bool interrupt = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref interrupt, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((KanaboItem)(object)target).PlayAudioClipTypeServerRpc(audioClipType, interrupt); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_739090681(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { AudioClipTypes audioClipType = default(AudioClipTypes); ((FastBufferReader)(ref reader)).ReadValueSafe<AudioClipTypes>(ref audioClipType, default(ForEnums)); int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); bool interrupt = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref interrupt, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((KanaboItem)(object)target).PlayAudioClipTypeClientRpc(audioClipType, clipIndex, interrupt); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "KanaboItem"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace LethalCompanySeichiItems.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }
BepInEx/plugins/mythicmoons/ScarletMansionSeichiPatch.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using HarmonyLib; using ScarletMansion.DunGenPatch; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("ScarletMansionSeichiPatch")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ScarletMansionSeichiPatch")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3fb44756-2543-4ee4-ace4-da3fdb995192")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ScarletMansionSeichiPatch; public class Patch { public static void Activate() { Plugin.Instance.harmony.PatchAll(typeof(Patch)); } public static Volume GetVolume() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) GameObject[] array = null; for (int i = 0; i < SceneManager.sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); if (((Scene)(ref sceneAt)).name.ToLowerInvariant() == "seichi") { array = ((Scene)(ref sceneAt)).GetRootGameObjects(); Plugin.logger.LogInfo((object)"Found Seichi scene"); break; } } if (array == null) { return null; } GameObject[] array2 = array; foreach (GameObject val in array2) { if (((Object)val).name.ToLowerInvariant() == "environment") { Transform val2 = val.transform.Find("RaphtaliaVolume"); if ((Object)(object)val2 != (Object)null) { return ((Component)val2).GetComponentInChildren<Volume>(true); } } } return null; } [HarmonyPatch(typeof(RoundManager), "SetPowerOffAtStart")] [HarmonyPostfix] public static void ShipLandedPatch(ref RoundManager __instance) { if (Patch.active) { Volume volume = GetVolume(); if ((Object)(object)volume == (Object)null) { Plugin.logger.LogWarning((object)"Couldn't setup SDM/Seichi compatibility feature"); } else { ((Behaviour)volume).enabled = true; } } } } [BepInPlugin("dev.ladyalice.scarletmansion.seichipatch", "Scarlet Mansion Seichi Patch", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string modGUID = "dev.ladyalice.scarletmansion.seichipatch"; private const string modName = "Scarlet Mansion Seichi Patch"; private const string modVersion = "1.0.0"; public const string targetModGUID = "dev.ladyalice.scarletmansion"; public const string targetModVersion = "1.3.27"; public readonly Harmony harmony = new Harmony("dev.ladyalice.scarletmansion.seichipatch"); public static Plugin Instance { get; private set; } public static ManualLogSource logger { get; internal set; } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("dev.ladyalice.scarletmansion.seichipatch"); if (Chainloader.PluginInfos.ContainsKey("dev.ladyalice.scarletmansion")) { PluginInfo val = Chainloader.PluginInfos["dev.ladyalice.scarletmansion"]; Version version = val.Metadata.Version; bool flag; if (string.IsNullOrWhiteSpace("1.3.27")) { flag = true; } else { Version version2 = new Version("1.3.27"); flag = version >= version2; } if (flag) { logger.LogInfo((object)"Plugin Scarlet Mansion Seichi Patch has been added!"); Patch.Activate(); } } } }
BepInEx/plugins/mythicmoons/TestAccount666.StatueThingy.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TestAccount666.StatueThingy.NetcodePatcher; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TestAccount666.StatueThingy")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("StatueThingy")] [assembly: AssemblyTitle("TestAccount666.StatueThingy")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace StatueThingy { [BepInPlugin("TestAccount666.StatueThingy", "StatueThingy", "1.0.0")] public class StatueThingy : BaseUnityPlugin { public static StatueThingy Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("TestAccount666.StatueThingy"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); ExecuteNetcodePatcher(); Logger.LogInfo((object)"TestAccount666.StatueThingy v1.0.0 has loaded!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } private static void ExecuteNetcodePatcher() { Assembly executingAssembly = Assembly.GetExecutingAssembly(); Type[] types = executingAssembly.GetTypes(); foreach (Type type in types) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } } [AddComponentMenu("TestAccount666/StatueThingy/StatueThingySync")] public class StatueThingySync : NetworkBehaviour { [SerializeField] private string[] poseTriggers = Array.Empty<string>(); [SerializeField] private Animator? animator; private readonly LinkedList<int> _poseTriggersHash = new LinkedList<int>(); [ClientRpc] private void SyncPoseClientRpc(int index) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3043677422u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3043677422u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((Behaviour)this).isActiveAndEnabled) { ((MonoBehaviour)this).StartCoroutine(WaitUntilInitializationAndApply(index)); } } } private void Start() { if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) { NetworkObject component = ((Component)this).GetComponent<NetworkObject>(); if (!component.IsSpawned) { component.Spawn(true); } } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); ((MonoBehaviour)this).StartCoroutine(WaitUntilInitializationAndSync()); } private IEnumerator WaitUntilInitializationAndApply(int index) { yield return (object)new WaitUntil((Func<bool>)delegate { int result; if (this != null && animator != null) { string[] array2 = poseTriggers; if (array2 != null) { result = ((array2.Length > 0) ? 1 : 0); goto IL_0020; } } result = 0; goto IL_0020; IL_0020: return (byte)result != 0; }); if (_poseTriggersHash.Count <= 0) { string[] array = poseTriggers; foreach (string triggerName in array) { _poseTriggersHash.AddLast(Animator.StringToHash(triggerName)); } } ApplyMeshAndMaterial(index); } private IEnumerator WaitUntilInitializationAndSync() { yield return (object)new WaitUntil((Func<bool>)delegate { int result; if (this != null && animator != null) { string[] array2 = poseTriggers; if (array2 != null) { result = ((array2.Length > 0) ? 1 : 0); goto IL_0020; } } result = 0; goto IL_0020; IL_0020: return (byte)result != 0; }); if (!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer) { yield break; } if (_poseTriggersHash.Count <= 0) { string[] array = poseTriggers; foreach (string triggerName in array) { _poseTriggersHash.AddLast(Animator.StringToHash(triggerName)); } } Random seededRandom = new Random(StartOfRound.Instance.randomMapSeed); int index = seededRandom.Next(0, poseTriggers.Length); SyncPoseClientRpc(index); } private void ApplyMeshAndMaterial(int index) { Animator? obj = animator; if (obj != null) { obj.SetTrigger(_poseTriggersHash.ElementAt(index)); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_StatueThingySync() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3043677422u, new RpcReceiveHandler(__rpc_handler_3043677422)); } private static void __rpc_handler_3043677422(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); target.__rpc_exec_stage = (__RpcExecStage)2; ((StatueThingySync)(object)target).SyncPoseClientRpc(index); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "StatueThingySync"; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "TestAccount666.StatueThingy"; public const string PLUGIN_NAME = "StatueThingy"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace TestAccount666.StatueThingy.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }