Decompiled source of Classfixes Part 3 v2.1.2

StormCancerClassFixes3.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using SideLoader_ExtendedEffects;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OutwardModTemplate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardModTemplate")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace StormCancerClassFixes;

[BepInPlugin("stormcancer.classfixes.part3", "stormcancer classfixes part 3", "1.0.0")]
public class StormCancerClassFixes1 : BaseUnityPlugin
{
	public const string GUID = "stormcancer.classfixes.part3";

	public const string NAME = "stormcancer classfixes part 3";

	public const string VERSION = "1.0.0";

	internal static ManualLogSource Log;

	internal void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		ExtendedEffects.AddSkillTreeOverride("awsiJhIN-UmoO6JxQuzjIA", "customhexskilltree-stormcancer");
	}
}

ClassfixesPart3.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("OutwardModTemplate")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OutwardModTemplate")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c5450fe0-edcf-483f-b9ea-4b1ef9d36da7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ClassfixesPart3;

[BepInPlugin("com.StormCancer.ClassfixesPart3", "ClassfixesPart3", "1.0.0")]
public class HMBMRework : BaseUnityPlugin
{
	[HarmonyPatch(typeof(AffectMana), "ActivateLocally")]
	public class LeylinePassiveSoulAbsorb
	{
		private static bool Prefix(AffectMana __instance, Character _affectedCharacter, object[] _infos)
		{
			Transform transform = ((Component)__instance).transform;
			if ((Object)(object)transform != (Object)null && (Object)(object)transform.parent != (Object)null && ((Object)transform.parent).name == "ConsumeSoul")
			{
				if ((Object)(object)_affectedCharacter != (Object)null && ((CharacterKnowledge)_affectedCharacter.Inventory.SkillKnowledge).IsItemLearned(-28008))
				{
					float num = __instance.Value * (__instance.IsModifier ? (0.01f * _affectedCharacter.Stats.MaxHealth) : 1f) / 2f;
					float num2 = __instance.Value * (__instance.IsModifier ? (0.01f * _affectedCharacter.Stats.MaxMana) : 1f) / 2f;
					_affectedCharacter.Stats.AffectHealth(num);
					_affectedCharacter.Stats.RestaureMana((Tag[])null, num2);
					return false;
				}
				if ((Object)(object)_affectedCharacter != (Object)null && ((CharacterKnowledge)_affectedCharacter.Inventory.SkillKnowledge).IsItemLearned(-28007))
				{
					float num3 = __instance.Value * (__instance.IsModifier ? (0.01f * _affectedCharacter.Stats.MaxHealth) : 1f);
					_affectedCharacter.Stats.AffectHealth(num3);
					return false;
				}
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(CharacterKnowledge), "AddItem")]
	public class LeylinePassivesLearnedPatch
	{
		private static bool Prefix(CharacterKnowledge __instance, Item _item)
		{
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			if ((Object)(object)_item != (Object)null && _item.ItemID == -28007)
			{
				if (__instance.m_character.Stats.m_manaPoint > 0)
				{
					__instance.m_character.Stats.m_manaPoint = 0;
				}
				foreach (StatStack item in __instance.m_character.Stats.m_maxManaStat.RawStack)
				{
					if (!item.SourceID.Contains("ManaAugmentation"))
					{
						StatStack val = new StatStack(item.SourceID, item.RawValue * 0.25f, (Tag[])null);
						__instance.m_character.Stats.m_maxHealthStat.AddRawStack(val);
						__instance.m_character.Stats.m_maxStamina.AddRawStack(val);
					}
				}
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(CharacterStats), "GiveManaPoint")]
	public class LeylineAbandonmentGiveManaPointPatch
	{
		private static void Postfix(CharacterStats __instance)
		{
			if (((CharacterKnowledge)__instance.m_character.Inventory.SkillKnowledge).IsItemLearned(-28007))
			{
				__instance.m_manaPoint = 0;
			}
		}
	}

