Decompiled source of VanillaVoid v1.5.19

vanillaVoid.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
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 System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.DeepVoidPortalBattery;
using EntityStates.Engi.EngiMissilePainter;
using EntityStates.Mage.Weapon;
using HG.Reflection;
using HarmonyLib;
using IL.EntityStates.DeepVoidPortalBattery;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Engi.EngiMissilePainter;
using On.EntityStates.Mage.Weapon;
using On.RoR2;
using On.RoR2.Items;
using On.RoR2.Skills;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.ExpansionManagement;
using RoR2.Hologram;
using RoR2.Items;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using vanillaVoid.Equipment;
using vanillaVoid.Interactables;
using vanillaVoid.Items;
using vanillaVoid.Misc;
using vanillaVoid.Utils;
using vanillaVoid.Utils.Components;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("vanillaVoid")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("vanillaVoid")]
[assembly: AssemblyTitle("vanillaVoid")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace vanillaVoid
{
	[BepInPlugin("com.Zenithrium.vanillaVoid", "vanillaVoid", "1.5.19")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class vanillaVoidPlugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_GetLocalizedStringByToken <>9__31_0;

			public static Func<Type, bool> <>9__31_1;

			public static Func<Type, bool> <>9__31_2;

			public static Func<Type, bool> <>9__31_3;

			internal string <Awake>b__31_0(orig_GetLocalizedStringByToken orig, Language self, string token)
			{
				//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_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Invalid comparison between Unknown and I4
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				if (ItemBase.TokenToVoidPair.ContainsKey(token))
				{
					ItemIndex val = ItemCatalog.FindItemIndex(ItemBase.TokenToVoidPair[token]);
					if ((int)val != -1)
					{
						return orig.Invoke(self, token).Replace("{CORRUPTION}", MiscUtils.GetPlural(orig.Invoke(self, ItemCatalog.GetItemDef(val).nameToken)));
					}
				}
				return orig.Invoke(self, token);
			}

			internal bool <Awake>b__31_1(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase));
			}

			internal bool <Awake>b__31_2(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(EquipmentBase));
			}

			internal bool <Awake>b__31_3(Type type)
			{
				return !type.IsAbstract && type.IsSubclassOf(typeof(InteractableBase));
			}
		}

		public const string ModGuid = "com.Zenithrium.vanillaVoid";

		public const string ModName = "vanillaVoid";

		public const string ModVer = "1.5.19";

		public static ExpansionDef sotvDLC;

		public static ExpansionDef sotvDLC2;

		public static AssetBundle MainAssets;

		public List<ItemBase> Items = new List<ItemBase>();

		public List<EquipmentBase> Equipments = new List<EquipmentBase>();

		public List<InteractableBase> Interactables = new List<InteractableBase>();

		public static ManualLogSource ModLogger;

		public static GameObject platformObject;

		public static GameObject portalObject;

		public static GameObject lotusObject;

		public static GameObject lotusPulse;

		public static GameObject lotusCollider;

		public static GameObject exhaustVFX;

		public static List<Pair> corruptibleItems = new List<Pair>();

		public Xoroshiro128Plus genericRng;

		public static ConfigEntry<bool> locusEarlyExit;

		public static ConfigEntry<bool> locusExit;

		public static ConfigEntry<int> LocusBonus;

		public static ConfigEntry<bool> lockVoidsBehindPair;

		public static ConfigEntry<bool> doVoidPickupBorders;

		public static ConfigEntry<bool> doVoidCommandVFX;

		public static ConfigEntry<bool> doSaleCradle;

		private GameObject tier1Clone;

		private GameObject tier2Clone;

		private GameObject tier3Clone;

		private GameObject tier4Clone;

		private bool hasAdjustedTiers;

		private bool hasAddedCommand;

		private void Awake()
		{
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Expected O, but got Unknown
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Expected O, but got Unknown
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: 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_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Expected O, but got Unknown
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0372: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Expected O, but got Unknown
			//IL_0459: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Invalid comparison between Unknown and I4
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a0: Invalid comparison between Unknown and I4
			locusExit = ((BaseUnityPlugin)this).Config.Bind<bool>("Tweaks: Void Locus", "Exit Portal", true, "If enabled, spawns a portal in the void locus letting you return to normal stages if you want to.");
			locusEarlyExit = ((BaseUnityPlugin)this).Config.Bind<bool>("Tweaks: Void Locus", "Early Exit Portal", false, "If enabled, spawns the exit portal in void locus immediately upon entering the stage. Requires the exit portal to actually be enabled.");
			LocusBonus = ((BaseUnityPlugin)this).Config.Bind<int>("Tweaks: Void Locus", "Locus Bonus Credits", 0, "If you want to make going to the void locus have a little more of a reward, increase this number. Should be increased in at least multiples of 50ish");
			lockVoidsBehindPair = ((BaseUnityPlugin)this).Config.Bind<bool>("Tweaks: Void Items", "Require Original Item Unlocked", true, "If enabled, makes it so void items are locked until the non-void pair is unlocked. Ex. Pluripotent is locked until the profile has unlocked Dios. Only applies to void items which do not already have unlocks, in the event a mod adds special unlocks for a void item.");
			doVoidPickupBorders = ((BaseUnityPlugin)this).Config.Bind<bool>("Tweaks: Void Items", "Improved Pickup Highlights", true, "If enabled, picking up a void item will show tier-appropriate item highlights rather the the default white highlights.");
			doVoidCommandVFX = ((BaseUnityPlugin)this).Config.Bind<bool>("Tweaks: Void Items", "Improved Command VFX", true, "If enabled, void command cubes will have appropriate void vfx in the style of typical command VFX based on the actual void item VFX.");
			doSaleCradle = ((BaseUnityPlugin)this).Config.Bind<bool>("Tweaks: Void Cradles", "Sale Star Functionality", true, "If enabled, Sale Star will work on Void Cradles.");
			ModLogger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
			new PatchClassProcessor(val, typeof(ModdedDamageColors)).Patch();
			sotvDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("vanillaVoid.vanillavoidassets"))
			{
				MainAssets = AssetBundle.LoadFromStream(stream);
			}
			Swapallshaders(MainAssets);
			ContagiousItemManager.Init += new hook_Init(AddVoidItemsToDict);
			ItemCatalog.Init += new hook_Init(AddUnlocksToVoidItems);
			Stage.onServerStageBegin += AddLocusStuff;
			VoidStageMissionController.OnBatteryActivated += new hook_OnBatteryActivated(SpawnLocusPortal);
			SceneDirector.onPrePopulateSceneServer += LocusDirectorHelp;
			object obj = <>c.<>9__31_0;
			if (obj == null)
			{
				hook_GetLocalizedStringByToken val2 = delegate(orig_GetLocalizedStringByToken orig, Language self, string token)
				{
					//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_0022: Unknown result type (might be due to invalid IL or missing references)
					//IL_0024: Invalid comparison between Unknown and I4
					//IL_003c: Unknown result type (might be due to invalid IL or missing references)
					if (ItemBase.TokenToVoidPair.ContainsKey(token))
					{
						ItemIndex val10 = ItemCatalog.FindItemIndex(ItemBase.TokenToVoidPair[token]);
						if ((int)val10 != -1)
						{
							return orig.Invoke(self, token).Replace("{CORRUPTION}", MiscUtils.GetPlural(orig.Invoke(self, ItemCatalog.GetItemDef(val10).nameToken)));
						}
					}
					return orig.Invoke(self, token);
				};
				<>c.<>9__31_0 = val2;
				obj = (object)val2;
			}
			Language.GetLocalizedStringByToken += (hook_GetLocalizedStringByToken)obj;
			exhaustVFX = MainAssets.LoadAsset<GameObject>("ExhaustVFX.prefab");
			EffectComponent val3 = exhaustVFX.AddComponent<EffectComponent>();
			val3.applyScale = true;
			VFXAttributes val4 = exhaustVFX.AddComponent<VFXAttributes>();
			val4.vfxIntensity = (VFXIntensity)0;
			val4.vfxPriority = (VFXPriority)0;
			DestroyOnTimer val5 = exhaustVFX.AddComponent<DestroyOnTimer>();
			val5.duration = 5f;
			ContentAddition.AddEffect(exhaustVFX);
			platformObject = MainAssets.LoadAsset<GameObject>("mdlPlatformSeparate.prefab");
			platformObject.AddComponent<NetworkIdentity>();
			SurfaceDefProvider val6 = platformObject.AddComponent<SurfaceDefProvider>();
			val6.surfaceDef = Addressables.LoadAssetAsync<SurfaceDef>((object)"RoR2/Base/Common/sdMetal.asset").WaitForCompletion();
			string text = "RoR2/DLC1/Common/matVoidmetalTrim.mat";
			MeshRenderer component = ((Component)platformObject.transform.Find("platformlower")).GetComponent<MeshRenderer>();
			MeshRenderer component2 = ((Component)platformObject.transform.Find("platformupper")).GetComponent<MeshRenderer>();
			((Renderer)component).material = Addressables.LoadAssetAsync<Material>((object)text).WaitForCompletion();
			((Renderer)component2).material = Addressables.LoadAssetAsync<Material>((object)text).WaitForCompletion();
			GameObject val7 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/PortalArena/PortalArena.prefab").WaitForCompletion();
			portalObject = PrefabAPI.InstantiateClone(val7, "LocusVoidPortal");
			Light componentInChildren = portalObject.GetComponentInChildren<Light>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				((Behaviour)componentInChildren).enabled = false;
			}
			PrefabAPI.RegisterNetworkPrefab(platformObject);
			SetupVoidTierHighlights();
			if (doSaleCradle.Value)
			{
				GameObject val8 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidChest/VoidChest.prefab").WaitForCompletion();
				if (Object.op_Implicit((Object)(object)val8))
				{
					PurchaseInteraction component3 = val8.GetComponent<PurchaseInteraction>();
					if (Object.op_Implicit((Object)(object)component3))
					{
						component3.saleStarCompatible = true;
						PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(ImproveStarCradle);
					}
				}
			}
			IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(ItemBase))
				select type;
			List<Pair> list = new List<Pair>();
			foreach (Type item in enumerable)
			{
				ItemBase itemBase = (ItemBase)Activator.CreateInstance(item);
				if (!ValidateItem(itemBase, Items))
				{
					continue;
				}
				itemBase.Init(((BaseUnityPlugin)this).Config);
				ItemTag[] itemTags = itemBase.ItemTags;
				bool flag = true;
				bool flag2 = false;
				if ((int)itemBase.ItemDef.deprecatedTier == 5)
				{
					flag2 = true;
					flag = false;
				}
				string itemName = itemBase.ItemName;
				itemName = itemName.Replace("'", "");
				ItemTag[] array = itemTags;
				foreach (ItemTag val9 in array)
				{
					if ((int)val9 == 4)
					{
						flag2 = true;
						flag = false;
						break;
					}
				}
				if (!flag || ((BaseUnityPlugin)this).Config.Bind<bool>("Item: " + itemName, "Blacklist Item from AI Use?", false, "Should the AI not be able to obtain this item?").Value)
				{
					itemBase.AIBlacklisted = true;
				}
			}
			IEnumerable<Type> enumerable2 = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(EquipmentBase))
				select type;
			foreach (Type item2 in enumerable2)
			{
				EquipmentBase equipmentBase = (EquipmentBase)Activator.CreateInstance(item2);
				if (ValidateEquipment(equipmentBase, Equipments))
				{
					equipmentBase.Init(((BaseUnityPlugin)this).Config);
				}
			}
			IEnumerable<Type> enumerable3 = from type in Assembly.GetExecutingAssembly().GetTypes()
				where !type.IsAbstract && type.IsSubclassOf(typeof(InteractableBase))
				select type;
			foreach (Type item3 in enumerable3)
			{
				InteractableBase interactableBase = (InteractableBase)Activator.CreateInstance(item3);
				if (ValidateInteractable(interactableBase, Interactables))
				{
					interactableBase.Init(((BaseUnityPlugin)this).Config);
					ModLogger.LogInfo((object)("Interactable: " + interactableBase.InteractableName + " Initialized!"));
				}
			}
		}

		private void ImproveStarCradle(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
		{
			if (self.displayNameToken == "VOID_CHEST_NAME")
			{
				int itemCount = ((Component)activator).GetComponent<CharacterBody>().inventory.GetItemCount(Items.LowerPricedChests);
				ChestBehavior component = ((Component)self).GetComponent<ChestBehavior>();
				if (Object.op_Implicit((Object)(object)component) && itemCount > 0)
				{
					component.dropForwardVelocityStrength = 6f;
				}
			}
			orig.Invoke(self, activator);
		}

		private void AddUnlocksToVoidItems(orig_Init orig)
		{
			//IL_0022: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: 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)
			orig.Invoke();
			Pair[] array = ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem];
			foreach (Pair val in array)
			{
				if (lockVoidsBehindPair.Value && (Object)(object)val.itemDef1.unlockableDef != (Object)null && (Object)(object)val.itemDef2.unlockableDef == (Object)null)
				{
					Debug.Log((object)("Updating unlock condition for " + val.itemDef2.nameToken + " to " + val.itemDef1.nameToken + "'s."));
					val.itemDef2.unlockableDef = val.itemDef1.unlockableDef;
				}
			}
		}

		private void AddVoidItemsToDict(orig_Init orig)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Invalid comparison between Unknown and I4
			List<Pair> list = new List<Pair>();
			Debug.Log((object)"Adding VanillaVoid item transformations...");
			foreach (ItemBase item in Items)
			{
				if ((int)item.ItemDef.deprecatedTier != 5)
				{
					Debug.Log((object)("Item Name: " + item.ItemName));
					item.AddVoidPair(list);
				}
				else
				{
					Debug.Log((object)("Skipping " + item.ItemName));
				}
			}
			ItemRelationshipType contagiousItem = ItemRelationshipTypes.ContagiousItem;
			Debug.Log((object)contagiousItem);
			Pair[] first = ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem];
			ItemCatalog.itemRelationships[ItemRelationshipTypes.ContagiousItem] = first.Union(list).ToArray();
			Debug.Log((object)"Finishing appending VanillaVoid item transformations.");
			orig.Invoke();
		}

		public bool ValidateItem(ItemBase item, List<ItemBase> itemList)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			string text = item.ItemName.Replace("'", string.Empty);
			bool flag = false;
			if ((int)item.Tier == 5)
			{
				flag = true;
				item.AIBlacklisted = true;
			}
			else
			{
				flag = ((BaseUnityPlugin)this).Config.Bind<bool>("Item: " + text, "Enable Item?", true, "Should this item appear in runs?").Value;
			}
			if (flag)
			{
				itemList.Add(item);
			}
			return flag;
		}

		public bool ValidateEquipment(EquipmentBase equipment, List<EquipmentBase> equipmentList)
		{
			if (((BaseUnityPlugin)this).Config.Bind<bool>("Equipment: " + equipment.EquipmentName, "Enable Equipment?", true, "Should this equipment appear in runs?").Value)
			{
				equipmentList.Add(equipment);
				return true;
			}
			return false;
		}

		public bool ValidateInteractable(InteractableBase interactable, List<InteractableBase> interactableList)
		{
			if (((BaseUnityPlugin)this).Config.Bind<bool>("Interactable: " + interactable.InteractableName, "Enable Interactable?", true, "Should this interactable appear in runs?").Value)
			{
				interactableList.Add(interactable);
				return true;
			}
			return false;
		}

		public void SetupVoidTierHighlights()
		{
			//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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/UI/HighlightTier1Item.prefab").WaitForCompletion();
			val.AddComponent<NetworkIdentity>();
			tier1Clone = PrefabAPI.InstantiateClone(val, "void1HighlightPrefab");
			HighlightRect component = tier1Clone.GetComponent<HighlightRect>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.highlightColor = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)25));
				component.cornerImage = MainAssets.LoadAsset<Sprite>("texUICornerTier1");
			}
			tier2Clone = PrefabAPI.InstantiateClone(val, "void2HighlightPrefab");
			HighlightRect component2 = tier2Clone.GetComponent<HighlightRect>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.highlightColor = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)25));
				component2.cornerImage = MainAssets.LoadAsset<Sprite>("texUICornerTier2");
			}
			tier3Clone = PrefabAPI.InstantiateClone(val, "void3HighlightPrefab");
			HighlightRect component3 = tier3Clone.GetComponent<HighlightRect>();
			if (Object.op_Implicit((Object)(object)component3))
			{
				component3.highlightColor = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)25));
				component3.cornerImage = MainAssets.LoadAsset<Sprite>("texUICornerTier3");
			}
			tier4Clone = PrefabAPI.InstantiateClone(val, "void4HighlightPrefab");
			HighlightRect component4 = tier4Clone.GetComponent<HighlightRect>();
			if (Object.op_Implicit((Object)(object)component4))
			{
				component4.highlightColor = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)25));
				component4.cornerImage = MainAssets.LoadAsset<Sprite>("texUICornerTier1");
			}
			hasAdjustedTiers = false;
			if (!doVoidCommandVFX.Value)
			{
				hasAddedCommand = true;
			}
			else
			{
				hasAddedCommand = false;
			}
		}

		public void ApplyTierHighlights()
		{
			if (!hasAdjustedTiers && doVoidPickupBorders.Value)
			{
				ItemTierDef itemTierDef = ItemTierCatalog.GetItemTierDef((ItemTier)6);
				if (Object.op_Implicit((Object)(object)itemTierDef))
				{
					itemTierDef.highlightPrefab = tier1Clone;
				}
				ItemTierDef itemTierDef2 = ItemTierCatalog.GetItemTierDef((ItemTier)7);
				if (Object.op_Implicit((Object)(object)itemTierDef2))
				{
					itemTierDef2.highlightPrefab = tier2Clone;
				}
				ItemTierDef itemTierDef3 = ItemTierCatalog.GetItemTierDef((ItemTier)8);
				if (Object.op_Implicit((Object)(object)itemTierDef3))
				{
					itemTierDef3.highlightPrefab = tier3Clone;
				}
				ItemTierDef itemTierDef4 = ItemTierCatalog.GetItemTierDef((ItemTier)9);
				if (Object.op_Implicit((Object)(object)itemTierDef4))
				{
					itemTierDef4.highlightPrefab = tier4Clone;
				}
				hasAdjustedTiers = true;
			}
		}

		private void AddLocusStuff(Stage obj)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_041d: 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_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: 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_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Unknown result type (might be due to invalid IL or missing references)
			ApplyTierHighlights();
			if (!hasAddedCommand && doVoidCommandVFX.Value)
			{
				hasAddedCommand = true;
				GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Command/CommandCube.prefab").WaitForCompletion();
				GameObject val2 = MainAssets.LoadAsset<GameObject>("VoidSystem.prefab");
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.transform))
				{
					Transform val3 = val.transform.Find("PickupDisplay");
					if (Object.op_Implicit((Object)(object)val3))
					{
						ShakeEmitter val4 = val2.AddComponent<ShakeEmitter>();
						Wave wave = default(Wave);
						wave.amplitude = 1f;
						wave.frequency = 60f;
						wave.cycleOffset = 0f;
						val4.wave = wave;
						val4.shakeOnStart = true;
						val4.shakeOnEnable = false;
						val4.duration = 0.1f;
						val4.radius = 30f;
						val4.scaleShakeRadiusWithLocalScale = false;
						val4.amplitudeTimeDecay = true;
						Material item = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matTracerBright.mat").WaitForCompletion();
						Material material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matGenericFlash.mat").WaitForCompletion();
						try
						{
							((Renderer)((Component)val2.transform.Find("Loops").Find("DistantSoftGlow")).gameObject.GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/matGlowItemPickup.mat").WaitForCompletion();
							ParticleSystemRenderer component = ((Component)val2.transform.Find("Loops").Find("Swirls")).gameObject.GetComponent<ParticleSystemRenderer>();
							if (Object.op_Implicit((Object)(object)component))
							{
								List<Material> list = new List<Material>();
								list.Add(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matGlow2Soft.mat").WaitForCompletion());
								list.Add(item);
								RendererSetMaterialsExtension.SetMaterials((Renderer)(object)component, list);
							}
							((Renderer)((Component)val2.transform.Find("Loops").Find("Glowies")).gameObject.GetComponent<ParticleSystemRenderer>()).material = material;
							((Renderer)((Component)val2.transform.Find("Burst").Find("Vacuum Stars, Distortion")).gameObject.GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matInverseDistortion.mat").WaitForCompletion();
							ParticleSystemRenderer component2 = ((Component)val2.transform.Find("Burst").Find("Vacuum Stars, Trails")).gameObject.GetComponent<ParticleSystemRenderer>();
							if (Object.op_Implicit((Object)(object)component2))
							{
								List<Material> list2 = new List<Material>();
								list2.Add(item);
								list2.Add(Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Nullifier/matNullifierStarTrail.mat").WaitForCompletion());
								RendererSetMaterialsExtension.SetMaterials((Renderer)(object)component2, list2);
							}
							((Renderer)((Component)val2.transform.Find("Burst").Find("Flash")).gameObject.GetComponent<ParticleSystemRenderer>()).material = material;
							((Renderer)((Component)val2.transform.Find("Burst").Find("Vacuum Radial")).gameObject.GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Nullifier/matNullifierStarPortalEdge.mat").WaitForCompletion();
							((Renderer)((Component)val2.transform.Find("HarshGlow")).gameObject.GetComponent<ParticleSystemRenderer>()).material = material;
							val2.gameObject.SetActive(false);
							val2.transform.SetParent(val3);
							((Component)val3).GetComponent<PickupDisplay>().voidParticleEffect = val2;
							val2.transform.position = new Vector3(0f, 0f, 0f);
						}
						catch (Exception ex)
						{
							Debug.Log((object)("VV Exception (Command VFX): " + ex));
						}
					}
				}
			}
			if ((Object)(object)obj.sceneDef == (Object)(object)SceneCatalog.GetSceneDefFromSceneName("voidstage") && locusExit.Value)
			{
				if (locusEarlyExit.Value)
				{
					GameObject val5 = Object.Instantiate<GameObject>(portalObject, new Vector3(-37.5f, 19.5f, -284.05f), new Quaternion(0f, 70f, 0f, 0f));
					NetworkServer.Spawn(val5);
				}
				GameObject val6 = Object.Instantiate<GameObject>(platformObject, new Vector3(-37.5f, 15.25f, -273.5f), new Quaternion(0f, 0f, 0f, 0f));
				NetworkServer.Spawn(val6);
			}
		}

		private void SpawnLocusPortal(orig_OnBatteryActivated orig, VoidStageMissionController self)
		{
			//IL_0040: 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)
			orig.Invoke(self);
			if (self.numBatteriesActivated >= self.numBatteriesSpawned && !locusEarlyExit.Value)
			{
				GameObject val = Object.Instantiate<GameObject>(portalObject, new Vector3(-37.5f, 19.5f, -284.05f), new Quaternion(0f, 70f, 0f, 0f));
				NetworkServer.Spawn(val);
			}
		}

		private void LocusDirectorHelp(SceneDirector obj)
		{
			string baseSceneName = SceneCatalog.GetSceneDefForCurrentScene().baseSceneName;
			if (LocusBonus.Value > 0 && baseSceneName == "voidstage")
			{
				obj.interactableCredit += LocusBonus.Value;
			}
		}

		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;
				}
			}
		}
	}
}
namespace vanillaVoid.Utils
{
	public static class ItemHelpers
	{
		public static RendererInfo[] ItemDisplaySetup(GameObject obj, bool debugmode = false)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			List<Renderer> list = new List<Renderer>();
			MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
			if (componentsInChildren.Length != 0)
			{
				list.AddRange((IEnumerable<Renderer>)(object)componentsInChildren);
			}
			SkinnedMeshRenderer[] componentsInChildren2 = obj.GetComponentsInChildren<SkinnedMeshRenderer>();
			if (componentsInChildren2.Length != 0)
			{
				list.AddRange((IEnumerable<Renderer>)(object)componentsInChildren2);
			}
			RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[list.Count];
			for (int i = 0; i < list.Count; i++)
			{
				if (debugmode)
				{
					MaterialControllerComponents.HGControllerFinder hGControllerFinder = ((Component)list[i]).gameObject.AddComponent<MaterialControllerComponents.HGControllerFinder>();
					hGControllerFinder.Renderer = list[i];
				}
				array[i] = new RendererInfo
				{
					defaultMaterial = ((list[i] is SkinnedMeshRenderer) ? list[i].sharedMaterial : list[i].material),
					renderer = list[i],
					defaultShadowCastingMode = (ShadowCastingMode)1,
					ignoreOverlays = false
				};
			}
			return array;
		}

