using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("DerFabek")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("MoneySpawn")]
[assembly: AssemblyTitle("MoneySpawn")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
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 MoneySpawn
{
internal class ConfigManager
{
public static ConfigEntry<string> SpawnMoneyKey { get; private set; }
public static ConfigEntry<float> HowMuchMoney { get; private set; }
public static void Initialize(ConfigFile configFile)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
HowMuchMoney = configFile.Bind<float>("Values", "HowMuchMoney", 1000f, new ConfigDescription("How much money should spawn?", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000000f), Array.Empty<object>()));
SpawnMoneyKey = configFile.Bind<string>("Controls", "SpawnMoneyKey", "h", "The key used to spawn money.");
}
}
[BepInPlugin("DerFabek.MoneySpawn", "MoneySpawn", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MoneySpawn : BaseUnityPlugin
{
internal static MoneySpawn Instance { get; private set; }
internal static ManualLogSource Logger => Instance._Logger;
private ManualLogSource _Logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
//IL_0030: Expected O, but got Unknown
ConfigManager.Initialize(((BaseUnityPlugin)this).Config);
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
[HarmonyPatch(typeof(ShopManager))]
internal class SpawnManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Awake")]
private static void KeyboardListener(ShopManager __instance)
{
if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject.GetComponent<SpawnMoneyManager>() == (Object)null)
{
((Component)__instance).gameObject.AddComponent<SpawnMoneyManager>();
}
}
}
internal class SpawnMoneyManager : MonoBehaviour
{
private void Update()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
if (!SemiFunc.RunIsLevel())
{
return;
}
InputControl val = ((InputControl)Keyboard.current)[ConfigManager.SpawnMoneyKey.Value];
if (((ButtonControl)val).wasPressedThisFrame)
{
PrefabRef val2 = ((IEnumerable<PrefabRef>)Valuables.AllValuables).FirstOrDefault((Func<PrefabRef, bool>)((PrefabRef x) => ((Object)x.Prefab).name.Contains("money", StringComparison.OrdinalIgnoreCase)));
ValuableObject val3 = ((val2 != null) ? val2.Prefab.GetComponent<ValuableObject>() : null);
if (!((Object)(object)val3 == (Object)null))
{
Vector3 val4 = ((Component)PlayerAvatar.instance).transform.position + new Vector3(0f, 1f, 0f) + ((Component)PlayerAvatar.instance).transform.forward * 1f;
val3.valuePreset.valueMin = ConfigManager.HowMuchMoney.Value;
val3.valuePreset.valueMax = ConfigManager.HowMuchMoney.Value;
Valuables.SpawnValuable(val2, val4, Quaternion.identity);
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "MoneySpawn";
public const string PLUGIN_NAME = "MoneySpawn";
public const string PLUGIN_VERSION = "1.0.3";
}
}