using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NoClockSound")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoClockSound")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3b5568e8-7674-4c2b-995a-afbfa752a6fe")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoClockSound;
[HarmonyPatch(typeof(ClockProp))]
public class ClockPropPatch
{
[HarmonyPatch("Update")]
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> disableClockSound(IEnumerable<CodeInstruction> instructions)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = -1;
for (int i = 0; i < list.Count; i++)
{
if (list[i].opcode == OpCodes.Brfalse)
{
num = i - 8;
break;
}
}
if (num < 0)
{
NCSBase.Log.LogInfo((object)"Could not find if statement. Cant disable clock sound!");
return list.AsEnumerable();
}
list.RemoveRange(num, list.Count - num - 1);
list.Append(new CodeInstruction(OpCodes.Ret, (object)null));
NCSBase.Log.LogInfo((object)"Clock sound disabled..");
return list.AsEnumerable();
}
}
[BepInPlugin("Zesa.NoClockSound", "NoClockSound", "1.0.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class NCSBase : BaseUnityPlugin
{
private const string modGUID = "Zesa.NoClockSound";
private const string modName = "NoClockSound";
private const string modVersion = "1.0.0.0";
private static NCSBase Instance;
private readonly Harmony harmony = new Harmony("Zesa.NoClockSound");
public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
Log.LogInfo((object)"Patched clock sound..");
harmony.PatchAll(typeof(ClockPropPatch));
}
}