		public static string OrderManifestLoreFormatter(string deviceName, string estimatedDelivery, string sentTo, string trackingNumber, string devicePickupDesc, string shippingMethod, string orderDetails)
		{
			string[] value = new string[19]
			{
				"<align=left>Estimated Delivery:<indent=70%>Sent To:</indent></align>",
				"<align=left>" + estimatedDelivery + "<indent=70%>" + sentTo + "</indent></align>",
				"",
				"<indent=1%><style=cIsDamage><size=125%><u>  Shipping Details:\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0</u></size></style></indent>",
				"",
				"<indent=2%>-Order: <style=cIsUtility>" + deviceName + "</style></indent>",
				"<indent=4%><style=cStack>Tracking Number:  " + trackingNumber + "</style></indent>",
				"",
				"<indent=2%>-Order Description: " + devicePickupDesc + "</indent>",
				"",
				"<indent=2%>-Shipping Method: <style=cIsHealth>" + shippingMethod + "</style></indent>",
				"",
				"",
				"",
				"<indent=2%>-Order Details: " + orderDetails + "</indent>",
				"",
				"",
				"",
				"<style=cStack>Delivery being brought to you by the brand new </style><style=cIsUtility>Orbital Drop-Crate System (TM)</style>. <style=cStack><u>No refunds.</u></style>"
			};
			return string.Join("\n", value);
		}

