Decompiled source of Choose Your Loadout v1.0.0

ChooseYourLoadout.dll

Decompiled a day ago
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.Logging;
using CG.Game.Scenarios;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ResourceAssets;
using UnityEngine;
using VoidManager;
using VoidManager.MPModChecks;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ChooseYourLoadout")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+4ddcfeedd3e9580a96061b5c60ee15f8fafe0f50")]
[assembly: AssemblyProduct("ChooseYourLoadout")]
[assembly: AssemblyTitle("Host can choose challenge loadouts from the loadout terminal.")]
[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 ChooseYourLoadout
{
	public class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Dragon.ChooseYourLoadout";

		public const string PLUGIN_NAME = "ChooseYourLoadout";

		public const string USERS_PLUGIN_NAME = "Choose Your Loadout";

		public const string PLUGIN_VERSION = "1.0.0";

		public const string PLUGIN_DESCRIPTION = "Host can choose challenge loadouts from the loadout terminal.";

		public const string PLUGIN_ORIGINAL_AUTHOR = "Dragon";

		public const string PLUGIN_AUTHORS = "Dragon";

		public const string PLUGIN_THUNDERSTORE_ID = "NihilityShift/Choose_Your_Loadout";
	}
	[HarmonyPatch(typeof(ShipLoadoutDataContainer), "GetUnlockedShipDefinitionsFromHighestRankPlayer")]
	internal class Patch
	{
		private static void Postfix(ShipLoadoutDataContainer __instance, ref List<ShipLoadoutDataDef> __result)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (!VoidManagerPlugin.HostHasMod)
			{
				return;
			}
			int num = ScenarioCriteriaHelper.FindHighestPlayerRank();
			foreach (UnlockItemDef item in from t in ResourceAssetContainer<UnlockContainer, Object, UnlockItemDef>.Instance.GetUnlocksFromContainer((IResourceAssetContainer)(object)__instance)
				where (int)t.UnlockOptions.UnlockCriteria == 3
				select t)
			{
				ShipLoadoutDataDef assetDefById = ((ResourceAssetContainer<ShipLoadoutDataContainer, ShipLoadoutData, ShipLoadoutDataDef>)(object)__instance).GetAssetDefById(((ResourceAssetDef<Object>)(object)item).AssetGuid, true);
				__result.Add(assetDefById);
			}
		}
	}
	[BepInPlugin("Dragon.ChooseYourLoadout", "Choose Your Loadout", "1.0.0")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BepinPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Dragon.ChooseYourLoadout is loaded!");
		}
	}
	public class VoidManagerPlugin : VoidPlugin
	{
		public static bool HostHasMod;

		public override MultiplayerType MPType => (MultiplayerType)14;

		public override string Author => "Dragon";

		public override string Description => "Host can choose challenge loadouts from the loadout terminal.";

		public override string ThunderstoreID => "NihilityShift/Choose_Your_Loadout";

		public override SessionChangedReturn OnSessionChange(SessionChangedInput input)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			HostHasMod = input.HostHasMod;
			return ((VoidPlugin)this).OnSessionChange(input);
		}
	}
}