Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of ServerSider v1.8.0
plugins/ServerSider/ServerSider.dll
Decompiled a week agousing System; 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; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HG; using HG.Reflection; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using On.RoR2.UI; using RoR2; using RoR2.Navigation; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ServerSider")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.8.0.0")] [assembly: AssemblyInformationalVersion("1.8.0+cc3a105f1e4275a5aef28eda1655f507adc0a25f")] [assembly: AssemblyProduct("ServerSider")] [assembly: AssemblyTitle("ServerSider")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.8.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ServerSider { [BepInPlugin("itsschwer.ServerSider", "ServerSider", "1.8.0")] public sealed class Plugin : BaseUnityPlugin { public const string GUID = "itsschwer.ServerSider"; public const string Author = "itsschwer"; public const string Name = "ServerSider"; public const string Version = "1.8.0"; private static Plugin Instance; internal static ManualLogSource Logger { get; private set; } public static TweakManager Tweaks { get; private set; } internal static bool Enabled { get { if (Object.op_Implicit((Object)(object)Instance)) { return ((Behaviour)Instance).enabled; } return false; } } private void Awake() { Logger.Sources.Remove((ILogSource)(object)((BaseUnityPlugin)this).Logger); Logger = Logger.CreateLogSource("itsschwer.ServerSider"); Tweaks = new TweakManager(((BaseUnityPlugin)this).Config); Instance = this; Run.onRunStartGlobal += SetPluginActiveState; Run.onRunDestroyGlobal += Disable; SetPluginActiveState(); Logger.LogMessage((object)"~awake."); } private void OnEnable() { Logger.LogMessage((object)("Reloading " + ((BaseUnityPlugin)this).Config.ConfigFilePath.Substring(((BaseUnityPlugin)this).Config.ConfigFilePath.LastIndexOf(Path.DirectorySeparatorChar) + 1))); ((BaseUnityPlugin)this).Config.Reload(); Tweaks.Refresh(); Logger.LogMessage((object)"~enabled."); } private void OnDisable() { Tweaks.Refresh(); Logger.LogMessage((object)"~disabled."); } private void SetPluginActiveState(Run _ = null) { SetActive(NetworkServer.active); } private void SetActive(bool value) { ((Behaviour)this).enabled = value; Logger.LogMessage((object)("~" + (value ? "active" : "inactive") + ".")); } private void Disable(Run _) { SetActive(value: false); } } public class TweakManager { public readonly List<TweakBase> managedTweaks; public readonly RescueShipLoopPortal RescueShipLoopPortal; public readonly PressurePlateTweak PressurePlateTweak; public readonly QuitToLobbyButton QuitToLobbyButton; public readonly VoidPickupConfirmAll VoidPickupConfirmAll; public readonly VoidFieldFogTweak VoidFieldFogTweak; public readonly SendItemCostInChat SendItemCostInChat; public readonly TeleportOutOfBoundsPickups TeleportOutOfBoundsPickups; public readonly UnwrapCommandEssence UnwrapCommandEssence; public readonly DeadDroneVisibility DeadDroneVisibility; public readonly PreventEarlyHalcyonShrineActivation PreventEarlyHalcyonShrineActivation; internal TweakManager(ConfigFile config) { managedTweaks = new List<TweakBase>(); RescueShipLoopPortal = new RescueShipLoopPortal(config); managedTweaks.Add(RescueShipLoopPortal); PressurePlateTweak = new PressurePlateTweak(config); managedTweaks.Add(PressurePlateTweak); QuitToLobbyButton = new QuitToLobbyButton(config); managedTweaks.Add(QuitToLobbyButton); VoidPickupConfirmAll = new VoidPickupConfirmAll(config); managedTweaks.Add(VoidPickupConfirmAll); VoidFieldFogTweak = new VoidFieldFogTweak(config); managedTweaks.Add(VoidFieldFogTweak); SendItemCostInChat = new SendItemCostInChat(config); managedTweaks.Add(SendItemCostInChat); TeleportOutOfBoundsPickups = new TeleportOutOfBoundsPickups(config); managedTweaks.Add(TeleportOutOfBoundsPickups); UnwrapCommandEssence = new UnwrapCommandEssence(config); managedTweaks.Add(UnwrapCommandEssence); DeadDroneVisibility = new DeadDroneVisibility(config); managedTweaks.Add(DeadDroneVisibility); PreventEarlyHalcyonShrineActivation = new PreventEarlyHalcyonShrineActivation(config); managedTweaks.Add(PreventEarlyHalcyonShrineActivation); } internal void Refresh() { for (int i = 0; i < managedTweaks.Count; i++) { try { managedTweaks[i].Disable(); if (managedTweaks[i].allowed) { managedTweaks[i].Enable(); } } catch (Exception ex) { Plugin.Logger.LogError((object)ex); } } } } public class DeadDroneVisibility : TweakBase { private readonly ConfigEntry<bool> deadDroneVisibility; public override bool allowed => false; internal DeadDroneVisibility(ConfigFile config) { } protected override void Hook() { } protected override void Unhook() { } private static void Drone_DeathState_OnImpactServer(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); Func<Instruction, bool>[] array = new Func<Instruction, bool>[0]; if (val.TryGotoNext(array)) { Plugin.Logger.LogDebug((object)((object)il).ToString()); } else { Plugin.Logger.LogError((object)"DeadDroneVisibility> Cannot hook: failed to match IL instructions."); } } } public class PressurePlateTweak : TweakBase { [CompilerGenerated] private static class <>O { public static hook_SetSwitch <0>__PressurePlateController_SetSwitch; } private static ConfigEntry<float> pressurePlateGracePeriod; private static readonly Dictionary<PressurePlateController, float> platePressTimestamps = new Dictionary<PressurePlateController, float>(2); public override bool allowed { get { if (Plugin.Enabled) { return pressurePlateGracePeriod.Value != 0f; } return false; } } internal PressurePlateTweak(ConfigFile config) { pressurePlateGracePeriod = config.Bind<float>("Tweaks", "pressurePlateGracePeriod", 30f, "The length of time (in seconds) that a pressure plate will remain pressed after being activated.\nZero disables time functionality (reverts to vanilla behaviour). Negative values prevent pressure plates from releasing once activated."); } protected override void Hook() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__PressurePlateController_SetSwitch; if (obj == null) { hook_SetSwitch val = PressurePlateController_SetSwitch; <>O.<0>__PressurePlateController_SetSwitch = val; obj = (object)val; } PressurePlateController.SetSwitch += (hook_SetSwitch)obj; PressurePlateController.FixedUpdate += new hook_FixedUpdate(PressurePlateController_FixedUpdate); Plugin.Logger.LogDebug((object)("PressurePlateTweak> Hooked by " + TweakBase.GetExecutingMethod())); } protected override void Unhook() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__PressurePlateController_SetSwitch; if (obj == null) { hook_SetSwitch val = PressurePlateController_SetSwitch; <>O.<0>__PressurePlateController_SetSwitch = val; obj = (object)val; } PressurePlateController.SetSwitch -= (hook_SetSwitch)obj; PressurePlateController.FixedUpdate -= new hook_FixedUpdate(PressurePlateController_FixedUpdate); platePressTimestamps.Clear(); Plugin.Logger.LogDebug((object)("PressurePlateTweak> Unhooked by " + TweakBase.GetExecutingMethod())); } private static void PressurePlateController_SetSwitch(orig_SetSwitch orig, PressurePlateController self, bool switchIsDown) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown if (switchIsDown) { if (switchIsDown != self.switchDown) { string text = (((double)Random.value <= 0.2) ? "Press your plate!" : "A pressure plate is pressed.."); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cEvent>" + text + "</style>" }); } orig.Invoke(self, switchIsDown); platePressTimestamps[self] = Time.time; } else if (pressurePlateGracePeriod.Value >= 0f && !platePressTimestamps.ContainsKey(self)) { if (switchIsDown != self.switchDown) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cEvent>A pressure plate releases...</style>" }); } orig.Invoke(self, switchIsDown); } } private void PressurePlateController_FixedUpdate(orig_FixedUpdate orig, PressurePlateController self) { orig.Invoke(self); if (self.enableOverlapSphere && platePressTimestamps.TryGetValue(self, out var value) && Time.time - value >= pressurePlateGracePeriod.Value) { platePressTimestamps.Remove(self); } } } public class PreventEarlyHalcyonShrineActivation : TweakBase { [CompilerGenerated] private static class <>O { public static Manipulator <0>__GoldSiphonNearbyBodyController_DrainGold; } private readonly ConfigEntry<bool> preventEarlyHalcyonShrineActivation; public override bool allowed { get { if (Plugin.Enabled) { return preventEarlyHalcyonShrineActivation.Value; } return false; } } internal PreventEarlyHalcyonShrineActivation(ConfigFile config) { preventEarlyHalcyonShrineActivation = config.Bind<bool>("Tweaks", "preventEarlyHalcyonShrineActivation", true, "Disable the \"Pray to Halcyon Shrine\" prompt to prevent activating the shrine before it is fully charged."); } protected override void Hook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__GoldSiphonNearbyBodyController_DrainGold; if (obj == null) { Manipulator val = GoldSiphonNearbyBodyController_DrainGold; <>O.<0>__GoldSiphonNearbyBodyController_DrainGold = val; obj = (object)val; } GoldSiphonNearbyBodyController.DrainGold += (Manipulator)obj; Plugin.Logger.LogDebug((object)("PreventEarlyHalcyonShrineActivation> Hooked by " + TweakBase.GetExecutingMethod())); } protected override void Unhook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__GoldSiphonNearbyBodyController_DrainGold; if (obj == null) { Manipulator val = GoldSiphonNearbyBodyController_DrainGold; <>O.<0>__GoldSiphonNearbyBodyController_DrainGold = val; obj = (object)val; } GoldSiphonNearbyBodyController.DrainGold -= (Manipulator)obj; Plugin.Logger.LogDebug((object)("PreventEarlyHalcyonShrineActivation> Unhooked by " + TweakBase.GetExecutingMethod())); } private static void GoldSiphonNearbyBodyController_DrainGold(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); Func<Instruction, bool>[] array = new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(GoldSiphonNearbyBodyController), "purchaseInteraction"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PurchaseInteraction>(x, "SetAvailable") }; if (val.TryGotoNext(array)) { val.RemoveRange(array.Length); } else { Plugin.Logger.LogError((object)"PreventEarlyHalcyonShrineActivation> Cannot hook: failed to match IL instructions."); } } } public class QuitToLobbyButton : TweakBase { [CompilerGenerated] private static class <>O { public static hook_Awake <0>__PauseScreenController_Awake; } private readonly ConfigEntry<bool> quitToLobbyButton; private const string commandName = "itsschwer_run_end"; public override bool allowed { get { if (Plugin.Enabled) { return quitToLobbyButton.Value; } return false; } } internal QuitToLobbyButton(ConfigFile config) { quitToLobbyButton = config.Bind<bool>("Tweaks", "quitToLobbyButton", true, "Add a \"Quit to Lobby\" button to the Run pause menu.\n\nUseful in multiplayer for changing characters/survivors, difficulty, or artifacts without disconnecting everyone from the lobby."); } protected override void Hook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__PauseScreenController_Awake; if (obj == null) { hook_Awake val = PauseScreenController_Awake; <>O.<0>__PauseScreenController_Awake = val; obj = (object)val; } PauseScreenController.Awake += (hook_Awake)obj; Plugin.Logger.LogDebug((object)("QuitToLobbyButton> Hooked by " + TweakBase.GetExecutingMethod())); } protected override void Unhook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__PauseScreenController_Awake; if (obj == null) { hook_Awake val = PauseScreenController_Awake; <>O.<0>__PauseScreenController_Awake = val; obj = (object)val; } PauseScreenController.Awake -= (hook_Awake)obj; Plugin.Logger.LogDebug((object)("QuitToLobbyButton> Unhooked by " + TweakBase.GetExecutingMethod())); } private static void PauseScreenController_Awake(orig_Awake orig, PauseScreenController self) { orig.Invoke(self); if ((Object)(object)Run.instance != (Object)null) { PauseScreenController_Awake(self); } } private static void PauseScreenController_Awake(PauseScreenController __instance) { GameObject obj = Object.Instantiate<GameObject>(__instance.exitGameButton, __instance.exitGameButton.transform.parent); Object.DestroyImmediate((Object)(object)obj.GetComponent<LanguageTextMeshController>()); ((Object)obj).name = "GenericMenuButton (Quit to Lobby)"; ((TMP_Text)obj.GetComponentInChildren<HGTextMeshProUGUI>()).text = "Quit to Lobby"; ((UnityEventBase)((Button)obj.GetComponent<HGButton>()).onClick).m_PersistentCalls.GetListener(0).arguments.stringArgument = "quit_confirmed_command \"itsschwer_run_end\""; } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRunEndUnpause(ConCommandArgs args) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Console.instance.RunCmd(CmdSender.op_Implicit(LocalUserManager.GetFirstLocalUser()), "run_end", new List<string>()); if (PauseScreenController.instancesList.Count != 0) { Object.Destroy((Object)(object)((Component)PauseScreenController.instancesList[0]).gameObject); } } } public class RescueShipLoopPortal : TweakBase { [CompilerGenerated] private static class <>O { public static hook_Start <0>__HoldoutZoneController_Start; } private readonly ConfigEntry<bool> rescueShipPortal; public override bool allowed { get { if (Plugin.Enabled) { return rescueShipPortal.Value; } return false; } } internal RescueShipLoopPortal(ConfigFile config) { rescueShipPortal = config.Bind<bool>("Tweaks", "rescueShipPortal", true, "Spawn a portal in the Rescue Ship to allow looping after defeating Mithrix."); } protected override void Hook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__HoldoutZoneController_Start; if (obj == null) { hook_Start val = HoldoutZoneController_Start; <>O.<0>__HoldoutZoneController_Start = val; obj = (object)val; } HoldoutZoneController.Start += (hook_Start)obj; Plugin.Logger.LogDebug((object)("RescueShipLoopPortal> Hooked by " + TweakBase.GetExecutingMethod())); } protected override void Unhook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__HoldoutZoneController_Start; if (obj == null) { hook_Start val = HoldoutZoneController_Start; <>O.<0>__HoldoutZoneController_Start = val; obj = (object)val; } HoldoutZoneController.Start -= (hook_Start)obj; Plugin.Logger.LogDebug((object)("RescueShipLoopPortal> Unhooked by " + TweakBase.GetExecutingMethod())); } private static void HoldoutZoneController_Start(orig_Start orig, HoldoutZoneController self) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00b2: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (self.inBoundsObjectiveToken == "OBJECTIVE_MOON_CHARGE_DROPSHIP") { Transform val = null; try { val = ((Component)self).transform.parent.parent.Find("RescueshipMoon/escapeship/DropshipMesh"); } catch (NullReferenceException arg) { Plugin.Logger.LogError((object)string.Format("{0}> {1}", "RescueShipLoopPortal", arg)); } if ((Object)(object)val == (Object)null) { Plugin.Logger.LogError((object)"RescueShipLoopPortal> Failed to find \"Moon2DropshipZone/RescueshipMoon/escapeship/DropshipMesh\""); } else { InstantiatePortal(val.position + val.up * 7f + val.forward * 14f, Quaternion.LookRotation(val.forward, -val.up)); } } } internal static void InstantiatePortal(Vector3 position, Quaternion rotation) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown GameObject obj = Object.Instantiate<GameObject>(((SpawnCard)Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"0fe24a82acb288346a0779181fc66c39").WaitForCompletion()).prefab, position, rotation); obj.GetComponent<SceneExitController>().useRunNextStageScene = true; NetworkServer.Spawn(obj); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<size=120%><style=cIsVoid>The Void calls...</style></size>" }); } } public class SendItemCostInChat : TweakBase { [CompilerGenerated] private static class <>O { public static hook_PayCost <0>__CostTypeDef_PayCost; public static hook_BeginScrapping_UniquePickup <1>__ScrapperController_BeginScrapping; } private readonly ConfigEntry<bool> sendItemCostInChat; private static ConfigEntry<bool> includeScrapInItemCost; public override bool allowed { get { if (Plugin.Enabled) { return sendItemCostInChat.Value; } return false; } } internal SendItemCostInChat(ConfigFile config) { sendItemCostInChat = config.Bind<bool>("Chat", "sendItemCostInChat", true, "Send a chat notification listing the items that are consumed when a Scrapper, 3D Printer, Cleansing Pool, or Cauldron is used."); includeScrapInItemCost = config.Bind<bool>("Chat", "includeScrapInItemCost", false, "Include Item Scrap in the list printed by sendItemCostInChat."); } protected override void Hook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown object obj = <>O.<0>__CostTypeDef_PayCost; if (obj == null) { hook_PayCost val = CostTypeDef_PayCost; <>O.<0>__CostTypeDef_PayCost = val; obj = (object)val; } CostTypeDef.PayCost += (hook_PayCost)obj; object obj2 = <>O.<1>__ScrapperController_BeginScrapping; if (obj2 == null) { hook_BeginScrapping_UniquePickup val2 = ScrapperController_BeginScrapping; <>O.<1>__ScrapperController_BeginScrapping = val2; obj2 = (object)val2; } ScrapperController.BeginScrapping_UniquePickup += (hook_BeginScrapping_UniquePickup)obj2; Plugin.Logger.LogDebug((object)("SendItemCostInChat> Hooked by " + TweakBase.GetExecutingMethod())); } protected override void Unhook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown object obj = <>O.<0>__CostTypeDef_PayCost; if (obj == null) { hook_PayCost val = CostTypeDef_PayCost; <>O.<0>__CostTypeDef_PayCost = val; obj = (object)val; } CostTypeDef.PayCost -= (hook_PayCost)obj; object obj2 = <>O.<1>__ScrapperController_BeginScrapping; if (obj2 == null) { hook_BeginScrapping_UniquePickup val2 = ScrapperController_BeginScrapping; <>O.<1>__ScrapperController_BeginScrapping = val2; obj2 = (object)val2; } ScrapperController.BeginScrapping_UniquePickup -= (hook_BeginScrapping_UniquePickup)obj2; Plugin.Logger.LogDebug((object)("SendItemCostInChat> Unhooked by " + TweakBase.GetExecutingMethod())); } private static void CostTypeDef_PayCost(orig_PayCost orig, CostTypeDef self, PayCostContext context, PayCostResults result) { orig.Invoke(self, context, result); try { CostTypeDef_PayCost(result, context.activator, context.purchasedObject); } catch (Exception ex) { Plugin.Logger.LogError((object)ex); } } private static void CostTypeDef_PayCost(PayCostResults __result, Interactor activator, GameObject purchasedObject) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0119: Unknown result type (might be due to invalid IL or missing references) PurchaseInteraction val = ((purchasedObject != null) ? purchasedObject.GetComponent<PurchaseInteraction>() : null); if ((Object)(object)val == (Object)null) { return; } string purchaseInteractionVerb = GetPurchaseInteractionVerb(val); if (string.IsNullOrEmpty(purchaseInteractionVerb)) { return; } object obj; if (activator == null) { obj = null; } else { CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (component == null) { obj = null; } else { CharacterMaster master = component.master; if (master == null) { obj = null; } else { PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController; obj = ((playerCharacterMasterController != null) ? playerCharacterMasterController.networkUser : null); } } } NetworkUser val2 = (NetworkUser)obj; if ((Object)(object)val2 == (Object)null) { return; } Dictionary<PickupDef, int> dictionary = new Dictionary<PickupDef, int>(); foreach (ItemAndStackValues item in __result.itemStacksTaken) { if (includeScrapInItemCost.Value || !IsScrap(item.itemIndex)) { PickupDef pickupDef = PickupCatalog.GetPickupDef(PickupCatalog.FindPickupIndex(item.itemIndex)); if (!dictionary.ContainsKey(pickupDef)) { dictionary[pickupDef] = 0; } dictionary[pickupDef] += item.stackValues.permanentStacks; } } foreach (EquipmentIndex item2 in __result.equipmentTaken) { PickupDef pickupDef2 = PickupCatalog.GetPickupDef(PickupCatalog.FindPickupIndex(item2)); if (!dictionary.ContainsKey(pickupDef2)) { dictionary[pickupDef2] = 0; } dictionary[pickupDef2]++; } AnnounceExchangedItems(dictionary, val2, purchaseInteractionVerb); } private static void ScrapperController_BeginScrapping(orig_BeginScrapping_UniquePickup orig, ScrapperController self, UniquePickup pickupToTake) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) //IL_007b: Unknown result type (might be due to invalid IL or missing references) PickupDef pickupDef; CharacterBody component; int itemCountPermanent; try { pickupDef = PickupCatalog.GetPickupDef(pickupToTake.pickupIndex); component = ((Component)self.interactor).GetComponent<CharacterBody>(); itemCountPermanent = component.inventory.GetItemCountPermanent(pickupDef.itemIndex); } catch (Exception ex) { Plugin.Logger.LogError((object)ex); return; } finally { orig.Invoke(self, pickupToTake); } object obj; if (component == null) { obj = null; } else { CharacterMaster master = component.master; if (master == null) { obj = null; } else { PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController; obj = ((playerCharacterMasterController != null) ? playerCharacterMasterController.networkUser : null); } } NetworkUser val = (NetworkUser)obj; if (!((Object)(object)val == (Object)null)) { int itemCountPermanent2 = component.inventory.GetItemCountPermanent(pickupDef.itemIndex); AnnounceExchangedItems(new Dictionary<PickupDef, int> { { pickupDef, itemCountPermanent - itemCountPermanent2 } }, val, "scrapped"); } } private static void AnnounceExchangedItems(Dictionary<PickupDef, int> exchanged, NetworkUser user, string action) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown if (exchanged.Count <= 0) { return; } StringBuilder stringBuilder = new StringBuilder(); List<PickupDef> list = exchanged.Keys.ToList(); for (int i = 0; i < list.Count; i++) { PickupDef val = list[i]; stringBuilder.Append(Util.GenerateColoredString(Language.GetString(val.nameToken), Color32.op_Implicit(val.baseColor))); if (exchanged[val] != 1) { stringBuilder.Append($"({exchanged[val]})"); } int num = list.Count - i; if (num > 2) { stringBuilder.Append(", "); } else if (num > 1) { stringBuilder.Append((list.Count > 2) ? ", and " : " and "); } } Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = $"<style=cEvent>{user.userName} {action} {stringBuilder}</color>" }); } private static bool IsScrap(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (itemIndex != Items.ScrapWhite.itemIndex && itemIndex != Items.ScrapGreen.itemIndex && itemIndex != Items.ScrapRed.itemIndex && itemIndex != Items.ScrapYellow.itemIndex) { return itemIndex == Items.RegeneratingScrap.itemIndex; } return true; } private static string GetPurchaseInteractionVerb(PurchaseInteraction purchaseInteraction) { switch (purchaseInteraction.displayNameToken) { default: return ""; case "BAZAAR_CAULDRON_NAME": return "reforged"; case "SHRINE_CLEANSE_NAME": return "cleansed themself of"; case "DUPLICATOR_NAME": case "DUPLICATOR_MILITARY_NAME": case "DUPLICATOR_WILD_NAME": return "gave up"; } } } public class TeleportOutOfBoundsPickups : TweakBase { private class OutOfBoundsPickupHelper : MonoBehaviour { public Vector3 origin { get; private set; } public bool attempted { get; internal set; } private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) origin = ((Component)this).transform.position; attempted = false; } } [CompilerGenerated] private static class <>O { public static hook_TryZoneStart <0>__MapZone_TryZoneStart; } private readonly ConfigEntry<bool> teleportOutOfBoundsPickups; private const string mapZoneLayerName = "CollideWithCharacterHullOnly"; private bool vanillaIgnoreLayerCollision; private static SpawnCard _scTeleportHelper; public override bool allowed { get { if (Plugin.Enabled) { return teleportOutOfBoundsPickups.Value; } return false; } } private static int dropletLayer => PickupDropletController.pickupDropletPrefab.layer; private static SpawnCard scTeleportHelper { get { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_scTeleportHelper == (Object)null) { SpawnCard obj = ScriptableObject.CreateInstance<SpawnCard>(); obj.prefab = LegacyResourcesAPI.Load<GameObject>("SpawnCards/HelperPrefab"); obj.nodeGraphType = (GraphType)0; obj.hullSize = (HullClassification)0; _scTeleportHelper = obj; } return _scTeleportHelper; } } internal TeleportOutOfBoundsPickups(ConfigFile config) { teleportOutOfBoundsPickups = config.Bind<bool>("Tweaks", "teleportOutOfBoundsPickups", true, "Teleport items that fall off the map to the nearest valid ground node."); } protected override void Hook() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown StringBuilder stringBuilder = new StringBuilder("TeleportOutOfBoundsPickups> Hooked by " + TweakBase.GetExecutingMethod()); int num = LayerMask.NameToLayer("CollideWithCharacterHullOnly"); vanillaIgnoreLayerCollision = Physics.GetIgnoreLayerCollision(num, dropletLayer); Physics.IgnoreLayerCollision(num, dropletLayer, false); stringBuilder.Append($"\n\tChanged ignore layer collision rule between layers {num} and {dropletLayer} from {vanillaIgnoreLayerCollision} to {false}"); object obj = <>O.<0>__MapZone_TryZoneStart; if (obj == null) { hook_TryZoneStart val = MapZone_TryZoneStart; <>O.<0>__MapZone_TryZoneStart = val; obj = (object)val; } MapZone.TryZoneStart += (hook_TryZoneStart)obj; PickupDropletController.Start += new hook_Start(PickupDropletController_Start); GenericPickupController.Start += new hook_Start(GenericPickupController_Start); Plugin.Logger.LogDebug((object)stringBuilder.ToString()); } protected override void Unhook() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown Physics.IgnoreLayerCollision(LayerMask.NameToLayer("CollideWithCharacterHullOnly"), dropletLayer, vanillaIgnoreLayerCollision); object obj = <>O.<0>__MapZone_TryZoneStart; if (obj == null) { hook_TryZoneStart val = MapZone_TryZoneStart; <>O.<0>__MapZone_TryZoneStart = val; obj = (object)val; } MapZone.TryZoneStart -= (hook_TryZoneStart)obj; PickupDropletController.Start -= new hook_Start(PickupDropletController_Start); GenericPickupController.Start -= new hook_Start(GenericPickupController_Start); Plugin.Logger.LogDebug((object)("TeleportOutOfBoundsPickups> Unhooked by " + TweakBase.GetExecutingMethod())); } private void GenericPickupController_Start(orig_Start orig, GenericPickupController self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<OutOfBoundsPickupHelper>(); } private void PickupDropletController_Start(orig_Start orig, PickupDropletController self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<OutOfBoundsPickupHelper>(); } private static void MapZone_TryZoneStart(orig_TryZoneStart orig, MapZone self, Collider other) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, other); if ((int)self.zoneType != 0) { return; } StringBuilder stringBuilder = new StringBuilder("TeleportOutOfBoundsPickups> "); OutOfBoundsPickupHelper outOfBoundsPickupHelper = default(OutOfBoundsPickupHelper); if (((Component)other).TryGetComponent<OutOfBoundsPickupHelper>(ref outOfBoundsPickupHelper)) { if (!outOfBoundsPickupHelper.attempted) { Vector3 origin = outOfBoundsPickupHelper.origin; TeleportHelper.TeleportGameObject(((Component)other).gameObject, origin); if (Object.op_Implicit((Object)(object)other.attachedRigidbody)) { other.attachedRigidbody.velocity = Vector3.zero; } outOfBoundsPickupHelper.attempted = true; stringBuilder.AppendLine($"Teleported pickup to {origin}"); stringBuilder.AppendLine("\tentered " + ((Object)((Component)self).gameObject).name); Plugin.Logger.LogDebug((object)stringBuilder.ToString()); } else { Vector3? val = TeleportToNearestNode(other); if (val.HasValue) { stringBuilder.AppendLine($"Teleported pickup to {val.Value}"); stringBuilder.AppendLine("\tentered " + ((Object)((Component)self).gameObject).name); Plugin.Logger.LogDebug((object)stringBuilder.ToString()); } } return; } PickupDropletController val2 = default(PickupDropletController); bool flag = ((Component)other).TryGetComponent<PickupDropletController>(ref val2); GenericPickupController val3 = default(GenericPickupController); bool flag2 = ((Component)other).TryGetComponent<GenericPickupController>(ref val3); PickupPickerController val4 = default(PickupPickerController); bool flag3 = ((Component)other).TryGetComponent<PickupPickerController>(ref val4); string text = string.Format("{{ {0}: {1}, {2}: {3}, {4}: {5} }}", "hasPickupDropletController", flag, "hasGenericPickupController", flag2, "hasPickupPickerController", flag3); if (flag || flag2 || flag3) { Vector3? val5 = TeleportToNearestNode(other); if (val5.HasValue) { stringBuilder.AppendLine($"Teleported pickup to {val5.Value}"); stringBuilder.AppendLine("\tentered " + ((Object)((Component)self).gameObject).name); stringBuilder.AppendLine("\t" + text); Plugin.Logger.LogDebug((object)stringBuilder.ToString()); } else { stringBuilder.AppendLine($"Failed to find a node to teleport to (from {((Component)other).transform.position})"); stringBuilder.AppendLine("\tentered " + ((Object)((Component)self).gameObject).name); Plugin.Logger.LogDebug((object)stringBuilder.ToString()); } } } private static Vector3? TeleportToNearestNode(Collider other) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0046: 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) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) GameObject val = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(scTeleportHelper, new DirectorPlacementRule { placementMode = (PlacementMode)3, position = ((Component)other).transform.position }, RoR2Application.rng)); if ((Object)(object)val != (Object)null) { Vector3 position = val.transform.position; Vector3 up = Vector3.up; Bounds bounds = other.bounds; Vector3 val2 = position + up * ((Bounds)(ref bounds)).extents.y; TeleportHelper.TeleportGameObject(((Component)other).gameObject, val2); if (Object.op_Implicit((Object)(object)other.attachedRigidbody)) { other.attachedRigidbody.velocity = Vector3.zero; } Object.Destroy((Object)(object)val); return val2; } return null; } } public abstract class TweakBase { private bool _hooked; public abstract bool allowed { get; } public bool Enable() { if (_hooked) { return false; } _hooked = true; Hook(); return true; } public bool Disable() { if (!_hooked) { return false; } _hooked = false; Unhook(); return true; } protected abstract void Hook(); protected abstract void Unhook(); protected static string GetExecutingMethod(int index = 0) { MethodBase method = new StackTrace().GetFrame(index + 3).GetMethod(); return $"{method.DeclaringType}::{method.Name}"; } } public class UnwrapCommandEssence : TweakBase { [CompilerGenerated] private static class <>O { public static Manipulator <0>__PickupDropletController_CreatePickup; } private readonly ConfigEntry<bool> unwrapCommandEssence; public override bool allowed { get { if (Plugin.Enabled) { return unwrapCommandEssence.Value; } return false; } } internal UnwrapCommandEssence(ConfigFile config) { unwrapCommandEssence = config.Bind<bool>("Tweaks", "unwrapCommandEssence", true, "Command Essence droplets drop directly as the contained item if there is only one choice."); } protected override void Hook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__PickupDropletController_CreatePickup; if (obj == null) { Manipulator val = PickupDropletController_CreatePickup; <>O.<0>__PickupDropletController_CreatePickup = val; obj = (object)val; } PickupDropletController.CreatePickup += (Manipulator)obj; Plugin.Logger.LogDebug((object)("UnwrapCommandEssence> Hooked by " + TweakBase.GetExecutingMethod())); } protected override void Unhook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown object obj = <>O.<0>__PickupDropletController_CreatePickup; if (obj == null) { Manipulator val = PickupDropletController_CreatePickup; <>O.<0>__PickupDropletController_CreatePickup = val; obj = (object)val; } PickupDropletController.CreatePickup -= (Manipulator)obj; Plugin.Logger.LogDebug((object)("UnwrapCommandEssence> Unhooked by " + TweakBase.GetExecutingMethod())); } private static void PickupDropletController_CreatePickup(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel createNormalPickup = il.DefineLabel(); Func<Instruction, bool>[] array = new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref createNormalPickup), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropletController>(x, "CreateCommandCube") }; if (val.TryGotoNext(array)) { int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<PickupDropletController, bool>>((Func<PickupDropletController, bool>)((PickupDropletController @this) => PickupPickerController.GetOptionsFromPickupState(((CreatePickupInfo)(ref @this.createPickupInfo)).pickup).Length == 1)); val.Emit(OpCodes.Brtrue, (object)createNormalPickup); } else { Plugin.Logger.LogError((object)"UnwrapCommandEssence> Cannot hook: failed to match IL instructions."); } } } public class VoidFieldFogTweak : TweakBase { [CompilerGenerated] private static class <>O { public static hook_OnStartServer <0>__ArenaMissionController_OnStartServer; public static hook_BeginRound <1>__ArenaMissionController_BeginRound; } private readonly ConfigEntry<bool> voidFieldFogAltStart; public override bool allowed { get { if (Plugin.Enabled) { return voidFieldFogAltStart.Value; } return false; } } internal VoidFieldFogTweak(ConfigFile config) { voidFieldFogAltStart = config.Bind<bool>("Tweaks", "voidFieldFogAltStart", false, "Change the Void Fields fog to only become active once a Cell Vent has been activated."); } protected override void Hook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown object obj = <>O.<0>__ArenaMissionController_OnStartServer; if (obj == null) { hook_OnStartServer val = ArenaMissionController_OnStartServer; <>O.<0>__ArenaMissionController_OnStartServer = val; obj = (object)val; } ArenaMissionController.OnStartServer += (hook_OnStartServer)obj; object obj2 = <>O.<1>__ArenaMissionController_BeginRound; if (obj2 == null) { hook_BeginRound val2 = ArenaMissionController_BeginRound; <>O.<1>__ArenaMissionController_BeginRound = val2; obj2 = (object)val2; } ArenaMissionController.BeginRound += (hook_BeginRound)obj2; Plugin.Logger.LogDebug((object)("VoidFieldFogTweak> Hooked by " + TweakBase.GetExecutingMethod())); } protected override void Unhook() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0030: 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_003b: Expected O, but got Unknown object obj = <>O.<0>__ArenaMissionController_OnStartServer; if (obj == null) { hook_OnStartServer val = ArenaMissionController_OnStartServer; <>O.<0>__ArenaMissionController_OnStartServer = val; obj = (object)val; } ArenaMissionController.OnStartServer -= (hook_OnStartServer)obj; object obj2 = <>O.<1>__ArenaMissionController_BeginRound; if (obj2 == null) { hook_BeginRound val2 = ArenaMissionController_BeginRound; <>O.<1>__ArenaMissionController_BeginRound = val2; obj2 = (object)val2; } ArenaMissionController.BeginRound -= (hook_BeginRound)obj2; Plugin.Logger.LogDebug((object)("VoidFieldFogTweak> Unhooked by " + TweakBase.GetExecutingMethod())); } private static void ArenaMissionController_OnStartServer(orig_OnStartServer orig, ArenaMissionController self) { orig.Invoke(self); SetFogActive(self, value: false); } private static void ArenaMissionController_BeginRound(orig_BeginRound orig, ArenaMissionController self) { orig.Invoke(self); if (self.currentRound == 1) { SetFogActive(self, value: true); } } private static void SetFogActive(ArenaMissionController controller, bool value) { GameObject fogDamageInstance = controller.fogDamageInstance; if (fogDamageInstance != null) { fogDamageInstance.SetActive(value); } controller.clearedEffect.SetActive(!value); } } public class VoidPickupConfirmAll : TweakBase { private readonly ConfigEntry<bool> voidPickupConfirmAll; private static readonly Dictionary<ItemTier, PickupRules> originalRules = new Dictionary<ItemTier, PickupRules>(); public override bool allowed { get { if (Plugin.Enabled) { return voidPickupConfirmAll.Value; } return false; } } internal VoidPickupConfirmAll(ConfigFile config) { voidPickupConfirmAll = config.Bind<bool>("Tweaks", "voidPickupConfirmAll", true, "Always require confirmation to pick up void items."); } protected override void Hook() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_0041: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 StringBuilder stringBuilder = new StringBuilder("VoidPickupConfirmAll> Hooked by " + TweakBase.GetExecutingMethod()); Enumerator<ItemTierDef> enumerator = ItemTierCatalog.allItemTierDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { ItemTierDef current = enumerator.Current; if ((int)current.tier == 6 || (int)current.tier == 7 || (int)current.tier == 8 || (int)current.tier == 9) { originalRules[current.tier] = current.pickupRules; current.pickupRules = (PickupRules)2; stringBuilder.Append($"\n\tChanged pickup rule for item tier {current.tier} from {originalRules[current.tier]} to {current.pickupRules}"); } } } finally { ((IDisposable)enumerator).Dispose(); } Plugin.Logger.LogDebug((object)stringBuilder.ToString()); } protected override void Unhook() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Enumerator<ItemTierDef> enumerator = ItemTierCatalog.allItemTierDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { ItemTierDef current = enumerator.Current; if (originalRules.TryGetValue(current.tier, out var value)) { current.pickupRules = value; } } } finally { ((IDisposable)enumerator).Dispose(); } originalRules.Clear(); Plugin.Logger.LogDebug((object)("VoidPickupConfirmAll> Unhooked by " + TweakBase.GetExecutingMethod())); } } }