using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BoplFixedMath;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("More_Ability")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("More_Ability")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6cff8b4f-b388-4a45-a438-317c4b678d5c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace More_Ability;
[BepInPlugin("com.000diggity000.More_Ability_Drop", "More Ability Drop", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public static int abilityCount = 0;
internal static ConfigFile config = new ConfigFile(Path.Combine(Paths.ConfigPath, "More_Ability_Drop_Config.cfg"), true);
internal static ConfigEntry<int> AbilityConfig;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
Harmony val = new Harmony("com.000diggity000.More_Ability_Drop");
val.PatchAll(typeof(Patches));
AbilityConfig = config.Bind<int>("More Ability Drop", "Abilities", 3, "Minimum is 1");
if (AbilityConfig.Value <= 1)
{
AbilityConfig.Value = 1;
}
abilityCount = AbilityConfig.Value;
}
}
public class Patches
{
[HarmonyPatch(typeof(SlimeController), "DropAbilities")]
[HarmonyPrefix]
public static void DropAbilities_Patch(SlimeController __instance, ref AbilityReadyIndicator[] ___AbilityReadyIndicators, ref NamedSpriteList ___abilityIconsFull, ref NamedSpriteList ___abilityIconsDemo, ref DynamicAbilityPickup ___abilityPickupPrefab)
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: 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)
if (!GameSession.IsInitialized() || GameSessionHandler.HasGameEnded() || __instance.abilities.Count <= 0)
{
return;
}
int num = Settings.Get().NumberOfAbilities - 1;
while (num >= 0 && (num >= ___AbilityReadyIndicators.Length || (Object)(object)___AbilityReadyIndicators[num] == (Object)null))
{
num--;
}
if (num >= 0)
{
Vec2 val = Vec2.NormalizedSafe(Vec2.up + new Vec2(Updater.RandomFix((Fix)(-0.3f), (Fix)0.3f), (Fix)0L));
Sprite primarySprite = ___AbilityReadyIndicators[num].GetPrimarySprite();
NamedSprite val2 = ___abilityIconsFull.sprites[___abilityIconsFull.IndexOf(primarySprite)];
if ((Object)(object)val2.associatedGameObject == (Object)null)
{
val2 = ___abilityIconsDemo.sprites[___abilityIconsDemo.IndexOf(primarySprite)];
}
for (int i = 2; i <= Plugin.abilityCount; i++)
{
DynamicAbilityPickup val3 = FixTransform.InstantiateFixed<DynamicAbilityPickup>(___abilityPickupPrefab, __instance.body.position);
val3.InitPickup(val2.associatedGameObject, primarySprite, val);
}
}
}
}