Decompiled source of Marixxe Is Mithrix v1.1.1

MarixxeIsMithrix.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using MarixxeIsMithrix.Buff;
using MarixxeIsMithrix.Item;
using MarixxeIsMithrix.Modules;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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("MarixxeIsMithrix")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MarixxeIsMithrix")]
[assembly: AssemblyTitle("MarixxeIsMithrix")]
[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 MarixxeIsMithrix
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("MaxwellArmatria.MarixxeIsMithrix", "MarixxeIsMithrix", "1.0.6")]
	public class MarixxeIsMithrix : BaseUnityPlugin
	{
		public const string PluginGUID = "MaxwellArmatria.MarixxeIsMithrix";

		public const string PluginAuthor = "MaxwellArmatria";

		public const string PluginName = "MarixxeIsMithrix";

		public const string PluginVersion = "1.0.6";

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			PInfo = ((BaseUnityPlugin)this).Info;
			Assets.Init();
			BuffCreator.CreateBuff();
			ItemCreator.CreateItem();
		}

		private void Update()
		{
		}
	}
}
namespace MarixxeIsMithrix.Modules
{
	public static class Assets
	{
		public static AssetBundle mainBundle;

		public const string bundleName = "marixxeisitem.bundle";

		public const string assetBundleFolder = "AssetBundles";

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(MarixxeIsMithrix.PInfo.Location), "AssetBundles", "marixxeisitem.bundle");

		public static void Init()
		{
			mainBundle = AssetBundle.LoadFromFile(AssetBundlePath);
		}
	}
	public static class BuffCreator
	{
		public static void CreateBuff()
		{
			Order.Init();
		}
	}
	public static class ItemCreator
	{
		public static void CreateItem()
		{
			MonsterCan.Init();
			SelfFillingGatling.Init();
			LawAndOrder.Init();
		}
	}
}
namespace MarixxeIsMithrix.Item
{
	internal class CrystalDivergence
	{
		public static ItemDef crystalDivergence;

