Decompiled source of PeltsOnly v1.0.0

PeltOnlyChallenge.dll

Decompiled 2 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 BepInEx.Logging;
using DiskCardGame;
using HarmonyLib;
using InscryptionAPI.Ascension;
using InscryptionAPI.Helpers;
using Microsoft.CodeAnalysis;
using OnlyPeltChallenge.Scripts;
using PeltOnlyChallenge;
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: AssemblyCompany("PeltOnlyChallenge")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PeltOnlyChallenge")]
[assembly: AssemblyTitle("PeltOnlyChallenge")]
[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 MorePeltsMod.Scripts.PeltsOnlyPatches
{
	internal class Patches
	{
		[HarmonyPatch(typeof(MapGenerator), "CreateNode", new Type[]
		{
			typeof(int),
			typeof(int),
			typeof(List<NodeData>),
			typeof(List<NodeData>),
			typeof(int)
		})]
		private static class MapGenerator_CreateNode
		{
			public static void Postfix(ref NodeData __result)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_008a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0091: Expected O, but got Unknown
				if (AscensionSaveData.Data.ChallengeIsActive(Plugin.PeltsOnlyChallengeID.Challenge.challengeType))
				{
					Type type = ((object)__result).GetType();
					if (type == typeof(CardChoicesNodeData) || type == typeof(BoulderChoiceNodeData) || type == typeof(DeckTrialNodeData))
					{
						NodeData val = (NodeData)((SeededRandom.Range(0, 100, RunState.RandomSeed + ((MapElementData)__result).id) > 50) ? new TradePeltsNodeData() : new BuyPeltsNodeData());
						((MapElementData)val).id = ((MapElementData)__result).id;
						val.gridX = __result.gridX;
						val.gridY = __result.gridY;
						__result = val;
					}
				}
			}
		}
	}
}
namespace OnlyPeltChallenge.Scripts
{
	[BepInPlugin("keks307.inscryption.PeltOnlyChallenge", "Pelt Only Challenge", "0.1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "keks307.inscryption.PeltOnlyChallenge";

		public const string PluginName = "Pelt Only Challenge";

		public const string PluginVersion = "0.1.0.0";

		public static string PluginDirectory;

		public static ManualLogSource Log;

		public static FullChallenge PeltsOnlyChallengeID;

		private void Awake()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Log.LogInfo((object)"Loading Pelt Only Challenge...");
			PluginDirectory = ((BaseUnityPlugin)this).Info.Location.Replace("PeltOnlyChallenge.dll", "");
			new Harmony("keks307.inscryption.PeltOnlyChallenge").PatchAll();
			PeltsOnlyChallenge();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Pelt Only Challenge!");
		}

		private void PeltsOnlyChallenge()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected I4, but got Unknown
			AscensionChallengeInfo val = ScriptableObject.CreateInstance<AscensionChallengeInfo>();
			val.title = "Pelts Only";
			val.description = "All Card Choices are replaced with either Trapper or Trader.";
			val.pointValue = 20;
			val.iconSprite = Assets.LoadSprite("ChallengePeltonly");
			val.activatedSprite = Assets.LoadSprite("ChallengePeltonly_Glow");
			PeltsOnlyChallengeID = ChallengeManager.Add("keks307.inscryption.PeltOnlyChallenge", val, 0, false);
			Log.LogInfo((object)("PeltsOnlyChallengeID " + (int)PeltsOnlyChallengeID.Challenge.challengeType));
		}
	}
}
namespace PeltOnlyChallenge
{
	internal class Assets
	{
		private static Assembly _assembly;

		public static Assembly CurrentAssembly => _assembly ?? (_assembly = Assembly.GetExecutingAssembly());

		public static Texture2D LoadTexture(string name)
		{
			return TextureHelper.GetImageAsTexture((name + (name.EndsWith(".png") ? "" : ".png")).ToLowerInvariant(), CurrentAssembly, (FilterMode)0);
		}

		public static Sprite LoadSprite(string name)
		{
			return TextureHelper.ConvertTexture(TextureHelper.GetImageAsTexture((name + (name.EndsWith(".png") ? "" : ".png")).ToLowerInvariant(), CurrentAssembly, (FilterMode)0), (Vector2?)null);
		}
	}
}