Decompiled source of UseAllRaces v1.0.0

UseAllRaces.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Eremite;
using Eremite.Controller;
using Eremite.Services;
using Eremite.View.HUD;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("UseAllRaces")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Use all races in every run instead of just 3")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UseAllRaces")]
[assembly: AssemblyTitle("UseAllRaces")]
[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 ATS_UseAllRaces
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "UseAllRaces";

		public const string PLUGIN_NAME = "UseAllRaces";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace JamesGames
{
	[HarmonyPatch]
	[BepInPlugin("ATS_UseAllRaces", "ATS_UseAllRaces", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "ATS_UseAllRaces";

		private const string NAME = "ATS_UseAllRaces";

		private const string VERSION = "1.0.0";

		public static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(typeof(Plugin).Assembly, "ATS_UseAllRaces");
			Log.LogInfo((object)"ATS_UseAllRaces v1.0.0 Plugin loaded");
		}

		[HarmonyPatch(typeof(MainController), "InitReferences")]
		[HarmonyPostfix]
		private static void PostSetupMainController()
		{
			Serviceable.Settings.gameplayRaces = MB.Settings.Races.Length;
		}

		[HarmonyPatch(typeof(RacesHUD), "SetUp")]
		[HarmonyPrefix]
		private static bool RacesHUD_SetUp(RacesHUD __instance)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			while (__instance.slots.Length < GameMB.RacesService.Races.Length)
			{
				int num = __instance.slots.Length - 1;
				RacesHUDSlot val = __instance.slots[num];
				RacesHUDSlot val2 = Object.Instantiate<RacesHUDSlot>(val, ((Component)val).transform.parent);
				Transform transform = ((Component)val2).transform;
				transform.localPosition += ((Component)val).transform.localPosition - ((Component)__instance.slots[num - 1]).transform.localPosition;
				((Object)((Component)val2).gameObject).name = $"RaceHUDSlot ({num + 1})";
				__instance.slots = ArrayExtension.ForceAdd<RacesHUDSlot>(__instance.slots, val2);
			}
			return true;
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}