Decompiled source of CrucifixionTomb v0.0.1

plugins\CrucifixionTomb.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("CrucifixionTomb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CrucifixionTomb")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
namespace CrucifixionTomb;

public static class CodeMatcherExtensions
{
	public static CodeMatcher GetPosition(this CodeMatcher codeMatcher, out int position)
	{
		position = codeMatcher.Pos;
		return codeMatcher;
	}

	public static CodeMatcher AddLabel(this CodeMatcher codeMatcher, out Label label)
	{
		label = default(Label);
		codeMatcher.AddLabels((IEnumerable<Label>)new Label[1] { label });
		return codeMatcher;
	}

	public static CodeMatcher GetOperand(this CodeMatcher codeMatcher, out object operand)
	{
		operand = codeMatcher.Operand;
		return codeMatcher;
	}

	public static bool IsCall(this CodeInstruction i, string declaringType, string name)
	{
		if ((i.opcode == OpCodes.Callvirt || i.opcode == OpCodes.Call) && i.operand is MethodInfo methodInfo && methodInfo.DeclaringType?.Name == declaringType)
		{
			return methodInfo.Name == name;
		}
		return false;
	}

	public static bool CallReturns(this CodeInstruction i, Type returnType)
	{
		if ((i.opcode == OpCodes.Callvirt || i.opcode == OpCodes.Call) && i.operand is MethodInfo methodInfo)
		{
			return methodInfo.ReturnType == returnType;
		}
		return false;
	}

	public static CodeMatcher SaveInstruction(this CodeMatcher matcher, int offset, out CodeInstruction instruction)
	{
		instruction = matcher.InstructionAt(offset);
		return matcher;
	}

	public static CodeMatcher SaveInstructions(this CodeMatcher matcher, int offset, out List<CodeInstruction> instructions)
	{
		instructions = matcher.InstructionsInRange(0, offset - 1);
		return matcher;
	}
}
public class Decay : MonoBehaviour
{
	public Vector3 m_skin_ori = Vector3.one;

	public Vector3 m_hair_ori = Vector3.one;

	public VisEquipment m_visEquipment;

	public long m_deathTime;

	public static readonly int zdoHashSkinColorOri = StringExtensionMethods.GetStableHashCode("bid_skinColorOri");

	public static readonly int zdoHashHairColorOri = StringExtensionMethods.GetStableHashCode("bid_hairColorOri");

	public static Vector3 s_skinDecay = new Vector3(0.3f, 0.367f, 0.32f);

	public static Vector3 s_hairDecay = new Vector3(0.278f, 0.278f, 0.278f);

	public static Color s_smokeColor = new Color(0.0669f, 0.0894f, 0f, 0.522f);

	public readonly List<Transform> s_crossNew = new List<Transform>();

	public readonly List<Transform> s_crossWornBroken = new List<Transform>();

	public EmissionModule m_fliesEmission;

	public MainModule m_smokeMain;

	private void Awake()
	{
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_023f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		m_visEquipment = ((Component)this).GetComponent<VisEquipment>();
		s_crossNew.Add(((Component)this).transform.GetChild(0).Find("New"));
		s_crossWornBroken.Add(((Component)this).transform.GetChild(0).Find("WornBroken"));
		s_crossNew.Add(((Component)this).transform.GetChild(1).Find("New"));
		s_crossWornBroken.Add(((Component)this).transform.GetChild(1).Find("WornBroken"));
		s_crossNew.Add(((Component)this).transform.GetChild(2).Find("New"));
		s_crossWornBroken.Add(((Component)this).transform.GetChild(2).Find("WornBroken"));
		s_crossNew.Add(((Component)this).transform.GetChild(3).Find("New"));
		s_crossWornBroken.Add(((Component)this).transform.GetChild(3).Find("WornBroken"));
		s_crossNew.Add(((Component)this).transform.GetChild(4).Find("New"));
		s_crossWornBroken.Add(((Component)this).transform.GetChild(4).Find("WornBroken"));
		ParticleSystem component = ((Component)((Component)this).transform.Find("Player_crucifixtion").Find("flies")).GetComponent<ParticleSystem>();
		ParticleSystem component2 = ((Component)((Component)this).transform.Find("Player_crucifixtion").Find("smoke")).GetComponent<ParticleSystem>();
		m_fliesEmission = component.emission;
		m_smokeMain = component2.main;
		float num = CrucifixionTomb.DecayTimeConfig.Value / 100f;
		((MonoBehaviour)this).InvokeRepeating("UpdateDecay", 1f, Mathf.Min(num, 300f));
		if (Object.op_Implicit((Object)(object)m_visEquipment.m_nview) && m_visEquipment.m_nview.IsValid())
		{
			m_skin_ori = m_visEquipment.m_nview.GetZDO().GetVec3(zdoHashSkinColorOri, Vector3.one);
			m_hair_ori = m_visEquipment.m_nview.GetZDO().GetVec3(zdoHashHairColorOri, Vector3.one);
			ZDO zDO = m_visEquipment.m_nview.GetZDO();
			if (zDO != null && zDO.IsValid())
			{
				long ticks = ZNet.instance.GetTime().Ticks;
				m_deathTime = zDO.GetLong(ZDOVars.s_timeOfDeath, ticks);
			}
		}
	}

