Decompiled source of RideZombie v0.1.2

RideZombie.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RideZombie")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f5413d65797993bf13e43d6d61cb19239253c1c7")]
[assembly: AssemblyProduct("RideZombie")]
[assembly: AssemblyTitle("RideZombie")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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 RideZombie
{
	[HarmonyPatch(typeof(CharacterInteractible))]
	internal static class RidePrompt
	{
		private static bool Rideable(CharacterInteractible target)
		{
			Item currentItem = Character.localCharacter.data.currentItem;
			MushroomZombie zombie = default(MushroomZombie);
			if (((Component)target).TryGetComponent<MushroomZombie>(ref zombie) && ((Object)(object)currentItem == (Object)null || !currentItem.canUseOnFriend))
			{
				return Rides.CanRide(Character.localCharacter, zombie);
			}
			return false;
		}

		[HarmonyPostfix]
		[HarmonyPatch("IsInteractible")]
		private static void IsInteractible(CharacterInteractible __instance, ref bool __result)
		{
			__result = __result || Rideable(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("IsPrimaryInteractible")]
		private static void IsPrimaryInteractible(CharacterInteractible __instance, ref bool __result)
		{
			__result = __result || Rideable(__instance);
		}

		[HarmonyPostfix]
		[HarmonyPatch("GetInteractionText")]
		private static void GetInteractionText(CharacterInteractible __instance, ref string __result)
		{
			if (Rideable(__instance))
			{
				__result = "Ride";
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("Interact")]
		private static bool Interact(CharacterInteractible __instance, Character interactor)
		{
			if (!Rideable(__instance))
			{
				return true;
			}
			Rides.RequestRide(interactor, ((Component)__instance).GetComponent<MushroomZombie>());
			return false;
		}
	}
	[HarmonyPatch(typeof(CharacterInput), "Sample")]
	internal static class RiderInput
	{
		private static void Postfix(CharacterInput __instance)
		{
			Rides.Capture(__instance);
		}
	}
	[HarmonyPatch(typeof(MushroomZombie), "Update")]
	internal static class ZombieSteering
	{
		private static void Postfix(MushroomZombie __instance)
		{
			Rides.Steer(__instance);
		}
	}
	[HarmonyPatch(typeof(MainCameraMovement), "CharacterCam")]
	internal static class RiderCamera
	{
		private static void Postfix(MainCameraMovement __instance)
		{
			RideCamera.Follow(((Component)__instance).transform);
		}
	}
	[HarmonyPatch(typeof(Character), "SetRotation")]
	internal static class RiderFacing
	{
		private static bool Prefix(Character __instance)
		{
			return !RidePose.Face(__instance);
		}
	}
	[HarmonyPatch(typeof(CharacterCarrying), "GetCarried")]
	internal static class RiderSeat
	{
		private static bool Prefix(CharacterCarrying __instance)
		{
			return !RidePose.Carry(__instance.character);
		}
	}
	[HarmonyPatch(typeof(CharacterAnimations), "ConfigureIK")]
	internal static class RiderLegs
	{
		private static void Postfix(CharacterAnimations __instance)
		{
			RidePose.Straddle(__instance.character);
		}
	}
	[HarmonyPatch(typeof(MushroomZombie), "DoLunging")]
	internal static class RiddenLunge
	{
		private static bool Prefix(MushroomZombie __instance)
		{
			return !Rides.LandLunge(__instance);
		}
	}
	[HarmonyPatch(typeof(MushroomZombieBiteCollider), "OnTriggerEnter")]
	internal static class ZombieBite
	{
		private static void Postfix(MushroomZombieBiteCollider __instance, Collider other)
		{
			Rides.Bite(__instance.parentZombie, other);
		}
	}
	[BepInPlugin("dest1n1.RideZombie", "RideZombie", "0.1.2")]
	public class Plugin : BaseUnityPlugin, IOnEventCallback
	{
		private const string Guid = "dest1n1.RideZombie";

		private ConfigEntry<bool> testZombieKey;

		private void Awake()
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			testZombieKey = ((BaseUnityPlugin)this).Config.Bind<bool>("Testing", "F8SpawnsFriendlyZombie", false, "Press F8 to spawn a friendly, rideable zombie in front of you.");
			RideCamera.Distance = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "Distance", 4f, "How far behind the zombie the camera sits while riding.");
			RideCamera.Height = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "Height", 1f, "How far above the zombie the camera looks from while riding.");
			new Harmony("dest1n1.RideZombie").PatchAll();
			PhotonNetwork.AddCallbackTarget((object)this);
		}

		private void Update()
		{
			if (PhotonNetwork.InRoom)
			{
				Rides.Tick();
				ZombieStaminaBar.Tick();
				if (testZombieKey.Value)
				{
					TestZombie.Tick();
				}
			}
			else
			{
				Rides.Reset();
			}
		}

		public void OnEvent(EventData photonEvent)
		{
			Rides.OnEvent(photonEvent);
		}
	}
	internal static class RideCamera
	{
		private const float WallGap = 0.2f;

		public static ConfigEntry<float> Distance;

		public static ConfigEntry<float> Height;

		private static bool showingSelf;

		public static void Follow(Transform camera)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00b1: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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)
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				return;
			}
			Character val = (Rides.IsRiding(localCharacter) ? localCharacter.data.carrier : null);
			if (showingSelf != ((Object)(object)val != (Object)null))
			{
				showingSelf = (Object)(object)val != (Object)null;
				LocalPlayerRenderer[] componentsInChildren = ((Component)localCharacter).GetComponentsInChildren<LocalPlayerRenderer>(true);
				foreach (LocalPlayerRenderer val2 in componentsInChildren)
				{
					((Renderer)((Component)val2).GetComponent<MeshRenderer>()).shadowCastingMode = (ShadowCastingMode)(showingSelf ? 1 : ((int)val2.renderMode));
				}
			}
			if (!((Object)(object)val == (Object)null))
			{
				Vector3 lookDirection = localCharacter.data.lookDirection;
				Vector3 val3 = val.Center + Vector3.up * Height.Value;
				Vector3 val4 = val3 - lookDirection * Distance.Value;
				RaycastHit val5 = HelperFunctions.LineCheck(val3, val4, (LayerType)1, 0f, (QueryTriggerInteraction)1);
				Vector3 val6;
				if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val5)).transform))
				{
					val6 = val4;
				}
				else
				{
					Vector3 point = ((RaycastHit)(ref val5)).point;
					Vector3 val7 = val3 - ((RaycastHit)(ref val5)).point;
					val6 = point + ((Vector3)(ref val7)).normalized * 0.2f;
				}
				camera.SetPositionAndRotation(val6, Quaternion.LookRotation(lookDirection));
			}
		}
	}
	internal static class RidePose
	{
		private const float CarryForce = 500f;

		private const float ShinReach = 0.1f;

		private static readonly (BodypartType Leg, BodypartType Knee, BodypartType Foot, float Side)[] Legs = new(BodypartType, BodypartType, BodypartType, float)[2]
		{
			((BodypartType)11, (BodypartType)12, (BodypartType)13, -1f),
			((BodypartType)14, (BodypartType)15, (BodypartType)16, 1f)
		};

		private const float SeatHeight = 0.05f;

		private const float SeatBack = 0.15f;

		private const float LegRaise = 70f;

		private const float LegSpread = 50f;

		private static readonly bool SitOnShoulders = false;

		private static Character SeatedOn(Character rider)
		{
			if (!SitOnShoulders)
			{
				return null;
			}
			return Rides.MountOf(rider);
		}

		public static bool Face(Character rider)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			Character val = SeatedOn(rider);
			if (val == null)
			{
				return false;
			}
			((Component)rider.refs.rigCreator).transform.rotation = Quaternion.LookRotation(val.data.lookDirection_Flat);
			return true;
		}

		public static bool Carry(Character rider)
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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_00ab: 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)
			Character val = Rides.MountOf(rider);
			if (val == null)
			{
				return false;
			}
			rider.refs.animations.SetBool("IsCarried", !SitOnShoulders);
			if (!SitOnShoulders)
			{
				return false;
			}
			Vector3 val2 = val.GetBodypart((BodypartType)4).transform.position + Vector3.up * 0.05f - val.data.lookDirection_Flat * 0.15f;
			Vector3 position = rider.GetBodypart((BodypartType)0).transform.position;
			rider.AddForce(Vector3.ClampMagnitude(val2 + val.data.avarageVelocity * 0.06f - position, 1f) * 500f, 1f, 1f);
			rider.refs.movement.ApplyExtraDrag(0.5f, true);
			rider.data.sinceGrounded = 0f;
			return true;
		}

		public static void Straddle(Character rider)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0078: 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_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)SeatedOn(rider) == (Object)null))
			{
				Quaternion rotation = ((Component)rider.refs.rigCreator).transform.rotation;
				Vector3 direction = rotation * (Vector3.down + Vector3.forward * 0.1f);
				(BodypartType, BodypartType, BodypartType, float)[] legs = Legs;
				for (int i = 0; i < legs.Length; i++)
				{
					(BodypartType, BodypartType, BodypartType, float) tuple = legs[i];
					BodypartType item = tuple.Item1;
					BodypartType item2 = tuple.Item2;
					BodypartType item3 = tuple.Item3;
					float item4 = tuple.Item4;
					Vector3 direction2 = rotation * Quaternion.AngleAxis(item4 * 50f, Vector3.forward) * Quaternion.AngleAxis(-70f, Vector3.right) * Vector3.down;
					Aim(rider.GetBodypart(item).transform, rider.GetBodypart(item2).transform, direction2);
					Aim(rider.GetBodypart(item2).transform, rider.GetBodypart(item3).transform, direction);
				}
			}
		}

		private static void Aim(Transform joint, Transform end, Vector3 direction)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			joint.rotation = Quaternion.FromToRotation(end.position - joint.position, direction) * joint.rotation;
		}
	}
	internal readonly struct RideInput
	{
		public readonly Vector2 Move;

		public readonly Vector2 Look;

		public readonly bool Sprint;

		public readonly bool Climb;

		public readonly int Jumps;

		public readonly int Attacks;

		public RideInput(Vector2 move, Vector2 look, bool sprint, bool climb, int jumps, int attacks)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			Move = move;
			Look = look;
			Sprint = sprint;
			Climb = climb;
			Jumps = jumps;
			Attacks = attacks;
		}

		public RideInput Idle()
		{
			//IL_0000: 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)
			return new RideInput(Vector2.zero, Look, sprint: false, climb: false, Jumps, Attacks);
		}

		public object[] ToEvent(int zombieId)
		{
			return new object[9] { zombieId, Move.x, Move.y, Look.x, Look.y, Sprint, Climb, Jumps, Attacks };
		}

		public static RideInput FromEvent(object[] data)
		{
			//IL_0010: 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)
			return new RideInput(new Vector2((float)data[1], (float)data[2]), new Vector2((float)data[3], (float)data[4]), (bool)data[5], (bool)data[6], (int)data[7], (int)data[8]);
		}
	}
	internal readonly struct Steering
	{
		public readonly RideInput Latest;

		public readonly float ReceivedAt;

		public readonly RideInput Applied;

		public Steering(RideInput latest, float receivedAt, RideInput applied)
		{
			Latest = latest;
			ReceivedAt = receivedAt;
			Applied = applied;
		}
	}
	internal static class Rides
	{
		private const string KeyPrefix = "RideZombie.";

		private const byte RideEvent = 181;

		private const byte DismountEvent = 182;

		private const byte InputEvent = 183;

		private const byte StaminaEvent = 184;

		private const float MaxMountDistance = 4f;

		private const float InputInterval = 0.05f;

		private const float InputTimeout = 0.5f;

		private const float SprintStamina = 0.05f;

		private const float JumpStamina = 0.05f;

		private const float SprintJumpStamina = 0.15f;

		private const float LungeStamina = 0.2f;

		private const float DismountDistance = 1.2f;

		private const float StandingCenterHeight = 0.9f;

		private static readonly Dictionary<int, int> riders = new Dictionary<int, int>();

		private static readonly Dictionary<Character, Character> attached = new Dictionary<Character, Character>();

		private static readonly Dictionary<int, int?> published = new Dictionary<int, int?>();

		private static readonly Dictionary<int, Steering> steering = new Dictionary<int, Steering>();

		private static RideInput captured;

		private static float nextSend;

		public unsafe static void Tick()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Invalid comparison between Unknown and I4
			riders.Clear();
			DictionaryEntryEnumerator enumerator = ((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties.GetEnumerator();
			try
			{
				while (((DictionaryEntryEnumerator)(ref enumerator)).MoveNext())
				{
					DictionaryEntry current = ((DictionaryEntryEnumerator)(ref enumerator)).Current;
					if (current.Key is string text && text.StartsWith("RideZombie.") && current.Value is int value)
					{
						riders[int.Parse(text.Substring("RideZombie.".Length))] = value;
					}
				}
			}
			finally
			{
				((IDisposable)(*(DictionaryEntryEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose();
			}
			Attach();
			foreach (int item in steering.Keys.Where((int id) => !riders.ContainsKey(id)).ToList())
			{
				steering.Remove(item);
			}
			if (PhotonNetwork.IsMasterClient)
			{
				foreach (KeyValuePair<int, int> rider in riders)
				{
					rider.Deconstruct(out var key, out var value2);
					int num = key;
					int viewId = value2;
					MushroomZombie val = Find<MushroomZombie>(num);
					Character val2 = Find<Character>(viewId);
					if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || !Conscious(val2) || (!Upright(val) && (int)val.currentState != 4))
					{
						Publish(num, null);
					}
				}
			}
			else
			{
				published.Clear();
			}
			SendInput();
		}

		public static void Reset()
		{
			riders.Clear();
			attached.Clear();
			published.Clear();
			steering.Clear();
			captured = default(RideInput);
		}

		public static bool IsRiding(Character character)
		{
			return ZombieRiddenBy(((MonoBehaviourPun)character).photonView.ViewID).HasValue;
		}

		public static Character MountOf(Character rider)
		{
			if (!attached.TryGetValue(rider, out var value))
			{
				return null;
			}
			return value;
		}

		public static bool CanRide(Character rider, MushroomZombie zombie)
		{
			if (!riders.ContainsKey(((MonoBehaviourPun)zombie).photonView.ViewID) && !IsRiding(rider) && Upright(zombie) && Conscious(rider) && !rider.data.isCarried && (Object)(object)rider.data.carriedPlayer == (Object)null)
			{
				return !rider.data.isClimbingAnything;
			}
			return false;
		}

		public static void RequestRide(Character rider, MushroomZombie zombie)
		{
			ToMaster(181, new int[2]
			{
				((MonoBehaviourPun)zombie).photonView.ViewID,
				((MonoBehaviourPun)rider).photonView.ViewID
			});
		}

		private static void RequestDismount(Character rider)
		{
			ToMaster(182, ((MonoBehaviourPun)rider).photonView.ViewID);
		}

		public static void OnEvent(EventData photonEvent)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			switch (photonEvent.Code)
			{
			case 181:
			case 182:
				if (PhotonNetwork.IsMasterClient)
				{
					Handle(photonEvent.Code, photonEvent.CustomData);
				}
				break;
			case 183:
			{
				object[] array2 = (object[])photonEvent.CustomData;
				Receive((int)array2[0], RideInput.FromEvent(array2));
				Character val2 = Find<Character>((int)array2[0]);
				if ((Object)(object)val2 != (Object)null && ((MonoBehaviourPun)val2).photonView.IsMine)
				{
					object[] obj = new object[2]
					{
						(int)array2[0],
						val2.data.currentStamina
					};
					RaiseEventOptions val3 = new RaiseEventOptions();
					val3.TargetActors = new int[1] { photonEvent.Sender };
					PhotonNetwork.RaiseEvent((byte)184, (object)obj, val3, SendOptions.SendUnreliable);
				}
				break;
			}
			case 184:
			{
				object[] array = (object[])photonEvent.CustomData;
				Character val = Find<Character>((int)array[0]);
				if ((Object)(object)val != (Object)null)
				{
					val.data.currentStamina = (float)array[1];
				}
				break;
			}
			}
		}

		public static void Capture(CharacterInput input)
		{
			//IL_0029: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if (!IsRiding(localCharacter))
			{
				captured = default(RideInput);
				return;
			}
			if (input.interactWasPressed)
			{
				RequestDismount(localCharacter);
			}
			captured = new RideInput(input.movementInput, default(Vector2), input.sprintIsPressed, input.usePrimaryIsPressed, captured.Jumps + (input.jumpWasPressed ? 1 : 0), captured.Attacks + (input.useSecondaryWasPressed ? 1 : 0));
			Vector2 lookInput = input.lookInput;
			input.ResetInput();
			input.lookInput = lookInput;
		}

		public static void Steer(MushroomZombie zombie)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Invalid comparison between Unknown and I4
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Invalid comparison between Unknown and I4
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Invalid comparison between Unknown and I4
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			int viewID = ((MonoBehaviourPun)zombie).photonView.ViewID;
			bool flag = riders.ContainsKey(viewID);
			if (!((MonoBehaviourPun)zombie).photonView.IsMine || (!flag && !TestZombie.IsFriendly(zombie)))
			{
				return;
			}
			if ((int)zombie.currentState == 0)
			{
				zombie.WakeUpFromSleep();
			}
			State currentState = zombie.currentState;
			if (currentState - 2 <= 1)
			{
				zombie.currentState = (State)5;
			}
			zombie.timeSpentRecoveringFromLunge = 0f;
			if (!flag)
			{
				return;
			}
			steering.TryGetValue(viewID, out var value);
			bool num = Time.time - value.ReceivedAt <= 0.5f;
			RideInput applied = (num ? value.Latest : value.Latest.Idle());
			Character character = zombie.character;
			if (num)
			{
				character.data.lookValues = applied.Look;
			}
			if (applied.Attacks != value.Applied.Attacks && character.data.isGrounded && (int)zombie.currentState == 5 && character.GetTotalStamina() >= 0.2f)
			{
				character.UseStamina(0.2f, true, false);
				zombie.lungeTargetForward = character.Center + character.data.lookDirection * 100f;
				character.input.jumpWasPressed = true;
				zombie.currentState = (State)4;
				zombie.timeSpentLunging = 0f;
			}
			else if ((int)zombie.currentState != 4)
			{
				character.input.movementInput = applied.Move;
				character.input.sprintIsPressed = applied.Sprint;
				if (character.data.isGrounded && character.data.isSprinting)
				{
					character.UseStamina(0.05f * Time.deltaTime, true, false);
				}
				if (applied.Jumps != value.Applied.Jumps)
				{
					character.input.jumpWasPressed = true;
					if (character.data.isGrounded)
					{
						character.UseStamina(character.data.isSprinting ? 0.15f : 0.05f, true, false);
					}
				}
				if (character.data.isClimbing)
				{
					character.input.usePrimaryWasReleased = value.Applied.Climb && !applied.Climb;
				}
				else if (applied.Climb)
				{
					character.refs.climbing.TryClimb(1.25f);
				}
			}
			steering[viewID] = new Steering(value.Latest, value.ReceivedAt, applied);
		}

		public static bool LandLunge(MushroomZombie zombie)
		{
			if (!riders.ContainsKey(((MonoBehaviourPun)zombie).photonView.ViewID) || zombie.timeSpentLunging + Time.deltaTime < zombie.lungeTime)
			{
				return false;
			}
			zombie.timeSpentLunging = 0f;
			zombie.currentState = (State)5;
			return true;
		}

		public static void Bite(MushroomZombie biter, Collider other)
		{
			Character val = default(Character);
			MushroomZombie val2 = default(MushroomZombie);
			if (riders.ContainsKey(((MonoBehaviourPun)biter).photonView.ViewID) && CharacterRagdoll.TryGetCharacterFromCollider(other, ref val) && (Object)(object)val != (Object)(object)biter.character && ((MonoBehaviourPun)val).photonView.IsMine && ((Component)val).TryGetComponent<MushroomZombie>(ref val2) && val.data.fallSeconds <= 0f)
			{
				val.Fall(biter.biteStunTime, 0f);
			}
		}

		private static bool Upright(MushroomZombie zombie)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Invalid comparison between Unknown and I4
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			State currentState = zombie.currentState;
			bool flag = ((currentState - 2 <= 1 || (int)currentState == 5) ? true : false);
			if (flag && zombie.character.data.fallSeconds <= 0f)
			{
				return !zombie.character.data.passedOut;
			}
			return false;
		}

		private static bool Conscious(Character character)
		{
			if (!character.data.dead && !character.data.passedOut)
			{
				return !character.data.fullyPassedOut;
			}
			return false;
		}

		private static void Attach()
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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)
			Dictionary<Character, Character> dictionary = new Dictionary<Character, Character>();
			foreach (KeyValuePair<int, int> rider in riders)
			{
				rider.Deconstruct(out var key, out var value);
				int viewId = key;
				int viewId2 = value;
				MushroomZombie val = Find<MushroomZombie>(viewId);
				Character val2 = Find<Character>(viewId2);
				if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null)
				{
					dictionary[val2] = val.character;
				}
			}
			Character value2;
			Character key2;
			foreach (KeyValuePair<Character, Character> item in attached.ToList())
			{
				item.Deconstruct(out value2, out key2);
				Character val3 = value2;
				Character val4 = key2;
				if (dictionary.TryGetValue(val3, out var value3) && !((Object)(object)value3 != (Object)(object)val4))
				{
					continue;
				}
				attached.Remove(val3);
				if ((Object)(object)val3 == (Object)null)
				{
					continue;
				}
				SetCarrier(val3, null);
				if (val3.IsLocal && (Object)(object)val4 != (Object)null)
				{
					Vector3? val5 = DismountSpot(val4);
					if (val5.HasValue)
					{
						Vector3 valueOrDefault = val5.GetValueOrDefault();
						val3.WarpPlayer(valueOrDefault, false);
					}
				}
			}
			foreach (KeyValuePair<Character, Character> item2 in dictionary)
			{
				item2.Deconstruct(out key2, out value2);
				Character val6 = key2;
				Character val7 = value2;
				if (!attached.ContainsKey(val6))
				{
					attached[val6] = val7;
					SetCarrier(val6, val7);
				}
			}
		}

		private static Vector3? DismountSpot(Character zombie)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = -zombie.data.lookDirection_Flat;
			Vector3 val2 = Vector3.Cross(Vector3.up, val);
			Vector3[] array = (Vector3[])(object)new Vector3[4]
			{
				val,
				val2,
				-val2,
				-val
			};
			foreach (Vector3 val3 in array)
			{
				Vector3 val4 = zombie.Center + val3 * 1.2f;
				RaycastHit val5 = HelperFunctions.LineCheck(zombie.Center, val4 + val3 * 0.3f, (LayerType)1, 0f, (QueryTriggerInteraction)1);
				if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val5)).transform))
				{
					RaycastHit val6 = HelperFunctions.LineCheck(val4 + Vector3.up, val4 + Vector3.down * 3f, (LayerType)1, 0f, (QueryTriggerInteraction)1);
					return Object.op_Implicit((Object)(object)((RaycastHit)(ref val6)).transform) ? (((RaycastHit)(ref val6)).point + Vector3.up * 0.9f) : val4;
				}
			}
			return null;
		}

		private static void SetCarrier(Character rider, Character carrier)
		{
			rider.refs.carriying.ToggleCarryPhysics((Object)(object)carrier != (Object)null);
			rider.data.isCarried = (Object)(object)carrier != (Object)null;
			rider.data.carrier = carrier;
		}

		private static void SendInput()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if ((Object)(object)localCharacter == (Object)null)
			{
				return;
			}
			int? num = ZombieRiddenBy(((MonoBehaviourPun)localCharacter).photonView.ViewID);
			if (!num.HasValue)
			{
				return;
			}
			int valueOrDefault = num.GetValueOrDefault();
			MushroomZombie val = Find<MushroomZombie>(valueOrDefault);
			if (!((Object)(object)val == (Object)null))
			{
				RideInput input = new RideInput(captured.Move, localCharacter.data.lookValues, captured.Sprint, captured.Climb, captured.Jumps, captured.Attacks);
				if (((MonoBehaviourPun)val).photonView.IsMine)
				{
					Receive(valueOrDefault, input);
				}
				else if (Time.time >= nextSend)
				{
					nextSend = Time.time + 0.05f;
					object[] array = input.ToEvent(valueOrDefault);
					RaiseEventOptions val2 = new RaiseEventOptions();
					val2.TargetActors = new int[1] { ((MonoBehaviourPun)val).photonView.ControllerActorNr };
					PhotonNetwork.RaiseEvent((byte)183, (object)array, val2, SendOptions.SendUnreliable);
				}
			}
		}

		private static void Receive(int zombieId, RideInput input)
		{
			steering.TryGetValue(zombieId, out var value);
			steering[zombieId] = new Steering(input, Time.time, value.Applied);
		}

		private static void ToMaster(byte code, object content)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			if (PhotonNetwork.IsMasterClient)
			{
				Handle(code, content);
				return;
			}
			PhotonNetwork.RaiseEvent(code, content, new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)2
			}, SendOptions.SendReliable);
		}

		private static void Handle(byte code, object content)
		{
			//IL_0071: 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)
			if (code == 181)
			{
				int[] array = (int[])content;
				MushroomZombie val = Find<MushroomZombie>(array[0]);
				Character val2 = Find<Character>(array[1]);
				if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null && !published.GetValueOrDefault(array[0]).HasValue && !published.ContainsValue(array[1]) && CanRide(val2, val) && Vector3.Distance(val2.Center, val.character.Center) <= 4f)
				{
					Publish(array[0], array[1]);
				}
			}
			else
			{
				int? num = ZombieRiddenBy((int)content);
				if (num.HasValue)
				{
					int valueOrDefault = num.GetValueOrDefault();
					Publish(valueOrDefault, null);
				}
			}
		}

		private static void Publish(int zombieId, int? riderId)
		{
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			if (!published.TryGetValue(zombieId, out var value) || value != riderId)
			{
				published[zombieId] = riderId;
				PhotonNetwork.CurrentRoom.SetCustomProperties(new Hashtable { [(object)("RideZombie." + zombieId)] = riderId }, (Hashtable)null, (WebFlags)null);
			}
		}

		private static int? ZombieRiddenBy(int riderId)
		{
			foreach (var (value, num3) in riders)
			{
				if (num3 == riderId)
				{
					return value;
				}
			}
			return null;
		}

		private static T Find<T>(int viewId) where T : Component
		{
			PhotonView photonView = PhotonNetwork.GetPhotonView(viewId);
			if (!((Object)(object)photonView == (Object)null))
			{
				return ((Component)photonView).GetComponent<T>();
			}
			return default(T);
		}
	}
	internal static class TestZombie
	{
		private const string Marker = "RideZombie.Friendly";

		private const Key SpawnKey = (Key)101;

		private const float SpawnDistance = 3f;

		public static bool IsFriendly(MushroomZombie zombie)
		{
			object[] instantiationData = ((MonoBehaviourPun)zombie).photonView.InstantiationData;
			if (instantiationData != null && instantiationData.Length == 1 && instantiationData[0] is string text)
			{
				return text == "RideZombie.Friendly";
			}
			return false;
		}

		public static void Tick()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: 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_004a: 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_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_005f: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: 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_00a3: 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_00ad: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null))
			{
				Keyboard current = Keyboard.current;
				if (current != null && ((ButtonControl)current[(Key)101]).wasPressedThisFrame)
				{
					Vector3 val = localCharacter.Center + localCharacter.data.lookDirection_Flat * 3f;
					RaycastHit val2 = HelperFunctions.LineCheck(val + Vector3.up * 3f, val + Vector3.down * 10f, (LayerType)1, 0f, (QueryTriggerInteraction)1);
					PhotonNetwork.Instantiate("MushroomZombie", Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).transform) ? ((RaycastHit)(ref val2)).point : val, Quaternion.LookRotation(-localCharacter.data.lookDirection_Flat), (byte)0, new object[1] { "RideZombie.Friendly" }).GetComponent<MushroomZombie>().lifetime = float.PositiveInfinity;
				}
			}
		}
	}
	internal static class ZombieStaminaBar
	{
		private const float Gap = 8f;

		private static readonly Color Fill = new Color(0.22f, 0.52f, 0.08f);

		private static StaminaBar bar;

		public static void Tick()
		{
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0233: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			Character val = (((Object)(object)localCharacter == (Object)null) ? null : Rides.MountOf(localCharacter));
			if ((Object)(object)bar == (Object)null && (Object)(object)val == (Object)null)
			{
				return;
			}
			if ((Object)(object)bar == (Object)null)
			{
				bar = Clone(GUIManager.instance.bar);
			}
			((Component)bar).gameObject.SetActive((Object)(object)val != (Object)null);
			if (!((Object)(object)val == (Object)null))
			{
				float currentStamina = val.data.currentStamina;
				float x = bar.fullBar.sizeDelta.x;
				float num = Mathf.Max(0f, currentStamina * x + bar.staminaBarOffset);
				float num2 = Time.deltaTime * 10f;
				Resize(bar.staminaBar, Mathf.Lerp(bar.staminaBar.sizeDelta.x, num, num2));
				Resize(bar.maxStaminaBar, Mathf.Lerp(bar.maxStaminaBar.sizeDelta.x, Mathf.Max(0f, val.GetMaxStamina() * x + bar.staminaBarOffset), num2));
				Resize(bar.staminaBarOutline, 14f + x);
				((Component)bar.staminaBar).gameObject.SetActive(bar.staminaBar.sizeDelta.x > bar.minStaminaBarWidth);
				((Component)bar.maxStaminaBar).gameObject.SetActive(bar.maxStaminaBar.sizeDelta.x > bar.minStaminaBarWidth);
				float num3 = Mathf.Clamp01((bar.staminaBar.sizeDelta.x - num) * 0.5f);
				bar.sinTime = (bar.sinTime + num2 * num3) % (MathF.PI * 2f);
				Color color = ((Graphic)bar.staminaGlow).color;
				color.a = num3 * 0.4f - Mathf.Abs(Mathf.Sin(bar.sinTime)) * 0.2f;
				((Graphic)bar.staminaGlow).color = color;
				if (currentStamina <= 0.005f && !bar.outOfStamina)
				{
					bar.OutOfStaminaPulse();
				}
				bar.outOfStamina = currentStamina <= 0.005f;
			}
		}

		private static StaminaBar Clone(StaminaBar source)
		{
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: 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_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			StaminaBar component = Object.Instantiate<GameObject>(((Component)source).gameObject, ((Component)source).transform.parent).GetComponent<StaminaBar>();
			((Behaviour)component).enabled = false;
			((Component)component).gameObject.AddComponent<LayoutElement>().ignoreLayout = true;
			BarAffliction[] componentsInChildren = ((Component)component).GetComponentsInChildren<BarAffliction>(true);
			BarAffliction[] array = componentsInChildren;
			for (int i = 0; i < array.Length; i++)
			{
				((Component)array[i]).gameObject.SetActive(false);
			}
			Component[] array2 = (Component[])(object)new Component[6]
			{
				(Component)component.extraBar,
				(Component)component.shield.transform,
				(Component)component.campfire.transform,
				(Component)component.moraleBoostText,
				(Component)component.rainbowStamina,
				(Component)component.staminaBarOutlineOverflowBar
			};
			for (int i = 0; i < array2.Length; i++)
			{
				array2[i].gameObject.SetActive(false);
			}
			Transform transform = ((Component)componentsInChildren.First((BarAffliction a) => (int)a.afflictionType == 10)).transform;
			Image component2 = ((Component)transform.Find("Fill")).GetComponent<Image>();
			Image component3 = ((Component)((Transform)component.staminaBar).Find("Fill")).GetComponent<Image>();
			component3.sprite = component2.sprite;
			((Graphic)component3).material = ((Graphic)component2).material;
			component3.type = component2.type;
			component3.pixelsPerUnitMultiplier = component2.pixelsPerUnitMultiplier;
			((Graphic)component3).color = Fill;
			RectTransform val = (RectTransform)Object.Instantiate<GameObject>(((Component)transform.Find("Outline")).gameObject, ((Component)component3).transform, false).transform;
			val.sizeDelta = new Vector2(6f, 8f);
			((Graphic)((Component)val).GetComponent<Image>()).color = Fill;
			RectTransform val2 = (RectTransform)((Component)component).transform;
			val2.anchoredPosition += Vector2.up * (component.staminaBarOutline.sizeDelta.y + 8f);
			return component;
		}

		private static void Resize(RectTransform rect, float width)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			rect.sizeDelta = new Vector2(Mathf.Max(0f, width), rect.sizeDelta.y);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}