using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Numerics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("WhoopsAllJimbos")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.3.0")]
[assembly: AssemblyInformationalVersion("0.1.3")]
[assembly: AssemblyProduct("WhoopsAllJimbos")]
[assembly: AssemblyTitle("WhoopsAllJimbos")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.3.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.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;
}
}
[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 WhoopsAllJimbos
{
[BepInPlugin("com.brian.whoopsalljimbos", "Whoops All Jimbos", "2.0.1")]
public class WhoopsAllJimbosMod : BaseUnityPlugin
{
private void Awake()
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"Whoops All Jimbos 2.0.1 Loaded");
Harmony.CreateAndPatchAll(typeof(JimboPatches), (string)null);
}
}
public static class JimboManager
{
public class JimboState
{
public List<JimboAbility> Abilities = new List<JimboAbility>();
public int RoundsLeft = -1;
public Event LuckDelegate;
}
private static Dictionary<PowerupScript, JimboState> _activeJimbos = new Dictionary<PowerupScript, JimboState>();
private static List<PowerupScript> _storeTrash = new List<PowerupScript>();
public static void Register(PowerupScript script, JimboState state)
{
if (!((Object)(object)script == (Object)null))
{
if (_activeJimbos.ContainsKey(script))
{
_activeJimbos[script] = state;
}
else
{
_activeJimbos.Add(script, state);
}
}
}
public static JimboState GetState(PowerupScript script)
{
if (!((Object)(object)script != (Object)null) || !_activeJimbos.TryGetValue(script, out JimboState value))
{
return null;
}
return value;
}
public static void MarkStoreItem(PowerupScript script)
{
_storeTrash.Add(script);
}
public static void CleanupStore()
{
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
List<PowerupScript> value = Traverse.Create(typeof(PowerupScript)).Field("_initializationTempList").GetValue<List<PowerupScript>>();
foreach (PowerupScript item in _storeTrash)
{
if ((Object)(object)item != (Object)null && PowerupScript.IsNotBought(item.identifier))
{
PowerupScript.list_NotBought.Remove(item);
PowerupScript.all.Remove(item);
value?.Remove(item);
_activeJimbos.Remove(item);
Object.Destroy((Object)(object)((Component)item).gameObject);
}
}
_storeTrash.Clear();
}
public static bool AnyEquippedHasAbility(JimboAbility ability)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
if (!CheckList(PowerupScript.list_EquippedNormal))
{
return CheckList(PowerupScript.list_EquippedSkeleton);
}
return true;
bool CheckList(List<PowerupScript> list)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
foreach (PowerupScript item in list)
{
if ((Object)(object)item != (Object)null && (int)item.identifier == 150 && _activeJimbos.TryGetValue(item, out JimboState value) && value.Abilities.Contains(ability))
{
return true;
}
}
return false;
}
}
public static void ProcessRoundEnd()
{
//IL_0030: 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_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Expected O, but got Unknown
List<PowerupScript> list = new List<PowerupScript>();
foreach (KeyValuePair<PowerupScript, JimboState> activeJimbo in _activeJimbos)
{
PowerupScript key = activeJimbo.Key;
JimboState value = activeJimbo.Value;
if (PowerupScript.IsEquipped_Quick(key.identifier) && PowerupScript.IsEquipped(key.identifier) && (value.Abilities.Contains((JimboAbility)5) || value.Abilities.Contains((JimboAbility)4)))
{
value.RoundsLeft--;
if (value.RoundsLeft <= 0)
{
list.Add(key);
}
else
{
PowerupScript.PlayPowerDownAnimation((Identifier)150);
}
}
}
foreach (PowerupScript item in list)
{
JimboState jimboState = _activeJimbos[item];
if (jimboState.LuckDelegate != null)
{
SlotMachineScript instance = SlotMachineScript.instance;
instance.OnSpinPreLuckApplication = (Event)Delegate.Remove((Delegate?)(object)instance.OnSpinPreLuckApplication, (Delegate?)(object)jimboState.LuckDelegate);
}
PowerupScript.ThrowAway(item.identifier, false);
_activeJimbos.Remove(item);
}
}
}
public static class JimboPatches
{
[CompilerGenerated]
private static class <>O
{
public static PowerupEvent <0>__CustomOnEquip;
public static PowerupEvent <1>__CustomOnUnequip;
public static PowerupEvent <2>__CustomOnThrowAway;
}
private static List<JimboAbility> _backupAbilities;
private static int _backupRounds;
[HarmonyPatch(typeof(StoreCapsuleScript), "Restock")]
[HarmonyPrefix]
public static void Restock_Prefix(ref PowerupScript[] predeterminedPowerups)
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Expected O, but got Unknown
JimboManager.CleanupStore();
GameplayData instance = GameplayData.Instance;
if (instance == null)
{
return;
}
Traverse val = Traverse.Create((object)instance);
List<JimboAbility> value = val.Field("jimboAbilities_BadPool").GetValue<List<JimboAbility>>();
List<JimboAbility> value2 = val.Field("jimboAbilities_GoodPool").GetValue<List<JimboAbility>>();
PowerupScript[] array = (PowerupScript[])(object)new PowerupScript[4];
for (int i = 0; i < 4; i++)
{
PowerupScript val2 = PowerupScript.Spawn((Identifier)150);
BigInteger bigInteger = -1;
object obj = <>O.<0>__CustomOnEquip;
if (obj == null)
{
PowerupEvent val3 = CustomOnEquip;
<>O.<0>__CustomOnEquip = val3;
obj = (object)val3;
}
object obj2 = <>O.<1>__CustomOnUnequip;
if (obj2 == null)
{
PowerupEvent val4 = CustomOnUnequip;
<>O.<1>__CustomOnUnequip = val4;
obj2 = (object)val4;
}
object obj3 = <>O.<2>__CustomOnThrowAway;
if (obj3 == null)
{
PowerupEvent val5 = CustomOnThrowAway;
<>O.<2>__CustomOnThrowAway = val5;
obj3 = (object)val5;
}
val2.Initialize(false, (Category)1, (Identifier)150, (Archetype)0, false, -1, 0.35f, 5, bigInteger, "POWERUP_NAME_JIMBO", "POWERUP_DESCR_JIMBO", "POWERUP_UNLOCK_CONDITION_JIMBO", (PowerupEvent)obj, (PowerupEvent)obj2, (PowerupEvent)null, (PowerupEvent)obj3);
JimboManager.JimboState state = GenerateStats(value, value2);
JimboManager.Register(val2, state);
JimboManager.MarkStoreItem(val2);
array[i] = val2;
}
predeterminedPowerups = array;
}
private static void CustomOnEquip(PowerupScript p)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
PowerupScript p2 = p;
PowerupScript.PlayTriggeredAnimation((Identifier)150);
JimboManager.JimboState state = JimboManager.GetState(p2);
if (state == null || !state.Abilities.Contains((JimboAbility)11))
{
return;
}
state.LuckDelegate = (Event)delegate
{
if (SlotMachineScript.IsFirstSpinOfRound())
{
GameplayData.ExtraLuck_SetEntry("tl_jmb", 5f, 1, true);
PowerupTriggerAnimController.AddAnimation(p2, (Identifier)21, (AnimationKind)0);
}
};
SlotMachineScript instance = SlotMachineScript.instance;
instance.OnSpinPreLuckApplication = (Event)Delegate.Combine((Delegate?)(object)instance.OnSpinPreLuckApplication, (Delegate?)(object)state.LuckDelegate);
}
private static void CustomOnUnequip(PowerupScript p)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
JimboManager.JimboState state = JimboManager.GetState(p);
if (state != null && state.LuckDelegate != null)
{
SlotMachineScript instance = SlotMachineScript.instance;
instance.OnSpinPreLuckApplication = (Event)Delegate.Remove((Delegate?)(object)instance.OnSpinPreLuckApplication, (Delegate?)(object)state.LuckDelegate);
}
}
private static void CustomOnThrowAway(PowerupScript p)
{
CustomOnUnequip(p);
}
private static JimboManager.JimboState GenerateStats(List<JimboAbility> badPool, List<JimboAbility> goodPool)
{
//IL_0015: 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_0021: 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_0030: Invalid comparison between Unknown and I4
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Invalid comparison between Unknown and I4
//IL_0064: 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)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
JimboManager.JimboState jimboState = new JimboManager.JimboState();
int index = Random.Range(0, badPool.Count);
JimboAbility val = badPool[index];
jimboState.Abilities.Add(val);
jimboState.RoundsLeft = -1;
if ((int)val == 4)
{
jimboState.RoundsLeft = 5;
}
else if ((int)val == 5)
{
jimboState.RoundsLeft = 3;
}
for (int i = 0; i < 2; i++)
{
int count = goodPool.Count;
int num = Random.Range(0, count);
for (int j = 0; j < count; j++)
{
if (jimboState.Abilities.Count >= 3)
{
break;
}
JimboAbility item = goodPool[num];
if (!jimboState.Abilities.Contains(item))
{
jimboState.Abilities.Add(item);
break;
}
num++;
if (num >= count)
{
num = 0;
}
}
}
return jimboState;
}
[HarmonyPatch(typeof(GameplayData), "Powerup_Jimbo_IsAbilityAvailable")]
[HarmonyPrefix]
public static bool IsAbilityAvailable_Prefix(JimboAbility ability, bool considerEquippedState, ref bool __result)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
if (considerEquippedState)
{
__result = JimboManager.AnyEquippedHasAbility(ability);
}
else
{
__result = false;
}
return false;
}
[HarmonyPatch(typeof(SlotMachineScript), "Set_NoMoreSpins")]
[HarmonyPostfix]
public static void Set_NoMoreSpins_Postfix()
{
JimboManager.ProcessRoundEnd();
}
[HarmonyPatch(typeof(PowerupScript), "DescriptionGet")]
[HarmonyPrefix]
public static void DescriptionGet_Prefix(PowerupScript __instance)
{
JimboManager.JimboState state = JimboManager.GetState(__instance);
if (state != null)
{
GameplayData instance = GameplayData.Instance;
if (instance != null)
{
Traverse val = Traverse.Create((object)instance).Field("jimboAbilities_Selected");
_backupAbilities = new List<JimboAbility>(val.GetValue<List<JimboAbility>>());
_backupRounds = GameplayData.Powerup_Jimbo_RoundsLeft;
List<JimboAbility> value = val.GetValue<List<JimboAbility>>();
value.Clear();
value.AddRange(state.Abilities);
GameplayData.Powerup_Jimbo_RoundsLeft = state.RoundsLeft;
}
}
}
[HarmonyPatch(typeof(PowerupScript), "DescriptionGet")]
[HarmonyPostfix]
public static void DescriptionGet_Postfix(PowerupScript __instance)
{
if (_backupAbilities != null)
{
GameplayData instance = GameplayData.Instance;
if (instance != null)
{
Traverse val = Traverse.Create((object)instance).Field("jimboAbilities_Selected");
List<JimboAbility> value = val.GetValue<List<JimboAbility>>();
value.Clear();
value.AddRange(_backupAbilities);
GameplayData.Powerup_Jimbo_RoundsLeft = _backupRounds;
}
_backupAbilities = null;
}
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ConstantExpectedAttribute : Attribute
{
public object? Min { get; set; }
public object? Max { get; set; }
}
[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)]
[ExcludeFromCodeCoverage]
internal sealed class ExperimentalAttribute : Attribute
{
public string DiagnosticId { get; }
public string? UrlFormat { get; set; }
public ExperimentalAttribute(string diagnosticId)
{
DiagnosticId = diagnosticId;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
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)]
[ExcludeFromCodeCoverage]
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)]
[ExcludeFromCodeCoverage]
internal sealed class SetsRequiredMembersAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
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)]
[ExcludeFromCodeCoverage]
internal sealed class UnscopedRefAttribute : Attribute
{
}
}
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)]
[ExcludeFromCodeCoverage]
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.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CallerArgumentExpressionAttribute : Attribute
{
public string ParameterName { get; }
public CallerArgumentExpressionAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class CollectionBuilderAttribute : Attribute
{
public Type BuilderType { get; }
public string MethodName { get; }
public CollectionBuilderAttribute(Type builderType, string methodName)
{
BuilderType = builderType;
MethodName = methodName;
}
}
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
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)]
[ExcludeFromCodeCoverage]
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)]
[ExcludeFromCodeCoverage]
internal sealed class InterpolatedStringHandlerAttribute : Attribute
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal static class IsExternalInit
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class ModuleInitializerAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class OverloadResolutionPriorityAttribute : Attribute
{
public int Priority { get; }
public OverloadResolutionPriorityAttribute(int priority)
{
Priority = priority;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)]
[ExcludeFromCodeCoverage]
internal sealed class ParamCollectionAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class RequiredMemberAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[EditorBrowsable(EditorBrowsableState.Never)]
[ExcludeFromCodeCoverage]
internal sealed class RequiresLocationAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)]
[ExcludeFromCodeCoverage]
internal sealed class SkipLocalsInitAttribute : Attribute
{
}
}