using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using HG;
using HG.Reflection;
using IL.RoR2.UI;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2.UI;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SkillKeywordsInLoadoutTab")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SkillKeywordsInLoadoutTab")]
[assembly: AssemblyTitle("SkillKeywordsInLoadoutTab")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 SkillKeywordsInLoadoutTab
{
[Serializable]
[BepInPlugin("com.brynzananas.skillkeywordsinloadouttab", "Skill Keywords In Loadout Tab", "2.0.0")]
public class SkillKeywordsInLoadoutTab : BaseUnityPlugin
{
public const string ModGuid = "com.brynzananas.skillkeywordsinloadouttab";
public const string ModName = "Skill Keywords In Loadout Tab";
public const string ModVer = "2.0.0";
public static Dictionary<string, string[]> skillNamesToSkillKeywords = new Dictionary<string, string[]>();
public void Awake()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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
Row.FromSkillSlot += new Manipulator(Row_FromSkillSlot);
Row.AddButton += new Manipulator(Row_AddButton);
TooltipController.SetTooltipProvider += new hook_SetTooltipProvider(TooltipController_SetTooltipProvider);
}
private void TooltipController_SetTooltipProvider(orig_SetTooltipProvider orig, TooltipController self, TooltipProvider provider)
{
//IL_0069: 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_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: 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)
orig.Invoke(self, provider);
if (provider.bodyText != null && provider.bodyText.Length > 700)
{
Transform val = ((Component)self).transform.Find("TooltipOffset/Panel/TitleRect");
RectTransform val2 = (RectTransform)(object)((Object.op_Implicit((Object)(object)val) && val is RectTransform) ? ((val is RectTransform) ? val : null) : null);
if (Object.op_Implicit((Object)(object)val2))
{
val2.sizeDelta = new Vector2(val2.sizeDelta.x * 2f, val2.sizeDelta.y);
}
Transform val3 = ((Component)self).transform.Find("TooltipOffset/Panel/BodyRect");
RectTransform val4 = (RectTransform)(object)((Object.op_Implicit((Object)(object)val3) && val3 is RectTransform) ? ((val3 is RectTransform) ? val3 : null) : null);
if (Object.op_Implicit((Object)(object)val4))
{
val4.sizeDelta = new Vector2(val4.sizeDelta.x * 2f, val4.sizeDelta.y);
}
}
}
private void Row_FromSkillSlot(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = null;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 7)
}))
{
val.Emit(OpCodes.Ldloc, 7);
val.EmitDelegate<<>A{00000001}<Variant>>((<>A{00000001}<Variant>)FillSkillNamesToSkillKeywordsDictionary);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
static void FillSkillNamesToSkillKeywordsDictionary(ref Variant variant)
{
if (variant.skillDef.keywordTokens != null && variant.skillDef.keywordTokens.Length != 0 && !skillNamesToSkillKeywords.ContainsKey(variant.skillDef.skillNameToken))
{
skillNamesToSkillKeywords.Add(variant.skillDef.skillNameToken, variant.skillDef.keywordTokens);
}
}
}
private void Row_AddButton(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_003f: 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_0058: 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)
ILCursor val = new ILCursor(il);
ILLabel val2 = null;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStfld<TooltipProvider>(x, "overrideTitleText")
}))
{
val.Emit(OpCodes.Ldloc, 3);
val.Emit(OpCodes.Ldarg_3);
val.Emit(OpCodes.Ldloc_0);
val.EmitDelegate<Func<string, string, HGButton, string>>((Func<string, string, HGButton, string>)sus);
val.Emit(OpCodes.Stloc, 3);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
static string sus(string str, string str2, HGButton hGButton)
{
if (!((MPButton)hGButton).disablePointerClick && skillNamesToSkillKeywords.ContainsKey(str2))
{
string[] array = skillNamesToSkillKeywords[str2];
StringBuilder stringBuilder = StringBuilderPool.RentStringBuilder();
for (int i = 0; i < array.Length; i++)
{
string @string = Language.GetString(array[i]);
stringBuilder.Append("\n\n").Append(@string);
}
string text = stringBuilder.ToString();
stringBuilder = StringBuilderPool.ReturnStringBuilder(stringBuilder);
return str + text;
}
return str;
}
}
}
}