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 UsualScrap v2.0.2
UsualScrap.dll
Decompiled 6 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using Dawn; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UsualScrap.Behaviors; using UsualScrap.Behaviors.Effects; using UsualScrap.NetcodePatcher; [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("UsualScrap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds many new unique items that expand on the available scrap items and interactions!")] [assembly: AssemblyFileVersion("2.0.2.0")] [assembly: AssemblyInformationalVersion("2.0.2")] [assembly: AssemblyProduct("UsualScrap")] [assembly: AssemblyTitle("UsualScrap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } [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 UsualScrap { [BepInPlugin("Emil.UsualScrap", "UsualScrap", "2.0.2")] public class Plugin : BaseUnityPlugin { public static class ScrapPackKeys { public static NamespacedKey<DawnItemInfo> US_PocketWatch = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Pocket_Watch"); public static NamespacedKey<DawnItemInfo> US_ServantBell = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Servant_Bell"); public static NamespacedKey<DawnItemInfo> US_ChessPieces = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Chess_Pieces"); public static NamespacedKey<DawnItemInfo> US_GoldenChessPieces = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Golden_Chess_Pieces"); public static NamespacedKey<DawnItemInfo> US_TrafficCone = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Traffic_Cone"); public static NamespacedKey<DawnItemInfo> US_MereGear = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Mere_Gear"); } public static class ScrapItemKeys { public static NamespacedKey<DawnItemInfo> US_Ticket = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Ticket"); public static NamespacedKey<DawnItemInfo> US_GoldenTicket = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Golden_Ticket"); public static NamespacedKey<DawnItemInfo> US_Rose = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Rose"); public static NamespacedKey<DawnItemInfo> US_SizableScissors = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Sizable_Scissors"); public static NamespacedKey<DawnItemInfo> US_WalkingCane = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Walking_Cane"); public static NamespacedKey<DawnItemInfo> US_CandyDispenser = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Candy_Dispenser"); public static NamespacedKey<DawnItemInfo> US_VintageCandy = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Vintage_Candy"); public static NamespacedKey<DawnItemInfo> US_FuelCylinder = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Fuel_Cylinder"); public static NamespacedKey<DawnItemInfo> US_RadioactiveCell = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Radioactive_Cell"); public static NamespacedKey<DawnItemInfo> US_GloomyCapsule = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Gloomy_Capsule"); public static NamespacedKey<DawnItemInfo> US_FrigidCapsule = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Frigid_Capsule"); public static NamespacedKey<DawnItemInfo> US_BloodyCapsule = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Bloody_Capsule"); public static NamespacedKey<DawnItemInfo> US_Padlock = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Padlock"); public static NamespacedKey<DawnItemInfo> US_Crowbar = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Crowbar"); } public static class StoreItemKeys { public static NamespacedKey<DawnItemInfo> US_HandLamp = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Hand_Lamp"); public static NamespacedKey<DawnItemInfo> US_Bandages = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Bandages"); public static NamespacedKey<DawnItemInfo> US_MedicalKit = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Medical_Kit"); public static NamespacedKey<DawnItemInfo> US_Defibrillator = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Defibrillator"); public static NamespacedKey<DawnItemInfo> US_ProductivityAutoinjector = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Productivity_Autoinjector"); public static NamespacedKey<DawnItemInfo> US_ShiftController = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Shift_Controller"); public static NamespacedKey<DawnItemInfo> US_Toolkit = NamespacedKey<DawnItemInfo>.From("Usual_Scrap", "US_Toolkit"); } public const string PLUGIN_GUID = "Emil.UsualScrap"; public const string PLUGIN_NAME = "UsualScrap"; public const string PLUGIN_VERSION = "2.0.2"; public static Plugin instance; private List<KeyValuePair<NamespacedKey<DawnMoonInfo>, DawnMoonInfo>> FinalMoons = new List<KeyValuePair<NamespacedKey<DawnMoonInfo>, DawnMoonInfo>>(); private List<string> FinalMoonNames = new List<string>(); internal static UsualScrapConfigs BoundConfig { get; private set; } public void InitializeItem(GrabbableObject itemScript, bool grabbable, bool grabbableToEnemies, Item itemProperties) { DawnLib.RegisterNetworkPrefab(itemProperties.spawnPrefab); Utilities.FixMixerGroups(itemProperties.spawnPrefab); itemScript.grabbable = grabbable; itemScript.grabbableToEnemies = grabbableToEnemies; itemScript.itemProperties = itemProperties; } public void Awake() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } List<Item> list = new List<Item>(); instance = this; BoundConfig = new UsualScrapConfigs(((BaseUnityPlugin)this).Config); new UsualScrapConfigs(((BaseUnityPlugin)this).Config); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "usualscrapassetbundle")); try { if (BoundConfig.HandlampLoaded.Value) { Item val2 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/HandlampAssets/US_HandlampItem.asset"); list.Add(val2); TerminalNode US_HandlampNode = val.LoadAsset<TerminalNode>("Assets/Items/HandlampAssets/US_HandlampNode.asset"); HandlampScript itemScript = val2.spawnPrefab.AddComponent<HandlampScript>(); InitializeItem((GrabbableObject)(object)itemScript, grabbable: true, grabbableToEnemies: true, val2); if (BoundConfig.HandlampIsStoreItem.Value && BoundConfig.HandlampStorePrice.Value >= 0) { DawnLib.DefineItem(StoreItemKeys.US_HandLamp, val2, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder) { shopBuilder.OverrideCost(BoundConfig.HandlampStorePrice.Value).OverrideInfoNode(US_HandlampNode); }); }); } } } catch { Debug.LogError((object)"USUAL SCRAP - Handlamp experienced an error while loading. Skipping..."); } try { if (BoundConfig.BandagesLoaded.Value) { Item val3 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/BandagesAssets/US_BandagesItem.asset"); list.Add(val3); TerminalNode US_BandagesNode = val.LoadAsset<TerminalNode>("Assets/Items/BandagesAssets/US_BandagesNode.asset"); BandagesScript itemScript2 = val3.spawnPrefab.AddComponent<BandagesScript>(); InitializeItem((GrabbableObject)(object)itemScript2, grabbable: true, grabbableToEnemies: true, val3); if (BoundConfig.BandagesIsStoreItem.Value && BoundConfig.BandagesStorePrice.Value >= 0) { DawnLib.DefineItem(StoreItemKeys.US_Bandages, val3, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder) { shopBuilder.OverrideCost(BoundConfig.BandagesStorePrice.Value).OverrideInfoNode(US_BandagesNode); }); }); } } } catch { Debug.LogError((object)"USUAL SCRAP - Bandages experienced an error while loading. Skipping..."); } try { if (BoundConfig.MedicalKitLoaded.Value) { Item val4 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/MedicalKitAssets/US_MedicalKitItem.asset"); list.Add(val4); TerminalNode US_MedicalKitNode = val.LoadAsset<TerminalNode>("Assets/Items/MedicalKitAssets/US_MedicalKitNode.asset"); MedicalKitScript itemScript3 = val4.spawnPrefab.AddComponent<MedicalKitScript>(); InitializeItem((GrabbableObject)(object)itemScript3, grabbable: true, grabbableToEnemies: true, val4); if (BoundConfig.MedicalKitIsStoreItem.Value && BoundConfig.MedicalKitStorePrice.Value >= 0) { DawnLib.DefineItem(StoreItemKeys.US_MedicalKit, val4, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder) { shopBuilder.OverrideCost(BoundConfig.MedicalKitStorePrice.Value).OverrideInfoNode(US_MedicalKitNode); }); }); } } } catch { Debug.LogError((object)"USUAL SCRAP - Medical Kit experienced an error while loading. Skipping..."); } try { if (BoundConfig.DefibrillatorLoaded.Value) { Item val5 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/DefibrillatorAssets/US_DefibrillatorItem.asset"); list.Add(val5); TerminalNode US_DefibrillatorNode = val.LoadAsset<TerminalNode>("Assets/Items/DefibrillatorAssets/US_DefibrillatorNode.asset"); DefibrillatorScript itemScript4 = val5.spawnPrefab.AddComponent<DefibrillatorScript>(); InitializeItem((GrabbableObject)(object)itemScript4, grabbable: true, grabbableToEnemies: true, val5); if (BoundConfig.DefibrillatorIsStoreItem.Value && BoundConfig.DefibrillatorStorePrice.Value >= 0) { DawnLib.DefineItem(StoreItemKeys.US_Defibrillator, val5, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder) { shopBuilder.OverrideCost(BoundConfig.DefibrillatorStorePrice.Value).OverrideInfoNode(US_DefibrillatorNode); }); }); } } } catch { Debug.LogError((object)"USUAL SCRAP - Defibrillator experienced an error while loading. Skipping..."); } try { if (BoundConfig.ProductivityAutoinjectorLoaded.Value) { Item val6 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/ProductivityAutoinjectorAssets/US_ProductivityAutoinjectorItem.asset"); list.Add(val6); TerminalNode US_ProductivityAutoinjectorNode = val.LoadAsset<TerminalNode>("Assets/Items/ProductivityAutoinjectorAssets/US_ProductivityAutoinjectorNode.asset"); ProductivityAutoinjectorScript itemScript5 = val6.spawnPrefab.AddComponent<ProductivityAutoinjectorScript>(); InitializeItem((GrabbableObject)(object)itemScript5, grabbable: true, grabbableToEnemies: true, val6); if (BoundConfig.ProductivityAutoinjectorIsStoreItem.Value && BoundConfig.ProductivityAutoinjectorStorePrice.Value >= 0) { DawnLib.DefineItem(StoreItemKeys.US_ProductivityAutoinjector, val6, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder) { shopBuilder.OverrideCost(BoundConfig.ProductivityAutoinjectorStorePrice.Value).OverrideInfoNode(US_ProductivityAutoinjectorNode); }); }); } } } catch { Debug.LogError((object)"USUAL SCRAP - Productivity Autoinjector experienced an error while loading. Skipping..."); } try { if (BoundConfig.ToolkitLoaded.Value) { Item val7 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/ToolkitAssets/US_ToolkitItem.asset"); list.Add(val7); TerminalNode US_ToolkitNode = val.LoadAsset<TerminalNode>("Assets/Items/ToolkitAssets/US_ToolkitNode.asset"); ToolkitScript itemScript6 = val7.spawnPrefab.AddComponent<ToolkitScript>(); InitializeItem((GrabbableObject)(object)itemScript6, grabbable: true, grabbableToEnemies: true, val7); if (BoundConfig.ToolkitIsStoreItem.Value && BoundConfig.ToolkitStorePrice.Value >= 0) { DawnLib.DefineItem(StoreItemKeys.US_Toolkit, val7, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder) { shopBuilder.OverrideCost(BoundConfig.ToolkitStorePrice.Value).OverrideInfoNode(US_ToolkitNode); }); }); } } } catch { Debug.LogError((object)"USUAL SCRAP - Toolkit experienced an error while loading. Skipping..."); } try { if (BoundConfig.ShiftControllerLoaded.Value) { Item val8 = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/ShiftControllerAssets/US_ShiftControllerItem.asset"); list.Add(val8); TerminalNode US_ShiftControllerNode = val.LoadAsset<TerminalNode>("Assets/Items/ShiftControllerAssets/US_ShiftControllerNode.asset"); ShiftControllerScript itemScript7 = val8.spawnPrefab.AddComponent<ShiftControllerScript>(); InitializeItem((GrabbableObject)(object)itemScript7, grabbable: true, grabbableToEnemies: true, val8); if (BoundConfig.ShiftControllerIsStoreItem.Value && BoundConfig.ShiftControllerStorePrice.Value >= 0) { DawnLib.DefineItem(StoreItemKeys.US_ShiftController, val8, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineShop((Action<ShopBuilder>)delegate(ShopBuilder shopBuilder) { shopBuilder.OverrideCost(BoundConfig.ShiftControllerStorePrice.Value).OverrideInfoNode(US_ShiftControllerNode); }); }); } } } catch { Debug.LogError((object)"USUAL SCRAP - Shift Controller experienced an error while loading. Skipping..."); } Item US_Ticket = null; Item US_GoldenTicket = null; Item US_Rose = null; Item US_SizableScissors = null; Item US_WalkingCane = null; Item US_CandyDispenser = null; Item US_VintageCandy = null; Item US_FuelCylinder = null; Item US_RadioactiveCell = null; Item US_GloomyCapsule = null; Item US_FrigidCapsule = null; Item US_BloodyCapsule = null; Item US_Padlock = null; Item US_Crowbar = null; Item US_PocketWatch = null; Item US_ServantBell = null; Item US_ChessPieces = null; Item US_GoldenChessPieces = null; Item US_TrafficCone = null; Item US_MereGear = null; ((Registry<DawnMoonInfo>)(object)LethalContent.Moons).BeforeFreeze += DetectMoons; ((Registry<DawnMoonInfo>)(object)LethalContent.Moons).BeforeFreeze += SetWeights; try { if (BoundConfig.TicketLoaded.Value) { US_Ticket = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/TicketAssets/US_TicketItem.asset"); list.Add(US_Ticket); TicketScript itemScript8 = US_Ticket.spawnPrefab.AddComponent<TicketScript>(); InitializeItem((GrabbableObject)(object)itemScript8, grabbable: true, grabbableToEnemies: true, US_Ticket); } } catch { Debug.LogError((object)"USUAL SCRAP - Ticket experienced an error while loading. Skipping..."); } try { if (BoundConfig.GoldenTicketLoaded.Value) { US_GoldenTicket = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/GoldenTicketAssets/US_GoldenTicketItem.asset"); list.Add(US_GoldenTicket); GoldenTicketScript itemScript9 = US_GoldenTicket.spawnPrefab.AddComponent<GoldenTicketScript>(); InitializeItem((GrabbableObject)(object)itemScript9, grabbable: true, grabbableToEnemies: true, US_GoldenTicket); } } catch { Debug.LogError((object)"USUAL SCRAP - Golden Ticket experienced an error while loading. Skipping..."); } try { if (BoundConfig.RoseLoaded.Value) { US_Rose = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/RoseAssets/US_RoseItem.asset"); list.Add(US_Rose); RoseScript itemScript10 = US_Rose.spawnPrefab.AddComponent<RoseScript>(); InitializeItem((GrabbableObject)(object)itemScript10, grabbable: true, grabbableToEnemies: true, US_Rose); } } catch { Debug.LogError((object)"USUAL SCRAP - Rose experienced an error while loading. Skipping..."); } try { if (BoundConfig.SizableScissorsLoaded.Value) { US_SizableScissors = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/SizableScissorsAssets/US_SizableScissorsItem.asset"); list.Add(US_SizableScissors); SizableScissorsScript itemScript11 = US_SizableScissors.spawnPrefab.AddComponent<SizableScissorsScript>(); InitializeItem((GrabbableObject)(object)itemScript11, grabbable: true, grabbableToEnemies: true, US_SizableScissors); } } catch { Debug.LogError((object)"USUAL SCRAP - Scissors experienced an error while loading. Skipping..."); } try { if (BoundConfig.WalkingCaneLoaded.Value) { US_WalkingCane = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/WalkingCaneAssets/US_WalkingCaneItem.asset"); list.Add(US_WalkingCane); WalkingCaneScript itemScript12 = US_WalkingCane.spawnPrefab.AddComponent<WalkingCaneScript>(); InitializeItem((GrabbableObject)(object)itemScript12, grabbable: true, grabbableToEnemies: true, US_WalkingCane); } } catch { Debug.LogError((object)"USUAL SCRAP - Walking Cane experienced an error while loading. Skipping..."); } try { if (BoundConfig.CandyDispenserLoaded.Value) { US_CandyDispenser = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/CandyDispenserAssets/US_CandyDispenserItem.asset"); list.Add(US_CandyDispenser); CandyDispenserScript itemScript13 = US_CandyDispenser.spawnPrefab.AddComponent<CandyDispenserScript>(); InitializeItem((GrabbableObject)(object)itemScript13, grabbable: true, grabbableToEnemies: true, US_CandyDispenser); US_VintageCandy = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/VintageCandyAssets/US_VintageCandyItem.asset"); list.Add(US_VintageCandy); VintageCandyScript itemScript14 = US_VintageCandy.spawnPrefab.AddComponent<VintageCandyScript>(); InitializeItem((GrabbableObject)(object)itemScript14, grabbable: true, grabbableToEnemies: true, US_VintageCandy); } else if (BoundConfig.VintageCandyLoaded.Value) { US_VintageCandy = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/VintageCandyAssets/US_VintageCandyItem.asset"); list.Add(US_VintageCandy); VintageCandyScript itemScript15 = US_VintageCandy.spawnPrefab.AddComponent<VintageCandyScript>(); InitializeItem((GrabbableObject)(object)itemScript15, grabbable: true, grabbableToEnemies: true, US_VintageCandy); } } catch { Debug.LogError((object)"USUAL SCRAP - Candy Dispenser experienced an error while loading. Skipping..."); } try { if (BoundConfig.FuelCylinderLoaded.Value) { US_FuelCylinder = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/FuelCylinderAssets/US_FuelCylinderItem.asset"); list.Add(US_FuelCylinder); FuelCylinderScript itemScript16 = US_FuelCylinder.spawnPrefab.AddComponent<FuelCylinderScript>(); InitializeItem((GrabbableObject)(object)itemScript16, grabbable: true, grabbableToEnemies: true, US_FuelCylinder); } } catch { Debug.LogError((object)"USUAL SCRAP - Fuel Cylinder experienced an error while loading. Skipping..."); } try { if (BoundConfig.RadioactiveCellLoaded.Value) { US_RadioactiveCell = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/RadioactiveCellAssets/US_RadioactiveCellItem.asset"); list.Add(US_RadioactiveCell); RadioactiveCellScript itemScript17 = US_RadioactiveCell.spawnPrefab.AddComponent<RadioactiveCellScript>(); InitializeItem((GrabbableObject)(object)itemScript17, grabbable: true, grabbableToEnemies: true, US_RadioactiveCell); } } catch { Debug.LogError((object)"USUAL SCRAP - Radioactive Cell experienced an error while loading. Skipping..."); } try { if (BoundConfig.GloomyCapsuleLoaded.Value) { US_GloomyCapsule = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/GloomyCapsuleAssets/US_GloomyCapsuleItem.asset"); list.Add(US_GloomyCapsule); GloomyCapsuleScript itemScript18 = US_GloomyCapsule.spawnPrefab.AddComponent<GloomyCapsuleScript>(); InitializeItem((GrabbableObject)(object)itemScript18, grabbable: true, grabbableToEnemies: true, US_GloomyCapsule); } } catch { Debug.LogError((object)"USUAL SCRAP - Gloomy Capsule experienced an error while loading. Skipping..."); } try { if (BoundConfig.FrigidCapsuleLoaded.Value) { US_FrigidCapsule = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/FrigidCapsuleAssets/US_FrigidCapsuleItem.asset"); list.Add(US_FrigidCapsule); FrigidCapsuleScript itemScript19 = US_FrigidCapsule.spawnPrefab.AddComponent<FrigidCapsuleScript>(); InitializeItem((GrabbableObject)(object)itemScript19, grabbable: true, grabbableToEnemies: true, US_FrigidCapsule); } } catch { Debug.LogError((object)"USUAL SCRAP - Frigid Capsule experienced an error while loading. Skipping..."); } try { if (BoundConfig.BloodyCapsuleLoaded.Value) { US_BloodyCapsule = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/BloodyCapsuleAssets/US_BloodyCapsuleItem.asset"); list.Add(US_BloodyCapsule); BloodyCapsuleScript itemScript20 = US_BloodyCapsule.spawnPrefab.AddComponent<BloodyCapsuleScript>(); InitializeItem((GrabbableObject)(object)itemScript20, grabbable: true, grabbableToEnemies: true, US_BloodyCapsule); } } catch { Debug.LogError((object)"USUAL SCRAP - Bloody Capsule experienced an error while loading. Skipping..."); } try { if (BoundConfig.PadlockLoaded.Value) { US_Padlock = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/PadlockAssets/US_PadlockItem.asset"); list.Add(US_Padlock); PadlockScript itemScript21 = US_Padlock.spawnPrefab.AddComponent<PadlockScript>(); InitializeItem((GrabbableObject)(object)itemScript21, grabbable: true, grabbableToEnemies: true, US_Padlock); } } catch { Debug.LogError((object)"USUAL SCRAP - Padlock experienced an error while loading. Skipping..."); } try { if (BoundConfig.CrowbarLoaded.Value) { US_Crowbar = val.LoadAsset<Item>("Assets/UsualScrapContent/Items/CrowbarAssets/US_CrowbarItem.asset"); list.Add(US_Crowbar); CrowbarScript itemScript22 = US_Crowbar.spawnPrefab.AddComponent<CrowbarScript>(); InitializeItem((GrabbableObject)(object)itemScript22, grabbable: true, grabbableToEnemies: true, US_Crowbar); } } catch { Debug.LogError((object)"USUAL SCRAP - Crowbar experienced an error while loading. Skipping..."); } if (BoundConfig.MansionScrapPackEnabled.Value) { try { US_PocketWatch = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/PocketWatchAssets/US_PocketWatchItem.asset"); list.Add(US_PocketWatch); PhysicsProp itemScript23 = US_PocketWatch.spawnPrefab.AddComponent<PhysicsProp>(); InitializeItem((GrabbableObject)(object)itemScript23, grabbable: true, grabbableToEnemies: true, US_PocketWatch); } catch { Debug.LogError((object)"USUAL SCRAP - Pocket Watch scrap pack item experienced an error while loading. Skipping..."); } try { US_ServantBell = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/ServantBellAssets/US_ServantBellItem.asset"); list.Add(US_ServantBell); NoiseMakerScript itemScript24 = US_ServantBell.spawnPrefab.AddComponent<NoiseMakerScript>(); InitializeItem((GrabbableObject)(object)itemScript24, grabbable: true, grabbableToEnemies: true, US_ServantBell); } catch { Debug.LogError((object)"USUAL SCRAP - Servant Bell scrap pack item experienced an error while loading. Skipping..."); } try { US_ChessPieces = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/ChessPiecesAssets/US_ChessPiecesItem.asset"); list.Add(US_ChessPieces); RandomModelBNWScript randomModelBNWScript = US_ChessPieces.spawnPrefab.AddComponent<RandomModelBNWScript>(); randomModelBNWScript.changeColor = true; InitializeItem((GrabbableObject)(object)randomModelBNWScript, grabbable: true, grabbableToEnemies: true, US_ChessPieces); } catch { Debug.LogError((object)"USUAL SCRAP - Chess Pieces scrap pack item experienced an error while loading. Skipping..."); } try { US_GoldenChessPieces = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/GoldenChessPiecesAssets/US_GoldenChessPiecesItem.asset"); list.Add(US_GoldenChessPieces); RandomModelBNWScript randomModelBNWScript2 = US_GoldenChessPieces.spawnPrefab.AddComponent<RandomModelBNWScript>(); randomModelBNWScript2.changeColor = false; InitializeItem((GrabbableObject)(object)randomModelBNWScript2, grabbable: true, grabbableToEnemies: true, US_GoldenChessPieces); } catch { Debug.LogError((object)"USUAL SCRAP - Golden Chess Pieces scrap pack item experienced an error while loading. Skipping..."); } } if (BoundConfig.FacilityScrapPackEnabled.Value) { try { US_TrafficCone = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/TrafficConeAssets/US_TrafficConeItem.asset"); list.Add(US_TrafficCone); PhysicsProp itemScript25 = US_TrafficCone.spawnPrefab.AddComponent<PhysicsProp>(); InitializeItem((GrabbableObject)(object)itemScript25, grabbable: true, grabbableToEnemies: true, US_TrafficCone); } catch { Debug.LogError((object)"USUAL SCRAP - Traffic Cone scrap pack item experienced an error while loading. Skipping..."); } try { US_MereGear = val.LoadAsset<Item>("Assets/UsualScrapContent/ScrapPackItems/MereGearAssets/US_MereGearItem.asset"); list.Add(US_MereGear); PhysicsProp itemScript26 = US_MereGear.spawnPrefab.AddComponent<PhysicsProp>(); InitializeItem((GrabbableObject)(object)itemScript26, grabbable: true, grabbableToEnemies: true, US_MereGear); } catch { Debug.LogError((object)"USUAL SCRAP - Mere Gear scrap pack item experienced an error while loading. Skipping..."); } } if (BoundConfig.DisableItemIcons.Value) { foreach (Item item in list) { item.itemIcon = null; } } Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Emil.UsualScrap"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Emil.UsualScrap is loaded!"); void SetWeights() { if (BoundConfig.MansionScrapPackEnabled.Value) { try { if ((Object)(object)US_PocketWatch != (Object)null) { string[] pocketWatchMoonStrings = BoundConfig.PocketWatchMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapPackKeys.US_PocketWatch, US_PocketWatch, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, pocketWatchMoonStrings, US_Ticket, BoundConfig.PocketWatchMoonSpawnWeights, BoundConfig.PocketWatchGlobalSpawnWeight); }); }); }); } if ((Object)(object)US_ServantBell != (Object)null) { string[] servantBellMoonStrings = BoundConfig.ServantBellMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapPackKeys.US_ServantBell, US_ServantBell, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, servantBellMoonStrings, US_Ticket, BoundConfig.ServantBellMoonSpawnWeights, BoundConfig.ServantBellGlobalSpawnWeight); }); }); }); } if ((Object)(object)US_ChessPieces != (Object)null) { string[] chessPiecesMoonStrings = BoundConfig.ChessPiecesMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapPackKeys.US_ChessPieces, US_ChessPieces, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, chessPiecesMoonStrings, US_Ticket, BoundConfig.ChessPiecesMoonSpawnWeights, BoundConfig.ChessPiecesGlobalSpawnWeight); }); }); }); } if ((Object)(object)US_GoldenChessPieces != (Object)null) { string[] goldenChessPiecesMoonStrings = BoundConfig.GoldenChessPiecesMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapPackKeys.US_GoldenChessPieces, US_GoldenChessPieces, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, goldenChessPiecesMoonStrings, US_Ticket, BoundConfig.GoldenChessPiecesMoonSpawnWeights, BoundConfig.GoldenChessPiecesGlobalSpawnWeight); }); }); }); } } catch { } } if (BoundConfig.FacilityScrapPackEnabled.Value) { try { if ((Object)(object)US_TrafficCone != (Object)null) { string[] trafficConeMoonStrings = BoundConfig.TrafficConeMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapPackKeys.US_TrafficCone, US_TrafficCone, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, trafficConeMoonStrings, US_TrafficCone, BoundConfig.TrafficConeMoonSpawnWeights, BoundConfig.TrafficConeGlobalSpawnWeight); }); }); }); } if ((Object)(object)US_MereGear != (Object)null) { string[] mereGearMoonStrings = BoundConfig.MereGearMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapPackKeys.US_MereGear, US_MereGear, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, mereGearMoonStrings, US_MereGear, BoundConfig.MereGearMoonSpawnWeights, BoundConfig.MereGearGlobalSpawnWeight); }); }); }); } } catch { } } if ((Object)(object)US_Ticket != (Object)null) { if (BoundConfig.GoldenTicketSpawnsAsScrap.Value) { string[] ticketMoonStrings = BoundConfig.TicketMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_Ticket, US_Ticket, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, ticketMoonStrings, US_Ticket, BoundConfig.TicketMoonSpawnWeights, BoundConfig.TicketGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_GoldenTicket); } if ((Object)(object)US_GoldenTicket != (Object)null) { if (BoundConfig.GoldenTicketSpawnsAsScrap.Value) { string[] goldenTicketMoonStrings = BoundConfig.GoldenTicketMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_GoldenTicket, US_GoldenTicket, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, goldenTicketMoonStrings, US_GoldenTicket, BoundConfig.GoldenTicketMoonSpawnWeights, BoundConfig.GoldenTicketGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_GoldenTicket); } if ((Object)(object)US_Rose != (Object)null) { if (BoundConfig.RoseSpawnsAsScrap.Value) { string[] roseMoonStrings = BoundConfig.RoseMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_Rose, US_Rose, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, roseMoonStrings, US_Rose, BoundConfig.RoseMoonSpawnWeights, BoundConfig.RoseGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_Rose); } } if ((Object)(object)US_SizableScissors != (Object)null) { if (BoundConfig.SizableScissorsSpawnsAsScrap.Value) { string[] sizableScissorsMoonStrings = BoundConfig.SizableScissorsMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_SizableScissors, US_SizableScissors, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, sizableScissorsMoonStrings, US_SizableScissors, BoundConfig.SizableScissorsMoonSpawnWeights, BoundConfig.SizableScissorsGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_SizableScissors); } } if ((Object)(object)US_WalkingCane != (Object)null) { if (BoundConfig.WalkingCaneSpawnsAsScrap.Value) { string[] walkingCaneMoonStrings = BoundConfig.WalkingCaneMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_WalkingCane, US_WalkingCane, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, walkingCaneMoonStrings, US_WalkingCane, BoundConfig.WalkingCaneMoonSpawnWeights, BoundConfig.WalkingCaneGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_WalkingCane); } } if ((Object)(object)US_CandyDispenser != (Object)null && (Object)(object)US_VintageCandy != (Object)null) { if (BoundConfig.CandyDispenserSpawnsAsScrap.Value) { string[] candyDispenserMoonStrings = BoundConfig.CandyDispenserMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_CandyDispenser, US_CandyDispenser, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, candyDispenserMoonStrings, US_CandyDispenser, BoundConfig.CandyDispenserMoonSpawnWeights, BoundConfig.CandyDispenserGlobalSpawnWeight); }); }); }); string[] vintageCandyMoonStrings = BoundConfig.VintageCandyMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_VintageCandy, US_VintageCandy, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, vintageCandyMoonStrings, US_VintageCandy, BoundConfig.VintageCandyMoonSpawnWeights, BoundConfig.VintageCandyGlobalSpawnWeight); }); }); }); } else if (BoundConfig.VintageCandySpawnsAsScrap.Value && !BoundConfig.CandyDispenserSpawnsAsScrap.Value) { string[] vintageCandyMoonStrings2 = BoundConfig.VintageCandyMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_VintageCandy, US_VintageCandy, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, vintageCandyMoonStrings2, US_VintageCandy, BoundConfig.VintageCandyMoonSpawnWeights, BoundConfig.VintageCandyGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_CandyDispenser); Items.RegisterItem(US_VintageCandy); } } if ((Object)(object)US_FuelCylinder != (Object)null) { if (BoundConfig.FuelCylinderSpawnsAsScrap.Value) { string[] fuelCylinderMoonStrings = BoundConfig.FuelCylinderMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_FuelCylinder, US_FuelCylinder, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, fuelCylinderMoonStrings, US_FuelCylinder, BoundConfig.FuelCylinderMoonSpawnWeights, BoundConfig.FuelCylinderGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_FuelCylinder); } } if ((Object)(object)US_RadioactiveCell != (Object)null) { if (BoundConfig.RadioactiveCellSpawnsAsScrap.Value) { string[] radioactiveCellMoonStrings = BoundConfig.RadioactiveCellMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_RadioactiveCell, US_RadioactiveCell, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, radioactiveCellMoonStrings, US_RadioactiveCell, BoundConfig.RadioactiveCellMoonSpawnWeights, BoundConfig.RadioactiveCellGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_RadioactiveCell); } } if ((Object)(object)US_GloomyCapsule != (Object)null) { if (BoundConfig.GloomyCapsuleSpawnsAsScrap.Value) { string[] gloomyCapsuleMoonStrings = BoundConfig.GloomyCapsuleMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_GloomyCapsule, US_GloomyCapsule, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, gloomyCapsuleMoonStrings, US_GloomyCapsule, BoundConfig.GloomyCapsuleMoonSpawnWeights, BoundConfig.GloomyCapsuleGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_GloomyCapsule); } } if ((Object)(object)US_FrigidCapsule != (Object)null) { if (BoundConfig.FrigidCapsuleSpawnsAsScrap.Value) { string[] frigidCapsuleMoonStrings = BoundConfig.FrigidCapsuleMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_FrigidCapsule, US_FrigidCapsule, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, frigidCapsuleMoonStrings, US_FrigidCapsule, BoundConfig.FrigidCapsuleMoonSpawnWeights, BoundConfig.FrigidCapsuleGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_FrigidCapsule); } } if ((Object)(object)US_BloodyCapsule != (Object)null) { if (BoundConfig.BloodyCapsuleSpawnsAsScrap.Value) { string[] bloodyCapsuleMoonStrings = BoundConfig.BloodyCapsuleMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_BloodyCapsule, US_BloodyCapsule, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, bloodyCapsuleMoonStrings, US_BloodyCapsule, BoundConfig.BloodyCapsuleMoonSpawnWeights, BoundConfig.BloodyCapsuleGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_BloodyCapsule); } } if ((Object)(object)US_Padlock != (Object)null) { if (BoundConfig.PadlockSpawnsAsScrap.Value) { string[] padlockMoonStrings = BoundConfig.PadlockMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_Padlock, US_Padlock, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, padlockMoonStrings, US_Padlock, BoundConfig.PadlockMoonSpawnWeights, BoundConfig.PadlockGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_Padlock); } } if ((Object)(object)US_Crowbar != (Object)null) { if (BoundConfig.CrowbarSpawnsAsScrap.Value) { string[] crowbarMoonStrings = BoundConfig.CrowbarMoonSpawnWeights.Value.Split(','); DawnLib.DefineItem(ScrapItemKeys.US_Crowbar, US_Crowbar, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder) { builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder) { scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder) { buildallweights(weightBuilder, crowbarMoonStrings, US_Crowbar, BoundConfig.CrowbarMoonSpawnWeights, BoundConfig.CrowbarGlobalSpawnWeight); }); }); }); } else { Items.RegisterItem(US_Crowbar); } } } } } void buildallweights(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> builder, string[] moonStrings, Item item, ConfigEntry<string> moonWeightConfig, ConfigEntry<int> globalWeightConfig) { List<string> list2 = new List<string>(); Dictionary<string, int> dictionary = new Dictionary<string, int>(); List<string> list3 = new List<string>(); foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, DawnMoonInfo> finalMoon in FinalMoons) { foreach (string text in moonStrings) { try { string[] array3 = text.Split('='); string text2 = array3[0].Trim().ToLowerInvariant(); string s = array3[1].Trim(); int num = int.Parse(s); string text3 = Regex.Replace(finalMoon.Value.Level.PlanetName, "[\\d\\s]", "").Trim().ToLowerInvariant(); if (text3 == text2 && num >= 0) { if (BoundConfig.DebugLogging.Value) { MonoBehaviour.print((object)$"Setting moon {finalMoon}'s weight to moon weight {num} for {item}"); } dictionary[text2] = num; builder.AddWeight(finalMoon.Key, num); list2.Add(text2); } else if (text3 == text2 && num <= -1 && globalWeightConfig.Value >= 0) { if (BoundConfig.DebugLogging.Value) { MonoBehaviour.print((object)$"Setting moon {finalMoon}'s weight to global weight {globalWeightConfig} for {item}"); } dictionary[text2] = -1; builder.AddWeight(finalMoon.Key, globalWeightConfig.Value); list2.Add(text2); } else if (text3 == text2 && num <= -1 && globalWeightConfig.Value == -1) { list2.Add(text2); dictionary[text2] = -1; } else if ((text2 == null || !(text3 != text2)) && !list3.Contains(text)) { Debug.LogWarning((object)$"Usual Scrap - Moon weight config entry [{text2}] from [{item}] is unreadable and returned an error. Reformatting and resetting entry..."); list3.Add(text); } } catch { if (!list3.Contains(text)) { Debug.LogWarning((object)$"Usual Scrap - Moon weight config entry [{text}] from [{item}] is unreadable and returned an error. Reformatting and resetting entry..."); list3.Add(text); } } } } foreach (string text4 in moonStrings) { try { string text5 = text4.Split('=')[0].Trim().ToLowerInvariant(); if (!list2.Contains(text5) && !string.IsNullOrWhiteSpace(text5)) { Debug.LogWarning((object)$"Usual Scrap - Config entry '{text5}' for [{item}] does not match any loaded moons or is formatted incorrectly. Reformatting and resetting entry..."); } } catch { } } foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, DawnMoonInfo> finalMoon2 in FinalMoons) { string text6 = Regex.Replace(finalMoon2.Value.Level.PlanetName, "[\\d\\s]", "").Trim().ToLowerInvariant(); if (!list2.Contains(text6)) { if (BoundConfig.DebugLogging.Value) { Debug.LogWarning((object)$"{item} config does not contain {text6}, adding it to the config.. Weight setting skipped for this moon.."); } bool flag = false; foreach (string text7 in moonStrings) { if (text7.ToLowerInvariant().Contains(text6)) { flag = true; break; } } if (!flag) { string text8 = moonWeightConfig.Value; if (!string.IsNullOrWhiteSpace(text8) && !text8.EndsWith(",")) { text8 += ", "; } text8 = text8 + text6 + "=-1"; moonWeightConfig.Value = text8; list2.Add(text6); } } } List<string> list4 = new List<string>(); foreach (string item2 in list2) { int num2 = (dictionary.ContainsKey(item2) ? dictionary[item2] : (-1)); list4.Add($"{item2}={num2}"); } string value = string.Join(", ", list4); moonWeightConfig.Value = value; ((BaseUnityPlugin)this).Config.Save(); string text9 = $"USUAL SCRAP - {item} spawn weights successfully set for "; foreach (string item3 in list2) { text9 = text9 + item3 + ", "; } if (BoundConfig.DebugLogging.Value) { MonoBehaviour.print((object)text9); } } } private void DetectMoons() { TaggedRegistry<DawnMoonInfo> moons = LethalContent.Moons; List<TerminalKeyword> list = new List<TerminalKeyword>(); TerminalKeyword[] allKeywords = Object.FindObjectOfType<Terminal>().terminalNodes.allKeywords; TerminalKeyword[] array = allKeywords; foreach (TerminalKeyword val in array) { if (!(((Object)val).name == "route") && !(((Object)val).name == "Route")) { continue; } CompatibleNoun[] compatibleNouns = val.compatibleNouns; foreach (CompatibleNoun val2 in compatibleNouns) { if (!list.Contains(val2.noun)) { list.Add(val2.noun); } } } foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, DawnMoonInfo> item in (Registry<DawnMoonInfo>)(object)moons) { foreach (TerminalKeyword item2 in list) { if ((Object)(object)item.Value.NameKeyword == (Object)(object)item2 && item.Value.Level.spawnEnemiesAndScrap) { FinalMoons.Add(item); FinalMoonNames.Add(((object)item.Value.NameKeyword).ToString().ToLowerInvariant().Trim()); } } } } } internal class UsualScrapConfigs { public readonly ConfigEntry<bool> MansionScrapPackEnabled; public readonly ConfigEntry<bool> FacilityScrapPackEnabled; public readonly ConfigEntry<bool> TicketLoaded; public readonly ConfigEntry<bool> TicketSpawnsAsScrap; public readonly ConfigEntry<string> TicketMoonSpawnWeights; public readonly ConfigEntry<int> TicketGlobalSpawnWeight; public readonly ConfigEntry<bool> GoldenTicketLoaded; public readonly ConfigEntry<bool> GoldenTicketSpawnsAsScrap; public readonly ConfigEntry<string> GoldenTicketMoonSpawnWeights; public readonly ConfigEntry<int> GoldenTicketGlobalSpawnWeight; public readonly ConfigEntry<bool> RoseLoaded; public readonly ConfigEntry<bool> RoseSpawnsAsScrap; public readonly ConfigEntry<string> RoseMoonSpawnWeights; public readonly ConfigEntry<int> RoseGlobalSpawnWeight; public readonly ConfigEntry<bool> SizableScissorsLoaded; public readonly ConfigEntry<bool> SizableScissorsSpawnsAsScrap; public readonly ConfigEntry<string> SizableScissorsMoonSpawnWeights; public readonly ConfigEntry<int> SizableScissorsGlobalSpawnWeight; public readonly ConfigEntry<bool> WalkingCaneLoaded; public readonly ConfigEntry<bool> WalkingCaneSpawnsAsScrap; public readonly ConfigEntry<string> WalkingCaneMoonSpawnWeights; public readonly ConfigEntry<int> WalkingCaneGlobalSpawnWeight; public readonly ConfigEntry<bool> CandyDispenserLoaded; public readonly ConfigEntry<bool> CandyDispenserSpawnsAsScrap; public readonly ConfigEntry<string> CandyDispenserMoonSpawnWeights; public readonly ConfigEntry<int> CandyDispenserGlobalSpawnWeight; public readonly ConfigEntry<bool> VintageCandyLoaded; public readonly ConfigEntry<bool> VintageCandySpawnsAsScrap; public readonly ConfigEntry<string> VintageCandyMoonSpawnWeights; public readonly ConfigEntry<int> VintageCandyGlobalSpawnWeight; public readonly ConfigEntry<bool> FuelCylinderLoaded; public readonly ConfigEntry<bool> FuelCylinderSpawnsAsScrap; public readonly ConfigEntry<string> FuelCylinderMoonSpawnWeights; public readonly ConfigEntry<int> FuelCylinderGlobalSpawnWeight; public readonly ConfigEntry<bool> RadioactiveCellLoaded; public readonly ConfigEntry<bool> RadioactiveCellSpawnsAsScrap; public readonly ConfigEntry<string> RadioactiveCellMoonSpawnWeights; public readonly ConfigEntry<int> RadioactiveCellGlobalSpawnWeight; public readonly ConfigEntry<bool> GloomyCapsuleLoaded; public readonly ConfigEntry<bool> GloomyCapsuleSpawnsAsScrap; public readonly ConfigEntry<string> GloomyCapsuleMoonSpawnWeights; public readonly ConfigEntry<int> GloomyCapsuleGlobalSpawnWeight; public readonly ConfigEntry<bool> FrigidCapsuleLoaded; public readonly ConfigEntry<bool> FrigidCapsuleSpawnsAsScrap; public readonly ConfigEntry<string> FrigidCapsuleMoonSpawnWeights; public readonly ConfigEntry<int> FrigidCapsuleGlobalSpawnWeight; public readonly ConfigEntry<bool> BloodyCapsuleLoaded; public readonly ConfigEntry<bool> BloodyCapsuleSpawnsAsScrap; public readonly ConfigEntry<string> BloodyCapsuleMoonSpawnWeights; public readonly ConfigEntry<int> BloodyCapsuleGlobalSpawnWeight; public readonly ConfigEntry<bool> PadlockLoaded; public readonly ConfigEntry<bool> PadlockSpawnsAsScrap; public readonly ConfigEntry<string> PadlockMoonSpawnWeights; public readonly ConfigEntry<int> PadlockGlobalSpawnWeight; public readonly ConfigEntry<bool> CrowbarLoaded; public readonly ConfigEntry<bool> CrowbarSpawnsAsScrap; public readonly ConfigEntry<string> CrowbarMoonSpawnWeights; public readonly ConfigEntry<int> CrowbarGlobalSpawnWeight; public readonly ConfigEntry<bool> HandlampLoaded; public readonly ConfigEntry<bool> HandlampIsStoreItem; public readonly ConfigEntry<int> HandlampStorePrice; public readonly ConfigEntry<bool> BandagesLoaded; public readonly ConfigEntry<bool> BandagesIsStoreItem; public readonly ConfigEntry<int> BandagesStorePrice; public readonly ConfigEntry<bool> MedicalKitLoaded; public readonly ConfigEntry<bool> MedicalKitIsStoreItem; public readonly ConfigEntry<int> MedicalKitStorePrice; public readonly ConfigEntry<bool> DefibrillatorLoaded; public readonly ConfigEntry<bool> DefibrillatorIsStoreItem; public readonly ConfigEntry<int> DefibrillatorStorePrice; public readonly ConfigEntry<bool> DefibrillatorRequiresBattery; public readonly ConfigEntry<bool> DefibrillatorUsesLimited; public readonly ConfigEntry<int> DefibrillatorUseLimit; public readonly ConfigEntry<bool> DefibrillatorPermaDeathRule; public readonly ConfigEntry<bool> DefibrillatorRefillsOnLanding; public readonly ConfigEntry<bool> ProductivityAutoinjectorLoaded; public readonly ConfigEntry<bool> ProductivityAutoinjectorIsStoreItem; public readonly ConfigEntry<int> ProductivityAutoinjectorStorePrice; public readonly ConfigEntry<bool> ToolkitLoaded; public readonly ConfigEntry<bool> ToolkitIsStoreItem; public readonly ConfigEntry<int> ToolkitStorePrice; public readonly ConfigEntry<bool> ShiftControllerLoaded; public readonly ConfigEntry<bool> ShiftControllerIsStoreItem; public readonly ConfigEntry<int> ShiftControllerStorePrice; public readonly ConfigEntry<int> ShiftControllerGreatRange; public readonly ConfigEntry<int> ShiftControllerPoorRange; public readonly ConfigEntry<string> PocketWatchMoonSpawnWeights; public readonly ConfigEntry<int> PocketWatchGlobalSpawnWeight; public readonly ConfigEntry<string> ServantBellMoonSpawnWeights; public readonly ConfigEntry<int> ServantBellGlobalSpawnWeight; public readonly ConfigEntry<string> ChessPiecesMoonSpawnWeights; public readonly ConfigEntry<int> ChessPiecesGlobalSpawnWeight; public readonly ConfigEntry<string> GoldenChessPiecesMoonSpawnWeights; public readonly ConfigEntry<int> GoldenChessPiecesGlobalSpawnWeight; public readonly ConfigEntry<string> TrafficConeMoonSpawnWeights; public readonly ConfigEntry<int> TrafficConeGlobalSpawnWeight; public readonly ConfigEntry<string> MereGearMoonSpawnWeights; public readonly ConfigEntry<int> MereGearGlobalSpawnWeight; public readonly ConfigEntry<bool> CapsulesDisabledOnTheShip; public readonly ConfigEntry<bool> TicketsFunctionOnCheapItems; public readonly ConfigEntry<bool> DisableItemIcons; public readonly ConfigEntry<bool> TrueSurvivorPreset; public readonly ConfigEntry<bool> NoScrapItemsPreset; public readonly ConfigEntry<bool> NoStoreItemsPreset; public readonly ConfigEntry<bool> DebugLogging; public UsualScrapConfigs(ConfigFile cfg) { try { string configFilePath = cfg.ConfigFilePath; if (File.Exists(configFilePath)) { string destFileName = configFilePath + ".bak"; File.Copy(configFilePath, destFileName, overwrite: true); } } catch (Exception ex) { Debug.LogWarning((object)("Usual Scrap - Failed to create config backup: " + ex.Message)); } cfg.SaveOnConfigSet = false; DebugLogging = cfg.Bind<bool>("1. Debugging", "Log actions for debugging purposes", false, "Whether or not to log actions for debugging purposes"); DisableItemIcons = cfg.Bind<bool>("2. General Options", "Disable Item Icons", false, "Whether or not to disable this mod's items icons (For use with runtime icons and similar mods)"); MansionScrapPackEnabled = cfg.Bind<bool>("4. Scrap Packs", "Mansion Scrap Pack Enabled", false, "Whether or not the Mansion Scrap Pack is enabled, required for scrap pack items below to spawn. Scrap Packs include thematic items that have little to no function besides being scrap, they could be considered bloat and so they are toggleable."); FacilityScrapPackEnabled = cfg.Bind<bool>("4. Scrap Packs", "Facility Scrap Pack Enabled", false, "Whether or not the Facility Scrap Pack is enabled, required for scrap pack items below to spawn. Scrap Packs include thematic items that have little to no function besides being scrap, they could be considered bloat and so they are toggleable."); PocketWatchMoonSpawnWeights = cfg.Bind<string>("5. Scrap Pack Items", "Pocket Watch Moon Spawn Weight", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Pocket Watch will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); PocketWatchGlobalSpawnWeight = cfg.Bind<int>("5. Scrap Pack Items", "Pocket Watch Global Spawn Weight", 15, "How often the Pocket Watch will spawn globally (Will affect all moons including modded moons, -1 to disable)"); ServantBellMoonSpawnWeights = cfg.Bind<string>("5. Scrap Pack Items", "Servant Bell Moon Spawn Weight", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Servant Bell will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); ServantBellGlobalSpawnWeight = cfg.Bind<int>("5. Scrap Pack Items", "Servant Bell Global Spawn Weight", 15, "How often the Servant Bell will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); ChessPiecesMoonSpawnWeights = cfg.Bind<string>("5. Scrap Pack Items", "Chess Pieces Moon Spawn Weight", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often Chess Pieces will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); ChessPiecesGlobalSpawnWeight = cfg.Bind<int>("5. Scrap Pack Items", "Chess Pieces Global Spawn Weight", 30, "How often Chess Pieces will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); GoldenChessPiecesMoonSpawnWeights = cfg.Bind<string>("5. Scrap Pack Items", "Golden Chess Pieces Moon Spawn Weight", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often Golden Chess Pieces will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); GoldenChessPiecesGlobalSpawnWeight = cfg.Bind<int>("5. Scrap Pack Items", "Golden Chess Pieces Global Spawn Weight", 10, "How often Golden Chess Pieces will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); TrafficConeMoonSpawnWeights = cfg.Bind<string>("5. Scrap Pack Items", "Traffic Cone Moon Spawn Weight", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Traffic Cone will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); TrafficConeGlobalSpawnWeight = cfg.Bind<int>("5. Scrap Pack Items", "Traffic Cone Global Spawn Weight", 20, "How often Traffic Cone will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); MereGearMoonSpawnWeights = cfg.Bind<string>("5. Scrap Pack Items", "Mere Gear Moon Spawn Weight", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Mere Gear will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); MereGearGlobalSpawnWeight = cfg.Bind<int>("5. Scrap Pack Items", "Mere Gear Global Spawn Weight", 20, "How often Mere Gear will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); TicketsFunctionOnCheapItems = cfg.Bind<bool>("Scrap Items - Tickets", "Tickets function on cheap items", true, "Whether or not tickets function when used on items with a value below 5 (Meaning tickets will no longer work on most equipment whose value is normally 0)"); TicketLoaded = cfg.Bind<bool>("Scrap Items - Tickets", "Ticket is loaded", true, "Whether or not the Ticket is loaded"); TicketSpawnsAsScrap = cfg.Bind<bool>("Scrap Items - Tickets", "Ticket is a scrap item", true, "Whether or not the Ticket spawns as scrap"); TicketMoonSpawnWeights = cfg.Bind<string>("Scrap Items - Tickets", "Ticket Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Ticket will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); TicketGlobalSpawnWeight = cfg.Bind<int>("Scrap Items - Tickets", "Ticket Global Spawning", 40, "How often the Ticket will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); GoldenTicketLoaded = cfg.Bind<bool>("Scrap Items - Tickets", "Golden Ticket is loaded", true, "Whether or not the Golden Ticket is loaded"); GoldenTicketSpawnsAsScrap = cfg.Bind<bool>("Scrap Items - Tickets", "Golden Ticket is a scrap item", true, "Whether or not the Golden Ticket spawns as scrap"); GoldenTicketMoonSpawnWeights = cfg.Bind<string>("Scrap Items - Tickets", "Golden Ticket Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Golden Ticket will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); GoldenTicketGlobalSpawnWeight = cfg.Bind<int>("Scrap Items - Tickets", "Golden Ticket Global Spawning", 5, "How often the Golden Ticket will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); RoseLoaded = cfg.Bind<bool>("Scrap Item - Rose", "Rose is loaded", true, "Whether or not the Rose is loaded"); RoseSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Rose", "Rose is a scrap item", true, "Whether or not the Rose spawns as scrap"); RoseMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Rose", "Rose Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Rose will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); RoseGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Rose", "Rose Global Spawning", 30, "How often the Rose will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); SizableScissorsLoaded = cfg.Bind<bool>("Scrap Item - Sizable Scissors", "Sizable Scissors is loaded", true, "Whether or not the Sizable Scissors is loaded"); SizableScissorsSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Sizable Scissors", "Sizable Scissors is a scrap item", true, "Whether or not the Sizable Scissors spawns as scrap"); SizableScissorsMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Sizable Scissors", "Sizable Scissors Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Sizable Scissors will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); SizableScissorsGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Sizable Scissors", "Sizable Scissors Global Spawning", 20, "How often the Sizable Scissors will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); WalkingCaneLoaded = cfg.Bind<bool>("Scrap Item - Walking Cane", "Walking Cane is loaded", true, "Whether or not the Walking Cane is loaded"); WalkingCaneSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Walking Cane", "Walking Cane is a scrap item", true, "Whether or not the Walking Cane spawns as scrap"); WalkingCaneMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Walking Cane", "Walking Cane Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often Walking Cane will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); WalkingCaneGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Walking Cane", "Walking Cane Global Spawning", 15, "How often the Walking Cane will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); CandyDispenserLoaded = cfg.Bind<bool>("Scrap Item - Candy Dispenser", "Candy Dispenser is loaded", true, "Whether or not the Candy Dispenser is loaded"); CandyDispenserSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Candy Dispenser", "Candy Dispenser is a scrap item", true, "Whether or not the Candy Dispenser spawns as scrap"); CandyDispenserMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Candy Dispenser", "Candy Dispenser Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Candy Dispenser will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); CandyDispenserGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Candy Dispenser", "Candy Dispenser Global Spawning", 30, "How often the Candy Dispenser will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); VintageCandyLoaded = cfg.Bind<bool>("Scrap Item - Vintage Candy", "Vintage Candy is loaded", true, "Whether or not the Vintage Candy is loaded"); VintageCandySpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Vintage Candy", "Vintage Candy is a scrap item", true, "Whether or not the Vintage Candy spawns as scrap"); VintageCandyMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Vintage Candy", "Vintage Candy Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often Vintage Candy will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); VintageCandyGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Vintage Candy", "Vintage Candy Global Spawning", 20, "How often Vintage Candy will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); FuelCylinderLoaded = cfg.Bind<bool>("Scrap Item - Fuel Cylinder", "Fuel Cylinder is loaded", true, "Whether or not the Fuel Cylinder is loaded"); FuelCylinderSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Fuel Cylinder", "Fuel Cylinder is a scrap item", true, "Whether or not the Fuel Cylinder spawns as scrap"); FuelCylinderMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Fuel Cylinder", "Fuel Cylinder Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Fuel Cylinder will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); FuelCylinderGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Fuel Cylinder", "Fuel Cylinder Global Spawning", 20, "How often the Fuel Cylinder will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); RadioactiveCellLoaded = cfg.Bind<bool>("Scrap Item - Radioactive Cell", "Radioactive Cell is loaded", true, "Whether or not the Radioactive Cell is loaded"); RadioactiveCellSpawnsAsScrap = cfg.Bind<bool>("Scrap Item - Radioactive Cell", "Radioactive Cell is a scrap item", true, "Whether or not the Radioactive Cell spawns as scrap"); RadioactiveCellMoonSpawnWeights = cfg.Bind<string>("Scrap Item - Radioactive Cell", "Radioactive Cell Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Radioactive Cell will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); RadioactiveCellGlobalSpawnWeight = cfg.Bind<int>("Scrap Item - Radioactive Cell", "Radioactive Cell Global Spawning", 20, "How often the Radioactive Cell will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); CapsulesDisabledOnTheShip = cfg.Bind<bool>("Scrap Items - Capsules", "Capsules Disabled On The Ship", true, "Whether or not capsules are disabled inside the ship when landed (Capsules are disabled in orbit always)"); GloomyCapsuleLoaded = cfg.Bind<bool>("Scrap Items - Capsules", "Gloomy Capsule is loaded", true, "Whether or not the Gloomy Capsule is loaded"); GloomyCapsuleSpawnsAsScrap = cfg.Bind<bool>("Scrap Items - Capsules", "Gloomy Capsule is a scrap item", true, "Whether or not the Gloomy Capsule spawns as scrap"); GloomyCapsuleMoonSpawnWeights = cfg.Bind<string>("Scrap Items - Capsules", "Gloomy Capsule Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often Gloomy Capsule will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); GloomyCapsuleGlobalSpawnWeight = cfg.Bind<int>("Scrap Items - Capsules", "Gloomy Capsule Global Spawning", 15, "How often the Gloomy Capsule will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); FrigidCapsuleLoaded = cfg.Bind<bool>("Scrap Items - Capsules", "Frigid Capsule is loaded", true, "Whether or not the Frigid Capsule is loaded"); FrigidCapsuleSpawnsAsScrap = cfg.Bind<bool>("Scrap Items - Capsules", "Frigid Capsule is a scrap item", true, "Whether or not the Frigid Capsule spawns as scrap"); FrigidCapsuleMoonSpawnWeights = cfg.Bind<string>("Scrap Items - Capsules", "Frigid Capsule Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Frigid Capsule will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); FrigidCapsuleGlobalSpawnWeight = cfg.Bind<int>("Scrap Items - Capsules", "Frigid Capsule Global Spawning", 15, "How often the Frigid Capsule will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); BloodyCapsuleLoaded = cfg.Bind<bool>("Scrap Items - Capsules", "Bloody Capsule is loaded", true, "Whether or not the Bloody Capsule is loaded"); BloodyCapsuleSpawnsAsScrap = cfg.Bind<bool>("Scrap Items - Capsules", "Bloody Capsule is a scrap item", true, "Whether or not the Bloody Capsule spawns as scrap"); BloodyCapsuleMoonSpawnWeights = cfg.Bind<string>("Scrap Items - Capsules", "Bloody Capsule Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Bloody Capsule will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); BloodyCapsuleGlobalSpawnWeight = cfg.Bind<int>("Scrap Items - Capsules", "Bloody Capsule Global Spawning", 15, "How often the Bloody Capsule will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); PadlockLoaded = cfg.Bind<bool>("Item - Padlock", "Padlock is loaded", true, "Whether or not the Padlock is loaded"); PadlockSpawnsAsScrap = cfg.Bind<bool>("Item - Padlock", "Padlock is a scrap item", true, "Whether or not the Padlock spawns as scrap"); PadlockMoonSpawnWeights = cfg.Bind<string>("Item - Padlock", "Padlock Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Padlock will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); PadlockGlobalSpawnWeight = cfg.Bind<int>("Item - Padlock", "Padlock Global Spawning", 30, "How often the Padlock will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); CrowbarLoaded = cfg.Bind<bool>("Item - Crowbar", "Crowbar is loaded", true, "Whether or not the Crowbar is loaded"); CrowbarSpawnsAsScrap = cfg.Bind<bool>("Item - Crowbar", "Crowbar is a scrap item", true, "Whether or not the Crowbar spawns as scrap"); CrowbarMoonSpawnWeights = cfg.Bind<string>("Item - Crowbar", "Crowbar Moon Spawning", "experimentation=-1, vow=-1, march=-1, assurance=-1, offense=-1, rend=-1, dine=-1, titan=-1, adamance=-1, artifice=-1, embrion=-1", "Where and how often the Crowbar will spawn (Moon spawn weights will individually overwrite global spawn weights, set to -1 to disable. Correct spelling and formatting is critical, shown, and a log will appear pointing out unreadable/disabled configs. Modded moon spawn weights are generated upon loading into a game for the first time with the moon mod downloaded and enabled.)"); CrowbarGlobalSpawnWeight = cfg.Bind<int>("Item - Crowbar", "Crowbar Global Spawning", 30, "How often the Crowbar will spawn globally (Will affect all moons including modded moons unless overwritten by moon spawn weights, -1 to disable)"); HandlampLoaded = cfg.Bind<bool>("Store Item - Handlamp", "Handlamp is loaded", true, "Whether or not the Handlamp is loaded"); HandlampIsStoreItem = cfg.Bind<bool>("Store Item - Handlamp", "Handlamp is a store item", true, "Whether or not the Handlamp is a store item"); HandlampStorePrice = cfg.Bind<int>("Store Item - Handlamp", "Handlamp store price", 25, "The store price of the Handlamp (Cannot be a negative number)"); BandagesLoaded = cfg.Bind<bool>("Store Item - Bandages", "Bandages are loaded", true, "Whether or not the Bandages are loaded"); BandagesIsStoreItem = cfg.Bind<bool>("Store Item - Bandages", "Bandages are a store item", true, "Whether or not the Bandages are a store item"); BandagesStorePrice = cfg.Bind<int>("Store Item - Bandages", "Bandages store price", 20, "The store price of the Bandages (Cannot be a negative number)"); MedicalKitLoaded = cfg.Bind<bool>("Store Item - Medical Kit", "Medical Kit is loaded", true, "Whether or not the Medical Kit is loaded"); MedicalKitIsStoreItem = cfg.Bind<bool>("Store Item - Medical Kit", "Medical Kit is a store item", true, "Whether or not the Medical Kit is a store item"); MedicalKitStorePrice = cfg.Bind<int>("Store Item - Medical Kit", "Medical Kit store price", 120, "The store price of the Medical Kit (Cannot be a negative number)"); DefibrillatorLoaded = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator is loaded", true, "Whether or not the Defibrillator is loaded"); DefibrillatorIsStoreItem = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator is a store item", true, "Whether or not the Defibrillator is a store item"); DefibrillatorStorePrice = cfg.Bind<int>("Store Item - Defibrillator", "Defibrillator store price", 375, "The store price of the Defibrillator (Cannot be a negative number)"); DefibrillatorRequiresBattery = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator requires battery", true, "Whether or not the Defibrillator requires battery"); DefibrillatorUsesLimited = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator uses are limited", true, "Whether or not Defibrillators have limited uses"); DefibrillatorUseLimit = cfg.Bind<int>("Store Item - Defibrillator", "Defibrillators use limit", 3, "The number of uses each Defibrillator has (Uses have a minimum of 1, uses are used up on players successfully revived only)"); DefibrillatorRefillsOnLanding = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator refills every moon landing", false, "Whether or not existing Defibrillators will refill their uses upon landing on a moon"); DefibrillatorPermaDeathRule = cfg.Bind<bool>("Store Item - Defibrillator", "Defibrillator follows perma-death rules", true, "Whether or not specific causes of death will prevent the defibrillator from reviving players (Ex - Corpses decapitated by CoilHeads, Corpses snipped in half by a Barber, Corpses head popped by the Ghost Girl)"); ProductivityAutoinjectorLoaded = cfg.Bind<bool>("Store Item - Productivity Autoinjector", "Productivity Autoinjector is loaded", true, "Whether or not the Productivity Autoinjector is loaded"); ProductivityAutoinjectorIsStoreItem = cfg.Bind<bool>("Store Item - Productivity Autoinjector", "Productivity Autoinjector is a store item", true, "Whether or not the Productivity Autoinjector is a store item"); ProductivityAutoinjectorStorePrice = cfg.Bind<int>("Store Item - Productivity Autoinjector", "Productivity Autoinjector store price", 90, "The store price of the Productivity Autoinjector"); ToolkitLoaded = cfg.Bind<bool>("Store Item - Toolkit", "Toolkit is loaded", true, "Whether or not the Toolkit is loaded"); ToolkitIsStoreItem = cfg.Bind<bool>("Store Item - Toolkit", "Toolkit is a store item", true, "Whether or not the Toolkit is a store item"); ToolkitStorePrice = cfg.Bind<int>("Store Item - Toolkit", "Toolkit store price", 115, "The store price of the Toolkit"); ShiftControllerLoaded = cfg.Bind<bool>("Store Item - Shift Controller", "Shift Controller is loaded", true, "Whether or not the Shift Controller is loaded"); ShiftControllerIsStoreItem = cfg.Bind<bool>("Store Item - Shift Controller", "Shift Controller is a store item", true, "Whether or not the Shift Controller is a store item"); ShiftControllerStorePrice = cfg.Bind<int>("Store Item - Shift Controller", "Shift Controller store price", 225, "The store price of the Shift Controller"); ShiftControllerGreatRange = cfg.Bind<int>("Store Item - Shift Controller", "Shift Controllers great/first connection range", 50, "The max range of the Shift Controller's great/first connection range. (The great/first connection range starts at 0 and stops at this value, The average/middle connection range starts at this value)"); ShiftControllerPoorRange = cfg.Bind<int>("Store Item - Shift Controller", "Shift Controllers poor/last connection range", 175, "The range where the Shift Controller enters it's poor/last connection range. (The average/middle connection range stops at this value, The poor/last connection range starts at this value)"); ClearOrphanedEntries(cfg); cfg.Save(); cfg.SaveOnConfigSet = true; } private static void ClearOrphanedEntries(ConfigFile cfg) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg); dictionary.Clear(); } } } namespace UsualScrap.Behaviors { public class BandagesScript : GrabbableObject { private int uses = 3; private ParticleSystem particle; public void Awake() { particle = ((Component)this).GetComponentInChildren<ParticleSystem>(); } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); if (base.heldByPlayerOnServer && !base.isPocketed) { UpdateControlTip(); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if (base.heldByPlayerOnServer && !base.isPocketed) { UpdateControlTip(); } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && base.playerHeldBy.health < 100) { HealServerRpc(); if (base.heldByPlayerOnServer && !base.isPocketed) { UpdateControlTip(); } } } public void UpdateControlTip() { string text = $"Remaining Uses - {uses}"; HUDManager.Instance.ChangeControlTip(1, text, false); } [ServerRpc(RequireOwnership = false)] public void HealServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(87823207u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 87823207u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; HealClientRpc(); } } } [ClientRpc] public void HealClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2085797069u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2085797069u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Heal(); } } } public void Heal() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB playerHeldBy = base.playerHeldBy; if (uses > 1 && playerHeldBy.health < 70) { playerHeldBy.health += 30; ParticleSystem val = Object.Instantiate<ParticleSystem>(particle, ((Component)playerHeldBy).transform.position, Quaternion.identity, ((Component)playerHeldBy).transform); val.Play(); uses--; } else if (uses == 1 && playerHeldBy.health < 70) { playerHeldBy.health += 30; ParticleSystem val2 = Object.Instantiate<ParticleSystem>(particle, ((Component)playerHeldBy).transform.position, Quaternion.identity, ((Component)playerHeldBy).transform); val2.Play(); if (base.heldByPlayerOnServer && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } Object.Destroy((Object)(object)((Component)this).gameObject); } else if (uses > 1 && playerHeldBy.health >= 70 && playerHeldBy.health < 100) { playerHeldBy.health = 100; ParticleSystem val3 = Object.Instantiate<ParticleSystem>(particle, ((Component)playerHeldBy).transform.position, Quaternion.identity, ((Component)playerHeldBy).transform); val3.Play(); uses--; } else if (uses == 1 && playerHeldBy.health >= 70 && playerHeldBy.health < 100) { playerHeldBy.health = 100; ParticleSystem val4 = Object.Instantiate<ParticleSystem>(particle, ((Component)playerHeldBy).transform.position, Quaternion.identity, ((Component)playerHeldBy).transform); val4.Play(); if (base.heldByPlayerOnServer && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } Object.Destroy((Object)(object)((Component)this).gameObject); } else if (uses < 1 || uses > 3) { if (base.heldByPlayerOnServer && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true); } Object.Destroy((Object)(object)((Component)this).gameObject); } if (playerHeldBy.health >= 20) { if (playerHeldBy.criticallyInjured) { playerHeldBy.criticallyInjured = false; } if (playerHeldBy.bleedingHeavily) { playerHeldBy.bleedingHeavily = false; } if ((Object)(object)playerHeldBy.playerBodyAnimator != (Object)null) { playerHeldBy.playerBodyAnimator.SetBool("Limp", false); } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)playerHeldBy) { HUDManager.Instance.UpdateHealthUI(playerHeldBy.health, false); } } MonoBehaviour.print((object)playerHeldBy.health); } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(87823207u, new RpcReceiveHandler(__rpc_handler_87823207), "HealServerRpc"); ((NetworkBehaviour)this).__registerRpc(2085797069u, new RpcReceiveHandler(__rpc_handler_2085797069), "HealClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_87823207(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((BandagesScript)(object)target).HealServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2085797069(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((BandagesScript)(object)target).HealClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "BandagesScript"; } } public class BloodyCapsuleScript : GrabbableObject { private ParticleSystem chargedParticles; private ParticleSystem chargingParticles; private ParticleSystem drainingParticles; private AudioSource[] sounds; private AudioClip pulse; private Light light; private bool chargingParticlePlaying = false; private bool chargedParticlesPlaying = false; private Coroutine detectCoroutine = null; private int charge = 0; private bool disabledInShip; internal static UsualScrapConfigs BoundConfig { get; private set; } public void Awake() { BoundConfig = Plugin.BoundConfig; try { chargedParticles = ((Component)((Component)this).transform.Find("ChargedParticles")).GetComponent<ParticleSystem>(); chargingParticles = ((Component)((Component)this).transform.Find("ChargingParticles")).GetComponent<ParticleSystem>(); drainingParticles = ((Component)((Component)this).transform.Find("DrainingParticles")).GetComponent<ParticleSystem>(); sounds = ((Component)((Component)this).transform.Find("BloodyCapsuleSounds")).gameObject.GetComponents<AudioSource>(); light = ((Component)((Component)this).transform.Find("Point Light")).GetComponent<Light>(); pulse = sounds[0].clip; } catch { if ((Object)(object)chargedParticles == (Object)null) { MonoBehaviour.print((object)"Bloody Capsule missing charged particles! - USUAL SCRAP"); } if ((Object)(object)chargingParticles == (Object)null) { MonoBehaviour.print((object)"Bloody Capsule missing charging particles! - USUAL SCRAP"); } if ((Object)(object)drainingParticles == (Object)null) { MonoBehaviour.print((object)"Bloody Capsule missing draining particles! - USUAL SCRAP"); } if (sounds == null) { MonoBehaviour.print((object)"Bloody Capsule missing sounds! - USUAL SCRAP"); } } disabledInShip = BoundConfig.CapsulesDisabledOnTheShip.Value; ((MonoBehaviour)this).StartCoroutine(Glow()); } private IEnumerator Glow() { float maxintensity = light.intensity * 1.5f; float minintensity = light.intensity * 0.5f; while (true) { if (!((Behaviour)light).enabled) { yield return (object)new WaitUntil((Func<bool>)(() => ((Behaviour)light).enabled)); } float t = (MathF.Sin(Time.time * 1f) + 1f) / 2f; light.intensity = minintensity + (maxintensity - minintensity) * t