using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("GlobblerLevelUnlocks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0+6ec15b3ffc98c2932156a234a155078e8cc6d2fc")]
[assembly: AssemblyProduct("GlobblerLevelUnlocks")]
[assembly: AssemblyTitle("GlobblerLevelUnlocks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
[BepInPlugin("sparroh.globblerlevelunlocks", "GlobblerLevelUnlocks", "1.0.0")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class SkipIntroPlugin : BaseUnityPlugin
{
public const string PluginGUID = "sparroh.globblerlevelunlocks";
public const string PluginName = "GlobblerLevelUnlocks";
public const string PluginVersion = "1.0.0";
internal static ManualLogSource Logger;
private static LevelUnlock[] _globblerLevelUnlockRewards;
private static LevelUnlockList _globblerLevelUnlocks;
private static bool _initialized;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Expected O, but got Unknown
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("sparroh.globblerlevelunlocks");
MethodInfo methodInfo = AccessTools.Method(typeof(GearData), "HasUnclaimedLevelUnlocks", (Type[])null, (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(typeof(SkipIntroPlugin), "PatchHasUnclaimedLevelUnlocks", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo methodInfo3 = AccessTools.Method(typeof(GearDetailsWindow), "Setup", new Type[1] { typeof(IUpgradable) }, (Type[])null);
MethodInfo methodInfo4 = AccessTools.Method(typeof(SkipIntroPlugin), "PatchSetup", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo3, (HarmonyMethod)null, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
MethodInfo methodInfo5 = AccessTools.Method(typeof(GearDetailsWindow), "ShowLevelUnlocks", (Type[])null, (Type[])null);
MethodInfo methodInfo6 = AccessTools.Method(typeof(SkipIntroPlugin), "PatchShowLevelUnlocks", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
Logger.LogInfo((object)"GlobblerLevelUnlocks loaded successfully.");
}
private static void InitializeGlobblerUnlocks()
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Expected O, but got Unknown
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Expected O, but got Unknown
if (_initialized)
{
return;
}
try
{
List<LevelUnlock> list = new List<LevelUnlock>();
PlayerResource val = null;
PlayerResource val2 = null;
PlayerResource val3 = null;
if (!PlayerResource.TryGetResource("Beezia", ref val) && (Object)(object)val == (Object)null)
{
PlayerResource.TryGetResource("beezia", ref val);
}
if (!PlayerResource.TryGetResource("Yeuco", ref val2) && (Object)(object)val2 == (Object)null)
{
PlayerResource.TryGetResource("yeuco", ref val2);
}
if (!PlayerResource.TryGetResource("Saxonite", ref val3) && (Object)(object)val3 == (Object)null)
{
PlayerResource.TryGetResource("saxonite", ref val3);
}
if ((Object)(object)val != (Object)null)
{
list.Add((LevelUnlock)new LevelUnlock_Resource(3, new ResourceCost(val, 5)));
}
list.Add((LevelUnlock)new LevelUnlock_UpgradeRarity(5, (Rarity)1));
list.Add((LevelUnlock)new LevelUnlock_UpgradeRarity(10, (Rarity)1));
if ((Object)(object)val2 != (Object)null)
{
list.Add((LevelUnlock)new LevelUnlock_Resource(15, new ResourceCost(val2, 5)));
}
list.Add((LevelUnlock)new LevelUnlock_UpgradeRarity(20, (Rarity)2));
list.Add((LevelUnlock)new LevelUnlock_UpgradeRarity(25, (Rarity)3));
if ((Object)(object)val3 != (Object)null)
{
list.Add((LevelUnlock)new LevelUnlock_Resource(30, new ResourceCost(val3, 1)));
}
list.Add((LevelUnlock)new LevelUnlock_UpgradeRarity(31, (Rarity)3));
_globblerLevelUnlockRewards = list.ToArray();
_globblerLevelUnlocks = new LevelUnlockList(_globblerLevelUnlockRewards);
_initialized = true;
}
catch (Exception ex)
{
Logger.LogError((object)("Failed to initialize Globbler level unlocks: " + ex.Message));
}
}
private static void PatchSetup(GearDetailsWindow __instance, IUpgradable upgradable)
{
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
if (!_initialized && (Object)(object)Global.Instance != (Object)null)
{
InitializeGlobblerUnlocks();
}
if (!(upgradable.Info.APIName == "globbler") || !_initialized)
{
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(GearDetailsWindow), "levelUnlockListParent");
FieldInfo fieldInfo2 = AccessTools.Field(typeof(GearDetailsWindow), "levelUnlockButtonPrefab");
FieldInfo fieldInfo3 = AccessTools.Field(typeof(GearDetailsWindow), "levelUnlockButtons");
FieldInfo fieldInfo4 = AccessTools.Field(typeof(GearDetailsWindow), "levelUnlockCount");
try
{
List<LevelUnlockButton> list = (List<LevelUnlockButton>)fieldInfo3.GetValue(__instance);
LevelUnlockButton val = (LevelUnlockButton)fieldInfo2.GetValue(__instance);
RectTransform val2 = (RectTransform)fieldInfo.GetValue(__instance);
_ = (int)fieldInfo4.GetValue(__instance);
RectTransform val3 = (RectTransform)fieldInfo.GetValue(__instance);
for (int i = 0; i < _globblerLevelUnlockRewards.Length; i++)
{
if (i == list.Count)
{
list.Add(Object.Instantiate<LevelUnlockButton>(val, (Transform)(object)val2));
RectTransform rectTransform = list[i].RectTransform;
float num;
if (i != 0)
{
num = list[i - 1].RectTransform.anchoredPosition.x + 150f;
}
else
{
Rect rect = val3.rect;
num = (0f - ((Rect)(ref rect)).width) * 0.5f + 90f;
}
rectTransform.anchoredPosition = new Vector2(num, -15f);
}
}
for (int j = 0; j < _globblerLevelUnlockRewards.Length; j++)
{
bool flag = j < _globblerLevelUnlockRewards.Length - 1;
((Component)list[j]).gameObject.SetActive(true);
list[j].Setup(__instance, upgradable, _globblerLevelUnlockRewards[j], flag, flag ? _globblerLevelUnlockRewards[j + 1].Level : 0);
}
for (int k = _globblerLevelUnlockRewards.Length; k < list.Count; k++)
{
((Component)list[k]).gameObject.SetActive(false);
}
fieldInfo4.SetValue(__instance, _globblerLevelUnlockRewards.Length);
AccessTools.Method(typeof(GearDetailsWindow), "ResetLevelUnlockShimmer", (Type[])null, (Type[])null).Invoke(__instance, null);
}
catch (Exception ex)
{
Logger.LogError((object)("Error in PatchSetup for globbler: " + ex.Message));
}
}
private static void PatchHasUnclaimedLevelUnlocks(GearData __instance, ref bool __result)
{
if (!_initialized && (Object)(object)Global.Instance != (Object)null)
{
InitializeGlobblerUnlocks();
}
if (!_initialized || !(__instance.Gear.Info.APIName == "globbler") || __instance.Level < 5)
{
return;
}
for (int i = 0; i < _globblerLevelUnlockRewards.Length; i++)
{
if (_globblerLevelUnlockRewards[i].Level <= __instance.Level && !__instance.IsLevelUnlockedClaimed(_globblerLevelUnlockRewards[i]))
{
__result = true;
break;
}
}
}
private static void PatchShowLevelUnlocks(GearDetailsWindow __instance)
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
if (!_initialized && (Object)(object)Global.Instance != (Object)null)
{
InitializeGlobblerUnlocks();
}
if (_initialized && __instance.UpgradablePrefab.Info.APIName == "globbler")
{
((Component)(RectTransform)AccessTools.Field(typeof(GearDetailsWindow), "levelUnlocksContainer").GetValue(__instance)).gameObject.SetActive(true);
}
}
}
[CompilerGenerated]
[ExcludeFromCodeCoverage]
internal static class GitVersionInformation
{
public const string AssemblySemFileVer = "0.0.1.0";
public const string AssemblySemVer = "0.0.1.0";
public const string BranchName = "master";
public const string BuildMetaData = "";
public const string CommitDate = "2025-10-17";
public const string CommitsSinceVersionSource = "1";
public const string EscapedBranchName = "master";
public const string FullBuildMetaData = "Branch.master.Sha.6ec15b3ffc98c2932156a234a155078e8cc6d2fc";
public const string FullSemVer = "0.0.1-1";
public const string InformationalVersion = "0.0.1-1+Branch.master.Sha.6ec15b3ffc98c2932156a234a155078e8cc6d2fc";
public const string Major = "0";
public const string MajorMinorPatch = "0.0.1";
public const string Minor = "0";
public const string Patch = "1";
public const string PreReleaseLabel = "";
public const string PreReleaseLabelWithDash = "";
public const string PreReleaseNumber = "1";
public const string PreReleaseTag = "1";
public const string PreReleaseTagWithDash = "-1";
public const string SemVer = "0.0.1-1";
public const string Sha = "6ec15b3ffc98c2932156a234a155078e8cc6d2fc";
public const string ShortSha = "6ec15b3";
public const string UncommittedChanges = "16";
public const string VersionSourceSha = "";
public const string WeightedPreReleaseNumber = "55001";
}
namespace GlobblerLevelUnlocks
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "GlobblerLevelUnlocks";
public const string PLUGIN_NAME = "GlobblerLevelUnlocks";
public const string PLUGIN_VERSION = "0.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}