Decompiled source of PossumPal v1.0.0

plugins/PossumPal.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PossumPal")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PossumPal")]
[assembly: AssemblyTitle("PossumPal")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PossumPal
{
	[BepInPlugin("com.possumpal.ror2", "Possum Pal - Furry Commando", "1.0.0")]
	public sealed class PossumPalPlugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.possumpal.ror2";

		public const string PluginName = "Possum Pal - Furry Commando";

		public const string PluginVersion = "1.0.0";

		private ConfigEntry<bool> costumeEnabled;

		private ConfigEntry<float> costumeScale;

		private ConfigEntry<bool> wagTail;

		private ConfigEntry<float> headHeight;

		private ConfigEntry<float> headForward;

		private ConfigEntry<float> tailBack;

		private ConfigEntry<string> furHex;

		private ConfigEntry<string> innerEarHex;

		private ConfigEntry<string> noseHex;

		private Material fur;

		private Material white;

		private Material pink;

		private Material dark;

		private Material eyes;

		private Material ear;

		private void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: 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_024a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			costumeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "Enabled", true, "Add a possum costume to every Commando (including teammates) on this client.");
			costumeScale = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "CostumeScale", 1f, new ConfigDescription("Scale the ears, face and tail.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2f), Array.Empty<object>()));
			wagTail = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "WagTail", true, "Animate the curled tail locally.");
			headHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "HeadHeight", 0.06f, "Move the possum head up/down relative to the Commando head bone, in Unity units.");
			headForward = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "HeadForward", 0f, "Move the possum head forward/back relative to the Commando head bone.");
			tailBack = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "TailBack", -0.14f, "Offset the base of the tail behind the hips.");
			furHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "Fur", "#BEBAB8", "Main coat in hex RGB, e.g. #BEBAB8.");
			innerEarHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "InnerEar", "#E39AAA", "Inner ears in hex RGB.");
			noseHex = ((BaseUnityPlugin)this).Config.Bind<string>("Colors", "NoseAndTail", "#E8A0B0", "Nose and bare tail in hex RGB.");
			try
			{
				Shader val = LoadGameShader();
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = Shader.Find("Hopoo Games/Deferred/Standard");
				}
				if (!Object.op_Implicit((Object)(object)val))
				{
					val = Shader.Find("Standard");
				}
				if (!Object.op_Implicit((Object)(object)val))
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"No compatible shader found. Possum costume will be disabled.");
					return;
				}
				fur = NewMaterial(val, ColorFromHex(furHex.Value, new Color(0.74f, 0.72f, 0.72f)));
				white = NewMaterial(val, new Color(0.96f, 0.94f, 0.91f));
				pink = NewMaterial(val, ColorFromHex(noseHex.Value, new Color(0.91f, 0.63f, 0.69f)));
				dark = NewMaterial(val, new Color(0.16f, 0.13f, 0.16f));
				eyes = NewMaterial(val, Color.white);
				ear = NewMaterial(val, ColorFromHex(innerEarHex.Value, new Color(0.9f, 0.6f, 0.66f)));
				CharacterBody.onBodyStartGlobal += OnBodyStart;
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Possum Pal loaded! The look is local cosmetics and works in multiplayer.");
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Failed to initialize Possum Pal: " + ex));
			}
		}

		private void OnDestroy()
		{
			CharacterBody.onBodyStartGlobal -= OnBodyStart;
			DestroyMaterial(fur);
			DestroyMaterial(white);
			DestroyMaterial(pink);
			DestroyMaterial(dark);
			DestroyMaterial(eyes);
			DestroyMaterial(ear);
		}

		private Shader LoadGameShader()
		{
			//IL_0005: 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)
			try
			{
				return Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion();
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not load HGStandard through Addressables, trying fallbacks: " + ex.Message));
				return null;
			}
		}

		private static void DestroyMaterial(Material material)
		{
			if (Object.op_Implicit((Object)(object)material))
			{
				Object.Destroy((Object)(object)material);
			}
		}

		private unsafe static Material NewMaterial(Shader shader, Color color)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_0040: 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)
			Material val = new Material(shader)
			{
				name = "PossumPal/" + ((object)(*(Color*)(&color))/*cast due to .constrained prefix*/).ToString()
			};
			if (val.HasProperty("_Color"))
			{
				val.SetColor("_Color", color);
			}
			else
			{
				val.color = color;
			}
			if (val.HasProperty("_Glossiness"))
			{
				val.SetFloat("_Glossiness", 0.15f);
			}
			if (val.HasProperty("_Smoothness"))
			{
				val.SetFloat("_Smoothness", 0.15f);
			}
			return val;
		}

		private static Color ColorFromHex(string value, Color fallback)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Color result = default(Color);
			if (!ColorUtility.TryParseHtmlString(value ?? "", ref result))
			{
				return fallback;
			}
			return result;
		}

		private void OnBodyStart(CharacterBody body)
		{
			if (costumeEnabled.Value && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)fur) && ((Object)((Component)body).gameObject).name.StartsWith("CommandoBody", StringComparison.Ordinal))
			{
				((MonoBehaviour)this).StartCoroutine(AddCostumeWhenReady(body));
			}
		}

		private IEnumerator AddCostumeWhenReady(CharacterBody body)
		{
			for (int i = 0; i < 40; i++)
			{
				if (!Object.op_Implicit((Object)(object)body))
				{
					break;
				}
				ModelLocator modelLocator = body.modelLocator;
				Transform val = (Object.op_Implicit((Object)(object)modelLocator) ? modelLocator.modelTransform : null);
				if (Object.op_Implicit((Object)(object)val))
				{
					if (Object.op_Implicit((Object)(object)((Component)val).GetComponent<PossumCostumeMarker>()))
					{
						break;
					}
					try
					{
						AttachCostume(val);
						break;
					}
					catch (Exception ex)
					{
						((BaseUnityPlugin)this).Logger.LogError((object)("Could not attach possum costume: " + ex));
						break;
					}
				}
				yield return (object)new WaitForSeconds(0.1f);
			}
		}

		private void AttachCostume(Transform model)
		{
			//IL_0073: 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_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_00c2: 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_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Unknown result type (might be due to invalid IL or missing references)
			//IL_0583: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0687: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cc: Unknown result type (might be due to invalid IL or missing references)
			ChildLocator component = ((Component)model).GetComponent<ChildLocator>();
			Transform val = FindBone(component, model, "Head", "head", "HeadCenter");
			if (!Object.op_Implicit((Object)(object)val))
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Commando head bone not found; skipping possum costume.");
				return;
			}
			((Component)model).gameObject.AddComponent<PossumCostumeMarker>();
			Transform val2 = Pivot("PossumPal_Head", val, new Vector3(0f, headHeight.Value, headForward.Value));
			val2.localScale = Vector3.one * costumeScale.Value;
			Orb("FurHead", val2, new Vector3(0f, 0.1f, 0.015f), new Vector3(0.48f, 0.46f, 0.43f), fur);
			Orb("WhiteFace", val2, new Vector3(0f, 0.075f, 0.19f), new Vector3(0.35f, 0.31f, 0.17f), white);
			for (int i = -1; i <= 1; i += 2)
			{
				float num = (float)i * 0.215f;
				Orb("EarOutside", val2, new Vector3(num, 0.365f, 0.012f), new Vector3(0.185f, 0.285f, 0.105f), dark, Quaternion.Euler(0f, 0f, (float)i * -18f));
				Orb("EarFur", val2, new Vector3(num, 0.371f, 0.035f), new Vector3(0.163f, 0.261f, 0.094f), fur, Quaternion.Euler(0f, 0f, (float)i * -18f));
				Orb("InnerEar", val2, new Vector3(num, 0.381f, 0.102f), new Vector3(0.104f, 0.18f, 0.032f), ear, Quaternion.Euler(0f, 0f, (float)i * -18f));
				Orb("EyeMask", val2, new Vector3((float)i * 0.118f, 0.175f, 0.327f), new Vector3(0.125f, 0.144f, 0.052f), dark);
				Orb("Eye", val2, new Vector3((float)i * 0.117f, 0.182f, 0.374f), new Vector3(0.058f, 0.066f, 0.038f), eyes);
				Orb("Pupil", val2, new Vector3((float)i * 0.114f, 0.184f, 0.402f), new Vector3(0.031f, 0.041f, 0.02f), dark);
				Orb("EyeShine", val2, new Vector3((float)i * 0.104f, 0.201f, 0.418f), new Vector3(0.014f, 0.017f, 0.01f), eyes);
			}
			Orb("CheekL", val2, new Vector3(-0.075f, -0.01f, 0.285f), new Vector3(0.17f, 0.13f, 0.16f), white);
			Orb("CheekR", val2, new Vector3(0.075f, -0.01f, 0.285f), new Vector3(0.17f, 0.13f, 0.16f), white);
			Orb("Muzzle", val2, new Vector3(0f, -0.005f, 0.35f), new Vector3(0.17f, 0.122f, 0.255f), white);
			Orb("Nose", val2, new Vector3(0f, 0.01f, 0.49f), new Vector3(0.105f, 0.074f, 0.072f), pink);
			for (int j = -1; j <= 1; j += 2)
			{
				for (int k = -1; k <= 1; k++)
				{
					Transform val3 = Pivot("Whisker", val2, new Vector3((float)j * 0.105f, -0.028f + (float)k * 0.027f, 0.42f));
					val3.localRotation = Quaternion.Euler((float)k * -11f, (float)j * 20f, (float)(j * -k) * 12f);
					Orb("WhiskerStrand", val3, new Vector3((float)j * 0.103f, 0f, 0f), new Vector3(0.216f, 0.006f, 0.006f), dark);
				}
			}
			Transform val4 = FindBone(component, model, "Chest", "UpperChest", "Spine2");
			if (Object.op_Implicit((Object)(object)val4))
			{
				Transform val5 = Pivot("PossumPal_Chest", val4, new Vector3(0f, 0.03f, 0.13f));
				val5.localScale = Vector3.one * costumeScale.Value;
				Orb("ChestFluff", val5, Vector3.zero, new Vector3(0.28f, 0.32f, 0.09f), white);
				Orb("FluffTip", val5, new Vector3(0f, -0.13f, 0.035f), new Vector3(0.16f, 0.2f, 0.09f), white);
			}
			Transform val6 = FindBone(component, model, "Pelvis", "Hips", "Hip", "Stomach", "Root");
			bool num2 = Object.op_Implicit((Object)(object)val6);
			if (!Object.op_Implicit((Object)(object)val6))
			{
				val6 = model;
			}
			Vector3 position = (num2 ? new Vector3(0f, -0.03f, tailBack.Value) : new Vector3(0f, 0.92f, tailBack.Value));
			Transform val7 = Pivot("PossumPal_Tail", val6, position);
			val7.localScale = Vector3.one * costumeScale.Value;
			TailBuilder.Build(val7, fur, pink);
			if (wagTail.Value)
			{
				((Component)val7).gameObject.AddComponent<PossumTailWag>();
			}
		}

		private static Transform FindBone(ChildLocator locator, Transform model, params string[] names)
		{
			string[] array;
			if (Object.op_Implicit((Object)(object)locator))
			{
				array = names;
				foreach (string text in array)
				{
					Transform val = locator.FindChild(text);
					if (Object.op_Implicit((Object)(object)val))
					{
						return val;
					}
				}
			}
			array = names;
			foreach (string wanted in array)
			{
				Transform val2 = FindDescendant(model, wanted);
				if (Object.op_Implicit((Object)(object)val2))
				{
					return val2;
				}
			}
			return null;
		}

		private static Transform FindDescendant(Transform parent, string wanted)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			foreach (Transform item in parent)
			{
				Transform val = item;
				if (string.Equals(((Object)val).name, wanted, StringComparison.OrdinalIgnoreCase))
				{
					return val;
				}
				Transform val2 = FindDescendant(val, wanted);
				if (Object.op_Implicit((Object)(object)val2))
				{
					return val2;
				}
			}
			return null;
		}

		private static Transform Pivot(string name, Transform parent, Vector3 position)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: 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_0020: 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_002c: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name)
			{
				layer = 2
			};
			val.transform.SetParent(parent, false);
			val.transform.localPosition = position;
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = Vector3.one;
			return val.transform;
		}

		private static GameObject Orb(string name, Transform parent, Vector3 position, Vector3 scale, Material material, Quaternion? rotation = null)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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)
			GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0);
			((Object)obj).name = "PossumPal_" + name;
			obj.layer = 2;
			obj.transform.SetParent(parent, false);
			obj.transform.localPosition = position;
			obj.transform.localScale = scale;
			obj.transform.localRotation = (Quaternion)(((??)rotation) ?? Quaternion.identity);
			Collider component = obj.GetComponent<Collider>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.enabled = false;
				Object.Destroy((Object)(object)component);
			}
			((Renderer)obj.GetComponent<MeshRenderer>()).sharedMaterial = material;
			return obj;
		}
	}
	internal sealed class PossumCostumeMarker : MonoBehaviour
	{
	}
	internal sealed class PossumTailWag : MonoBehaviour
	{
		private Quaternion initialRotation;

		private float phase;

		private void Start()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			initialRotation = ((Component)this).transform.localRotation;
			phase = (float)Mathf.Abs(((Object)((Component)this).transform).GetInstanceID() % 101) * 0.061f;
		}

		private void LateUpdate()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localRotation = initialRotation * Quaternion.Euler(0f, Mathf.Sin(Time.time * 3.2f + phase) * 12f, 0f);
		}
	}
	internal sealed class PossumProceduralMesh : MonoBehaviour
	{
		public Mesh OwnedMesh;

		private void OnDestroy()
		{
			if (Object.op_Implicit((Object)(object)OwnedMesh))
			{
				Object.Destroy((Object)(object)OwnedMesh);
			}
		}
	}
	internal static class TailBuilder
	{
		private const int Segments = 26;

		private const int Sides = 10;

		public static void Build(Transform parent, Material fur, Material pink)
		{
			//IL_008a: 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)
			Vector3[] array = (Vector3[])(object)new Vector3[27];
			float[] array2 = new float[27];
			for (int i = 0; i <= 26; i++)
			{
				float num = (float)i / 26f;
				float num2 = Mathf.Max(0f, (num - 0.72f) / 0.28f);
				array[i] = new Vector3(0.105f * Mathf.Sin(num * 3.25f), -0.06f - 0.18f * Mathf.Sin(num * MathF.PI) + 0.35f * num * num * num, -0.04f - 0.76f * num + 0.27f * num2 * num2);
				array2[i] = Mathf.Lerp(0.09f, 0.012f, num);
			}
			AddTube("FurryBase", parent, array, array2, 0, 9, fur);
			AddTube("PinkTail", parent, array, array2, 9, 26, pink);
		}

		private static void AddTube(string name, Transform parent, Vector3[] positions, float[] radii, int begin, int end, Material material)
		{
			//IL_0043: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00a1: 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)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Expected O, but got Unknown
			//IL_0249: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			int num = end - begin + 1;
			Vector3[] array = (Vector3[])(object)new Vector3[num * 10];
			Vector2[] array2 = (Vector2[])(object)new Vector2[array.Length];
			int[] array3 = new int[(num - 1) * 10 * 6];
			for (int i = 0; i < num; i++)
			{
				int num2 = begin + i;
				Vector3 val = positions[Mathf.Max(0, num2 - 1)];
				Vector3 val2 = positions[Mathf.Min(positions.Length - 1, num2 + 1)] - val;
				Vector3 normalized = ((Vector3)(ref val2)).normalized;
				Vector3 val3 = Vector3.Cross(normalized, Vector3.up);
				if (((Vector3)(ref val3)).sqrMagnitude < 0.0001f)
				{
					val3 = Vector3.Cross(normalized, Vector3.right);
				}
				((Vector3)(ref val3)).Normalize();
				val2 = Vector3.Cross(normalized, val3);
				Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
				for (int j = 0; j < 10; j++)
				{
					float num3 = (float)j * MathF.PI * 2f / 10f;
					int num4 = i * 10 + j;
					array[num4] = positions[num2] + radii[num2] * (Mathf.Cos(num3) * val3 + Mathf.Sin(num3) * normalized2);
					array2[num4] = new Vector2((float)j / 10f, (float)num2 / 26f);
				}
			}
			int num5 = 0;
			for (int k = 0; k < num - 1; k++)
			{
				for (int l = 0; l < 10; l++)
				{
					int num6 = k * 10 + l;
					int num7 = k * 10 + (l + 1) % 10;
					int num8 = (k + 1) * 10 + l;
					int num9 = (k + 1) * 10 + (l + 1) % 10;
					array3[num5++] = num6;
					array3[num5++] = num7;
					array3[num5++] = num8;
					array3[num5++] = num7;
					array3[num5++] = num9;
					array3[num5++] = num8;
				}
			}
			Mesh val4 = new Mesh
			{
				name = "PossumPal_" + name
			};
			val4.vertices = array;
			val4.uv = array2;
			val4.triangles = array3;
			val4.RecalculateNormals();
			val4.RecalculateBounds();
			GameObject val5 = new GameObject("PossumPal_" + name)
			{
				layer = 2
			};
			val5.transform.SetParent(parent, false);
			val5.AddComponent<MeshFilter>().sharedMesh = val4;
			((Renderer)val5.AddComponent<MeshRenderer>()).sharedMaterial = material;
			val5.AddComponent<PossumProceduralMesh>().OwnedMesh = val4;
		}
	}
}