Decompiled source of Transcendence v0.1.0

plugins/shroudednight-Transcendence/Transcendence.dll

Decompiled 5 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 BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Transcendence")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Go Beyond")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2b50d48b986c7584b67c19e82f9916244f48fee8")]
[assembly: AssemblyProduct("Transcendence")]
[assembly: AssemblyTitle("Transcendence")]
[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 com.shroudednight.transcendence
{
	public static class Extensions
	{
		public static void INFO(this ManualLogSource logSource, string data)
		{
			logSource.LogInfo((object)data);
		}

		public static void WARN(this ManualLogSource logSource, string data)
		{
			logSource.LogWarning((object)data);
		}

		public static void ERROR(this ManualLogSource logSource, string data)
		{
			logSource.LogError((object)data);
		}

		public static void FATAL(this ManualLogSource logSource, string data)
		{
			logSource.LogFatal((object)data);
		}
	}
	[BepInPlugin("Transcendence", "Transcendence", "1.0.0")]
	public class Plugin : BasePlugin
	{
		[HarmonyPatch(typeof(Player), "Start")]
		public class Player_PatchStart
		{
			public static void Prefix(Player __instance)
			{
				Runtime.BeforePlayerStart(__instance);
			}

			public static void Postfix(Player __instance)
			{
				Runtime.AfterPlayerStart(__instance);
			}
		}

		[HarmonyPatch(typeof(Player), "FixedUpdate")]
		public class Player_PatchFixedUpdate
		{
			public static void Prefix(Player __instance)
			{
				Runtime.BeforePlayerFixedUpdate(__instance);
			}

			public static void Postfix(Player __instance)
			{
				Runtime.AfterPlayerFixedUpdate(__instance);
			}
		}

		[HarmonyPatch(typeof(UpgradeEffectController), "GetUpgradeEffect", new Type[] { typeof(Effect) })]
		public class UpgradeEffectController_GetUpgradeEffect
		{
			public static bool Prefix(UpgradeEffectController __instance, ref Effect effect)
			{
				return true;
			}

			public static void Postfix(UpgradeEffectController __instance, ref Effect effect, ref float __result)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Expected I4, but got Unknown
				Effect val = effect;
				__result = (val - 6) switch
				{
					0 => 1f, 
					3 => 1f, 
					7 => 1f, 
					8 => 1f, 
					9 => 1f, 
					13 => 3f, 
					17 => 10f, 
					21 => 0f, 
					25 => 1f, 
					26 => 1f, 
					27 => 1f, 
					28 => 1f, 
					30 => 1f, 
					29 => 1f, 
					33 => 1f, 
					34 => 1f, 
					35 => 1f, 
					36 => 3f, 
					37 => 3f, 
					38 => 3f, 
					_ => __result, 
				};
			}
		}

		[HarmonyPatch(typeof(FurnishingsController), "UpdateListDisplay")]
		public class FurnishingsController_UpdateListDisplay
		{
			public static bool prefix(FurnishingsController __instance)
			{
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				__instance.displayClasses.Clear();
				DecorClass[] array = (DecorClass[])Enum.GetValues(typeof(DecorClass));
				foreach (DecorClass val in array)
				{
					__instance.displayClasses.Add(val);
				}
				Enumerator<FurniturePreset> enumerator = Toolbox.Instance.allFurniture.GetEnumerator();
				while (enumerator.MoveNext())
				{
					enumerator.Current.purchasable = true;
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(ApartmentItemsController), "UpdateListDisplay")]
		public class ApartmentItemsController_UpdateListDisplay
		{
			public static bool prefix(ApartmentItemsController __instance)
			{
				Enumerator<string, InteractablePreset> enumerator = Toolbox.Instance.objectPresetDictionary.GetEnumerator();
				while (enumerator.MoveNext())
				{
					KeyValuePair<string, InteractablePreset> current = enumerator.Current;
					current.Value.spawnable = true;
					current.Value.allowInApartmentShop = true;
				}
				return true;
			}
		}

		private static PluginRuntime Runtime { get; set; }

		public override void Load()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Runtime = new PluginRuntime(((BasePlugin)this).Log);
				new Harmony("Transcendence").PatchAll();
			}
			catch (Exception value)
			{
				((BasePlugin)this).Log.FATAL($"Unable to load ${"Transcendence"}: {value}");
				throw;
			}
			((BasePlugin)this).Log.INFO("Plugin Transcendence is loaded!");
		}
	}
	internal class PluginRuntime
	{
		private const float ATTRIBUTE_MAXIMUM = 1E+14f;

		private readonly ManualLogSource Logger;

		private long _updateCount;

		internal PluginRuntime(ManualLogSource log)
		{
			Logger = log;
		}

		public void BeforePlayerStart(Player player)
		{
			_updateCount = 0L;
		}

		public void AfterPlayerStart(Player player)
		{
			player.desiredWalkSpeed = 8f;
			player.desiredRunSpeed = 16f;
			GameplayControls instance = GameplayControls.Instance;
			instance.fallDamageMultiplier = 0f;
			instance.jumpHeight = 16f;
			instance.defaultInventorySlots = 12;
		}

		public void BeforePlayerFixedUpdate(Player player)
		{
			_updateCount++;
			GameplayController instance = GameplayController.Instance;
			((Actor)player).SetMaxHealth(1E+14f, true);
			((Actor)player).SetMaxNerve(1E+14f, true);
			((Actor)player).SetCombatHeft(1f);
			instance.currentLockpickStrength = 1f;
			((Human)player).hygiene = ((Human)player).hygiene + (1f - ((Human)player).hygiene) / 2f;
			((Human)player).breath = ((Human)player).breath + (1f - ((Human)player).breath) / 2f;
			((Human)player).brokenLeg = ((Human)player).brokenLeg / 2f;
			((Human)player).bruised = ((Human)player).bruised / 2f;
			((Human)player).bleeding = ((Human)player).bleeding / 2f;
			((Human)player).blackEye = ((Human)player).blackEye / 2f;
			((Human)player).wet = ((Human)player).wet / 2f;
			float num8 = (((Human)player).chores = (((Human)player).heat = (((Human)player).excitement = (((Human)player).energy = (((Human)player).alertness = (((Human)player).nourishment = (((Human)player).hydration = Mathf.Sqrt(((Human)player).hydration))))))));
			((Human)player).drunk = 1f - num8;
			((Human)player).headache = 1f - num8;
			((Human)player).starchAddiction = 1f - num8;
		}

		public void AfterPlayerFixedUpdate(Player player)
		{
		}

		public void Log(LogLevel level, string str)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Logger.Log(level, (object)str);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Transcendence";

		public const string PLUGIN_NAME = "Transcendence";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}