	public void UpdateDecay()
	{
		//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_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_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)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.Clamp01((float)((ZNet.instance.GetTime().Ticks - m_deathTime) / 10000000) / CrucifixionTomb.DecayTimeConfig.Value);
		((EmissionModule)(ref m_fliesEmission)).rateOverTimeMultiplier = 5f * num;
		Color val = s_smokeColor;
		val.a *= num;
		((MainModule)(ref m_smokeMain)).startColor = MinMaxGradient.op_Implicit(val);
		m_visEquipment.SetSkinColor(Vector3.Lerp(m_skin_ori, s_skinDecay, num));
		m_visEquipment.SetHairColor(Vector3.Lerp(m_hair_ori, s_hairDecay, num));
		if (num > 0.5f)
		{
			if (!((Component)s_crossNew.First()).gameObject.activeSelf)
			{
				return;
			}
			foreach (Transform item in s_crossWornBroken)
			{
				((Component)item).gameObject.SetActive(true);
			}
			{
				foreach (Transform item2 in s_crossNew)
				{
					((Component)item2).gameObject.SetActive(false);
				}
				return;
			}
		}
		if (!((Component)s_crossWornBroken.First()).gameObject.activeSelf)
		{
			return;
		}
		foreach (Transform item3 in s_crossWornBroken)
		{
			((Component)item3).gameObject.SetActive(false);
		}
		foreach (Transform item4 in s_crossNew)
		{
			((Component)item4).gameObject.SetActive(true);
		}
	}

