Decompiled source of BetterPlayerModel v2.0.2

BetterPlayerModel.dll

Decompiled 5 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("BetterPlayerModel")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterPlayerModel")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("0c885750-dcdd-4727-9404-206f99fc6144")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BetterPlayerModel
{
	public class LethalCreature
	{
		public class CreatureController : MonoBehaviour
		{
			private GameObject playerObject;

			private SkinnedMeshRenderer thisPlayerModel;

			public SkinnedMeshRenderer myPlayerModel;

			private Transform badge;

			private Transform badge2;

			private void Start()
			{
				//IL_0057: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
				((Component)this).gameObject.GetComponentInChildren<LODGroup>().enabled = false;
				SkinnedMeshRenderer[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
				for (int i = 0; i < componentsInChildren.Length; i++)
				{
					((Renderer)componentsInChildren[i]).enabled = false;
				}
				playerObject = Object.Instantiate<GameObject>(BetterModelBase.playerModel);
				playerObject.transform.localScale = Vector3.one * 0.16f;
				Transform val = ((Component)this).gameObject.transform.Find("ScavengerModel").Find("metarig");
				playerObject.transform.SetParent(val);
				playerObject.transform.localPosition = new Vector3(0f, 0f, 0f);
				playerObject.transform.localEulerAngles = Vector3.zero;
				thisPlayerModel = ((Component)this).gameObject.GetComponent<PlayerControllerB>().thisPlayerModel;
				Shader shader = ((Renderer)thisPlayerModel).material.shader;
				SkinnedMeshRenderer componentInChildren = playerObject.GetComponentInChildren<SkinnedMeshRenderer>();
				((Renderer)componentInChildren).materials[0].shader = shader;
				((Renderer)componentInChildren).materials[0].SetTexture("_BaseColorMap", (Texture)(object)BetterModelBase.textures[0]);
				((Renderer)componentInChildren).materials[0].SetFloat("_Smoothness", 0.3f);
				((Renderer)componentInChildren).materials[1] = ((Renderer)componentInChildren).materials[0];
				((Renderer)componentInChildren).materials[1].shader = shader;
				((Renderer)componentInChildren).materials[1].SetTexture("_BaseColorMap", (Texture)(object)BetterModelBase.textures[1]);
				((Renderer)componentInChildren).materials[1].SetFloat("_Smoothness", 0.3f);
				((Renderer)componentInChildren).materials[2] = ((Renderer)componentInChildren).materials[0];
				((Renderer)componentInChildren).materials[2].shader = shader;
				((Renderer)componentInChildren).materials[2].SetTexture("_BaseColorMap", (Texture)(object)BetterModelBase.textures[2]);
				((Renderer)componentInChildren).materials[2].SetFloat("_Smoothness", 0.3f);
				HDMaterial.ValidateMaterial(((Renderer)componentInChildren).materials[0]);
				HDMaterial.ValidateMaterial(((Renderer)componentInChildren).materials[1]);
				HDMaterial.ValidateMaterial(((Renderer)componentInChildren).materials[2]);
				playerObject.GetComponentInChildren<Animator>().runtimeAnimatorController = BetterModelBase.animationController;
				Transform val2 = val.Find("spine").Find("thigh.L");
				Transform obj = val.Find("spine").Find("thigh.R");
				Transform val3 = val2.Find("shin.L");
				Transform obj2 = obj.Find("shin.R");
				val3.Find("foot.L");
				obj2.Find("foot.R");
				Transform obj3 = val.Find("spine").Find("spine.001").Find("spine.002")
					.Find("spine.003");
				Transform val4 = obj3.Find("shoulder.L");
				Transform obj4 = obj3.Find("shoulder.R");
				Transform val5 = val4.Find("arm.L_upper");
				Transform obj5 = obj4.Find("arm.R_upper");
				Transform val6 = val5.Find("arm.L_lower");
				Transform obj6 = obj5.Find("arm.R_lower");
				val6.Find("hand.L");
				obj6.Find("hand.R");
				myPlayerModel = ((Component)playerObject.transform).GetComponentInChildren<SkinnedMeshRenderer>();
			}

			private void UpdateTransforms(Transform thisTransform, Transform transform, bool setPos, bool setRot, Vector3 offSet, Vector3 rotOffSet, bool worldPos, bool worldRot)
			{
				//IL_001e: 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_0025: 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_000e: 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_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_0054: 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_003e: 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)
				if (setPos)
				{
					if (worldPos)
					{
						thisTransform.position = transform.position + offSet;
					}
					else
					{
						thisTransform.localPosition = transform.localPosition + offSet;
					}
				}
				if (setRot)
				{
					if (worldRot)
					{
						thisTransform.eulerAngles = transform.eulerAngles + rotOffSet;
					}
					else
					{
						thisTransform.localEulerAngles = transform.localEulerAngles + rotOffSet;
					}
				}
			}

			private void LateUpdate()
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Expected O, but got Unknown
				//IL_0021: 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_034d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0352: Unknown result type (might be due to invalid IL or missing references)
				//IL_035c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0361: Unknown result type (might be due to invalid IL or missing references)
				//IL_0367: Unknown result type (might be due to invalid IL or missing references)
				//IL_036e: 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_0393: Unknown result type (might be due to invalid IL or missing references)
				//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_040a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0448: Unknown result type (might be due to invalid IL or missing references)
				//IL_0486: Unknown result type (might be due to invalid IL or missing references)
				//IL_048c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0493: Unknown result type (might be due to invalid IL or missing references)
				//IL_0498: Unknown result type (might be due to invalid IL or missing references)
				//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
				//IL_0516: Unknown result type (might be due to invalid IL or missing references)
				//IL_055f: Unknown result type (might be due to invalid IL or missing references)
				//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_05fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_064e: Unknown result type (might be due to invalid IL or missing references)
				//IL_065c: Unknown result type (might be due to invalid IL or missing references)
				//IL_066a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0682: Unknown result type (might be due to invalid IL or missing references)
				//IL_069a: 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_06de: Unknown result type (might be due to invalid IL or missing references)
				//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_070e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0730: Unknown result type (might be due to invalid IL or missing references)
				//IL_0752: Unknown result type (might be due to invalid IL or missing references)
				//IL_076a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0782: Unknown result type (might be due to invalid IL or missing references)
				//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_07c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_07de: Unknown result type (might be due to invalid IL or missing references)
				//IL_07f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0818: Unknown result type (might be due to invalid IL or missing references)
				//IL_083a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0852: Unknown result type (might be due to invalid IL or missing references)
				//IL_086a: Unknown result type (might be due to invalid IL or missing references)
				//IL_088c: Unknown result type (might be due to invalid IL or missing references)
				//IL_08ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_08cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_08f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0911: Unknown result type (might be due to invalid IL or missing references)
				//IL_0916: Unknown result type (might be due to invalid IL or missing references)
				//IL_0920: Unknown result type (might be due to invalid IL or missing references)
				//IL_0925: Unknown result type (might be due to invalid IL or missing references)
				//IL_092c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0933: Unknown result type (might be due to invalid IL or missing references)
				//IL_0938: Unknown result type (might be due to invalid IL or missing references)
				//IL_0959: Unknown result type (might be due to invalid IL or missing references)
				//IL_095e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0968: Unknown result type (might be due to invalid IL or missing references)
				//IL_096d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0974: Unknown result type (might be due to invalid IL or missing references)
				//IL_097b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0980: Unknown result type (might be due to invalid IL or missing references)
				//IL_09ab: Unknown result type (might be due to invalid IL or missing references)
				//IL_09d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a0b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0a3f: Unknown result type (might be due to invalid IL or missing references)
				if ((Object)playerObject != (Object)null)
				{
					playerObject.transform.localPosition = Vector3.zero;
					Transform val = ((Component)this).gameObject.transform.Find("ScavengerModel").Find("metarig").Find("spine");
					Transform val2 = val.Find("spine.001");
					Transform val3 = val2.Find("spine.002");
					Transform obj = val3.Find("spine.003");
					Transform val4 = obj.Find("spine.004");
					Transform val5 = val.Find("thigh.L");
					Transform val6 = val.Find("thigh.R");
					Transform val7 = val5.Find("shin.L");
					Transform val8 = val6.Find("shin.R");
					Transform val9 = val7.Find("foot.L");
					Transform val10 = val8.Find("foot.R");
					Transform val11 = obj.Find("shoulder.L");
					Transform val12 = obj.Find("shoulder.R");
					Transform val13 = val11.Find("arm.L_upper");
					Transform val14 = val12.Find("arm.R_upper");
					Transform val15 = val13.Find("arm.L_lower");
					Transform val16 = val14.Find("arm.R_lower");
					Transform val17 = val15.Find("hand.L");
					Transform val18 = val16.Find("hand.R");
					Transform val19 = val17.Find("finger2.L");
					Transform val20 = val18.Find("finger2.R");
					Transform val21 = val19.Find("finger2.L.001");
					Transform val22 = val20.Find("finger2.R.001");
					Transform val23 = val17.Find("finger3.L");
					Transform val24 = val18.Find("finger3.R");
					Transform val25 = val23.Find("finger3.L.001");
					Transform val26 = val24.Find("finger3.R.001");
					Transform val27 = val17.Find("finger4.L");
					Transform val28 = val18.Find("finger4.R");
					Transform val29 = val27.Find("finger4.L.001");
					Transform val30 = val28.Find("finger4.R.001");
					Transform val31 = val17.Find("finger5.L");
					Transform val32 = val18.Find("finger5.R");
					Transform val33 = val31.Find("finger5.L.001");
					Transform val34 = val32.Find("finger5.R.001");
					Transform val35 = val17.Find("finger1.L");
					Transform val36 = val18.Find("finger1.R");
					Transform val37 = val35.Find("finger1.L.001");
					Transform val38 = val36.Find("finger1.R.001");
					Transform transform = playerObject.transform;
					Transform val39 = transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("shoulder.L")
						.Find("arm.L_upper")
						.Find("arm.L_lower")
						.Find("hand.L");
					Transform val40 = transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("shoulder.R")
						.Find("arm.R_upper")
						.Find("arm.R_lower")
						.Find("hand.R");
					float num = -0.05f;
					transform.Find("Armature").localEulerAngles = new Vector3(90f, 0f, 0f);
					transform.Find("Armature").Find("spine").position = val.position + Vector3.up * 0.19f + val.forward * num;
					transform.Find("Armature").Find("spine").localEulerAngles = val.localEulerAngles + new Vector3(90f, 0f, 0f);
					transform.Find("Armature").Find("spine").Find("spine.001")
						.localEulerAngles = val2.localEulerAngles;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.localEulerAngles = val3.localEulerAngles;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("spine.003")
						.rotation = val4.rotation;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("spine.003")
						.position = val4.position + val4.forward * num;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("shoulder.L")
						.localEulerAngles = val11.localEulerAngles;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("shoulder.R")
						.localEulerAngles = val12.localEulerAngles;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("shoulder.L")
						.Find("arm.L_upper")
						.localEulerAngles = val13.localEulerAngles;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("shoulder.R")
						.Find("arm.R_upper")
						.localEulerAngles = val14.localEulerAngles;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("shoulder.L")
						.Find("arm.L_upper")
						.Find("arm.L_lower")
						.localEulerAngles = val15.localEulerAngles;
					transform.Find("Armature").Find("spine").Find("spine.001")
						.Find("spine.002")
						.Find("shoulder.R")
						.Find("arm.R_upper")
						.Find("arm.R_lower")
						.localEulerAngles = val16.localEulerAngles;
					val39.localEulerAngles = val17.localEulerAngles;
					val40.localEulerAngles = val18.localEulerAngles;
					val39.Find("finger2.L").localEulerAngles = val19.localEulerAngles;
					val40.Find("finger2.R").localEulerAngles = val20.localEulerAngles;
					val39.Find("finger2.L").Find("finger2.L.001").localEulerAngles = val21.localEulerAngles;
					val40.Find("finger2.R").Find("finger2.R.001").localEulerAngles = val22.localEulerAngles;
					val39.Find("finger3.L").localEulerAngles = val23.localEulerAngles;
					val40.Find("finger3.R").localEulerAngles = val24.localEulerAngles;
					val39.Find("finger3.L").Find("finger3.L.001").localEulerAngles = val25.localEulerAngles;
					val40.Find("finger3.R").Find("finger3.R.001").localEulerAngles = val26.localEulerAngles;
					val39.Find("finger4.L").localEulerAngles = val27.localEulerAngles;
					val40.Find("finger4.R").localEulerAngles = val28.localEulerAngles;
					val39.Find("finger4.L").Find("finger4.L.001").localEulerAngles = val29.localEulerAngles;
					val40.Find("finger4.R").Find("finger4.R.001").localEulerAngles = val30.localEulerAngles;
					val39.Find("finger5.L").localEulerAngles = val31.localEulerAngles;
					val40.Find("finger5.R").localEulerAngles = val32.localEulerAngles;
					val39.Find("finger5.L").Find("finger5.L.001").localEulerAngles = val33.localEulerAngles;
					val40.Find("finger5.R").Find("finger5.R.001").localEulerAngles = val34.localEulerAngles;
					val39.Find("finger1.L").localEulerAngles = val35.localEulerAngles;
					val40.Find("finger1.R").localEulerAngles = val36.localEulerAngles;
					val39.Find("finger1.L").Find("finger1.L.001").localEulerAngles = val37.localEulerAngles;
					val40.Find("finger1.R").Find("finger1.R.001").localEulerAngles = val38.localEulerAngles;
					transform.Find("Armature").Find("thigh.L").rotation = val5.rotation;
					transform.Find("Armature").Find("thigh.R").rotation = val6.rotation;
					transform.Find("Armature").Find("thigh.L").position = val5.position + Vector3.up * 0.15f - val5.forward * num;
					transform.Find("Armature").Find("thigh.R").position = val6.position + Vector3.up * 0.15f - val6.forward * num;
					transform.Find("Armature").Find("thigh.L").Find("shin.L")
						.localEulerAngles = val7.localEulerAngles;
					transform.Find("Armature").Find("thigh.R").Find("shin.R")
						.localEulerAngles = val8.localEulerAngles;
					transform.Find("Armature").Find("thigh.L").Find("shin.L")
						.Find("foot.L")
						.localEulerAngles = val9.localEulerAngles;
					transform.Find("Armature").Find("thigh.R").Find("shin.R")
						.Find("foot.R")
						.localEulerAngles = val10.localEulerAngles;
				}
			}
		}
	}
	public class IKController : MonoBehaviour
	{
		protected Animator animator;

		public bool ikActive;

		public Transform leftLegTarget;

		public Transform rightLegTarget;

		public Transform leftHandTarget;

		public Transform rightHandTarget;

		private void Start()
		{
			animator = ((Component)this).GetComponent<Animator>();
		}

		private void OnAnimatorIK()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_003c: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_008e: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_00e0: 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_0135: 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)
			if (ikActive)
			{
				if ((Object)leftLegTarget != (Object)null)
				{
					animator.SetIKPositionWeight((AvatarIKGoal)0, 1f);
					animator.SetIKPosition((AvatarIKGoal)0, leftLegTarget.position);
					animator.SetIKRotation((AvatarIKGoal)0, leftLegTarget.rotation);
				}
				if ((Object)rightLegTarget != (Object)null)
				{
					animator.SetIKPositionWeight((AvatarIKGoal)1, 1f);
					animator.SetIKPosition((AvatarIKGoal)1, rightLegTarget.position);
					animator.SetIKRotation((AvatarIKGoal)1, rightLegTarget.rotation);
				}
				if ((Object)leftHandTarget != (Object)null)
				{
					animator.SetIKPositionWeight((AvatarIKGoal)2, 1f);
					animator.SetIKPosition((AvatarIKGoal)2, leftHandTarget.position);
					animator.SetIKRotation((AvatarIKGoal)2, leftHandTarget.rotation);
				}
				if ((Object)rightHandTarget != (Object)null)
				{
					animator.SetIKPositionWeight((AvatarIKGoal)3, 1f);
					animator.SetIKPosition((AvatarIKGoal)3, rightHandTarget.position);
					animator.SetIKRotation((AvatarIKGoal)3, rightHandTarget.rotation);
				}
			}
			else
			{
				animator.SetIKPositionWeight((AvatarIKGoal)0, 0f);
				animator.SetIKRotationWeight((AvatarIKGoal)0, 0f);
				animator.SetIKPositionWeight((AvatarIKGoal)1, 0f);
				animator.SetIKRotationWeight((AvatarIKGoal)1, 0f);
				animator.SetIKPositionWeight((AvatarIKGoal)2, 0f);
				animator.SetIKRotationWeight((AvatarIKGoal)2, 0f);
				animator.SetIKPositionWeight((AvatarIKGoal)3, 0f);
				animator.SetIKRotationWeight((AvatarIKGoal)3, 0f);
			}
		}
	}
	[BepInPlugin("TheGooberator.BetterPlayer", "Better Player Model", "1.0.0.0")]
	public class BetterModelBase : BaseUnityPlugin
	{
		public static class Assets
		{
			public static string mainAssetBundleName = "newmesh";

			public static AssetBundle MainAssetBundle = null;

			private static string GetAssemblyName()
			{
				return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0];
			}

			public static void PopulateAssets()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_0010: Expected O, but got Unknown
				if ((Object)MainAssetBundle == (Object)null)
				{
					using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName))
					{
						MainAssetBundle = AssetBundle.LoadFromStream(stream);
					}
				}
			}
		}

		private const string modeGUID = "TheGooberator.BetterPlayer";

		private const string modName = "Better Player Model";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("TheGooberator.BetterPlayer");

		private static BetterModelBase Instance;

		internal static ManualLogSource nls;

		public static GameObject playerModel;

		public static RuntimeAnimatorController animationController;

		public static List<Texture2D> textures = new List<Texture2D>();

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			nls = Logger.CreateLogSource("TheGooberator.BetterPlayer");
			nls.LogInfo((object)"BetterPlayerModel Loaded");
			Assets.PopulateAssets();
			nls.LogInfo((object)"Populated Assets");
			playerModel = Assets.MainAssetBundle.LoadAsset<GameObject>("Assets/Scavenger.fbx");
			animationController = Assets.MainAssetBundle.LoadAsset<RuntimeAnimatorController>("Assets/Scavenger.controller");
			textures.Add(Assets.MainAssetBundle.LoadAsset<Texture2D>("Assets/Gear_Base_Color.png"));
			textures.Add(Assets.MainAssetBundle.LoadAsset<Texture2D>("Assets/Clothing_Base_Color.png"));
			textures.Add(Assets.MainAssetBundle.LoadAsset<Texture2D>("Assets/Helmet_Base_Color.png"));
			textures.Add(Assets.MainAssetBundle.LoadAsset<Texture2D>("Assets/Gear_Normal_OpenGL.png"));
			textures.Add(Assets.MainAssetBundle.LoadAsset<Texture2D>("Assets/Clothing_Normal_OpenGL.png"));
			textures.Add(Assets.MainAssetBundle.LoadAsset<Texture2D>("Assets/Helmet_Normal_OpenGL.png"));
			nls.LogInfo((object)("Grabed Asset: " + (object)playerModel));
			harmony.PatchAll();
		}
	}
}
namespace BetterPlayerModel.Patches
{
	[HarmonyPatch]
	internal class PlayerObjects
	{
		public static void InitModels()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_003a: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			Debug.Log((object)((Object)((Component)localPlayerController).gameObject).name);
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			LethalCreature.CreatureController creatureController = default(LethalCreature.CreatureController);
			foreach (PlayerControllerB val in array)
			{
				if (!((Object)val == (Object)localPlayerController) && !((Object)((Component)val).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>().ToList().Find((SkinnedMeshRenderer x) => ((Object)x).name.Contains("Body")) != (Object)null) && !((Component)val).gameObject.TryGetComponent<LethalCreature.CreatureController>(ref creatureController))
				{
					((Component)val).gameObject.AddComponent<LethalCreature.CreatureController>();
				}
			}
		}