	[HarmonyPatch(typeof(CharacterStats), "AddStatStack")]
	public class LeylineAbandonmentAddStackPatch
	{
		private static bool Prefix(CharacterStats __instance, Tag _stat, StatStack _stack, bool _multiplier)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Expected O, but got Unknown
			if (_stat.TagName == "MaxMana" && ((CharacterKnowledge)__instance.m_character.Inventory.SkillKnowledge).IsItemLearned(-28007))
			{
				float num = _stack.RawValue * 0.25f;
				StatStack val = new StatStack(_stack.SourceID, num, (Tag[])null);
				__instance.m_character.Stats.m_maxHealthStat.AddRawStack(val);
				__instance.m_character.Stats.m_maxStamina.AddRawStack(val);
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(Skill), "HasEnoughHealth")]
	public class LeylinePassivesHealthOverride
	{
		private static bool Prefix(Skill __instance, bool _tryingToActivate, ref bool __result)
		{
			if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28008))
			{
				float num = __instance.ManaCost / 2f;
				__result = ((Item)__instance).m_ownerCharacter.Health > num;
				if (!__result && Object.op_Implicit((Object)(object)((Item)__instance).m_ownerCharacter.CharacterUI) && _tryingToActivate)
				{
					((Item)__instance).m_ownerCharacter.CharacterUI.ShowInfoNotificationLoc("Notification_Skill_NotEnoughHealth");
				}
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(Skill), "ConsumeResources")]
	public class ConsumeResourcesPatch
	{
		private static bool Prefix(Skill __instance)
		{
			if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-23296))
			{
				if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28007))
				{
					if (__instance.ManaCost != 0f)
					{
						float num = __instance.ManaCost / 2f;
						((Item)__instance).m_ownerCharacter.PlayerStats.AffectCorruptionLevel(0f - num * 10f, false);
						((Item)__instance).m_ownerCharacter.Stats.SetHealth(((Item)__instance).m_ownerCharacter.Health - num);
					}
					if (__instance.HealthCost != 0f)
					{
						((Item)__instance).m_ownerCharacter.Stats.SetHealth(((Item)__instance).m_ownerCharacter.Health - __instance.HealthCost);
					}
					if (__instance.StaminaCost != 0f)
					{
						((Item)__instance).m_ownerCharacter.Stats.UseStamina(__instance.StaminaCost, 1f);
					}
					return false;
				}
				if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28008))
				{
					if (__instance.ManaCost != 0f)
					{
						float num2 = __instance.ManaCost / 2f;
						float num3 = num2 / 2f;
						((Item)__instance).m_ownerCharacter.PlayerStats.AffectCorruptionLevel(0f - num2 * 10f, false);
						((Item)__instance).m_ownerCharacter.Stats.SetHealth(((Item)__instance).m_ownerCharacter.Health - num3);
						((Item)__instance).m_ownerCharacter.Stats.UseMana((Tag[])null, num3);
					}
					if (__instance.HealthCost != 0f)
					{
						((Item)__instance).m_ownerCharacter.Stats.SetHealth(((Item)__instance).m_ownerCharacter.Health - __instance.HealthCost);
					}
					if (__instance.StaminaCost != 0f)
					{
						((Item)__instance).m_ownerCharacter.Stats.UseStamina(__instance.StaminaCost, 1f);
					}
					return false;
				}
				if (__instance.ManaCost != 0f)
				{
					float num4 = __instance.ManaCost / 2f;
					((Item)__instance).m_ownerCharacter.PlayerStats.AffectCorruptionLevel(0f - num4 * 10f, false);
					((Item)__instance).m_ownerCharacter.Stats.UseMana((Tag[])null, num4);
				}
				if (__instance.HealthCost != 0f)
				{
					((Item)__instance).m_ownerCharacter.Stats.ReceiveDamage(__instance.HealthCost);
				}
				if (__instance.StaminaCost != 0f)
				{
					((Item)__instance).m_ownerCharacter.Stats.UseStamina(__instance.StaminaCost, 1f);
				}
				return false;
			}
			if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28007))
			{
				if (__instance.ManaCost != 0f)
				{
					((Item)__instance).m_ownerCharacter.Stats.SetHealth(((Item)__instance).m_ownerCharacter.Health - __instance.ManaCost);
				}
				if (__instance.HealthCost != 0f)
				{
					((Item)__instance).m_ownerCharacter.Stats.SetHealth(((Item)__instance).m_ownerCharacter.Health - __instance.HealthCost);
				}
				if (__instance.StaminaCost != 0f)
				{
					((Item)__instance).m_ownerCharacter.Stats.UseStamina(__instance.StaminaCost, 1f);
				}
				return false;
			}
			if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28008))
			{
				if (__instance.ManaCost != 0f)
				{
					float num5 = __instance.ManaCost / 2f;
					((Item)__instance).m_ownerCharacter.Stats.SetHealth(((Item)__instance).m_ownerCharacter.Health - num5);
					((Item)__instance).m_ownerCharacter.Stats.UseMana((Tag[])null, num5);
				}
				if (__instance.HealthCost != 0f)
				{
					float num6 = __instance.HealthCost / 2f;
					((Item)__instance).m_ownerCharacter.Stats.SetHealth(((Item)__instance).m_ownerCharacter.Health - num6);
					((Item)__instance).m_ownerCharacter.Stats.UseMana((Tag[])null, num6);
				}
				if (__instance.StaminaCost != 0f)
				{
					((Item)__instance).m_ownerCharacter.Stats.UseStamina(__instance.StaminaCost, 1f);
				}
				return false;
			}
			return true;
		}
	}

	[HarmonyPatch(typeof(Skill), "HasEnoughMana")]
	public class ResourceCheckOverride
	{
		private static bool Prefix(Skill __instance, bool _tryingToActivate, ref bool __result)
		{
			if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-23296))
			{
				float num = __instance.ManaCost / 2f;
				__result = ((Item)__instance).m_ownerCharacter.PlayerStats.Corruption >= num * 10f;
				if (!__result && Object.op_Implicit((Object)(object)((Item)__instance).m_ownerCharacter.CharacterUI) && _tryingToActivate)
				{
					((Item)__instance).m_ownerCharacter.CharacterUI.ShowInfoNotificationLoc("Notification_Skill_NotEnoughCorruption");
					return false;
				}
				if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28007))
				{
					__result = __instance.HasEnoughHealth(_tryingToActivate);
					return false;
				}
				if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28008))
				{
					float num2 = (Object.op_Implicit((Object)(object)((Item)__instance).m_ownerCharacter.Stats) ? ((Item)__instance).m_ownerCharacter.Stats.GetFinalManaConsumption((Tag[])null, num) : num);
					bool flag = ((Item)__instance).m_ownerCharacter.Mana >= num2 / 2f;
					bool flag2 = ((Item)__instance).m_ownerCharacter.Health >= num2 / 2f;
					if (!flag && Object.op_Implicit((Object)(object)((Item)__instance).m_ownerCharacter.CharacterUI) && _tryingToActivate)
					{
						((Item)__instance).m_ownerCharacter.CharacterUI.ShowInfoNotificationLoc("Notification_Skill_NotEnoughMana");
						__result = flag;
						return false;
					}
					if (!flag2 && Object.op_Implicit((Object)(object)((Item)__instance).m_ownerCharacter.CharacterUI) && _tryingToActivate)
					{
						((Item)__instance).m_ownerCharacter.CharacterUI.ShowInfoNotificationLoc("Notification_Skill_NotEnoughHealth");
						__result = flag2;
						return false;
					}
					__result = true;
					return false;
				}
			}
			else
			{
				if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28007))
				{
					__result = __instance.HasEnoughHealth(_tryingToActivate);
					return false;
				}
				if (((CharacterKnowledge)((Item)__instance).m_ownerCharacter.Inventory.SkillKnowledge).IsItemLearned(-28008))
				{
					float num3 = (Object.op_Implicit((Object)(object)((Item)__instance).m_ownerCharacter.Stats) ? ((Item)__instance).m_ownerCharacter.Stats.GetFinalManaConsumption((Tag[])null, __instance.ManaCost) : __instance.ManaCost);
					__result = ((Item)__instance).m_ownerCharacter.Mana >= num3 / 2f;
					if (!__result && Object.op_Implicit((Object)(object)((Item)__instance).m_ownerCharacter.CharacterUI) && _tryingToActivate)
					{
						((Item)__instance).m_ownerCharacter.CharacterUI.ShowInfoNotificationLoc("Notification_Skill_NotEnoughMana");
					}
					return false;
				}
			}
			return true;
		}
	}

	public const string GUID = "com.StormCancer.ClassfixesPart3";

	public const string NAME = "ClassfixesPart3";

	public const string VERSION = "1.0.0";

	public static HMBMRework Instance;

	public const int LeylineAbandonmentID = -28007;

	public const int LeylineEntanglementID = -28008;

	public const int HexMageBreakthroughID = -23296;

	internal static ManualLogSource Log;

	internal void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		Instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogMessage((object)"Hello world from ClassfixesPart3 1.0.0!");
		new Harmony("com.StormCancer.ClassfixesPart3").PatchAll();
	}

	internal void Update()
	{
	}

	public static Tag GetTagDefinition(string TagName)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		Tag[] tags = TagSourceManager.Instance.m_tags;
		foreach (Tag val in tags)
		{
			if (val.TagName == TagName)
			{
				return val;
			}
		}
		return default(Tag);
	}
}