Decompiled source of morninScrap v1.0.1

morninscrap/Cake2g.morninScrap.dll

Decompiled 3 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using morninScrap.Behaviours;
using morninScrap.Utils;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Cake2g.morninScrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("morninScrap")]
[assembly: AssemblyTitle("Cake2g.morninScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 morninScrap
{
	[BepInPlugin("Cake2g.morninScrap", "morninScrap", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class morninScrap : BaseUnityPlugin
	{
		public static List<AudioClip> audioClips;

		public static morninScrap Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "morninScrap");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/frazerClubCard.asset");
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, 20, (LevelTypes)(-1));
			Item val3 = val.LoadAsset<Item>("Assets/pixzaBox.asset");
			eatPizza eatPizza = val3.spawnPrefab.AddComponent<eatPizza>();
			((GrabbableObject)eatPizza).grabbable = true;
			((GrabbableObject)eatPizza).grabbableToEnemies = true;
			((GrabbableObject)eatPizza).itemProperties = val3;
			Utilities.FixMixerGroups(val3.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
			Items.RegisterScrap(val3, 20, (LevelTypes)(-1));
			TerminalNode val4 = ScriptableObject.CreateInstance<TerminalNode>();
			val4.clearPreviousText = true;
			val4.displayText = "For only 99 credits, who could resist?\n\n";
			Items.RegisterShopItem(val3, (TerminalNode)null, (TerminalNode)null, val4, 99);
			Item val5 = val.LoadAsset<Item>("Assets/gnome.asset");
			Utilities.FixMixerGroups(val5.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
			Items.RegisterScrap(val5, 20, (LevelTypes)(-1));
			Item val6 = val.LoadAsset<Item>("Assets/cake.asset");
			eatCake eatCake = val6.spawnPrefab.AddComponent<eatCake>();
			((GrabbableObject)eatCake).grabbable = true;
			((GrabbableObject)eatCake).grabbableToEnemies = true;
			((GrabbableObject)eatCake).itemProperties = val6;
			Utilities.FixMixerGroups(val6.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
			Items.RegisterScrap(val6, 20, (LevelTypes)(-1));
			TerminalNode val7 = ScriptableObject.CreateInstance<TerminalNode>();
			val7.clearPreviousText = true;
			val7.displayText = "Delicious!\n\n";
			Items.RegisterShopItem(val6, (TerminalNode)null, (TerminalNode)null, val7, 60);
			Item val8 = val.LoadAsset<Item>("Assets/kenzof1.asset");
			Utilities.FixMixerGroups(val8.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
			Items.RegisterScrap(val8, 20, (LevelTypes)(-1));
			Item val9 = val.LoadAsset<Item>("Assets/rat.asset");
			Utilities.FixMixerGroups(val9.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
			Items.RegisterScrap(val9, 20, (LevelTypes)(-1));
			string text2 = "Assets/";
			audioClips = new List<AudioClip>
			{
				val.LoadAsset<AudioClip>(text2 + "Audio/gnomegremlin.ogg"),
				val.LoadAsset<AudioClip>(text2 + "Audio/BeeHiveGrab.ogg"),
				val.LoadAsset<AudioClip>(text2 + "Audio/gulp.ogg")
			};
			Logger.LogInfo((object)"Cake2g.morninScrap v1.0.0 has loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Cake2g.morninScrap";

		public const string PLUGIN_NAME = "morninScrap";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace morninScrap.Utils
{
	internal class Effects
	{
		public enum DeathAnimation
		{
			Normal,
			NoHead1,
			Spring,
			Haunted,
			Mask1,
			Mask2,
			Fire,
			CutInHalf,
			NoHead2
		}

		public static int NbOfPlayers()
		{
			return StartOfRound.Instance.connectedPlayersAmount + 1;
		}

		public static List<PlayerControllerB> GetPlayers(bool includeDead = false)
		{
			List<PlayerControllerB> list = Object.FindObjectsOfType<PlayerControllerB>().ToList();
			List<PlayerControllerB> list2 = new List<PlayerControllerB>(list);
			foreach (PlayerControllerB item in list)
			{
				if (item.playerSteamId == 0 || (!includeDead && item.isPlayerDead))
				{
					list2.Remove(item);
				}
			}
			return list2;
		}

		public static List<EnemyAI> GetEnemies(bool includeDead = false, bool includeCanDie = false)
		{
			List<EnemyAI> list = Object.FindObjectsOfType<EnemyAI>().ToList();
			List<EnemyAI> list2 = new List<EnemyAI>(list);
			if (includeDead)
			{
				return list2;
			}
			foreach (EnemyAI item in list)
			{
				if (item.isEnemyDead || (!includeCanDie && !item.enemyType.canDie))
				{
					list2.Remove(item);
				}
			}
			return list2;
		}

		public static void Damage(PlayerControllerB player, int damageNb, CauseOfDeath cause = 0, int animation = 0, bool criticalBlood = true)
		{
			//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_0031: Unknown result type (might be due to invalid IL or missing references)
			if (criticalBlood && player.health - damageNb <= 20)
			{
				player.bleedingHeavily = true;
			}
			player.DamagePlayer(damageNb, true, true, cause, animation, false, default(Vector3));
		}

		public static IEnumerator DamageHost(PlayerControllerB player, int damageNb, CauseOfDeath cause = 0, int animation = 0, bool criticalBlood = true)
		{
			//IL_0015: 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)
			yield return (object)new WaitForEndOfFrame();
			Damage(player, damageNb, cause, animation, criticalBlood);
		}

		public static void Heal(ulong playerID, int health)
		{
			PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[playerID];
			val.health += health;
			if (val.health > 100)
			{
				val.health = 100;
			}
			val.criticallyInjured = false;
			val.bleedingHeavily = false;
			val.playerBodyAnimator.SetBool("Limp", false);
		}

		public static void Teleportation(PlayerControllerB player, Vector3 position, bool ship = false, bool exterior = false, bool interior = false)
		{
			//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_006d: Unknown result type (might be due to invalid IL or missing references)
			if (ship)
			{
				player.isInElevator = true;
				player.isInHangarShipRoom = true;
				player.isInsideFactory = false;
			}
			if (exterior)
			{
				player.isInElevator = false;
				player.isInHangarShipRoom = false;
				player.isInsideFactory = false;
			}
			if (interior)
			{
				player.isInElevator = false;
				player.isInHangarShipRoom = false;
				player.isInsideFactory = true;
			}
			player.averageVelocity = 0f;
			player.velocityLastFrame = Vector3.zero;
			player.TeleportPlayer(position, true, 0f, false, true);
			player.beamOutParticle.Play();
			HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
		}

		public static void Explosion(Vector3 position, float range, int damage = 50, float physicsForce = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(position, true, range, range * 2.5f, damage, physicsForce, (GameObject)null, false);
		}

		public static void ExplosionLight(Vector3 position, float range, int damage = 10, float physicsForce = 1f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(position, true, 0f, range, damage, physicsForce, (GameObject)null, false);
		}

		public static IEnumerator ExplosionHostDeath(Vector3 position, float range, int damage = 50, float physicsForce = 1f)
		{
			//IL_0007: 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)
			yield return (object)new WaitForEndOfFrame();
			Explosion(position, range, damage, physicsForce);
		}

		public static void Knockback(Vector3 position, float range, int damage = 0, float physicsForce = 30f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Landmine.SpawnExplosion(position, false, 0f, range, damage, physicsForce, (GameObject)null, false);
		}

		public static void DropItem(Vector3 placingPosition = default(Vector3))
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			GameNetworkManager.Instance.localPlayerController.DiscardHeldObject(true, (NetworkObject)null, placingPosition, true);
		}

		public static void Audio(int audioID, float volume)
		{
			RoundManager.PlayRandomClip(HUDManager.Instance.UIAudio, (AudioClip[])(object)new AudioClip[1] { morninScrap.audioClips[audioID] }, false, volume, 0, 1000);
		}

		public static void Audio(int audioID, Vector3 position, float volume, bool adjust = true)
		{
			//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_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = position;
			if (adjust)
			{
				val += Vector3.up * 2f;
			}
			AudioSource.PlayClipAtPoint(morninScrap.audioClips[audioID], val, volume);
		}

		public static void Audio(int audioID, Vector3 clientPosition, float localVolume, float clientVolume, PlayerControllerB player)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)player != (Object)null && GameNetworkManager.Instance.localPlayerController.playerClientId == player.playerClientId)
			{
				Audio(audioID, localVolume);
			}
			else
			{
				Audio(audioID, clientPosition, clientVolume);
			}
		}

		public static void Audio(int audioID, Vector3 position, float volume, float pitch, bool adjust = true)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			AudioClip val = morninScrap.audioClips[audioID];
			Vector3 val2 = position;
			if (adjust)
			{
				val2 += Vector3.up * 2f;
			}
			GameObject val3 = new GameObject("One shot audio");
			val3.transform.position = val2;
			AudioSource val4 = (AudioSource)val3.AddComponent(typeof(AudioSource));
			val4.clip = val;
			val4.spatialBlend = 1f;
			val4.volume = volume;
			val4.pitch = pitch;
			val4.Play();
			Object.Destroy((Object)(object)val3, val.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale));
		}

		public static void Audio(int[] audioIDs, Vector3 position, float volume, bool adjust = true)
		{
			//IL_002c: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_005c: 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: Expected O, but got Unknown
			//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_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_004a: Unknown result type (might be due to invalid IL or missing references)
			AudioClip[] array = audioIDs.Select((int id) => morninScrap.audioClips[id]).ToArray();
			Vector3 val = position;
			if (adjust)
			{
				val += Vector3.up * 2f;
			}
			GameObject val2 = new GameObject("One shot audio");
			val2.transform.position = val;
			AudioSource val3 = (AudioSource)val2.AddComponent(typeof(AudioSource));
			val3.spatialBlend = 1f;
			val3.volume = volume;
			RoundManager.PlayRandomClip(val3, array, true, volume, 0, 1000);
			Object.Destroy((Object)(object)val2, array[^1].length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale));
		}

		public static void Message(string title, string bottom, bool warning = false)
		{
			HUDManager.Instance.DisplayTip(title, bottom, warning, false, "LC_Tip1");
		}

		public static IEnumerator Status(string text)
		{
			while (true)
			{
				HUDManager.Instance.DisplayStatusEffect(text);
				yield return (object)new WaitForSeconds(1f);
			}
		}

		public static void Spawn(SpawnableEnemyWithRarity enemy, Vector3 position)
		{
			//IL_000c: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, position, Quaternion.Euler(new Vector3(0f, 0f, 0f)));
			val.GetComponentInChildren<NetworkObject>().Spawn(true);
			RoundManager.Instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
		}

		public static void Spawn(string scrapName, Vector3 position)
		{
			//IL_003a: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			string scrapName2 = scrapName;
			SpawnableItemWithRarity val = ((IEnumerable<SpawnableItemWithRarity>)RoundManager.Instance.currentLevel.spawnableScrap).FirstOrDefault((Func<SpawnableItemWithRarity, bool>)((SpawnableItemWithRarity i) => ((Object)i.spawnableItem).name.Equals(scrapName2)));
			GameObject val2 = Object.Instantiate<GameObject>(val.spawnableItem.spawnPrefab, position, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer);
			GrabbableObject component = val2.GetComponent<GrabbableObject>();
			((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
			component.fallTime = 0f;
			component.scrapValue = (int)((float)Random.Range(val.spawnableItem.minValue, val.spawnableItem.maxValue) * RoundManager.Instance.scrapValueMultiplier);
			NetworkObject component2 = val2.GetComponent<NetworkObject>();
			component2.Spawn(false);
			component.FallToGround(true);
		}

		public static void SpawnQuicksand(int nb)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_0078: 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_0080: 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_008a: 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)
			Random random = new Random(StartOfRound.Instance.randomMapSeed + 2);
			GameObject[] array = (from x in GameObject.FindGameObjectsWithTag("OutsideAINode")
				orderby Vector3.Distance(x.transform.position, Vector3.zero)
				select x).ToArray();
			NavMeshHit val = default(NavMeshHit);
			for (int i = 0; i < nb; i++)
			{
				Vector3 position = array[random.Next(0, array.Length)].transform.position;
				Vector3 val2 = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(position, 30f, val, random, -1) + Vector3.up;
				GameObject val3 = Object.Instantiate<GameObject>(RoundManager.Instance.quicksandPrefab, val2, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform);
			}
		}
	}
}
namespace morninScrap.Patches
{
	[HarmonyPatch(typeof(TVScript))]
	public class ExampleTVPatch
	{
		[HarmonyPatch("SwitchTVLocalClient")]
		[HarmonyPrefix]
		private static void SwitchTVPrefix(TVScript __instance)
		{
			StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn);
		}
	}
}
namespace morninScrap.Behaviours
{
	public class eatCake : PhysicsProp
	{
		private int bitesLeft = 6;

		private string[] allLines = new string[1] { "Consume Cake (6/6): [LMB]" };

		public Vector3? originalPosition = null;

		public Vector3? originalRotation = null;

		public PlayerControllerB thismotherfucker = null;

		public override void SetControlTipsForItem()
		{
			((GrabbableObject)this).SetControlTipsForItem();
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				HUDManager.Instance.ChangeControlTipMultiple(allLines, true, ((GrabbableObject)this).itemProperties);
			}
			else
			{
				HUDManager.Instance.ClearControlTips();
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && bitesLeft != 0)
			{
				thismotherfucker = ((GrabbableObject)this).playerHeldBy;
				Debug.Log((object)thismotherfucker);
				PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
				PlayerControllerB playerHeldBy2 = ((GrabbableObject)this).playerHeldBy;
				playerHeldBy.movementSpeed = (playerHeldBy2.movementSpeed += 3f);
				Debug.Log((object)((GrabbableObject)this).playerHeldBy.movementSpeed);
				((GrabbableObject)this).playerHeldBy.sprintMeter = 10f;
				HUDManager.Instance.flashFilter = 0.14f;
				bitesLeft--;
				PlayerControllerB playerHeldBy3 = ((GrabbableObject)this).playerHeldBy;
				((MonoBehaviour)this).StartCoroutine(CakeEffect(playerHeldBy3));
				allLines = new string[1] { "Consume Cake (" + bitesLeft + "/6): [LMB]" };
				((GrabbableObject)this).SetControlTipsForItem();
				if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					HUDManager.Instance.ChangeControlTipMultiple(allLines, true, ((GrabbableObject)this).itemProperties);
					originalPosition = ((GrabbableObject)this).itemProperties.positionOffset;
					originalRotation = ((GrabbableObject)this).itemProperties.rotationOffset;
					UpdatePosRotServerRpc(new Vector3(0.05f, 0.1f, 0.05f), ((GrabbableObject)this).itemProperties.rotationOffset);
					((GrabbableObject)this).playerHeldBy.activatingItem = true;
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", true);
				}
				else
				{
					HUDManager.Instance.ClearControlTips();
				}
				((GrabbableObject)this).SetScrapValue(((GrabbableObject)this).scrapValue = ((GrabbableObject)this).scrapValue - ((GrabbableObject)this).scrapValue / 6);
				((GrabbableObject)this).useCooldown = 12f;
				((GrabbableObject)this).RequireCooldown();
				Debug.Log((object)("Bites left: " + bitesLeft));
			}
		}

		private IEnumerator CakeEffect(PlayerControllerB player)
		{
			if (!((NetworkBehaviour)this).IsOwner)
			{
				yield break;
			}
			Debug.Log((object)((GrabbableObject)this).playerHeldBy);
			Debug.Log((object)thismotherfucker);
			yield return (object)new WaitForSeconds(0.8f);
			AudioServerRpc(2, ((Component)thismotherfucker).transform.position, 1f, 1.8f);
			yield return (object)new WaitForSeconds(0.8f);
			UpdatePosRotServerRpc((Vector3)(originalPosition.HasValue ? originalPosition.Value : default(Vector3)), (Vector3)(originalRotation.HasValue ? originalRotation.Value : default(Vector3)));
			thismotherfucker.playerBodyAnimator.SetBool("useTZPItem", false);
			thismotherfucker.activatingItem = false;
			yield return (object)new WaitForSeconds(7f);
			if (!thismotherfucker.isPlayerDead)
			{
				PlayerControllerB obj = thismotherfucker;
				PlayerControllerB obj2 = thismotherfucker;
				obj.movementSpeed = (obj2.movementSpeed -= 5f);
				if (((NetworkBehaviour)player).IsHost)
				{
					((MonoBehaviour)this).StartCoroutine(Effects.DamageHost(thismotherfucker, 10, (CauseOfDeath)5, 7, criticalBlood: false));
				}
				else
				{
					Effects.Damage(thismotherfucker, 10, (CauseOfDeath)5, 7, criticalBlood: false);
				}
				yield return (object)new WaitForSeconds(5f);
				PlayerControllerB obj3 = thismotherfucker;
				PlayerControllerB obj4 = thismotherfucker;
				obj3.movementSpeed = (obj4.movementSpeed += 2f);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void AudioServerRpc(int audioID, Vector3 clientPosition, float localVolume, float clientVolume = 0f)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			AudioClientRpc(audioID, clientPosition, localVolume, (clientVolume == 0f) ? localVolume : clientVolume);
		}

		[ClientRpc]
		private void AudioClientRpc(int audioID, Vector3 clientPosition, float localVolume, float clientVolume)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Effects.Audio(audioID, clientPosition, localVolume, clientVolume, ((GrabbableObject)this).playerHeldBy);
		}

		[ServerRpc(RequireOwnership = false)]
		private void UpdatePosRotServerRpc(Vector3 newPos, Vector3 newRot)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			UpdatePosRotClientRpc(newPos, newRot);
		}

		[ClientRpc]
		private void UpdatePosRotClientRpc(Vector3 newPos, Vector3 newRot)
		{
			//IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).itemProperties.positionOffset = newPos;
			((GrabbableObject)this).itemProperties.rotationOffset = newRot;
		}
	}
	public class eatPizza : PhysicsProp
	{
		private int bitesLeft = 6;

		private string[] allLines = new string[1] { "Consume Pizza (6/6): [LMB]" };

		public Vector3? originalPosition = null;

		public Vector3? originalRotation = null;

		public override void SetControlTipsForItem()
		{
			((GrabbableObject)this).SetControlTipsForItem();
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				HUDManager.Instance.ChangeControlTipMultiple(allLines, true, ((GrabbableObject)this).itemProperties);
			}
			else
			{
				HUDManager.Instance.ClearControlTips();
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown && bitesLeft != 0)
			{
				PlayerControllerB playerHeldBy = ((GrabbableObject)this).playerHeldBy;
				((MonoBehaviour)this).StartCoroutine(PizzaEffect(playerHeldBy));
				bitesLeft--;
				((GrabbableObject)this).SetScrapValue(((GrabbableObject)this).scrapValue = ((GrabbableObject)this).scrapValue - ((GrabbableObject)this).scrapValue / 6);
				Debug.Log((object)("Bites left: " + bitesLeft));
				((GrabbableObject)this).useCooldown = 5f;
				((GrabbableObject)this).RequireCooldown();
				allLines = new string[1] { "Consume Pizza (" + bitesLeft + "/6): [LMB]" };
				((GrabbableObject)this).SetControlTipsForItem();
				if (((NetworkBehaviour)this).IsOwner && (Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
				{
					HUDManager.Instance.ChangeControlTipMultiple(allLines, true, ((GrabbableObject)this).itemProperties);
					originalPosition = ((GrabbableObject)this).itemProperties.positionOffset;
					originalRotation = ((GrabbableObject)this).itemProperties.rotationOffset;
					UpdatePosRotServerRpc(new Vector3(0.05f, 0.1f, 0.05f), ((GrabbableObject)this).itemProperties.rotationOffset);
					((GrabbableObject)this).playerHeldBy.activatingItem = true;
					((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", true);
				}
				else
				{
					HUDManager.Instance.ClearControlTips();
				}
				HUDManager.Instance.flashFilter = 0.14f;
			}
		}

		private IEnumerator PizzaEffect(PlayerControllerB player)
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				yield return (object)new WaitForSeconds(0.8f);
				AudioServerRpc(2, ((Component)((GrabbableObject)this).playerHeldBy).transform.position, 1f, 1.8f);
				yield return (object)new WaitForSeconds(0.8f);
				UpdatePosRotServerRpc((Vector3)(originalPosition.HasValue ? originalPosition.Value : default(Vector3)), (Vector3)(originalRotation.HasValue ? originalRotation.Value : default(Vector3)));
				player.playerBodyAnimator.SetBool("useTZPItem", false);
				player.activatingItem = false;
				if (!player.isPlayerDead)
				{
					HealPlayerServerRpc(StartOfRound.Instance.localPlayerController.playerClientId, 20);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void AudioServerRpc(int audioID, Vector3 clientPosition, float localVolume, float clientVolume = 0f)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			AudioClientRpc(audioID, clientPosition, localVolume, (clientVolume == 0f) ? localVolume : clientVolume);
		}

		[ClientRpc]
		private void AudioClientRpc(int audioID, Vector3 clientPosition, float localVolume, float clientVolume)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			Effects.Audio(audioID, clientPosition, localVolume, clientVolume, ((GrabbableObject)this).playerHeldBy);
		}

		[ServerRpc(RequireOwnership = false)]
		private void UpdatePosRotServerRpc(Vector3 newPos, Vector3 newRot)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			UpdatePosRotClientRpc(newPos, newRot);
		}

		[ClientRpc]
		private void UpdatePosRotClientRpc(Vector3 newPos, Vector3 newRot)
		{
			//IL_0007: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).itemProperties.positionOffset = newPos;
			((GrabbableObject)this).itemProperties.rotationOffset = newRot;
		}

		[ServerRpc(RequireOwnership = false)]
		private void HealPlayerServerRpc(ulong playerID, int health)
		{
			HealPlayerClientRpc(playerID, health);
		}

		[ClientRpc]
		private void HealPlayerClientRpc(ulong playerID, int health)
		{
			Effects.Heal(playerID, health);
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && GameNetworkManager.Instance.localPlayerController.playerClientId == ((GrabbableObject)this).playerHeldBy.playerClientId)
			{
				HUDManager.Instance.UpdateHealthUI(100, false);
			}
		}
	}
}