Decompiled source of GoldGunsInDreaming v1.0.0

R2Mod.dll

Decompiled 7 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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 Receiver2;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("R2Mod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("R2Mod")]
[assembly: AssemblyTitle("R2Mod")]
[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 R2Mod
{
	[BepInPlugin("R2Mod", "R2Mod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private static Dictionary<string, string> gunmap = new Dictionary<string, string>
		{
			{ "wolfire.smith_and_wesson_model_10", "wolfire.smith_and_wesson_model_10_gold" },
			{ "wolfire.colt_detective", "wolfire.colt_detective_gold" },
			{ "wolfire.colt_saa", "wolfire.colt_saa_gold" },
			{ "wolfire.hi_point_c9", "wolfire.hi_point_c9_gold" },
			{ "wolfire.glock_17", "wolfire.glock_17_gold" },
			{ "wolfire.beretta_m9", "wolfire.beretta_m9_gold" },
			{ "wolfire.sig226", "wolfire.sig226_gold" },
			{ "wolfire.desert_eagle", "wolfire.desert_eagle_gold" },
			{ "wolfire.colt_m1911", "wolfire.colt_m1911_gold" }
		};

		private static Dictionary<string, string> challengemap = new Dictionary<string, string>
		{
			{ "wolfire.smith_and_wesson_model_10", "wolfire.model_10_base_gold" },
			{ "wolfire.colt_detective", "wolfire.colt_detective_base_gold" },
			{ "wolfire.colt_saa", "wolfire.colt_saa_base_gold" },
			{ "wolfire.hi_point_c9", "wolfire.hi_point_c9_base_gold" },
			{ "wolfire.glock_17", "wolfire.glock17_base_gold" },
			{ "wolfire.beretta_m9", "wolfire.beretta_m9_base_gold" },
			{ "wolfire.sig226", "wolfire.sig226_base_gold" },
			{ "wolfire.desert_eagle", "wolfire.desert_eagle_base_gold" },
			{ "wolfire.colt_m1911", "wolfire.colt_m1911_base_gold" }
		};

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin GoldSpawner is loaded!");
			Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
		}

		[HarmonyPatch(typeof(ReceiverCoreScript), "SpawnPlayer")]
		[HarmonyPrefix]
		public static void OnSpawnPlayer()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Invalid comparison between Unknown and I4
			if ((int)ReceiverCoreScript.Instance().game_mode.GetGameMode() != 2)
			{
				return;
			}
			PlayerLoadout currentLoadout = ReceiverCoreScript.Instance().CurrentLoadout;
			if (gunmap.ContainsKey(currentLoadout.gun_internal_name))
			{
				string text = challengemap[currentLoadout.gun_internal_name];
				if (ReceiverCoreScript.Instance().MallData.IsItemGroupUnlocked(text))
				{
					currentLoadout.gun_internal_name = gunmap[currentLoadout.gun_internal_name];
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "R2Mod";

		public const string PLUGIN_NAME = "R2Mod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}