using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using MelonLoader;
using Microsoft.CodeAnalysis;
using TheCodex;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Class1), "The Codex", "2.0", "TheMrEvil", null)]
[assembly: MelonGame("Alvios", "Vellum")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TheCodex")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8775f5a590fa3cbdc7181f58469351ca662e6f54")]
[assembly: AssemblyProduct("TheCodex")]
[assembly: AssemblyTitle("TheCodex")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace System.Runtime.Versioning
{
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)]
internal sealed class RequiresPreviewFeaturesAttribute : Attribute
{
public string? Message { get; }
public string? Url { get; set; }
public RequiresPreviewFeaturesAttribute()
{
}
public RequiresPreviewFeaturesAttribute(string? message)
{
Message = message;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
internal sealed class CompilerFeatureRequiredAttribute : Attribute
{
public const string RefStructs = "RefStructs";
public const string RequiredMembers = "RequiredMembers";
public string FeatureName { get; }
public bool IsOptional { get; set; }
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute
{
public string[] Arguments { get; }
public InterpolatedStringHandlerArgumentAttribute(string argument)
{
Arguments = new string[1] { argument };
}
public InterpolatedStringHandlerArgumentAttribute(params string[] arguments)
{
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class StringSyntaxAttribute : Attribute
{
public const string CompositeFormat = "CompositeFormat";
public const string DateOnlyFormat = "DateOnlyFormat";
public const string DateTimeFormat = "DateTimeFormat";
public const string EnumFormat = "EnumFormat";
public const string GuidFormat = "GuidFormat";
public const string Json = "Json";
public const string NumericFormat = "NumericFormat";
public const string Regex = "Regex";
public const string TimeOnlyFormat = "TimeOnlyFormat";
public const string TimeSpanFormat = "TimeSpanFormat";
public const string Uri = "Uri";
public const string Xml = "Xml";
public string Syntax { get; }
public object?[] Arguments { get; }
public StringSyntaxAttribute(string syntax)
{
Syntax = syntax;
Arguments = new object[0];
}
public StringSyntaxAttribute(string syntax, params object?[] arguments)
{
Syntax = syntax;
Arguments = arguments;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
namespace TheCodex
{
public class Class1 : MelonMod
{
public enum AbilityTabType
{
Primary,
Secondary,
Utility,
Movement,
Core,
AllAugments
}
private bool showDropdown;
private Rect windowRect = new Rect(20f, 20f, 500f, 600f);
private Vector2 scrollPosition = Vector2.zero;
private AbilityTabType currentTab;
private readonly string[] tabNames = new string[6] { "Primary", "Secondary", "Utility", "Movement", "Core", "Augments" };
private static readonly Dictionary<PlayerAbilityType, List<AbilityTree>> cachedFullAbilityLists = new Dictionary<PlayerAbilityType, List<AbilityTree>>();
private static readonly List<AugmentTree> cachedFullCoreList = new List<AugmentTree>();
private static bool hasInitializedCache = false;
public override void OnUpdate()
{
if (Input.GetKeyDown((KeyCode)61) || Input.GetKeyDown((KeyCode)270))
{
showDropdown = !showDropdown;
if (showDropdown && !hasInitializedCache)
{
InitializeAbilityCache();
}
}
if (showDropdown)
{
SetCursorState(unlocked: true);
}
}
private void InitializeAbilityCache()
{
//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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
try
{
MelonLogger.Msg("Initializing ability cache...");
PlayerAbilityType[] array = new PlayerAbilityType[4];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
PlayerAbilityType[] array2 = (PlayerAbilityType[])(object)array;
foreach (PlayerAbilityType val in array2)
{
List<AbilityTree> abilitiesForTypeInternal = GetAbilitiesForTypeInternal(val);
cachedFullAbilityLists[val] = new List<AbilityTree>(abilitiesForTypeInternal);
MelonLogger.Msg($"Cached {abilitiesForTypeInternal.Count} abilities for type {val}");
}
List<AugmentTree> availableCoresInternal = GetAvailableCoresInternal();
cachedFullCoreList.Clear();
cachedFullCoreList.AddRange(availableCoresInternal);
MelonLogger.Msg($"Cached {availableCoresInternal.Count} cores");
hasInitializedCache = true;
}
catch (Exception arg)
{
MelonLogger.Error($"Error initializing ability cache: {arg}");
}
}
public override void OnGUI()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Expected O, but got Unknown
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
if (showDropdown)
{
GUI.FocusWindow(0);
GUIStyle val = new GUIStyle(GUI.skin.window);
val.normal.background = MakeTexture(2, 2, new Color(0.12f, 0.12f, 0.12f, 1f));
val.hover.background = val.normal.background;
val.active.background = val.normal.background;
val.focused.background = val.normal.background;
val.onNormal.background = val.normal.background;
val.onHover.background = val.normal.background;
val.onActive.background = val.normal.background;
val.onFocused.background = val.normal.background;
val.normal.textColor = Color.white;
val.hover.textColor = Color.white;
val.active.textColor = Color.white;
val.focused.textColor = Color.white;
val.onNormal.textColor = Color.white;
val.onHover.textColor = Color.white;
val.onActive.textColor = Color.white;
val.onFocused.textColor = Color.white;
GUI.depth = 0;
windowRect = GUILayout.Window(0, windowRect, new WindowFunction(DrawWindow), "The Codex", val, Array.Empty<GUILayoutOption>());
}
}
private void DrawWindow(int windowID)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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: Expected O, but got Unknown
//IL_00c5: 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_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.button);
val.normal.background = MakeTexture(2, 2, new Color(0.2f, 0.2f, 0.2f, 1f));
val.normal.textColor = Color.white;
val.fontSize = 14;
val.fixedHeight = 30f;
val.hover.background = MakeTexture(2, 2, new Color(0.3f, 0.3f, 0.3f, 1f));
val.active.background = val.normal.background;
GUIStyle val2 = new GUIStyle(val);
val2.normal.background = MakeTexture(2, 2, new Color(0.4f, 0.4f, 0.4f, 1f));
val2.normal.textColor = Color.yellow;
val2.hover.background = val2.normal.background;
val2.active.background = val2.normal.background;
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
for (int i = 0; i < tabNames.Length; i++)
{
AbilityTabType abilityTabType = (AbilityTabType)i;
GUIStyle val3 = ((currentTab == abilityTabType) ? val2 : val);
if (GUILayout.Button(tabNames[i], val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
currentTab = abilityTabType;
}
}
GUILayout.EndHorizontal();
GUILayout.Space(10f);
scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
switch (currentTab)
{
case AbilityTabType.Primary:
DrawAbilityTab((PlayerAbilityType)0, "Primary Abilities");
break;
case AbilityTabType.Secondary:
DrawAbilityTab((PlayerAbilityType)1, "Secondary Abilities");
break;
case AbilityTabType.Utility:
DrawAbilityTab((PlayerAbilityType)2, "Utility Abilities");
break;
case AbilityTabType.Movement:
DrawAbilityTab((PlayerAbilityType)3, "Movement Abilities");
break;
case AbilityTabType.Core:
DrawCoreTab();
break;
case AbilityTabType.AllAugments:
DrawAllAugmentsTab();
break;
}
GUILayout.EndScrollView();
GUI.DragWindow();
}
private void DrawAbilityTab(PlayerAbilityType abilityType, string tabTitle)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_001e: 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_00ee: 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_006a: Expected O, but got Unknown
//IL_0088: 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_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Expected O, but got Unknown
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: 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_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.label);
val.fontSize = 18;
val.normal.textColor = Color.white;
val.fontStyle = (FontStyle)1;
GUILayout.Label(tabTitle, val, Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
AbilityTree currentAbility = GetCurrentAbility(abilityType);
if ((Object)(object)currentAbility != (Object)null)
{
GUIStyle val2 = new GUIStyle(GUI.skin.box);
val2.normal.background = MakeTexture(2, 2, new Color(0.1f, 0.3f, 0.1f, 1f));
val2.normal.textColor = Color.green;
val2.fontSize = 14;
GUILayout.BeginVertical(val2, Array.Empty<GUILayoutOption>());
GUILayout.Label("Currently Equipped: " + currentAbility.Root.Name, val2, Array.Empty<GUILayoutOption>());
GUILayout.EndVertical();
GUILayout.Space(10f);
}
List<AbilityTree> abilitiesForType = GetAbilitiesForType(abilityType);
if (abilitiesForType.Count == 0)
{
GUILayout.Label("No abilities available for this type.", GUI.skin.label, Array.Empty<GUILayoutOption>());
return;
}
GUIStyle val3 = new GUIStyle(GUI.skin.button);
val3.normal.background = MakeTexture(2, 2, new Color(0.25f, 0.25f, 0.25f, 1f));
val3.normal.textColor = Color.white;
val3.fontSize = 16;
val3.fixedHeight = 40f;
val3.hover.background = MakeTexture(2, 2, new Color(0.35f, 0.35f, 0.35f, 1f));
val3.active.background = val3.normal.background;
foreach (AbilityTree item in abilitiesForType)
{
string text = item.Root.Name;
bool flag = (Object)(object)currentAbility != (Object)null && ((GraphTree)currentAbility).ID == ((GraphTree)item).ID;
if (flag)
{
val3.normal.textColor = Color.green;
text += " (Equipped)";
}
else
{
val3.normal.textColor = Color.white;
}
if (GUILayout.Button(text, val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }) && !flag)
{
EquipAbility(abilityType, item);
}
}
}
private void DrawCoreTab()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_001e: 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_006d: Expected O, but got Unknown
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.label);
val.fontSize = 18;
val.normal.textColor = Color.white;
val.fontStyle = (FontStyle)1;
GUILayout.Label("Core Selection", val, Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
AugmentTree currentCore = GetCurrentCore();
if ((Object)(object)currentCore != (Object)null)
{
GUIStyle val2 = new GUIStyle(GUI.skin.box);
val2.normal.background = MakeTexture(2, 2, new Color(0.1f, 0.3f, 0.1f, 1f));
val2.normal.textColor = Color.green;
val2.fontSize = 14;
GUILayout.BeginVertical(val2, Array.Empty<GUILayoutOption>());
GUILayout.Label("Currently Equipped: " + currentCore.Root.Name, val2, Array.Empty<GUILayoutOption>());
GUILayout.EndVertical();
GUILayout.Space(10f);
}
List<AugmentTree> availableCores = GetAvailableCores();
if (availableCores.Count == 0)
{
GUILayout.Label("No cores available.", GUI.skin.label, Array.Empty<GUILayoutOption>());
return;
}
GUIStyle val3 = new GUIStyle(GUI.skin.button);
val3.normal.background = MakeTexture(2, 2, new Color(0.25f, 0.25f, 0.25f, 1f));
val3.normal.textColor = Color.white;
val3.fontSize = 16;
val3.fixedHeight = 40f;
val3.hover.background = MakeTexture(2, 2, new Color(0.35f, 0.35f, 0.35f, 1f));
val3.active.background = val3.normal.background;
foreach (AugmentTree item in availableCores)
{
string text = item.Root.Name;
bool flag = (Object)(object)currentCore != (Object)null && ((GraphTree)currentCore).ID == ((GraphTree)item).ID;
if (flag)
{
val3.normal.textColor = Color.green;
text += " (Equipped)";
}
else
{
val3.normal.textColor = Color.white;
}
if (GUILayout.Button(text, val3, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }) && !flag)
{
EquipCore(item);
}
}
}
private void DrawAllAugmentsTab()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_001e: 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_0059: Expected O, but got Unknown
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
GUIStyle val = new GUIStyle(GUI.skin.label);
val.fontSize = 18;
val.normal.textColor = Color.white;
val.fontStyle = (FontStyle)1;
GUILayout.Label("All Augments", val, Array.Empty<GUILayoutOption>());
GUILayout.Space(10f);
GUIStyle val2 = new GUIStyle(GUI.skin.button);
val2.normal.background = MakeTexture(2, 2, new Color(0.25f, 0.25f, 0.25f, 1f));
val2.normal.textColor = Color.white;
val2.fontSize = 16;
val2.fixedHeight = 35f;
val2.hover.background = MakeTexture(2, 2, new Color(0.35f, 0.35f, 0.35f, 1f));
val2.active.background = val2.normal.background;
foreach (AugmentTree addableAugmentTree in GetAddableAugmentTrees())
{
string text = addableAugmentTree.Root?.Name ?? "Unnamed Augment";
if (GUILayout.Button(text, val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }))
{
MelonLogger.Msg("Adding augment: " + text + " (ID: " + ((GraphTree)addableAugmentTree).ID + ")");
AddAugment(addableAugmentTree);
}
}
}
private void AddAugment(AugmentTree augmentTree)
{
try
{
if ((Object)(object)PlayerControl.myInstance != (Object)null)
{
MelonLogger.Msg("Adding augment: " + (augmentTree.Root?.Name ?? "Unnamed") + " (ID: " + ((GraphTree)augmentTree).ID + ")");
((EntityControl)PlayerControl.myInstance).AddAugment(augmentTree, 1);
MelonLogger.Msg("Successfully added augment: " + (augmentTree.Root?.Name ?? "Unnamed"));
}
else
{
MelonLogger.Error("PlayerControl.myInstance is null - cannot add augment");
}
}
catch (Exception arg)
{
MelonLogger.Error(string.Format("Error adding augment {0}: {1}", augmentTree.Root?.Name ?? "Unnamed", arg));
}
}
private List<AugmentTree> GetAddableAugmentTrees()
{
List<AugmentTree> list = new List<AugmentTree>();
try
{
List<AugmentTree> allAugments = GraphDB.GetAllAugments((ModType)0);
if (allAugments != null)
{
foreach (AugmentTree item in allAugments)
{
if ((Object)(object)item != (Object)null)
{
list.Add(item);
}
}
}
}
catch (Exception arg)
{
MelonLogger.Error($"Error getting augment trees: {arg}");
}
return list.OrderBy<AugmentTree, string>((AugmentTree a) => a.Root?.Name ?? "zzz_Unnamed", StringComparer.OrdinalIgnoreCase).ToList();
}
private List<AbilityTree> GetAbilitiesForType(PlayerAbilityType abilityType)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (hasInitializedCache && cachedFullAbilityLists.ContainsKey(abilityType))
{
return cachedFullAbilityLists[abilityType];
}
return GetAbilitiesForTypeInternal(abilityType);
}
private List<AbilityTree> GetAbilitiesForTypeInternal(PlayerAbilityType abilityType)
{
//IL_0094: 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_003a: 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_0047: 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_0050: Unknown result type (might be due to invalid IL or missing references)
List<AbilityTree> list = new List<AbilityTree>();
try
{
List<AbilityTree> playerAbilities = GraphDB.GetPlayerAbilities(abilityType);
if (playerAbilities != null)
{
foreach (AbilityTree item in playerAbilities)
{
if (item != null && item.Root?.PlrAbilityType == (PlayerAbilityType?)abilityType && item.Root.Name != null)
{
list.Add(item);
}
}
}
}
catch (Exception arg)
{
MelonLogger.Error($"Error getting abilities for type {abilityType}: {arg}");
}
return list.OrderBy((AbilityTree a) => a.Root.Name).ToList();
}
private List<AugmentTree> GetAvailableCores()
{
if (hasInitializedCache && cachedFullCoreList.Count > 0)
{
return cachedFullCoreList;
}
return GetAvailableCoresInternal();
}
private List<AugmentTree> GetAvailableCoresInternal()
{
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
List<AugmentTree> list = new List<AugmentTree>();
try
{
Type typeFromHandle = typeof(PlayerDB);
FieldInfo field = typeFromHandle.GetField("instance", BindingFlags.Static | BindingFlags.NonPublic);
if (field != null)
{
object value = field.GetValue(null);
if (value != null)
{
FieldInfo field2 = typeFromHandle.GetField("Cores", BindingFlags.Instance | BindingFlags.Public);
if (field2 != null && field2.GetValue(value) is IEnumerable<object> enumerable)
{
foreach (object item in enumerable)
{
FieldInfo field3 = item.GetType().GetField("core", BindingFlags.Instance | BindingFlags.Public);
FieldInfo field4 = item.GetType().GetField("color", BindingFlags.Instance | BindingFlags.Public);
if (field3 != null && field4 != null)
{
object? value2 = field3.GetValue(item);
AugmentTree val = (AugmentTree)((value2 is AugmentTree) ? value2 : null);
object value3 = field4.GetValue(item);
if ((Object)(object)val != (Object)null)
{
list.Add(val);
MelonLogger.Msg($"Found core: {val.Root.Name} (Color: {value3})");
}
}
}
}
}
}
if (list.Count == 0)
{
MelonLogger.Msg("Reflection approach failed, trying static method approach...");
MagicColor[] array = new MagicColor[8];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
MagicColor[] array2 = (MagicColor[])(object)array;
foreach (MagicColor val2 in array2)
{
try
{
CoreDisplay core = PlayerDB.GetCore(val2);
if ((Object)(object)core?.core != (Object)null)
{
list.Add(core.core);
MelonLogger.Msg($"Found core via static method: {core.core.Root.Name} (Color: {val2})");
}
}
catch (Exception ex)
{
MelonLogger.Warning($"Failed to get core for color {val2}: {ex.Message}");
}
}
}
}
catch (Exception arg)
{
MelonLogger.Error($"Error getting available cores: {arg}");
}
return (from c in list
group c by ((GraphTree)c).ID into g
select g.First() into c
orderby c.Root.Name
select c).ToList();
}
private AbilityTree? GetCurrentAbility(PlayerAbilityType abilityType)
{
//IL_0040: 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)
try
{
if ((Object)(object)PlayerControl.myInstance?.actions != (Object)null)
{
return PlayerControl.myInstance.actions.GetAbility(abilityType)?.AbilityTree;
}
}
catch (Exception arg)
{
MelonLogger.Error($"Error getting current ability for type {abilityType}: {arg}");
}
return null;
}
private AugmentTree? GetCurrentCore()
{
try
{
if ((Object)(object)PlayerControl.myInstance?.actions != (Object)null)
{
FieldInfo field = ((object)PlayerControl.myInstance.actions).GetType().GetField("core", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
object? value = field.GetValue(PlayerControl.myInstance.actions);
return (AugmentTree?)((value is AugmentTree) ? value : null);
}
}
}
catch (Exception arg)
{
MelonLogger.Error($"Error getting current core: {arg}");
}
return null;
}
private void EquipAbility(PlayerAbilityType abilityType, AbilityTree ability)
{
//IL_0029: 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)
try
{
if ((Object)(object)PlayerControl.myInstance?.actions != (Object)null)
{
MelonLogger.Msg($"Equipping {ability.Root.Name} to {abilityType}");
PlayerControl.myInstance.actions.LoadAbility(abilityType, ((Node)ability.Root).guid, false);
Settings.SaveLoadout();
MelonLogger.Msg("Successfully equipped " + ability.Root.Name);
}
}
catch (Exception arg)
{
MelonLogger.Error($"Error equipping ability {ability.Root.Name}: {arg}");
}
}
private void EquipCore(AugmentTree core)
{
try
{
if ((Object)(object)PlayerControl.myInstance?.actions != (Object)null)
{
MelonLogger.Msg("Equipping core: " + core.Root.Name);
PlayerControl.myInstance.actions.SetCore(core);
Settings.SaveLoadout();
MelonLogger.Msg("Successfully equipped core " + core.Root.Name);
}
}
catch (Exception arg)
{
MelonLogger.Error($"Error equipping core {core.Root.Name}: {arg}");
}
}
private void SetCursorState(bool unlocked)
{
if (unlocked)
{
Cursor.lockState = (CursorLockMode)0;
Cursor.visible = true;
}
else
{
Cursor.lockState = (CursorLockMode)1;
Cursor.visible = false;
}
}
private Texture2D MakeTexture(int width, int height, Color color)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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: Expected O, but got Unknown
Color[] array = (Color[])(object)new Color[width * height];
for (int i = 0; i < array.Length; i++)
{
array[i] = color;
}
Texture2D val = new Texture2D(width, height);
val.SetPixels(array);
val.Apply();
return val;
}
}
}