using System;
using System.Collections;
using System.Collections.Generic;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.CyrusCastle.TalkingBingBong")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2+688cf5ffabfc35611155f1b89d154b97e02499a9")]
[assembly: AssemblyProduct("com.github.CyrusCastle.TalkingBingBong")]
[assembly: AssemblyTitle("TalkingBingBong")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace TalkingBingBong
{
[BepInPlugin("com.github.CyrusCastle.TalkingBingBong", "TalkingBingBong", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
public const string Id = "com.github.CyrusCastle.TalkingBingBong";
internal static ManualLogSource Log { get; private set; }
internal static string directory { get; private set; }
public static string Name => "TalkingBingBong";
public static string Version => "1.0.2";
private void Awake()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
directory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
Harmony val = new Harmony("com.github.CyrusCastle.TalkingBingBong");
val.PatchAll();
((MonoBehaviour)this).StartCoroutine(Patch_AskRoutine.InitResponses());
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
}
}
[HarmonyPatch(typeof(Action_AskBingBong), "AskRoutine", new Type[]
{
typeof(int),
typeof(bool)
})]
public static class Patch_AskRoutine
{
[Serializable]
public class BenResponse
{
public string subtitle;
public AudioClip sfx;
}
[CompilerGenerated]
private sealed class <BenSubtitleRoutine>d__5 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Action_AskBingBong __instance;
public string subtitle;
private float <t>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BenSubtitleRoutine>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.19f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
((Component)__instance.subtitles).gameObject.SetActive(true);
((TMP_Text)__instance.subtitles).text = subtitle;
<t>5__2 = 0f;
break;
case 2:
<>1__state = -1;
break;
}
if (<t>5__2 < 1.8f)
{
<t>5__2 += Time.deltaTime;
((TMP_Text)__instance.subtitles).alpha = Mathf.Clamp01(<t>5__2 * 12f);
__instance.subtitles.transform.localScale = Vector3.one * __instance.scaleCurve.Evaluate(Vector3.Distance(__instance.subtitles.transform.position, ((Component)MainCamera.instance).transform.position));
__instance.subtitles.transform.forward = ((Component)MainCamera.instance).transform.forward;
<>2__current = null;
<>1__state = 2;
return true;
}
((Component)__instance.subtitles).gameObject.SetActive(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 <InitResponses>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <InitResponses>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
Plugin.Log.LogInfo((object)"Initialising Ben Responses...");
benResponses = new BenResponse[4];
<>2__current = LoadClip("yes.ogg", delegate(AudioClip clip)
{
benResponses[0] = new BenResponse
{
subtitle = "Yes...",
sfx = clip
};
});
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = LoadClip("no.ogg", delegate(AudioClip clip)
{
benResponses[1] = new BenResponse
{
subtitle = "No.",
sfx = clip
};
});
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = LoadClip("ugh.ogg", delegate(AudioClip clip)
{
benResponses[2] = new BenResponse
{
subtitle = "Ugh...",
sfx = clip
};
});
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = LoadClip("laugh.ogg", delegate(AudioClip clip)
{
benResponses[3] = new BenResponse
{
subtitle = "Hohoho!",
sfx = clip
};
});
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
Plugin.Log.LogInfo((object)"All Ben responses loaded!");
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 <LoadClip>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string filename;
public Action<AudioClip> onLoaded;
private UnityWebRequest <www>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadClip>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<www>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Invalid comparison between Unknown and I4
try
{
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
string absoluteUri = new Uri(Path.Combine(Plugin.directory, filename)).AbsoluteUri;
<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(absoluteUri, (AudioType)14);
<>1__state = -3;
<>2__current = <www>5__2.SendWebRequest();
<>1__state = 1;
return true;
}
case 1:
<>1__state = -3;
if ((int)<www>5__2.result != 1)
{
Plugin.Log.LogError((object)("Failed to load " + filename + ": " + <www>5__2.error));
onLoaded(null);
}
else
{
AudioClip content = DownloadHandlerAudioClip.GetContent(<www>5__2);
Plugin.Log.LogInfo((object)(filename + " is loaded!"));
onLoaded(content);
}
<>m__Finally1();
<www>5__2 = null;
return false;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<www>5__2 != null)
{
((IDisposable)<www>5__2).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <MyAskBenRoutine>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int index;
public Action_AskBingBong __instance;
private BenResponse <selected>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <MyAskBenRoutine>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<selected>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<selected>5__2 = benResponses[index];
Plugin.Log.LogInfo((object)("TalkingBingBong has said: " + <selected>5__2.subtitle));
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
__instance.source.PlayOneShot(<selected>5__2.sfx);
<>2__current = BenSubtitleRoutine(__instance, <selected>5__2.subtitle);
<>1__state = 2;
return true;
case 2:
<>1__state = -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 static BenResponse[] benResponses;
[IteratorStateMachine(typeof(<InitResponses>d__1))]
public static IEnumerator InitResponses()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <InitResponses>d__1(0);
}
[IteratorStateMachine(typeof(<LoadClip>d__2))]
private static IEnumerator LoadClip(string filename, Action<AudioClip> onLoaded)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadClip>d__2(0)
{
filename = filename,
onLoaded = onLoaded
};
}
public static bool Prefix(Action_AskBingBong __instance, int index, bool spamming, ref IEnumerator __result)
{
Plugin.Log.LogInfo((object)"Asking BingBong...");
__result = MyAskBenRoutine(__instance, index % 4);
return false;
}
[IteratorStateMachine(typeof(<MyAskBenRoutine>d__4))]
public static IEnumerator MyAskBenRoutine(Action_AskBingBong __instance, int index)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <MyAskBenRoutine>d__4(0)
{
__instance = __instance,
index = index
};
}
[IteratorStateMachine(typeof(<BenSubtitleRoutine>d__5))]
private static IEnumerator BenSubtitleRoutine(Action_AskBingBong __instance, string subtitle)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BenSubtitleRoutine>d__5(0)
{
__instance = __instance,
subtitle = subtitle
};
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}