Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of FizixTestMod v0.0.1
LCTutorialMod.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LCSoundTool; using LCTutorialMod.Patches; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LCTutorialMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LCTutorialMod")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7dc26b64-38c3-4a5b-923d-a5dab32e2793")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LCTutorialMod { [BepInPlugin("Poseidon.LCTutorialMod", "LC Tutorial Mod", "1.0.0.0")] public class TutorialModBase : BaseUnityPlugin { private const string modGUID = "Poseidon.LCTutorialMod"; private const string modName = "LC Tutorial Mod"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Poseidon.LCTutorialMod"); private static TutorialModBase Instance; internal static ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Poseidon.LCTutorialMod"); mls.LogInfo((object)"The test mod has awaken :)"); harmony.PatchAll(typeof(TutorialModBase)); harmony.PatchAll(typeof(PlayerControllerBPatch)); } } } namespace LCTutorialMod.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { private static AudioClip[] Belches = (AudioClip[])(object)new AudioClip[5] { SoundTool.GetAudioClip("LCTutorialMod", "Belches", "rick-belching-rick-and-morty.mp3"), SoundTool.GetAudioClip("LCTutorialMod", "Belches", "rick-and-morty-burp-made-with-Voicemod.mp3"), SoundTool.GetAudioClip("LCTutorialMod", "Belches", "Burp-A1.mp3"), SoundTool.GetAudioClip("LCTutorialMod", "Belches", "Burp-A2.mp3"), SoundTool.GetAudioClip("LCTutorialMod", "Belches", "Burp-B1.mp3") }; private static Random Randomizer = new Random(); private static int NextBelchSecond = Randomizer.Next(15); private static DateTime LastPlayedBelch = DateTime.Now; [HarmonyPatch("Update")] [HarmonyPostfix] private static void infiniteSprintPatch() { TimeSpan timeSpan = DateTime.Now - LastPlayedBelch; int num = (int)timeSpan.TotalSeconds; if (num < 3) { return; } TutorialModBase.mls.LogInfo((object)("TIME CHECK: " + timeSpan.Seconds % 15 + " == " + NextBelchSecond)); if (timeSpan.Seconds % 15 == NextBelchSecond) { List<WalkieTalkie> allWalkieTalkies = WalkieTalkie.allWalkieTalkies; TutorialModBase.mls.LogInfo((object)("CHECK IF USING WALKIE: " + allWalkieTalkies.Count)); WalkieTalkie userWalkieTalkieBeingUsed = GetUserWalkieTalkieBeingUsed(); if ((Object)(object)userWalkieTalkieBeingUsed != (Object)null) { LastPlayedBelch = DateTime.Now; TutorialModBase.mls.LogInfo((object)"TEST: "); PlayRandomClip(userWalkieTalkieBeingUsed.target, Belches, randomize: true, 0.25f); NextBelchSecond = Randomizer.Next(15); } } } private static WalkieTalkie GetUserWalkieTalkieBeingUsed() { List<WalkieTalkie> allWalkieTalkies = WalkieTalkie.allWalkieTalkies; for (int i = 0; i < allWalkieTalkies.Count; i++) { WalkieTalkie val = allWalkieTalkies[i]; TutorialModBase.mls.LogInfo((object)$"UPDATE: {(Object)(object)((GrabbableObject)val).playerHeldBy == (Object)null} || {!val.clientIsHoldingAndSpeakingIntoThis} || {!((GrabbableObject)val).isBeingUsed}"); if (!((Object)(object)((GrabbableObject)val).playerHeldBy == (Object)null) && val.clientIsHoldingAndSpeakingIntoThis && ((GrabbableObject)val).isBeingUsed && ((GrabbableObject)val).isBeingUsed) { return val; } } return null; } private static float GetMaxVolume(WalkieTalkie walkieTalkie) { return (float)((object)walkieTalkie).GetType().GetField("maxVolume", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(walkieTalkie); } public static int PlayRandomClip(AudioSource audioSource, AudioClip[] clipsArray, bool randomize = true, float oneShotVolume = 1f, int audibleNoiseID = 0) { if (randomize) { audioSource.pitch = Random.Range(0.94f, 1.06f); } int num = Random.Range(0, clipsArray.Length); WalkieTalkie.TransmitOneShotAudio(audioSource, clipsArray[num], 0.85f); if (!(audioSource.spatialBlend > 0f) || audibleNoiseID >= 0) { } return num; } } [HarmonyPatch(typeof(WalkieTalkie))] internal class WalkieTalkiePatch { private static AudioClip newSound = SoundTool.GetAudioClip("LCTutorialMod", "Belches", "rick-belching-rick-and-morty.mp3"); [HarmonyPatch("Update")] [HarmonyPostfix] private static void testPatch(ref Transform ___thisPlayerBody) { TutorialModBase.mls.LogInfo((object)"TEST WALKIE TALKIE USE"); } public static void SpawnExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_0302: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00ef: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"Spawning explosion at pos: {explosionPosition}"); if (spawnExplosionEffect) { Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true); } float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition); if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } Collider[] array = Physics.OverlapSphere(explosionPosition, 6f, 2621448, (QueryTriggerInteraction)2); PlayerControllerB val = null; for (int i = 0; i < array.Length; i++) { float num2 = Vector3.Distance(explosionPosition, ((Component)array[i]).transform.position); if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)array[i]).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } if (((Component)array[i]).gameObject.layer == 3) { val = ((Component)array[i]).gameObject.GetComponent<PlayerControllerB>(); if ((Object)(object)val != (Object)null && ((NetworkBehaviour)val).IsOwner) { if (num2 < killRange) { Vector3 val2 = (((Component)val.gameplayCamera).transform.position - explosionPosition) * 80f / Vector3.Distance(((Component)val.gameplayCamera).transform.position, explosionPosition); val.KillPlayer(val2, true, (CauseOfDeath)3, 0); } else if (num2 < damageRange) { val.DamagePlayer(50, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } else if (((Component)array[i]).gameObject.layer == 21) { Landmine componentInChildren = ((Component)array[i]).gameObject.GetComponentInChildren<Landmine>(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < 6f) { Debug.Log((object)"Setting off other mine"); ((MonoBehaviour)componentInChildren).StartCoroutine(TriggerOtherMineDelayed(componentInChildren)); } } else if (((Component)array[i]).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)array[i]).gameObject.GetComponentInChildren<EnemyAICollisionDetect>(); if ((Object)(object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < 4.5f) { componentInChildren2.mainScript.HitEnemyOnLocalClient(6, default(Vector3), (PlayerControllerB)null, false); } } } int num3 = ~LayerMask.GetMask(new string[1] { "Room" }); num3 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(explosionPosition, 10f, num3); for (int j = 0; j < array.Length; j++) { Rigidbody component = ((Component)array[j]).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.AddExplosionForce(70f, explosionPosition, 10f); } } } private static IEnumerator TriggerOtherMineDelayed(Landmine mine) { if (!mine.hasExploded) { mine.mineAudio.pitch = Random.Range(0.75f, 1.07f); mine.hasExploded = true; yield return (object)new WaitForSeconds(0.2f); mine.SetOffMineAnimation(); } } } }