		public static void RefreshTimedBuffs(CharacterBody body, BuffDef buffDef, float duration)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body) || body.GetBuffCount(buffDef) <= 0)
			{
				return;
			}
			foreach (TimedBuff timedBuff in body.timedBuffs)
			{
				if (buffDef.buffIndex == timedBuff.buffIndex)
				{
					timedBuff.timer = duration;
				}
			}
		}

		public static void RefreshTimedBuffs(CharacterBody body, BuffDef buffDef, float taperStart, float taperDuration)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body) || body.GetBuffCount(buffDef) <= 0)
			{
				return;
			}
			int num = 0;
			foreach (TimedBuff timedBuff in body.timedBuffs)
			{
				if (buffDef.buffIndex == timedBuff.buffIndex)
				{
					timedBuff.timer = taperStart + (float)num * taperDuration;
					num++;
				}
			}
		}

		public static void AddBuffAndDot(BuffDef buff, float duration, int stackCount, CharacterBody body)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Invalid comparison between Unknown and I4
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			DotIndex val = (DotIndex)Array.FindIndex(DotController.dotDefs, (DotDef dotDef) => (Object)(object)dotDef.associatedBuff == (Object)(object)buff);
			for (int i = 0; i < stackCount; i++)
			{
				if ((int)val != -1)
				{
					DotController.InflictDot(((Component)body).gameObject, ((Component)body).gameObject, val, duration, 0.25f, (uint?)null);
				}
				else
				{
					body.AddTimedBuff(buff.buffIndex, duration);
				}
			}
		}

		public static DotIndex FindAssociatedDotForBuff(BuffDef buff)
		{
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			return (DotIndex)Array.FindIndex(DotController.dotDefs, (DotDef dotDef) => (Object)(object)dotDef.associatedBuff == (Object)(object)buff);
		}
	}
	public static class MathHelpers
	{
		public static string FloatToPercentageString(float number, float numberBase = 100f)
		{
			return (number * numberBase).ToString("##0") + "%";
		}

		public static Vector3 ClosestPointOnSphereToPoint(Vector3 origin, float radius, Vector3 targetPosition)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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_0019: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = targetPosition - origin;
			val = Vector3.Normalize(val);
			val *= radius;
			return origin + val;
		}

		public static List<Vector3> DistributePointsEvenlyAroundSphere(int points, float radius, Vector3 origin)
		{
			//IL_0066: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			double num = Math.PI * (3.0 - Math.Sqrt(5.0));
			for (int i = 0; i < points; i++)
			{
				int num2 = 1 - i / (points - 1) * 2;
				double num3 = Math.Sqrt(1 - num2 * num2);
				double num4 = num * (double)i;
				float num5 = (float)(Math.Cos(num4) * num3);
				float num6 = (float)(Math.Sin(num4) * num3);
				Vector3 val = origin + new Vector3(num5, (float)num2, num6);
				list.Add(val * radius);
			}
			return list;
		}

		public static List<Vector3> DistributePointsEvenlyAroundCircle(int points, float radius, Vector3 origin, float angleOffset = 0f)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			List<Vector3> list = new List<Vector3>();
			Vector3 item = default(Vector3);
			for (int i = 0; i < points; i++)
			{
				double num = Math.PI * 2.0 / (double)points;
				double num2 = num * (double)i + (double)angleOffset;
				((Vector3)(ref item))..ctor((float)((double)radius * Math.Cos(num2) + (double)origin.x), origin.y, (float)((double)radius * Math.Sin(num2) + (double)origin.z));
				list.Add(item);
			}
			return list;
		}

		public static Vector3 GetPointOnUnitSphereCap(Quaternion targetDirection, float angle)
		{
			//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_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			float num = Random.Range(0f, angle) * (MathF.PI / 180f);
			Vector2 insideUnitCircle = Random.insideUnitCircle;
			Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * Mathf.Sin(num);
			Vector3 val2 = default(Vector3);
			((Vector3)(ref val2))..ctor(val.x, val.y, Mathf.Cos(num));
			return targetDirection * val2;
		}

		public static Vector3 GetPointOnUnitSphereCap(Vector3 targetDirection, float angle)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			return GetPointOnUnitSphereCap(Quaternion.LookRotation(targetDirection), angle);
		}

		public static Vector3 RandomPointOnCircle(Vector3 origin, float radius, Xoroshiro128Plus random)
		{
			//IL_0012: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			float num = random.RangeFloat(0f, MathF.PI * 2f);
			return origin + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * radius;
		}

		public static float InverseHyperbolicScaling(float baseValue, float additionalValue, float maxValue, int itemCount)
		{
			return baseValue + (maxValue - baseValue) * (1f - 1f / (1f + additionalValue * (float)(itemCount - 1)));
		}
	}
	public static class MiscUtils
	{
		private static List<string> alreadyPlural = new List<string>
		{
			"400 Tickets", "Balls", "Gummy Vitamins", "Booster Boots", "Life Savings", "Predatory Instincts", "Fueling Bellows", "Sharpened Chopsticks", "Hardlight Shields", "Steroids",
			"Charging Nanobots", "Experimental Jets", "Prototype Jet Boots", "Low Quality Speakers", "Stargazer's Records", "Baby's Toys", "Defensive Microbots", "Death's Regards", "Spare Drone Parts", "Brainstalks",
			"Sorcerer's Pills", "Shifted Quartz", "Clasping Claws", "Enhancement Vials", "<style=cIsVoid>Corrupts all Shatterspleens.</style>", "Empyrean Braces", "Orbs of Falsity", "Visions of Heresy", "Hooks of Heresy", "Strides of Heresy",
			"Essence of Heresy", "Beads of Fealty", "Prescriptions", "Snake Eyes", "Panic Mines"
		};

		private static Dictionary<string, string> rules = new Dictionary<string, string>
		{
			{ "rounds$", "rounds" },
			{ "tooth$", "teeth" },
			{ "fungus$", "fungi" },
			{ "(a|e|i|o|u)o$", "$1os" },
			{ "o$", "oes" },
			{ "(a|e|i|o|u)y$", "$1ys" },
			{ "y$", "ies" },
			{ "ff$", "s" },
			{ "fe?$", "ves" },
			{ "es$", "es" },
			{ "(ch|sh|x|z|s)$", "$1es" },
			{ "s?$", "s" }
		};

		public static Vector3? RaycastToDirection(Vector3 position, float maxDistance, Vector3 direction, int layer)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if (Physics.Raycast(new Ray(position, direction), ref val, maxDistance, layer, (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val)).point;
			}
			return null;
		}

		public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> toShuffle, Xoroshiro128Plus random)
		{
			List<T> list = new List<T>();
			foreach (T item in toShuffle)
			{
				list.Insert(random.RangeInt(0, list.Count + 1), item);
			}
			return list;
		}

		public static Vector3 FindClosestNodeToPosition(Vector3 position, HullClassification hullClassification, bool checkAirNodes = false)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			NodeGraph val = (checkAirNodes ? SceneInfo.instance.airNodes : SceneInfo.instance.groundNodes);
			NodeIndex val2 = val.FindClosestNode(position, hullClassification, float.PositiveInfinity);
			if (val2 != NodeIndex.invalid)
			{
				Vector3 result = default(Vector3);
				val.GetNodePosition(val2, ref result);
				return result;
			}
			vanillaVoidPlugin.ModLogger.LogInfo((object)$"No closest node to be found for XYZ: {position}, returning 0,0,0");
			return Vector3.zero;
		}

		public static bool TeleportBody(CharacterBody characterBody, GameObject target, GameObject teleportEffect, HullClassification hullClassification, Xoroshiro128Plus rng, float minDistance = 20f, float maxDistance = 45f, bool teleportAir = false)
		{
			//IL_001d: 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_002c: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)characterBody))
			{
				return false;
			}
			SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>();
			val.hullSize = hullClassification;
			val.nodeGraphType = (GraphType)(teleportAir ? 1 : 0);
			val.prefab = Resources.Load<GameObject>("SpawnCards/HelperPrefab");
			GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule
			{
				placementMode = (PlacementMode)1,
				position = target.transform.position,
				minDistance = minDistance,
				maxDistance = maxDistance
			}, rng));
			if (Object.op_Implicit((Object)(object)val2))
			{
				TeleportHelper.TeleportBody(characterBody, val2.transform.position);
				if (Object.op_Implicit((Object)(object)teleportEffect))
				{
					EffectManager.SimpleEffect(teleportEffect, val2.transform.position, Quaternion.identity, true);
				}
				Object.Destroy((Object)(object)val2);
				Object.Destroy((Object)(object)val);
				return true;
			}
			Object.Destroy((Object)(object)val);
			return false;
		}

		public static Vector3? AboveTargetVectorFromDamageInfo(DamageInfo damageInfo, float distanceAboveTarget)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			if (damageInfo.rejected || !Object.op_Implicit((Object)(object)damageInfo.attacker))
			{
				return null;
			}
			CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				TeamMask enemyTeams = TeamMask.GetEnemyTeams(component.teamComponent.teamIndex);
				HurtBox val = new SphereSearch
				{
					radius = 1f,
					mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
					origin = damageInfo.position
				}.RefreshCandidates().FilterCandidatesByHurtBoxTeam(enemyTeams).OrderCandidatesByDistance()
					.FilterCandidatesByDistinctHurtBoxEntities()
					.GetHurtBoxes()
					.FirstOrDefault();
				if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && Object.op_Implicit((Object)(object)val.healthComponent.body))
				{
					CharacterBody body = val.healthComponent.body;
					Vector3 val2 = body.mainHurtBox.collider.ClosestPointOnBounds(body.transform.position + new Vector3(0f, 10000f, 0f));
					Vector3? val3 = RaycastToDirection(val2, distanceAboveTarget, Vector3.up, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask));
					if (val3.HasValue)
					{
						return val3.Value;
					}
					return val2 + Vector3.up * distanceAboveTarget;
				}
			}
			return null;
		}

		public static Vector3? AboveTargetBody(CharacterBody body, float distanceAbove)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_0080: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)body))
			{
				return null;
			}
			Vector3 val = body.mainHurtBox.collider.ClosestPointOnBounds(body.transform.position + new Vector3(0f, 10000f, 0f));
			Vector3? val2 = RaycastToDirection(val, distanceAbove, Vector3.up, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask));
			if (val2.HasValue)
			{
				return val2.Value;
			}
			return val + Vector3.up * distanceAbove;
		}

		public static Dictionary<string, Vector3> GetAimSurfaceAlignmentInfo(Ray ray, int layerMask, float distance)
		{
			//IL_0007: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<string, Vector3> dictionary = new Dictionary<string, Vector3>();
			RaycastHit val = default(RaycastHit);
			if (!Physics.Raycast(ray, ref val, distance, layerMask, (QueryTriggerInteraction)1))
			{
				vanillaVoidPlugin.ModLogger.LogInfo((object)$"GetAimSurfaceAlignmentInfo did not hit anything in the aim direction on the specified layer ({layerMask}).");
				return null;
			}
			Vector3 point = ((RaycastHit)(ref val)).point;
			Vector3 val2 = Vector3.Cross(((Ray)(ref ray)).direction, Vector3.up);
			Vector3 val3 = Vector3.ProjectOnPlane(((RaycastHit)(ref val)).normal, val2);
			Vector3 value = Vector3.Cross(val2, val3);
			dictionary.Add("Position", point);
			dictionary.Add("Right", val2);
			dictionary.Add("Forward", value);
			dictionary.Add("Up", val3);
			return dictionary;
		}

		public static string GetPlural(string str)
		{
			if (alreadyPlural.Contains(str))
			{
				return str;
			}
			if (str == "Silence Between Two Strikes")
			{
				return "Silences Between Two Strikes";
			}
			Match match = Regex.Match(str, "(.+) of (.+)", RegexOptions.IgnoreCase);
			if (match.Success)
			{
				return GetPlural(match.Groups[1].Value) + " of " + match.Groups[2].Value;
			}
			match = Regex.Match(str, "^the (.+)", RegexOptions.IgnoreCase);
			if (match.Success)
			{
				return GetPlural(match.Groups[1].Value);
			}
			foreach (string key in rules.Keys)
			{
				if (Regex.Match(str, key, RegexOptions.IgnoreCase).Success)
				{
					return Regex.Replace(str, key, rules[key], RegexOptions.IgnoreCase);
				}
			}
			return str;
		}
	}
	public static class NetworkingHelpers
	{
		public static T GetObjectFromNetIdValue<T>(uint netIdValue)
		{
			//IL_002c: 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)
			NetworkInstanceId key = default(NetworkInstanceId);
			((NetworkInstanceId)(ref key))..ctor(netIdValue);
			NetworkIdentity value = null;
			if (NetworkServer.active)
			{
				NetworkServer.objects.TryGetValue(key, out value);
			}
			else
			{
				ClientScene.objects.TryGetValue(key, out value);
			}
			if (Object.op_Implicit((Object)(object)value))
			{
				T component = ((Component)value).GetComponent<T>();
				if (component != null)
				{
					return component;
				}
			}
			return default(T);
		}
	}
}
namespace vanillaVoid.Utils.Components
{
	public class MaterialControllerComponents
	{
		public class HGControllerFinder : MonoBehaviour
		{
			public Renderer Renderer;