		[HarmonyPatch(typeof(PlayerControllerB), "SpawnPlayerAnimation")]
		[HarmonyPostfix]
		public static void InitModel(ref PlayerControllerB __instance)
		{
			InitModels();
		}

		[HarmonyPatch(typeof(PlayerControllerB), "DisablePlayerModel")]
		[HarmonyPostfix]
		public static void DisablePlayerModel(ref PlayerControllerB __instance, GameObject playerObject, bool enable, bool disableLocalArms)
		{
			//IL_000c: 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_001c: Expected O, but got Unknown
			//IL_001c: Expected O, but got Unknown
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if ((Object)playerObject == (Object)localPlayerController)
			{
				return;
			}
			playerObject.gameObject.GetComponentInChildren<LODGroup>().enabled = false;
			SkinnedMeshRenderer[] componentsInChildren = playerObject.gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
			LethalCreature.CreatureController creatureController = default(LethalCreature.CreatureController);
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				if (!(((Object)val).name == "Body"))
				{
					((Renderer)val).enabled = false;
				}
				if (((Component)__instance).TryGetComponent<LethalCreature.CreatureController>(ref creatureController) && (Object)(object)creatureController.myPlayerModel == (Object)(object)val)
				{
					((Renderer)val).enabled = enable;
				}
			}
		}
	}
}