	public void SetColorOri(Vector3 skinColor, Vector3 hairColor)
	{
		//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_001d: 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_0044: Unknown result type (might be due to invalid IL or missing references)
		m_skin_ori = skinColor;
		m_visEquipment.m_nview.GetZDO().Set(zdoHashSkinColorOri, m_skin_ori);
		m_hair_ori = hairColor;
		m_visEquipment.m_nview.GetZDO().Set(zdoHashHairColorOri, m_hair_ori);
	}
}
public class Helper
{
	public static void CleanupMonos(GameObject go)
	{
		WearNTear[] componentsInChildren = go.GetComponentsInChildren<WearNTear>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			Object.Destroy((Object)(object)componentsInChildren[i]);
		}
		Piece[] componentsInChildren2 = go.GetComponentsInChildren<Piece>();
		for (int i = 0; i < componentsInChildren2.Length; i++)
		{
			Object.Destroy((Object)(object)componentsInChildren2[i]);
		}
		Ragdoll[] componentsInChildren3 = go.GetComponentsInChildren<Ragdoll>();
		for (int i = 0; i < componentsInChildren3.Length; i++)
		{
			Object.Destroy((Object)(object)componentsInChildren3[i]);
		}
		VisEquipment[] componentsInChildren4 = go.GetComponentsInChildren<VisEquipment>();
		for (int i = 0; i < componentsInChildren4.Length; i++)
		{
			Object.Destroy((Object)(object)componentsInChildren4[i]);
		}
		ZNetView[] componentsInChildren5 = go.GetComponentsInChildren<ZNetView>();
		for (int i = 0; i < componentsInChildren5.Length; i++)
		{
			Object.Destroy((Object)(object)componentsInChildren5[i]);
		}
	}

	public static void ChangeLayerRecursive(GameObject go, LayerMask layerMask)
	{
		//IL_000b: 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_0034: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)go == (Object)null)
		{
			return;
		}
		go.layer = LayerMask.op_Implicit(layerMask);
		foreach (Transform item in go.transform)
		{
			ChangeLayerRecursive(((Component)item).gameObject, layerMask);
		}
	}

	public static void ReplaceCharacterJointsWithConfigurable(GameObject root)
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: 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_00a4: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: 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_00ec: 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)
		CharacterJoint[] componentsInChildren = root.GetComponentsInChildren<CharacterJoint>();
		foreach (CharacterJoint obj in componentsInChildren)
		{
			((Component)obj).GetComponent<Rigidbody>();
			Rigidbody connectedBody = ((Joint)obj).connectedBody;
			GameObject gameObject = ((Component)obj).gameObject;
			Object.DestroyImmediate((Object)(object)obj);
			ConfigurableJoint obj2 = gameObject.AddComponent<ConfigurableJoint>();
			((Joint)obj2).connectedBody = connectedBody;
			((Joint)obj2).anchor = Vector3.zero;
			((Joint)obj2).autoConfigureConnectedAnchor = false;
			((Joint)obj2).connectedAnchor = Vector3.zero;
			obj2.xMotion = (ConfigurableJointMotion)0;
			obj2.yMotion = (ConfigurableJointMotion)0;
			obj2.zMotion = (ConfigurableJointMotion)0;
			obj2.angularXMotion = (ConfigurableJointMotion)1;
			obj2.angularYMotion = (ConfigurableJointMotion)1;
			obj2.angularZMotion = (ConfigurableJointMotion)1;
			SoftJointLimitSpring val = default(SoftJointLimitSpring);
			((SoftJointLimitSpring)(ref val)).spring = 5000f;
			((SoftJointLimitSpring)(ref val)).damper = 100f;
			SoftJointLimitSpring angularYZLimitSpring = (obj2.angularXLimitSpring = val);
			obj2.angularYZLimitSpring = angularYZLimitSpring;
			SoftJointLimit val3 = default(SoftJointLimit);
			((SoftJointLimit)(ref val3)).limit = 10f;
			SoftJointLimit angularZLimit = (obj2.angularYLimit = (obj2.highAngularXLimit = (obj2.lowAngularXLimit = val3)));
			obj2.angularZLimit = angularZLimit;
			((Joint)obj2).axis = Vector3.right;
			obj2.secondaryAxis = Vector3.up;
		}
	}

	public static Transform RecursiveFindChild(Transform parent, string childName)
	{
		//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 (((Object)val).name.ToLower().Contains(childName.ToLower()))
			{
				return val;
			}
			Transform val2 = RecursiveFindChild(val, childName);
			if ((Object)(object)val2 != (Object)null)
			{
				return val2;
			}
		}
		return null;
	}

	public static void ConnectJoint(GameObject prefab, string childName, string parentName)
	{
		Transform val = RecursiveFindChild(prefab.transform, childName);
		Transform val2 = RecursiveFindChild(prefab.transform, parentName);
		if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null)
		{
			Debug.LogWarning((object)("Missing bone: " + childName + " or " + parentName));
			return;
		}
		CharacterJoint val3 = ((Component)val).GetComponent<CharacterJoint>();
		Rigidbody val4 = ((Component)val2).GetComponent<Rigidbody>();
		Debug.Log((object)("parent " + ((object)val2)?.ToString() + " has rigid " + (object)val4));
		if ((Object)(object)val3 == (Object)null)
		{
			val3 = ((Component)val).gameObject.AddComponent<CharacterJoint>();
			Debug.Log((object)("no joint found on " + ((object)val)?.ToString() + " creating"));
		}
		if ((Object)(object)val4 == (Object)null)
		{
			val4 = ((Component)val2).gameObject.AddComponent<Rigidbody>();
			val4.isKinematic = true;
			Debug.Log((object)("no rigidbody found on " + ((object)val2)?.ToString() + " creating"));
		}
		if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null)
		{
			((Joint)val3).connectedBody = val4;
			Debug.Log((object)("Connected " + childName + " to " + parentName));
		}
		else
		{
			Debug.Log((object)$"no rigidbody {val4} or joint {val3} ");
		}
	}

	public static void StiffenJoint(GameObject root, string child)
	{
		//IL_001e: 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_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: 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_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		CharacterJoint component = ((Component)RecursiveFindChild(root.transform, child)).GetComponent<CharacterJoint>();
		if (Object.op_Implicit((Object)(object)component))
		{
			SoftJointLimit val = default(SoftJointLimit);
			((SoftJointLimit)(ref val)).limit = 0f;
			component.lowTwistLimit = val;
			val = default(SoftJointLimit);
			((SoftJointLimit)(ref val)).limit = 0f;
			component.highTwistLimit = val;
			val = default(SoftJointLimit);
			((SoftJointLimit)(ref val)).limit = 0f;
			component.swing1Limit = val;
			val = default(SoftJointLimit);
			((SoftJointLimit)(ref val)).limit = 0f;
			component.swing2Limit = val;
		}
	}
}
[HarmonyPatch(typeof(TombStone), "Awake")]
internal static class TombStone_Awake_Patches
{
	public static void OnTakeAllSuccess(TombStone __instance)
	{
		((Component)((Component)__instance).transform.Find("Player_crucifixtion")).gameObject.SetActive(false);
		Destructible.CreateFragments(((Component)__instance).gameObject, true);
	}

