Decompiled source of AutoMithrixDisplays v1.0.1

AutoMithrixDisplays.dll

Decompiled 3 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HG;
using HarmonyLib;
using On.RoR2;
using R2API.Utils;
using RoR2;
using RoR2.ContentManagement;
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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("AutoMithrixDisplays")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AutoMithrixDisplays")]
[assembly: AssemblyTitle("AutoMithrixDisplays")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace AutoMithrixDisplays;

[BepInPlugin("com.Zenithrium.AutoMithrixDisplays", "AutoMithrixDisplays", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class AutoMithrixDisplays : BaseUnityPlugin
{
	public const string ModGuid = "com.Zenithrium.AutoMithrixDisplays";

	public const string ModName = "AutoMithrixDisplays";

	public const string ModVer = "1.0.1";

	public static ManualLogSource ModLogger;

	public static ConfigEntry<ulong> seed;

	public static ConfigEntry<string> idsToIgnore;

	public static AssetBundle MainAssets;

	public GameObject t1Infect;

	public GameObject t2Infect;

	public GameObject t3Infect;

	public GameObject bsInfect;

	public GameObject luInfect;

	public GameObject v1Infect;

	public GameObject v2Infect;

	public GameObject v3Infect;

	public GameObject v4Infect;

	public GameObject syblInfect;

	public GameObject sacrInfect;

	public GameObject vdluInfect;

	private ItemTier syblTier;

	private ItemTier sacrTier;

	private ItemTier vdluTier;

	private bool sybl = true;

	private bool sacr = true;

	private bool vdlu = true;

	private void Awake()
	{
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Expected O, but got Unknown
		seed = ((BaseUnityPlugin)this).Config.Bind<ulong>("General", "Placement Seed", 2147483520uL, "Adjust what seed the random number generator uses for item placement. (Ex: 2147483520, 7, 3691215, etc)");
		idsToIgnore = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Ignored Content Packs", "", "Adjust which mods do not get item displays added for them, in the event they already have them, separated by commas. (Ex. \"Aetherium, Starstorm\" or \"com.ContactLight.LostInTransit, com.Hex3.Hex3Mod\"");
		ModLogger = ((BaseUnityPlugin)this).Logger;
		using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("AutoMithrixDisplays.automithrixdisplaysassets"))
		{
			MainAssets = AssetBundle.LoadFromStream(stream);
		}
		Swapallshaders(MainAssets);
		ItemCatalog.Init += new hook_Init(ItemCatalog_Init);
	}

	private void ItemCatalog_Init(orig_Init orig)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: 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_0040: 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_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0578: Unknown result type (might be due to invalid IL or missing references)
		//IL_057d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0591: Unknown result type (might be due to invalid IL or missing references)
		//IL_0596: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0469: Unknown result type (might be due to invalid IL or missing references)
		//IL_0470: Expected O, but got Unknown
		//IL_0470: Unknown result type (might be due to invalid IL or missing references)
		//IL_0475: Unknown result type (might be due to invalid IL or missing references)
		//IL_047a: Unknown result type (might be due to invalid IL or missing references)
		//IL_047f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0532: 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_0559: Unknown result type (might be due to invalid IL or missing references)
		//IL_055e: Unknown result type (might be due to invalid IL or missing references)
		//IL_05da: Unknown result type (might be due to invalid IL or missing references)
		//IL_05df: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0682: Unknown result type (might be due to invalid IL or missing references)
		//IL_0687: Unknown result type (might be due to invalid IL or missing references)
		//IL_050b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0510: Unknown result type (might be due to invalid IL or missing references)
		//IL_0723: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
		orig.Invoke();
		t1Infect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/ItemInfection, White.prefab").WaitForCompletion();
		t2Infect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/ItemInfection, Green.prefab").WaitForCompletion();
		t3Infect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/ItemInfection, Red.prefab").WaitForCompletion();
		luInfect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/ItemInfection, Blue.prefab").WaitForCompletion();
		v1Infect = MainAssets.LoadAsset<GameObject>("void1Infection.prefab");
		ItemDisplay val = v1Infect.AddComponent<ItemDisplay>();
		val.rendererInfos = (RendererInfo[])(object)new RendererInfo[1];
		val.rendererInfos[0].renderer = (Renderer)(object)v1Infect.GetComponent<MeshRenderer>();
		val.rendererInfos[0].defaultMaterial = MainAssets.LoadAsset<Material>("voidInfectionT1.mat");
		Debug.Log((object)("v1dis: " + (object)val));
		v2Infect = MainAssets.LoadAsset<GameObject>("void2Infection.prefab");
		ItemDisplay val2 = v2Infect.AddComponent<ItemDisplay>();
		val2.rendererInfos = (RendererInfo[])(object)new RendererInfo[1];
		val2.rendererInfos[0].renderer = (Renderer)(object)v2Infect.GetComponent<MeshRenderer>();
		val2.rendererInfos[0].defaultMaterial = MainAssets.LoadAsset<Material>("voidInfectionT2.mat");
		v3Infect = MainAssets.LoadAsset<GameObject>("void3Infection.prefab");
		ItemDisplay val3 = v3Infect.AddComponent<ItemDisplay>();
		val3.rendererInfos = (RendererInfo[])(object)new RendererInfo[1];
		val3.rendererInfos[0].renderer = (Renderer)(object)v3Infect.GetComponent<MeshRenderer>();
		val3.rendererInfos[0].defaultMaterial = MainAssets.LoadAsset<Material>("voidInfectionT3.mat");
		v4Infect = MainAssets.LoadAsset<GameObject>("void4Infection.prefab");
		ItemDisplay val4 = v4Infect.AddComponent<ItemDisplay>();
		val4.rendererInfos = (RendererInfo[])(object)new RendererInfo[1];
		val4.rendererInfos[0].renderer = (Renderer)(object)v4Infect.GetComponent<MeshRenderer>();
		val4.rendererInfos[0].defaultMaterial = MainAssets.LoadAsset<Material>("voidInfectionT4.mat");
		bsInfect = MainAssets.LoadAsset<GameObject>("t4Infection.prefab");
		ItemDisplay val5 = bsInfect.AddComponent<ItemDisplay>();
		val5.rendererInfos = (RendererInfo[])(object)new RendererInfo[1];
		val5.rendererInfos[0].renderer = (Renderer)(object)bsInfect.GetComponent<MeshRenderer>();
		val5.rendererInfos[0].defaultMaterial = MainAssets.LoadAsset<Material>("InfectionT4.mat");
		syblInfect = MainAssets.LoadAsset<GameObject>("syblInfect.prefab");
		ItemDisplay val6 = syblInfect.AddComponent<ItemDisplay>();
		val6.rendererInfos = (RendererInfo[])(object)new RendererInfo[1];
		val6.rendererInfos[0].renderer = (Renderer)(object)syblInfect.GetComponent<MeshRenderer>();
		val6.rendererInfos[0].defaultMaterial = MainAssets.LoadAsset<Material>("syblInfectMat.mat");
		sacrInfect = MainAssets.LoadAsset<GameObject>("sacrInfect.prefab");
		ItemDisplay val7 = sacrInfect.AddComponent<ItemDisplay>();
		val7.rendererInfos = (RendererInfo[])(object)new RendererInfo[1];
		val7.rendererInfos[0].renderer = (Renderer)(object)sacrInfect.GetComponent<MeshRenderer>();
		val7.rendererInfos[0].defaultMaterial = MainAssets.LoadAsset<Material>("sacriInfectMat.mat");
		vdluInfect = MainAssets.LoadAsset<GameObject>("vdluInfect.prefab");
		ItemDisplay val8 = vdluInfect.AddComponent<ItemDisplay>();
		val8.rendererInfos = (RendererInfo[])(object)new RendererInfo[1];
		val8.rendererInfos[0].renderer = (Renderer)(object)vdluInfect.GetComponent<MeshRenderer>();
		val8.rendererInfos[0].defaultMaterial = MainAssets.LoadAsset<Material>("vdluInfectMat.mat");
		string[] bones = new string[14]
		{
			"chest", "Stomach", "Head", "UpperArmL", "LowerArmL", "UpperArmR", "LowerArmR", "ThighL", "ThighR", "CalfL",
			"CalfR", "chest", "Stomach", "chest"
		};
		Xoroshiro128Plus mithRand = new Xoroshiro128Plus(seed.Value);
		Enumerator<ItemTierDef> enumerator = ItemTierCatalog.allItemTierDefs.GetEnumerator();
		try
		{
			while (enumerator.MoveNext())
			{
				ItemTierDef current = enumerator.Current;
				string[] obj = new string[6]
				{
					"j2: ",
					((Object)current).name,
					" | ",
					null,
					null,
					null
				};
				ItemTier tier = current.tier;
				obj[3] = ((object)(ItemTier)(ref tier)).ToString();
				obj[4] = " | ";
				obj[5] = ((object)current).ToString();
				Debug.Log((object)string.Concat(obj));
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		try
		{
			syblTier = ItemTierCatalog.FindTierDef("Sibylline").tier;
		}
		catch (Exception)
		{
			sybl = false;
		}
		try
		{
			sacrTier = ItemTierCatalog.FindTierDef("Sacrificial").tier;
		}
		catch (Exception)
		{
			sacr = false;
		}
		try
		{
			vdluTier = ItemTierCatalog.FindTierDef("VoidLunarTierDef").tier;
		}
		catch (Exception)
		{
			vdlu = false;
		}
		ItemDisplayRuleSet val9 = Addressables.LoadAssetAsync<ItemDisplayRuleSet>((object)"RoR2/Base/Brother/idrsBrother.asset").WaitForCompletion();
		KeyAssetRuleGroup[] array = val9.keyAssetRuleGroups;
		ReadOnlyArray<ReadOnlyContentPack> allLoadedContentPacks = ContentManager.allLoadedContentPacks;
		IList<string> source = idsToIgnore.Value.Split(new string[2] { ",", " " }, StringSplitOptions.RemoveEmptyEntries);
		Enumerator<ReadOnlyContentPack> enumerator2 = allLoadedContentPacks.GetEnumerator();
		try
		{
			while (enumerator2.MoveNext())
			{
				ReadOnlyContentPack pack = enumerator2.Current;
				List<string> list = source.Where((string item) => ((ReadOnlyContentPack)(ref pack)).identifier.Contains(item)).ToList();
				Debug.Log((object)("List of Finds: " + list.Count + " | " + list.ToString()));
				if (list.Count > 0)
				{
					Debug.Log((object)("Skipping " + ((ReadOnlyContentPack)(ref pack)).identifier));
				}
				else if (((ReadOnlyContentPack)(ref pack)).identifier == "RoR2.BaseContent")
				{
					if (((ReadOnlyContentPack)(ref pack)).itemDefs.Length != 0)
					{
						Debug.Log((object)("Adding " + ((ReadOnlyContentPack)(ref pack)).identifier + " boss items"));
						array = AddAllDisplays(((ReadOnlyContentPack)(ref pack)).itemDefs, array, mithRand, bones, (ItemTier)4);
					}
				}
				else if (((ReadOnlyContentPack)(ref pack)).itemDefs.Length != 0)
				{
					Debug.Log((object)("Adding " + ((ReadOnlyContentPack)(ref pack)).identifier + "'s items"));
					array = AddAllDisplays(((ReadOnlyContentPack)(ref pack)).itemDefs, array, mithRand, bones, (ItemTier)5);
				}
			}
		}
		finally
		{
			((IDisposable)enumerator2).Dispose();
		}
		val9.keyAssetRuleGroups = array;
	}

	private (Vector3, Vector3) GeneratePositionFromRand(Xoroshiro128Plus rand, int randVal)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_037a: Unknown result type (might be due to invalid IL or missing references)
		//IL_037b: Unknown result type (might be due to invalid IL or missing references)
		//IL_037c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0381: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_0388: Unknown result type (might be due to invalid IL or missing references)
		//IL_038c: 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_0393: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_0396: Unknown result type (might be due to invalid IL or missing references)
		//IL_039b: Unknown result type (might be due to invalid IL or missing references)
		//IL_039d: Unknown result type (might be due to invalid IL or missing references)
		//IL_039e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02be: Unknown result type (might be due to invalid IL or missing references)
		Vector3 zero = Vector3.zero;
		Vector3 zero2 = Vector3.zero;
		Vector3 val = default(Vector3);
		if (randVal == 0 || randVal == 11)
		{
			((Vector3)(ref val))..ctor(rand.nextBool ? rand.RangeFloat(-0.125f, -0.045f) : rand.RangeFloat(0.045f, 0.125f), rand.RangeFloat(-0.2f, 0.325f), rand.nextBool ? rand.RangeFloat(-0.125f, -0.085f) : rand.RangeFloat(0.085f, 0.125f));
			((Vector3)(ref zero))..ctor(-0.00957f, 0.20225f, -0.023202f);
			((Vector3)(ref zero2))..ctor(0f, 80f, 330f);
		}
		else if (randVal == 1 || randVal == 12)
		{
			((Vector3)(ref val))..ctor(rand.nextBool ? rand.RangeFloat(-0.1275f, -0.065f) : rand.RangeFloat(0.065f, 0.1275f), rand.RangeFloat(0.125f, 0.325f), rand.nextBool ? rand.RangeFloat(-0.125f, -0.085f) : rand.RangeFloat(0.085f, 0.125f));
			((Vector3)(ref zero))..ctor(-0.03386f, 0.24174f, 0.06423f);
			((Vector3)(ref zero2))..ctor(0f, 90f, 0f);
		}
		else if (randVal == 2)
		{
			((Vector3)(ref val))..ctor(rand.RangeFloat(-0.075f, 0.075f), rand.RangeFloat(-0.03f, 0.0675f), rand.RangeFloat(-0.075f, 0.075f));
		}
		else if (randVal >= 3 && randVal <= 6)
		{
			((Vector3)(ref val))..ctor(rand.RangeFloat(-0.0065f, 0.0065f), rand.RangeFloat(0.075f, 0.3f), rand.RangeFloat(0.005f, 0.01f));
		}
		else if (randVal == 7 || randVal == 8)
		{
			((Vector3)(ref val))..ctor(rand.RangeFloat(-0.021f, 0.029f), rand.RangeFloat(0.0375f, 0.325f), 0f);
		}
		else if (randVal == 9 || randVal == 10)
		{
			(float, float, float) tuple = (rand.RangeFloat(-0.025f, 0.045f), rand.RangeFloat(0f, 0.3675f), rand.RangeFloat(0.02f, 0.04f));
			((Vector3)(ref val))..ctor(tuple.Item1, tuple.Item2, tuple.Item3);
			((Vector3)(ref zero))..ctor(0.01f, val.y, 0.03f);
		}
		else
		{
			((Vector3)(ref val))..ctor(rand.nextBool ? rand.RangeFloat(-0.115f, -0.065f) : rand.RangeFloat(0.065f, 0.115f), rand.RangeFloat(0.12f, 0.325f), rand.nextBool ? rand.RangeFloat(-0.05f, -0.035f) : rand.RangeFloat(-0.005f, 0.01f));
			((Vector3)(ref zero))..ctor(-0.00957f, 0.20225f, -0.025f);
			((Vector3)(ref zero2))..ctor(341.1971f, 90f, 27f);
		}
		zero.y = val.y;
		Vector3 val2 = val - zero;
		Quaternion val3 = Quaternion.LookRotation(val2);
		Vector3 eulerAngles = ((Quaternion)(ref val3)).eulerAngles;
		eulerAngles += zero2;
		return (val, eulerAngles);
	}

	private KeyAssetRuleGroup[] AddAllDisplays(ReadOnlyNamedAssetCollection<ItemDef> items, KeyAssetRuleGroup[] itemRuleGroups, Xoroshiro128Plus mithRand, string[] bones, ItemTier filter)
	{
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: 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_001b: Invalid comparison between Unknown and I4
		//IL_0027: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Invalid comparison between Unknown and I4
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Invalid comparison between Unknown and I4
		//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_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Expected I4, but got Unknown
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0160: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_024e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0283: 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_029e: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_020a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		AssetEnumerator<ItemDef> enumerator = items.GetEnumerator();
		try
		{
			KeyAssetRuleGroup val = default(KeyAssetRuleGroup);
			while (enumerator.MoveNext())
			{
				ItemDef current = enumerator.Current;
				if (((int)filter == 5 && (int)current.tier != 5) || (current.tier == filter && (int)filter != 5))
				{
					string nameToken = current.nameToken;
					ItemTier tier = current.tier;
					Debug.Log((object)("item: " + nameToken + "| " + ((object)(ItemTier)(ref tier)).ToString()));
					val.keyAsset = (Object)(object)current;
					int num = mithRand.RangeInt(0, bones.Length);
					(Vector3, Vector3) tuple = GeneratePositionFromRand(mithRand, num);
					ItemTier tier2 = current.tier;
					ItemTier val2 = tier2;
					GameObject followerPrefab;
					switch ((int)val2)
					{
					case 0:
					{
						followerPrefab = t1Infect;
						string nameToken3 = current.nameToken;
						tier = current.tier;
						Debug.Log((object)("item T1: " + nameToken3 + "| " + ((object)(ItemTier)(ref tier)).ToString()));
						break;
					}
					case 1:
						followerPrefab = t2Infect;
						break;
					case 2:
						followerPrefab = t3Infect;
						break;
					case 4:
						followerPrefab = bsInfect;
						break;
					case 3:
						followerPrefab = luInfect;
						break;
					case 6:
					{
						followerPrefab = v1Infect;
						string nameToken2 = current.nameToken;
						tier = current.tier;
						Debug.Log((object)("item VT1: " + nameToken2 + "| " + ((object)(ItemTier)(ref tier)).ToString()));
						break;
					}
					case 7:
						followerPrefab = v2Infect;
						break;
					case 8:
						followerPrefab = v3Infect;
						break;
					case 9:
						followerPrefab = v4Infect;
						break;
					default:
						followerPrefab = ((sybl && current.tier == syblTier) ? syblInfect : ((sacr && current.tier == sacrTier) ? sacrInfect : ((!vdlu || current.tier != vdluTier) ? t1Infect : vdluInfect)));
						break;
					}
					val.displayRuleGroup = default(DisplayRuleGroup);
					((DisplayRuleGroup)(ref val.displayRuleGroup)).AddDisplayRule(new ItemDisplayRule
					{
						ruleType = (ItemDisplayRuleType)0,
						followerPrefab = followerPrefab,
						childName = bones[num],
						localPos = tuple.Item1,
						localAngles = tuple.Item2,
						localScale = new Vector3(0.11f, 0.11f, 0.11f)
					});
					itemRuleGroups = CollectionExtensions.AddItem<KeyAssetRuleGroup>((IEnumerable<KeyAssetRuleGroup>)itemRuleGroups, val).ToArray();
				}
			}
		}
		finally
		{
			((IDisposable)enumerator).Dispose();
		}
		return itemRuleGroups;
	}

	public void Swapallshaders(AssetBundle bundle)
	{
		Material[] array = bundle.LoadAllAssets<Material>();
		Material[] array2 = array;
		foreach (Material val in array2)
		{
			switch (((Object)val.shader).name)
			{
			case "Stubbed Hopoo Games/Deferred/Standard":
				val.shader = Resources.Load<Shader>("shaders/deferred/hgstandard");
				break;
			case "Stubbed Hopoo Games/Deferred/Snow Topped":
				val.shader = Resources.Load<Shader>("shaders/deferred/hgsnowtopped");
				break;
			case "Stubbed Hopoo Games/FX/Cloud Remap":
				val.shader = Resources.Load<Shader>("shaders/fx/hgcloudremap");
				break;
			case "Stubbed Hopoo Games/FX/Cloud Intersection Remap":
				val.shader = Resources.Load<Shader>("shaders/fx/hgintersectioncloudremap");
				break;
			case "Stubbed Hopoo Games/FX/Opaque Cloud Remap":
				val.shader = Resources.Load<Shader>("shaders/fx/hgopaquecloudremap");
				break;
			case "Stubbed Hopoo Games/FX/Distortion":
				val.shader = Resources.Load<Shader>("shaders/fx/hgdistortion");
				break;
			case "Stubbed Hopoo Games/FX/Solid Parallax":
				val.shader = Resources.Load<Shader>("shaders/fx/hgsolidparallax");
				break;
			case "Stubbed Hopoo Games/Environment/Distant Water":
				val.shader = Resources.Load<Shader>("shaders/environment/hgdistantwater");
				break;
			case "StubbedRoR2/Base/Shaders/HGCloudRemap":
				val.shader = Resources.Load<Shader>("shaders/fx/hgcloudremap");
				break;
			}
		}
	}
}