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 ExtraSkillSlots v1.7.0
plugins/ExtraSkillSlots/ExtraSkillSlots.dll
Decompiled 5 days 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.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using IL.EntityStates; using IL.RoR2; using IL.RoR2.UI; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour.HookGen; using On.EntityStates; using On.RoR2; using On.RoR2.UI; using Rewired; using Rewired.Data; using Rewired.Data.Mapping; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.Items; using RoR2.UI; using RoR2BepInExPack.Utilities; 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: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.7.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 ExtraSkillSlots { public class BookPositionWithExtraSkills : MonoBehaviour { private CursedBookExtraDisplay display; private KeyItemIconExtraDisplay displayIcon; private Vector2 origPivot; private Vector2 origPosition; public void Awake() { //IL_0026: 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) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) display = ((Component)this).GetComponent<CursedBookExtraDisplay>(); displayIcon = ((Component)this).GetComponent<KeyItemIconExtraDisplay>(); RectTransform spellSlotHolder = display.spellSlotHolder; origPivot = spellSlotHolder.pivot; origPosition = spellSlotHolder.anchoredPosition; BaseKeyItemBodyBehavior bodyBehavior = displayIcon.bodyBehavior; Refresh((bodyBehavior != null) ? bodyBehavior.body : null); displayIcon.onBodyBehaviorDiscovered += OnBodyBehaviorDiscovered; displayIcon.onBodyBehaviorLost += OnBodyBehaviorLost; } public void OnDestroy() { displayIcon.onBodyBehaviorDiscovered -= OnBodyBehaviorDiscovered; displayIcon.onBodyBehaviorLost -= OnBodyBehaviorLost; } private void OnBodyBehaviorDiscovered(BaseKeyItemBodyBehavior behavior) { Refresh(behavior.body); } private void OnBodyBehaviorLost(BaseKeyItemBodyBehavior behavior) { Refresh(null); } private void Refresh(CharacterBody body) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0043: 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) RectTransform spellSlotHolder = display.spellSlotHolder; if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)((Component)body).GetComponent<ExtraSkillLocator>())) { spellSlotHolder.pivot = new Vector2(1f, spellSlotHolder.pivot.y); spellSlotHolder.anchoredPosition = new Vector2(20f, spellSlotHolder.anchoredPosition.y); } else { spellSlotHolder.pivot = origPivot; spellSlotHolder.anchoredPosition = origPosition; } } } internal class ExtraBaseSkillState { private static readonly FixedConditionalWeakTable<ISkillState, ExtraBaseSkillState> instances = new FixedConditionalWeakTable<ISkillState, ExtraBaseSkillState>(); public ExtraInputBankTest ExtraInputBankTest { get; private set; } public ExtraSkillLocator ExtraSkillLocator { get; private set; } public static void IsKeyDownAuthorityILHook(ILContext il) { SkillMethodIl(il, IsKeyDown); } public static void IsKeyJustPressedAuthorityILHook(ILContext il) { SkillMethodIl(il, IsKeyJustPressed); } public static void IsKeyJustReleasedAuthorityILHook(ILContext il) { SkillMethodIl(il, IsKeyJustReleased); } public static void SetKeyPressClaimedAuthorityILHook(ILContext il) { SkillMethodIl(il, SetKeyPressClaimed); } public static void IsKeyPressClaimedAuthorityILHook(ILContext il) { SkillMethodIl(il, IsKeyPressClaimed); } public static void GetSkillDamageSourceIlHook(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<ArgumentOutOfRangeException>(x), (Instruction x) => ILPatternMatchingExt.MatchThrow(x) }); int index = val.Index; val.Index = index + 1; val.Previous.OpCode = OpCodes.Nop; val.Previous.Operand = null; val.Remove(); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<ISkillState, SkillLocator, DamageSource>>((Func<ISkillState, SkillLocator, DamageSource>)GetSkillDamageSource); val.Emit(OpCodes.Ret); } private static void SkillMethodIl(ILContext il, Func<ISkillState, SkillLocator, bool> func) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<ArgumentOutOfRangeException>(x), (Instruction x) => ILPatternMatchingExt.MatchThrow(x) }); int index = val.Index; val.Index = index + 1; val.Previous.OpCode = OpCodes.Nop; val.Previous.Operand = null; val.Remove(); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<ISkillState, SkillLocator, bool>>(func); val.Emit(OpCodes.Ret); } private static bool IsKeyDown(ISkillState skillState, SkillLocator skillLocator) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown if (!TryGetExtraInputBank(skillState, skillLocator, out var extraInputBank, out var _)) { return false; } return (ExtraSkillSlot)(int)skillLocator.FindSkillSlot(skillState.activatorSkillSlot) switch { ExtraSkillSlot.ExtraFirst => extraInputBank.extraSkill1.down, ExtraSkillSlot.ExtraSecond => extraInputBank.extraSkill2.down, ExtraSkillSlot.ExtraThird => extraInputBank.extraSkill3.down, ExtraSkillSlot.ExtraFourth => extraInputBank.extraSkill4.down, _ => throw new ArgumentOutOfRangeException(), }; } private static bool IsKeyJustPressed(ISkillState skillState, SkillLocator skillLocator) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown if (!TryGetExtraInputBank(skillState, skillLocator, out var extraInputBank, out var _)) { return false; } return (ExtraSkillSlot)(int)skillLocator.FindSkillSlot(skillState.activatorSkillSlot) switch { ExtraSkillSlot.ExtraFirst => ((ButtonState)(ref extraInputBank.extraSkill1)).justPressed, ExtraSkillSlot.ExtraSecond => ((ButtonState)(ref extraInputBank.extraSkill2)).justPressed, ExtraSkillSlot.ExtraThird => ((ButtonState)(ref extraInputBank.extraSkill3)).justPressed, ExtraSkillSlot.ExtraFourth => ((ButtonState)(ref extraInputBank.extraSkill4)).justPressed, _ => throw new ArgumentOutOfRangeException(), }; } private static bool IsKeyJustReleased(ISkillState skillState, SkillLocator skillLocator) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown if (!TryGetExtraInputBank(skillState, skillLocator, out var extraInputBank, out var _)) { return false; } return (ExtraSkillSlot)(int)skillLocator.FindSkillSlot(skillState.activatorSkillSlot) switch { ExtraSkillSlot.ExtraFirst => ((ButtonState)(ref extraInputBank.extraSkill1)).justReleased, ExtraSkillSlot.ExtraSecond => ((ButtonState)(ref extraInputBank.extraSkill2)).justReleased, ExtraSkillSlot.ExtraThird => ((ButtonState)(ref extraInputBank.extraSkill3)).justReleased, ExtraSkillSlot.ExtraFourth => ((ButtonState)(ref extraInputBank.extraSkill4)).justReleased, _ => throw new ArgumentOutOfRangeException(), }; } private static bool SetKeyPressClaimed(ISkillState skillState, SkillLocator skillLocator) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown if (!TryGetExtraInputBank(skillState, skillLocator, out var extraInputBank, out var _)) { return false; } return (ExtraSkillSlot)(int)skillLocator.FindSkillSlot(skillState.activatorSkillSlot) switch { ExtraSkillSlot.ExtraFirst => extraInputBank.extraSkill1.hasPressBeenClaimed = true, ExtraSkillSlot.ExtraSecond => extraInputBank.extraSkill2.hasPressBeenClaimed = true, ExtraSkillSlot.ExtraThird => extraInputBank.extraSkill3.hasPressBeenClaimed = true, ExtraSkillSlot.ExtraFourth => extraInputBank.extraSkill4.hasPressBeenClaimed = true, _ => throw new ArgumentOutOfRangeException(), }; } private static bool IsKeyPressClaimed(ISkillState skillState, SkillLocator skillLocator) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown if (!TryGetExtraInputBank(skillState, skillLocator, out var extraInputBank, out var _)) { return false; } return (ExtraSkillSlot)(int)skillLocator.FindSkillSlot(skillState.activatorSkillSlot) switch { ExtraSkillSlot.ExtraFirst => extraInputBank.extraSkill1.hasPressBeenClaimed, ExtraSkillSlot.ExtraSecond => extraInputBank.extraSkill2.hasPressBeenClaimed, ExtraSkillSlot.ExtraThird => extraInputBank.extraSkill3.hasPressBeenClaimed, ExtraSkillSlot.ExtraFourth => extraInputBank.extraSkill4.hasPressBeenClaimed, _ => throw new ArgumentOutOfRangeException(), }; } private static DamageSource GetSkillDamageSource(ISkillState skillState, SkillLocator skillLocator) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected I4, but got Unknown //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_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (!TryGetExtraInputBank(skillState, skillLocator, out var _, out var extraSkillLocator)) { return (DamageSource)0; } return (DamageSource)((ExtraSkillSlot)(int)skillLocator.FindSkillSlot(skillState.activatorSkillSlot) switch { ExtraSkillSlot.ExtraFirst => extraSkillLocator.extraFirstDamageSource, ExtraSkillSlot.ExtraSecond => extraSkillLocator.extraSecondDamageSource, ExtraSkillSlot.ExtraThird => extraSkillLocator.extraThirdDamageSource, ExtraSkillSlot.ExtraFourth => extraSkillLocator.extraFourthDamageSource, _ => throw new ArgumentOutOfRangeException(), }); } private static bool TryGetExtraInputBank(ISkillState skillState, SkillLocator skillLocator, out ExtraInputBankTest extraInputBank, out ExtraSkillLocator extraSkillLocator) { ExtraBaseSkillState extraBaseSkillState = default(ExtraBaseSkillState); if (!instances.TryGetValue(skillState, ref extraBaseSkillState)) { FixedConditionalWeakTable<ISkillState, ExtraBaseSkillState> obj = instances; ExtraBaseSkillState obj2 = new ExtraBaseSkillState { ExtraInputBankTest = ((Component)skillLocator).GetComponent<ExtraInputBankTest>(), ExtraSkillLocator = ((Component)skillLocator).GetComponent<ExtraSkillLocator>() }; extraBaseSkillState = obj2; obj.Add(skillState, obj2); } extraInputBank = extraBaseSkillState.ExtraInputBankTest; extraSkillLocator = extraBaseSkillState.ExtraSkillLocator; if (Object.op_Implicit((Object)(object)extraInputBank)) { return Object.op_Implicit((Object)(object)extraSkillLocator); } return false; } } internal static class ExtraCharacterBody { internal static void RecalculateStatsILHook(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int cooldownScaleIndex = -1; int flatCooldownReductionIndex = -1; val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<SkillLocator>(x, "primary") }); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GenericSkill>(x, "set_cooldownScale") }); val.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref cooldownScaleIndex) }); val.GotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<GenericSkill>(x, "set_flatCooldownReduction") }); val.GotoPrev(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref flatCooldownReductionIndex) }); val.GotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchRet(x) }); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, cooldownScaleIndex); val.Emit(OpCodes.Ldloc, flatCooldownReductionIndex); val.EmitDelegate<Action<CharacterBody, float, float>>((Action<CharacterBody, float, float>)RecalculateCooldowns); } private static void RecalculateCooldowns(CharacterBody characterBody, float scale, float flatCooldownReduction) { ExtraSkillLocator component = ((Component)characterBody).GetComponent<ExtraSkillLocator>(); if (Object.op_Implicit((Object)(object)component)) { if (Object.op_Implicit((Object)(object)component.extraFirst)) { component.extraFirst.cooldownScale = scale; component.extraFirst.flatCooldownReduction = flatCooldownReduction; } if (Object.op_Implicit((Object)(object)component.extraSecond)) { component.extraSecond.cooldownScale = scale; component.extraSecond.flatCooldownReduction = flatCooldownReduction; } if (Object.op_Implicit((Object)(object)component.extraThird)) { component.extraThird.cooldownScale = scale; component.extraThird.flatCooldownReduction = flatCooldownReduction; } if (Object.op_Implicit((Object)(object)component.extraFourth)) { component.extraFourth.cooldownScale = scale; component.extraFourth.flatCooldownReduction = flatCooldownReduction; } } } } internal class ExtraGenericCharacterMain { private static readonly FixedConditionalWeakTable<GenericCharacterMain, ExtraGenericCharacterMain> instances = new FixedConditionalWeakTable<GenericCharacterMain, ExtraGenericCharacterMain>(); public ExtraSkillLocator ExtraSkillLocator { get; private set; } public ExtraInputBankTest ExtraInputBankTest { get; private set; } private ExtraGenericCharacterMain() { } internal static void PerformInputsOverrideHook(orig_PerformInputs orig, GenericCharacterMain self) { orig.Invoke(self); if (((EntityState)self).isAuthority) { ExtraGenericCharacterMain extraGenericCharacterMain = default(ExtraGenericCharacterMain); if (!instances.TryGetValue(self, ref extraGenericCharacterMain)) { FixedConditionalWeakTable<GenericCharacterMain, ExtraGenericCharacterMain> obj = instances; ExtraGenericCharacterMain obj2 = new ExtraGenericCharacterMain { ExtraSkillLocator = ((Component)((EntityState)self).outer).GetComponent<ExtraSkillLocator>(), ExtraInputBankTest = ((Component)((EntityState)self).outer).GetComponent<ExtraInputBankTest>() }; extraGenericCharacterMain = obj2; obj.Add(self, obj2); } ExtraSkillLocator extraSkillLocator = extraGenericCharacterMain.ExtraSkillLocator; ExtraInputBankTest extraInputBankTest = extraGenericCharacterMain.ExtraInputBankTest; if (Object.op_Implicit((Object)(object)extraSkillLocator) && Object.op_Implicit((Object)(object)extraInputBankTest)) { self.HandleSkill(extraSkillLocator.extraFirst, ref extraInputBankTest.extraSkill1); self.HandleSkill(extraSkillLocator.extraSecond, ref extraInputBankTest.extraSkill2); self.HandleSkill(extraSkillLocator.extraThird, ref extraInputBankTest.extraSkill3); self.HandleSkill(extraSkillLocator.extraFourth, ref extraInputBankTest.extraSkill4); } } } } [RequireComponent(typeof(HUD))] internal class ExtraHud : MonoBehaviour { private HUD hud; public SkillIcon extraSkillIconFirst; public SkillIcon extraSkillIconSecond; public SkillIcon extraSkillIconThird; public SkillIcon extraSkillIconFourth; private void Awake() { hud = ((Component)this).GetComponent<HUD>(); SkillIcon[] skillIcons = hud.skillIcons; extraSkillIconFirst = CopyUISkillSlot(RewiredAction.FirstExtraSkill.Name, skillIcons[0]); extraSkillIconSecond = CopyUISkillSlot(RewiredAction.SecondExtraSkill.Name, skillIcons[1]); extraSkillIconThird = CopyUISkillSlot(RewiredAction.ThirdExtraSkill.Name, skillIcons[2]); extraSkillIconFourth = CopyUISkillSlot(RewiredAction.FourthExtraSkill.Name, skillIcons[3]); } internal static SkillIcon CopyUISkillSlot(string actionName, SkillIcon skillsContainer) { //IL_0027: 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) Transform transform = ((Component)skillsContainer).gameObject.transform; Transform obj = Object.Instantiate<Transform>(transform, transform.parent); RectTransform component = ((Component)obj).GetComponent<RectTransform>(); component.anchorMin = new Vector2(1f, 2.5f); component.anchorMax = new Vector2(1f, 2.5f); Transform val = obj.Find("SkillBackgroundPanel"); Transform obj2 = val.Find("SkillKeyText"); ((Component)Object.Instantiate<Transform>(obj2, val)).GetComponent<InputBindingDisplayController>().actionName = actionName; InputBindingDisplayController component2 = ((Component)obj2).GetComponent<InputBindingDisplayController>(); component2.actionName = RewiredAction.ExtraModifier.Name; ((Component)val).gameObject.AddComponent<MPEventSystemLocator>(); ((Component)val).gameObject.AddComponent<SkillInputDisplaySwitch>().modifierGO = ((Component)component2).gameObject; return ((Component)obj).GetComponent<SkillIcon>(); } private void Update() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)hud.targetBodyObject)) { return; } ExtraSkillLocator component = hud.targetBodyObject.GetComponent<ExtraSkillLocator>(); if (Object.op_Implicit((Object)(object)component)) { PlayerCharacterMasterController playerCharacterMasterController = (Object.op_Implicit((Object)(object)hud.targetMaster) ? hud.targetMaster.playerCharacterMasterController : null); if (Object.op_Implicit((Object)(object)extraSkillIconFirst)) { ((Component)extraSkillIconFirst).gameObject.SetActive(ShouldShow(component.extraFirst)); extraSkillIconFirst.targetSkillSlot = (SkillSlot)11; extraSkillIconFirst.targetSkill = component.extraFirst; extraSkillIconFirst.playerCharacterMasterController = playerCharacterMasterController; } if (Object.op_Implicit((Object)(object)extraSkillIconSecond)) { ((Component)extraSkillIconSecond).gameObject.SetActive(ShouldShow(component.extraSecond)); extraSkillIconSecond.targetSkillSlot = (SkillSlot)12; extraSkillIconSecond.targetSkill = component.extraSecond; extraSkillIconSecond.playerCharacterMasterController = playerCharacterMasterController; } if (Object.op_Implicit((Object)(object)extraSkillIconThird)) { ((Component)extraSkillIconThird).gameObject.SetActive(ShouldShow(component.extraThird)); extraSkillIconThird.targetSkillSlot = (SkillSlot)13; extraSkillIconThird.targetSkill = component.extraThird; extraSkillIconThird.playerCharacterMasterController = playerCharacterMasterController; } if (Object.op_Implicit((Object)(object)extraSkillIconFourth)) { ((Component)extraSkillIconFourth).gameObject.SetActive(ShouldShow(component.extraFourth)); extraSkillIconFourth.targetSkillSlot = (SkillSlot)14; extraSkillIconFourth.targetSkill = component.extraFourth; extraSkillIconFourth.playerCharacterMasterController = playerCharacterMasterController; } } else { if (Object.op_Implicit((Object)(object)extraSkillIconFirst)) { ((Component)extraSkillIconFirst).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)extraSkillIconSecond)) { ((Component)extraSkillIconSecond).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)extraSkillIconThird)) { ((Component)extraSkillIconThird).gameObject.SetActive(false); } if (Object.op_Implicit((Object)(object)extraSkillIconFourth)) { ((Component)extraSkillIconFourth).gameObject.SetActive(false); } } } private bool ShouldShow(GenericSkill skill) { if (Object.op_Implicit((Object)(object)skill) && Object.op_Implicit((Object)(object)skill.skillDef)) { return !skill.skillDef.skillName.Equals("Disabled", StringComparison.InvariantCultureIgnoreCase); } return false; } } [RequireComponent(typeof(InputBankTest))] [DisallowMultipleComponent] public class ExtraInputBankTest : MonoBehaviour { public ButtonState extraSkill1; public ButtonState extraSkill2; public ButtonState extraSkill3; public ButtonState extraSkill4; internal static bool CheckAnyButtonDownOverrideHook(orig_CheckAnyButtonDown orig, InputBankTest self) { if (orig.Invoke(self)) { return true; } ExtraInputBankTest component = ((Component)self).GetComponent<ExtraInputBankTest>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } if (!component.extraSkill1.down && !component.extraSkill2.down && !component.extraSkill3.down) { return component.extraSkill4.down; } return true; } } internal static class ExtraInputs { internal static void AddActionsToInputCatalog() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0064: 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) InputCatalog.actionToToken[RewiredAction.FirstExtraSkill] = RewiredAction.FirstExtraSkill.DisplayToken; InputCatalog.actionToToken[RewiredAction.SecondExtraSkill] = RewiredAction.SecondExtraSkill.DisplayToken; InputCatalog.actionToToken[RewiredAction.ThirdExtraSkill] = RewiredAction.ThirdExtraSkill.DisplayToken; InputCatalog.actionToToken[RewiredAction.FourthExtraSkill] = RewiredAction.FourthExtraSkill.DisplayToken; InputCatalog.actionToToken[RewiredAction.ExtraModifier] = RewiredAction.ExtraModifier.DisplayToken; } internal static void AddCustomActions(Action<UserData> orig, UserData self) { self.mapCategories?.Add(RewiredAction.ExtraSkillsCategory); self.actions?.Add(RewiredAction.FirstExtraSkill); self.actions?.Add(RewiredAction.SecondExtraSkill); self.actions?.Add(RewiredAction.ThirdExtraSkill); self.actions?.Add(RewiredAction.FourthExtraSkill); self.actions?.Add(RewiredAction.ExtraModifier); FillActionMaps(RewiredAction.FirstExtraSkill, self); FillActionMaps(RewiredAction.SecondExtraSkill, self); FillActionMaps(RewiredAction.ThirdExtraSkill, self); FillActionMaps(RewiredAction.FourthExtraSkill, self); FillActionMaps(RewiredAction.ExtraModifier, self); orig(self); } internal static void OnLoadUserProfiles(orig_LoadUserProfiles orig, SaveSystem self) { orig.Invoke(self); foreach (var (text2, val2) in self.loadedUserProfiles) { try { AddMissingBindings(val2); val2.RequestEventualSave(); } catch (Exception ex) { ExtraSkillSlotsPlugin.InstanceLogger.LogWarning((object)("Failed to add default bindings to '" + text2 + "' profile")); ExtraSkillSlotsPlugin.InstanceLogger.LogError((object)ex); } } } internal static void OnLoadDefaultProfile(orig_LoadDefaultProfile orig) { orig.Invoke(); try { AddMissingBindings(UserProfile.defaultProfile); } catch (Exception ex) { ExtraSkillSlotsPlugin.InstanceLogger.LogWarning((object)"Failed to add default bindings to default profile"); ExtraSkillSlotsPlugin.InstanceLogger.LogError((object)ex); } } internal static void OnFillDefaultJoystickMaps(orig_FillDefaultJoystickMaps orig, UserProfile self) { orig.Invoke(self); AddMissingBindings(self); } internal static bool InputMapperHelperDoActionElementMapsHaveOverlappingElementOrAction(orig_DoActionElementMapsHaveOverlappingElementOrAction orig, ActionElementMap a, ActionElementMap b) { if ((a.controllerMap is JoystickMap && a.actionId >= RewiredAction.FirstExtraSkill.ActionId && a.actionId <= RewiredAction.FourthExtraSkill.ActionId) != (b.controllerMap is JoystickMap && b.actionId >= RewiredAction.FirstExtraSkill.ActionId && b.actionId <= RewiredAction.FourthExtraSkill.ActionId)) { return false; } return orig.Invoke(a, b); } private static void AddMissingBindings(UserProfile userProfile) { AddActionMaps(RewiredAction.FirstExtraSkill, userProfile); AddActionMaps(RewiredAction.SecondExtraSkill, userProfile); AddActionMaps(RewiredAction.ThirdExtraSkill, userProfile); AddActionMaps(RewiredAction.FourthExtraSkill, userProfile); AddActionMaps(RewiredAction.ExtraModifier, userProfile); } private static void FillActionMaps(RewiredAction action, UserData userData) { foreach (ControllerMap_Editor joystickMap in userData.joystickMaps) { if (joystickMap.categoryId == 0 && joystickMap.actionElementMaps.All((ActionElementMap map) => map.actionId != action.ActionId)) { joystickMap.actionElementMaps.Add(action.DefaultJoystickMap); } } foreach (ControllerMap_Editor keyboardMap in userData.keyboardMaps) { if (keyboardMap.categoryId == 0 && keyboardMap.actionElementMaps.All((ActionElementMap map) => map.actionId != action.ActionId)) { keyboardMap.actionElementMaps.Add(action.DefaultKeyboardMap); } } } private static void AddActionMaps(RewiredAction action, UserProfile userProfile) { //IL_007e: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) foreach (var (_, val2) in userProfile.HardwareJoystickMaps2) { if (((ControllerMap)val2).AllMaps.All((ActionElementMap map) => map.actionId != action.ActionId)) { ((ControllerMap)val2).CreateElementMap(action.DefaultJoystickMap.actionId, action.DefaultJoystickMap.axisContribution, action.DefaultJoystickMap.elementIdentifierId, action.DefaultJoystickMap.elementType, action.DefaultJoystickMap.axisRange, action.DefaultJoystickMap.invert); action.DefaultJoystickMap.cVYzDXVDMNXvRMrklCVdVyeXGAlK((ControllerMap)(object)val2); } } if (((ControllerMap)userProfile.keyboardMap).AllMaps.All((ActionElementMap map) => map.actionId != action.ActionId)) { ActionElementMap val3 = default(ActionElementMap); ((ControllerMap)userProfile.keyboardMap).CreateElementMap(action.DefaultKeyboardMap.actionId, action.DefaultKeyboardMap.axisContribution, action.DefaultKeyboardMap.elementIdentifierId, action.DefaultJoystickMap.elementType, action.DefaultJoystickMap.axisRange, action.DefaultJoystickMap.invert, ref val3); val3._keyboardKeyCode = action.DefaultKeyboardKey; action.DefaultKeyboardMap.cVYzDXVDMNXvRMrklCVdVyeXGAlK((ControllerMap)(object)userProfile.keyboardMap); } } } internal class ExtraPlayerCharacterMasterController : NetworkBehaviour { private struct PreButtons<T> { public T extraSkill1; public T extraSkill2; public T extraSkill3; public T extraSkill4; } private PlayerCharacterMasterController playerCharacterMasterController; private ExtraInputBankTest extraInputBankTest; private PreButtons<ButtonBuffer> buttonBuffers; private PreButtons<int> buttonCollisions; private static ButtonBuffer bufferDiscard; public void Awake() { playerCharacterMasterController = ((Component)this).GetComponent<PlayerCharacterMasterController>(); InputBindingDisplayController.onBindingsChanged = (Action)Delegate.Combine(InputBindingDisplayController.onBindingsChanged, new Action(RebuildCollisions)); } public void Start() { RebuildCollisions(); } public void OnDestroy() { InputBindingDisplayController.onBindingsChanged = (Action)Delegate.Remove(InputBindingDisplayController.onBindingsChanged, new Action(RebuildCollisions)); } public void Update() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Invalid comparison between Unknown and I4 if (!playerCharacterMasterController.hasEffectiveAuthority || !Object.op_Implicit((Object)(object)playerCharacterMasterController.networkUser)) { return; } NetworkUser networkUser = playerCharacterMasterController.networkUser; Player inputPlayer = networkUser.inputPlayer; ((ButtonBuffer)(ref buttonBuffers.extraSkill1)).PushValue(inputPlayer.GetButton(RewiredAction.FirstExtraSkill.ActionId)); ((ButtonBuffer)(ref buttonBuffers.extraSkill2)).PushValue(inputPlayer.GetButton(RewiredAction.SecondExtraSkill.ActionId)); ((ButtonBuffer)(ref buttonBuffers.extraSkill3)).PushValue(inputPlayer.GetButton(RewiredAction.ThirdExtraSkill.ActionId)); ((ButtonBuffer)(ref buttonBuffers.extraSkill4)).PushValue(inputPlayer.GetButton(RewiredAction.FourthExtraSkill.ActionId)); LocalUser localUser = networkUser.localUser; if (localUser != null && localUser.isUIFocused) { SuppressAllExtraButtons(); return; } MPEventSystem eventSystem = networkUser.localUser.eventSystem; if (eventSystem != null && (int)eventSystem.currentInputSource == 1) { if (inputPlayer.GetButton(RewiredAction.ExtraModifier.ActionId)) { HandleButtonSuppression(ref buttonBuffers.extraSkill1, ref GetVanillaButtonBuffer(buttonCollisions.extraSkill1)); HandleButtonSuppression(ref buttonBuffers.extraSkill2, ref GetVanillaButtonBuffer(buttonCollisions.extraSkill2)); HandleButtonSuppression(ref buttonBuffers.extraSkill3, ref GetVanillaButtonBuffer(buttonCollisions.extraSkill3)); HandleButtonSuppression(ref buttonBuffers.extraSkill4, ref GetVanillaButtonBuffer(buttonCollisions.extraSkill4)); } else { HandleButtonSuppression(ref GetVanillaButtonBuffer(buttonCollisions.extraSkill1), ref buttonBuffers.extraSkill1); HandleButtonSuppression(ref GetVanillaButtonBuffer(buttonCollisions.extraSkill2), ref buttonBuffers.extraSkill2); HandleButtonSuppression(ref GetVanillaButtonBuffer(buttonCollisions.extraSkill3), ref buttonBuffers.extraSkill3); HandleButtonSuppression(ref GetVanillaButtonBuffer(buttonCollisions.extraSkill4), ref buttonBuffers.extraSkill4); } } } private void HandleButtonSuppression(ref ButtonBuffer currentBuffer, ref ButtonBuffer previousBuffer) { if (previousBuffer.previousPollReportedValue) { ((ButtonBuffer)(ref currentBuffer)).SuppressUntilReleased(); } else { ((ButtonBuffer)(ref previousBuffer)).SuppressUntilReleased(); } } private void SuppressAllExtraButtons() { ((ButtonBuffer)(ref buttonBuffers.extraSkill1)).SuppressUntilReleased(); ((ButtonBuffer)(ref buttonBuffers.extraSkill2)).SuppressUntilReleased(); ((ButtonBuffer)(ref buttonBuffers.extraSkill3)).SuppressUntilReleased(); ((ButtonBuffer)(ref buttonBuffers.extraSkill4)).SuppressUntilReleased(); } public void FixedUpdate() { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0075: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)extraInputBankTest) && playerCharacterMasterController.hasEffectiveAuthority) { PreButtons<PollResult> preButtons = new PreButtons<PollResult> { extraSkill1 = ((ButtonBuffer)(ref buttonBuffers.extraSkill1)).Poll(), extraSkill2 = ((ButtonBuffer)(ref buttonBuffers.extraSkill2)).Poll(), extraSkill3 = ((ButtonBuffer)(ref buttonBuffers.extraSkill3)).Poll(), extraSkill4 = ((ButtonBuffer)(ref buttonBuffers.extraSkill4)).Poll() }; LocalUser val = default(LocalUser); Player val2 = default(Player); CameraRigController val3 = default(CameraRigController); bool flag = default(bool); if (!PlayerCharacterMasterController.CanSendBodyInput(playerCharacterMasterController.networkUser, ref val, ref val2, ref val3, ref flag) || flag) { preButtons = default(PreButtons<PollResult>); } ((ButtonState)(ref extraInputBankTest.extraSkill1)).PushState(preButtons.extraSkill1.value); ((ButtonState)(ref extraInputBankTest.extraSkill2)).PushState(preButtons.extraSkill2.value); ((ButtonState)(ref extraInputBankTest.extraSkill3)).PushState(preButtons.extraSkill3.value); ((ButtonState)(ref extraInputBankTest.extraSkill4)).PushState(preButtons.extraSkill4.value); } } internal static void SetBodyOverrideHook(orig_SetBody orig, PlayerCharacterMasterController self, GameObject newBody) { orig.Invoke(self, newBody); ExtraPlayerCharacterMasterController component = ((Component)self).GetComponent<ExtraPlayerCharacterMasterController>(); if (Object.op_Implicit((Object)(object)component)) { component.extraInputBankTest = (Object.op_Implicit((Object)(object)self.body) ? ((Component)self.body).GetComponent<ExtraInputBankTest>() : null); } } internal static void AwakeHook(orig_Awake orig, PlayerCharacterMasterController self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<ExtraPlayerCharacterMasterController>(); } public ref ButtonBuffer GetVanillaButtonBuffer(int index) { return index switch { 0 => ref playerCharacterMasterController.buttonBuffers.skill1, 1 => ref playerCharacterMasterController.buttonBuffers.skill2, 2 => ref playerCharacterMasterController.buttonBuffers.skill3, 3 => ref playerCharacterMasterController.buttonBuffers.skill4, 4 => ref playerCharacterMasterController.buttonBuffers.interact, 5 => ref playerCharacterMasterController.buttonBuffers.sprint, 6 => ref playerCharacterMasterController.buttonBuffers.activateEquipment, 7 => ref playerCharacterMasterController.buttonBuffers.jump, 8 => ref playerCharacterMasterController.buttonBuffers.ping, 9 => ref playerCharacterMasterController.buttonBuffers.activateKeyItem, 10 => ref playerCharacterMasterController.buttonBuffers.keyItemNextElement, 11 => ref playerCharacterMasterController.buttonBuffers.keyItemPrevElement, _ => ref bufferDiscard, }; } private void RebuildCollisions() { if (!Object.op_Implicit((Object)(object)playerCharacterMasterController) || !Object.op_Implicit((Object)(object)playerCharacterMasterController.networkUser) || playerCharacterMasterController.networkUser.localUser == null) { ResetCollisions(); return; } MPEventSystem eventSystem = playerCharacterMasterController.networkUser.localUser.eventSystem; if (!Object.op_Implicit((Object)(object)eventSystem)) { ResetCollisions(); return; } string[] array = new string[12] { GetGlyphString(eventSystem, 7, (AxisRange)0), GetGlyphString(eventSystem, 8, (AxisRange)0), GetGlyphString(eventSystem, 9, (AxisRange)0), GetGlyphString(eventSystem, 10, (AxisRange)0), GetGlyphString(eventSystem, 5, (AxisRange)0), GetGlyphString(eventSystem, 18, (AxisRange)0), GetGlyphString(eventSystem, 6, (AxisRange)0), GetGlyphString(eventSystem, 4, (AxisRange)0), GetGlyphString(eventSystem, 28, (AxisRange)0), GetGlyphString(eventSystem, 44, (AxisRange)0), GetGlyphString(eventSystem, 47, (AxisRange)1), GetGlyphString(eventSystem, 47, (AxisRange)2) }; buttonCollisions.extraSkill1 = ((ReadOnlySpan<string>)array).IndexOf(GetGlyphString(eventSystem, RewiredAction.FirstExtraSkill.ActionId, (AxisRange)0)); buttonCollisions.extraSkill2 = ((ReadOnlySpan<string>)array).IndexOf(GetGlyphString(eventSystem, RewiredAction.SecondExtraSkill.ActionId, (AxisRange)0)); buttonCollisions.extraSkill3 = ((ReadOnlySpan<string>)array).IndexOf(GetGlyphString(eventSystem, RewiredAction.ThirdExtraSkill.ActionId, (AxisRange)0)); buttonCollisions.extraSkill4 = ((ReadOnlySpan<string>)array).IndexOf(GetGlyphString(eventSystem, RewiredAction.FourthExtraSkill.ActionId, (AxisRange)0)); } private void ResetCollisions() { buttonCollisions.extraSkill1 = -1; buttonCollisions.extraSkill2 = -1; buttonCollisions.extraSkill3 = -1; buttonCollisions.extraSkill4 = -1; } private string GetGlyphString(MPEventSystem eventSystem, int actionId, AxisRange axisRange = (AxisRange)0) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return Glyphs.GetGlyphString(eventSystem, ReInput.mapping.GetAction(actionId).name, axisRange); } } [RequireComponent(typeof(SkillLocator))] [DisallowMultipleComponent] public class ExtraSkillLocator : MonoBehaviour { public GenericSkill extraFirst; public GenericSkill extraSecond; public GenericSkill extraThird; public GenericSkill extraFourth; public DamageSource extraFirstDamageSource; public DamageSource extraSecondDamageSource; public DamageSource extraThirdDamageSource; public DamageSource extraFourthDamageSource; private void Awake() { if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent<ExtraInputBankTest>())) { ((Component)this).gameObject.AddComponent<ExtraInputBankTest>(); } } internal static GenericSkill GetSkillOverrideHook(orig_GetSkill orig, SkillLocator self, SkillSlot skillSlot) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected I4, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ExtraSkillLocator component = ((Component)self).GetComponent<ExtraSkillLocator>(); if (!Object.op_Implicit((Object)(object)component)) { return orig.Invoke(self, skillSlot); } return (GenericSkill)((ExtraSkillSlot)(int)skillSlot switch { ExtraSkillSlot.ExtraFirst => component.extraFirst, ExtraSkillSlot.ExtraSecond => component.extraSecond, ExtraSkillSlot.ExtraThird => component.extraThird, ExtraSkillSlot.ExtraFourth => component.extraFourth, _ => orig.Invoke(self, skillSlot), }); } internal static SkillSlot FindSkillSlotOverrideHook(orig_FindSkillSlot orig, SkillLocator self, GenericSkill skillComponent) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) ExtraSkillLocator component = ((Component)self).GetComponent<ExtraSkillLocator>(); if (!Object.op_Implicit((Object)(object)component)) { return orig.Invoke(self, skillComponent); } if (!Object.op_Implicit((Object)(object)skillComponent)) { return (SkillSlot)(-1); } if ((Object)(object)skillComponent == (Object)(object)component.extraFirst) { return (SkillSlot)11; } if ((Object)(object)skillComponent == (Object)(object)component.extraSecond) { return (SkillSlot)12; } if ((Object)(object)skillComponent == (Object)(object)component.extraThird) { return (SkillSlot)13; } if ((Object)(object)skillComponent == (Object)(object)component.extraFourth) { return (SkillSlot)14; } return orig.Invoke(self, skillComponent); } } internal enum ExtraSkillSlot { None = -1, Primary = 0, Secondary = 1, Utility = 2, Special = 3, ExtraFirst = 11, ExtraSecond = 12, ExtraThird = 13, ExtraFourth = 14 } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.KingEnderBrine.ExtraSkillSlots", "Extra Skill Slots", "1.7.0")] public class ExtraSkillSlotsPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Action<Action<UserData>, UserData> <0>__AddCustomActions; public static hook_LoadDefaultProfile <1>__OnLoadDefaultProfile; public static hook_LoadUserProfiles <2>__OnLoadUserProfiles; public static hook_FillDefaultJoystickMaps <3>__OnFillDefaultJoystickMaps; public static hook_DoActionElementMapsHaveOverlappingElementOrAction <4>__InputMapperHelperDoActionElementMapsHaveOverlappingElementOrAction; public static hook_Awake <5>__SettingsPanelControllerStart; public static hook_Awake <6>__HUDAwake; public static hook_GetSkill <7>__GetSkillOverrideHook; public static hook_FindSkillSlot <8>__FindSkillSlotOverrideHook; public static hook_CheckAnyButtonDown <9>__CheckAnyButtonDownOverrideHook; public static hook_PerformInputs <10>__PerformInputsOverrideHook; public static Manipulator <11>__IsKeyDownAuthorityILHook; public static Manipulator <12>__IsKeyJustPressedAuthorityILHook; public static Manipulator <13>__IsKeyJustReleasedAuthorityILHook; public static Manipulator <14>__IsKeyPressClaimedAuthorityILHook; public static Manipulator <15>__SetKeyPressClaimedAuthorityILHook; public static Manipulator <16>__GetSkillDamageSourceIlHook; public static hook_Awake <17>__AwakeHook; public static hook_SetBody <18>__SetBodyOverrideHook; public static Manipulator <19>__RecalculateStatsILHook; public static Manipulator <20>__LoadoutPanelControllerFromSkillSlot; public static hook_Awake <21>__CursedBookExtraDisplayAwake; } public const string GUID = "com.KingEnderBrine.ExtraSkillSlots"; public const string Name = "Extra Skill Slots"; public const string Version = "1.7.0"; internal static ConfigEntry<ModifierButtonBehavior> ModifierButtonBehavior { get; private set; } internal static ExtraSkillSlotsPlugin Instance { get; private set; } internal static ManualLogSource InstanceLogger { get { ExtraSkillSlotsPlugin instance = Instance; if (instance == null) { return null; } return ((BaseUnityPlugin)instance).Logger; } } private void Start() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00d1: 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_00dc: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Expected O, but got Unknown Instance = this; ModifierButtonBehavior = ((BaseUnityPlugin)this).Config.Bind<ModifierButtonBehavior>("Main", "Modifier button behavior", ExtraSkillSlots.ModifierButtonBehavior.Default, "Determines how modifier button for gamepad should behave.\nDefault - You must hold modifier button and press skill button to activate a skill\nIgnore - Modifier button will not be required to activate extra skills"); ExtraInputs.AddActionsToInputCatalog(); HookEndpointManager.Add((MethodBase)typeof(UserData).GetMethod("gLOOAxUFAvrvUufkVjaYyZoeLbLE", BindingFlags.Instance | BindingFlags.NonPublic), (Delegate)new Action<Action<UserData>, UserData>(ExtraInputs.AddCustomActions)); object obj = <>O.<1>__OnLoadDefaultProfile; if (obj == null) { hook_LoadDefaultProfile val = ExtraInputs.OnLoadDefaultProfile; <>O.<1>__OnLoadDefaultProfile = val; obj = (object)val; } UserProfile.LoadDefaultProfile += (hook_LoadDefaultProfile)obj; object obj2 = <>O.<2>__OnLoadUserProfiles; if (obj2 == null) { hook_LoadUserProfiles val2 = ExtraInputs.OnLoadUserProfiles; <>O.<2>__OnLoadUserProfiles = val2; obj2 = (object)val2; } SaveSystem.LoadUserProfiles += (hook_LoadUserProfiles)obj2; object obj3 = <>O.<3>__OnFillDefaultJoystickMaps; if (obj3 == null) { hook_FillDefaultJoystickMaps val3 = ExtraInputs.OnFillDefaultJoystickMaps; <>O.<3>__OnFillDefaultJoystickMaps = val3; obj3 = (object)val3; } UserProfile.FillDefaultJoystickMaps += (hook_FillDefaultJoystickMaps)obj3; object obj4 = <>O.<4>__InputMapperHelperDoActionElementMapsHaveOverlappingElementOrAction; if (obj4 == null) { hook_DoActionElementMapsHaveOverlappingElementOrAction val4 = ExtraInputs.InputMapperHelperDoActionElementMapsHaveOverlappingElementOrAction; <>O.<4>__InputMapperHelperDoActionElementMapsHaveOverlappingElementOrAction = val4; obj4 = (object)val4; } InputMapperHelper.DoActionElementMapsHaveOverlappingElementOrAction += (hook_DoActionElementMapsHaveOverlappingElementOrAction)obj4; object obj5 = <>O.<5>__SettingsPanelControllerStart; if (obj5 == null) { hook_Awake val5 = UIHooks.SettingsPanelControllerStart; <>O.<5>__SettingsPanelControllerStart = val5; obj5 = (object)val5; } SettingsPanelController.Awake += (hook_Awake)obj5; object obj6 = <>O.<6>__HUDAwake; if (obj6 == null) { hook_Awake val6 = UIHooks.HUDAwake; <>O.<6>__HUDAwake = val6; obj6 = (object)val6; } HUD.Awake += (hook_Awake)obj6; object obj7 = <>O.<7>__GetSkillOverrideHook; if (obj7 == null) { hook_GetSkill val7 = ExtraSkillLocator.GetSkillOverrideHook; <>O.<7>__GetSkillOverrideHook = val7; obj7 = (object)val7; } SkillLocator.GetSkill += (hook_GetSkill)obj7; object obj8 = <>O.<8>__FindSkillSlotOverrideHook; if (obj8 == null) { hook_FindSkillSlot val8 = ExtraSkillLocator.FindSkillSlotOverrideHook; <>O.<8>__FindSkillSlotOverrideHook = val8; obj8 = (object)val8; } SkillLocator.FindSkillSlot += (hook_FindSkillSlot)obj8; object obj9 = <>O.<9>__CheckAnyButtonDownOverrideHook; if (obj9 == null) { hook_CheckAnyButtonDown val9 = ExtraInputBankTest.CheckAnyButtonDownOverrideHook; <>O.<9>__CheckAnyButtonDownOverrideHook = val9; obj9 = (object)val9; } InputBankTest.CheckAnyButtonDown += (hook_CheckAnyButtonDown)obj9; object obj10 = <>O.<10>__PerformInputsOverrideHook; if (obj10 == null) { hook_PerformInputs val10 = ExtraGenericCharacterMain.PerformInputsOverrideHook; <>O.<10>__PerformInputsOverrideHook = val10; obj10 = (object)val10; } GenericCharacterMain.PerformInputs += (hook_PerformInputs)obj10; object obj11 = <>O.<11>__IsKeyDownAuthorityILHook; if (obj11 == null) { Manipulator val11 = ExtraBaseSkillState.IsKeyDownAuthorityILHook; <>O.<11>__IsKeyDownAuthorityILHook = val11; obj11 = (object)val11; } SkillStateMethods.IsKeyDownAuthority += (Manipulator)obj11; object obj12 = <>O.<12>__IsKeyJustPressedAuthorityILHook; if (obj12 == null) { Manipulator val12 = ExtraBaseSkillState.IsKeyJustPressedAuthorityILHook; <>O.<12>__IsKeyJustPressedAuthorityILHook = val12; obj12 = (object)val12; } SkillStateMethods.IsKeyJustPressedAuthority += (Manipulator)obj12; object obj13 = <>O.<13>__IsKeyJustReleasedAuthorityILHook; if (obj13 == null) { Manipulator val13 = ExtraBaseSkillState.IsKeyJustReleasedAuthorityILHook; <>O.<13>__IsKeyJustReleasedAuthorityILHook = val13; obj13 = (object)val13; } SkillStateMethods.IsKeyJustReleasedAuthority += (Manipulator)obj13; object obj14 = <>O.<14>__IsKeyPressClaimedAuthorityILHook; if (obj14 == null) { Manipulator val14 = ExtraBaseSkillState.IsKeyPressClaimedAuthorityILHook; <>O.<14>__IsKeyPressClaimedAuthorityILHook = val14; obj14 = (object)val14; } SkillStateMethods.IsKeyPressClaimedAuthority += (Manipulator)obj14; object obj15 = <>O.<15>__SetKeyPressClaimedAuthorityILHook; if (obj15 == null) { Manipulator val15 = ExtraBaseSkillState.SetKeyPressClaimedAuthorityILHook; <>O.<15>__SetKeyPressClaimedAuthorityILHook = val15; obj15 = (object)val15; } SkillStateMethods.SetKeyPressClaimedAuthority += (Manipulator)obj15; object obj16 = <>O.<16>__GetSkillDamageSourceIlHook; if (obj16 == null) { Manipulator val16 = ExtraBaseSkillState.GetSkillDamageSourceIlHook; <>O.<16>__GetSkillDamageSourceIlHook = val16; obj16 = (object)val16; } SkillStateMethods.GetSkillDamageSource += (Manipulator)obj16; object obj17 = <>O.<17>__AwakeHook; if (obj17 == null) { hook_Awake val17 = ExtraPlayerCharacterMasterController.AwakeHook; <>O.<17>__AwakeHook = val17; obj17 = (object)val17; } PlayerCharacterMasterController.Awake += (hook_Awake)obj17; object obj18 = <>O.<18>__SetBodyOverrideHook; if (obj18 == null) { hook_SetBody val18 = ExtraPlayerCharacterMasterController.SetBodyOverrideHook; <>O.<18>__SetBodyOverrideHook = val18; obj18 = (object)val18; } PlayerCharacterMasterController.SetBody += (hook_SetBody)obj18; object obj19 = <>O.<19>__RecalculateStatsILHook; if (obj19 == null) { Manipulator val19 = ExtraCharacterBody.RecalculateStatsILHook; <>O.<19>__RecalculateStatsILHook = val19; obj19 = (object)val19; } CharacterBody.RecalculateStats += (Manipulator)obj19; object obj20 = <>O.<20>__LoadoutPanelControllerFromSkillSlot; if (obj20 == null) { Manipulator val20 = UIHooks.LoadoutPanelControllerFromSkillSlot; <>O.<20>__LoadoutPanelControllerFromSkillSlot = val20; obj20 = (object)val20; } Row.FromSkillSlot += (Manipulator)obj20; object obj21 = <>O.<21>__CursedBookExtraDisplayAwake; if (obj21 == null) { hook_Awake val21 = UIHooks.CursedBookExtraDisplayAwake; <>O.<21>__CursedBookExtraDisplayAwake = val21; obj21 = (object)val21; } CursedBookExtraDisplay.Awake += (hook_Awake)obj21; Language.collectLanguageRootFolders += CollectLanguageRootFolders; NetworkModCompatibilityHelper.networkModList = NetworkModCompatibilityHelper.networkModList.Append("com.KingEnderBrine.ExtraSkillSlots;1.7.0"); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { RiskOfOptionsCompat.AddConfig(); } } private void CollectLanguageRootFolders(List<string> folders) { folders.Add(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language")); } } public static class LanguageConsts { public static readonly string EXTRA_SKILL_SLOTS_FIRST_EXTRA_SKILL = "EXTRA_SKILL_SLOTS_FIRST_EXTRA_SKILL"; public static readonly string EXTRA_SKILL_SLOTS_SECOND_EXTRA_SKILL = "EXTRA_SKILL_SLOTS_SECOND_EXTRA_SKILL"; public static readonly string EXTRA_SKILL_SLOTS_THIRD_EXTRA_SKILL = "EXTRA_SKILL_SLOTS_THIRD_EXTRA_SKILL"; public static readonly string EXTRA_SKILL_SLOTS_FOURTH_EXTRA_SKILL = "EXTRA_SKILL_SLOTS_FOURTH_EXTRA_SKILL"; public static readonly string EXTRA_SKILL_SLOTS_EXTRA_MODIFIER = "EXTRA_SKILL_SLOTS_EXTRA_MODIFIER"; } public enum ModifierButtonBehavior { Default, Ignore } public class RewiredAction { private InputAction inputAction; private ActionElementMap _defaultJoystickMap; private ActionElementMap _defaultKeyboardMap; public static RewiredAction FirstExtraSkill { get; } public static RewiredAction SecondExtraSkill { get; } public static RewiredAction ThirdExtraSkill { get; } public static RewiredAction FourthExtraSkill { get; } public static RewiredAction ExtraModifier { get; } public static InputMapCategory ExtraSkillsCategory { get; } public int ActionId { get; private set; } public string Name { get; private set; } public string DisplayToken { get; private set; } public KeyboardKeyCode DefaultKeyboardKey { get; private set; } public int DefaultJoystickKey { get; private set; } public int CategoryId { get; private set; } public ActionElementMap DefaultJoystickMap { get { //IL_001a: 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_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown ActionElementMap obj = _defaultJoystickMap; if (obj == null) { ActionElementMap val = new ActionElementMap(ActionId, (ControllerElementType)1, DefaultJoystickKey, (Pole)0, (AxisRange)1); ActionElementMap val2 = val; _defaultJoystickMap = val; obj = val2; } return obj; } } public ActionElementMap DefaultKeyboardMap { get { //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: Expected I4, but got Unknown //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_0022: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0033: Expected O, but got Unknown ActionElementMap obj = _defaultKeyboardMap; if (obj == null) { ActionElementMap val = new ActionElementMap(ActionId, (ControllerElementType)1, DefaultKeyboardKey - 21) { _keyboardKeyCode = DefaultKeyboardKey }; ActionElementMap val2 = val; _defaultKeyboardMap = val; obj = val2; } return obj; } } static RewiredAction() { //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_000d: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown InputMapCategory val = new InputMapCategory(); ((InputCategory)val).QurFqcdYtHIEpCpYBddZfQQtnImHA(100); ((InputCategory)val).LEWtVuPGPZtPpCUSAMYCEbPqyAuf("ExtraSkills"); ((InputCategory)val).nfWwbfSEwQCdVSicPaIBIPkMqJfu("Extra skills"); val.nCSWMGlcEoXKgwGMNFCNFCCAkmwFA(false); ((InputCategory)val).BSFQAxJApIZsVFnOmINQEGShHPvFb(true); ExtraSkillsCategory = val; FirstExtraSkill = new RewiredAction { ActionId = 100, Name = "FirstExtraSkill", DisplayToken = LanguageConsts.EXTRA_SKILL_SLOTS_FIRST_EXTRA_SKILL, DefaultKeyboardKey = (KeyboardKeyCode)49, DefaultJoystickKey = 5, CategoryId = ((InputCategory)ExtraSkillsCategory).id }; SecondExtraSkill = new RewiredAction { ActionId = 101, Name = "SecondExtraSkill", DisplayToken = LanguageConsts.EXTRA_SKILL_SLOTS_SECOND_EXTRA_SKILL, DefaultKeyboardKey = (KeyboardKeyCode)50, DefaultJoystickKey = 4, CategoryId = ((InputCategory)ExtraSkillsCategory).id }; ThirdExtraSkill = new RewiredAction { ActionId = 102, Name = "ThirdExtraSkill", DisplayToken = LanguageConsts.EXTRA_SKILL_SLOTS_THIRD_EXTRA_SKILL, DefaultKeyboardKey = (KeyboardKeyCode)51, DefaultJoystickKey = 10, CategoryId = ((InputCategory)ExtraSkillsCategory).id }; FourthExtraSkill = new RewiredAction { ActionId = 103, Name = "FourthExtraSkill", DisplayToken = LanguageConsts.EXTRA_SKILL_SLOTS_FOURTH_EXTRA_SKILL, DefaultKeyboardKey = (KeyboardKeyCode)52, DefaultJoystickKey = 11, CategoryId = ((InputCategory)ExtraSkillsCategory).id }; ExtraModifier = new RewiredAction { ActionId = 104, Name = "ExtraModifier", DisplayToken = LanguageConsts.EXTRA_SKILL_SLOTS_EXTRA_MODIFIER, DefaultKeyboardKey = (KeyboardKeyCode)0, DefaultJoystickKey = 7, CategoryId = 0 }; } public static implicit operator ActionAxisPair(RewiredAction action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return new ActionAxisPair(action.Name, (AxisRange)0); } public static implicit operator InputAction(RewiredAction action) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0044: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_005e: Expected O, but got Unknown InputAction obj = action.inputAction; if (obj == null) { InputAction val = new InputAction(); val.QurFqcdYtHIEpCpYBddZfQQtnImHA(action.ActionId); val.LEWtVuPGPZtPpCUSAMYCEbPqyAuf(action.Name); val.nLGCfekdjaMIxCLlcjdYgcEjEDxz((InputActionType)1); val.nfWwbfSEwQCdVSicPaIBIPkMqJfu(action.Name); val.MFwTFVDRoziRWNJMARlSUXIebtLw(0); val.BSFQAxJApIZsVFnOmINQEGShHPvFb(true); val.REsRGcKFtjbUwlqUSreCTUubayPb(action.CategoryId); InputAction val2 = val; action.inputAction = val; obj = val2; } return obj; } } public class RiskOfOptionsCompat { [MethodImpl(MethodImplOptions.NoInlining)] public static void AddConfig() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)ExtraSkillSlotsPlugin.ModifierButtonBehavior), "com.KingEnderBrine.ExtraSkillSlots", "Extra Skill Slots"); } } public class SkillInputDisplaySwitch : MonoBehaviour { public GameObject modifierGO; private InputSource lastSource = (InputSource)(-1); private MPEventSystemLocator eventSystemLocator; public void Awake() { eventSystemLocator = ((Component)this).GetComponent<MPEventSystemLocator>(); ExtraSkillSlotsPlugin.ModifierButtonBehavior.SettingChanged += ModifierButtonBehaviorSettingChanged; } public void OnDestroy() { ExtraSkillSlotsPlugin.ModifierButtonBehavior.SettingChanged -= ModifierButtonBehaviorSettingChanged; } private void ModifierButtonBehaviorSettingChanged(object sender, EventArgs e) { Refresh(); } public void Update() { //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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)eventSystemLocator.eventSystem)) { InputSource currentInputSource = eventSystemLocator.eventSystem.currentInputSource; if (lastSource != currentInputSource) { lastSource = currentInputSource; Refresh(); } } } private void Refresh() { //IL_0001: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((int)lastSource == 0 || ExtraSkillSlotsPlugin.ModifierButtonBehavior.Value == ModifierButtonBehavior.Ignore) { modifierGO.SetActive(false); ((Component)this).transform.localScale = Vector3.one; } else if ((int)lastSource == 1) { modifierGO.SetActive(true); ((Component)this).transform.localScale = new Vector3(0.7f, 0.7f, 0.7f); } } } internal static class UIHooks { internal static void HUDAwake(orig_Awake orig, HUD self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<ExtraHud>(); } internal static void SettingsPanelControllerStart(orig_Awake orig, SettingsPanelController self) { orig.Invoke(self); string name = ((Object)self).name; if (name == "SettingsSubPanel, Controls (M&KB)" || name == "SettingsSubPanel, Controls (Gamepad)") { Transform buttonToCopy = ((Component)self).transform.Find("Scroll View/Viewport/VerticalLayout/SettingsEntryButton, Binding (Jump)"); if (name == "SettingsSubPanel, Controls (Gamepad)") { AddActionBindingToSettings(RewiredAction.ExtraModifier.Name, buttonToCopy); } AddActionBindingToSettings(RewiredAction.FirstExtraSkill.Name, buttonToCopy); AddActionBindingToSettings(RewiredAction.SecondExtraSkill.Name, buttonToCopy); AddActionBindingToSettings(RewiredAction.ThirdExtraSkill.Name, buttonToCopy); AddActionBindingToSettings(RewiredAction.FourthExtraSkill.Name, buttonToCopy); } } internal static void AddActionBindingToSettings(string actionName, Transform buttonToCopy) { InputBindingControl component = ((Component)Object.Instantiate<Transform>(buttonToCopy, buttonToCopy.parent)).GetComponent<InputBindingControl>(); component.actionName = actionName; component.Awake(); } internal static void LoadoutPanelControllerFromSkillSlot(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int skillSlotIndex = -1; int titleTokenIndex = -1; int addWIPIconsIndex = -1; val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<SkillLocator>(x, "FindSkillSlot"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref skillSlotIndex) }); string text = default(string); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, ref text), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref titleTokenIndex) }); int num = default(int); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref addWIPIconsIndex) }); val.GotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchNewobj<ArgumentOutOfRangeException>(x), (Instruction x) => ILPatternMatchingExt.MatchThrow(x) }); val.Index += 1; val.Remove(); val.Previous.OpCode = OpCodes.Nop; val.Previous.Operand = null; val.Emit(OpCodes.Ldloc, skillSlotIndex); val.Emit(OpCodes.Call, (MethodBase)typeof(UIHooks).GetMethod("GetSkillSlotName", BindingFlags.Static | BindingFlags.NonPublic)); val.Emit(OpCodes.Stloc, titleTokenIndex); val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Stloc, addWIPIconsIndex); } private static string GetSkillSlotName(SkillSlot skillSlot) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown return (ExtraSkillSlot)(int)skillSlot switch { ExtraSkillSlot.ExtraFirst => LanguageConsts.EXTRA_SKILL_SLOTS_FIRST_EXTRA_SKILL, ExtraSkillSlot.ExtraSecond => LanguageConsts.EXTRA_SKILL_SLOTS_SECOND_EXTRA_SKILL, ExtraSkillSlot.ExtraThird => LanguageConsts.EXTRA_SKILL_SLOTS_THIRD_EXTRA_SKILL, ExtraSkillSlot.ExtraFourth => LanguageConsts.EXTRA_SKILL_SLOTS_FOURTH_EXTRA_SKILL, _ => throw new ArgumentOutOfRangeException(), }; } internal static void CursedBookExtraDisplayAwake(orig_Awake orig, CursedBookExtraDisplay self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<BookPositionWithExtraSkills>(); } } }