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 System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.Networking;
using UnityEngine.UI;
using UnityEngine.Video;
[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: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("DumbassStuff.BillyMasked")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BillyMasked")]
[assembly: AssemblyTitle("DumbassStuff.BillyMasked")]
[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 BillyMasked
{
[BepInPlugin("DumbassStuff.BillyMasked", "BillyMasked", "1.0.0")]
public class BillyMasked : BaseUnityPlugin
{
public static BillyMasked Instance { get; private set; } = null;
internal static ManualLogSource Logger { get; private set; } = null;
internal static Harmony Harmony { get; set; } = null;
public static ConfigEntry<bool> EnableVisualEffects { get; private set; } = null;
public static List<AudioClip> BillyMaysClips { get; private set; } = new List<AudioClip>();
public static Dictionary<string, string> ClipTranscripts { get; private set; } = new Dictionary<string, string>();
public static Dictionary<string, string> ClipVideoPaths { get; private set; } = new Dictionary<string, string>();
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
EnableVisualEffects = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableVisualEffects", false, "Enables visual effects (Karaoke bar and Videos) on screen during the kill animation.");
LoadAssets();
Patch();
Logger.LogInfo((object)"DumbassStuff.BillyMasked v1.0.0 loaded.");
}
private void LoadAssets()
{
//IL_0097: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Invalid comparison between Unknown and I4
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: 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)
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string path = Path.Combine(directoryName, "Commercials");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
return;
}
string[] files = Directory.GetFiles(path);
foreach (string text in files)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
string text2 = Path.GetExtension(text).ToLowerInvariant();
if (1 == 0)
{
}
AudioType val = (AudioType)(text2 switch
{
".wav" => 20,
".ogg" => 14,
".mp3" => 13,
_ => 0,
});
if (1 == 0)
{
}
AudioType val2 = val;
if ((int)val2 > 0)
{
LoadAudio(text, val2, fileNameWithoutExtension);
continue;
}
bool flag;
switch (text2)
{
case ".mp4":
case ".webm":
case ".mov":
flag = true;
break;
default:
flag = false;
break;
}
if (flag)
{
ClipVideoPaths[fileNameWithoutExtension] = text;
}
else if (text2 == ".txt")
{
ClipTranscripts[fileNameWithoutExtension] = File.ReadAllText(text).Replace("\r\n", " ").Replace("\n", " ");
}
}
}
private void LoadAudio(string file, AudioType type, string name)
{
//IL_000c: 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_0032: Invalid comparison between Unknown and I4
UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("file://" + file, type);
try
{
audioClip.SendWebRequest();
while (!audioClip.isDone)
{
}
if ((int)audioClip.result == 1)
{
AudioClip content = DownloadHandlerAudioClip.GetContent(audioClip);
((Object)content).name = name;
BillyMaysClips.Add(content);
}
}
finally
{
((IDisposable)audioClip)?.Dispose();
}
}
internal static void Patch()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
Harmony = new Harmony("DumbassStuff.BillyMasked");
Harmony.PatchAll();
}
internal static void Unpatch()
{
Harmony harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}
public class BillyMaysInputs : LcInputActions
{
public static BillyMaysInputs Instance { get; private set; }
[InputAction("<Keyboard>/space", Name = "Skill Check", GamepadPath = "<Gamepad>/buttonSouth")]
public InputAction SkillCheckKey { get; set; } = null;
public static void Initialize()
{
Instance = new BillyMaysInputs();
}
}
public class BillyMaysSkillCheck : MonoBehaviour
{
[CompilerGenerated]
private sealed class <ExtremeZoomRoutine>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public BillyMaysSkillCheck <>4__this;
private float <orig>5__1;
private float <duration>5__2;
private float <elapsed>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ExtremeZoomRoutine>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.isZooming = true;
<orig>5__1 = <>4__this.originalFOV;
<duration>5__2 = 0.08f;
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
<elapsed>5__3 = 0f;
goto IL_00f7;
case 1:
<>1__state = -1;
goto IL_00f7;
case 2:
<>1__state = -1;
<elapsed>5__3 = 0f;
break;
case 3:
{
<>1__state = -1;
break;
}
IL_00f7:
if (<elapsed>5__3 < <duration>5__2)
{
if ((Object)(object)<>4__this.playerCamera == (Object)null)
{
return false;
}
<>4__this.playerCamera.fieldOfView = Mathf.Lerp(<orig>5__1, 12f, <elapsed>5__3 / <duration>5__2);
<elapsed>5__3 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = (object)new WaitForSeconds(0.25f);
<>1__state = 2;
return true;
}
if (<elapsed>5__3 < <duration>5__2)
{
if ((Object)(object)<>4__this.playerCamera == (Object)null)
{
return false;
}
<>4__this.playerCamera.fieldOfView = Mathf.Lerp(12f, <orig>5__1, <elapsed>5__3 / <duration>5__2);
<elapsed>5__3 += Time.deltaTime;
<>2__current = null;
<>1__state = 3;
return true;
}
if ((Object)(object)<>4__this.playerCamera != (Object)null)
{
<>4__this.playerCamera.fieldOfView = <orig>5__1;
}
<>4__this.isZooming = false;
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <MaskZoomRoutine>d__23 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Transform mask;
public BillyMaysSkillCheck <>4__this;
private float <orig>5__1;
private Vector3 <startLocalPos>5__2;
private Quaternion <startLocalRot>5__3;
private float <duration>5__4;
private float <elapsed>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MaskZoomRoutine>d__23(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//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_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_01b7: 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)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Expected O, but got Unknown
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_010f: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.isZooming = true;
<orig>5__1 = <>4__this.originalFOV;
<startLocalPos>5__2 = ((Component)<>4__this.playerCamera).transform.localPosition;
<startLocalRot>5__3 = ((Component)<>4__this.playerCamera).transform.localRotation;
<duration>5__4 = 0.15f;
<elapsed>5__5 = 0f;
goto IL_0144;
case 1:
<>1__state = -1;
goto IL_0144;
case 2:
{
<>1__state = -1;
if ((Object)(object)<>4__this.playerCamera != (Object)null)
{
<>4__this.playerCamera.fieldOfView = <orig>5__1;
((Component)<>4__this.playerCamera).transform.localPosition = <startLocalPos>5__2;
((Component)<>4__this.playerCamera).transform.localRotation = <startLocalRot>5__3;
}
<>4__this.isZooming = false;
return false;
}
IL_0144:
if (<elapsed>5__5 < <duration>5__4)
{
if ((Object)(object)<>4__this.playerCamera == (Object)null)
{
return false;
}
<>4__this.playerCamera.fieldOfView = Mathf.Lerp(<orig>5__1, 30f, <elapsed>5__5 / <duration>5__4);
((Component)<>4__this.playerCamera).transform.LookAt(mask.position + Vector3.up * 1.5f);
<elapsed>5__5 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = (object)new WaitForSeconds(0.4f);
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <PlayVideoRoutine>d__25 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string filePath;
public BillyMaysSkillCheck <>4__this;
private RenderTexture <renderTexture>5__1;
private float <fadeTime>5__2;
private float <elapsed>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PlayVideoRoutine>d__25(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<renderTexture>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.videoPlayer.url = "file://" + filePath;
<>4__this.videoPlayer.Prepare();
goto IL_0082;
case 1:
<>1__state = -1;
goto IL_0082;
case 2:
<>1__state = -1;
goto IL_01a0;
case 3:
{
<>1__state = -1;
break;
}
IL_0082:
if (!<>4__this.videoPlayer.isPrepared)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<renderTexture>5__1 = new RenderTexture((int)<>4__this.videoPlayer.width, (int)<>4__this.videoPlayer.height, 24);
<>4__this.videoPlayer.targetTexture = <renderTexture>5__1;
<>4__this.billyVideoUI.texture = (Texture)(object)<renderTexture>5__1;
((Component)<>4__this.billyVideoUI).gameObject.SetActive(true);
<>4__this.videoPlayer.Play();
<fadeTime>5__2 = 1.5f;
<elapsed>5__3 = 0f;
goto IL_01a0;
IL_01a0:
if (<elapsed>5__3 < <fadeTime>5__2)
{
((Graphic)<>4__this.billyVideoUI).color = new Color(1f, 1f, 1f, Mathf.Lerp(0f, 1f, <elapsed>5__3 / <fadeTime>5__2));
<elapsed>5__3 += Time.deltaTime;
<>2__current = null;
<>1__state = 2;
return true;
}
((Graphic)<>4__this.billyVideoUI).color = Color.white;
break;
}
if (<>4__this.videoPlayer.isPlaying)
{
<>2__current = null;
<>1__state = 3;
return true;
}
((Graphic)<>4__this.billyVideoUI).color = new Color(1f, 1f, 1f, 0f);
((Component)<>4__this.billyVideoUI).gameObject.SetActive(false);
<>4__this.videoPlayer.targetTexture = null;
Object.Destroy((Object)(object)<renderTexture>5__1);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private PlayerControllerB localPlayer;
private Camera playerCamera;
private float originalFOV;
private bool isZooming;
private GameObject karaokeContainer;
private RectTransform karaokeTextRect;
private TextMeshProUGUI karaokeText;
private RawImage billyVideoUI;
private VideoPlayer videoPlayer;
private string[] karaokeWords;
private float[] billyMaysWordTimes;
private float[] continuationWordTimes;
public static BillyMaysSkillCheck Instance { get; private set; }
public static BillyMaysSkillCheck Create()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
if ((Object)(object)Instance != (Object)null)
{
return Instance;
}
GameObject val = new GameObject("BillyMaysUI");
Object.DontDestroyOnLoad((Object)(object)val);
Instance = val.AddComponent<BillyMaysSkillCheck>();
Instance.InitializeUI();
return Instance;
}
private void InitializeUI()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0053: 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_0070: Expected O, but got Unknown
//IL_00a8: 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_00d4: 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_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Expected O, but got Unknown
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Expected O, but got Unknown
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("BillyMaysCanvas");
val.transform.SetParent(((Component)this).transform);
Canvas val2 = val.AddComponent<Canvas>();
val2.renderMode = (RenderMode)0;
val2.sortingOrder = 1000;
CanvasScaler val3 = val.AddComponent<CanvasScaler>();
val3.uiScaleMode = (ScaleMode)1;
val3.referenceResolution = new Vector2(1920f, 1080f);
val.AddComponent<GraphicRaycaster>();
GameObject val4 = new GameObject("BillyFullscreenVideo");
val4.transform.SetParent(val.transform);
billyVideoUI = val4.AddComponent<RawImage>();
((Graphic)billyVideoUI).color = new Color(1f, 1f, 1f, 0f);
((Graphic)billyVideoUI).rectTransform.anchorMin = Vector2.zero;
((Graphic)billyVideoUI).rectTransform.anchorMax = Vector2.one;
((Graphic)billyVideoUI).rectTransform.offsetMin = Vector2.zero;
((Graphic)billyVideoUI).rectTransform.offsetMax = Vector2.zero;
val4.SetActive(false);
videoPlayer = ((Component)this).gameObject.AddComponent<VideoPlayer>();
videoPlayer.playOnAwake = false;
videoPlayer.renderMode = (VideoRenderMode)2;
videoPlayer.audioOutputMode = (VideoAudioOutputMode)0;
videoPlayer.isLooping = false;
karaokeContainer = new GameObject("KaraokeContainer");
karaokeContainer.transform.SetParent(val.transform);
RectTransform val5 = karaokeContainer.AddComponent<RectTransform>();
val5.anchorMin = new Vector2(0f, 0.15f);
val5.anchorMax = new Vector2(1f, 0.25f);
val5.offsetMin = Vector2.zero;
val5.offsetMax = Vector2.zero;
((Graphic)karaokeContainer.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.7f);
karaokeContainer.AddComponent<RectMask2D>();
GameObject val6 = new GameObject("KaraokeText");
val6.transform.SetParent(karaokeContainer.transform);
karaokeText = val6.AddComponent<TextMeshProUGUI>();
((TMP_Text)karaokeText).fontSize = 52f;
((TMP_Text)karaokeText).fontStyle = (FontStyles)1;
((TMP_Text)karaokeText).alignment = (TextAlignmentOptions)513;
((TMP_Text)karaokeText).enableWordWrapping = false;
((TMP_Text)karaokeText).overflowMode = (TextOverflowModes)0;
((TMP_Text)karaokeText).outlineWidth = 0.3f;
((TMP_Text)karaokeText).outlineColor = Color32.op_Implicit(Color.black);
ContentSizeFitter val7 = val6.AddComponent<ContentSizeFitter>();
val7.horizontalFit = (FitMode)2;
val7.verticalFit = (FitMode)0;
karaokeTextRect = val6.GetComponent<RectTransform>();
karaokeTextRect.pivot = new Vector2(0f, 0.5f);
karaokeTextRect.anchorMin = new Vector2(0f, 0.5f);
karaokeTextRect.anchorMax = new Vector2(0f, 0.5f);
karaokeTextRect.anchoredPosition = Vector2.zero;
karaokeContainer.SetActive(false);
}
public void ShowKaraoke(string transcript, float[] wordTimes, float[] continuationTimes)
{
if (!string.IsNullOrEmpty(transcript) && BillyMasked.EnableVisualEffects.Value)
{
karaokeWords = transcript.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
billyMaysWordTimes = wordTimes;
continuationWordTimes = continuationTimes;
karaokeContainer.SetActive(true);
UpdateKaraoke(0f, null, null);
}
}
public void UpdateKaraoke(float percent, AudioSource audio, Transform maskedTransform)
{
//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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: 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)
if (!BillyMasked.EnableVisualEffects.Value || karaokeWords == null || karaokeWords.Length == 0)
{
return;
}
int num = Mathf.Clamp((int)(percent * (float)karaokeWords.Length), 0, karaokeWords.Length);
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append("<color=#FFD700>");
for (int i = 0; i < num; i++)
{
stringBuilder.Append(karaokeWords[i]).Append(" ");
}
stringBuilder.Append("</color><color=#FFFFFF>");
for (int j = num; j < karaokeWords.Length; j++)
{
stringBuilder.Append(karaokeWords[j]).Append(" ");
}
stringBuilder.Append("</color>");
((TMP_Text)karaokeText).text = stringBuilder.ToString();
Rect rect = karaokeContainer.GetComponent<RectTransform>().rect;
float width = ((Rect)(ref rect)).width;
LayoutRebuilder.ForceRebuildLayoutImmediate(karaokeTextRect);
rect = karaokeTextRect.rect;
float width2 = ((Rect)(ref rect)).width;
float num2 = width;
float num3 = 0f - width2;
float num4 = Mathf.Lerp(num2, num3, percent);
karaokeTextRect.anchoredPosition = new Vector2(num4, 0f);
if (!((Object)(object)audio != (Object)null))
{
return;
}
if ((Object)(object)localPlayer == (Object)null || (Object)(object)playerCamera == (Object)null)
{
localPlayer = GameNetworkManager.Instance.localPlayerController;
if ((Object)(object)localPlayer != (Object)null)
{
playerCamera = localPlayer.gameplayCamera;
}
if ((Object)(object)playerCamera != (Object)null)
{
originalFOV = playerCamera.fieldOfView;
}
}
if ((Object)(object)playerCamera == (Object)null)
{
return;
}
float time = audio.time;
if (billyMaysWordTimes != null)
{
float[] array = billyMaysWordTimes;
foreach (float num5 in array)
{
if (Mathf.Abs(time - num5) < 0.1f && !isZooming)
{
StartExtremeZoom();
break;
}
}
}
if (continuationWordTimes == null || !((Object)(object)maskedTransform != (Object)null))
{
return;
}
float[] array2 = continuationWordTimes;
foreach (float num6 in array2)
{
if (Mathf.Abs(time - num6) < 0.1f && !isZooming)
{
StartMaskZoom(maskedTransform);
break;
}
}
}
private void StartExtremeZoom()
{
if (!isZooming)
{
((MonoBehaviour)this).StartCoroutine(ExtremeZoomRoutine());
}
}
[IteratorStateMachine(typeof(<ExtremeZoomRoutine>d__21))]
private IEnumerator ExtremeZoomRoutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ExtremeZoomRoutine>d__21(0)
{
<>4__this = this
};
}
private void StartMaskZoom(Transform mask)
{
if (!isZooming && !((Object)(object)playerCamera == (Object)null) && !((Object)(object)mask == (Object)null))
{
((MonoBehaviour)this).StartCoroutine(MaskZoomRoutine(mask));
}
}
[IteratorStateMachine(typeof(<MaskZoomRoutine>d__23))]
private IEnumerator MaskZoomRoutine(Transform mask)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MaskZoomRoutine>d__23(0)
{
<>4__this = this,
mask = mask
};
}
public void PlayVideo(string filePath)
{
if (BillyMasked.EnableVisualEffects.Value)
{
((MonoBehaviour)this).StartCoroutine(PlayVideoRoutine(filePath));
}
}
[IteratorStateMachine(typeof(<PlayVideoRoutine>d__25))]
private IEnumerator PlayVideoRoutine(string filePath)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PlayVideoRoutine>d__25(0)
{
<>4__this = this,
filePath = filePath
};
}
public void HideKaraoke()
{
if ((Object)(object)karaokeContainer != (Object)null)
{
karaokeContainer.SetActive(false);
}
}
public void ForceHide()
{
HideKaraoke();
if ((Object)(object)billyVideoUI != (Object)null)
{
((Component)billyVideoUI).gameObject.SetActive(false);
}
if ((Object)(object)videoPlayer != (Object)null && videoPlayer.isPlaying)
{
videoPlayer.Stop();
}
if (isZooming && (Object)(object)playerCamera != (Object)null)
{
playerCamera.fieldOfView = originalFOV;
}
isZooming = false;
}
}
[HarmonyPatch(typeof(MaskedPlayerEnemy))]
public class MaskedPatch
{
[CompilerGenerated]
private sealed class <BillyMaysCommercial>d__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MaskedPlayerEnemy masked;
public int playerObjectId;
private PlayerControllerB <victim>5__1;
private Vector3 <dir>5__2;
private Quaternion <targetRot>5__3;
private float <rotateTime>5__4;
private float <t>5__5;
private Quaternion <startRot>5__6;
private List<AudioClip> <continuation>5__7;
private List<AudioClip> <commercials>5__8;
private int <currentLayerCount>5__9;
private int <i>5__10;
private AudioClip <clip>5__11;
private int <startLayers>5__12;
private int <endLayers>5__13;
private AudioClip <cont>5__14;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BillyMaysCommercial>d__13(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<victim>5__1 = null;
<continuation>5__7 = null;
<commercials>5__8 = null;
<clip>5__11 = null;
<cont>5__14 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_038e: Unknown result type (might be due to invalid IL or missing references)
//IL_0398: Expected O, but got Unknown
//IL_058b: Unknown result type (might be due to invalid IL or missing references)
//IL_0595: Expected O, but got Unknown
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_0361: Unknown result type (might be due to invalid IL or missing references)
//IL_036b: Expected O, but got Unknown
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
<victim>5__1 = StartOfRound.Instance.allPlayerScripts[playerObjectId];
if ((Object)(object)<victim>5__1 == (Object)null || <victim>5__1.isPlayerDead || <victim>5__1.isInsideFactory == ((EnemyAI)masked).isOutside)
{
masked.FinishKillAnimation(false);
return false;
}
volumeMultiplier = 1f;
if ((Object)(object)<victim>5__1 == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
BillyMaysSkillCheck.Create();
}
if (masked.searchForPlayers.inProgress)
{
((EnemyAI)masked).StopSearch(masked.searchForPlayers, true);
}
((EnemyAI)masked).inSpecialAnimationWithPlayer = <victim>5__1;
<victim>5__1.inAnimationWithEnemy = (EnemyAI)(object)masked;
if ((Object)(object)<victim>5__1 == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
masked.startingKillAnimationLocalClient = false;
<victim>5__1.CancelSpecialTriggerAnimations();
}
masked.inKillAnimation = true;
((EnemyAI)masked).inSpecialAnimation = true;
((EnemyAI)masked).creatureAnimator.SetBool("killing", true);
((Behaviour)((EnemyAI)masked).agent).enabled = false;
<victim>5__1.inSpecialInteractAnimation = true;
<victim>5__1.snapToServerPosition = true;
<victim>5__1.disableSyncInAnimation = true;
<victim>5__1.disableLookInput = true;
WalkieTalkie.TransmitOneShotAudio(((EnemyAI)masked).creatureSFX, ((EnemyAI)masked).enemyType.audioClips[0], 1f);
((EnemyAI)masked).creatureSFX.PlayOneShot(((EnemyAI)masked).enemyType.audioClips[0]);
Vector3 val = ((Component)masked).transform.position - ((Component)<victim>5__1).transform.position;
<dir>5__2 = ((Vector3)(ref val)).normalized;
<dir>5__2.y = 0f;
<targetRot>5__3 = Quaternion.LookRotation(<dir>5__2);
<rotateTime>5__4 = 0.3f;
<t>5__5 = 0f;
<startRot>5__6 = ((Component)<victim>5__1).transform.rotation;
goto IL_032d;
}
case 1:
<>1__state = -1;
goto IL_032d;
case 2:
<>1__state = -1;
masked.SetMaskGlow(true);
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<continuation>5__7 = BillyMasked.BillyMaysClips.Where(IsContinuationClip).ToList();
<commercials>5__8 = (from c in BillyMasked.BillyMaysClips
where !IsContinuationClip(c)
select c into _
orderby Random.value
select _).ToList();
<currentLayerCount>5__9 = 1;
<i>5__10 = 0;
goto IL_05c7;
case 4:
<>1__state = -1;
if (!IsAnimationStillValid(masked, <victim>5__1))
{
break;
}
<currentLayerCount>5__9 = <endLayers>5__13;
if (<i>5__10 < <commercials>5__8.Count - 1 && <continuation>5__7.Count > 0)
{
<cont>5__14 = <continuation>5__7[Random.Range(0, <continuation>5__7.Count)];
<>2__current = PlayCommercialSegment(masked, <victim>5__1, <cont>5__14, <currentLayerCount>5__9, <currentLayerCount>5__9, isContinuation: true);
<>1__state = 5;
return true;
}
goto IL_05ad;
case 5:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.3f);
<>1__state = 6;
return true;
case 6:
{
<>1__state = -1;
<cont>5__14 = null;
goto IL_05ad;
}
IL_032d:
if (<t>5__5 < <rotateTime>5__4)
{
if (!IsAnimationStillValid(masked, <victim>5__1))
{
ResetAnimationState(masked, <victim>5__1);
return false;
}
((Component)<victim>5__1).transform.rotation = Quaternion.Slerp(<startRot>5__6, <targetRot>5__3, <t>5__5 / <rotateTime>5__4);
<t>5__5 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
((Component)<victim>5__1).transform.rotation = <targetRot>5__3;
<>2__current = (object)new WaitForSeconds(0.3f);
<>1__state = 2;
return true;
IL_05ad:
<clip>5__11 = null;
<i>5__10++;
goto IL_05c7;
IL_05c7:
if (<i>5__10 < <commercials>5__8.Count && IsAnimationStillValid(masked, <victim>5__1))
{
<clip>5__11 = <commercials>5__8[<i>5__10];
<startLayers>5__12 = <currentLayerCount>5__9;
<endLayers>5__13 = <currentLayerCount>5__9 + 2;
<>2__current = PlayCommercialSegment(masked, <victim>5__1, <clip>5__11, <startLayers>5__12, <endLayers>5__13, isContinuation: false);
<>1__state = 4;
return true;
}
break;
}
ResetAnimationState(masked, <victim>5__1);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <PlayCommercialSegment>d__14 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MaskedPlayerEnemy masked;
public PlayerControllerB victim;
public AudioClip clip;
public int startLayers;
public int endLayers;
public bool isContinuation;
private int <maxLayers>5__1;
private string <transcript>5__2;
private float[] <billyTimes>5__3;
private float[] <continuationTimes>5__4;
private string <t>5__5;
private float <len>5__6;
private int <lastLayerCount>5__7;
private string <videoPath>5__8;
private float <currentTime>5__9;
private float <progress>5__10;
private int <targetLayers>5__11;
private int <i>5__12;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PlayCommercialSegment>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<transcript>5__2 = null;
<billyTimes>5__3 = null;
<continuationTimes>5__4 = null;
<t>5__5 = null;
<videoPath>5__8 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<maxLayers>5__1 = Mathf.Max(startLayers, endLayers);
EnsureAudioLayers(masked, <maxLayers>5__1);
PlayOnAllLayers(clip, startLayers);
<transcript>5__2 = "";
<billyTimes>5__3 = Array.Empty<float>();
<continuationTimes>5__4 = Array.Empty<float>();
if (BillyMasked.ClipTranscripts.TryGetValue(((Object)clip).name, out <t>5__5))
{
<transcript>5__2 = <t>5__5;
<billyTimes>5__3 = GetBillyMaysTimestamps(<transcript>5__2, clip.length);
if (isContinuation)
{
<continuationTimes>5__4 = new float[1] { 0.1f };
}
}
if ((Object)(object)victim == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
BillyMaysSkillCheck.Instance.ShowKaraoke(<transcript>5__2, <billyTimes>5__3, <continuationTimes>5__4);
if (BillyMasked.ClipVideoPaths.TryGetValue(((Object)clip).name, out <videoPath>5__8))
{
BillyMaysSkillCheck.Instance.PlayVideo(<videoPath>5__8);
}
<videoPath>5__8 = null;
}
<len>5__6 = clip.length;
<lastLayerCount>5__7 = startLayers;
break;
case 1:
<>1__state = -1;
break;
}
if (AnyLayerPlaying())
{
if (!IsAnimationStillValid(masked, victim))
{
ResetAnimationState(masked, victim);
return false;
}
<currentTime>5__9 = GetLayerTime();
<progress>5__10 = <currentTime>5__9 / <len>5__6;
<targetLayers>5__11 = Mathf.RoundToInt(Mathf.Lerp((float)startLayers, (float)endLayers, <progress>5__10));
if (<targetLayers>5__11 > <lastLayerCount>5__7)
{
<i>5__12 = <lastLayerCount>5__7;
while (<i>5__12 < <targetLayers>5__11 && <i>5__12 < audioLayers.Count)
{
audioLayers[<i>5__12].clip = clip;
audioLayers[<i>5__12].time = <currentTime>5__9;
audioLayers[<i>5__12].Play();
<i>5__12++;
}
<lastLayerCount>5__7 = <targetLayers>5__11;
}
KeepFacingEachOther(masked, victim);
if ((Object)(object)victim == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
BillyMaysSkillCheck.Instance.UpdateKaraoke(<progress>5__10, audioLayers[0], ((Component)masked).transform);
}
<>2__current = null;
<>1__state = 1;
return true;
}
if ((Object)(object)victim == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
BillyMaysSkillCheck.Instance.HideKaraoke();
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static readonly string[] continuationNames = new string[8] { "butwait", "butwaitthere", "butthatsnotall", "butthatsnot", "butimnotdoneyet", "butimnotdone", "butimstillnotdone", "butimstillnot" };
private static float volumeMultiplier = 1f;
private static List<AudioSource> audioLayers = new List<AudioSource>();
[HarmonyPatch("KillPlayerAnimationClientRpc")]
[HarmonyPrefix]
public static bool KillPlayerAnimationPrefix(MaskedPlayerEnemy __instance, int playerObjectId)
{
if (BillyMasked.BillyMaysClips.Count == 0)
{
return true;
}
((MonoBehaviour)__instance).StartCoroutine(BillyMaysCommercial(__instance, playerObjectId));
return false;
}
private static bool IsContinuationClip(AudioClip clip)
{
string @object = ((Object)clip).name.ToLower().Replace(" ", "").Replace("-", "")
.Replace("_", "");
return continuationNames.Any(@object.Contains);
}
private static float[] GetBillyMaysTimestamps(string transcript, float clipLength)
{
if (string.IsNullOrEmpty(transcript))
{
return Array.Empty<float>();
}
List<float> list = new List<float>();
string[] array = transcript.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < array.Length - 1; i++)
{
if (array[i].ToUpper().Contains("BILLY") && array[i + 1].ToUpper().Contains("MAYS"))
{
list.Add((float)i / (float)array.Length * clipLength);
}
}
return list.ToArray();
}
private static AudioSource CreateAudioLayer(MaskedPlayerEnemy masked)
{
AudioSource val = ((Component)masked).gameObject.AddComponent<AudioSource>();
val.spatialBlend = 0f;
val.volume = 1f;
val.bypassEffects = true;
val.bypassListenerEffects = true;
val.bypassReverbZones = true;
val.priority = 0;
val.loop = false;
return val;
}
private static void EnsureAudioLayers(MaskedPlayerEnemy masked, int count)
{
audioLayers.RemoveAll((AudioSource s) => (Object)(object)s == (Object)null);
while (audioLayers.Count < count)
{
audioLayers.Add(CreateAudioLayer(masked));
}
}
private static void PlayOnAllLayers(AudioClip clip, int layerCount)
{
for (int i = 0; i < layerCount && i < audioLayers.Count; i++)
{
audioLayers[i].clip = clip;
audioLayers[i].volume = 1f;
audioLayers[i].Play();
}
}
private static void SetAllLayersVolume(float volumePerLayer)
{
foreach (AudioSource audioLayer in audioLayers)
{
if ((Object)(object)audioLayer != (Object)null && audioLayer.isPlaying)
{
audioLayer.volume = Mathf.Min(volumePerLayer, 1f);
}
}
}
private static void StopAllLayers()
{
foreach (AudioSource audioLayer in audioLayers)
{
if ((Object)(object)audioLayer != (Object)null)
{
audioLayer.Stop();
audioLayer.volume = 1f;
}
}
}
private static bool AnyLayerPlaying()
{
return audioLayers.Any((AudioSource l) => (Object)(object)l != (Object)null && l.isPlaying);
}
private static float GetLayerTime()
{
AudioSource val = ((IEnumerable<AudioSource>)audioLayers).FirstOrDefault((Func<AudioSource, bool>)((AudioSource l) => (Object)(object)l != (Object)null && l.isPlaying));
return ((Object)(object)val != (Object)null) ? val.time : 0f;
}
[IteratorStateMachine(typeof(<BillyMaysCommercial>d__13))]
private static IEnumerator BillyMaysCommercial(MaskedPlayerEnemy masked, int playerObjectId)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BillyMaysCommercial>d__13(0)
{
masked = masked,
playerObjectId = playerObjectId
};
}
[IteratorStateMachine(typeof(<PlayCommercialSegment>d__14))]
private static IEnumerator PlayCommercialSegment(MaskedPlayerEnemy masked, PlayerControllerB victim, AudioClip clip, int startLayers, int endLayers, bool isContinuation)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PlayCommercialSegment>d__14(0)
{
masked = masked,
victim = victim,
clip = clip,
startLayers = startLayers,
endLayers = endLayers,
isContinuation = isContinuation
};
}
private static bool IsAnimationStillValid(MaskedPlayerEnemy masked, PlayerControllerB victim)
{
if (!((EnemyAI)masked).inSpecialAnimation)
{
return false;
}
if (((EnemyAI)masked).isEnemyDead)
{
return false;
}
if ((Object)(object)victim == (Object)null || victim.isPlayerDead)
{
return false;
}
return true;
}
private static void ResetAnimationState(MaskedPlayerEnemy masked, PlayerControllerB victim)
{
BillyMaysSkillCheck.Instance?.ForceHide();
StopAllLayers();
((EnemyAI)masked).creatureSFX.Stop();
((EnemyAI)masked).creatureSFX.volume = 1f;
masked.SetMaskGlow(false);
if ((Object)(object)victim != (Object)null)
{
victim.disableSyncInAnimation = false;
victim.disableLookInput = false;
victim.inSpecialInteractAnimation = false;
victim.snapToServerPosition = false;
victim.inAnimationWithEnemy = null;
}
((EnemyAI)masked).inSpecialAnimation = false;
masked.inKillAnimation = false;
((EnemyAI)masked).creatureAnimator.SetBool("killing", false);
masked.startingKillAnimationLocalClient = false;
masked.stareAtTransform = null;
masked.stopAndStareTimer = 0f;
((EnemyAI)masked).movingTowardsTargetPlayer = false;
((EnemyAI)masked).inSpecialAnimationWithPlayer = null;
if (((NetworkBehaviour)masked).IsServer && !((EnemyAI)masked).isEnemyDead && !((EnemyAI)masked).inSpecialAnimation)
{
((EnemyAI)masked).SwitchToBehaviourState(0);
}
if (((NetworkBehaviour)masked).IsOwner && !((EnemyAI)masked).isEnemyDead)
{
((EnemyAI)masked).SwitchToBehaviourStateOnLocalClient(0);
((Behaviour)((EnemyAI)masked).agent).enabled = true;
}
}
private static void KeepFacingEachOther(MaskedPlayerEnemy masked, PlayerControllerB victim)
{
//IL_0021: 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_0031: 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_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)victim != (Object)null && !victim.isPlayerDead)
{
Vector3 val = ((Component)masked).transform.position - ((Component)victim).transform.position;
Vector3 normalized = ((Vector3)(ref val)).normalized;
normalized.y = 0f;
if (normalized != Vector3.zero)
{
((Component)victim).transform.rotation = Quaternion.LookRotation(normalized);
}
}
if ((Object)(object)victim != (Object)null)
{
((Component)masked).transform.LookAt(((Component)victim).transform.position);
((Component)masked).transform.eulerAngles = new Vector3(0f, ((Component)masked).transform.eulerAngles.y, 0f);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "DumbassStuff.BillyMasked";
public const string PLUGIN_NAME = "BillyMasked";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}