Decompiled source of SaveMyShotty v1.0.2
BuyableShotgun.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("BuyableShotgun")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2023 MegaPiggy")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f4271793e57a966e00668122ac278845cc79146b")] [assembly: AssemblyProduct("BuyableShotgun")] [assembly: AssemblyTitle("BuyableShotgun")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 BuyableShotgun { [BepInDependency("evaisa.lethallib", "0.13.2")] [BepInPlugin("MegaPiggy.BuyableShotgun", "Buyable Shotgun", "1.0.4")] public class BuyableShotgun : BaseUnityPlugin { private const string modGUID = "MegaPiggy.BuyableShotgun"; private const string modName = "Buyable Shotgun"; private const string modVersion = "1.0.4"; private readonly Harmony harmony = new Harmony("MegaPiggy.BuyableShotgun"); private static BuyableShotgun Instance; private ConfigEntry<int> ShotgunPriceConfig; private static Dictionary<string, TerminalNode> infoNodes = new Dictionary<string, TerminalNode>(); private static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger; 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.Equals("Shotgun"))); public Item ShotgunClone { get; private set; } public int ShotgunPrice => ShotgunPriceConfig.Value; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ShotgunPriceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShotgunPrice", 700, "Credits needed to buy shotgun"); SceneManager.sceneLoaded += OnSceneLoaded; ShotgunClone = MakeNonScrap(ShotgunPrice); AddToShop(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Buyable Shotgun is loaded with version 1.0.4!"); } private Item MakeNonScrap(int price) { //IL_00cb: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) Item val = ScriptableObject.CreateInstance<Item>(); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).name = "Error"; val.itemName = "Error"; val.itemId = 6624; val.isScrap = false; val.creditsWorth = price; val.canBeGrabbedBeforeGameStart = true; val.automaticallySetUsingPower = false; val.batteryUsage = 300f; val.canBeInspected = false; val.isDefensiveWeapon = true; val.saveItemVariable = true; val.syncGrabFunction = false; val.twoHandedAnimation = true; val.verticalOffset = 0.25f; GameObject val2 = NetworkPrefabs.CreateNetworkPrefab("Cube"); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)3); val3.transform.SetParent(val2.transform, false); ((Renderer)val3.GetComponent<MeshRenderer>()).sharedMaterial.shader = Shader.Find("HDRP/Lit"); val2.AddComponent<BoxCollider>().size = Vector3.one * 2f; val2.AddComponent<AudioSource>(); PhysicsProp val4 = val2.AddComponent<PhysicsProp>(); ((GrabbableObject)val4).itemProperties = val; ((GrabbableObject)val4).grabbable = true; val.spawnPrefab = val2; val2.tag = "PhysicsProp"; val2.layer = LayerMask.NameToLayer("Props"); val3.layer = LayerMask.NameToLayer("Props"); try { GameObject val5 = Object.Instantiate<GameObject>(Items.scanNodePrefab, val2.transform); ((Object)val5).name = "ScanNode"; val5.transform.localPosition = new Vector3(0f, 0f, 0f); Transform transform = val5.transform; transform.localScale *= 2f; ScanNodeProperties component = val5.GetComponent<ScanNodeProperties>(); component.nodeType = 1; component.headerText = "Error"; component.subText = "A mod is incompatible with Buyable Shotgun"; } catch (Exception ex) { LoggerInstance.LogError((object)ex.ToString()); } val2.transform.localScale = Vector3.one / 2f; return val; } private void CloneNonScrap(Item original, Item clone, int price) { Object.DontDestroyOnLoad((Object)(object)original.spawnPrefab); CopyFields(original, clone); ((Object)clone).name = "Buyable" + ((Object)original).name; clone.creditsWorth = price; } public static void CopyFields(Item source, Item destination) { FieldInfo[] fields = typeof(Item).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(destination, fieldInfo.GetValue(source)); } } private TerminalNode CreateInfoNode(string name, string description) { if (infoNodes.ContainsKey(name)) { return infoNodes[name]; } TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); Object.DontDestroyOnLoad((Object)(object)val); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; infoNodes.Add(name, val); return val; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { LoggerInstance.LogInfo((object)("Scene \"" + ((Scene)(ref scene)).name + "\" loaded with " + ((object)(LoadSceneMode)(ref mode)).ToString() + " mode.")); if (!((Object)(object)Shotgun == (Object)null)) { CloneNonScrap(Shotgun, ShotgunClone, ShotgunPrice); } } private void AddToShop() { Item shotgunClone = ShotgunClone; int shotgunPrice = ShotgunPrice; Items.RegisterShopItem(shotgunClone, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("Shotgun", "Nutcracker's shotgun. Can hold 2 shells. Recommended to keep safety on while not using or it might shoot randomly."), shotgunPrice); LoggerInstance.LogInfo((object)$"Shotgun added to Shop for {ShotgunPrice} credits"); } } }
BuyableShotgunShells.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; 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: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("BuyableShotgunShells")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2023 MegaPiggy")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d3b9a4b110f11cec26aacb9899b73d38055d7e40")] [assembly: AssemblyProduct("BuyableShotgunShells")] [assembly: AssemblyTitle("BuyableShotgunShells")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 BuyableShotgunShells { [BepInDependency("evaisa.lethallib", "0.13.2")] [BepInPlugin("MegaPiggy.BuyableShotgunShells", "Buyable Shotgun Shells", "1.0.5")] public class BuyableShotgunShells : BaseUnityPlugin { private const string modGUID = "MegaPiggy.BuyableShotgunShells"; private const string modName = "Buyable Shotgun Shells"; private const string modVersion = "1.0.5"; private readonly Harmony harmony = new Harmony("MegaPiggy.BuyableShotgunShells"); private static BuyableShotgunShells Instance; private ConfigEntry<int> ShellPriceConfig; private static Dictionary<string, TerminalNode> infoNodes = new Dictionary<string, TerminalNode>(); private static ManualLogSource LoggerInstance => ((BaseUnityPlugin)Instance).Logger; public List<Item> AllItems => Resources.FindObjectsOfTypeAll<Item>().Concat(Object.FindObjectsByType<Item>((FindObjectsInactive)1, (FindObjectsSortMode)1)).ToList(); public Item ShotgunShell => ((IEnumerable<Item>)AllItems).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name.Equals("GunAmmo"))); public Item ShotgunShellClone { get; private set; } public int ShellPrice => ShellPriceConfig.Value; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); ShellPriceConfig = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "ShotgunShellPrice", 20, "Credits needed to buy shotgun shells"); SceneManager.sceneLoaded += OnSceneLoaded; ShotgunShellClone = MakeNonScrap(ShellPrice); AddToShop(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Buyable Shotgun Shells is loaded with version 1.0.5!"); } private Item MakeNonScrap(int price) { //IL_00cb: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) Item val = ScriptableObject.CreateInstance<Item>(); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).name = "Error"; val.itemName = "Error"; val.itemId = 6624; val.isScrap = false; val.creditsWorth = price; val.canBeGrabbedBeforeGameStart = true; val.automaticallySetUsingPower = false; val.batteryUsage = 300f; val.canBeInspected = false; val.isDefensiveWeapon = true; val.saveItemVariable = true; val.syncGrabFunction = false; val.twoHandedAnimation = true; val.verticalOffset = 0.25f; GameObject val2 = NetworkPrefabs.CreateNetworkPrefab("Cube"); GameObject val3 = GameObject.CreatePrimitive((PrimitiveType)3); val3.transform.SetParent(val2.transform, false); ((Renderer)val3.GetComponent<MeshRenderer>()).sharedMaterial.shader = Shader.Find("HDRP/Lit"); val2.AddComponent<BoxCollider>().size = Vector3.one * 2f; val2.AddComponent<AudioSource>(); PhysicsProp val4 = val2.AddComponent<PhysicsProp>(); ((GrabbableObject)val4).itemProperties = val; ((GrabbableObject)val4).grabbable = true; val.spawnPrefab = val2; val2.tag = "PhysicsProp"; val2.layer = LayerMask.NameToLayer("Props"); val3.layer = LayerMask.NameToLayer("Props"); try { GameObject val5 = Object.Instantiate<GameObject>(Items.scanNodePrefab, val2.transform); ((Object)val5).name = "ScanNode"; val5.transform.localPosition = new Vector3(0f, 0f, 0f); Transform transform = val5.transform; transform.localScale *= 2f; ScanNodeProperties component = val5.GetComponent<ScanNodeProperties>(); component.nodeType = 1; component.headerText = "Error"; component.subText = "A mod is incompatible with Buyable Shotgun Shells"; } catch (Exception ex) { LoggerInstance.LogError((object)ex.ToString()); } val2.transform.localScale = Vector3.one / 2f; return val; } private void CloneNonScrap(Item original, Item clone, int price) { Object.DontDestroyOnLoad((Object)(object)original.spawnPrefab); CopyFields(original, clone); ((Object)clone).name = "Buyable" + ((Object)original).name; clone.creditsWorth = price; } public static void CopyFields(Item source, Item destination) { FieldInfo[] fields = typeof(Item).GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(destination, fieldInfo.GetValue(source)); } } private TerminalNode CreateInfoNode(string name, string description) { if (infoNodes.ContainsKey(name)) { return infoNodes[name]; } TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>(); val.clearPreviousText = true; ((Object)val).name = name + "InfoNode"; val.displayText = description + "\n\n"; infoNodes.Add(name, val); return val; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (!((Object)(object)ShotgunShell == (Object)null)) { CloneNonScrap(ShotgunShell, ShotgunShellClone, ShellPrice); ShotgunShellClone.itemName = "Shells"; } } private void AddToShop() { Item shotgunShellClone = ShotgunShellClone; int shellPrice = ShellPrice; Items.RegisterShopItem(shotgunShellClone, (TerminalNode)null, (TerminalNode)null, CreateInfoNode("ShotgunShell", "Ammo for the Nutcracker's Shotgun."), shellPrice); LoggerInstance.LogInfo((object)$"Shotgun Shell added to Shop for {ShellPrice} credits"); } } }
MissFireFix.dll
Decompiled 8 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; 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: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("MissFireFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("MissFireFix")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MissFireFix")] [assembly: AssemblyTitle("MissFireFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 MissFireFix { [BepInPlugin("MissFireFix", "MissFireFix", "1.0.0")] public class MissFireFix : BaseUnityPlugin { private const string modGUID = "MissFireFix"; private const string modName = "MissFireFix"; private const string modVersion = "1.0.0"; private static MissFireFix Instance; private readonly Harmony harmony = new Harmony("MissFireFix"); public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)Instance == (Object)null) { Instance = this; } harmony.PatchAll(); } } internal class MissFireFixPatch { [HarmonyPatch(typeof(ShotgunItem), "Update")] public class ShotgunItem_Update_Patch { public static void Postfix(ShotgunItem __instance) { __instance.misfireTimer = 9999f; } } } public static class PluginInfo { public const string PLUGIN_GUID = "MissFireFix"; public const string PLUGIN_NAME = "MissFireFix"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }