Decompiled source of 20andrey24 Defolt Client v1.0.0
plugins/BlueAmulet-REPONetworkTweaks/REPONetworkTweaks.dll
Decompiled 3 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("REPONetworkTweaks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("REPONetworkTweaks")] [assembly: AssemblyCopyright("Copyright © BlueAmulet 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b71c6ed6-b7be-40af-a0ab-023cbc72986c")] [assembly: AssemblyFileVersion("1.0.3")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] namespace REPONetworkTweaks { public class PhotonTransformViewTweak : MonoBehaviour { private class TransformSnapshot { internal Vector3 position; internal Quaternion rotation; internal Vector3 velocity; internal Vector3 angularVelocity; internal TransformSnapshot(Vector3 position, Quaternion rotation, Vector3 velocity, Vector3 angularVelocity) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) this.position = position; this.rotation = rotation; this.velocity = velocity; this.angularVelocity = angularVelocity; } } private Rigidbody rigidBody; private PhotonTransformView photonTransformView; private PhysGrabHinge hinge; private Vector3 m_StoredPosition; private bool teleport; private bool isSleeping; private bool isKinematic; private Vector3 interpVelocity; private Vector3 interpAngularVelocity; private readonly LinkedList<TransformSnapshot> snapshots = new LinkedList<TransformSnapshot>(); private TransformSnapshot prevSnapshot; private float interpolationStartTime = -1f; private float smoothUpdateFrequency = (float)PhotonNetwork.serializationFrequency / 1000f; private float lastSerializationFrequency = -1f; private int lastSendTimestamp; private bool haveFirstSend; private float interpFactor { get { if (!(smoothUpdateFrequency <= 0f) && !(interpolationStartTime < 0f)) { return (Time.timeSinceLevelLoad - interpolationStartTime) / smoothUpdateFrequency; } return 1f; } } public void Awake() { //IL_002b: 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) rigidBody = ((Component)this).GetComponent<Rigidbody>(); photonTransformView = ((Component)this).GetComponent<PhotonTransformView>(); hinge = ((Component)this).GetComponent<PhysGrabHinge>(); m_StoredPosition = ((Component)this).transform.position; } public void OnEnable() { snapshots.Clear(); prevSnapshot = null; } internal void Teleport(Vector3 _position, Quaternion _rotation) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) teleport = true; ((Component)this).transform.position = _position; ((Component)this).transform.rotation = _rotation; m_StoredPosition = _position; isSleeping = false; if (Object.op_Implicit((Object)(object)rigidBody)) { rigidBody.position = _position; rigidBody.rotation = _rotation; rigidBody.WakeUp(); } } private Vector3 HermiteInterpolatePosition(Vector3 startPos, Vector3 startVel, Vector3 endPos, Vector3 endVel, float interpolation) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) Vector3 val = startPos + startVel * (smoothUpdateFrequency * interpolation) / 3f; Vector3 val2 = endPos - endVel * (smoothUpdateFrequency * (1f - interpolation)) / 3f; return Vector3.Lerp(val, val2, interpolation); } private Quaternion HermiteInterpolateRotation(Quaternion startRot, Vector3 startSpin, Quaternion endRot, Vector3 endSpin, float interpolation) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Quaternion val = startRot * Quaternion.Euler(startSpin * (smoothUpdateFrequency * interpolation) / 3f); Quaternion val2 = endRot * Quaternion.Euler(endSpin * (-1f * smoothUpdateFrequency * (1f - interpolation)) / 3f); return Quaternion.Slerp(val, val2, interpolation); } public void Update() { //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0141: 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_014d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)rigidBody)) { rigidBody = ((Component)this).GetComponent<Rigidbody>(); } Transform transform = ((Component)this).transform; if (PhotonNetwork.IsMasterClient) { return; } if (Object.op_Implicit((Object)(object)rigidBody)) { rigidBody.isKinematic = true; rigidBody.interpolation = (RigidbodyInterpolation)0; } if (snapshots.Count < 1) { return; } while (interpFactor >= 1f && snapshots.Count > 1) { prevSnapshot = snapshots.First.Value; snapshots.RemoveFirst(); interpolationStartTime += smoothUpdateFrequency; } if (snapshots.Count == 1) { TransformSnapshot value = snapshots.First.Value; if (prevSnapshot != null && Settings.Extrapolate.Value) { float num = 2f - Mathf.Pow(MathF.E, 0f - interpFactor); transform.position = value.position + Vector3.SlerpUnclamped(prevSnapshot.velocity, value.velocity, num) * ((num - 1f) * smoothUpdateFrequency); transform.rotation = Quaternion.SlerpUnclamped(prevSnapshot.rotation, value.rotation, num); } else { transform.position = value.position; transform.rotation = value.rotation; } interpVelocity = value.velocity; interpAngularVelocity = value.angularVelocity; } else { LinkedListNode<TransformSnapshot>? first = snapshots.First; TransformSnapshot value2 = first.Value; TransformSnapshot value3 = first.Next.Value; transform.position = HermiteInterpolatePosition(value2.position, value2.velocity, value3.position, value3.velocity, interpFactor); transform.rotation = HermiteInterpolateRotation(value2.rotation, value2.angularVelocity, value3.rotation, value3.angularVelocity, interpFactor); interpVelocity = Vector3.Slerp(value2.velocity, value3.velocity, interpFactor); interpAngularVelocity = Vector3.Lerp(value2.angularVelocity, value3.angularVelocity, interpFactor); } } internal void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; if (stream.IsWriting) { stream.SendNext((object)rigidBody.IsSleeping()); stream.SendNext((object)teleport); teleport = false; isKinematic = rigidBody.isKinematic; stream.SendNext((object)isKinematic); stream.SendNext((object)rigidBody.velocity); stream.SendNext((object)rigidBody.angularVelocity); Vector3 val = transform.position - m_StoredPosition; m_StoredPosition = transform.position; stream.SendNext((object)transform.position); stream.SendNext((object)val); stream.SendNext((object)transform.rotation); return; } if (!Object.op_Implicit((Object)(object)rigidBody)) { rigidBody = ((Component)this).GetComponent<Rigidbody>(); } isSleeping = (bool)stream.ReceiveNext(); if (isSleeping) { rigidBody.Sleep(); } else { rigidBody.WakeUp(); } teleport = (bool)stream.ReceiveNext(); isKinematic = (bool)stream.ReceiveNext(); Vector3 velocity = (Vector3)stream.ReceiveNext(); Vector3 angularVelocity = (Vector3)stream.ReceiveNext(); Vector3 position = (Vector3)stream.ReceiveNext(); Vector3 val2 = (Vector3)stream.ReceiveNext(); Quaternion rotation = (Quaternion)stream.ReceiveNext(); if ((Object)(object)hinge != (Object)null && !hinge.broken) { velocity = ((!haveFirstSend) ? (val2 / smoothUpdateFrequency) : (val2 / (float)(((PhotonMessageInfo)(ref info)).SentServerTimestamp - lastSendTimestamp) * 1000f)); } if (teleport) { snapshots.Clear(); prevSnapshot = null; } float num = Mathf.Max(Settings.Future.Value * smoothUpdateFrequency, 0f); TransformSnapshot transformSnapshot = new TransformSnapshot(position, rotation, velocity, angularVelocity); if (snapshots.Count > 0 && (float)(((PhotonMessageInfo)(ref info)).SentServerTimestamp - lastSendTimestamp) / 1000f < Settings.TimingThreshold.Value) { TransformSnapshot value = snapshots.Last.Value; Vector3 val3 = (transformSnapshot.velocity - value.velocity) / smoothUpdateFrequency; transformSnapshot.position += transformSnapshot.velocity * num + 0.5f * val3 * num * num; Vector3 val4 = (transformSnapshot.angularVelocity - value.angularVelocity) / smoothUpdateFrequency; Quaternion val5 = Quaternion.Euler((transformSnapshot.angularVelocity + val4 * num) * num); transformSnapshot.rotation *= val5; } else { transformSnapshot.position += transformSnapshot.velocity * num; transformSnapshot.rotation *= Quaternion.Euler(transformSnapshot.angularVelocity * num); } snapshots.AddLast(transformSnapshot); if (snapshots.Count == 2) { interpolationStartTime = Time.timeSinceLevelLoad; } else if (snapshots.Count >= 4) { snapshots.RemoveFirst(); TransformSnapshot value2 = snapshots.First.Value; value2.position = transform.position; value2.rotation = transform.rotation; value2.velocity = interpVelocity; value2.angularVelocity = interpAngularVelocity; interpolationStartTime = Time.timeSinceLevelLoad; } if (haveFirstSend) { lastSerializationFrequency = (float)(((PhotonMessageInfo)(ref info)).SentServerTimestamp - lastSendTimestamp) / 1000f; if (lastSerializationFrequency >= Settings.TimingThreshold.Value) { lastSerializationFrequency = (float)PhotonNetwork.serializationFrequency / 1000f; smoothUpdateFrequency = lastSerializationFrequency; } else { smoothUpdateFrequency = Mathf.Lerp(smoothUpdateFrequency, lastSerializationFrequency, Settings.RateSmoothing.Value); } } else { haveFirstSend = true; } lastSendTimestamp = ((PhotonMessageInfo)(ref info)).SentServerTimestamp; } } [BepInPlugin("BlueAmulet.REPONetworkTweaks", "REPONetworkTweaks", "1.0.3")] public class REPONetworkTweaks : BaseUnityPlugin { internal const string Name = "REPONetworkTweaks"; internal const string Author = "BlueAmulet"; internal const string ID = "BlueAmulet.REPONetworkTweaks"; internal const string Version = "1.0.3"; internal static ManualLogSource Log; public void Awake() { //IL_001b: 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) Log = ((BaseUnityPlugin)this).Logger; Settings.InitConfig(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("BlueAmulet.REPONetworkTweaks"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Applying Harmony patches"); val.PatchAll(Assembly.GetExecutingAssembly()); int num = 0; foreach (MethodBase patchedMethod in val.GetPatchedMethods()) { _ = patchedMethod; num++; } ((BaseUnityPlugin)this).Logger.LogInfo((object)(num + " patches applied")); } } internal static class Settings { internal static ConfigEntry<bool> DisableTimeout; internal static ConfigEntry<bool> PhotonLateUpdate; internal static ConfigEntry<bool> Extrapolate; internal static ConfigEntry<float> RateSmoothing; internal static ConfigEntry<float> Future; internal static ConfigEntry<float> TimingThreshold; public static void InitConfig(ConfigFile config) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown DisableTimeout = config.Bind<bool>("NetworkTweaks", "DisableTimeout", true, "Remove client sided Photon timeout"); PhotonLateUpdate = config.Bind<bool>("NetworkTweaks", "PhotonLateUpdate", true, "Run Photon networking in LateUpdate instead of FixedUpdate"); Extrapolate = config.Bind<bool>("NetworkTweaks", "Extrapolate", true, "Extrapolate position and rotations when out of data"); RateSmoothing = config.Bind<float>("NetworkTweaks", "RateSmoothing", 0.1f, new ConfigDescription("How much to smooth the guessed sending rate", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); Future = config.Bind<float>("NetworkTweaks", "Future", 1f, new ConfigDescription("How much to project data into the future", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); TimingThreshold = config.Bind<float>("NetworkTweaks", "TimingThreshold", 1f, "Threshold in seconds for when data is considered discontinuous"); } } } namespace REPONetworkTweaks.Patches { [HarmonyPatch(typeof(PhotonHandler))] internal static class PhotonHandlerPatch { [HarmonyPrefix] [HarmonyPatch("Awake")] public static void PrefixAwake() { if (Settings.PhotonLateUpdate.Value) { REPONetworkTweaks.Log.LogInfo((object)"Changing PhotonHandler to run in LateUpdate"); PhotonNetwork.MinimalTimeScaleToDispatchInFixedUpdate = float.PositiveInfinity; } } } [HarmonyPatch(typeof(PhotonTransformView))] internal static class PhotonTransformViewPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] public static void PostfixAwake(ref PhotonTransformView __instance) { if (SemiFunc.IsMultiplayer()) { ((Component)__instance).gameObject.AddComponent<PhotonTransformViewTweak>(); } } [HarmonyPrefix] [HarmonyPatch("OnPhotonSerializeView")] public static bool PrefixOnPhotonSerializeView(ref PhotonTransformView __instance, PhotonStream stream, PhotonMessageInfo info) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer()) { ((Component)__instance).GetComponent<PhotonTransformViewTweak>().OnPhotonSerializeView(stream, info); return false; } return true; } [HarmonyPrefix] [HarmonyPatch("Teleport")] public static bool PrefixTeleport(ref PhotonTransformView __instance, Vector3 _position, Quaternion _rotation) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer()) { ((Component)__instance).GetComponent<PhotonTransformViewTweak>().Teleport(_position, _rotation); return false; } return true; } [HarmonyPrefix] [HarmonyPatch("Update")] public static bool PrefixUpdate() { return !SemiFunc.IsMultiplayer(); } } [HarmonyPatch] internal static class TimeoutDisconnectPatch { private static readonly MethodInfo debugOut = AccessTools.PropertyGetter(typeof(PeerBase), "debugOut"); private static readonly MethodInfo EnqueueStatusCallback = AccessTools.Method(typeof(PeerBase), "EnqueueStatusCallback", (Type[])null, (Type[])null); [HarmonyTranspiler] [HarmonyPatch(typeof(EnetPeer), "SendOutgoingCommands")] internal static IEnumerable<CodeInstruction> TranspilerEnetPeer(IEnumerable<CodeInstruction> instructions) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown if (!Settings.DisableTimeout.Value) { return instructions; } List<CodeInstruction> list = new List<CodeInstruction>(instructions); bool flag = false; for (int i = 1; i < list.Count; i++) { CodeInstruction val = list[i]; if (val.opcode == OpCodes.Call && (MethodInfo)val.operand == debugOut && list[i + 1].opcode == OpCodes.Ldc_I4_2 && list[i - 3].opcode == OpCodes.Brfalse) { list.Insert(i - 2, new CodeInstruction(OpCodes.Br, list[i - 3].operand)); list[i - 3].opcode = OpCodes.Pop; list[i - 3].operand = null; flag = true; break; } } if (flag) { REPONetworkTweaks.Log.LogInfo((object)"Removed TimeoutDisconnect from EnetPeer"); } else { REPONetworkTweaks.Log.LogWarning((object)"Failed to locate patch to remove EnetPeer triggering TimeoutDisconnect"); } return list; } [HarmonyTranspiler] [HarmonyPatch(typeof(TPeer), "DispatchIncomingCommands")] internal static IEnumerable<CodeInstruction> TranspilerTPeer(IEnumerable<CodeInstruction> instructions) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown if (!Settings.DisableTimeout.Value) { return instructions; } List<CodeInstruction> list = new List<CodeInstruction>(instructions); bool flag = false; for (int i = 1; i < list.Count; i++) { CodeInstruction val = list[i]; if (val.opcode == OpCodes.Ldc_I4 && (int)val.operand == 1040 && list[i + 1].opcode == OpCodes.Call && (MethodInfo)list[i + 1].operand == EnqueueStatusCallback && list[i - 3].opcode == OpCodes.Brfalse) { list.Insert(i - 2, new CodeInstruction(OpCodes.Br, list[i - 3].operand)); list[i - 3].opcode = OpCodes.Pop; list[i - 3].operand = null; flag = true; break; } } if (flag) { REPONetworkTweaks.Log.LogInfo((object)"Removed TimeoutDisconnect from TPeer"); } else { REPONetworkTweaks.Log.LogWarning((object)"Failed to locate patch to remove TPeer triggering TimeoutDisconnect"); } return list; } } }
plugins/CoddingCat-ToggleMute/ToggleMute.dll
Decompiled 3 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Voice.Unity; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ToggleMute")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod for Repo")] [assembly: AssemblyFileVersion("0.0.5.0")] [assembly: AssemblyInformationalVersion("0.0.5+d2d866fd73d0e86b799bd7475b8582103b6a59b8")] [assembly: AssemblyProduct("ToggleMute")] [assembly: AssemblyTitle("ToggleMute")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.5.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 ToggleMute { [HarmonyPatch(typeof(PlayerVoiceChat), "OnDestroy")] internal class PushToMuteCleanupPatch { [HarmonyPrefix] private static void Prefix(PlayerVoiceChat __instance) { if (PushToMutePatch.playerRecorders.ContainsKey(__instance)) { PushToMutePatch.playerRecorders.Remove(__instance); PushToMutePatch.AnimateIconCoroutine = null; } else { Debug.Log((object)("PlayerVoiceChat OnDestroy: No recorder found for " + ((Component)__instance).GetComponent<PhotonView>().Owner.NickName + ".")); } } } [HarmonyPatch(typeof(PlayerVoiceChat), "Awake")] internal class PushToMuteInitPatch { [HarmonyPostfix] private static void Postfix(PlayerVoiceChat __instance) { PhotonView component = ((Component)__instance).GetComponent<PhotonView>(); Recorder component2 = ((Component)__instance).GetComponent<Recorder>(); if ((Object)(object)component != (Object)null && component.IsMine && (Object)(object)component2 != (Object)null) { PushToMutePatch.playerRecorders[__instance] = component2; } } } [BepInPlugin("com.coddingcat.togglemute", "ToggleMute", "1.0.0")] public class PushToMuteMod : BaseUnityPlugin { private Harmony harmony; private static GameObject hudCanvas; public AssetBundle muteIconBundle; public static PushToMuteMod Instance; public static ConfigEntry<KeyCode> MuteKey { get; private set; } public static ConfigEntry<float> SoundVolume { get; private set; } public static ConfigEntry<int> AnimationTime { get; private set; } private void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) Instance = this; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; BindCofigs(); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); harmony = new Harmony("com.coddingcat.pushtomute"); harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Push-to-Mute mod loaded! Key: {MuteKey.Value}"); SceneManager.sceneLoaded += OnSceneLoaded; } private void BindCofigs() { MuteKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "MuteKey", (KeyCode)109, "Key to toggle Push-to-Mute (Change in config file)"); SoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SoundVolume", 0.3f, "Volume of mute/unmute sound (0.0 - 1.0)"); AnimationTime = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Animation Duration", 200, "Duration of the mute icon animation in milliseconds."); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { PushToMutePatch.UpdateUI(PushToMutePatch.isMuted); } private void LogAssetNames(AssetBundle bundle) { if (!((Object)(object)bundle == (Object)null)) { string[] allAssetNames = bundle.GetAllAssetNames(); string[] array = allAssetNames; foreach (string text in array) { Debug.Log((object)("Asset in bundle: " + text)); } } } public static GameObject GetHudCanvas() { if ((Object)(object)hudCanvas == (Object)null) { hudCanvas = GameObject.Find("UI/HUD/HUD Canvas"); if ((Object)(object)hudCanvas == (Object)null) { Debug.LogError((object)"HUD Canvas not found"); } } return hudCanvas; } } [HarmonyPatch(typeof(PlayerVoiceChat), "Update")] internal class PushToMutePatch { public static Dictionary<PlayerVoiceChat, Recorder> playerRecorders = new Dictionary<PlayerVoiceChat, Recorder>(); private static GameObject muteIcon; private static GameObject cutLineIcon; private static Image muteIconImage; private static Image cutLineImage; private static Color muteIconColor; private static Color cutLineColor; private static AssetBundle muteIconBundle; private static AudioSource audioSource; private static AudioClip muteSound; private static AudioClip unmuteSound; public static PlayerVoiceChat instance; public static Coroutine AnimateIconCoroutine; public static bool isMuted = false; private static float t = 0f; public static void UpdateUI(bool Animation) { if ((Object)(object)muteIcon == (Object)null) { InitMuteIcon(); } isMuted = Animation; AnimateIconCoroutine = ((MonoBehaviour)PushToMuteMod.Instance).StartCoroutine(AnimateIcon()); } [HarmonyPostfix] private static void Postfix(PlayerVoiceChat __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) instance = __instance; if (!playerRecorders.TryGetValue(__instance, out var value)) { return; } KeyCode value2 = PushToMuteMod.MuteKey.Value; if ((Object)(object)muteIcon == (Object)null) { InitMuteIcon(); } if (!(bool)typeof(ChatManager).GetField("chatActive", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(ChatManager.instance)) { if (Input.GetKeyDown(value2)) { isMuted = !isMuted; audioSource.clip = (isMuted ? muteSound : unmuteSound); audioSource.Play(); value.TransmitEnabled = !isMuted; value.RecordingEnabled = !isMuted; } bool flag = AnimateIconCoroutine != null; bool flag2 = (t != 1f || !isMuted) && (t != 0f || isMuted); if (!flag && flag2) { AnimateIconCoroutine = ((MonoBehaviour)__instance).StartCoroutine(AnimateIcon()); } } } private static void InitMuteIcon() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) GameObject hudCanvas = PushToMuteMod.GetHudCanvas(); if ((Object)(object)hudCanvas == (Object)null) { return; } GameObject val = new GameObject("MuteIconContainer"); RectTransform val2 = val.AddComponent<RectTransform>(); ((Transform)val2).SetParent(hudCanvas.transform, false); Vector2 sizeDelta = default(Vector2); ((Vector2)(ref sizeDelta))..ctor(40f, 40f); val2.anchorMin = new Vector2(1f, 0f); val2.anchorMax = new Vector2(1f, 0f); val2.pivot = new Vector2(1f, 0f); val2.anchoredPosition = new Vector2(-10f, 10f); val2.sizeDelta = sizeDelta; muteIcon = new GameObject("MuteIcon"); RectTransform val3 = muteIcon.AddComponent<RectTransform>(); ((Transform)val3).SetParent((Transform)(object)val2); val3.pivot = new Vector2(0.5f, 0.5f); val3.anchoredPosition = Vector2.op_Implicit(Vector3.zero); val3.sizeDelta = sizeDelta; cutLineIcon = new GameObject("CutLine"); RectTransform val4 = cutLineIcon.AddComponent<RectTransform>(); ((Transform)val4).SetParent((Transform)(object)val2, false); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.zero; val4.pivot = Vector2.zero; val4.anchoredPosition = Vector2.op_Implicit(Vector3.zero); val4.sizeDelta = sizeDelta; muteIconImage = muteIcon.AddComponent<Image>(); cutLineImage = cutLineIcon.AddComponent<Image>(); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if ((Object)(object)muteIconBundle == (Object)null) { muteIconBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "togglemutebundle")); } if ((Object)(object)muteIconBundle != (Object)null) { Sprite val5 = muteIconBundle.LoadAsset<Sprite>("assets/unmuted.png"); Sprite val6 = muteIconBundle.LoadAsset<Sprite>("assets/cutLine.png"); muteSound = muteIconBundle.LoadAsset<AudioClip>("assets/on.ogg"); unmuteSound = muteIconBundle.LoadAsset<AudioClip>("assets/off.ogg"); if ((Object)(object)val5 != (Object)null && (Object)(object)val6 != (Object)null) { muteIconImage.sprite = val5; cutLineImage.sprite = val6; } } muteIconColor = ((Graphic)muteIconImage).color; cutLineColor = ((Graphic)cutLineImage).color; if ((Object)(object)audioSource == (Object)null) { audioSource = muteIcon.AddComponent<AudioSource>(); } audioSource.volume = PushToMuteMod.SoundVolume.Value; } private static IEnumerator AnimateIcon() { while (true) { if ((Object)(object)muteIcon == (Object)null || (Object)(object)muteIconImage == (Object)null) { AnimateIconCoroutine = null; yield break; } if (t == 1f && isMuted) { muteIcon.transform.localScale = Vector3.one; muteIconColor.a = 1f; ((Graphic)muteIconImage).color = muteIconColor; cutLineIcon.transform.localScale = Vector3.one; cutLineColor.a = 1f; ((Graphic)cutLineImage).color = cutLineColor; AnimateIconCoroutine = null; yield break; } if (t == 0f && !isMuted) { break; } if (PushToMuteMod.AnimationTime.Value == 0) { t = (isMuted ? 1f : 0f); } else { float animationTimeInSeconds = (float)PushToMuteMod.AnimationTime.Value * 0.001f; t = Mathf.MoveTowards(t, isMuted ? 1f : 0f, Time.deltaTime / animationTimeInSeconds); } float easeT = EaseInOut(t); muteIcon.transform.localScale = Vector3.Lerp(Vector3.zero, Vector3.one, easeT); cutLineIcon.transform.localScale = Vector3.Lerp(Vector3.zero, Vector3.one, easeT); muteIconColor = ((Graphic)muteIconImage).color; muteIconColor.a = Mathf.Lerp(0f, 1f, easeT); cutLineColor = ((Graphic)cutLineImage).color; cutLineColor.a = Mathf.Lerp(0f, 1f, easeT); ((Graphic)cutLineImage).color = cutLineColor; ((Graphic)muteIconImage).color = muteIconColor; yield return null; } muteIcon.transform.localScale = Vector3.zero; muteIconColor.a = 0f; ((Graphic)muteIconImage).color = muteIconColor; cutLineIcon.transform.localScale = Vector3.zero; cutLineColor.a = 0f; ((Graphic)cutLineImage).color = cutLineColor; AnimateIconCoroutine = null; } private static float EaseInOut(float t) { return t * t * (3f - 2f * t); } } public static class PluginInfo { public const string PLUGIN_GUID = "ToggleMute"; public const string PLUGIN_NAME = "ToggleMute"; public const string PLUGIN_VERSION = "0.0.5"; } }
plugins/discjenny-SkipToMenu/SkipToMenu.dll
Decompiled 3 months agousing System; using System.Diagnostics; 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("discjenny")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+34b99dd32c1b07af2cc7517769b09b9687a124b5")] [assembly: AssemblyProduct("SkipToMenu")] [assembly: AssemblyTitle("SkipToMenu")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 SkipToMenu { [BepInPlugin("discjenny.SkipToMenu", "SkipToMenu", "1.0")] public class SkipToMenu : BaseUnityPlugin { internal static SkipToMenu Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } [HarmonyPatch] public static class SkipToMenu_Patches { [HarmonyPatch(typeof(GameDirector), "gameStateStart")] [HarmonyPrefix] public static void GameDirector_gameStateStart_Prefix(GameDirector __instance) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 if ((Object)(object)RunManager.instance != (Object)null && (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelMainMenu && (int)__instance.currentState == 1 && __instance.gameStateStartImpulse) { __instance.gameStateTimer = 0f; } } [HarmonyPatch(typeof(MenuPageMain), "Start")] [HarmonyPostfix] public static void MenuPageMain_Start_Postfix(MenuPageMain __instance) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RunManager.instance != (Object)null) { RunManager.instance.skipLoadingUI = true; } if (!((Object)(object)__instance != (Object)null)) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(MenuPageMain), "doIntroAnimation"); if (fieldInfo != null) { fieldInfo.SetValue(__instance, false); } FieldInfo fieldInfo2 = AccessTools.Field(typeof(MenuPageMain), "rectTransform"); if (fieldInfo2 != null) { RectTransform val = (RectTransform)fieldInfo2.GetValue(__instance); if ((Object)(object)val != (Object)null) { ((Transform)val).localPosition = Vector3.zero; } } } [HarmonyPatch(typeof(MenuPageMain), "Update")] [HarmonyPrefix] public static void MenuPageMain_Update_Prefix(MenuPageMain __instance) { FieldInfo fieldInfo = AccessTools.Field(typeof(MenuPageMain), "popUpTimer"); if (fieldInfo != null) { float num = (float)fieldInfo.GetValue(__instance); if (num > 0f) { fieldInfo.SetValue(__instance, 0f); } } } [HarmonyPatch(typeof(CameraMainMenu), "Update")] [HarmonyPrefix] public static void CameraMainMenu_Update_Prefix(CameraMainMenu __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (!((Object)(object)GameDirector.instance != (Object)null) || (int)GameDirector.instance.currentState != 2) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(CameraMainMenu), "introLerp"); if (fieldInfo != null) { float num = (float)fieldInfo.GetValue(__instance); if (num < 1f) { fieldInfo.SetValue(__instance, 1f); } } } [HarmonyPatch(typeof(FadeOverlay), "Update")] [HarmonyPrefix] public static void FadeOverlay_Update_Prefix(FadeOverlay __instance) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (!((Object)(object)GameDirector.instance != (Object)null) || (int)GameDirector.instance.currentState != 2) { return; } FieldInfo fieldInfo = AccessTools.Field(typeof(FadeOverlay), "IntroLerp"); if (fieldInfo != null) { float num = (float)fieldInfo.GetValue(__instance); if (num < 1f) { fieldInfo.SetValue(__instance, 1f); } } } } }
plugins/khalliv-ShoppingListHUD/ShoppingListHUD.dll
Decompiled 3 months agousing System; 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.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("khalliv")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShoppingListHUD")] [assembly: AssemblyTitle("ShoppingListHUD")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 ShoppingListHUD { [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { ShoppingListHUD.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { ShoppingListHUD.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } [BepInPlugin("khalliv.ShoppingListHUD", "ShoppingListHUD", "1.0.2")] public class ShoppingListHUD : BaseUnityPlugin { internal static ConfigEntry<float> PositionOffsetX; internal static ConfigEntry<float> PositionOffsetY; internal static ShoppingListHUD Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); SetupConfigs(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(typeof(ShoppingListHUDPatches)); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal void CreateNetworkingObject() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)ShoppingListHUD_Networking.instance == (Object)null) { GameObject val = new GameObject("ShoppingListHUDNetworking"); val.AddComponent<ShoppingListHUD_Networking>(); } } private void SetupConfigs() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown PositionOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PositionX", 0f, new ConfigDescription("The X position for the Shopping List HUD", (AcceptableValueBase)null, Array.Empty<object>())); PositionOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PositionY", 0f, new ConfigDescription("The Y position for the Shopping List HUD", (AcceptableValueBase)null, Array.Empty<object>())); } } internal class ShoppingListHUDPatches { private const string header = "Shopping List"; internal static List<ShoppingListHUD_ItemData> shoppingListGroups = new List<ShoppingListHUD_ItemData>(); internal static int shoppingListCount = 0; private static bool currentTextSet = false; private static bool textResetToStatsUI = false; private static string headerColor = ColorUtility.ToHtmlStringRGB(new Color(0.6f, 0.6f, 0.45f)); private static string weaponsColor = ColorUtility.ToHtmlStringRGB(new Color(1f, 0.53f, 0.53f)); internal static string countsText = ""; internal static string namesText = ""; private static Dictionary<string, string> textColorsDict = new Dictionary<string, string> { { "HEALTH PACK", ColorUtility.ToHtmlStringRGB(new Color(0.5f, 1f, 0.5f)) }, { "UPGRADE", ColorUtility.ToHtmlStringRGB(new Color(0.4f, 0.8f, 1f)) }, { "CRYSTAL", ColorUtility.ToHtmlStringRGB(new Color(1f, 1f, 0.3f)) }, { "DRONE", ColorUtility.ToHtmlStringRGB(new Color(0.78f, 0.49f, 1f)) }, { "ORB", ColorUtility.ToHtmlStringRGB(new Color(0.78f, 0.49f, 1f)) }, { "TRACKER", ColorUtility.ToHtmlStringRGB(new Color(1f, 0.71f, 0.95f)) }, { "C.A.R.T", ColorUtility.ToHtmlStringRGB(new Color(1f, 0.71f, 0.23f)) } }; [HarmonyPatch(typeof(ShopManager), "ShopInitialize")] [HarmonyPostfix] private static void ShopManager_ShopInitialize_Postfix(ShopManager __instance) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.RunIsShop()) { ((TMP_Text)StatsUI.instance.upgradesHeader).text = "UPGRADES"; ((TMP_Text)StatsUI.instance.Text).rectTransform.sizeDelta = new Vector2(250f, 50f); return; } ((TMP_Text)StatsUI.instance.Text).rectTransform.sizeDelta = new Vector2(300f, 50f); currentTextSet = false; if (SemiFunc.IsMultiplayer() && (Object)(object)ShoppingListHUD_Networking.instance == (Object)null) { ShoppingListHUD.Instance.CreateNetworkingObject(); } } [HarmonyPatch(typeof(ShopManager), "ShopCheck")] [HarmonyPostfix] private static void ShopManager_ShopCheck_Postfix(ShopManager __instance) { if ((!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient()) && SemiFunc.RunIsShop()) { shoppingListGroups.Clear(); shoppingListCount = 0; if ((Object)(object)ShoppingListHUD_Networking.instance != (Object)null) { ShoppingListHUD_Networking.instance.UpdateShoppingList(shoppingListCount, "", ""); } } } [HarmonyPatch(typeof(ShopManager), "ShoppingListItemAdd")] [HarmonyPostfix] private static void ShoppingList_ShoppingListItemAdd_Postfix(ShopManager __instance) { if (!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient()) { currentTextSet = false; } } [HarmonyPatch(typeof(ShopManager), "ShoppingListItemRemove")] [HarmonyPostfix] private static void ShoppingList_ShoppingListItemRemove_Postfix(ShopManager __instance) { if (!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient()) { currentTextSet = false; } } [HarmonyPatch(typeof(StatsUI), "Update")] [HarmonyPrefix] private static bool StatsUI_Update_Prefix(StatsUI __instance) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.RunIsShop()) { return true; } bool flag = SemiFunc.IsMultiplayer() && SemiFunc.IsMasterClient(); if (__instance.showStatsTimer > 0f || ((SemiUI)__instance).showTimer > 0f) { OnMapOpenInShop(); return true; } textResetToStatsUI = false; if (Mathf.Abs(((Component)__instance).transform.position.x - (61f + ShoppingListHUD.PositionOffsetX.Value)) > 0.1f || Mathf.Abs(((Component)__instance).transform.position.y - (255f + ShoppingListHUD.PositionOffsetY.Value)) > 0.1f) { ((Component)__instance).transform.position = new Vector3(61f + ShoppingListHUD.PositionOffsetX.Value, 255f + ShoppingListHUD.PositionOffsetY.Value, 0f); } if (SemiFunc.IsMasterClientOrSingleplayer()) { if (!currentTextSet) { currentTextSet = true; UpdateShoppingList(); if (flag && (Object)(object)ShoppingListHUD_Networking.instance != (Object)null) { ShoppingListHUD_Networking.instance.UpdateShoppingList(shoppingListCount, countsText, namesText); } } } else if (!currentTextSet) { currentTextSet = true; if (shoppingListCount > 0) { SetUITexts(); } } ToggleTextComponents(shoppingListCount > 0); return false; } internal static void OnMapOpenInShop() { ResetTextToStatsUI(); ((TMP_Text)StatsUI.instance.upgradesHeader).text = "UPGRADES"; ToggleTextComponents(state: true); currentTextSet = false; } internal static void ToggleTextComponents(bool state) { StatsUI.instance.scanlineObject.SetActive(state); ((Component)StatsUI.instance.upgradesHeader).gameObject.SetActive(state); ((Behaviour)StatsUI.instance.upgradesHeader).enabled = true; ((Component)StatsUI.instance.textNumbers).gameObject.SetActive(state); ((Behaviour)StatsUI.instance.Text).enabled = state; } internal static void ResetTextToStatsUI() { if (!textResetToStatsUI) { StatsUI.instance.Fetch(); textResetToStatsUI = true; } } private static void UpdateShoppingList(bool tryUpdateShoppingListGroups = true) { if (!TryUpdateShoppingListGroups()) { return; } string text = ""; string text2 = ""; foreach (ShoppingListHUD_ItemData shoppingListGroup in shoppingListGroups) { text += $"<color=white>{shoppingListGroup.Count}x</color>\n"; string text3 = ""; foreach (KeyValuePair<string, string> item in textColorsDict) { if (shoppingListGroup.Name.IndexOf(item.Key, StringComparison.InvariantCultureIgnoreCase) >= 0) { text3 = item.Value; } } if (text3 == "") { text3 = weaponsColor; } text2 += $"<color=#{text3}>{shoppingListGroup.Name}</color> <b><color=white>=</color> $<color=white>{shoppingListGroup.Cost}</color></b>\n"; } countsText = text; namesText = text2; SetUITexts(); } internal static void SetShoppingListCountFromRPC(int count) { shoppingListCount = count; } internal static void SetUITexts() { ((TMP_Text)StatsUI.instance.upgradesHeader).text = ((shoppingListCount > 0) ? ("<color=#" + headerColor + ">Shopping List</color>") : ""); ((TMP_Text)StatsUI.instance.textNumbers).text = countsText; ((TMP_Text)StatsUI.instance.Text).text = namesText; } private static bool TryUpdateShoppingListGroups() { shoppingListGroups.Clear(); if ((Object)(object)ShopManager.instance == (Object)null || ShopManager.instance.shoppingList == null || ShopManager.instance.shoppingList.Count == 0) { shoppingListCount = 0; return false; } IOrderedEnumerable<ShoppingListHUD_ItemData> collection = from data in (from item in ShopManager.instance.shoppingList group item by item.itemName).Select(delegate(IGrouping<string, ItemAttributes> @group) { ShoppingListHUD_ItemData result = default(ShoppingListHUD_ItemData); result.Name = @group.Key; result.Count = @group.Count(); result.Cost = @group.Sum((ItemAttributes item) => item.value) * 1000; return result; }) orderby (textColorsDict.Keys.ToList().FindIndex((string key) => data.Name.IndexOf(key, StringComparison.InvariantCultureIgnoreCase) >= 0) == -1) ? int.MaxValue : textColorsDict.Keys.ToList().FindIndex((string key) => data.Name.IndexOf(key, StringComparison.InvariantCultureIgnoreCase) >= 0), data.Name select data; shoppingListGroups.AddRange(collection); shoppingListCount = shoppingListGroups.Count; return true; } } internal struct ShoppingListHUD_ItemData { public int Count; public string Name; public int Cost; } public class ShoppingListHUD_Networking : MonoBehaviourPunCallbacks { public static ShoppingListHUD_Networking instance; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } ((Component)this).gameObject.AddComponent<PhotonView>(); ((MonoBehaviourPun)this).photonView.ViewID = 223307; } internal void UpdateShoppingList(int shoppingListCount, string counts, string names) { ((MonoBehaviourPun)this).photonView.RPC("UpdateShoppingList_RPC", (RpcTarget)1, new object[3] { shoppingListCount, counts, names }); } [PunRPC] private void UpdateShoppingList_RPC(int shoppingListCount, string counts, string names) { ShoppingListHUDPatches.countsText = counts; ShoppingListHUDPatches.namesText = names; ShoppingListHUDPatches.SetShoppingListCountFromRPC(shoppingListCount); ShoppingListHUDPatches.SetUITexts(); } } }
plugins/LucydDemon-DisableItemsInShop/DisableItemsInShop/lucyddemon.disableitemsinshop.dll
Decompiled 3 months agousing System; 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.Configuration; using BepInEx.Logging; using DisableItemsInShop.Patches; using HarmonyLib; using Microsoft.CodeAnalysis; 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("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("LucydDemon")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.1.0")] [assembly: AssemblyInformationalVersion("1.3.1+e9e25cb731dcf0a2f4d46b943f003451b608e23c")] [assembly: AssemblyProduct("DisableItemsInShop")] [assembly: AssemblyTitle("lucyddemon.disableitemsinshop")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.3.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 DisableItemsInShop { internal class DisableItemsInShopConfig { public readonly ConfigEntry<string> Level; public readonly ConfigEntry<bool> Explosives; public readonly ConfigEntry<bool> Guns; public readonly ConfigEntry<bool> Melee; public readonly ConfigEntry<bool> RubberDuck; public readonly ConfigEntry<string> CustomItems; public DisableItemsInShopConfig(ConfigFile cfg) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown cfg.SaveOnConfigSet = false; Level = cfg.Bind<string>("General", "DisableLevel", "Shop", new ConfigDescription("Where should items be disabled", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "Shop", "Lobby", "Both" }), Array.Empty<object>())); Explosives = cfg.Bind<bool>("General", "DisableExplosives", true, (ConfigDescription)null); Guns = cfg.Bind<bool>("General", "DisableGuns", false, (ConfigDescription)null); Melee = cfg.Bind<bool>("General", "DisableMelees", false, (ConfigDescription)null); RubberDuck = cfg.Bind<bool>("General", "DisableRubberDuck", false, (ConfigDescription)null); CustomItems = cfg.Bind<string>("Custom", "DisableCustomItems", "", new ConfigDescription("Comma-separated list of item name patterns to disable. Only works for toggleable items like guns, mines, etc. (ex. Rifle, Drone, ...)", (AcceptableValueBase)null, Array.Empty<object>())); ClearOrphanedEntries(cfg); cfg.Save(); cfg.SaveOnConfigSet = true; } private static void ClearOrphanedEntries(ConfigFile cfg) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg); dictionary.Clear(); } } [BepInPlugin("lucyddemon.disableitemsinshop", "DisableItemsInShop", "1.3.1")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("lucyddemon.disableitemsinshop"); internal static Plugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal static DisableItemsInShopConfig BoundConfig { get; private set; } public static bool IsInDisabledLevel { get { bool flag = SemiFunc.RunIsShop(); bool flag2 = SemiFunc.RunIsLobby(); return BoundConfig.Level.Value switch { "Shop" => flag, "Lobby" => flag2, "Both" => flag || flag2, _ => false, }; } } private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; BoundConfig = new DisableItemsInShopConfig(((BaseUnityPlugin)this).Config); harmony.PatchAll(typeof(ItemTogglePatch)); harmony.PatchAll(typeof(ItemMeleePatch)); harmony.PatchAll(typeof(ItemRubberDuckPatch)); Logger.LogInfo((object)"DisableItemsInShop 1.3.1 by LucydDemon has loaded!"); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } internal static class MyPluginInfo { public const string PLUGIN_GUID = "lucyddemon.disableitemsinshop"; public const string PLUGIN_NAME = "DisableItemsInShop"; public const string PLUGIN_VERSION = "1.3.1"; public const string PLUGIN_AUTHOR = "LucydDemon"; } } namespace DisableItemsInShop.Patches { [HarmonyPatch(typeof(ItemMelee))] internal static class ItemMeleePatch { private static bool IsMeleeDisabled { get { if (Plugin.IsInDisabledLevel) { return Plugin.BoundConfig.Melee.Value; } return false; } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start_Postfix(ItemMelee __instance) { if (IsMeleeDisabled) { Plugin.Logger.LogDebug((object)("Disabled item usage: " + ((Object)__instance).name)); } } [HarmonyPatch("Update")] [HarmonyPrefix] private static bool Update_Prefix(ItemMelee __instance) { if (!IsMeleeDisabled) { return true; } return false; } } [HarmonyPatch(typeof(ItemRubberDuck))] internal static class ItemRubberDuckPatch { private static bool IsRubberDuckDisabled { get { if (Plugin.IsInDisabledLevel) { return Plugin.BoundConfig.RubberDuck.Value; } return false; } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start_Postfix(ItemRubberDuck __instance) { if (IsRubberDuckDisabled) { Plugin.Logger.LogDebug((object)("Disabled item usage: " + ((Object)__instance).name)); } } [HarmonyPatch("Quack")] [HarmonyPrefix] private static bool Quack_Prefix(ItemRubberDuck __instance) { if (!IsRubberDuckDisabled) { return true; } return false; } } [HarmonyPatch(typeof(ItemToggle))] internal static class ItemTogglePatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start_Postfix(ItemToggle __instance) { if (Plugin.IsInDisabledLevel) { string name = ((Object)__instance).name; DisableItemsInShopConfig boundConfig = Plugin.BoundConfig; if (ShouldDisableItem(name, boundConfig)) { __instance.ToggleDisable(true); Plugin.Logger.LogDebug((object)("Disabled item usage: " + name)); } } } private static bool ShouldDisableItem(string itemName, DisableItemsInShopConfig cfg) { bool flag = cfg.Explosives.Value && (itemName.StartsWith("Item Grenade") || itemName.StartsWith("Item Mine")); bool flag2 = cfg.Guns.Value && itemName.StartsWith("Item Gun"); bool flag3 = (from item in cfg.CustomItems.Value.Split(',') where !string.IsNullOrEmpty(item) select item.Trim().ToLower()).Any((string item) => itemName.ToLower().Contains(item)); return flag || flag2 || flag3; } } }
plugins/nickklmao-PlayerCount/PlayerCount.dll
Decompiled 3 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PlayerCount")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PlayerCount")] [assembly: AssemblyTitle("PlayerCount")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] 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 PlayerCount { [BepInPlugin("nickklmao.playercount", "Player Count", "1.0.0")] internal sealed class Entry : BaseUnityPlugin { private const string MOD_NAME = "Player Count"; internal static readonly ManualLogSource logger = Logger.CreateLogSource("Player Count"); private static void MenuPageLobby_AwakeHook(Action<MenuPageLobby> orig, MenuPageLobby self) { //IL_0037: 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) orig(self); Transform obj = Object.Instantiate<Transform>(((Component)self).transform.Find("Menu Button - Leave/ButtonText"), ((Component)self).transform.Find("Panel")); obj.localPosition = new Vector3(-154f, 10f); TextMeshProUGUI component = ((Component)obj).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).alignment = (TextAlignmentOptions)516; ((TMP_Text)component).fontSize = 20f; ((Graphic)component).color = Color.white; ((Component)obj).gameObject.AddComponent<PlayerCountBehavior>().tmp = component; } private static void MenuPageEsc_AwakeHook(Action<MenuPageEsc> orig, MenuPageEsc self) { //IL_0037: 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) orig(self); Transform obj = Object.Instantiate<Transform>(((Component)self).transform.Find("Menu Button - Settings/ButtonText"), ((Component)self).transform.Find("Panel")); obj.localPosition = new Vector3(396f, -44.5f); TextMeshProUGUI component = ((Component)obj).GetComponent<TextMeshProUGUI>(); ((TMP_Text)component).alignment = (TextAlignmentOptions)513; ((TMP_Text)component).fontSize = 20f; ((Graphic)component).color = Color.white; ((Component)obj).gameObject.AddComponent<PlayerCountBehavior>().tmp = component; } private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) logger.LogDebug((object)"Hooking `MenuPageLobby.Awake`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageLobby), "Awake", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageLobby>, MenuPageLobby>(MenuPageLobby_AwakeHook)); logger.LogDebug((object)"Hooking `MenuPageEsc.Start`"); new Hook((MethodBase)AccessTools.Method(typeof(MenuPageEsc), "Start", (Type[])null, (Type[])null), (Delegate)new Action<Action<MenuPageEsc>, MenuPageEsc>(MenuPageEsc_AwakeHook)); } } internal sealed class PlayerCountBehavior : MonoBehaviour { internal TextMeshProUGUI tmp; private void Update() { if (Object.op_Implicit((Object)(object)tmp)) { Room currentRoom = PhotonNetwork.CurrentRoom; ((TMP_Text)tmp).text = $"Players: {((currentRoom != null) ? currentRoom.PlayerCount : 0)}/{((currentRoom != null) ? currentRoom.MaxPlayers : 6)}"; } } } }
plugins/PxntxrezStudio-No_Save_Delete/NoSaveDelete.dll
Decompiled 3 months agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("NoSaveDeleteMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NoSaveDeleteMod")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("194122da-d5ca-4c8a-b922-4931bcfb19f6")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [HarmonyPatch(typeof(PlayerAvatar), "PlayerDeathRPC")] public class AutoLoadMultiplayer { private static async void Postfix() { if (!MyModConfig.AutoLoadInMultiplayer.Value) { Debug.Log((object)"[NoSaveDelete] Auto-load disabled due to AutoLoadInMultiplayer being enabled."); } else { if (!SemiFunc.IsMultiplayer() || !PhotonNetwork.IsMasterClient) { return; } FieldInfo deadSetField = AccessTools.Field(typeof(PlayerAvatar), "deadSet"); List<PlayerAvatar> players = SemiFunc.PlayerGetList(); bool allDead = true; foreach (PlayerAvatar player in players) { if (!(bool)deadSetField.GetValue(player)) { Debug.Log((object)"[NoSaveDelete] Not all players are dead. Reload is not performed."); allDead = false; break; } } if (allDead) { FieldInfo saveFileField = AccessTools.Field(typeof(StatsManager), "saveFileCurrent"); string saveFileName = (string)saveFileField.GetValue(StatsManager.instance); if (string.IsNullOrEmpty(saveFileName)) { Debug.LogWarning((object)"[NoSaveDelete] No save file to load!"); } else if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelShop) { Debug.Log((object)"[NoSaveDelete] All players died in the SHOP. Restarting save WITHOUT restoring backup..."); await Task.Delay(650); SemiFunc.MenuActionSingleplayerGame(saveFileName); } else { Debug.Log((object)"[NoSaveDelete] All players died. Restoring backup..."); RestoreBackup(saveFileName); await Task.Delay(650); SemiFunc.MenuActionSingleplayerGame(saveFileName); } } } } private static void RestoreBackup(string saveFileName) { string text = Path.Combine(Application.persistentDataPath, "saves", saveFileName); if (!Directory.Exists(text)) { Debug.LogError((object)("[NoSaveDelete] Save folder not found: " + text)); return; } string text2 = FindLatestBackup(text, saveFileName); if (!string.IsNullOrEmpty(text2)) { try { string text3 = Path.Combine(text, saveFileName + ".es3"); if (File.Exists(text3)) { File.Delete(text3); } File.Move(text2, text3); Debug.Log((object)("[NoSaveDelete] Backup restored from: " + text2)); return; } catch (IOException ex) { Debug.LogError((object)("[NoSaveDelete] Restore error: " + ex.Message)); return; } } Debug.LogWarning((object)"[NoSaveDelete] No valid backup found!"); } private static string FindLatestBackup(string directory, string saveFileName) { if (!Directory.Exists(directory)) { return null; } string[] files = Directory.GetFiles(directory, saveFileName + "_BACKUP*.es3"); if (files.Length == 0) { return null; } Regex regex = new Regex("_BACKUP(\\d+)", RegexOptions.IgnoreCase); return (from file in files select new { FilePath = file, BackupNumber = ExtractBackupNumber(file, regex) } into b where b.BackupNumber >= 0 orderby b.BackupNumber descending select b).FirstOrDefault()?.FilePath; } private static int ExtractBackupNumber(string filePath, Regex regex) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath); Match match = regex.Match(fileNameWithoutExtension); if (match.Success && int.TryParse(match.Groups[1].Value, out var result)) { return result; } return -1; } } [HarmonyPatch(typeof(GameDirector), "Update")] public class CheckArenaAndRestoreBackup { private static bool shouldRestoreBackup; private static bool hasLoggedArena; private static void Postfix(GameDirector __instance) { if (!MyModConfig.AutoLoadInMultiplayer.Value && SemiFunc.IsMultiplayer() && PhotonNetwork.IsMasterClient) { bool flag = (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelArena; bool flag2 = (Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelLobbyMenu; if (flag && !hasLoggedArena) { hasLoggedArena = true; shouldRestoreBackup = true; Debug.Log((object)"[NoSaveDelete] The game is on the arena. Enabling backup restoration after returning to the lobby."); } if (shouldRestoreBackup && flag2) { shouldRestoreBackup = false; hasLoggedArena = false; DelayedRestoreBackup(); } } } private static async Task DelayedRestoreBackup() { Debug.Log((object)"[NoSaveDelete] Waiting 3 seconds before restoring the backup..."); await Task.Delay(3000); RestoreBackup(); } private static void RestoreBackup() { FieldInfo fieldInfo = AccessTools.Field(typeof(StatsManager), "saveFileCurrent"); string text = (string)fieldInfo.GetValue(StatsManager.instance); if (string.IsNullOrEmpty(text)) { Debug.LogWarning((object)"[NoSaveDelete] No active save file!"); return; } string text2 = Path.Combine(Application.persistentDataPath, "saves", text); if (!Directory.Exists(text2)) { Debug.LogError((object)("[NoSaveDelete] Save folder not found: " + text2)); return; } string text3 = FindLatestBackup(text2, text); if (!string.IsNullOrEmpty(text3)) { try { string text4 = Path.Combine(text2, text + ".es3"); if (File.Exists(text4)) { File.Delete(text4); } File.Move(text3, text4); Debug.Log((object)("[NoSaveDelete] Backup successfully restored from: " + text3)); MethodInfo method = typeof(StatsManager).GetMethod("LoadGame", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(StatsManager.instance, new object[1] { text }); Debug.Log((object)("[NoSaveDelete] Called LoadGame() for " + text + ", data updated in memory.")); } else { Debug.LogWarning((object)"[NoSaveDelete] Unable to find LoadGame method for reflection call!"); } return; } catch (IOException ex) { Debug.LogError((object)("[NoSaveDelete] Restore error: " + ex.Message)); return; } } Debug.LogWarning((object)"[NoSaveDelete] No backup found! Using the standard save."); } private static string FindLatestBackup(string directory, string saveFileName) { if (!Directory.Exists(directory)) { Debug.LogError((object)"[NoSaveDelete] Save directory is empty or does not exist!"); return null; } string[] files = Directory.GetFiles(directory, saveFileName + "_BACKUP*.es3"); if (files.Length == 0) { Debug.LogWarning((object)"[NoSaveDelete] No backup files found."); return null; } Regex regex = new Regex("_BACKUP(\\d+)", RegexOptions.IgnoreCase); var anon = (from file in files select new { FilePath = file, BackupNumber = ExtractBackupNumber(file, regex) } into b where b.BackupNumber >= 0 orderby b.BackupNumber descending select b).FirstOrDefault(); if (anon == null) { Debug.LogWarning((object)"[NoSaveDelete] Unable to determine the latest backup."); return null; } Debug.Log((object)$"[NoSaveDelete] Selected backup: {anon.FilePath} (number {anon.BackupNumber})"); return anon.FilePath; } private static int ExtractBackupNumber(string filePath, Regex regex) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(filePath); Match match = regex.Match(fileNameWithoutExtension); if (match.Success && int.TryParse(match.Groups[1].Value, out var result)) { return result; } return -1; } public static void ResetFlags() { shouldRestoreBackup = false; hasLoggedArena = false; Debug.Log((object)"[NoSaveDelete] Backup flags have been reset."); } } [HarmonyPatch(typeof(RunManager), "LeaveToMainMenu")] public class ResetBackupFlagsOnMainMenuLeave { private static void Prefix() { object value = AccessTools.Field(typeof(CheckArenaAndRestoreBackup), "shouldRestoreBackup").GetValue(null); bool flag = default(bool); int num; if (value is bool) { flag = (bool)value; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { CheckArenaAndRestoreBackup.ResetFlags(); Debug.Log((object)"[NoSaveDelete] The host has left the arena and returned to the main menu. Resetting flags..."); } else { Debug.Log((object)"[NoSaveDelete] Returning to the main menu. Flags were not set — no reset needed."); } } } [HarmonyPatch(typeof(PlayerAvatar), "PlayerDeath")] public class AutoLoadSingleplayer { [HarmonyPatch(typeof(PlayerAvatar), "Revive")] public class CancelAutoLoadOnRevive { private static void Prefix() { if (_cancellationTokenSource != null) { _cancellationTokenSource.Cancel(); Debug.Log((object)"[NoSaveDelete] Player revived. Auto-load canceled."); } } } private static CancellationTokenSource _cancellationTokenSource; private static async void Prefix() { if (MyModConfig.AllowGameDelete.Value) { Debug.Log((object)"[NoSaveDelete] Auto-load disabled due to AllowGameDelete being enabled."); } else { if (SemiFunc.IsMultiplayer()) { return; } FieldInfo saveFileField = AccessTools.Field(typeof(StatsManager), "saveFileCurrent"); string saveFileName = (string)saveFileField.GetValue(StatsManager.instance); if (!string.IsNullOrEmpty(saveFileName)) { Debug.Log((object)("[NoSaveDelete] The player has died. Reloading the last save: " + saveFileName)); _cancellationTokenSource?.Cancel(); _cancellationTokenSource = new CancellationTokenSource(); CancellationToken token = _cancellationTokenSource.Token; try { await Task.Delay(4000, token); if (!token.IsCancellationRequested) { SemiFunc.MenuActionSingleplayerGame(saveFileName); } return; } catch (TaskCanceledException) { Debug.Log((object)"[NoSaveDelete] Auto-load was canceled because the player revived."); return; } } Debug.LogWarning((object)"[NoSaveDelete] No save file to load!"); } } } public static class MyModConfig { public static ConfigEntry<bool> AllowPlayerDelete; public static ConfigEntry<bool> AllowGameDelete; public static ConfigEntry<bool> AutoLoadInMultiplayer; public static void Init(ConfigFile config) { AllowPlayerDelete = config.Bind<bool>("Settings", "AllowPlayerDelete", true, "Allow the player to delete saves? (true - yes, false - no)"); AllowGameDelete = config.Bind<bool>("Settings", "AllowGameDelete", false, "Allow the game to delete saves? (true - yes, false - no)"); AutoLoadInMultiplayer = config.Bind<bool>("Settings", "AutoLoadInMultiplayer", false, "Enable automatically load the last save in Multiplayer if ALL players die? (true - yes, false - no)"); } } [HarmonyPatch(typeof(MenuPageSaves), "OnDeleteGame")] public class MenuPageSavesPatch { public static bool IsPlayerDeletingSave; private static bool Prefix() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)$"Attempt to delete the save. AllowPlayerDelete = {MyModConfig.AllowPlayerDelete.Value}"); if (!MyModConfig.AllowPlayerDelete.Value) { Debug.Log((object)"The player is not allowed to delete the save (config prohibits it)."); MenuManager.instance.PagePopUp("Delete blocked.", Color.red, "You cannot delete the save. Please change the mod config.", "OK"); return false; } Debug.Log((object)"The player is deleting the save."); IsPlayerDeletingSave = true; return true; } } [BepInPlugin("com.pxntxrez.nosavedelete", "NoSaveDeleteMod", "1.2.4")] public class MyMod : BaseUnityPlugin { private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown MyModConfig.Init(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("com.pxntxrez.nosavedelete"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod NoSaveDelete loaded."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Settings can be changed in BepInEx/config/com.pxntxrez.nosavedelete.cfg"); } } [HarmonyPatch(typeof(StatsManager), "SaveFileDelete")] public class SaveFileDeletePatch { private static bool Prefix(string saveFileName) { if (MenuPageSavesPatch.IsPlayerDeletingSave) { Debug.Log((object)("Player delete save " + saveFileName + ".")); MenuPageSavesPatch.IsPlayerDeletingSave = false; return true; } if (MyModConfig.AllowGameDelete.Value) { Debug.Log((object)("Game delete save " + saveFileName + " (allowed by config).")); return true; } Debug.Log((object)("The game tried to delete the save " + saveFileName + ", but the mod blocked it.")); return false; } } [HarmonyPatch(typeof(StatsManager), "SaveGame")] public class PreventSaveGameUltimate { private static bool Prefix(ref string fileName) { if (MyModConfig.AllowGameDelete.Value) { return true; } if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelArena) { Debug.Log((object)"[NoSaveDelete] Blocking loss of items, charges, HP, and more has been activated! Because AllowGameDelete = false!"); return false; } return true; } }
plugins/SaturnKai-Dead_Map_Access/DeadMapAccess.dll
Decompiled 3 months agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; 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("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("SaturnKai")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.4.0")] [assembly: AssemblyInformationalVersion("1.0.4+a79dee4aa0fca7a6cd5ff757e184d547a209136b")] [assembly: AssemblyProduct("DeadMapAccess")] [assembly: AssemblyTitle("DeadMapAccess")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.4.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 DeadMapAccess { internal static class Configuration { internal static Color borderColor = Color32.op_Implicit(new Color32((byte)19, (byte)19, (byte)19, byte.MaxValue)); internal static ConfigEntry<float> width = null; internal static ConfigEntry<float> height = null; internal static ConfigEntry<int> borderSize = null; internal static ConfigEntry<bool> toggle = null; internal static ConfigEntry<bool> showUpgrades = null; internal static ConfigEntry<bool> hideValuables = null; internal static void Init(ConfigFile config) { width = config.Bind<float>("General", "Width", 600f, "The width of the map."); height = config.Bind<float>("General", "Height", 600f, "The height of the map."); borderSize = config.Bind<int>("General", "Border", 6, "The size of the map border."); toggle = config.Bind<bool>("General", "Toggle", false, "Set the map to toggle instead of hold."); showUpgrades = config.Bind<bool>("General", "ShowUpgrades", true, "Show upgrades while the map is shown."); hideValuables = config.Bind<bool>("Host", "HideValuables", false, "Force hide valuables on the map for all spectating players (only works when you are host)."); } } [BepInPlugin("dev.saturnkai.deadmapaccess", "DeadMapAccess", "1.0.4")] public class DeadMap : BaseUnityPlugin { internal static RenderTexture? renderTexture = null; internal static Camera? camera = null; internal static float cameraOrthographicDefault = 2.5f; internal static bool spectating = false; internal static bool hideValuables = false; private bool active; private bool activePrev; private readonly float scaleSpeed = 5f; private float scale = 0.5f; private float targetScale = 1f; private readonly float zoomSpeed = 0.2f; private readonly float zoomMin = 1f; private readonly float zoomMax = 20f; internal static DeadMap Instance { get; private set; } = null; internal static ManualLogSource Logger => Instance._logger; internal Harmony? Harmony { get; set; } private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0054: Expected O, but got Unknown Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Configuration.Init(((BaseUnityPlugin)this).Config); if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) if (Configuration.toggle.Value && spectating) { if (SemiFunc.InputDown((InputKey)8)) { active = !active; } } else if (spectating) { active = SemiFunc.InputHold((InputKey)8); } targetScale = (active ? 1f : 0.5f); scale = Mathf.Lerp(scale, targetScale, Time.deltaTime * scaleSpeed); if (!spectating || !((Object)(object)SpectateCamera.instance != (Object)null) || (int)SpectateCamera.instance.currentState != 1) { return; } Transform transform = ((Component)SpectateCamera.instance).transform; if ((Object)(object)DirtFinderMapPlayer.Instance.PlayerTransform == (Object)null) { Logger.LogWarning((object)"DirtFinderMapPlayer transform null."); DirtFinderMapPlayer.Instance.PlayerTransform = new GameObject().transform; } DirtFinderMapPlayer.Instance.PlayerTransform.position = transform.position; Transform playerTransform = DirtFinderMapPlayer.Instance.PlayerTransform; Quaternion rotation = transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; rotation = transform.rotation; playerTransform.rotation = Quaternion.Euler(0f, y, ((Quaternion)(ref rotation)).eulerAngles.z); PlayerController.instance.playerAvatarScript.LastNavmeshPosition = SpectateCamera.instance.player.LastNavmeshPosition; if (active && Configuration.showUpgrades.Value) { ((SemiUI)StatsUI.instance).Show(); } if (active) { float num = SemiFunc.InputScrollY() * 0.01f; if (num != 0f && (Object)(object)camera != (Object)null) { Camera? obj = camera; obj.orthographicSize -= num * zoomSpeed; camera.orthographicSize = Mathf.Clamp(camera.orthographicSize, zoomMin, zoomMax); } } } private void OnGUI() { //IL_013d: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (!spectating) { return; } if (active != activePrev) { activePrev = active; Sound val = (activePrev ? PlayerAvatar.instance.mapToolController.SoundStart : PlayerAvatar.instance.mapToolController.SoundStop); if ((Object)(object)SpectateCamera.instance != (Object)null) { val.Play(((Component)SpectateCamera.instance).transform.position, 1f, 1f, 1f, 1f); } } Map.Instance.Active = active; if (!active) { targetScale = 0.5f; return; } CameraTopFade.Instance.Set(0.5f, 0.1f); float num = Configuration.width.Value * scale; float num2 = Configuration.height.Value * scale; float num3 = ((float)Screen.width - num) / 2f; float num4 = ((float)Screen.height - num2) / 2f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num3 - (float)Configuration.borderSize.Value, num4 - (float)Configuration.borderSize.Value, num + (float)(Configuration.borderSize.Value * 2), num2 + (float)(Configuration.borderSize.Value * 2)); GUI.color = Configuration.borderColor; GUI.DrawTexture(val2, (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.DrawTexture(new Rect(num3, num4, num, num2), (Texture)(object)renderTexture, (ScaleMode)0, false); } internal static void SetSpectating(bool isSpectating) { spectating = isSpectating; if ((Object)(object)camera != (Object)null) { camera.orthographicSize = cameraOrthographicDefault; } if (hideValuables) { MapValuable[] componentsInChildren = ((Component)Map.Instance.OverLayerParent).GetComponentsInChildren<MapValuable>(true); MapValuable[] array = componentsInChildren; foreach (MapValuable val in array) { ((Component)val).gameObject.SetActive(!spectating); } } } } internal class NetworkController : MonoBehaviourPun { [PunRPC] internal void HideValuables() { if (!DeadMap.hideValuables) { DeadMap.hideValuables = true; DeadMap.Logger.LogInfo((object)"Valuables set to hidden."); } } } } namespace DeadMapAccess.patches { [HarmonyPatch(typeof(DirtFinderMapPlayer))] internal static class DirtFinderMapPlayerPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(DirtFinderMapPlayer __instance) { Camera componentInChildren = ((Component)__instance).GetComponentInChildren<Camera>(); if (((Object)componentInChildren).name != "Dirt Finder Map Camera") { DeadMap.Logger.LogWarning((object)"Dirt Finder Map Camera not found in map children."); } else if ((Object)(object)DeadMap.camera == (Object)null) { DeadMap.camera = componentInChildren; DeadMap.cameraOrthographicDefault = componentInChildren.orthographicSize; } } } [HarmonyPatch(typeof(GameDirector))] internal static class GameDirectorPatch { [HarmonyPrefix] [HarmonyPatch("Revive")] private static void Revive_Prefix() { if (DeadMap.spectating) { DeadMap.SetSpectating(isSpectating: false); } } [HarmonyPrefix] [HarmonyPatch("gameStateStart")] private static void GameStateStart_Prefix() { if (SemiFunc.IsMasterClient() && Configuration.hideValuables.Value) { NetworkController component = ((Component)Map.Instance).gameObject.GetComponent<NetworkController>(); if ((Object)(object)component == (Object)null) { DeadMap.Logger.LogWarning((object)"Failed to send hide valuables event: Network controller is null."); return; } ((MonoBehaviourPun)component).photonView.RPC("HideValuables", (RpcTarget)0, new object[0]); } if (DeadMap.spectating) { DeadMap.SetSpectating(isSpectating: false); } } } [HarmonyPatch(typeof(Map))] internal static class MapPatch { [HarmonyPostfix] [HarmonyPatch("Awake")] private static void Awake_Postfix(Map __instance) { if ((Object)(object)((Component)__instance).gameObject.GetComponent<NetworkController>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<NetworkController>(); } } [HarmonyPostfix] [HarmonyPatch("AddValuable")] private static void AddValuable_Postfix(Map __instance) { if (DeadMap.spectating && DeadMap.hideValuables) { MapValuable[] componentsInChildren = ((Component)__instance.OverLayerParent).GetComponentsInChildren<MapValuable>(); MapValuable[] array = componentsInChildren; foreach (MapValuable val in array) { ((Component)val).gameObject.SetActive(false); } } } } [HarmonyPatch(typeof(PlayerAvatar))] internal static class PlayerAvatarPatch { [HarmonyPrefix] [HarmonyPatch("SetSpectate")] private static void SetSpectate_Prefix() { Map.Instance.ActiveParent.SetActive(true); if ((Object)(object)DeadMap.camera != (Object)null) { ((MonoBehaviour)Map.Instance).StartCoroutine(LoadRenderTexture(DeadMap.camera)); } } private static IEnumerator LoadRenderTexture(Camera camera) { RenderTexture activeTexture = camera.activeTexture; while ((Object)(object)activeTexture == (Object)null) { yield return null; activeTexture = camera.activeTexture; } DeadMap.renderTexture = activeTexture; DeadMap.Logger.LogInfo((object)"Loaded map render texture."); } } [HarmonyPatch(typeof(RoundDirector))] internal static class RoundDirectorPatch { [HarmonyPostfix] [HarmonyPatch("StartRound")] private static void StartRound_Postfix() { DeadMap.hideValuables = false; } } [HarmonyPatch(typeof(SpectateCamera))] internal static class SpectateCameraPatch { [HarmonyPrefix] [HarmonyPatch("StateNormal")] private static void StateNormal_Prefix() { if ((SemiFunc.RunIsLevel() || SemiFunc.RunIsShop()) && !DeadMap.spectating && (Object)(object)SpectateCamera.instance.player != (Object)null) { DeadMap.SetSpectating(isSpectating: true); } } } }
plugins/Snowlance-NoDamageInShop/NoDamageInShop.dll
Decompiled 3 months agousing System; using System.Diagnostics; 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NoDamageInShop")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9e23f68e87b4e00530b9caa95b9807625eb768d9")] [assembly: AssemblyProduct("NoDamageInShop")] [assembly: AssemblyTitle("NoDamageInShop")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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; } } } [BepInPlugin("Snowlance.NoDamageInShop", "NoDamageInShop", "1.0.1")] public class Plugin : BaseUnityPlugin { public const string modGUID = "Snowlance.NoDamageInShop"; public const string modName = "NoDamageInShop"; public const string modVersion = "1.0.1"; public static Plugin PluginInstance; public static ManualLogSource LoggerInstance; private readonly Harmony harmony = new Harmony("Snowlance.NoDamageInShop"); public void Awake() { if ((Object)(object)PluginInstance == (Object)null) { PluginInstance = this; } LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger; harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.NoDamageInShop v1.0.1 has loaded!"); } } namespace NoDamageInShop { [HarmonyPatch] public class PlayerHealthPatch { private static ManualLogSource logger = Plugin.LoggerInstance; [HarmonyPrefix] [HarmonyPatch(typeof(PlayerHealth), "Hurt")] public static bool HurtPrefix() { if ((Object)(object)RunManager.instance.levelCurrent == (Object)(object)RunManager.instance.levelShop) { if (ChatManager.instance.betrayalActive) { return true; } return false; } return true; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
plugins/toejune-NoBackgroundHover/NoBackgroundHover.dll
Decompiled 3 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using NoBackgroundHover.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("NoBackgroundHover")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("toejune")] [assembly: AssemblyProduct("NoBackgroundHover")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("563263f8-d8ed-4f62-9416-c31df24326f5")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace NoBackgroundHover { [BepInPlugin("toejune.NoBackgroundHover", "NoBackgroundHover", "1.0")] public class NoBackgroundHoverBase : BaseUnityPlugin { private const string modGUID = "toejune.NoBackgroundHover"; private const string modName = "NoBackgroundHover"; private const string modVersion = "1.0"; private readonly Harmony harmony = new Harmony("toejune.NoBackgroundHover"); private static NoBackgroundHoverBase Instance; internal static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("toejune.NoBackgroundHover"); mls.LogInfo((object)"NoBackgroundHover started."); harmony.PatchAll(typeof(NoBackgroundHoverBase)); harmony.PatchAll(typeof(NoBackgroundHover.Patches.NoBackgroundHover)); harmony.PatchAll(typeof(NoBackgroundHover_Stub)); } } } namespace NoBackgroundHover.Patches { [HarmonyPatch(typeof(MenuHolder))] internal class NoBackgroundHover { private static bool _focused = false; private static bool _lastFocused = true; private static bool _menuButtonsInitialized = false; private static bool _menuElementsHoverInitialized = false; [DllImport("user32.dll")] private static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll")] private static extern IntPtr GetActiveWindow(); private static bool IsGameFocused() { return GetForegroundWindow() == GetActiveWindow(); } [HarmonyPatch(typeof(MenuHolder), "Start")] [HarmonyPostfix] public static void Start(MenuHolder __instance) { HandleFocus(ref __instance); } [HarmonyPatch(typeof(MenuHolder), "Update")] [HarmonyPrefix] public static void Update_Prefix(MenuHolder __instance) { HandleFocus(ref __instance); } private static void HandleFocus(ref MenuHolder instance, bool forceUpdate = false) { if (!_menuButtonsInitialized) { _menuButtonsInitialized = Initialize<MenuButton, NoBackgroundHover_Stub>(ref instance, zeroCheck: true); } if (!_menuElementsHoverInitialized) { _menuElementsHoverInitialized = Initialize<MenuElementHover, NoBackgroundHover_Stub>(ref instance, zeroCheck: false); } if (!_menuButtonsInitialized || !_menuElementsHoverInitialized) { return; } _focused = IsGameFocused(); if (_focused != _lastFocused || forceUpdate) { MenuElementHover[] componentsInChildren = ((Component)instance).GetComponentsInChildren<MenuElementHover>(); foreach (MenuElementHover val in componentsInChildren) { ((Behaviour)val).enabled = _focused; } MenuButton[] componentsInChildren2 = ((Component)instance).GetComponentsInChildren<MenuButton>(); foreach (MenuButton val2 in componentsInChildren2) { ((Behaviour)val2).enabled = _focused; } _lastFocused = _focused; } } private static bool Initialize<TFind, TTarget>(ref MenuHolder instance, bool zeroCheck = true) where TFind : Component { int num = 0; int num2 = ((Component)instance).GetComponentsInChildren<TFind>().Length; TFind[] componentsInChildren = ((Component)instance).GetComponentsInChildren<TFind>(); foreach (TFind val in componentsInChildren) { GameObject gameObject = ((Component)val).gameObject; NoBackgroundHover_Stub noBackgroundHover_Stub = gameObject.GetComponent<NoBackgroundHover_Stub>(); if (!Object.op_Implicit((Object)(object)noBackgroundHover_Stub)) { noBackgroundHover_Stub = gameObject.AddComponent<NoBackgroundHover_Stub>(); } if (noBackgroundHover_Stub.IsInitialized()) { num++; } } return num == num2 && ((zeroCheck && num2 != 0) || !zeroCheck); } } [HarmonyPatch(typeof(MenuButton))] internal class NoBackgroundHover_Stub : MonoBehaviour { private static bool _initialized; [DllImport("user32.dll")] private static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll")] private static extern IntPtr GetActiveWindow(); private static bool IsGameFocused() { return GetForegroundWindow() == GetActiveWindow(); } public bool IsInitialized() { return _initialized; } [HarmonyPatch(typeof(MenuButton), "Awake")] [HarmonyPostfix] public static void Awake_Postfix(MenuButton __instance) { ((Behaviour)__instance).enabled = IsGameFocused(); _initialized = true; } } }