using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using Sonigon.Internal; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("NoxyMathEngine")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.5.2.0")] [assembly: AssemblyInformationalVersion("0.5.2")] [assembly: AssemblyProduct("NoxyMathEngine")] [assembly: AssemblyTitle("NoxyMathEngine")] [assembly: AssemblyVersion("0.5.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 NoxyMathEngine { [BepInPlugin("com.noxy.rounds.mathengine", "Noxy Math Engine", "0.5.2")] public class MathEnginePlugin : BaseUnityPlugin { public const string Version = "0.5.2"; public static MathEnginePlugin instance; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) instance = this; new Harmony("com.noxy.rounds.mathengine").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Compatibility fixes loaded."); } } } namespace NoxyMathEngine.Optimizations { [HarmonyPatch(typeof(CharacterStatModifiers), "ConfigureMassAndSize")] public class CardMathOptimizer { private static bool Prefix(CharacterStatModifiers __instance) { return true; } } [HarmonyPatch(typeof(CardBar), "AddCard")] public class CardBarLagFixer { private static bool Prefix(CardInfo card) { return true; } } [HarmonyPatch(typeof(Voice), "ResetVoice")] internal static class DestroyedAudioSourceFix { private static IEnumerable Transpiler(IEnumerable instructions) { MethodInfo setter = AccessTools.PropertySetter(typeof(AudioSource), "volume"); MethodInfo guarded = AccessTools.Method(typeof(DestroyedAudioSourceFix), "SetVolumeIfAlive", (Type[])null, (Type[])null); int replacements = 0; foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.Calls(instruction, setter)) { instruction.opcode = OpCodes.Call; instruction.operand = guarded; replacements++; } yield return instruction; } if (replacements != 1) { throw new InvalidOperationException("Unexpected Sonigon ResetVoice layout; expected one volume setter."); } } private static void SetVolumeIfAlive(AudioSource source, float volume) { if ((Object)(object)source != (Object)null) { source.volume = volume; } } } [HarmonyPatch(typeof(SoundManagerVoicePool), "PoolVoice")] internal static class VoicePoolShutdownFix { private static bool Prefix(Voice voice, bool isCalledByOnDestroy) { if (!isCalledByOnDestroy) { return true; } if (voice == null) { return false; } voice.ResetVoice(); if ((Object)(object)voice.cachedVoiceEffect != (Object)null) { voice.cachedVoiceEffect.SetEnabled(false); } if ((Object)(object)voice.cachedAudioSource != (Object)null) { voice.cachedAudioSource.Stop(); } return false; } } }