Decompiled source of WitchBindExtended v1.0.0

WitchBindExtended.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using GlobalSettings;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TeamCherry.Localization;
using UnityEngine;
using WitchBindExtended.Settings;

[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("WitchBindExtended")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+be52595ee7347fafc4aacf59cdf92830ec77490f")]
[assembly: AssemblyProduct("WitchBindExtended")]
[assembly: AssemblyTitle("WitchBindExtended")]
[assembly: NeutralResourcesLanguage("EN")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace WitchBindExtended
{
	[BepInPlugin("io.github.danielstegink.witchbindextended", "WitchBindExtended", "1.0.0")]
	public class WitchBindExtended : BaseUnityPlugin
	{
		public const string Id = "io.github.danielstegink.witchbindextended";

		internal static WitchBindExtended Instance { get; private set; }

		public static string Name => "WitchBindExtended";

		public static string Version => "1.0.0";

		private void Awake()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			new Harmony("io.github.danielstegink.witchbindextended").PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)("Plugin " + Name + " (io.github.danielstegink.witchbindextended) has loaded!"));
		}

		private void Start()
		{
			ConfigSettings.Initialize(((BaseUnityPlugin)this).Config);
		}

		internal void Log(string message)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)message);
		}
	}
}
namespace WitchBindExtended.Settings
{
	public static class ConfigSettings
	{
		public static ConfigEntry<float> multiplier;

		public static ConfigEntry<float> longclawMultiplier;

		public static void Initialize(ConfigFile config)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			LocalisedString val = default(LocalisedString);
			((LocalisedString)(ref val))..ctor("Mods.io.github.danielstegink.witchbindextended", "NAME");
			LocalisedString val2 = default(LocalisedString);
			((LocalisedString)(ref val2))..ctor("Mods.io.github.danielstegink.witchbindextended", "DESC");
			float num = 1.2f;
			if (((LocalisedString)(ref val)).Exists && ((LocalisedString)(ref val2)).Exists)
			{
				multiplier = config.Bind<float>("Modifier", LocalisedString.op_Implicit(val), num, LocalisedString.op_Implicit(val2));
			}
			else
			{
				multiplier = config.Bind<float>("Modifier", "Multiplier", num, "How much to enlarge Witch Crest's tentacles");
			}
			((LocalisedString)(ref val))..ctor("Mods.io.github.danielstegink.witchbindextended", "LN_NAME");
			((LocalisedString)(ref val2))..ctor("Mods.io.github.danielstegink.witchbindextended", "LN_DESC");
			num = 1.52f;
			if (((LocalisedString)(ref val)).Exists && ((LocalisedString)(ref val2)).Exists)
			{
				longclawMultiplier = config.Bind<float>("Modifier", LocalisedString.op_Implicit(val), num, LocalisedString.op_Implicit(val2));
			}
			else
			{
				longclawMultiplier = config.Bind<float>("Modifier", "Longclaw Multiplier", num, "How much to enlarge Witch Crest's tentacles with Longclaw equipped");
			}
		}
	}
	public static class SharedData
	{
		public static float modifierApplied = 1f;
	}
}
namespace WitchBindExtended.Helpers
{
	[HarmonyPatch(typeof(HeroController), "Start")]
	public static class HeroController_Start
	{
		[HarmonyPostfix]
		public static void Postfix(HeroController __instance)
		{
			SharedData.modifierApplied = 1f;
		}
	}
	[HarmonyPatch(typeof(HeroController), "Update")]
	public static class HeroController_Update
	{
		[HarmonyPostfix]
		public static void Postfix(HeroController __instance)
		{
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			float value = ConfigSettings.multiplier.Value;
			if (((ToolBase)Gameplay.LongNeedleTool).IsEquipped)
			{
				value = ConfigSettings.longclawMultiplier.Value;
			}
			if (SharedData.modifierApplied == value || (Object)(object)GameObject.Find("Bind Effects") == (Object)null)
			{
				return;
			}
			GameObject val = GameObject.Find("Witch Bind");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Transform[] componentsInChildren = val.GetComponentsInChildren<Transform>();
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				GameObject gameObject = ((Component)componentsInChildren[i]).gameObject;
				if (((Object)gameObject).name.Contains("Damager") || ((Object)gameObject).name.Contains("Tendril"))
				{
					GameObject gameObject2 = ((Component)gameObject.transform.parent).gameObject;
					if ((Object)(object)gameObject2 != (Object)null && ((Object)gameObject2).name.Equals("Witch Bind"))
					{
						_ = gameObject.transform.localScale;
						Transform transform = gameObject.transform;
						transform.localScale /= SharedData.modifierApplied;
						Transform transform2 = gameObject.transform;
						transform2.localScale *= value;
					}
				}
			}
			SharedData.modifierApplied = value;
		}
	}
}