using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; 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("HarveysRepoMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("HarveysRepoMod")] [assembly: AssemblyTitle("HarveysRepoMod")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } } namespace SprayCanMod { [BepInPlugin("com.HarvDallz.SprayCan", "Spray Can Mod", "1.0.0")] public class SprayCanPlugin : BaseUnityPlugin { public static GameObject sprayCanPrefab; public static GameObject paintDecalPrefab; public static AssetBundle sprayCanBundle; private void Awake() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "spraycan"); sprayCanBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)sprayCanBundle == (Object)null) { Debug.LogError((object)"[Spray Can Mod] Failed to physically load asset bundle file from disk."); return; } sprayCanPrefab = sprayCanBundle.LoadAsset("Spray Can"); paintDecalPrefab = sprayCanBundle.LoadAsset("PaintSplatObject"); Harmony.CreateAndPatchAll(typeof(SprayCanPatches), (string)null); Debug.Log((object)"[Spray Can Mod] Plugin initialized with Multiplayer RPC Syncing!"); } } public static class SprayCanPatches { private static float lastSprayTime = 0f; private static float timeBetweenSplats = 0.05f; private static float sprayRange = 5f; private static float minSprayDistance = 0.8f; private static float batteryDrainRate = 0.05f; [HarmonyPatch(typeof(StatsManager), "LoadItemsFromFolder")] [HarmonyPostfix] public static void StatsManagerPostfix(StatsManager __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if ((Object)(object)SprayCanPlugin.sprayCanBundle == (Object)null) { return; } Item val = SprayCanPlugin.sprayCanBundle.LoadAsset("Item Spray"); if ((Object)(object)val != (Object)null) { if (val.prefab == null) { val.prefab = new PrefabRef(); } ((PrefabRef)(object)val.prefab).SetPrefab(SprayCanPlugin.sprayCanBundle, "Spray Can"); string name = ((Object)val).name; if (!__instance.itemDictionary.ContainsKey(name)) { __instance.itemDictionary.TryAdd(name, val); } } } [HarmonyPatch(typeof(ItemToggle), "Update")] [HarmonyPostfix] public static void ItemToggleUpdatePatch(ItemToggle __instance) { ItemAttributes component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null || component.item.itemName != "Spray Can") { return; } PhysGrabObject component2 = ((Component)__instance).GetComponent(); if ((Object)(object)component2 == (Object)null || !component2.grabbed || !component2.grabbedLocal) { LineRenderer component3 = ((Component)__instance).GetComponent(); if ((Object)(object)component3 != (Object)null && ((Renderer)component3).enabled) { ((Renderer)component3).enabled = false; } AudioSource component4 = ((Component)__instance).GetComponent(); if ((Object)(object)component4 != (Object)null && component4.isPlaying) { component4.Stop(); } return; } ForceGunHoldingPhysics(component2); ItemBattery component5 = ((Component)__instance).GetComponent(); bool flag = true; if ((Object)(object)component5 != (Object)null && component5.batteryLife <= 0f) { flag = false; __instance.toggleState = false; } bool flag2 = __instance.toggleState && flag; AudioSource component6 = ((Component)__instance).GetComponent(); if ((Object)(object)component6 != (Object)null) { if (flag2) { component6.spatialBlend = 1f; if (!component6.isPlaying) { component6.Play(); } } else if (component6.isPlaying) { component6.Stop(); } } UpdateLaserAndSpray(((Component)__instance).gameObject, flag2); } private static void UpdateLaserAndSpray(GameObject canObject, bool isActivelySpraying) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0218: 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) LineRenderer val = canObject.GetComponent(); if ((Object)(object)val == (Object)null) { val = canObject.AddComponent(); val.positionCount = 2; val.startWidth = 0.02f; val.endWidth = 0.02f; val.useWorldSpace = true; ((Renderer)val).material = new Material(Shader.Find("Sprites/Default")); val.startColor = Color.cyan; val.endColor = Color.cyan; } Transform val2 = canObject.transform.Find("Muzzle") ?? canObject.transform; Vector3 val3 = val2.position + val2.forward * 0.25f; if (isActivelySpraying) { ((Renderer)val).enabled = true; val.SetPosition(0, val3); Camera main = Camera.main; Vector3 val4 = val3; Vector3 forward = val2.forward; if ((Object)(object)main != (Object)null) { val4 = ((Component)main).transform.position; forward = ((Component)main).transform.forward; } int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "Enemy" }); RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val4, forward, ref val5, sprayRange, num)) { val.SetPosition(1, ((RaycastHit)(ref val5)).point); float num2 = Vector3.Distance(val4, ((RaycastHit)(ref val5)).point); if (num2 >= minSprayDistance && Time.time >= lastSprayTime + timeBetweenSplats) { lastSprayTime = Time.time; int num3 = -1; PhotonView val6 = ((Component)((RaycastHit)(ref val5)).collider).GetComponentInParent() ?? ((Component)((RaycastHit)(ref val5)).collider).GetComponent(); if ((Object)(object)val6 != (Object)null) { num3 = val6.ViewID; } PhotonView val7 = canObject.GetComponentInParent() ?? canObject.GetComponent(); if ((Object)(object)val7 != (Object)null && SemiFunc.IsMultiplayer()) { val7.RPC("RPC_SyncSprayPaintSplat", (RpcTarget)0, new object[3] { ((RaycastHit)(ref val5)).point, ((RaycastHit)(ref val5)).normal, num3 }); } else { LocalSpawnPaintSplat(((RaycastHit)(ref val5)).point, ((RaycastHit)(ref val5)).normal, ((Component)((RaycastHit)(ref val5)).collider).gameObject); } } } else { val.SetPosition(1, val3 + forward * sprayRange); } } else { ((Renderer)val).enabled = false; } } [HarmonyPatch(typeof(PhotonNetwork), "ExecuteRpc")] [HarmonyPrefix] public static bool InterceptNetworkRPCs(Hashtable rpcData, Player sender) { //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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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) if (rpcData == null) { return true; } string text = string.Empty; if (rpcData.ContainsKey((byte)3)) { text = rpcData[(byte)3] as string; } else if (rpcData.ContainsKey((byte)5)) { text = rpcData[(byte)5] as string; } if (string.IsNullOrEmpty(text)) { return true; } if (text == "RPC_SyncSprayPaintSplat") { try { if (rpcData[(byte)4] is object[] array && array.Length == 3) { Vector3 position = (Vector3)array[0]; Vector3 normal = (Vector3)array[1]; int num = (int)array[2]; GameObject targetSurface = null; if (num != -1) { PhotonView val = PhotonView.Find(num); if ((Object)(object)val != (Object)null) { targetSurface = ((Component)val).gameObject; } } LocalSpawnPaintSplat(position, normal, targetSurface); } } catch (Exception ex) { Debug.LogError((object)("[Spray Can Net] Error unpacking PUN2 splat packet: " + ex.Message)); } return false; } return true; } public static void LocalSpawnPaintSplat(Vector3 position, Vector3 normal, GameObject targetSurface) { //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0041: 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_004c: 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) if ((Object)(object)SprayCanPlugin.paintDecalPrefab == (Object)null) { return; } Quaternion val = Quaternion.LookRotation(normal) * Quaternion.Euler(0f, 180f, 0f); Vector3 val2 = position + normal * 0.002f; GameObject val3 = Object.Instantiate(SprayCanPlugin.paintDecalPrefab, val2, val); if (!((Object)(object)val3 != (Object)null)) { return; } val3.SetActive(true); if (!((Object)(object)targetSurface != (Object)null)) { return; } Rigidbody component = targetSurface.GetComponent(); if ((Object)(object)component != (Object)null) { Rigidbody val4 = val3.GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = val3.AddComponent(); } val4.isKinematic = false; val4.useGravity = false; FixedJoint val5 = val3.AddComponent(); ((Joint)val5).connectedBody = component; } else { val3.transform.SetParent(targetSurface.transform, true); } } private static void ForceGunHoldingPhysics(PhysGrabObject physGrab) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer()) { Quaternion val = Quaternion.Euler(-5f, 0f, 0f); physGrab.TurnXYZ(val, Quaternion.identity, Quaternion.identity); physGrab.OverrideGrabVerticalPosition(-0.2f); physGrab.OverrideTorqueStrength(12f, 0.1f); physGrab.OverrideAngularDrag(20f, 0.1f); } } } } namespace HarveysRepoMod { [BepInPlugin("com.HarvDallz.repo.HarveysRepoMod", "Harvey's Repo mod", "1.0.2")] public class Plugin : BaseUnityPlugin { public static Dictionary soundMap = new Dictionary(); internal static ManualLogSource Logger { get; private set; } public static AudioClip getRandomClip(AudioClip[] list) { return list[Random.Range(0, list.Length)]; } private void Awake() { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); if (Directory.Exists(directoryName)) { foreach (string item in Directory.EnumerateFiles(directoryName, "*.wav")) { string text = Path.Combine(directoryName, item); if (!File.Exists(text)) { Logger.LogError((object)("Could not find audio file at: " + text)); continue; } try { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(item); AudioClip value = CreateClipFromWav(text, fileNameWithoutExtension); Logger.LogInfo((object)("Successfully built " + fileNameWithoutExtension)); soundMap[fileNameWithoutExtension] = value; } catch (Exception ex) { Logger.LogError((object)("Failed to parse " + item + ": " + ex.Message)); } } } else { Console.WriteLine("The specified folder does not exist."); } Harmony val = new Harmony("com.HarvDallz.repo.HarveysRepoMod"); val.PatchAll(); Logger.LogInfo((object)"Harvey's Repo mod has loaded! Oh Yeah baby!"); } private AudioClip CreateClipFromWav(string filePath, string name) { byte[] array = File.ReadAllBytes(filePath); int num = array[22]; int num2 = BitConverter.ToInt32(array, 24); int num3 = 44; float[] array2 = new float[(array.Length - num3) / 2]; for (int i = 0; i < array2.Length; i++) { array2[i] = (float)BitConverter.ToInt16(array, num3 + i * 2) / 32768f; } AudioClip val = AudioClip.Create(name, array2.Length / num, num, num2, false); val.SetData(array2, 0); return val; } } [HarmonyPatch(typeof(PhoneValuable))] public class PhoneRingPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void SwapPhoneAudioArray(PhoneValuable __instance) { AudioClip[] array = (AudioClip[])(object)new AudioClip[5] { Plugin.soundMap["mus1"], Plugin.soundMap["mus5"], Plugin.soundMap["mus6"], Plugin.soundMap["mus7"], Plugin.soundMap["mus10"] }; if (__instance.ringTone != null && array != null) { __instance.ringTone.Sounds = array; __instance.ringTone.Source.clip = Plugin.getRandomClip(array); Plugin.Logger.LogInfo((object)"Phone vanilla sounds completely overwritten with custom clip!"); } } } [HarmonyPatch(typeof(TrapGramophone))] public class GramophonePatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void SwapGramophoneAudio(TrapGramophone __instance) { AudioClip[] array = (AudioClip[])(object)new AudioClip[3] { Plugin.soundMap["mus2"], Plugin.soundMap["mus4"], Plugin.soundMap["mus8"] }; if (__instance.GramophoneMusic != null && (Object)(object)__instance.GramophoneMusic.Source != (Object)null && array != null) { __instance.GramophoneMusic.Sounds = array; __instance.GramophoneMusic.Source.clip = Plugin.getRandomClip(array); Plugin.Logger.LogInfo((object)"Gramophone music successfully swapped!"); } } } [HarmonyPatch(typeof(ShopRadio))] public class ShopRadioPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void SwapShopRadioAudio(ShopRadio __instance) { List shopMusicClips = new List { Plugin.soundMap["mus1"], Plugin.soundMap["mus2"], Plugin.soundMap["mus3"], Plugin.soundMap["mus4"], Plugin.soundMap["mus5"], Plugin.soundMap["mus6"], Plugin.soundMap["mus7"], Plugin.soundMap["mus8"] }; if (__instance.shopMusic != null && (Object)(object)__instance.shopMusic.Source != (Object)null) { __instance.shopMusicClips = shopMusicClips; } Plugin.Logger.LogInfo((object)"Shop music successfully swapped!"); } } [HarmonyPatch(typeof(ValuableBoombox))] public class BoomboxPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void SwapBoomboxAudio(ValuableBoombox __instance) { AudioClip[] array = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["mus9"] }; if (__instance.soundBoomboxMusic != null && (Object)(object)__instance.soundBoomboxMusic.Source != (Object)null && array != null) { __instance.soundBoomboxMusic.Sounds = array; __instance.soundBoomboxMusic.Source.clip = Plugin.getRandomClip(array); Plugin.Logger.LogInfo((object)"Boombox music successfully swapped!"); } } } [HarmonyPatch(typeof(TrapRadio))] public class HeadmanRadioPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void SwapHMRadioAudio(TrapRadio __instance) { AudioClip[] array = (AudioClip[])(object)new AudioClip[3] { Plugin.soundMap["mus2"], Plugin.soundMap["mus7"], Plugin.soundMap["mus8"] }; if (__instance.RadioLoop != null && (Object)(object)__instance.RadioLoop.Source != (Object)null && array != null) { __instance.RadioLoop.Sounds = array; __instance.RadioLoop.Source.clip = Plugin.getRandomClip(array); Plugin.Logger.LogInfo((object)"Radio music successfully swapped!"); } } } [HarmonyPatch(typeof(EnemyParent), "Awake")] public class MasterInstanceAudioPatch { [HarmonyPostfix] private static void OverwriteLiveEnemyInstanceSounds(EnemyParent __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)((Component)__instance).gameObject == (Object)null) { return; } EnemyTumblerAnim componentInChildren = ((Component)__instance).GetComponentInChildren(); EnemyGnomeAnim componentInChildren2 = ((Component)__instance).GetComponentInChildren(); EnemyGnome val = ((Component)__instance).GetComponentInParent() ?? ((Component)__instance).GetComponent(); EnemyBeamerAnim componentInChildren3 = ((Component)__instance).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { if (componentInChildren.sfxJump != null && Plugin.soundMap.ContainsKey("FrogJump1")) { componentInChildren.sfxJump.Sounds = (AudioClip[])(object)new AudioClip[3] { Plugin.soundMap["FrogJump1"], Plugin.soundMap["FrogJump2"], Plugin.soundMap["FrogJump3"] }; } if (componentInChildren.sfxDeath != null && Plugin.soundMap.ContainsKey("FrogDeath")) { componentInChildren.sfxDeath.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["FrogDeath"] }; } if (componentInChildren.sfxNotice != null && Plugin.soundMap.ContainsKey("FrogSpawn")) { componentInChildren.sfxNotice.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["FrogSpawn"] }; } Plugin.Logger.LogInfo((object)"[HarveysRepoMod] Live Frog instance audio redirected successfully."); } if ((Object)(object)componentInChildren2 != (Object)null) { if (componentInChildren2.soundJump != null && Plugin.soundMap.ContainsKey("gnomejump")) { componentInChildren2.soundJump.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["gnomejump"] }; } if (componentInChildren2.soundNotice != null && Plugin.soundMap.ContainsKey("GnomeSpotted1")) { componentInChildren2.soundNotice.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["GnomeSpotted1"] }; } if (componentInChildren2.soundPickaxeTell != null && Plugin.soundMap.ContainsKey("gnomepickaxetell")) { componentInChildren2.soundPickaxeTell.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["gnomepickaxetell"] }; } Plugin.Logger.LogInfo((object)"[HarveysRepoMod] Live Gnome Anim instance audio redirected successfully."); } if ((Object)(object)val != (Object)null) { if (val.soundDeath != null && Plugin.soundMap.ContainsKey("gnomedeath")) { val.soundDeath.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["gnomedeath"] }; } if (val.soundHurt != null && Plugin.soundMap.ContainsKey("gnomehurt")) { val.soundHurt.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["gnomehurt"] }; } Plugin.Logger.LogInfo((object)"[HarveysRepoMod] Live Gnome Logic Root instance audio redirected successfully."); } if ((Object)(object)componentInChildren3 != (Object)null) { if (componentInChildren3.soundAttackIntro != null && Plugin.soundMap.ContainsKey("clowncharge")) { componentInChildren3.soundAttackIntro.Sounds = (AudioClip[])(object)new AudioClip[1] { Plugin.soundMap["clowncharge"] }; } Plugin.Logger.LogInfo((object)"[HarveysRepoMod] Live Clown instance audio redirected successfully."); } } } }