Decompiled source of KenzouPlush v7.7.7

KenzouPlush.dll

Decompiled 5 hours ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
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 MiniZou.Behaviours;
using UnityEngine;
using UnityEngine.Rendering;

[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("MyName.Piouu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MiniZou")]
[assembly: AssemblyTitle("MyName.Piouu")]
[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 MiniZou
{
	[BepInPlugin("MyName.Piouu", "MiniZou", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MiniZou : BaseUnityPlugin
	{
		public static MiniZou 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;
			Patch();
			Instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "KenzouPlush");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			int num = 30;
			Item val2 = val.LoadAsset<Item>("Assets/Letsgoo/MiniZou.asset");
			AudioClip teleportClip = val.LoadAsset<AudioClip>("Assets/Letsgoo/KenzMus.mp3");
			AudioClip po = val.LoadAsset<AudioClip>("Assets/Letsgoo/Pouet.ogg");
			Material val3 = val.LoadAsset<Material>("Assets/Letsgoo/AluminumTank.mat");
			TeleportationItem teleportationItem = val2.spawnPrefab.AddComponent<TeleportationItem>();
			((GrabbableObject)teleportationItem).grabbable = true;
			((GrabbableObject)teleportationItem).grabbableToEnemies = true;
			((GrabbableObject)teleportationItem).itemProperties = val2;
			teleportationItem.teleportClip = teleportClip;
			teleportationItem.po = po;
			teleportationItem.itemToSpawn = val2;
			Utilities.FixMixerGroups(val2.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
			Items.RegisterScrap(val2, num, (LevelTypes)(-1));
			Logger.LogInfo((object)"\n\n                        @@@@@@@@@@@                              %@@@@@@@@@@                        \n                    @@@%%%%%%%%%%%%%@#                         @@%%%%%%%%%%%%@@@%                   \n                *@@@%%%%%%%%%%%%%%%%@@                        #@%%%%%%%%%%%%%%%%%@@@                \n              +@@%%%%%%%%%%%%%%%%@@@@                           #@@%%%%%%%%%%%%%%%%%@@              \n             @@%%%%%%%%%%%%%%@@@@                                  *@@@%%%%%%%%%%%%%%%@%            \n              %@@@@@@@@@@@@##                                           #%@@@@@@@@@@@@%             \n                                                                                                    \n                                                                                                    \n                +@@@@@@@@@@#                                            #@@@@@@@@@@                 \n            %@@@@+-@@@@@@@@@@@@%                                    %@@@@@@@@@@@@-:#@@@             \n          %@@=*@@@@@@@@+:.  .:*@@@                                #@@@=:.  :-+@@@@@@@-.%@@          \n        @@@.@@@@@@@@@@@@@@@@@.   .%                               #.  .@@@@@@@@@@@%@@@@@.*@@        \n       @@#@@@@@@@@@@@@@@@@@@@@@:  ..                             .  .@@@@@@@@@@@@@@@-@@@@@.@@       \n      #@#@@@@@#@@@@@@@@@@@@@@@@@%. .                            ..  @@@@@@@@@@@@@@@@%@@@@@@ %@      \n      @@@@@@@*@@@@@@@%*%@@@@@@@@@* ..                           .  @@@@@@@@@%*%@@@@@@%@#@@@@-@@     \n     @@%@@@@+@@@@@@@.   ..@@@@@@@@  .                           . =@@@@@@@*.    :@@@@@@@#@@@@:@#    \n     @@@@@@@%@@@@@@      ..@@@@@@@% ..                         .  @@@@@@@%       .@@@@@@-@@@@@@%    \n     @@@@@@=@@@@@@+     .  #@@@@@@@-..                         . *@@@@@@@:       .@@@@@@%-@@@@@@    \n     @@@@@@.%@@@@@%.    .  -@@@@@@@% .                         . %@@@@@@@. .     .@@@@@@@.@@@@@%    \n     #@@@@@ #@@@@@@.      .%@@@@@@@% .                         . @@@@@@@@*..     :@@@@@@@.@@@@@#    \n  @@@@@@@@@ #@@@@@@@      *@@@@@@@@# .                         . %@@@@@@@@-    .:@@@@@@*@.@@@@@@@@@ \n  *    @@@@ @.@@@@@@@@%#%@@@@@@@@@@+.                            #@@@@@@@@@@%#@@@@@@@@@.*.@@@@   @@ \n      #@@@@  * @@@@@@@@@@@@@@@@@@@@..                           . @@@@@@@@@@@@@@@@@@@@.% .@@@@      \n     @@@@@%  .@.@@@@@@@@@@@@@@@@@@..                               @@@@@@@@@@@@@@@@@%.%  .@@@@@*    \n   @@@@%   .   -#.@@@@@@@@@@@@@@- .                                .+@@@@@@@@@@@@@%:%:   .   %@@@   \n            +    .*@=-%@@@@@@*   .                                 .  .#@@@@@@%=*@+.   +.           \n         %@@@%@.              .#%                                   @-              .*@%@@@*        \n                #%@#+===+*%%@%                                         #@@#+===+*%%%*               \n                                              @@@@@@@@@                                             \n                                                                                                    \n                                                                                                    \n                                        %%#%@@@@@@@@@@@@%#@%                                        \n                                       %:                   *%                                      \n                                       @=                   @#                                      \n                                        %                   @                                       \n                                        @                  -%                                       \n                                         *                 @                                        \n                                         %.               *#                                        \n                                          @.             #%                                         \n                                           ##          .%                                           \n                                             %%      :%*                                            \n                                               #%@@@@                                               \n\n");
		}

		internal static void Patch()
		{
			//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_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("MyName.Piouu");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MyName.Piouu";

		public const string PLUGIN_NAME = "MiniZou";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MiniZou.Patches
{
	[HarmonyPatch(typeof(TVScript))]
	public class ExampleTVPatch
	{
		[HarmonyPatch("SwitchTVLocalClient")]
		[HarmonyPrefix]
		private static void SwitchTVPrefix(TVScript __instance)
		{
			StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn);
		}
	}
}
namespace MiniZou.Behaviours
{
	internal class TeleportationItem : PhysicsProp
	{
		public AudioClip teleportClip;

		public AudioClip po;

		public Material Chambre;

		public Vector3 darkRoomOffset = new Vector3(1000f, 1000f, 1000f);

		public Item itemToSpawn;

		public bool Cd = true;

		private Vector3 originalPosition;

		private Quaternion originalRotation;

		private Random noisemakerRandom;

		private Color originalAmbientLight;

		private PlayerControllerB previousOwner;

		public override void Start()
		{
			((GrabbableObject)this).Start();
			noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: 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_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!buttonDown || !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) || !Cd)
			{
				return;
			}
			Cd = false;
			((MonoBehaviour)this).StartCoroutine(Cooldown(1.5f));
			AudioSource val = ((Component)((GrabbableObject)this).playerHeldBy).GetComponent<AudioSource>();
			if (Random.Range(0, 10) != 0)
			{
				if ((Object)(object)val == (Object)null)
				{
					val = ((Component)((GrabbableObject)this).playerHeldBy).gameObject.AddComponent<AudioSource>();
				}
				if ((Object)(object)teleportClip != (Object)null)
				{
					float pitch = (float)noisemakerRandom.Next(100, 200) / 100f;
					val.pitch = pitch;
					val.PlayOneShot(po);
				}
				return;
			}
			previousOwner = ((GrabbableObject)this).playerHeldBy;
			originalPosition = ((Component)((GrabbableObject)this).playerHeldBy).transform.position;
			originalRotation = ((Component)((GrabbableObject)this).playerHeldBy).transform.rotation;
			originalAmbientLight = RenderSettings.ambientLight;
			RenderSettings.ambientLight = Color.black;
			Vector3 darkRoomSpawnPosition = GetDarkRoomSpawnPosition();
			((Component)((GrabbableObject)this).playerHeldBy).transform.position = darkRoomSpawnPosition;
			((Component)((GrabbableObject)this).playerHeldBy).transform.rotation = Quaternion.identity;
			Light component = ((Component)this).gameObject.GetComponent<Light>();
			if ((Object)(object)val == (Object)null)
			{
				val = ((Component)((GrabbableObject)this).playerHeldBy).gameObject.AddComponent<AudioSource>();
			}
			Vector3 val2 = ((Component)((GrabbableObject)this).playerHeldBy).transform.position + ((Component)((GrabbableObject)this).playerHeldBy).transform.forward * 2f + Vector3.up * 0.5f;
			GameObject val3 = Object.Instantiate<GameObject>(itemToSpawn.spawnPrefab, val2, Quaternion.identity);
			ScanNodeProperties componentInChildren = val3.GetComponentInChildren<ScanNodeProperties>();
			componentInChildren.nodeType = 1;
			componentInChildren.creatureScanID = 0;
			((GrabbableObject)this).playerHeldBy.Crouch(true);
			Rigidbody component2 = val3.GetComponent<Rigidbody>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.AddForce(((Component)((GrabbableObject)this).playerHeldBy).transform.forward * 5f, (ForceMode)1);
			}
			float delay = 5f;
			if ((Object)(object)teleportClip != (Object)null)
			{
				val.clip = teleportClip;
				val.pitch = 1f;
				val.Play();
				delay = teleportClip.length;
			}
			else
			{
				Debug.LogWarning((object)"Le clip audio n'est pas assigné dans TeleportationItem.");
			}
			((GrabbableObject)this).DestroyObjectInHand(((GrabbableObject)this).playerHeldBy);
			((MonoBehaviour)this).StartCoroutine(ReturnAfterDelay(delay));
		}

		private IEnumerator ReturnAfterDelay(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)previousOwner != (Object)null)
			{
				((Component)previousOwner).transform.position = originalPosition;
				((Component)previousOwner).transform.rotation = originalRotation;
			}
			RenderSettings.ambientLight = originalAmbientLight;
		}

		private IEnumerator Cooldown(float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			Cd = true;
		}

		private IEnumerator LumaDel(float delay, Light light)
		{
			yield return (object)new WaitForSeconds(delay);
			light.intensity = 200f;
		}

		private Vector3 GetDarkRoomSpawnPosition()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("DarkRoom");
			if ((Object)(object)val == (Object)null)
			{
				val = CreateDarkRoom();
			}
			return val.transform.position + new Vector3(0f, 1f, 0f);
		}

		private Vector3 GetDarkRoomCenter()
		{
			//IL_0030: 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_001c: 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)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
			{
				return ((Component)((GrabbableObject)this).playerHeldBy).transform.position + darkRoomOffset;
			}
			return darkRoomOffset;
		}

		private GameObject CreateDarkRoom()
		{
			//IL_0002: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_0019: 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_0059: 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_0089: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0185: 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)
			Vector3 darkRoomCenter = GetDarkRoomCenter();
			GameObject val = new GameObject("DarkRoom");
			val.transform.position = darkRoomCenter;
			float num = 100f;
			float num2 = 100f;
			float num3 = 10f;
			float num4 = 2f;
			CreateWall(val, "Floor", new Vector3(1f, 0f, 0f), new Vector3(num, num4, num2));
			CreateWall(val, "NorthWall", new Vector3(0f, num3 / 2f, num2 / 2f), new Vector3(num, num3, num4));
			CreateWall(val, "SouthWall", new Vector3(0f, num3 / 2f, (0f - num2) / 2f), new Vector3(num, num3, num4));
			CreateWall(val, "EastWall", new Vector3(num / 2f, num3 / 2f, 0f), new Vector3(num4, num3, num2));
			CreateWall(val, "WestWall", new Vector3((0f - num) / 2f, num3 / 2f, 0f), new Vector3(num4, num3, num2));
			CreateWall(val, "Ceiling", new Vector3(1f, num3, 0f), new Vector3(num, num4, num2));
			GameObject val2 = new GameObject("RoomLight");
			val2.transform.SetParent(val.transform);
			val2.transform.localPosition = new Vector3(0f, num3 - 2f, 0f);
			Light val3 = val2.AddComponent<Light>();
			val3.type = (LightType)2;
			val3.intensity = 0f;
			val3.range = 100f;
			val3.color = Color.red;
			((MonoBehaviour)this).StartCoroutine(LumaDel(1f, val3));
			return val;
		}

		private void CreateWall(GameObject parent, string name, Vector3 localPosition, Vector3 localScale)
		{
			//IL_0028: 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_0046: 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_0088: Expected O, but got Unknown
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
			((Object)val).name = name;
			val.transform.SetParent(parent.transform);
			val.transform.localPosition = localPosition;
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = localScale;
			int layer = LayerMask.NameToLayer("Room");
			val.layer = layer;
			Renderer component = val.GetComponent<Renderer>();
			if ((Object)(object)component != (Object)null)
			{
				Material val2 = new Material(Shader.Find("HDRP/Lit"));
				val2.SetFloat("_SurfaceType", 0f);
				val2.SetFloat("_CullMode", 2f);
				val2.SetFloat("_AlphaCutoffEnable", 0f);
				val2.renderQueue = 2000;
				val2.SetColor("_BaseColor", Color.black);
				component.material = val2;
				component.shadowCastingMode = (ShadowCastingMode)1;
				component.receiveShadows = true;
			}
		}
	}
}