			public Material Material;

			public void Start()
			{
				if (Object.op_Implicit((Object)(object)Renderer))
				{
					Material = Renderer.materials[0];
					if (Object.op_Implicit((Object)(object)Material))
					{
						switch (((Object)Material.shader).name)
						{
						case "Hopoo Games/Deferred/Standard":
						{
							HGStandardController hGStandardController = ((Component)this).gameObject.AddComponent<HGStandardController>();
							hGStandardController.Material = Material;
							hGStandardController.Renderer = Renderer;
							break;
						}
						case "Hopoo Games/FX/Cloud Remap":
						{
							HGCloudRemapController hGCloudRemapController = ((Component)this).gameObject.AddComponent<HGCloudRemapController>();
							hGCloudRemapController.Material = Material;
							hGCloudRemapController.Renderer = Renderer;
							break;
						}
						case "Hopoo Games/FX/Cloud Intersection Remap":
						{
							HGIntersectionController hGIntersectionController = ((Component)this).gameObject.AddComponent<HGIntersectionController>();
							hGIntersectionController.Material = Material;
							hGIntersectionController.Renderer = Renderer;
							break;
						}
						}
					}
				}
				Object.Destroy((Object)(object)this);
			}
		}

		public class HGStandardController : MonoBehaviour
		{
			public enum _RampInfoEnum
			{
				TwoTone = 0,
				SmoothedTwoTone = 1,
				Unlitish = 3,
				Subsurface = 4,
				Grass = 5
			}

