Decompiled source of LethalCardCollector Comedic v1.0.0

plugins/LethalCardCollector_Comedic/myCardsMod.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("myCardsMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My Cards Mod")]
[assembly: AssemblyTitle("myCardsMod")]
[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 MyCardsMod
{
	[BepInPlugin("com.aleks.mojekarty", "Mod Na Karty", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "com.aleks.mojekarty";

		private const string NAME = "Mod Na Karty";

		private const string VERSION = "1.0.0";

		internal static ManualLogSource Log;

		internal static List<Item> LoadedCards = new List<Item>();

		private readonly Harmony harmony = new Harmony("com.aleks.mojekarty");

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			LoadCardsFromBundle();
			harmony.PatchAll();
			Log.LogInfo((object)"Card Mod loaded successfully!");
		}

		private void LoadCardsFromBundle()
		{
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "kartybundle");
			if (!File.Exists(text))
			{
				Log.LogError((object)("[CRITICAL ERROR] Bundle not found: " + text));
				return;
			}
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val == (Object)null)
			{
				Log.LogError((object)"[CRITICAL ERROR] Failed to load AssetBundle!");
				return;
			}
			Dictionary<string, int> dictionary = new Dictionary<string, int>
			{
				{ "Common1", 60 },
				{ "Common2", 60 },
				{ "Common3", 60 },
				{ "Uncommon1", 35 },
				{ "Uncommon2", 35 },
				{ "Uncommon3", 35 },
				{ "Rare1", 15 },
				{ "Rare2", 15 },
				{ "Rare3", 15 },
				{ "Legendary1", 7 },
				{ "Legendary2", 7 },
				{ "Mythic1", 3 },
				{ "Unknown1", 1 }
			};
			int num = 0;
			foreach (KeyValuePair<string, int> item in dictionary)
			{
				string key = item.Key;
				int value = item.Value;
				Item val2 = val.LoadAsset<Item>(key);
				if ((Object)(object)val2 != (Object)null && (Object)(object)val2.spawnPrefab != (Object)null)
				{
					ScanNodeProperties componentInChildren = val2.spawnPrefab.GetComponentInChildren<ScanNodeProperties>();
					if ((Object)(object)componentInChildren != (Object)null)
					{
						componentInChildren.nodeType = 1;
						componentInChildren.creatureScanID = -1;
					}
					NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
					Items.RegisterScrap(val2, value, (LevelTypes)(-1));
					LoadedCards.Add(val2);
					num++;
				}
			}
			Log.LogInfo((object)$"Successfully registered {num} cards to the scrap pool.");
		}
	}
}