Decompiled source of ExtendedStoryModeSettings v0.1.1

ExtendedStoryModeSettings.dll

Decompiled 10 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ExtendedStoryModeSettings")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Extended Story Mode Settings")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+28b506a0e02e840dcd820ee06fd5f8849a2d9b48")]
[assembly: AssemblyProduct("ExtendedStoryModeSettings")]
[assembly: AssemblyTitle("ExtendedStoryModeSettings")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 ExtendedStoryModeSettings
{
	[BepInPlugin("ExtendedStoryModeSettings", "ExtendedStoryModeSettings", "1.0.0")]
	public class ExtendedStoryModeSettings : BaseUnityPlugin
	{
		private Harmony harmony;

		private Slider? cachedAttackSlider;

		private Slider? cachedTakenDamageSlider;

		private void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
			harmony = Harmony.CreateAndPatchAll(typeof(ExtendedStoryModeSettings).Assembly, (string)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ExtendedStoryModeSettings is loaded!");
			SceneManager.sceneLoaded += OnSceneChanged;
		}

		private void OnSceneChanged(Scene scene, LoadSceneMode loadSceneMode)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			string text = "Yee Attack Ratio";
			string text2 = "Yee Take Damage";
			if ((Object)(object)cachedAttackSlider != (Object)null && (Object)(object)cachedTakenDamageSlider != (Object)null)
			{
				return;
			}
			Slider[] array = Object.FindObjectsOfType<Slider>(true);
			Slider val = null;
			Slider val2 = null;
			Slider[] array2 = array;
			foreach (Slider val3 in array2)
			{
				Scene scene2 = ((Component)val3).gameObject.scene;
				if (((Scene)(ref scene2)).name != null)
				{
					scene2 = ((Component)val3).gameObject.scene;
					if (!(((Scene)(ref scene2)).name == "DontDestroyOnLoad"))
					{
						continue;
					}
				}
				if (((Object)val3).name == text)
				{
					val = val3;
				}
				if (((Object)val3).name == text2)
				{
					val2 = val3;
				}
			}
			cachedAttackSlider = val;
			cachedTakenDamageSlider = val2;
			if ((Object)(object)val != (Object)null)
			{
				val.minValue = 0f;
				val.OverrideStpSize = 1f;
			}
			if ((Object)(object)val2 != (Object)null)
			{
				val2.maxValue = 1000f;
			}
		}

		private void OnDestroy()
		{
			SceneManager.sceneLoaded -= OnSceneChanged;
			harmony.UnpatchSelf();
		}
	}
	internal static class Log
	{
		private static ManualLogSource? logSource;

		internal static void Init(ManualLogSource logSource)
		{
			Log.logSource = logSource;
		}

		internal static void Debug(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogDebug(data);
			}
		}

		internal static void Error(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogError(data);
			}
		}

		internal static void Fatal(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogFatal(data);
			}
		}

		internal static void Info(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogInfo(data);
			}
		}

		internal static void Message(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogMessage(data);
			}
		}

		internal static void Warning(object data)
		{
			ManualLogSource? obj = logSource;
			if (obj != null)
			{
				obj.LogWarning(data);
			}
		}
	}
	[HarmonyPatch]
	public class Patches
	{
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ExtendedStoryModeSettings";

		public const string PLUGIN_NAME = "ExtendedStoryModeSettings";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}