			public enum _DecalLayerEnum
			{
				Default,
				Environment,
				Character,
				Misc
			}

			public enum _CullEnum
			{
				Off,
				Front,
				Back
			}

			public enum _PrintDirectionEnum
			{
				BottomUp = 0,
				TopDown = 1,
				BackToFront = 3
			}

			public Material Material;

			public Renderer Renderer;

			public string MaterialName;

			public bool _EnableCutout;

			public Color _Color;

			public Texture _MainTex;

			public Vector2 _MainTexScale;

			public Vector2 _MainTexOffset;

			[Range(0f, 5f)]
			public float _NormalStrength;

			public Texture _NormalTex;

			public Vector2 _NormalTexScale;

			public Vector2 _NormalTexOffset;

			public Color _EmColor;

			public Texture _EmTex;

			[Range(0f, 10f)]
			public float _EmPower;

			[Range(0f, 1f)]
			public float _Smoothness;

			public bool _IgnoreDiffuseAlphaForSpeculars;

			public _RampInfoEnum _RampChoice;

			public _DecalLayerEnum _DecalLayer;

			[Range(0f, 1f)]
			public float _SpecularStrength;

			[Range(0.1f, 20f)]
			public float _SpecularExponent;

			public _CullEnum _Cull_Mode;

			public bool _EnableDither;

			[Range(0f, 1f)]
			public float _FadeBias;

			public bool _EnableFresnelEmission;

			public Texture _FresnelRamp;

			[Range(0.1f, 20f)]
			public float _FresnelPower;

			public Texture _FresnelMask;

			[Range(0f, 20f)]
			public float _FresnelBoost;

			public bool _EnablePrinting;

			[Range(-25f, 25f)]
			public float _SliceHeight;

			[Range(0f, 10f)]
			public float _PrintBandHeight;

			[Range(0f, 1f)]
			public float _PrintAlphaDepth;

			public Texture _PrintAlphaTexture;

			public Vector2 _PrintAlphaTextureScale;

			public Vector2 _PrintAlphaTextureOffset;

			[Range(0f, 10f)]
			public float _PrintColorBoost;

			[Range(0f, 4f)]
			public float _PrintAlphaBias;

			[Range(0f, 1f)]
			public float _PrintEmissionToAlbedoLerp;

			public _PrintDirectionEnum _PrintDirection;

			public Texture _PrintRamp;

			[Range(-10f, 10f)]
			public float _EliteBrightnessMin;

			[Range(-10f, 10f)]
			public float _EliteBrightnessMax;

			public bool _EnableSplatmap;

			public bool _UseVertexColorsInstead;

			[Range(0f, 1f)]
			public float _BlendDepth;

			public Texture _SplatmapTex;

			public Vector2 _SplatmapTexScale;

			public Vector2 _SplatmapTexOffset;

			[Range(0f, 20f)]
			public float _SplatmapTileScale;

			public Texture _GreenChannelTex;

			public Texture _GreenChannelNormalTex;

			[Range(0f, 1f)]
			public float _GreenChannelSmoothness;

			[Range(-2f, 5f)]
			public float _GreenChannelBias;

			public Texture _BlueChannelTex;

			public Texture _BlueChannelNormalTex;

			[Range(0f, 1f)]
			public float _BlueChannelSmoothness;

			[Range(-2f, 5f)]
			public float _BlueChannelBias;

			public bool _EnableFlowmap;

			public Texture _FlowTexture;

			public Texture _FlowHeightmap;

			public Vector2 _FlowHeightmapScale;

			public Vector2 _FlowHeightmapOffset;

			public Texture _FlowHeightRamp;

			public Vector2 _FlowHeightRampScale;

			public Vector2 _FlowHeightRampOffset;

			[Range(-1f, 1f)]
			public float _FlowHeightBias;

			[Range(0.1f, 20f)]
			public float _FlowHeightPower;

			[Range(0.1f, 20f)]
			public float _FlowEmissionStrength;

			[Range(0f, 15f)]
			public float _FlowSpeed;

			[Range(0f, 5f)]
			public float _MaskFlowStrength;

			[Range(0f, 5f)]
			public float _NormalFlowStrength;

			[Range(0f, 10f)]
			public float _FlowTextureScaleFactor;

			public bool _EnableLimbRemoval;

			public void Start()
			{
				GrabMaterialValues();
			}

			public void GrabMaterialValues()
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_0402: Unknown result type (might be due to invalid IL or missing references)
				//IL_0407: Unknown result type (might be due to invalid IL or missing references)
				//IL_0520: Unknown result type (might be due to invalid IL or missing references)
				//IL_0525: Unknown result type (might be due to invalid IL or missing references)
				//IL_0536: Unknown result type (might be due to invalid IL or missing references)
				//IL_053b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0562: Unknown result type (might be due to invalid IL or missing references)
				//IL_0567: 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)
				if (Object.op_Implicit((Object)(object)Material))
				{
					_EnableCutout = Material.IsKeywordEnabled("CUTOUT");
					_Color = Material.GetColor("_Color");
					_MainTex = Material.GetTexture("_MainTex");
					_MainTexScale = Material.GetTextureScale("_MainTex");
					_MainTexOffset = Material.GetTextureOffset("_MainTex");
					_NormalStrength = Material.GetFloat("_NormalStrength");
					_NormalTex = Material.GetTexture("_NormalTex");
					_NormalTexScale = Material.GetTextureScale("_NormalTex");
					_NormalTexOffset = Material.GetTextureOffset("_NormalTex");
					_EmColor = Material.GetColor("_EmColor");
					_EmTex = Material.GetTexture("_EmTex");
					_EmPower = Material.GetFloat("_EmPower");
					_Smoothness = Material.GetFloat("_Smoothness");
					_IgnoreDiffuseAlphaForSpeculars = Material.IsKeywordEnabled("FORCE_SPEC");
					_RampChoice = (_RampInfoEnum)Material.GetFloat("_RampInfo");
					_DecalLayer = (_DecalLayerEnum)Material.GetFloat("_DecalLayer");
					_SpecularStrength = Material.GetFloat("_SpecularStrength");
					_SpecularExponent = Material.GetFloat("_SpecularExponent");
					_Cull_Mode = (_CullEnum)Material.GetFloat("_Cull");
					_EnableDither = Material.IsKeywordEnabled("DITHER");
					_FadeBias = Material.GetFloat("_FadeBias");
					_EnableFresnelEmission = Material.IsKeywordEnabled("FRESNEL_EMISSION");
					_FresnelRamp = Material.GetTexture("_FresnelRamp");
					_FresnelPower = Material.GetFloat("_FresnelPower");
					_FresnelMask = Material.GetTexture("_FresnelMask");
					_FresnelBoost = Material.GetFloat("_FresnelBoost");
					_EnablePrinting = Material.IsKeywordEnabled("PRINT_CUTOFF");
					_SliceHeight = Material.GetFloat("_SliceHeight");
					_PrintBandHeight = Material.GetFloat("_SliceBandHeight");
					_PrintAlphaDepth = Material.GetFloat("_SliceAlphaDepth");
					_PrintAlphaTexture = Material.GetTexture("_SliceAlphaTex");
					_PrintAlphaTextureScale = Material.GetTextureScale("_SliceAlphaTex");
					_PrintAlphaTextureOffset = Material.GetTextureOffset("_SliceAlphaTex");
					_PrintColorBoost = Material.GetFloat("_PrintBoost");
					_PrintAlphaBias = Material.GetFloat("_PrintBias");
					_PrintEmissionToAlbedoLerp = Material.GetFloat("_PrintEmissionToAlbedoLerp");
					_PrintDirection = (_PrintDirectionEnum)Material.GetFloat("_PrintDirection");
					_PrintRamp = Material.GetTexture("_PrintRamp");
					_EliteBrightnessMin = Material.GetFloat("_EliteBrightnessMin");
					_EliteBrightnessMax = Material.GetFloat("_EliteBrightnessMax");
					_EnableSplatmap = Material.IsKeywordEnabled("SPLATMAP");
					_UseVertexColorsInstead = Material.IsKeywordEnabled("USE_VERTEX_COLORS");
					_BlendDepth = Material.GetFloat("_Depth");
					_SplatmapTex = Material.GetTexture("_SplatmapTex");
					_SplatmapTexScale = Material.GetTextureScale("_SplatmapTex");
					_SplatmapTexOffset = Material.GetTextureOffset("_SplatmapTex");
					_SplatmapTileScale = Material.GetFloat("_SplatmapTileScale");
					_GreenChannelTex = Material.GetTexture("_GreenChannelTex");
					_GreenChannelNormalTex = Material.GetTexture("_GreenChannelNormalTex");
					_GreenChannelSmoothness = Material.GetFloat("_GreenChannelSmoothness");
					_GreenChannelBias = Material.GetFloat("_GreenChannelBias");
					_BlueChannelTex = Material.GetTexture("_BlueChannelTex");
					_BlueChannelNormalTex = Material.GetTexture("_BlueChannelNormalTex");
					_BlueChannelSmoothness = Material.GetFloat("_BlueChannelSmoothness");
					_BlueChannelBias = Material.GetFloat("_BlueChannelBias");
					_EnableFlowmap = Material.IsKeywordEnabled("FLOWMAP");
					_FlowTexture = Material.GetTexture("_FlowTex");
					_FlowHeightmap = Material.GetTexture("_FlowHeightmap");
					_FlowHeightmapScale = Material.GetTextureScale("_FlowHeightmap");
					_FlowHeightmapOffset = Material.GetTextureOffset("_FlowHeightmap");
					_FlowHeightRamp = Material.GetTexture("_FlowHeightRamp");
					_FlowHeightRampScale = Material.GetTextureScale("_FlowHeightRamp");
					_FlowHeightRampOffset = Material.GetTextureOffset("_FlowHeightRamp");
					_FlowHeightBias = Material.GetFloat("_FlowHeightBias");
					_FlowHeightPower = Material.GetFloat("_FlowHeightPower");
					_FlowEmissionStrength = Material.GetFloat("_FlowEmissionStrength");
					_FlowSpeed = Material.GetFloat("_FlowSpeed");
					_MaskFlowStrength = Material.GetFloat("_FlowMaskStrength");
					_NormalFlowStrength = Material.GetFloat("_FlowNormalStrength");
					_FlowTextureScaleFactor = Material.GetFloat("_FlowTextureScaleFactor");
					_EnableLimbRemoval = Material.IsKeywordEnabled("LIMBREMOVAL");
					MaterialName = ((Object)Material).name;
				}
			}