	public static void Postfix(ref TombStone __instance)
	{
		//IL_0051: 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_00a8: 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_00b9: 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)
		if (!((Object)__instance).name.StartsWith("Player_tombstone_cruci"))
		{
			return;
		}
		TombStone instance = __instance;
		Container container = __instance.m_container;
		container.m_onTakeAllSuccess = (Action)Delegate.Combine(container.m_onTakeAllSuccess, (Action)delegate
		{
			OnTakeAllSuccess(instance);
		});
		float num = ((!(((Component)__instance).transform.position.y > 3000f)) ? CrucifixionTomb.TombScaleConfig.Value : 0.3f);
		if (num != 1f)
		{
			Vector3 localScale = default(Vector3);
			((Vector3)(ref localScale))..ctor(num, num, num);
			((Component)__instance).transform.localScale = localScale;
			Joint[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<Joint>(true);
			foreach (Joint obj in componentsInChildren)
			{
				obj.anchor *= num;
				obj.connectedAnchor *= num;
			}
		}
	}
}
[HarmonyPatch(typeof(TombStone), "UpdateFloater")]
internal static class TombStone_UpdateFloater_Patches
{
	public static bool Prefix(ref TombStone __instance)
	{
		//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)
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a4: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: 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_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_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: 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)
		if (!((Object)__instance).name.StartsWith("Player_tombstone_cruci"))
		{
			return true;
		}
		bool flag = __instance.m_floating.BeenFloating();
		if (__instance.m_nview.IsOwner())
		{
			__instance.m_nview.GetZDO().Set(ZDOVars.s_inWater, flag);
		}
		Quaternion localRotation;
		if (flag)
		{
			localRotation = ((Component)__instance).transform.localRotation;
			Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles;
			((Component)__instance).transform.localRotation = Quaternion.Euler(90f, eulerAngles.y, eulerAngles.z);
		}
		else
		{
			localRotation = ((Component)__instance).transform.localRotation;
			Vector3 eulerAngles2 = ((Quaternion)(ref localRotation)).eulerAngles;
			((Component)__instance).transform.localRotation = Quaternion.Euler(0f, eulerAngles2.y, eulerAngles2.z);
		}
		return false;
	}
}
[HarmonyPatch(typeof(Humanoid), "OnRagdollCreated")]
internal static class Humanoid_OnRagdollCreated_Patches
{
	public static bool Prefix(Ragdoll ragdoll, ref Humanoid __instance)
	{
		if (CrucifixionTomb.EnabledConfig.Value)
		{
			Humanoid obj = __instance;
			Player val = (Player)(object)((obj is Player) ? obj : null);
			if (val != null && ((Humanoid)val).GetInventory().NrOfItems() > 0)
			{
				ragdoll.m_nview.Destroy();
				return false;
			}
		}
		return true;
	}
}
[HarmonyPatch(typeof(Player), "CreateTombStone")]
internal static class Player_CreateTombStone_Patches
{
	public static string m_lastChestItem;

	public static string m_lastHelmetItem;

	public static string m_lastLegItem;

	public static string m_lastHairItem;

