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 CoolerOxydeShip v0.0.9
CoolerOxydeShip.dll
Decompiled 2 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CodeRebirth; using CodeRebirth.src.Content.Enemies; using CodeRebirth.src.Content.Items; using CodeRebirth.src.Content.Maps; using CodeRebirth.src.Content.Unlockables; using CodeRebirth.src.Util; using CoolerOxydeShip.NetcodePatcher; using Dawn; using Dawn.Utils; using GameNetcodeStuff; using HarmonyLib; using LethalNetworkAPI; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("CodeRebirth")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CoolerOxydeShip")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+48e842d566e2e92289cfef65f3df66e388487fd4")] [assembly: AssemblyProduct("CoolerOxydeShip")] [assembly: AssemblyTitle("CoolerOxydeShip")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace CoolerOxydeShip { internal class ConfigHandler : MonoBehaviour { public static ConfigEntry<float> chanceToDespawn; public static ConfigEntry<bool> shouldSpawnScrap; public static ConfigEntry<bool> shouldSpawnScrapOnFirstCrash; public static ConfigEntry<int> scrapMin; public static ConfigEntry<int> scrapMax; public static ConfigEntry<float> scrapValueMultiplier; public static ConfigEntry<float> scrapDistanceMin; public static ConfigEntry<float> scrapDistanceMax; public static ConfigEntry<bool> shouldSpawnMasked; public static ConfigEntry<string> scrapItemList; public static ConfigEntry<bool> scrapUseWhitelist; public static ConfigEntry<bool> shouldSpawnMaskedOnFirstCrash; public static ConfigEntry<int> maskedMin; public static ConfigEntry<int> maskedMax; public static ConfigEntry<int> minMaskedPerPlayer; public static ConfigEntry<int> maxMaskedPerPlayer; public static ConfigEntry<int> maskedCap; public static ConfigEntry<float> maskedDistanceMin; public static ConfigEntry<float> maskedDistanceMax; public static ConfigEntry<bool> muteShipOnTabletCollection; public static ConfigEntry<float> shipWaitTimeMin; public static ConfigEntry<float> shipWaitTimeMax; public static ConfigEntry<bool> debtOnAnyPenalty; public static ConfigEntry<int> penaltyPerPlayer; public static ConfigEntry<int> coinsPerKill; public static ConfigEntry<bool> noExtraDebtOnWipe; public static ConfigEntry<bool> noDebtShield; public static ConfigEntry<float> merchantStealMultiplier; public static ConfigEntry<float> merchantSpeedMultiplier; public static ConfigEntry<float> maxTipDivisor; public static ConfigEntry<float> oxydeFlareDuration; public static ConfigEntry<bool> preventBloodInOrbit; public static ConfigEntry<bool> preventBloodInCompanyMoons; public static ConfigEntry<bool> killEugene; public static ConfigEntry<bool> mistressAlwaysKill; public static ConfigEntry<float> rabbitDistanceLimit; public static ConfigEntry<bool> oxydeDeleteSpawnedGear; public static ConfigEntry<bool> oxydeDontDeleteOnDeadline; public static void Init(ConfigFile config) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Expected O, but got Unknown //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Expected O, but got Unknown //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Expected O, but got Unknown //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Expected O, but got Unknown //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Expected O, but got Unknown //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Expected O, but got Unknown //IL_0466: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Expected O, but got Unknown //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Expected O, but got Unknown //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Expected O, but got Unknown //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Expected O, but got Unknown //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Expected O, but got Unknown //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Expected O, but got Unknown //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Expected O, but got Unknown //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Expected O, but got Unknown //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Expected O, but got Unknown //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Expected O, but got Unknown //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Expected O, but got Unknown //IL_0662: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Expected O, but got Unknown //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Expected O, but got Unknown //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Expected O, but got Unknown chanceToDespawn = config.Bind<float>("Ship", "Chance to Despawn", 33f, new ConfigDescription("An additional chance that if the ship 'spawns' (See the CodeRebirth spawn curve config for it), it will despawn anyways. Only applies once Oxyde is unlocked. This can be used to make the Crashing Ship less common once Oxyde is unlocked. A higher value increases the chance it will despawn, making it rarer once Oxyde is unlocked. At 0, the chance will never decrease. At 100, the ship will never spawn once Oxyde is unlocked like in Base CodeRebirth.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); shipWaitTimeMin = config.Bind<float>("Ship", "Minimum Wait Time", 180f, new ConfigDescription("The minimum time (in seconds) the ship will wait before crashing.", (AcceptableValueBase)null, Array.Empty<object>())); shipWaitTimeMax = config.Bind<float>("Ship", "Maximum Wait Time", 360f, new ConfigDescription("The maximum time (in seconds) the ship will wait before crashing.", (AcceptableValueBase)null, Array.Empty<object>())); muteShipOnTabletCollection = config.Bind<bool>("Ship", "Mute Ship on Tablet Collection", true, new ConfigDescription("If true, the alarm noise from the ship will be muted when the tablet is collected.", (AcceptableValueBase)null, Array.Empty<object>())); shouldSpawnScrap = config.Bind<bool>("Scrap Spawning", "Should Scrap Spawn", true, new ConfigDescription("If true, extra scrap will spawn when a ship crashes. If false, no extra scraps will spawn.", (AcceptableValueBase)null, Array.Empty<object>())); shouldSpawnScrapOnFirstCrash = config.Bind<bool>("Scrap Spawning", "Should Scrap Spawn on First Crash", false, new ConfigDescription("If true, extra scrap will always spawn at a crashed ship. If false, then only crashed ships encountered after Oxyde has been unlocked will spawn scrap.", (AcceptableValueBase)null, Array.Empty<object>())); scrapMin = config.Bind<int>("Scrap Spawning", "Minimum Scrap to Spawn", 3, new ConfigDescription("The minimum number of scrap items (inclusive) to spawn when a ship crashes. Shouldn't be higher than the maximum.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>())); scrapMax = config.Bind<int>("Scrap Spawning", "Maximum Scrap to Spawn", 6, new ConfigDescription("The maximum number of scrap items (inclusive) to spawn when a ship crashes. Shouldn't be lower than the minimum.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); scrapValueMultiplier = config.Bind<float>("Scrap Spawning", "Scrap Value Multiplier", 1f, new ConfigDescription("A multiplier for the value of scrap spawned when a ship crashes. This should stack with existing multipliers, such as moon scrap value multipliers or weather multipliers with WeatherRegistry.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); scrapDistanceMin = config.Bind<float>("Scrap Spawning", "Minimum Scrap Distance", 7f, new ConfigDescription("The minimum distance from the ship's crash site that scrap can spawn. A higher value will make scrap spawn further away from the crash site. Shouldn't be higher than the maximum.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>())); scrapDistanceMax = config.Bind<float>("Scrap Spawning", "Maximum Scrap Distance", 12f, new ConfigDescription("The maximum distance from the ship's crash site that scrap can spawn. A higher value will make scrap spawn further away from the crash site. Shouldn't be lower than the minimum.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>())); scrapItemList = config.Bind<string>("Scrap Spawning", "Scrap Item Blacklist", "", new ConfigDescription("A comma-separated list of scrap items that can't spawn when a ship crashes.", (AcceptableValueBase)null, Array.Empty<object>())); scrapUseWhitelist = config.Bind<bool>("Scrap Spawning", "Blacklist is Whitelist", false, new ConfigDescription("If true, only the scrap items in the 'Scrap Item Blacklist' can spawn. If false, all scrap items EXCEPT those in the list will spawn.", (AcceptableValueBase)null, Array.Empty<object>())); shouldSpawnMasked = config.Bind<bool>("Masked Spawning", "Should Masked Spawn", true, new ConfigDescription("If true, Masked enemies will spawn when a ship crashes.", (AcceptableValueBase)null, Array.Empty<object>())); shouldSpawnMaskedOnFirstCrash = config.Bind<bool>("Masked Spawning", "Should Masked Spawn on First Crash", false, new ConfigDescription("If true, Masked enemies will always spawn at a crashed ship. If false, then only crashed ships encountered after Oxyde has been unlocked will spawn Masked enemies.", (AcceptableValueBase)null, Array.Empty<object>())); maskedMin = config.Bind<int>("Masked Spawning", "Minimum Masked to Spawn", 1, new ConfigDescription("The minimum number of Masked enemies (inclusive) to spawn when a ship crashes. Shouldn't be higher than the maximum.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>())); maskedMax = config.Bind<int>("Masked Spawning", "Maximum Masked to Spawn", 2, new ConfigDescription("The maximum number of Masked enemies (inclusive) to spawn when a ship crashes. Shouldn't be lower than the minimum.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); minMaskedPerPlayer = config.Bind<int>("Masked Spawning", "Masked Min Per Player Increase", 0, new ConfigDescription("Adds this value to the Min Masked spawn count, for each player in the lobby after the first. Useful if you want to increase the amount of Masked that spawn with lobby size", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); maxMaskedPerPlayer = config.Bind<int>("Masked Spawning", "Masked Max Per Player Increase", 0, new ConfigDescription("Adds this value to the Max Masked spawn count, for each player in the lobby after the first. Useful if you want to increase the amount of Masked that spawn with lobby size", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); maskedCap = config.Bind<int>("Masked Spawning", "Masked Cap", 99, new ConfigDescription("The maximum amount of Masked that can spawn from the ship, overriding the above values. No more Masked can spawn than this value from one crashed ship.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())); maskedDistanceMin = config.Bind<float>("Masked Spawning", "Minimum Masked Distance", 7f, new ConfigDescription("The minimum distance from the ship's crash site that Masked enemies can spawn. A higher value will make Masked enemies spawn further away from the crash site. Shouldn't be higher than the maximum. Be careful to not make it too low, or they might be killed by the initial explosion.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>())); maskedDistanceMax = config.Bind<float>("Masked Spawning", "Maximum Masked Distance", 12f, new ConfigDescription("The maximum distance from the ship's crash site that Masked enemies can spawn. A higher value will make Masked enemies spawn further away from the crash site. Shouldn't be lower than the minimum. Be carefful to not make it too low, or they might be killed by the initial explosion.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>())); debtOnAnyPenalty = config.Bind<bool>("Debt", "Debt on Any Penalty", true, new ConfigDescription("If true, Debt will also be added to the Denomination Analyser for any dead crew, not just during a wipe.", (AcceptableValueBase)null, Array.Empty<object>())); penaltyPerPlayer = config.Bind<int>("Debt", "Penalty per Player", 2, new ConfigDescription("If 'Debt on Any Penalty' is true, this is the amount of debt added for each dead player.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 999), Array.Empty<object>())); coinsPerKill = config.Bind<int>("Debt", "Coins per Kill", 1, new ConfigDescription("The amount of coins added to the Denomination Analyser for each player killed by the Debt Collector. When Debt is calculated at the end of the round with 'Debt on Any Penalty', players killed by the Debt Collector will not be counted. Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 999), Array.Empty<object>())); noExtraDebtOnWipe = config.Bind<bool>("Debt", "No Extra Debt on Wipe", true, new ConfigDescription("If true, the above extra debt will not be added to the Denomination Analyser when a wipe occurs. If false, you'll be getting 2 punishments!! (1 from this mod, the other from base CodeRebirth)", (AcceptableValueBase)null, Array.Empty<object>())); noDebtShield = config.Bind<bool>("Debt", "No Debt Shield", false, new ConfigDescription("By default, the Denomination Anaylser has a shield mechanic, where you cannot enter Debt the first time your counter gets that low on a save file. This can be abused to, for example, steal a high value item from the store without much punishment. When this setting is enabled, any saves loaded with this on will be marked as 'Having entered Debt before', meaning any losses can immediately put you in the negative, making it behave like how you would expect it to.", (AcceptableValueBase)null, Array.Empty<object>())); merchantStealMultiplier = config.Bind<float>("Merchant", "Merchant Steal Multiplier", 2f, new ConfigDescription("By default, when you shoplift from the Merchant, the amount of coins you will lose is the cost of the item multiplied by this value.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); maxTipDivisor = config.Bind<float>("Merchant", "Maximum Tip Effectiveness", 1.3f, new ConfigDescription("Tipping the Merchant on Oxyde reduces the next quota's increase. By default, at 1.3, donating 100 coins results in a 23% quota reduction. By increasing this value, you can make it reduce the quota even further E.g. 1 = 0%, 1.3 = 23%, 1.5 = 33%, 2 = 50%, 3 = 66%, 4 = 75%, 10 = 90%, 20 = 95%", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())); merchantSpeedMultiplier = config.Bind<float>("Merchant", "Merchant Speed Multiplier", 1f, new ConfigDescription("Increases the speed of the Merchant's animations, making transactions faster. Might break shit if too high. Tested up to 4x speed where it seemed fine!", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); killEugene = config.Bind<bool>("Enemies", "Kill Eugene", true, new ConfigDescription("If true, Eugene will no longer randomly be forcibly-unlocked when landing the ship by setting the chance to 0%.", (AcceptableValueBase)null, Array.Empty<object>())); mistressAlwaysKill = config.Bind<bool>("Enemies", "Mistress Always Kills", true, new ConfigDescription("If true, the Mistress will always kill a player when they catch them, instead of doing the whole beheading thing.", (AcceptableValueBase)null, Array.Empty<object>())); rabbitDistanceLimit = config.Bind<float>("Enemies", "Rabbit Distance Limit", 40f, new ConfigDescription("The maximum distance you can actually trigger a Rabbit Magician's kill on a player. Set to 0 to disable, for the default infinite range.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 999f), Array.Empty<object>())); preventBloodInOrbit = config.Bind<bool>("Items", "Marrow Splitter - Prevent Blood in Orbit", true, new ConfigDescription("If true, The Marrow Splitter cannot generate blood when in Orbit.", (AcceptableValueBase)null, Array.Empty<object>())); preventBloodInCompanyMoons = config.Bind<bool>("Items", "Marrow Splitter - Prevent Blood in Company Moons", true, new ConfigDescription("If true, The Marrow Splitter cannot generate blood when at Company Moons (Including Gordion, Oxyde, and Galetry) since they could be revisited infinitely to charge it as much as you want.", (AcceptableValueBase)null, Array.Empty<object>())); oxydeFlareDuration = config.Bind<float>("Oxyde", "Oxyde Flare Duration", 20f, new ConfigDescription("The duration (in seconds) of the flare when you used a LethalThingsReloaded Flaregun on Oxyde. Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 60f), Array.Empty<object>())); oxydeDeleteSpawnedGear = config.Bind<bool>("Oxyde", "Delete Spawned Gear", true, new ConfigDescription("If true, MOST of the extra gear that can spawn on Oxyde 'E.g. Jetpacks, Nitro crates, Flashlights' won't spawn in.", (AcceptableValueBase)null, Array.Empty<object>())); oxydeDontDeleteOnDeadline = config.Bind<bool>("Oxyde", "Dont Delete Spawned Gear on Deadline", false, new ConfigDescription("If true, the extra gear that can spawn on Oxyde 'E.g. Jetpacks, Nitro crates, Flashlights' will not be deleted during Deadline day, since there is actually risk involved and it can't be done infinitely. This requires the 'Delete Spawned Gear' setting to be enabled.", (AcceptableValueBase)null, Array.Empty<object>())); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("ZetaArcade.CoolerOxydeShip", "CoolerOxydeShip", "0.0.9")] public class CoolerOxydeShipPatch : BaseUnityPlugin { [HarmonyPatch(typeof(OxydeCrashingShip), "OnNetworkSpawn")] internal static class OxydeCrashingShipSpawnPatch { [HarmonyPrefix] private static bool Prefix(OxydeCrashingShip __instance) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) bool flag = false; DawnMoonInfo val = default(DawnMoonInfo); if (!((Registry<DawnMoonInfo>)(object)LethalContent.Moons).TryGetValue(CodeRebirthMoonKeys.Oxyde, ref val) || (object)val.DawnPurchaseInfo.PurchasePredicate.CanPurchase() == TerminalPurchaseResult.Success() || (object)val.DawnPurchaseInfo.PurchasePredicate.CanPurchase() == TerminalPurchaseResult.Hidden()) { flag = true; } if (((NetworkBehaviour)__instance).IsServer && flag && new Random(StartOfRound.Instance.randomMapSeed).NextDouble() * 100.0 < (double)ConfigHandler.chanceToDespawn.Value) { ((NetworkBehaviour)__instance).NetworkObject.Despawn(true); return false; } Vector3 position = ((Component)__instance).transform.position; if (((NetworkBehaviour)__instance).IsServer) { TargetPositions[__instance] = position; OxydeShipNetwork.SendShipPosition(((NetworkBehaviour)__instance).NetworkObjectId, position); } ((Component)__instance).transform.position = new Vector3(9999f, 9999f, 9999f); if (!((NetworkBehaviour)__instance).IsServer) { return false; } ((MonoBehaviour)__instance).StartCoroutine(__instance.WaitToDoYourThing(position, Mathf.Lerp(ConfigHandler.shipWaitTimeMin.Value, ConfigHandler.shipWaitTimeMax.Value, (float)new Random(StartOfRound.Instance.randomMapSeed).NextDouble()))); Logger.LogDebug((object)$"Ship spawned at {position}"); return false; } } [HarmonyPatch(typeof(OxydeCrashingShip), "OnImpact")] internal static class OxydeCrashingShipImpactPatch { [HarmonyPostfix] private static void Postfix(OxydeCrashingShip __instance) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)__instance).IsServer) { Vector3 position = ((Component)__instance).transform.position; Vector3 value; Vector3 val = ((!TargetPositions.TryGetValue(__instance, out value)) ? position : value); Logger.LogDebug((object)$"Ship crashed at {position}"); Logger.LogDebug((object)$"Ship target was {val}"); bool flag = false; DawnMoonInfo val2 = default(DawnMoonInfo); if (!((Registry<DawnMoonInfo>)(object)LethalContent.Moons).TryGetValue(CodeRebirthMoonKeys.Oxyde, ref val2) || (object)val2.DawnPurchaseInfo.PurchasePredicate.CanPurchase() == TerminalPurchaseResult.Success() || (object)val2.DawnPurchaseInfo.PurchasePredicate.CanPurchase() == TerminalPurchaseResult.Hidden()) { flag = true; } if (ConfigHandler.shouldSpawnScrap.Value && (flag || ConfigHandler.shouldSpawnScrapOnFirstCrash.Value)) { SpawnLevelScrap(val); } if (ConfigHandler.shouldSpawnMasked.Value && (flag || ConfigHandler.shouldSpawnMaskedOnFirstCrash.Value)) { SpawnMasked(val); } } } public static void StopAlarm(OxydeCrashingShip shipRef) { AudioSource[] componentsInChildren = ((Component)shipRef).GetComponentsInChildren<AudioSource>(true); foreach (AudioSource val in componentsInChildren) { if (!(((Object)val).name != "ShipAlarm")) { val.Stop(); val.mute = true; ((Behaviour)val).enabled = false; Logger.LogInfo((object)"Ship alarm muted!"); } } } private static void SpawnLevelScrap(Vector3 spawnPosition) { //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) string[] source = (from s in ConfigHandler.scrapItemList.Value.Split(',') select s.Trim().ToLowerInvariant()).ToArray(); bool value = ConfigHandler.scrapUseWhitelist.Value; List<SpawnableItemWithRarity> list = new List<SpawnableItemWithRarity>(); foreach (SpawnableItemWithRarity item in RoundManager.Instance.currentLevel.spawnableScrap) { if (item.rarity > 0 && !((Object)(object)item.spawnableItem == (Object)null)) { string value2 = item.spawnableItem.itemName.ToLowerInvariant(); if (!value && !source.Contains(value2)) { list.Add(item); } else if (value && source.Contains(value2)) { list.Add(item); } } } if (list.Count == 0) { Logger.LogWarning((object)"WARNING: No scrap available after applying blacklist/whitelist filters :c or the level has no scrap???"); return; } Random random = new Random(StartOfRound.Instance.randomMapSeed); int num = random.Next(ConfigHandler.scrapMin.Value, ConfigHandler.scrapMax.Value + 1); Logger.LogDebug((object)$"Ship spawning {num} scrap."); RaycastHit val4 = default(RaycastHit); for (int num2 = 0; num2 < num; num2++) { SpawnableItemWithRarity val = RandomExtensions.NextItem<SpawnableItemWithRarity>(random, (IList<SpawnableItemWithRarity>)list); Item spawnableItem = val.spawnableItem; if ((Object)(object)spawnableItem == (Object)null || (Object)(object)spawnableItem.spawnPrefab == (Object)null) { continue; } float num3 = (float)(random.NextDouble() * 3.1415927410125732 * 2.0); float num4 = Mathf.Lerp(ConfigHandler.scrapDistanceMin.Value, ConfigHandler.scrapDistanceMax.Value, (float)random.NextDouble()); Vector3 val2 = spawnPosition + new Vector3(Mathf.Cos(num3) * num4, 1f, Mathf.Sin(num3) * num4); Vector3 val3 = val2; if (Physics.Raycast(val2 + Vector3.up * 1f, Vector3.down, ref val4, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val3 = ((RaycastHit)(ref val4)).point + Vector3.up * spawnableItem.verticalOffset; } GameObject val5 = Object.Instantiate<GameObject>(spawnableItem.spawnPrefab, val3, Quaternion.identity, (Transform)null); GrabbableObject component = val5.GetComponent<GrabbableObject>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)("Ship spawned " + ((Object)spawnableItem).name + ", but it has no GrabbableObject component so its being killed")); Object.Destroy((Object)(object)val5); continue; } NetworkObject networkObject = ((NetworkBehaviour)component).NetworkObject; if ((Object)(object)networkObject == (Object)null) { Logger.LogWarning((object)("Ship spawned " + ((Object)spawnableItem).name + ", but it has no NetworkObject so its being killed")); Object.Destroy((Object)(object)val5); } else { networkObject.Spawn(false); int num5 = (int)(Mathf.Lerp((float)spawnableItem.minValue, (float)spawnableItem.maxValue, (float)random.NextDouble()) * RoundManager.Instance.scrapValueMultiplier * ConfigHandler.scrapValueMultiplier.Value); CodeRebirthUtils.Instance.SyncScanNodeParentRotationsAndFallRpc(new NetworkBehaviourReference((NetworkBehaviour)(object)component), val2, val3, Quaternion.Euler(spawnableItem.restingRotation), num5); } } } private static void SpawnMasked(Vector3 spawnPosition) { //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)StartOfRound.Instance).IsServer) { return; } EnemyType val = null; foreach (SpawnableEnemyWithRarity enemy in RoundManager.Instance.currentLevel.Enemies) { if (enemy.enemyType.enemyName == "Masked") { val = enemy.enemyType; break; } } if ((Object)(object)val == (Object)null) { Logger.LogWarning((object)"Could not find Masked EnemyType??"); return; } Random random = new Random(StartOfRound.Instance.randomMapSeed); int num = ConfigHandler.minMaskedPerPlayer.Value * (StartOfRound.Instance.allPlayerScripts.Count() - 1); int num2 = ConfigHandler.maxMaskedPerPlayer.Value * (StartOfRound.Instance.allPlayerScripts.Count() - 1); int num3 = ConfigHandler.maskedMin.Value + num; int num4 = Math.Clamp(ConfigHandler.maskedMax.Value + num2, num3, ConfigHandler.maskedCap.Value); int num5 = random.Next(num3, num4 + 1); Logger.LogDebug((object)$"Ship spawning {num5} Masked."); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < num5; i++) { float num6 = (float)(random.NextDouble() * 3.1415927410125732 * 2.0); float num7 = Mathf.Lerp(ConfigHandler.maskedDistanceMin.Value, ConfigHandler.maskedDistanceMax.Value, (float)random.NextDouble()); Vector3 val2 = spawnPosition + new Vector3(Mathf.Cos(num6) * num7, 2f, Mathf.Sin(num6) * num7); if (Physics.Raycast(val2, Vector3.down, ref val3, 100f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val2 = ((RaycastHit)(ref val3)).point; } GameObject val4 = Object.Instantiate<GameObject>(val.enemyPrefab, val2, Quaternion.identity); NetworkObject component = val4.GetComponent<NetworkObject>(); if ((Object)(object)component == (Object)null) { Logger.LogWarning((object)"Masked prefab has no NetworkObject??"); Object.Destroy((Object)(object)val4); } else { component.Spawn(true); } } } } [HarmonyPatch(typeof(GrabbableObject), "GrabItem")] public static class OxydeTabletGrabPatch { private const float ShipSearchRange = 30f; public static void Postfix(GrabbableObject __instance) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00ab: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.itemProperties == (Object)null || __instance.itemProperties.itemName != "Oxyde Tablet" || (Object)(object)__instance.playerHeldBy == (Object)null || !PlayerControllerBExtensions.IsLocalPlayer(__instance.playerHeldBy)) { return; } Logger.LogDebug((object)"Oxyde Tablet detected!"); Vector3 position = ((Component)__instance).transform.position; ulong shipNetworkId = 0uL; bool flag = false; float num = 30f; foreach (KeyValuePair<ulong, Vector3> shipPosition in OxydeShipNetwork.ShipPositions) { float num2 = Vector3.Distance(position, shipPosition.Value); if (num2 <= num) { num = num2; shipNetworkId = shipPosition.Key; flag = true; } } if (flag) { OxydeShipNetwork.SendMuteShip(shipNetworkId); Logger.LogInfo((object)$"Oxyde Tablet picked up near ship. Distance from ship: {num}"); } else { Logger.LogDebug((object)"Oxyde Tablet was picked up, but no ship was found nearby :c"); } } } [HarmonyPatch(typeof(Guillotine), "PseudoKillPlayerServerRpc")] public static class GuillotineKillPatch { [HarmonyPrefix] private static bool Prefix(PlayerControllerReference playerControllerReference) { if (!ConfigHandler.mistressAlwaysKill.Value) { return true; } if (!NetworkManager.Singleton.IsServer) { return true; } PlayerControllerB val = PlayerControllerReference.op_Implicit(playerControllerReference); if ((Object)(object)val == (Object)null) { return false; } OxydeShipNetwork.SendMistressKill(val.playerClientId); return false; } } [HarmonyPatch(typeof(HauntedTeddyBear), "get_SpawnChance")] public static class HauntedTeddyBearPatch { [HarmonyPostfix] private static void Postfix(ref float __result) { if (ConfigHandler.killEugene.Value) { __result = -1f; } } } [HarmonyPatch(typeof(MoneyCounter), "CalculateCoinPenalty")] public static class MoneyCounterPenaltyPatch { [HarmonyPostfix] private static void Postfix(MoneyCounter __instance, int playersDead) { if (!ConfigHandler.debtOnAnyPenalty.Value || !NetworkManager.Singleton.IsServer || playersDead <= 0) { return; } int num = StartOfRound.Instance.allPlayerScripts.Count((PlayerControllerB x) => x.isPlayerControlled); if (playersDead < num || !ConfigHandler.noExtraDebtOnWipe.Value) { int num2 = playersDead - DebtCollectorVictims.Count; if (num2 > 0) { __instance.RemoveMoney(num2 * ConfigHandler.penaltyPerPlayer.Value); } } } } [HarmonyPatch(typeof(MoneyCounter), "RemoveMoney")] internal static class MoneyCounterRemoveShieldPatch { [HarmonyPrefix] private static void Prefix() { if (NetworkManager.Singleton.IsServer && ConfigHandler.noDebtShield.Value) { NamespacedKey val = NamespacedKey.From("code_rebirth", "went_to_debt_once"); PersistentDataContainer currentSave = DawnLib.GetCurrentSave(); if (currentSave != null) { ((DataContainer)currentSave).Set<bool>(val, true); } } } } [HarmonyPatch(typeof(StartOfRound), "StartGame")] internal static class ResetDebtCollectorVictimsPatch { [HarmonyPostfix] private static void Postfix() { DebtCollectorVictims.Clear(); } } [HarmonyPatch(typeof(DebtCollector), "KillTargetPlayer")] internal static class DebtCollectorKillPatch { [HarmonyPrefix] private static void Prefix(DebtCollector __instance, out PlayerControllerB __state) { __state = ((EnemyAI)__instance).targetPlayer; } [HarmonyPostfix] private static void Postfix(PlayerControllerB __state) { if (!((Object)(object)__state == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(__state) && __state.isPlayerDead) { OxydeShipNetwork.SendDebtCollectorKill(__state.playerClientId); } } } [HarmonyPatch(typeof(DebtCollector), "DoSlashAttack")] internal static class DebtCollectorSlashPatch { [HarmonyPrefix] private static void Prefix(out HashSet<ulong> __state) { __state = new HashSet<ulong>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(val) && !val.isPlayerDead) { __state.Add(val.playerClientId); } } } [HarmonyPostfix] private static void Postfix(HashSet<ulong> __state) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (!((Object)(object)val == (Object)null) && PlayerControllerBExtensions.IsLocalPlayer(val) && __state.Contains(val.playerClientId) && val.isPlayerDead) { OxydeShipNetwork.SendDebtCollectorKill(val.playerClientId); } } } } [HarmonyPatch(typeof(Merchant), "Steal")] internal static class MerchantStealPatch { [HarmonyPrefix] private static bool Prefix(Merchant __instance, int priceOfStolenItem, Dictionary<GrabbableObject, int> ___itemsOnSale) { foreach (GrabbableObject key in ___itemsOnSale.Keys) { key.grabbable = false; } __instance.bugleBoy.DisableSelf(); __instance.tipPad.CloseDonations(); __instance.merchantAnimator.SetTrigger("steal"); if (((NetworkBehaviour)__instance).IsServer) { int num = Mathf.RoundToInt((float)priceOfStolenItem * ConfigHandler.merchantStealMultiplier.Value); NetworkSingleton<MoneyCounter>.Instance.RemoveMoney(num); } return false; } } [HarmonyPatch(typeof(MerchantTipPad), "GetTippedAmount")] internal static class MerchantTippingPatch { [HarmonyPostfix] private static void Postfix(ref float __result) { float value = ConfigHandler.maxTipDivisor.Value; __result *= (value - 1f) / 0.3f; } } [HarmonyPatch(typeof(RabbitMagician), "KillAndSwitchTargetServerRpc")] internal static class RabbitDistancePatch { [HarmonyPrefix] private static bool Prefix(RabbitMagician __instance, PlayerControllerReference player) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (ConfigHandler.rabbitDistanceLimit.Value <= 0f) { return true; } PlayerControllerB val = PlayerControllerReference.op_Implicit(player); if ((Object)(object)val == (Object)null || (Object)(object)((EnemyAI)__instance).targetPlayer == (Object)null) { return true; } float num = Vector3.Distance(((Component)val).transform.position, ((Component)((EnemyAI)__instance).targetPlayer).transform.position); if (num <= ConfigHandler.rabbitDistanceLimit.Value) { return true; } ((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(2); return false; } } internal static class FlaregunOxydeNerfPatch { internal static void Prefix(object __instance) { if (NetworkManager.Singleton.IsServer) { RoundManager instance = RoundManager.Instance; if (instance != null && instance.currentLevel?.PlanetName?.Contains("Oxyde") == true) { AccessTools.Field(__instance.GetType(), "flareDuration")?.SetValue(__instance, ConfigHandler.oxydeFlareDuration.Value); } } } } [HarmonyPatch(typeof(NetworkObject), "Spawn")] internal static class OxydeNukeItemSpawnsPatch { private static readonly HashSet<string> BlockedItems = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Jetpack", "Spray paint", "Skull", "Clock", "Remote Detonator", "Yield sign", "Nitroglycerin Crate", "Lockpicker", "Flashlight", "Zap gun", "Pro-flashlight", "Extension ladder", "Ammo", "Mole Digger", "Clown horn", "Magic 7 ball", "Key", "Stun grenade" }; private static readonly HashSet<MerchantBarrel> BarrelRefs = new HashSet<MerchantBarrel>(); [HarmonyPostfix] private static void Postfix(NetworkObject __instance) { if (!ConfigHandler.oxydeDeleteSpawnedGear.Value || !NetworkManager.Singleton.IsServer || (Object)(object)StartOfRound.Instance == (Object)null || !StartOfRound.Instance.inShipPhase) { return; } RoundManager instance = RoundManager.Instance; if (instance == null || instance.currentLevel?.PlanetName?.Contains("Oxyde") != true) { return; } MerchantBarrel item = default(MerchantBarrel); if (((Component)__instance).TryGetComponent<MerchantBarrel>(ref item)) { BarrelRefs.Add(item); } else if (!ConfigHandler.oxydeDontDeleteOnDeadline.Value || (!((Object)(object)TimeOfDay.Instance == (Object)null) && TimeOfDay.Instance.daysUntilDeadline != 0)) { GrabbableObject component = ((Component)__instance).GetComponent<GrabbableObject>(); if (!((Object)(object)component?.itemProperties == (Object)null) && !component.isInShipRoom && !component.isInElevator && BlockedItems.Contains(component.itemProperties.itemName)) { ((MonoBehaviour)Instance).StartCoroutine(RemoveItem(__instance, component)); } } } private static IEnumerator RemoveItem(NetworkObject networkObject, GrabbableObject item) { yield return null; if ((Object)(object)networkObject == (Object)null || !networkObject.IsSpawned || !NetworkManager.Singleton.IsServer || (Object)(object)item == (Object)null) { yield break; } BarrelRefs.RemoveWhere((MerchantBarrel val) => (Object)(object)val == (Object)null || !((NetworkBehaviour)val).IsSpawned); foreach (MerchantBarrel barrel in BarrelRefs) { if ((Object)(object)barrel.currentlySpawnedGrabbableObject == (Object)(object)item) { yield break; } } Logger.LogInfo((object)("Removing item that spawned on Oxyde: " + ((Object)networkObject).name)); networkObject.Despawn(true); } } [HarmonyPatch(typeof(Merchant), "Start")] internal static class MerchantAnimationSpeedPatch { [HarmonyPostfix] private static void Postfix(Merchant __instance) { if (!((Object)(object)__instance.merchantAnimator == (Object)null)) { __instance.merchantAnimator.speed = ConfigHandler.merchantSpeedMultiplier.Value; } } } [HarmonyPatch(typeof(Merchant), "PayUpBoy")] internal static class MerchantPurchaseSpeedPatch { [HarmonyPrefix] private static bool Prefix(Merchant __instance, int itemCost, Dictionary<GrabbableObject, int> ___itemsOnSale, ref IEnumerator __result) { __result = FasterBuy(__instance, itemCost, ___itemsOnSale); return false; } private static IEnumerator FasterBuy(Merchant merchant, int itemCost, Dictionary<GrabbableObject, int> itemsOnSale) { if (((NetworkBehaviour)merchant).IsServer) { NetworkSingleton<MoneyCounter>.Instance.RemoveMoney(itemCost); } foreach (KeyValuePair<GrabbableObject, int> item in itemsOnSale) { if ((Object)(object)item.Key != (Object)null) { merchant.SetupGrabbableTooltip(item.Key, item.Value); } } foreach (GrabbableObject item2 in itemsOnSale.Keys) { if ((Object)(object)item2 != (Object)null) { item2.grabbable = false; } } merchant.merchantAnimator.SetTrigger("purchase"); float speed = merchant.merchantAnimator.speed; yield return (object)new WaitForSeconds(merchant.PurchaseAnimation.length / speed); foreach (GrabbableObject item3 in itemsOnSale.Keys) { if ((Object)(object)item3 != (Object)null) { item3.grabbable = true; } } } } [HarmonyPatch(typeof(CompactorToby), "TryCompactItemServerRpc")] internal static class AntiDuplicateCubePatch { [HarmonyPrefix] private static bool Prefix(CompactorToby __instance) { if (!((NetworkBehaviour)__instance).IsServer) { return true; } if (__instance.compacting) { return false; } __instance.compacting = true; return true; } } [HarmonyPatch(typeof(MarrowSplitter), "DoHitStuff")] internal static class MarrowSplitterExploitPatch { [HarmonyPrefix] private static void Prefix(ref int ____increaseAmount, out int __state) { __state = ____increaseAmount; if (!StartOfRound.Instance.inShipPhase) { RoundManager instance = RoundManager.Instance; if (instance == null || instance.currentLevel?.PlanetName?.Contains("Gordion") != true) { RoundManager instance2 = RoundManager.Instance; if (instance2 == null || instance2.currentLevel?.PlanetName?.Contains("Galetry") != true) { RoundManager instance3 = RoundManager.Instance; if (instance3 == null || instance3.currentLevel?.PlanetName?.Contains("Oxyde") != true) { return; } } } } ____increaseAmount = 0; } [HarmonyPostfix] private static void Postfix(ref int ____increaseAmount, int __state) { ____increaseAmount = __state; } } private Harmony harmony = new Harmony("ZetaArcade.CoolerOxydeShip"); public static ManualLogSource Logger; public static CoolerOxydeShipPatch Instance; internal static readonly Dictionary<OxydeCrashingShip, Vector3> TargetPositions = new Dictionary<OxydeCrashingShip, Vector3>(); internal static readonly HashSet<ulong> DebtCollectorVictims = new HashSet<ulong>(); private void Awake() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; ConfigHandler.Init(((BaseUnityPlugin)this).Config); OxydeShipNetwork.Init(); harmony.PatchAll(); if (Chainloader.PluginInfos.ContainsKey("HQ_Team.LethalThingsReloaded.Internals")) { harmony.Patch((MethodBase)AccessTools.Method("LethalThings.MonoBehaviours.FlareController:OnNetworkSpawn", (Type[])null, (Type[])null), new HarmonyMethod(typeof(FlaregunOxydeNerfPatch), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Logger.LogInfo((object)"LethalThings detected! Flare duration patch enabled."); } Logger.LogInfo((object)"Plugin is loaded!"); } internal static void RegisterDebtCollectorKill(PlayerControllerB player) { if (NetworkManager.Singleton.IsServer && DebtCollectorVictims.Add(player.playerClientId)) { MoneyCounter instance = NetworkSingleton<MoneyCounter>.Instance; if ((Object)(object)instance != (Object)null && ConfigHandler.coinsPerKill.Value > 0) { instance.AddMoney(ConfigHandler.coinsPerKill.Value); } } } } public static class OxydeShipNetwork { public static LNetworkMessage<MuteShipMessage> MuteShipRequest; public static LNetworkMessage<MuteShipMessage> MuteShipBroadcast; public static LNetworkMessage<ShipPositionMessage> ShipPositionBroadcast; public static LNetworkMessage<MistressKillMessage> MistressKillBroadcast; public static LNetworkMessage<DebtCollectorKillMessage> DebtCollectorKillRequest; public static readonly Dictionary<ulong, Vector3> ShipPositions = new Dictionary<ulong, Vector3>(); public static void Init() { MuteShipRequest = LNetworkMessage<MuteShipMessage>.Create("OxydeMuteShipRequest", (Action<MuteShipMessage, ulong>)OnMuteShipRequest, (Action<MuteShipMessage>)null, (Action<MuteShipMessage, ulong>)null); MuteShipBroadcast = LNetworkMessage<MuteShipMessage>.Create("OxydeMuteShipBroadcast", (Action<MuteShipMessage, ulong>)null, (Action<MuteShipMessage>)OnMuteShipReceived, (Action<MuteShipMessage, ulong>)null); ShipPositionBroadcast = LNetworkMessage<ShipPositionMessage>.Create("OxydeShipPosition", (Action<ShipPositionMessage, ulong>)null, (Action<ShipPositionMessage>)OnShipPositionReceived, (Action<ShipPositionMessage, ulong>)null); MistressKillBroadcast = LNetworkMessage<MistressKillMessage>.Create("MistressRealKill", (Action<MistressKillMessage, ulong>)null, (Action<MistressKillMessage>)OnMistressKillReceived, (Action<MistressKillMessage, ulong>)null); DebtCollectorKillRequest = LNetworkMessage<DebtCollectorKillMessage>.Create("DebtCollectorKillRequest", (Action<DebtCollectorKillMessage, ulong>)OnDebtCollectorKillReceived, (Action<DebtCollectorKillMessage>)null, (Action<DebtCollectorKillMessage, ulong>)null); } private static void OnMuteShipRequest(MuteShipMessage message, ulong senderClientId) { if (!((Object)(object)StartOfRound.Instance == (Object)null) && NetworkManager.Singleton.IsServer) { MuteShipBroadcast.SendClients(message, NetworkManager.Singleton.ConnectedClientsIds.ToArray()); OnMuteShipReceived(message); } } private static void OnMuteShipReceived(MuteShipMessage message) { if (NetworkManager.Singleton.SpawnManager.SpawnedObjects.TryGetValue(message.shipNetworkId, out var value)) { OxydeCrashingShip component = ((Component)value).GetComponent<OxydeCrashingShip>(); if (!((Object)(object)component == (Object)null)) { CoolerOxydeShipPatch.OxydeCrashingShipImpactPatch.StopAlarm(component); } } } public static void SendMuteShip(ulong shipNetworkId) { if (NetworkManager.Singleton.IsListening) { MuteShipRequest.SendServer(new MuteShipMessage { shipNetworkId = shipNetworkId }); } } public static void SendShipPosition(ulong shipNetworkId, Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { ShipPositions[shipNetworkId] = position; ShipPositionBroadcast.SendClients(new ShipPositionMessage { shipNetworkId = shipNetworkId, x = position.x, y = position.y, z = position.z }, NetworkManager.Singleton.ConnectedClientsIds.ToArray()); } } private static void OnShipPositionReceived(ShipPositionMessage message) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) ShipPositions[message.shipNetworkId] = new Vector3(message.x, message.y, message.z); CoolerOxydeShipPatch.Logger.LogDebug((object)$"Received ship position: {ShipPositions[message.shipNetworkId]}"); } public static void SendMistressKill(ulong playerId) { if (NetworkManager.Singleton.IsServer) { MistressKillBroadcast.SendClients(new MistressKillMessage { playerId = playerId }, NetworkManager.Singleton.ConnectedClientsIds.ToArray()); OnMistressKillReceived(new MistressKillMessage { playerId = playerId }); } } private static void OnMistressKillReceived(MistressKillMessage message) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId == message.playerId) { if (PlayerControllerBExtensions.IsLocalPlayer(val)) { CoolerOxydeShipPatch.Logger.LogDebug((object)"Mistress killing local player!"); val.KillPlayer(Vector3.zero, false, (CauseOfDeath)17, 0, default(Vector3), false); } break; } } } public static void SendDebtCollectorKill(ulong playerId) { if (NetworkManager.Singleton.IsListening) { DebtCollectorKillRequest.SendServer(new DebtCollectorKillMessage { playerId = playerId }); } } private static void OnDebtCollectorKillReceived(DebtCollectorKillMessage message, ulong senderClientId) { if (NetworkManager.Singleton.IsServer && senderClientId == message.playerId) { PlayerControllerB val = ((IEnumerable<PlayerControllerB>)StartOfRound.Instance.allPlayerScripts).FirstOrDefault((Func<PlayerControllerB, bool>)((PlayerControllerB p) => p.playerClientId == message.playerId)); if (!((Object)(object)val == (Object)null)) { CoolerOxydeShipPatch.RegisterDebtCollectorKill(val); } } } } public class MuteShipMessage { public ulong shipNetworkId; } public class ShipPositionMessage { public ulong shipNetworkId; public float x; public float y; public float z; } public class MistressKillMessage { public ulong playerId; } public class DebtCollectorKillMessage { public ulong playerId; } internal class PluginInfo { public const string modGUID = "ZetaArcade.CoolerOxydeShip"; public const string modName = "CoolerOxydeShip"; public const string modVersion = "0.0.9"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace CoolerOxydeShip.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }