Decompiled source of MoneyMultiplier v1.0.1

plugins/MoneyMultiplier/MoneyMultiplier.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: OptIn]
[assembly: AssemblyCompany("FriendlyGeekStudios")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c5993a3884db633a967739c5f852fc9d1ccf0e8f")]
[assembly: AssemblyProduct("MoneyMultiplier")]
[assembly: AssemblyTitle("MoneyMultiplier")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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;
		}
	}
}
namespace MoneyMultiplier
{
	[BepInPlugin("Arch1t3ct.MoneyMultiplier", "MoneyMultiplier", "1.0.1")]
	public class MoneyMultiplier : BaseUnityPlugin
	{
		public const string PluginGUID = "Arch1t3ct.MoneyMultiplier";

		public const string PluginAuthor = "Arch1t3ct";

		public const string PluginName = "MoneyMultiplier";

		public const string PluginVersion = "1.0.1";

		private static ConfigEntry<float> MultiplierConfig { get; set; }

		public static float Multiplier
		{
			get
			{
				return MultiplierConfig.Value;
			}
			protected set
			{
				MultiplierConfig.Value = value;
			}
		}

		public void Awake()
		{
			MultiplierConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Game", "MoneyMultiplier", 2f, " Sets the Money Multiplier");
		}

		public void OnEnable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CharacterMaster.GiveMoney += new hook_GiveMoney(CharacterMaster_GiveMoney);
		}

		public void OnDisable()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			CharacterMaster.GiveMoney -= new hook_GiveMoney(CharacterMaster_GiveMoney);
		}

		private void CharacterMaster_GiveMoney(orig_GiveMoney orig, CharacterMaster self, uint amount)
		{
			if (NetworkServer.active)
			{
				amount = (uint)((float)amount * Multiplier);
			}
			orig.Invoke(self, amount);
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void SetMoneyMultiplier(ConCommandArgs args)
		{
			((ConCommandArgs)(ref args)).CheckArgumentCount(1);
			if (float.TryParse(((ConCommandArgs)(ref args))[0], out var result))
			{
				MultiplierConfig.Value = result;
				Debug.Log((object)$"Money Multiplier set to {MultiplierConfig.Value}");
				SendChatMessage();
			}
		}

		private static void SendChatMessage()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			if (NetworkServer.active)
			{
				SimpleChatMessage val = new SimpleChatMessage();
				val.baseToken = "Money Multiplier has been set to {0}";
				val.paramTokens = new string[1] { MultiplierConfig.Value.ToString(CultureInfo.InvariantCulture) };
				Chat.SendBroadcastChat((ChatMessageBase)(object)val);
			}
		}
	}
}