		public static void Init()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			crystalDivergence = ScriptableObject.CreateInstance<ItemDef>();
			((Object)crystalDivergence).name = "CRYSTAL_DIVERGENCE_NAME";
			crystalDivergence.nameToken = "CRYSTAL_DIVERGENCE_NAME";
			crystalDivergence.pickupToken = "CRYSTAL_DIVERGENCE_PICKUP";
			crystalDivergence.descriptionToken = "CRYSTAL_DIVERGENCE_DESCRIPTION";
			crystalDivergence.loreToken = "CRYSTAL_DIVERGENCE_LORE";
			crystalDivergence._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier1Def.asset").WaitForCompletion();
			crystalDivergence.pickupIconSprite = Assets.mainBundle.LoadAsset<Sprite>("CrystalDivergence");
			crystalDivergence.pickupModelPrefab = Assets.mainBundle.LoadAsset<GameObject>("CrystalDivergence");
			crystalDivergence.canRemove = true;
			crystalDivergence.hidden = false;
			ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
			ItemAPI.Add(new CustomItem(crystalDivergence, val));
		}
	}
	internal class LawAndOrder
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnHitEnemy <0>__GlobalEventManager_OnHitEnemy;

			public static hook_TakeDamage <1>__HealthComponent_TakeDamage;
		}

		public static ItemDef lawAndOrder;

		public static void Init()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			lawAndOrder = ScriptableObject.CreateInstance<ItemDef>();
			((Object)lawAndOrder).name = "LAW_AND_ORDER_NAME";
			lawAndOrder.nameToken = "LAW_AND_ORDER_NAME";
			lawAndOrder.pickupToken = "LAW_AND_ORDER_PICKUP";
			lawAndOrder.descriptionToken = "LAW_AND_ORDER_DESCRIPTION";
			lawAndOrder.loreToken = "LAW_AND_ORDER_LORE";
			lawAndOrder._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier3Def.asset").WaitForCompletion();
			lawAndOrder.pickupIconSprite = Assets.mainBundle.LoadAsset<Sprite>("LawAndOrder");
			lawAndOrder.pickupModelPrefab = Assets.mainBundle.LoadAsset<GameObject>("LawAndOrder");
			lawAndOrder.canRemove = true;
			lawAndOrder.hidden = false;
			ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
			ItemAPI.Add(new CustomItem(lawAndOrder, val));
			Hooks();
		}

		public static void Hooks()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			object obj = <>O.<0>__GlobalEventManager_OnHitEnemy;
			if (obj == null)
			{
				hook_OnHitEnemy val = GlobalEventManager_OnHitEnemy;
				<>O.<0>__GlobalEventManager_OnHitEnemy = val;
				obj = (object)val;
			}
			GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj;
			object obj2 = <>O.<1>__HealthComponent_TakeDamage;
			if (obj2 == null)
			{
				hook_TakeDamage val2 = HealthComponent_TakeDamage;
				<>O.<1>__HealthComponent_TakeDamage = val2;
				obj2 = (object)val2;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj2;
		}

		public static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
		{
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			if (component.master.inventory.GetItemCount(lawAndOrder) > 0 && self.body.HasBuff(Order.order))
			{
				damageInfo.damage *= 1f + (float)self.body.GetBuffCount(Order.order) * ((float)component.master.inventory.GetItemCount(lawAndOrder) * 0.5f);
			}
			orig.Invoke(self, damageInfo);
		}

		public static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager globalEventManager, DamageInfo damageInfo, GameObject entity)
		{
			orig.Invoke(globalEventManager, damageInfo, entity);
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			CharacterBody component2 = entity.GetComponent<CharacterBody>();
			if (damageInfo.damage >= component2.healthComponent.fullHealth * 0.5f && component2.master.inventory.GetItemCount(lawAndOrder) > 0)
			{
				component.AddBuff(Order.order);
			}
		}
	}
	public class MonsterCan
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__RecalculateStatsAPI_GetStatCoefficients;
		}

		public static ItemDef monsterCan;

		public static void Init()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			monsterCan = ScriptableObject.CreateInstance<ItemDef>();
			((Object)monsterCan).name = "MONSTER_CAN_NAME";
			monsterCan.nameToken = "MONSTER_CAN_NAME";
			monsterCan.pickupToken = "MONSTER_CAN_PICKUP";
			monsterCan.descriptionToken = "MONSTER_CAN_DESCRIPTION";
			monsterCan.loreToken = "MONSTER_CAN_LORE";
			monsterCan._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier3Def.asset").WaitForCompletion();
			monsterCan.pickupIconSprite = Assets.mainBundle.LoadAsset<Sprite>("MonsterCan");
			monsterCan.pickupModelPrefab = Assets.mainBundle.LoadAsset<GameObject>("MonsterCan");
			monsterCan.canRemove = true;
			monsterCan.hidden = false;
			ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
			ItemAPI.Add(new CustomItem(monsterCan, val));
			Hooks();
		}

		public static void Hooks()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__RecalculateStatsAPI_GetStatCoefficients;
			if (obj == null)
			{
				StatHookEventHandler val = RecalculateStatsAPI_GetStatCoefficients;
				<>O.<0>__RecalculateStatsAPI_GetStatCoefficients = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
		}

		private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender.inventory))
			{
				int itemCount = sender.inventory.GetItemCount(monsterCan);
				if (itemCount == 1)
				{
					args.primaryCooldownMultAdd += -0.1f;
					args.secondaryCooldownMultAdd += -0.1f;
					args.utilityCooldownMultAdd += -0.1f;
					args.specialCooldownMultAdd += -0.1f;
					args.moveSpeedMultAdd += 0.1f;
					args.attackSpeedMultAdd += 0.1f;
					args.regenMultAdd += 0.1f;
				}
				else if (itemCount > 1)
				{
					args.primaryCooldownMultAdd += -0.1f + -0.1f * (float)(itemCount - 1);
					args.secondaryCooldownMultAdd += -0.1f + -0.1f * (float)(itemCount - 1);
					args.utilityCooldownMultAdd += -0.1f + -0.1f * (float)(itemCount - 1);
					args.specialCooldownMultAdd += -0.1f + -0.1f * (float)(itemCount - 1);
					args.moveSpeedMultAdd += 0.1f + 0.1f * (float)(itemCount - 1);
					args.attackSpeedMultAdd += 0.1f + 0.1f * (float)(itemCount - 1);
					args.regenMultAdd += 0.1f + 0.1f * (float)(itemCount - 1);
				}
			}
		}
	}
	internal class PullRouge
	{
		public static ItemDef pullRouge;

		public static void Init()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected O, but got Unknown
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Expected O, but got Unknown
			pullRouge = ScriptableObject.CreateInstance<ItemDef>();
			((Object)pullRouge).name = "PULL_ROUGE_NAME";
			pullRouge.nameToken = "PULL_ROUGE_NAME";
			pullRouge.pickupToken = "PULL_ROUGE_PICKUP";
			pullRouge.descriptionToken = "PULL_ROUGE_DESCRIPTION";
			pullRouge.loreToken = "PULL_ROUGE_LORE";
			pullRouge._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion();
			pullRouge.pickupIconSprite = Assets.mainBundle.LoadAsset<Sprite>("pullRouge");
			pullRouge.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion();
			pullRouge.canRemove = true;
			pullRouge.hidden = false;
			ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
			ItemAPI.Add(new CustomItem(pullRouge, val));
		}
	}
	internal class SelfFillingGatling
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static StatHookEventHandler <0>__RecalculateStatsAPI_GetStatCoefficients;
		}

		public static ItemDef selfFillingGatling;

		public static void Init()
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			selfFillingGatling = ScriptableObject.CreateInstance<ItemDef>();
			((Object)selfFillingGatling).name = "SELF_FILLING_GATLING_NAME";
			selfFillingGatling.nameToken = "SELF_FILLING_GATLING_NAME";
			selfFillingGatling.pickupToken = "SELF_FILLING_GATLING_PICKUP";
			selfFillingGatling.descriptionToken = "SELF_FILLING_GATLING_DESCRIPTION";
			selfFillingGatling.loreToken = "SELF_FILLING_GATLING_LORE";
			selfFillingGatling._itemTierDef = Addressables.LoadAssetAsync<ItemTierDef>((object)"RoR2/Base/Common/Tier2Def.asset").WaitForCompletion();
			selfFillingGatling.pickupIconSprite = Assets.mainBundle.LoadAsset<Sprite>("SelfFillingGatling");
			selfFillingGatling.pickupModelPrefab = Assets.mainBundle.LoadAsset<GameObject>("SelfFillingGatling");
			selfFillingGatling.canRemove = true;
			selfFillingGatling.hidden = false;
			ItemDisplayRuleDict val = new ItemDisplayRuleDict((ItemDisplayRule[])null);
			ItemAPI.Add(new CustomItem(selfFillingGatling, val));
			Hooks();
		}

		public static void Hooks()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__RecalculateStatsAPI_GetStatCoefficients;
			if (obj == null)
			{
				StatHookEventHandler val = RecalculateStatsAPI_GetStatCoefficients;
				<>O.<0>__RecalculateStatsAPI_GetStatCoefficients = val;
				obj = (object)val;
			}
			RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj;
		}

		private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)sender.inventory))
			{
				int itemCount = sender.inventory.GetItemCount(selfFillingGatling);
				if (itemCount == 1)
				{
					args.levelAttackSpeedAdd += 0.02f;
				}
				else if (itemCount > 1)
				{
					args.levelAttackSpeedAdd += 0.02f + 0.01f * (float)(itemCount - 1);
				}
			}
		}
	}
}
namespace MarixxeIsMithrix.Buff
{
	internal class Order
	{
		public static BuffDef order;

		public static void Init()
		{
			order = ScriptableObject.CreateInstance<BuffDef>();
			order.canStack = true;
			order.isDebuff = true;
			order.isHidden = false;
			order.isCooldown = false;
			order.iconSprite = Assets.mainBundle.LoadAsset<Sprite>("Order");
			ContentAddition.AddBuffDef(order);
		}
	}
}