using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mirror;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 UnlimitedMoneyOnPurchase
{
[BepInPlugin("com.earlj.supermarkettogether.unlimitedmoneyonpurchase", "Unlimited Money On Purchase", "1.0.0")]
public sealed class UnlimitedMoneyOnPurchasePlugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(GameData), "UserCode_CmdAlterFunds__Single")]
private static class AlterFundsPatch
{
private static void Prefix(ref float __0)
{
ReverseDebit(ref __0);
}
}
[HarmonyPatch(typeof(GameData), "UserCode_CmdAlterFundsWithoutExperience__Single")]
private static class AlterFundsWithoutExperiencePatch
{
private static void Prefix(ref float __0)
{
ReverseDebit(ref __0);
}
}
[HarmonyPatch(typeof(GameData), "AlterFundsFromEmployee")]
private static class EmployeeFundsPatch
{
private static void Prefix(ref float __0)
{
ReverseDebit(ref __0);
}
}
private Harmony harmony;
private void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
harmony = new Harmony("com.earlj.supermarkettogether.unlimitedmoneyonpurchase");
harmony.PatchAll(typeof(UnlimitedMoneyOnPurchasePlugin).Assembly);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Negative money transactions now increase the store balance on the host.");
}
private void OnDestroy()
{
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private static void ReverseDebit(ref float amount)
{
if (NetworkServer.active && amount < 0f)
{
amount = 0f - amount;
}
}
}
}