			public void Update()
			{
				//IL_007c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_013d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_0182: 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_043e: Unknown result type (might be due to invalid IL or missing references)
				//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_05c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_07e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0854: Unknown result type (might be due to invalid IL or missing references)
				//IL_086b: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)Material))
				{
					if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer))
					{
						GrabMaterialValues();
						PutMaterialIntoMeshRenderer(Renderer, Material);
					}
					SetShaderKeywordBasedOnBool(_EnableCutout, Material, "CUTOUT");
					Material.SetColor("_Color", _Color);
					if (Object.op_Implicit((Object)(object)_MainTex))
					{
						Material.SetTexture("_MainTex", _MainTex);
						Material.SetTextureScale("_MainTex", _MainTexScale);
						Material.SetTextureOffset("_MainTex", _MainTexOffset);
					}
					else
					{
						Material.SetTexture("_MainTex", (Texture)null);
					}
					Material.SetFloat("_NormalStrength", _NormalStrength);
					if (Object.op_Implicit((Object)(object)_NormalTex))
					{
						Material.SetTexture("_NormalTex", _NormalTex);
						Material.SetTextureScale("_NormalTex", _NormalTexScale);
						Material.SetTextureOffset("_NormalTex", _NormalTexOffset);
					}
					else
					{
						Material.SetTexture("_NormalTex", (Texture)null);
					}
					Material.SetColor("_EmColor", _EmColor);
					if (Object.op_Implicit((Object)(object)_EmTex))
					{
						Material.SetTexture("_EmTex", _EmTex);
					}
					else
					{
						Material.SetTexture("_EmTex", (Texture)null);
					}
					Material.SetFloat("_EmPower", _EmPower);
					Material.SetFloat("_Smoothness", _Smoothness);
					SetShaderKeywordBasedOnBool(_IgnoreDiffuseAlphaForSpeculars, Material, "FORCE_SPEC");
					Material.SetFloat("_RampInfo", Convert.ToSingle(_RampChoice));
					Material.SetFloat("_DecalLayer", Convert.ToSingle(_DecalLayer));
					Material.SetFloat("_SpecularStrength", _SpecularStrength);
					Material.SetFloat("_SpecularExponent", _SpecularExponent);
					Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode));
					SetShaderKeywordBasedOnBool(_EnableDither, Material, "DITHER");
					Material.SetFloat("_FadeBias", _FadeBias);
					SetShaderKeywordBasedOnBool(_EnableFresnelEmission, Material, "FRESNEL_EMISSION");
					if (Object.op_Implicit((Object)(object)_FresnelRamp))
					{
						Material.SetTexture("_FresnelRamp", _FresnelRamp);
					}
					else
					{
						Material.SetTexture("_FresnelRamp", (Texture)null);
					}
					Material.SetFloat("_FresnelPower", _FresnelPower);
					if (Object.op_Implicit((Object)(object)_FresnelMask))
					{
						Material.SetTexture("_FresnelMask", _FresnelMask);
					}
					else
					{
						Material.SetTexture("_FresnelMask", (Texture)null);
					}
					Material.SetFloat("_FresnelBoost", _FresnelBoost);
					SetShaderKeywordBasedOnBool(_EnablePrinting, Material, "PRINT_CUTOFF");
					Material.SetFloat("_SliceHeight", _SliceHeight);
					Material.SetFloat("_SliceBandHeight", _PrintBandHeight);
					Material.SetFloat("_SliceAlphaDepth", _PrintAlphaDepth);
					if (Object.op_Implicit((Object)(object)_PrintAlphaTexture))
					{
						Material.SetTexture("_SliceAlphaTex", _PrintAlphaTexture);
						Material.SetTextureScale("_SliceAlphaTex", _PrintAlphaTextureScale);
						Material.SetTextureOffset("_SliceAlphaTex", _PrintAlphaTextureOffset);
					}
					else
					{
						Material.SetTexture("_SliceAlphaTex", (Texture)null);
					}
					Material.SetFloat("_PrintBoost", _PrintColorBoost);
					Material.SetFloat("_PrintBias", _PrintAlphaBias);
					Material.SetFloat("_PrintEmissionToAlbedoLerp", _PrintEmissionToAlbedoLerp);
					Material.SetFloat("_PrintDirection", Convert.ToSingle(_PrintDirection));
					if (Object.op_Implicit((Object)(object)_PrintRamp))
					{
						Material.SetTexture("_PrintRamp", _PrintRamp);
					}
					else
					{
						Material.SetTexture("_PrintRamp", (Texture)null);
					}
					Material.SetFloat("_EliteBrightnessMin", _EliteBrightnessMin);
					Material.SetFloat("_EliteBrightnessMax", _EliteBrightnessMax);
					SetShaderKeywordBasedOnBool(_EnableSplatmap, Material, "SPLATMAP");
					SetShaderKeywordBasedOnBool(_UseVertexColorsInstead, Material, "USE_VERTEX_COLORS");
					Material.SetFloat("_Depth", _BlendDepth);
					if (Object.op_Implicit((Object)(object)_SplatmapTex))
					{
						Material.SetTexture("_SplatmapTex", _SplatmapTex);
						Material.SetTextureScale("_SplatmapTex", _SplatmapTexScale);
						Material.SetTextureOffset("_SplatmapTex", _SplatmapTexOffset);
					}
					else
					{
						Material.SetTexture("_SplatmapTex", (Texture)null);
					}
					Material.SetFloat("_SplatmapTileScale", _SplatmapTileScale);
					if (Object.op_Implicit((Object)(object)_GreenChannelTex))
					{
						Material.SetTexture("_GreenChannelTex", _GreenChannelTex);
					}
					else
					{
						Material.SetTexture("_GreenChannelTex", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_GreenChannelNormalTex))
					{
						Material.SetTexture("_GreenChannelNormalTex", _GreenChannelNormalTex);
					}
					else
					{
						Material.SetTexture("_GreenChannelNormalTex", (Texture)null);
					}
					Material.SetFloat("_GreenChannelSmoothness", _GreenChannelSmoothness);
					Material.SetFloat("_GreenChannelBias", _GreenChannelBias);
					if (Object.op_Implicit((Object)(object)_BlueChannelTex))
					{
						Material.SetTexture("_BlueChannelTex", _BlueChannelTex);
					}
					else
					{
						Material.SetTexture("_BlueChannelTex", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_BlueChannelNormalTex))
					{
						Material.SetTexture("_BlueChannelNormalTex", _BlueChannelNormalTex);
					}
					else
					{
						Material.SetTexture("_BlueChannelNormalTex", (Texture)null);
					}
					Material.SetFloat("_BlueChannelSmoothness", _BlueChannelSmoothness);
					Material.SetFloat("_BlueChannelBias", _BlueChannelBias);
					SetShaderKeywordBasedOnBool(_EnableFlowmap, Material, "FLOWMAP");
					if (Object.op_Implicit((Object)(object)_FlowTexture))
					{
						Material.SetTexture("_FlowTex", _FlowTexture);
					}
					else
					{
						Material.SetTexture("_FlowTex", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_FlowHeightmap))
					{
						Material.SetTexture("_FlowHeightmap", _FlowHeightmap);
						Material.SetTextureScale("_FlowHeightmap", _FlowHeightmapScale);
						Material.SetTextureOffset("_FlowHeightmap", _FlowHeightmapOffset);
					}
					else
					{
						Material.SetTexture("_FlowHeightmap", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_FlowHeightRamp))
					{
						Material.SetTexture("_FlowHeightRamp", _FlowHeightRamp);
						Material.SetTextureScale("_FlowHeightRamp", _FlowHeightRampScale);
						Material.SetTextureOffset("_FlowHeightRamp", _FlowHeightRampOffset);
					}
					else
					{
						Material.SetTexture("_FlowHeightRamp", (Texture)null);
					}
					Material.SetFloat("_FlowHeightBias", _FlowHeightBias);
					Material.SetFloat("_FlowHeightPower", _FlowHeightPower);
					Material.SetFloat("_FlowEmissionStrength", _FlowEmissionStrength);
					Material.SetFloat("_FlowSpeed", _FlowSpeed);
					Material.SetFloat("_FlowMaskStrength", _MaskFlowStrength);
					Material.SetFloat("_FlowNormalStrength", _NormalFlowStrength);
					Material.SetFloat("_FlowTextureScaleFactor", _FlowTextureScaleFactor);
					SetShaderKeywordBasedOnBool(_EnableLimbRemoval, Material, "LIMBREMOVAL");
				}
			}
		}

		public class HGCloudRemapController : MonoBehaviour
		{
			public enum _SrcBlendFloatEnum
			{
				Zero,
				One,
				DstColor,
				SrcColor,
				OneMinusDstColor,
				SrcAlpha,
				OneMinusSrcColor,
				DstAlpha,
				OneMinusDstAlpha,
				SrcAlphaSaturate,
				OneMinusSrcAlpha
			}

			public enum _DstBlendFloatEnum
			{
				Zero,
				One,
				DstColor,
				SrcColor,
				OneMinusDstColor,
				SrcAlpha,
				OneMinusSrcColor,
				DstAlpha,
				OneMinusDstAlpha,
				SrcAlphaSaturate,
				OneMinusSrcAlpha
			}

			public enum _CullEnum
			{
				Off,
				Front,
				Back
			}

			public enum _ZTestEnum
			{
				Disabled,
				Never,
				Less,
				Equal,
				LessEqual,
				Greater,
				NotEqual,
				GreaterEqual,
				Always
			}

			public Material Material;

			public Renderer Renderer;

			public string MaterialName;

			public _SrcBlendFloatEnum _Source_Blend_Mode;

			public _DstBlendFloatEnum _Destination_Blend_Mode;

			public int _InternalSimpleBlendMode;

			public Color _Tint;

			public bool _DisableRemapping;

			public Texture _MainTex;

			public Vector2 _MainTexScale;

			public Vector2 _MainTexOffset;

			public Texture _RemapTex;

			public Vector2 _RemapTexScale;

			public Vector2 _RemapTexOffset;

			[Range(0f, 2f)]
			public float _SoftFactor;

			[Range(1f, 20f)]
			public float _BrightnessBoost;

			[Range(0f, 20f)]
			public float _AlphaBoost;

			[Range(0f, 1f)]
			public float _AlphaBias;

			public bool _UseUV1;

			public bool _FadeWhenNearCamera;

			[Range(0f, 1f)]
			public float _FadeCloseDistance;

			public _CullEnum _Cull_Mode;

			public _ZTestEnum _ZTest_Mode;

			[Range(-10f, 10f)]
			public float _DepthOffset;

			public bool _CloudRemapping;

			public bool _DistortionClouds;

			[Range(-2f, 2f)]
			public float _DistortionStrength;

			public Texture _Cloud1Tex;

			public Vector2 _Cloud1TexScale;

			public Vector2 _Cloud1TexOffset;

			public Texture _Cloud2Tex;

			public Vector2 _Cloud2TexScale;

			public Vector2 _Cloud2TexOffset;

			public Vector4 _CutoffScroll;

			public bool _VertexColors;

			public bool _LuminanceForVertexAlpha;

			public bool _LuminanceForTextureAlpha;

			public bool _VertexOffset;

			public bool _FresnelFade;

			public bool _SkyboxOnly;

			[Range(-20f, 20f)]
			public float _FresnelPower;

			[Range(0f, 3f)]
			public float _VertexOffsetAmount;

			public void Start()
			{
				GrabMaterialValues();
			}

			public void GrabMaterialValues()
			{
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: 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_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0104: Unknown result type (might be due to invalid IL or missing references)
				//IL_024b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0250: Unknown result type (might be due to invalid IL or missing references)
				//IL_0261: Unknown result type (might be due to invalid IL or missing references)
				//IL_0266: Unknown result type (might be due to invalid IL or missing references)
				//IL_028d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0292: 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_02b9: 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)
				if (Object.op_Implicit((Object)(object)Material))
				{
					_Source_Blend_Mode = (_SrcBlendFloatEnum)Material.GetFloat("_SrcBlend");
					_Destination_Blend_Mode = (_DstBlendFloatEnum)Material.GetFloat("_DstBlend");
					_InternalSimpleBlendMode = (int)Material.GetFloat("_InternalSimpleBlendMode");
					_Tint = Material.GetColor("_TintColor");
					_DisableRemapping = Material.IsKeywordEnabled("DISABLEREMAP");
					_MainTex = Material.GetTexture("_MainTex");
					_MainTexScale = Material.GetTextureScale("_MainTex");
					_MainTexOffset = Material.GetTextureOffset("_MainTex");
					_RemapTex = Material.GetTexture("_RemapTex");
					_RemapTexScale = Material.GetTextureScale("_RemapTex");
					_RemapTexOffset = Material.GetTextureOffset("_RemapTex");
					_SoftFactor = Material.GetFloat("_InvFade");
					_BrightnessBoost = Material.GetFloat("_Boost");
					_AlphaBoost = Material.GetFloat("_AlphaBoost");
					_AlphaBias = Material.GetFloat("_AlphaBias");
					_UseUV1 = Material.IsKeywordEnabled("USE_UV1");
					_FadeWhenNearCamera = Material.IsKeywordEnabled("FADECLOSE");
					_FadeCloseDistance = Material.GetFloat("_FadeCloseDistance");
					_Cull_Mode = (_CullEnum)Material.GetFloat("_Cull");
					_ZTest_Mode = (_ZTestEnum)Material.GetFloat("_ZTest");
					_DepthOffset = Material.GetFloat("_DepthOffset");
					_CloudRemapping = Material.IsKeywordEnabled("USE_CLOUDS");
					_DistortionClouds = Material.IsKeywordEnabled("CLOUDOFFSET");
					_DistortionStrength = Material.GetFloat("_DistortionStrength");
					_Cloud1Tex = Material.GetTexture("_Cloud1Tex");
					_Cloud1TexScale = Material.GetTextureScale("_Cloud1Tex");
					_Cloud1TexOffset = Material.GetTextureOffset("_Cloud1Tex");
					_Cloud2Tex = Material.GetTexture("_Cloud2Tex");
					_Cloud2TexScale = Material.GetTextureScale("_Cloud2Tex");
					_Cloud2TexOffset = Material.GetTextureOffset("_Cloud2Tex");
					_CutoffScroll = Material.GetVector("_CutoffScroll");
					_VertexColors = Material.IsKeywordEnabled("VERTEXCOLOR");
					_LuminanceForVertexAlpha = Material.IsKeywordEnabled("VERTEXALPHA");
					_LuminanceForTextureAlpha = Material.IsKeywordEnabled("CALCTEXTUREALPHA");
					_VertexOffset = Material.IsKeywordEnabled("VERTEXOFFSET");
					_FresnelFade = Material.IsKeywordEnabled("FRESNEL");
					_SkyboxOnly = Material.IsKeywordEnabled("SKYBOX_ONLY");
					_FresnelPower = Material.GetFloat("_FresnelPower");
					_VertexOffsetAmount = Material.GetFloat("_OffsetAmount");
					MaterialName = ((Object)Material).name;
				}
			}

			public void Update()
			{
				//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Unknown result type (might be due to invalid IL or missing references)
				//IL_032d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0344: 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_03b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_03e0: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)Material))
				{
					if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer))
					{
						GrabMaterialValues();
						PutMaterialIntoMeshRenderer(Renderer, Material);
					}
					Material.SetFloat("_SrcBlend", Convert.ToSingle(_Source_Blend_Mode));
					Material.SetFloat("_DstBlend", Convert.ToSingle(_Destination_Blend_Mode));
					Material.SetFloat("_InternalSimpleBlendMode", (float)_InternalSimpleBlendMode);
					Material.SetColor("_TintColor", _Tint);
					SetShaderKeywordBasedOnBool(_DisableRemapping, Material, "DISABLEREMAP");
					if (Object.op_Implicit((Object)(object)_MainTex))
					{
						Material.SetTexture("_MainTex", _MainTex);
						Material.SetTextureScale("_MainTex", _MainTexScale);
						Material.SetTextureOffset("_MainTex", _MainTexOffset);
					}
					else
					{
						Material.SetTexture("_MainTex", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_RemapTex))
					{
						Material.SetTexture("_RemapTex", _RemapTex);
						Material.SetTextureScale("_RemapTex", _RemapTexScale);
						Material.SetTextureOffset("_RemapTex", _RemapTexOffset);
					}
					else
					{
						Material.SetTexture("_RemapTex", (Texture)null);
					}
					Material.SetFloat("_InvFade", _SoftFactor);
					Material.SetFloat("_Boost", _BrightnessBoost);
					Material.SetFloat("_AlphaBoost", _AlphaBoost);
					Material.SetFloat("_AlphaBias", _AlphaBias);
					SetShaderKeywordBasedOnBool(_UseUV1, Material, "USE_UV1");
					SetShaderKeywordBasedOnBool(_FadeWhenNearCamera, Material, "FADECLOSE");
					Material.SetFloat("_FadeCloseDistance", _FadeCloseDistance);
					Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode));
					Material.SetFloat("_ZTest", Convert.ToSingle(_ZTest_Mode));
					Material.SetFloat("_DepthOffset", _DepthOffset);
					SetShaderKeywordBasedOnBool(_CloudRemapping, Material, "USE_CLOUDS");
					SetShaderKeywordBasedOnBool(_DistortionClouds, Material, "CLOUDOFFSET");
					Material.SetFloat("_DistortionStrength", _DistortionStrength);
					if (Object.op_Implicit((Object)(object)_Cloud1Tex))
					{
						Material.SetTexture("_Cloud1Tex", _Cloud1Tex);
						Material.SetTextureScale("_Cloud1Tex", _Cloud1TexScale);
						Material.SetTextureOffset("_Cloud1Tex", _Cloud1TexOffset);
					}
					else
					{
						Material.SetTexture("_Cloud1Tex", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_Cloud2Tex))
					{
						Material.SetTexture("_Cloud2Tex", _Cloud2Tex);
						Material.SetTextureScale("_Cloud2Tex", _Cloud2TexScale);
						Material.SetTextureOffset("_Cloud2Tex", _Cloud2TexOffset);
					}
					else
					{
						Material.SetTexture("_Cloud2Tex", (Texture)null);
					}
					Material.SetVector("_CutoffScroll", _CutoffScroll);
					SetShaderKeywordBasedOnBool(_VertexColors, Material, "VERTEXCOLOR");
					SetShaderKeywordBasedOnBool(_LuminanceForVertexAlpha, Material, "VERTEXALPHA");
					SetShaderKeywordBasedOnBool(_LuminanceForTextureAlpha, Material, "CALCTEXTUREALPHA");
					SetShaderKeywordBasedOnBool(_VertexOffset, Material, "VERTEXOFFSET");
					SetShaderKeywordBasedOnBool(_FresnelFade, Material, "FRESNEL");
					SetShaderKeywordBasedOnBool(_SkyboxOnly, Material, "SKYBOX_ONLY");
					Material.SetFloat("_FresnelPower", _FresnelPower);
					Material.SetFloat("_OffsetAmount", _VertexOffsetAmount);
				}
			}
		}

		public class HGIntersectionController : MonoBehaviour
		{
			public enum _SrcBlendFloatEnum
			{
				Zero,
				One,
				DstColor,
				SrcColor,
				OneMinusDstColor,
				SrcAlpha,
				OneMinusSrcColor,
				DstAlpha,
				OneMinusDstAlpha,
				SrcAlphaSaturate,
				OneMinusSrcAlpha
			}

			public enum _DstBlendFloatEnum
			{
				Zero,
				One,
				DstColor,
				SrcColor,
				OneMinusDstColor,
				SrcAlpha,
				OneMinusSrcColor,
				DstAlpha,
				OneMinusDstAlpha,
				SrcAlphaSaturate,
				OneMinusSrcAlpha
			}

			public enum _CullEnum
			{
				Off,
				Front,
				Back
			}

			public Material Material;

			public Renderer Renderer;

			public string MaterialName;

			public _SrcBlendFloatEnum _Source_Blend_Mode;

			public _DstBlendFloatEnum _Destination_Blend_Mode;

			public Color _Tint;

			public Texture _MainTex;

			public Vector2 _MainTexScale;

			public Vector2 _MainTexOffset;

			public Texture _Cloud1Tex;

			public Vector2 _Cloud1TexScale;

			public Vector2 _Cloud1TexOffset;

			public Texture _Cloud2Tex;

			public Vector2 _Cloud2TexScale;

			public Vector2 _Cloud2TexOffset;

			public Texture _RemapTex;

			public Vector2 _RemapTexScale;

			public Vector2 _RemapTexOffset;

			public Vector4 _CutoffScroll;

			[Range(0f, 30f)]
			public float _SoftFactor;

			[Range(0.1f, 20f)]
			public float _SoftPower;

			[Range(0f, 5f)]
			public float _BrightnessBoost;

			[Range(0.1f, 20f)]
			public float _RimPower;

			[Range(0f, 5f)]
			public float _RimStrength;

			[Range(0f, 20f)]
			public float _AlphaBoost;

			[Range(0f, 20f)]
			public float _IntersectionStrength;

			public _CullEnum _Cull_Mode;

			public bool _FadeFromVertexColorsOn;

			public bool _EnableTriplanarProjectionsForClouds;

			public void Start()
			{
				GrabMaterialValues();
			}

			public void GrabMaterialValues()
			{
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_007f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d7: 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_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: Unknown result type (might be due to invalid IL or missing references)
				//IL_0140: Unknown result type (might be due to invalid IL or missing references)
				//IL_0145: Unknown result type (might be due to invalid IL or missing references)
				//IL_0156: Unknown result type (might be due to invalid IL or missing references)
				//IL_015b: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0171: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)Material))
				{
					_Source_Blend_Mode = (_SrcBlendFloatEnum)Material.GetFloat("_SrcBlendFloat");
					_Destination_Blend_Mode = (_DstBlendFloatEnum)Material.GetFloat("_DstBlendFloat");
					_Tint = Material.GetColor("_TintColor");
					_MainTex = Material.GetTexture("_MainTex");
					_MainTexScale = Material.GetTextureScale("_MainTex");
					_MainTexOffset = Material.GetTextureOffset("_MainTex");
					_Cloud1Tex = Material.GetTexture("_Cloud1Tex");
					_Cloud1TexScale = Material.GetTextureScale("_Cloud1Tex");
					_Cloud1TexOffset = Material.GetTextureOffset("_Cloud1Tex");
					_Cloud2Tex = Material.GetTexture("_Cloud2Tex");
					_Cloud2TexScale = Material.GetTextureScale("_Cloud2Tex");
					_Cloud2TexOffset = Material.GetTextureOffset("_Cloud2Tex");
					_RemapTex = Material.GetTexture("_RemapTex");
					_RemapTexScale = Material.GetTextureScale("_RemapTex");
					_RemapTexOffset = Material.GetTextureOffset("_RemapTex");
					_CutoffScroll = Material.GetVector("_CutoffScroll");
					_SoftFactor = Material.GetFloat("_InvFade");
					_SoftPower = Material.GetFloat("_SoftPower");
					_BrightnessBoost = Material.GetFloat("_Boost");
					_RimPower = Material.GetFloat("_RimPower");
					_RimStrength = Material.GetFloat("_RimStrength");
					_AlphaBoost = Material.GetFloat("_AlphaBoost");
					_IntersectionStrength = Material.GetFloat("_IntersectionStrength");
					_Cull_Mode = (_CullEnum)Material.GetFloat("_Cull");
					_FadeFromVertexColorsOn = Material.IsKeywordEnabled("FADE_FROM_VERTEX_COLORS");
					_EnableTriplanarProjectionsForClouds = Material.IsKeywordEnabled("TRIPLANAR");
					MaterialName = ((Object)Material).name;
				}
			}

			public void Update()
			{
				//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0151: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_022d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0244: Unknown result type (might be due to invalid IL or missing references)
				//IL_0272: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)Material))
				{
					if (((Object)Material).name != MaterialName && Object.op_Implicit((Object)(object)Renderer))
					{
						GrabMaterialValues();
						PutMaterialIntoMeshRenderer(Renderer, Material);
					}
					Material.SetFloat("_SrcBlendFloat", Convert.ToSingle(_Source_Blend_Mode));
					Material.SetFloat("_DstBlendFloat", Convert.ToSingle(_Destination_Blend_Mode));
					Material.SetColor("_TintColor", _Tint);
					if (Object.op_Implicit((Object)(object)_MainTex))
					{
						Material.SetTexture("_MainTex", _MainTex);
						Material.SetTextureScale("_MainTex", _MainTexScale);
						Material.SetTextureOffset("_MainTex", _MainTexOffset);
					}
					else
					{
						Material.SetTexture("_MainTex", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_Cloud1Tex))
					{
						Material.SetTexture("_Cloud1Tex", _Cloud1Tex);
						Material.SetTextureScale("_Cloud1Tex", _Cloud1TexScale);
						Material.SetTextureOffset("_Cloud1Tex", _Cloud1TexOffset);
					}
					else
					{
						Material.SetTexture("_Cloud1Tex", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_Cloud2Tex))
					{
						Material.SetTexture("_Cloud2Tex", _Cloud2Tex);
						Material.SetTextureScale("_Cloud2Tex", _Cloud2TexScale);
						Material.SetTextureOffset("_Cloud2Tex", _Cloud2TexOffset);
					}
					else
					{
						Material.SetTexture("_Cloud2Tex", (Texture)null);
					}
					if (Object.op_Implicit((Object)(object)_RemapTex))
					{
						Material.SetTexture("_RemapTex", _RemapTex);
						Material.SetTextureScale("_RemapTex", _RemapTexScale);
						Material.SetTextureOffset("_RemapTex", _RemapTexOffset);
					}
					else
					{
						Material.SetTexture("_RemapTex", (Texture)null);
					}
					Material.SetVector("_CutoffScroll", _CutoffScroll);
					Material.SetFloat("_InvFade", _SoftFactor);
					Material.SetFloat("_SoftPower", _SoftPower);
					Material.SetFloat("_Boost", _BrightnessBoost);
					Material.SetFloat("_RimPower", _RimPower);
					Material.SetFloat("_RimStrength", _RimStrength);
					Material.SetFloat("_AlphaBoost", _AlphaBoost);
					Material.SetFloat("_IntersectionStrength", _IntersectionStrength);
					Material.SetFloat("_Cull", Convert.ToSingle(_Cull_Mode));
					SetShaderKeywordBasedOnBool(_FadeFromVertexColorsOn, Material, "FADE_FROM_VERTEX_COLORS");
					SetShaderKeywordBasedOnBool(_EnableTriplanarProjectionsForClouds, Material, "TRIPLANAR");
				}
			}
		}

		public static void SetShaderKeywordBasedOnBool(bool enabled, Material material, string keyword)
		{
			if (!Object.op_Implicit((Object)(object)material))
			{
				return;
			}
			if (enabled)
			{
				if (!material.IsKeywordEnabled(keyword))
				{
					material.EnableKeyword(keyword);
				}
			}
			else if (material.IsKeywordEnabled(keyword))
			{
				material.DisableKeyword(keyword);
			}
		}

		public static void PutMaterialIntoMeshRenderer(Renderer renderer, Material material)
		{
			if (Object.op_Implicit((Object)(object)material