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 SpexSoftlockFix v0.1.3
BepInEx/plugins/SpexSoftlockFix/SpexSoftlockFix.dll
Decompiled 15 hours agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates.SolusVendor; using HarmonyLib; using RoR2; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SpexSoftlockFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.3.0")] [assembly: AssemblyInformationalVersion("0.1.3+de95d2eefad4fddd1c8b7ad70f8f6f6918fd4563")] [assembly: AssemblyProduct("SpexSoftlockFix")] [assembly: AssemblyTitle("SpexSoftlockFix")] [assembly: AssemblyVersion("0.1.3.0")] namespace SpexSoftlockFix; internal static class SpexRunState { private static Run _run; private static CharacterMaster _submitter; internal static CharacterMaster Submitter { get { Sync(); return _submitter; } } internal static void Record(CharacterMaster master) { Sync(); _submitter = master; } private static void Sync() { if ((Object)(object)Run.instance != (Object)(object)_run) { _run = Run.instance; _submitter = null; } } } [HarmonyPatch(typeof(SetStateOnHurt), "SetPain")] internal static class PreventHurtStealPatch { [HarmonyPrefix] private static bool Prefix(SetStateOnHurt __instance) { if (!SpexSoftlockFixPlugin.PreventSpexAnger.Value || !Object.op_Implicit((Object)(object)__instance)) { return true; } if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<SolusVendorController>())) { return true; } SpexSoftlockFixPlugin.Log.LogDebug((object)"blocked SPEX hurt-state transition"); return false; } } [HarmonyPatch(typeof(SolusVendorMainState), "CanExecuteSkill")] internal static class PreventVendorSkillPatch { [HarmonyPrefix] private static bool Prefix(ref bool __result) { if (!SpexSoftlockFixPlugin.PreventSpexAnger.Value) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(SolusVendorShrineController), "HandleGivenItem")] internal static class RecordSubmitterPatch { [HarmonyPostfix] private static void Postfix(SolusVendorShrineController __instance, int intPickupIndex) { //IL_000e: 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_0027: Unknown result type (might be due to invalid IL or missing references) if (!SpexSoftlockFixPlugin.RefundExposedCerebellum.Value) { return; } PickupDef pickupDef = PickupCatalog.GetPickupDef(new PickupIndex(intPickupIndex)); if (pickupDef == null || pickupDef.itemIndex != Items.MasterCore.itemIndex) { return; } Interactor value = Traverse.Create((object)__instance).Field<Interactor>("interactor").Value; if (Object.op_Implicit((Object)(object)value)) { CharacterBody component = ((Component)value).GetComponent<CharacterBody>(); CharacterMaster val = (Object.op_Implicit((Object)(object)component) ? component.master : null); if (Object.op_Implicit((Object)(object)val)) { SpexRunState.Record(val); } } } } [HarmonyPatch(typeof(StealItem), "OnExit")] internal static class RefundCerebellumPatch { [HarmonyPostfix] private static void Postfix(StealItem __instance) { //IL_0036: 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: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (!SpexSoftlockFixPlugin.RefundExposedCerebellum.Value || !NetworkServer.active) { return; } CharacterMaster submitter = SpexRunState.Submitter; if (!Object.op_Implicit((Object)(object)submitter) || !Object.op_Implicit((Object)(object)submitter.inventory)) { return; } ItemIndex itemIndex = Items.MasterCore.itemIndex; ItemIndex itemIndex2 = Items.MasterBattery.itemIndex; if (submitter.inventory.GetItemCountEffective(itemIndex) <= 0 && submitter.inventory.GetItemCountEffective(itemIndex2) <= 0) { submitter.inventory.GiveItemPermanent(itemIndex, 1); SpexSoftlockFixPlugin.Log.LogInfo((object)("refunded exposed cerebellum to " + ((Object)submitter).name)); if (SpexSoftlockFixPlugin.AnnounceRefund.Value) { Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = (IsChineseLanguage() ? "<color=#c8ffc8>[SPEX Fix] 暴露小脑已返还给供奉者</color>" : "<color=#c8ffc8>[SPEX Fix] Exposed Cerebellum refunded to the offering player</color>") }); } } } private static bool IsChineseLanguage() { string currentLanguageName = Language.currentLanguageName; if (!string.IsNullOrEmpty(currentLanguageName)) { return currentLanguageName.StartsWith("zh"); } return false; } } [BepInPlugin("pipichen.SpexSoftlockFix", "SPEX Softlock Fix", "0.1.3")] public sealed class SpexSoftlockFixPlugin : BaseUnityPlugin { public const string Guid = "pipichen.SpexSoftlockFix"; public const string Name = "SPEX Softlock Fix"; public const string Version = "0.1.3"; internal static ManualLogSource Log; internal static ConfigEntry<bool> PreventSpexAnger; internal static ConfigEntry<bool> RefundExposedCerebellum; internal static ConfigEntry<bool> AnnounceRefund; private Harmony _harmony; private void Awake() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PreventSpexAnger = ((BaseUnityPlugin)this).Config.Bind<bool>("Server", "PreventSpexAnger", true, "SPEX 不再因受击进入偷取状态, 也就不会把玩家踢出计算交易所。 | SPEX can no longer be angered into the steal state, so it never ejects players from the Computational Exchange."); RefundExposedCerebellum = ((BaseUnityPlugin)this).Config.Bind<bool>("Server", "RefundExposedCerebellum", true, "玩家供奉暴露小脑后仍被踢出时, 把暴露小脑返还给最初提交它的玩家。 | If the player is ejected after offering the Exposed Cerebellum, refund it to the player who offered it."); AnnounceRefund = ((BaseUnityPlugin)this).Config.Bind<bool>("Server", "AnnounceRefund", true, "返还暴露小脑时向全队广播一条提示。 | Broadcast a chat message to the team when a refund happens."); _harmony = new Harmony("pipichen.SpexSoftlockFix"); _harmony.PatchAll(typeof(SpexSoftlockFixPlugin).Assembly); Log.LogInfo((object)"SPEX Softlock Fix 0.1.3 loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } }