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 LC Shitgun v0.1.0
LC_Shitgun/LC_Shitgun.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using LC_TEST_MOD_CS.Patches; using LethalLib.Modules; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("LC_TEST_MOD_CS")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LC_TEST_MOD_CS")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5c3a8d04-ca64-495f-8829-9befd50b27ff")] [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")] namespace LC_TEST_MOD_CS { [BepInPlugin("Shambi.LC_TEST_MOD_CS", "LC_TEST_MOD_CS", "1.0.0")] public class LC_MOD_BASE : BaseUnityPlugin { private const string modGUID = "Shambi.LC_TEST_MOD_CS"; private const string modName = "LC_TEST_MOD_CS"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Shambi.LC_TEST_MOD_CS"); private static LC_MOD_BASE Instance; public static ManualLogSource mls; public int ShotgunPrice; public bool added_Shotgun; public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList(); public Item Shotgun => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "Shotgun")); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Shambi.LC_TEST_MOD_CS"); mls.LogInfo((object)"The Test mod has been loaded."); harmony.PatchAll(typeof(LC_MOD_BASE)); harmony.PatchAll(typeof(ShotgunItemPatch)); ShotgunPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShitgunPrice", 15, "Credits needed to buy a shitgun").Value; SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (!added_Shotgun) { Scene val = scene; if (((Scene)(ref val)).name == "MainMenu") { added_Shotgun = true; Shotgun.itemName = "Shitgun"; Shotgun.weight = 0.09f; Items.RegisterShopItem(Shotgun, ShotgunPrice); } } } } } namespace LC_TEST_MOD_CS.Patches { [HarmonyPatch] internal class ShotgunItemPatch { private static ManualLogSource mls = LC_MOD_BASE.mls; private static RoundManager currentRound; private static Random rand = new Random(); private static bool server = false; private static int mine = 0; private static bool die = false; [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPrefix] private static void LoadNewLevelPatch() { server = false; die = false; currentRound = RoundManager.Instance; if (((NetworkBehaviour)currentRound).IsServer) { server = true; } } [HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void FinishGeneratingNewLevelClientRpcPatch() { mls.LogInfo((object)"Level Loaded, any new mine spawned will blow up instantly"); int num = currentRound.currentLevel.spawnableMapObjects.Count(); for (int i = 0; i < num; i++) { if (((Object)currentRound.currentLevel.spawnableMapObjects[i].prefabToSpawn).name == "Landmine") { mls.LogInfo((object)("Found Mine Index: " + i)); mine = i; break; } } } [HarmonyPatch(typeof(Landmine), "Start")] [HarmonyPrefix] private static void LandminePatch(ref Landmine __instance) { mls.LogInfo((object)"Landmine Spawned"); if (die) { mls.LogInfo((object)"Forcing mine explosion"); __instance.ExplodeMineServerRpc(); mls.LogInfo((object)"Mine forcefully activated"); } } [HarmonyPatch(typeof(ShotgunItem), "ItemActivate")] [HarmonyPostfix] public static void PatchItemActivate(ShotgunItem __instance) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) mls.LogInfo((object)("ShotgunItem::ItemActivate: " + __instance.shellsLoaded)); __instance.shellsLoaded = 2; if (rand.Next(0, 100) < 13 && !die) { die = true; Landmine.SpawnExplosion(((GrabbableObject)__instance).playerHeldBy.thisPlayerBody.forward * 3.5f, true, 3.75f, 7f); } mls.LogInfo((object)("ShotgunItem::ItemActivate: " + __instance.shellsLoaded)); } [HarmonyPatch(typeof(ShotgunItem), "ShootGun")] [HarmonyPostfix] public static void PatchShootGun(ShotgunItem __instance) { mls.LogInfo((object)("ShotgunItem::PatchShootGun: " + __instance.shellsLoaded)); __instance.shellsLoaded = 2; mls.LogInfo((object)("ShotgunItem::PatchShootGun: " + __instance.shellsLoaded)); } } }