Decompiled source of BetterBands v1.2.0

BetterBands.dll

Decompiled 4 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.Bootstrap;
using BepInEx.Logging;
using HG;
using MysticsRisky2Utils.BaseAssetTypes;
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("BetterBands")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterBands")]
[assembly: AssemblyTitle("BetterBands")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace BetterBands;

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);
	}
}
[BepInPlugin("catgirlnov.BetterBands", "BetterBands", "1.2.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class BandDisplays : BaseUnityPlugin
{
	public const string PluginGUID = "catgirlnov.BetterBands";

	public const string PluginAuthor = "catgirlnov";

	public const string PluginName = "BetterBands";

	public const string PluginVersion = "1.2.0";

	internal static void Enable()
	{
		RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(AddDisplay));
	}

	internal static void Disable()
	{
		RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(AddDisplay));
	}

	private void Awake()
	{
		Enable();
		Log.Init(((BaseUnityPlugin)this).Logger);
	}

	public static void AddDisplay()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: 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_001f: 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)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_00af: 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_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0173: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_023d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_031e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0332: Unknown result type (might be due to invalid IL or missing references)
		//IL_0346: Unknown result type (might be due to invalid IL or missing references)
		//IL_0369: Unknown result type (might be due to invalid IL or missing references)
		//IL_037d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0391: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_0427: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0501: Unknown result type (might be due to invalid IL or missing references)
		//IL_0515: Unknown result type (might be due to invalid IL or missing references)
		//IL_0537: Unknown result type (might be due to invalid IL or missing references)
		//IL_054b: Unknown result type (might be due to invalid IL or missing references)
		//IL_055f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0581: Unknown result type (might be due to invalid IL or missing references)
		//IL_0595: Unknown result type (might be due to invalid IL or missing references)
		//IL_05a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0617: Unknown result type (might be due to invalid IL or missing references)
		//IL_062b: Unknown result type (might be due to invalid IL or missing references)
		//IL_063f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0662: Unknown result type (might be due to invalid IL or missing references)
		//IL_0676: Unknown result type (might be due to invalid IL or missing references)
		//IL_068a: Unknown result type (might be due to invalid IL or missing references)
		//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_070c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0720: Unknown result type (might be due to invalid IL or missing references)
		//IL_0743: Unknown result type (might be due to invalid IL or missing references)
		//IL_0757: Unknown result type (might be due to invalid IL or missing references)
		//IL_076b: Unknown result type (might be due to invalid IL or missing references)
		GameObject mdl = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageBody.prefab").WaitForCompletion();
		GameObject mdl2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/CommandoBody.prefab").WaitForCompletion();
		GameObject mdl3 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Huntress/HuntressBody.prefab").WaitForCompletion();
		GameObject mdl4 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2Body.prefab").WaitForCompletion();
		GameObject mdl5 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Toolbot/ToolbotBody.prefab").WaitForCompletion();
		GameObject mdl6 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Engi/EngiBody.prefab").WaitForCompletion();
		GameObject mdl7 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Merc/MercBody.prefab").WaitForCompletion();
		GameObject mdl8 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Loader/LoaderBody.prefab").WaitForCompletion();
		GameObject mdl9 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoBody.prefab").WaitForCompletion();
		GameObject mdl10 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Captain/CaptainBody.prefab").WaitForCompletion();
		GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElementalRings/DisplayFireRing.prefab").WaitForCompletion();
		GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ElementalRings/DisplayIceRing.prefab").WaitForCompletion();
		GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/ElementalRingVoid/DisplayVoidRing.prefab").WaitForCompletion();
		GameObject[] array = Array.Empty<GameObject>();
		ArrayUtils.ArrayAppend<GameObject>(ref array, ref val);
		ArrayUtils.ArrayAppend<GameObject>(ref array, ref val2);
		ArrayUtils.ArrayAppend<GameObject>(ref array, ref val3);
		GameObject[] array2 = array;
		foreach (GameObject item in array2)
		{
			VanillaOverride.OverrideDisplay(mdl, item, "ClavicleR", new Vector3(-0.00793f, -0.01487f, -0.01729f), new Vector3(325f, 20f, 0f), new Vector3(0.12f, 0.12f, 0.12f));
			VanillaOverride.OverrideDisplay(mdl2, item, "HeadCenter", new Vector3(0.00074f, -0.18093f, 0.00626f), new Vector3(90f, 0f, 0f), new Vector3(0.45f, 0.45f, 0.2f));
			VanillaOverride.OverrideDisplay(mdl3, item, "HeadCenter", new Vector3(-0.00581f, -0.15465f, -0.00326f), new Vector3(90f, 353.8943f, 0f), new Vector3(0.2f, 0.2f, 0.2f));
			VanillaOverride.OverrideDisplay(mdl4, item, "Head", new Vector3(0.00081f, -0.06583f, 0.01264f), new Vector3(80.00002f, 180f, 180f), new Vector3(0.15f, 0.15f, 0.15f));
			VanillaOverride.OverrideDisplay(mdl5, item, "Neck", new Vector3(-0.02293f, 2.07109f, 0.38638f), new Vector3(60f, 1E-05f, 1E-05f), new Vector3(2.3f, 2.3f, 2.3f));
			VanillaOverride.OverrideDisplay(mdl6, item, "HeadCenter", new Vector3(0.00274f, -0.03971f, 0.00236f), new Vector3(70.00002f, 180f, 180f), new Vector3(0.45f, 0.45f, 0.175f));
			VanillaOverride.OverrideDisplay(mdl7, item, "Head", new Vector3(-0.00102f, -0.01095f, 0.01069f), new Vector3(70.00002f, 180f, 180f), new Vector3(0.2f, 0.2f, 0.15f));
			VanillaOverride.OverrideDisplay(mdl8, item, "Neck", new Vector3(0.0079f, 0.04562f, -0.00803f), new Vector3(300f, 180f, 180f), new Vector3(0.15f, 0.15f, 0.2f));
			VanillaOverride.OverrideDisplay(mdl9, item, "HeadCenter", new Vector3(-0.04129f, -1.49135f, -0.68773f), new Vector3(85.00001f, 0f, 0f), new Vector3(5f, 5f, 3f));
			VanillaOverride.OverrideDisplay(mdl10, item, "Neck", new Vector3(-0.00911f, 0.0431f, 0.01236f), new Vector3(270f, 0.07719f, 0f), new Vector3(0.25f, 0.25f, 0.15f));
		}
		if (Chainloader.PluginInfos.ContainsKey("com.themysticsword.mysticsitems"))
		{
			Log.Debug("!!!");
			if (BaseItem.loadedDictionary.TryGetValue("MysticsItems_HealOrbOnBarrel", out var value))
			{
				GameObject itemDisplayPrefab = ((BaseItemLike)value).itemDisplayPrefab;
				VanillaOverride.OverrideDisplay(mdl, itemDisplayPrefab, "Head", new Vector3(0.00042f, -0.07915f, 0.00158f), new Vector3(0f, 180f, 0f), new Vector3(0.07f, 0.07f, 0.07f));
				VanillaOverride.OverrideDisplay(mdl2, itemDisplayPrefab, "Head", new Vector3(0.00111f, 0.05686f, 0.00893f), new Vector3(0f, 180f, 0f), new Vector3(0.25f, 0.1f, 0.25f));
				VanillaOverride.OverrideDisplay(mdl3, itemDisplayPrefab, "Head", new Vector3(0.00094f, 0.02789f, -0.01119f), new Vector3(0f, 180f, 0f), new Vector3(0.12f, 0.12f, 0.12f));
				VanillaOverride.OverrideDisplay(mdl4, itemDisplayPrefab, "Head", new Vector3(0.00363f, -0.08689f, 0.00308f), new Vector3(10f, 0f, 0f), new Vector3(0.1f, 0.1f, 0.1f));
				VanillaOverride.OverrideDisplay(mdl5, itemDisplayPrefab, "Neck", new Vector3(-0.11537f, 1.3268f, 0.57803f), new Vector3(20f, 0f, 0f), new Vector3(1.5f, 1.5f, 1.5f));
				VanillaOverride.OverrideDisplay(mdl6, itemDisplayPrefab, "HeadCenter", new Vector3(0.00018f, -0.06913f, -0.04166f), new Vector3(20f, 0.001f, 359.976f), new Vector3(0.3f, 0.3f, 0.3f));
				VanillaOverride.OverrideDisplay(mdl7, itemDisplayPrefab, "Neck", new Vector3(0.00248f, 0.08677f, 0.00608f), new Vector3(345f, 0f, 0f), new Vector3(0.15f, 0.15f, 0.15f));
				VanillaOverride.OverrideDisplay(mdl8, itemDisplayPrefab, "Neck", new Vector3(0f, 0.00494f, 0.01664f), new Vector3(30f, 180f, 0f), new Vector3(0.15f, 0.15f, 0.15f));
				VanillaOverride.OverrideDisplay(mdl9, itemDisplayPrefab, "Head", new Vector3(0.00033f, -0.81304f, -0.78769f), new Vector3(30f, 0f, 0f), new Vector3(4f, 4f, 4f));
				VanillaOverride.OverrideDisplay(mdl10, itemDisplayPrefab, "Neck", new Vector3(-0.00272f, 0.01468f, 0.00352f), new Vector3(0f, 0f, 0f), new Vector3(0.1f, 0.1f, 0.1f));
			}
		}
		LanguageAPI.Add("ITEM_FIRERING_NAME", "Kjaro's Collar");
		LanguageAPI.Add("ITEM_ICERING_NAME", "Runald's Collar");
		LanguageAPI.Add("ITEM_ELEMENTALRINGS_NAME", "Kjaro and Runald's Collars");
		LanguageAPI.Add("ITEM_ELEMENTALRINGVOID_NAME", "Singularity Collar");
		LanguageAPI.Add("ITEM_ELEMENTALRINGVOID_PICKUP", "High damage hits also create unstable black holes. Recharges over time. <style=cIsVoid>Corrupts all Runald's and Kjaro's Collars</style>.");
		LanguageAPI.Add("ITEM_ELEMENTALRINGVOID_DESC", "Hits that deal <style=cIsDamage>more than 400% damage</style> also fire a black hole that <style=cIsUtility>draws enemies within 15m into its center</style>. Lasts <style=cIsUtility>5</style> seconds before collapsing, dealing <style=cIsDamage>100%</style> <style=cStack>(+100% per stack)</style> TOTAL damage. Recharges every <style=cIsUtility>20</style> seconds. <style=cIsVoid>Corrupts all Runald's and Kjaro's Collars</style>.");
		Disable();
	}
}
public class VanillaOverride
{
	public static void OverrideDisplay(GameObject mdl, GameObject item, string chName, Vector3 pos, Vector3 angle, Vector3 scale)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: 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_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		KeyAssetRuleGroup[] keyAssetRuleGroups = mdl.GetComponentInChildren<CharacterModel>().itemDisplayRuleSet.keyAssetRuleGroups;
		foreach (KeyAssetRuleGroup val in keyAssetRuleGroups)
		{
			try
			{
				if ((Object)(object)val.displayRuleGroup.rules[0].followerPrefab == (Object)(object)item)
				{
					val.displayRuleGroup.rules[0].localPos = pos;
					val.displayRuleGroup.rules[0].localScale = scale;
					val.displayRuleGroup.rules[0].localAngles = angle;
					val.displayRuleGroup.rules[0].childName = chName;
				}
			}
			catch
			{
			}
		}
	}
}