	public static void Prefix(ref Player __instance)
	{
		if (((Character)__instance).m_nview.IsOwner())
		{
			m_lastChestItem = ((Humanoid)__instance).m_visEquipment.m_chestItem;
			m_lastHelmetItem = ((Humanoid)__instance).m_visEquipment.m_helmetItem;
			m_lastLegItem = ((Humanoid)__instance).m_visEquipment.m_legItem;
			m_lastHairItem = ((Humanoid)__instance).m_visEquipment.m_hairItem;
		}
	}

	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> OnCreateTombStoneTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		//IL_0002: 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_0036: Expected O, but got Unknown
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Expected O, but got Unknown
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		return new CodeMatcher(instructions, (ILGenerator)null).MatchForward(true, (CodeMatch[])(object)new CodeMatch[1]
		{
			new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.IsCall("Object", "Instantiate")), (string)null)
		}).ThrowIfInvalid("Could not patch Player.CreateTombStone(): Dup not found! ").Advance(1)
			.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3]
			{
				new CodeInstruction(OpCodes.Dup, (object)null),
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				Transpilers.EmitDelegate<Action<GameObject, Player>>((Action<GameObject, Player>)OnInstantiateDelegate)
			})
			.InstructionEnumeration();
	}

	private static void OnInstantiateDelegate(GameObject go, Player player)
	{
		//IL_0023: 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_0072: Unknown result type (might be due to invalid IL or missing references)
		if (CrucifixionTomb.EnabledConfig.Value)
		{
			VisEquipment component = go.GetComponent<VisEquipment>();
			((Humanoid)player).SetupVisEquipment(component, false);
			go.GetComponent<Decay>().SetColorOri(player.m_skinColor, player.m_hairColor);
			component.SetChestItem(m_lastChestItem);
			component.SetLegItem(m_lastLegItem);
			component.SetHairItem(m_lastHairItem);
			m_lastChestItem = null;
			m_lastLegItem = null;
			m_lastHelmetItem = null;
			go.transform.position = ((Component)player).transform.position;
			player.m_ragdoll = go.GetComponent<Ragdoll>();
		}
	}
}
[BepInPlugin("org.bepinex.plugins.bid.CrucifixionTomb", "CrucifixionTomb", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
internal class CrucifixionTomb : BaseUnityPlugin
{
	public const string PluginGUID = "org.bepinex.plugins.bid.CrucifixionTomb";

	public const string PluginName = "CrucifixionTomb";

	public const string PluginVersion = "0.0.1";

	private readonly Harmony harmony = new Harmony("org.bepinex.plugins.bid.CrucifixionTomb");

	public static CustomLocalization Localization = LocalizationManager.Instance.GetLocalization();

	public static ConfigEntry<float> TombScaleConfig;

	public static ConfigEntry<float> DecayTimeConfig;

	public static ConfigEntry<bool> EnabledConfig;

	private void Awake()
	{
		Logger.LogInfo((object)"CrucifixionTomb has landed");
		CreateConfigValues();
		PrefabManager.OnVanillaPrefabsAvailable += AddClonedItems;
		harmony.PatchAll();
	}

	private void AddClonedItems()
	{
		CreateCrucifixion();
		PrefabManager.OnVanillaPrefabsAvailable -= AddClonedItems;
	}

	private void CreateConfigValues()
	{
		//IL_002b: 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_0038: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Expected O, but got Unknown
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Expected O, but got Unknown
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Expected O, but got Unknown
		//IL_00a9: 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_00b6: Expected O, but got Unknown
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Expected O, but got Unknown
		((BaseUnityPlugin)this).Config.SaveOnConfigSet = true;
		EnabledConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("Server config", "Enabled", true, new ConfigDescription("enable/disable - needs restart", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		TombScaleConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "TombScale", 1f, new ConfigDescription("Scale of the tombstone", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		DecayTimeConfig = ((BaseUnityPlugin)this).Config.Bind<float>("Server config", "DecayTime", 1200f, new ConfigDescription("Time in seconds until body decay", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
		{
			IsAdminOnly = true
		} }));
		SynchronizationManager.OnConfigurationSynchronized += delegate(object obj, ConfigurationSynchronizationEventArgs attr)
		{
			_ = attr.InitialSynchronization;
		};
	}

	private void OnDestroy()
	{
		harmony.UnpatchSelf();
	}

	private void CreateCrucifixion()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//IL_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: 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_0107: 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_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_031c: 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_0325: Unknown result type (might be due to invalid IL or missing references)
		//IL_032a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: 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_0355: Unknown result type (might be due to invalid IL or missing references)
		//IL_035a: Unknown result type (might be due to invalid IL or missing references)
		//IL_035e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0363: Unknown result type (might be due to invalid IL or missing references)
		//IL_0371: Unknown result type (might be due to invalid IL or missing references)
		//IL_0378: Unknown result type (might be due to invalid IL or missing references)
		//IL_037f: Unknown result type (might be due to invalid IL or missing references)
		//IL_038f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0394: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03aa: 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_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03da: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_040e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0413: Unknown result type (might be due to invalid IL or missing references)
		//IL_0417: Unknown result type (might be due to invalid IL or missing references)
		//IL_0431: Unknown result type (might be due to invalid IL or missing references)
		//IL_0442: Unknown result type (might be due to invalid IL or missing references)
		//IL_0447: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0467: Unknown result type (might be due to invalid IL or missing references)
		//IL_0478: Unknown result type (might be due to invalid IL or missing references)
		//IL_047d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0481: 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_04ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0509: Unknown result type (might be due to invalid IL or missing references)
		//IL_0529: Unknown result type (might be due to invalid IL or missing references)
		//IL_0549: Unknown result type (might be due to invalid IL or missing references)
		//IL_0569: 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_0712: Unknown result type (might be due to invalid IL or missing references)
		//IL_0731: Unknown result type (might be due to invalid IL or missing references)
		//IL_07df: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0832: Unknown result type (might be due to invalid IL or missing references)
		//IL_084e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0853: Unknown result type (might be due to invalid IL or missing references)
		//IL_085c: Unknown result type (might be due to invalid IL or missing references)
		//IL_086d: Unknown result type (might be due to invalid IL or missing references)
		//IL_087e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0888: Unknown result type (might be due to invalid IL or missing references)
		//IL_088d: Unknown result type (might be due to invalid IL or missing references)
		//IL_089d: Unknown result type (might be due to invalid IL or missing references)
		//IL_089f: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a9: 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_08b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0ab6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0bdf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0be4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0c7c: Unknown result type (might be due to invalid IL or missing references)
		//IL_09ae: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject();
		((Object)val).name = "Crucifixion";
		PrefabManager.Instance.AddPrefab(val);
		GameObject prefab = PrefabManager.Instance.GetPrefab("wood_pole");
		GameObject prefab2 = PrefabManager.Instance.GetPrefab("wood_pole2");
		GameObject prefab3 = PrefabManager.Instance.GetPrefab("Player_ragdoll");
		GameObject obj = Object.Instantiate<GameObject>(prefab2);
		Helper.CleanupMonos(obj);
		obj.transform.parent = val.transform;
		obj.transform.localPosition = new Vector3(0f, 1f, 0f);
		GameObject val2 = Object.Instantiate<GameObject>(prefab2, val.transform);
		val2.transform.localPosition = new Vector3(0f, 2.5f, 0f);
		Helper.CleanupMonos(val2);
		GameObject obj2 = Object.Instantiate<GameObject>(prefab, val.transform);
		obj2.transform.localPosition = new Vector3(0f, 4f, 0f);
		Helper.CleanupMonos(obj2);
		GameObject obj3 = Object.Instantiate<GameObject>(prefab, val.transform);
		obj3.transform.localPosition = new Vector3(0.65f, 3.5f, 0f);
		obj3.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
		Helper.CleanupMonos(obj3);
		GameObject obj4 = Object.Instantiate<GameObject>(prefab, val.transform);
		obj4.transform.localPosition = new Vector3(-0.65f, 3.5f, 0f);
		obj4.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
		Helper.CleanupMonos(obj4);
		GameObject val3 = Object.Instantiate<GameObject>(prefab3, val.transform);
		Helper.CleanupMonos(val3);
		Helper.ChangeLayerRecursive(val3, LayerMask.op_Implicit(0));
		((Object)val3).name = "Player_crucifixtion";
		val3.transform.localPosition = new Vector3(0f, 1.55f, -0.37f);
		val3.transform.localRotation = Quaternion.Euler(0f, 176f, 0f);
		Transform val4 = Helper.RecursiveFindChild(val3.transform, "LeftHand");
		Transform val5 = Helper.RecursiveFindChild(val3.transform, "RightHand");
		Transform obj5 = Helper.RecursiveFindChild(val3.transform, "LeftLeg");
		Helper.RecursiveFindChild(val3.transform, "RightLeg");
		Transform obj6 = Helper.RecursiveFindChild(val3.transform, "RightArm");
		Transform obj7 = Helper.RecursiveFindChild(val3.transform, "LeftArm");
		Transform val6 = Helper.RecursiveFindChild(val3.transform, "RightForeArm");
		Transform val7 = Helper.RecursiveFindChild(val3.transform, "LeftForeArm");
		Transform obj8 = Helper.RecursiveFindChild(val3.transform, "RightShoulder");
		Transform val8 = Helper.RecursiveFindChild(val3.transform, "LeftShoulder");
		Transform obj9 = Helper.RecursiveFindChild(val3.transform, "RightFoot");
		Transform val9 = Helper.RecursiveFindChild(val3.transform, "LeftFoot");
		Helper.RecursiveFindChild(((Component)val3.transform).transform, "Hips");
		Transform val10 = Helper.RecursiveFindChild(val3.transform, "Spine1");
		Transform val11 = Helper.RecursiveFindChild(val3.transform, "Spine");
		Transform val12 = Helper.RecursiveFindChild(val3.transform, "Spine2");
		Transform val13 = Helper.RecursiveFindChild(val3.transform, "Helmet_attach");
		Quaternion localRotation = ((Component)obj9).transform.localRotation;
		Vector3 eulerAngles = ((Quaternion)(ref localRotation)).eulerAngles;
		((Component)obj9).transform.localRotation = Quaternion.Euler(-10f, eulerAngles.y, eulerAngles.z);
		localRotation = ((Component)val9).transform.localRotation;
		Vector3 eulerAngles2 = ((Quaternion)(ref localRotation)).eulerAngles;
		((Component)val9).transform.localRotation = Quaternion.Euler(-10f, eulerAngles2.y, eulerAngles2.z);
		Quaternion localRotation2 = ((Component)obj8).transform.localRotation;
		localRotation2 = Quaternion.Euler(80f, 295f, 180f);
		((Component)obj8).transform.localRotation = localRotation2;
		Quaternion localRotation3 = ((Component)val8).transform.localRotation;
		localRotation3 = Quaternion.Euler(0f, 0f, 90f);
		((Component)val8).transform.localRotation = localRotation3;
		((Component)obj7).transform.localRotation = Quaternion.Euler(330f, 340f, 0f);
		localRotation = ((Component)obj6).transform.localRotation;
		_ = ((Quaternion)(ref localRotation)).eulerAngles;
		((Component)obj6).transform.localRotation = Quaternion.Euler(330f, 340f, 0f);
		localRotation = ((Component)val6).transform.localRotation;
		_ = ((Quaternion)(ref localRotation)).eulerAngles;
		((Component)val6).transform.localRotation = Quaternion.Euler(0f, 270f, 0f);
		localRotation = ((Component)val7).transform.localRotation;
		_ = ((Quaternion)(ref localRotation)).eulerAngles;
		((Component)val7).transform.localRotation = Quaternion.Euler(8f, 60f, 0f);
		localRotation = ((Component)val5).transform.localRotation;
		_ = ((Quaternion)(ref localRotation)).eulerAngles;
		((Component)val5).transform.localRotation = Quaternion.Euler(15f, 315f, 0f);
		localRotation = ((Component)val4).transform.localRotation;
		_ = ((Quaternion)(ref localRotation)).eulerAngles;
		((Component)val4).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
		((Component)val11).transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
		((Component)val10).transform.localRotation = Quaternion.Euler(20f, 0f, 0f);
		((Component)val12).transform.localRotation = Quaternion.Euler(5f, 0f, 0f);
		SpringJoint val14 = ((Component)val10).gameObject.AddComponent<SpringJoint>();
		val14.spring = 500f;
		((Joint)val14).connectedBody = val2.GetComponent<Rigidbody>();
		if (!Object.op_Implicit((Object)(object)((Joint)val14).connectedBody))
		{
			((Joint)val14).connectedBody = val.AddComponent<Rigidbody>();
			((Joint)val14).connectedBody.isKinematic = true;
		}
		FixedJoint val15 = ((Component)val5).gameObject.AddComponent<FixedJoint>();
		((Joint)val15).connectedBody = val.GetComponent<Rigidbody>();
		if (!Object.op_Implicit((Object)(object)((Joint)val15).connectedBody))
		{
			((Joint)val15).connectedBody = val.AddComponent<Rigidbody>();
			((Joint)val15).connectedBody.isKinematic = true;
		}
		FixedJoint val16 = ((Component)val4).gameObject.AddComponent<FixedJoint>();
		((Joint)val16).connectedBody = val.GetComponent<Rigidbody>();
		if (!Object.op_Implicit((Object)(object)((Joint)val16).connectedBody))
		{
			((Joint)val16).connectedBody = val.AddComponent<Rigidbody>();
			((Joint)val16).connectedBody.isKinematic = true;
		}
		SpringJoint val17 = ((Component)val6).gameObject.AddComponent<SpringJoint>();
		val17.spring = 2500f;
		((Joint)val17).connectedBody = val.GetComponent<Rigidbody>();
		if (!Object.op_Implicit((Object)(object)((Joint)val17).connectedBody))
		{
			((Joint)val17).connectedBody = val.AddComponent<Rigidbody>();
			((Joint)val17).connectedBody.isKinematic = true;
		}
		((Joint)val17).anchor = new Vector3(0f, 0.00316f, 0f);
		SpringJoint val18 = ((Component)val7).gameObject.AddComponent<SpringJoint>();
		val18.spring = 2500f;
		((Joint)val18).connectedBody = val.GetComponent<Rigidbody>();
		if (!Object.op_Implicit((Object)(object)((Joint)val18).connectedBody))
		{
			((Joint)val18).connectedBody = val.AddComponent<Rigidbody>();
			((Joint)val18).connectedBody.isKinematic = true;
		}
		((Joint)val18).anchor = new Vector3(0f, 0.00316f, 0f);
		((Component)obj5).transform.localRotation = Quaternion.Euler(0f, 0f, 10f);
		FixedJoint val19 = ((Component)obj5).gameObject.AddComponent<FixedJoint>();
		((Joint)val19).connectedBody = val.GetComponent<Rigidbody>();
		if (!Object.op_Implicit((Object)(object)((Joint)val19).connectedBody))
		{
			((Joint)val19).connectedBody = val.AddComponent<Rigidbody>();
			((Joint)val19).connectedBody.isKinematic = true;
		}
		GameObject prefab4 = PrefabManager.Instance.GetPrefab("Draugr");
		Transform val20 = Helper.RecursiveFindChild(prefab4.transform, "flies");
		Transform obj10 = Helper.RecursiveFindChild(prefab4.transform, "evil_smoke");
		Transform obj11 = Object.Instantiate<Transform>(val20);
		((Object)obj11).name = "flies";
		((Component)obj11).transform.parent = val3.transform;
		obj11.localPosition = new Vector3(0f, 1f, 0f);
		EmissionModule emission = ((Component)obj11).GetComponent<ParticleSystem>().emission;
		((EmissionModule)(ref emission)).rateOverTimeMultiplier = 0f;
		Transform obj12 = Object.Instantiate<Transform>(obj10);
		((Object)obj12).name = "smoke";
		((Component)obj12).transform.parent = val3.transform;
		obj12.localPosition = new Vector3(0f, 1f, 0f);
		((Component)obj12).gameObject.SetActive(true);
		ParticleSystem component = ((Component)obj12).GetComponent<ParticleSystem>();
		MainModule main = component.main;
		((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(4f);
		((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0.02f);
		((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(10f);
		Color s_smokeColor = Decay.s_smokeColor;
		s_smokeColor.a = 0f;
		((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(s_smokeColor);
		emission = component.emission;
		((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(1f);
		((Object)val).name = "Crucification_base";
		PrefabManager.Instance.AddPrefab(val);
		GameObject val21 = PrefabManager.Instance.CreateClonedPrefab("Player_tombstone_cruci", val);
		((Object)val21).name = "Player_tombstone_cruci";
		Helper.CleanupMonos(val21);
		GameObject prefab5 = PrefabManager.Instance.GetPrefab("Player_tombstone");
		for (int i = 1; i < prefab5.transform.childCount; i++)
		{
			if (!((Object)prefab5.transform.GetChild(i)).name.StartsWith("floater") && !((Object)prefab5.transform.GetChild(i)).name.StartsWith("Particle"))
			{
				Transform val22 = Object.Instantiate<Transform>(prefab5.transform.GetChild(i));
				val22.parent = val21.transform;
				if (((Object)val22).name.StartsWith("Canvas"))
				{
					((Object)val22).name = "Canvas";
					((Transform)((Component)val22).GetComponent<RectTransform>()).localPosition = new Vector3(0f, 3.5f, -0.5f);
				}
			}
		}
		TombStone component2 = prefab5.GetComponent<TombStone>();
		TombStone obj13 = val21.AddComponent<TombStone>();
		((Object)obj13).name = ((Object)component2).name;
		obj13.m_text = component2.m_text;
		obj13.m_worldText = (TMP_Text)(object)((Component)((Component)obj13).transform.Find("Canvas").GetChild(0)).GetComponent<TextMeshProUGUI>();
		obj13.m_floater = null;
		obj13.m_spawnUpVel = component2.m_spawnUpVel;
		obj13.m_lootStatusEffect = component2.m_lootStatusEffect;
		obj13.m_removeEffect = component2.m_removeEffect;
		obj13.m_removeEffect.m_effectPrefabs[0].m_prefab = PrefabManager.Instance.GetPrefab("sfx_wood_break");
		Container component3 = prefab5.GetComponent<Container>();
		Container obj14 = val21.AddComponent<Container>();
		((Object)obj14).name = ((Object)component3).name;
		obj14.m_bkg = component3.m_bkg;
		obj14.m_width = component3.m_width;
		obj14.m_height = component3.m_height;
		obj14.m_privacy = component3.m_privacy;
		obj14.m_checkGuardStone = component3.m_checkGuardStone;
		obj14.m_autoDestroyEmpty = component3.m_autoDestroyEmpty;
		obj14.m_defaultItems = component3.m_defaultItems;
		ZSyncTransform obj15 = val21.AddComponent<ZSyncTransform>();
		obj15.m_syncPosition = true;
		obj15.m_syncRotation = true;
		Floating val23 = prefab5.AddComponent<Floating>();
		Floating obj16 = val21.AddComponent<Floating>();
		obj16.m_waterLevelOffset = 0.15f;
		obj16.m_forceDistance = val23.m_forceDistance;
		obj16.m_force = 1f;
		obj16.m_balanceForceFraction = val23.m_balanceForceFraction;
		obj16.m_damping = val23.m_damping;
		val4 = Helper.RecursiveFindChild(val21.transform, "LeftHand");
		val5 = Helper.RecursiveFindChild(val21.transform, "RightHand");
		val13 = Helper.RecursiveFindChild(val21.transform, "Helmet_attach");
		VisEquipment component4 = prefab3.GetComponent<VisEquipment>();
		VisEquipment obj17 = val21.AddComponent<VisEquipment>();
		obj17.m_bodyModel = ((Component)val21.transform.Find("Player_crucifixtion").GetChild(0).GetChild(1)).GetComponent<SkinnedMeshRenderer>();
		obj17.m_leftHand = val4;
		obj17.m_rightHand = val5;
		obj17.m_helmet = val13;
		obj17.m_isPlayer = true;
		obj17.m_models = component4.m_models;
		obj17.m_helmetHideHair = component4.m_helmetHideHair;
		GameObject prefab6 = PrefabManager.Instance.GetPrefab("Player");
		if (EnabledConfig.Value)
		{
			prefab6.GetComponent<Player>().m_tombstone = val21;
		}
		val21.AddComponent<Ragdoll>().m_ttl = float.MaxValue;
		val21.AddComponent<Decay>();
		Rigidbody val24 = val21.GetComponent<Rigidbody>();
		if ((Object)(object)val24 == (Object)null)
		{
			val24 = val21.AddComponent<Rigidbody>();
		}
		val24.mass = 100f;
		val24.isKinematic = false;
		val24.constraints = (RigidbodyConstraints)122;
		val21.AddComponent<BoxCollider>().size = new Vector3(0.1f, 0.1f, 0.1f);
		((Object)val21).name = "Player_tombstone_cruci";
		PrefabManager.Instance.AddPrefab(val21);
		val21.AddComponent<ZNetView>().m_persistent = true;
	}
}