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.Configuration;
using Dissonance;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[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("Assembly-CSharp")]
[assembly: AssemblyCompany("mia_suits")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("mia_suits")]
[assembly: AssemblyTitle("mia_suits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
}
}
}
namespace ModelReplacement
{
public class MRNANACHI : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Nanachi";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
SkinnedMeshRenderer componentInChildren = base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
BlendShapeBlink blendShapeBlink = base.replacementModel.AddComponent<BlendShapeBlink>();
blendShapeBlink.Init(componentInChildren, "05_Eye_Blink", -1, 6f, 12f);
BlendShapeMouthSpeak blendShapeMouthSpeak = base.replacementModel.AddComponent<BlendShapeMouthSpeak>();
blendShapeMouthSpeak.Init(componentInChildren, ((BodyReplacementBase)this).controller, "08_Mouth_A", -1, 50f);
BlendShapeMouthSpeak blendShapeMouthSpeak2 = base.replacementModel.AddComponent<BlendShapeMouthSpeak>();
blendShapeMouthSpeak2.Init(componentInChildren, ((BodyReplacementBase)this).controller, "16_Mouth_Smile2", -1, 50f);
}
}
}
public class MRMARULK : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Marulk";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
SkinnedMeshRenderer componentInChildren = base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
BlendShapeBlink blendShapeBlink = base.replacementModel.AddComponent<BlendShapeBlink>();
blendShapeBlink.Init(componentInChildren, "00_Eye_Blink", -1, 6f, 12f);
BlendShapeMouthSpeak blendShapeMouthSpeak = base.replacementModel.AddComponent<BlendShapeMouthSpeak>();
blendShapeMouthSpeak.Init(componentInChildren, ((BodyReplacementBase)this).controller, "08_Mouth_Damage", -1, 60f);
}
}
}
public class MRLYZA : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Lyza";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
SkinnedMeshRenderer componentInChildren = base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
BlendShapeBlink blendShapeBlink = base.replacementModel.AddComponent<BlendShapeBlink>();
blendShapeBlink.Init(componentInChildren, "Eyes_Blink", -1, 6f, 12f);
BlendShapeMouthSpeak blendShapeMouthSpeak = base.replacementModel.AddComponent<BlendShapeMouthSpeak>();
blendShapeMouthSpeak.Init(componentInChildren, ((BodyReplacementBase)this).controller, "Mouth_A", -1, 40f);
BlendShapeMouthSpeak blendShapeMouthSpeak2 = base.replacementModel.AddComponent<BlendShapeMouthSpeak>();
blendShapeMouthSpeak2.Init(componentInChildren, ((BodyReplacementBase)this).controller, "Mouth_Damage", -1, 60f);
}
}
}
public class MRFAPUTA : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Faputa";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
Transform val = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/Shoulder.L");
Transform val2 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/BLeft shoulder");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val2))
{
ScaledRotationFollower scaledRotationFollower = ((Component)val2).gameObject.AddComponent<ScaledRotationFollower>();
scaledRotationFollower.Init(val, val2, 1f);
}
Transform val3 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/Shoulder.L/Arms.L");
Transform val4 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/BLeft shoulder/BLeft arm");
if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val4))
{
ScaledRotationFollower scaledRotationFollower2 = ((Component)val4).gameObject.AddComponent<ScaledRotationFollower>();
scaledRotationFollower2.Init(val3, val4, 0.35f);
}
Transform val5 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/Shoulder.L/Arms.L/Elbow.L");
Transform val6 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/BLeft shoulder/BLeft arm/BLeft elbow");
if (Object.op_Implicit((Object)(object)val5) && Object.op_Implicit((Object)(object)val6))
{
ScaledRotationFollower scaledRotationFollower3 = ((Component)val6).gameObject.AddComponent<ScaledRotationFollower>();
scaledRotationFollower3.Init(val5, val6, 0.7f);
}
Transform val7 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/Shoulder.R");
Transform val8 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/BRight shoulder");
if (Object.op_Implicit((Object)(object)val7) && Object.op_Implicit((Object)(object)val8))
{
ScaledRotationFollower scaledRotationFollower4 = ((Component)val8).gameObject.AddComponent<ScaledRotationFollower>();
scaledRotationFollower4.Init(val7, val8, 1f);
}
Transform val9 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/Shoulder.R/Arms.R");
Transform val10 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/BRight shoulder/BRight arm");
if (Object.op_Implicit((Object)(object)val9) && Object.op_Implicit((Object)(object)val10))
{
ScaledRotationFollower scaledRotationFollower5 = ((Component)val10).gameObject.AddComponent<ScaledRotationFollower>();
scaledRotationFollower5.Init(val9, val10, 0.35f);
}
Transform val11 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/Shoulder.R/Arms.R/Elbow.R");
Transform val12 = base.replacementModel.transform.Find("Faputa ToonShading/Faputa ToonShading_arm/ParentNode/Center/Groove/UpperBody/UpperBody2/BRight shoulder/BRight arm/BRight elbow");
if (Object.op_Implicit((Object)(object)val11) && Object.op_Implicit((Object)(object)val12))
{
ScaledRotationFollower scaledRotationFollower6 = ((Component)val12).gameObject.AddComponent<ScaledRotationFollower>();
scaledRotationFollower6.Init(val11, val12, 0.7f);
}
SkinnedMeshRenderer componentInChildren = base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
BlendShapeBlink blendShapeBlink = base.replacementModel.AddComponent<BlendShapeBlink>();
blendShapeBlink.Init(componentInChildren, "Blink", -1, 6f, 12f);
BlendShapeMouthSpeak blendShapeMouthSpeak = base.replacementModel.AddComponent<BlendShapeMouthSpeak>();
blendShapeMouthSpeak.Init(componentInChildren, ((BodyReplacementBase)this).controller, "▲Triangle");
}
}
}
public class MROZEN : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Ozen";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
}
public class MRREG : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "reg";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
}
public class MRPRUSHKA : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Prushka";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
SkinnedMeshRenderer componentInChildren = base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
BlendShapeBlink blendShapeBlink = base.replacementModel.AddComponent<BlendShapeBlink>();
blendShapeBlink.Init(componentInChildren, "07_Eye_Blink", -1, 6f, 12f);
BlendShapeMouthSpeak blendShapeMouthSpeak = base.replacementModel.AddComponent<BlendShapeMouthSpeak>();
blendShapeMouthSpeak.Init(componentInChildren, ((BodyReplacementBase)this).controller, "15_Mouth_Damage", -1, 50f);
}
}
}
public class MRRIKO : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "Riko";
return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
}
protected override void AddModelScripts()
{
SkinnedMeshRenderer componentInChildren = base.replacementModel.GetComponentInChildren<SkinnedMeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
BlendShapeBlink blendShapeBlink = base.replacementModel.AddComponent<BlendShapeBlink>();
blendShapeBlink.Init(componentInChildren, "Blink", -1, 6f, 12f);
BlendShapeMouthSpeakRiko blendShapeMouthSpeakRiko = base.replacementModel.AddComponent<BlendShapeMouthSpeakRiko>();
blendShapeMouthSpeakRiko.Init(componentInChildren, ((BodyReplacementBase)this).controller);
}
}
}
public class PositionOnlySync : MonoBehaviour
{
public Transform sourceBone;
public Transform targetBone;
private Vector3 initialLocalPosition;
private Quaternion initialLocalRotation;
private Transform targetParent;
public void Init(Transform source, Transform target)
{
//IL_001d: 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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
sourceBone = source;
targetBone = target;
targetParent = target.parent;
initialLocalPosition = target.localPosition;
initialLocalRotation = target.localRotation;
}
private void LateUpdate()
{
//IL_0030: 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_0054: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)sourceBone == (Object)null) && !((Object)(object)targetBone == (Object)null))
{
targetBone.position = sourceBone.position;
targetBone.localRotation = initialLocalRotation;
targetBone.localPosition = initialLocalPosition;
}
}
}
public class ScaledRotationFollower : MonoBehaviour
{
public Transform sourceBone;
public Transform targetBone;
public float rotationScale = 0.5f;
private Quaternion sourceInitialLocalRotation;
private Quaternion sourceInitialWorldRotation;
private Quaternion targetInitialLocalRotation;
private Quaternion targetInitialWorldRotation;
public bool useWorldSpace = false;
public void Init(Transform source, Transform target, float scale)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
sourceBone = source;
targetBone = target;
rotationScale = scale;
targetInitialLocalRotation = target.localRotation;
targetInitialWorldRotation = target.rotation;
sourceInitialLocalRotation = source.localRotation;
sourceInitialWorldRotation = source.rotation;
}
private void LateUpdate()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)sourceBone == (Object)null) && !((Object)(object)targetBone == (Object)null))
{
Quaternion val = Quaternion.Inverse(sourceInitialLocalRotation) * sourceBone.localRotation;
Quaternion val2 = Quaternion.Inverse(sourceInitialWorldRotation) * sourceBone.rotation;
Quaternion val3 = (useWorldSpace ? val2 : val);
Quaternion val4 = Quaternion.Slerp(Quaternion.identity, val3, rotationScale);
if (useWorldSpace)
{
targetBone.rotation = targetInitialWorldRotation * val4;
}
else
{
targetBone.localRotation = targetInitialLocalRotation * val4;
}
}
}
}
public class BlendShapeBlink : MonoBehaviour
{
[CompilerGenerated]
private sealed class <AnimateBlendShape>d__11 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int index;
public float from;
public float to;
public float duration;
public BlendShapeBlink <>4__this;
private float <t>5__1;
private float <normalized>5__2;
private float <eased>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <AnimateBlendShape>d__11(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;
<t>5__1 = 0f;
break;
case 1:
<>1__state = -1;
break;
}
if (<t>5__1 < duration)
{
<t>5__1 += Time.deltaTime;
<normalized>5__2 = Mathf.Clamp01(<t>5__1 / duration);
<eased>5__3 = Mathf.SmoothStep(from, to, <normalized>5__2);
<>4__this.skinnedMeshRenderer.SetBlendShapeWeight(index, <eased>5__3);
<>2__current = null;
<>1__state = 1;
return true;
}
<>4__this.skinnedMeshRenderer.SetBlendShapeWeight(index, to);
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 <BlinkLoop>d__10 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public BlendShapeBlink <>4__this;
private Mesh <mesh>5__1;
private float <wait>5__2;
private float <half>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BlinkLoop>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<mesh>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Expected O, but got Unknown
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)<>4__this.skinnedMeshRenderer == (Object)null || (Object)(object)<>4__this.skinnedMeshRenderer.sharedMesh == (Object)null || <>4__this.skinnedMeshRenderer.sharedMesh.blendShapeCount == 0)
{
return false;
}
if (<>4__this.blendShapeIndex < 0)
{
<>4__this.blendShapeIndex = <>4__this.ResolveBlendShapeIndex(<>4__this.skinnedMeshRenderer, <>4__this.blendShapeName);
}
if (<>4__this.blendShapeIndex < 0)
{
return false;
}
<mesh>5__1 = <>4__this.skinnedMeshRenderer.sharedMesh;
break;
case 2:
<>1__state = -1;
<half>5__3 = Mathf.Max(0.01f, <>4__this.blinkDuration / 2f);
<>2__current = <>4__this.AnimateBlendShape(<>4__this.blendShapeIndex, 0f, <>4__this.closedWeight, <half>5__3);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.02f);
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<>2__current = <>4__this.AnimateBlendShape(<>4__this.blendShapeIndex, <>4__this.closedWeight, 0f, <half>5__3);
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
break;
}
<wait>5__2 = Random.Range(<>4__this.minInterval, <>4__this.maxInterval);
<>2__current = (object)new WaitForSeconds(<wait>5__2);
<>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();
}
}
public SkinnedMeshRenderer skinnedMeshRenderer;
public string blendShapeName = "Blink";
public int blendShapeIndex = -1;
public float blinkDuration = 0.15f;
public float minInterval = 10f;
public float maxInterval = 20f;
public float closedWeight = 100f;
private Coroutine blinkCoroutine;
public void Init(SkinnedMeshRenderer smr, string blendShapeName = "Blink", int blendShapeIndex = -1, float minInterval = 10f, float maxInterval = 20f)
{
skinnedMeshRenderer = smr;
this.blendShapeName = blendShapeName;
this.blendShapeIndex = blendShapeIndex;
this.minInterval = minInterval;
this.maxInterval = maxInterval;
if (blinkCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(blinkCoroutine);
}
blinkCoroutine = ((MonoBehaviour)this).StartCoroutine(BlinkLoop());
}
private void Start()
{
if ((Object)(object)skinnedMeshRenderer == (Object)null)
{
skinnedMeshRenderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
}
if (blinkCoroutine == null && (Object)(object)skinnedMeshRenderer != (Object)null)
{
blinkCoroutine = ((MonoBehaviour)this).StartCoroutine(BlinkLoop());
}
}
[IteratorStateMachine(typeof(<BlinkLoop>d__10))]
private IEnumerator BlinkLoop()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BlinkLoop>d__10(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<AnimateBlendShape>d__11))]
private IEnumerator AnimateBlendShape(int index, float from, float to, float duration)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <AnimateBlendShape>d__11(0)
{
<>4__this = this,
index = index,
from = from,
to = to,
duration = duration
};
}
private int ResolveBlendShapeIndex(SkinnedMeshRenderer smr, string preferredName)
{
Mesh sharedMesh = smr.sharedMesh;
if ((Object)(object)sharedMesh == (Object)null)
{
return -1;
}
if (!string.IsNullOrEmpty(preferredName))
{
int num = sharedMesh.GetBlendShapeIndex(preferredName);
if (num >= 0)
{
return num;
}
}
string[] array = new string[1] { "Blink" };
string[] array2 = array;
foreach (string text in array2)
{
int num2 = sharedMesh.GetBlendShapeIndex(text);
if (num2 >= 0)
{
return num2;
}
}
if (sharedMesh.blendShapeCount > 0)
{
return 0;
}
return -1;
}
private void OnDisable()
{
if (blinkCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(blinkCoroutine);
}
if ((Object)(object)skinnedMeshRenderer != (Object)null && blendShapeIndex >= 0)
{
skinnedMeshRenderer.SetBlendShapeWeight(blendShapeIndex, 0f);
}
}
}
public class BlendShapeMouthSpeak : MonoBehaviour
{
public SkinnedMeshRenderer skinnedMeshRenderer;
public string blendShapeName = "MouthOpen";
public int blendShapeIndex = -1;
public float openWeight = 100f;
public float closedWeight = 0f;
public PlayerControllerB player;
protected VoicePlayerState voice;
public float sensitivity => Plugin.voiceSensitivity.Value;
public void Init(SkinnedMeshRenderer smr, PlayerControllerB player, string blendShapeName = "MouthOpen", int blendShapeIndex = -1, float openWeight = 100f)
{
skinnedMeshRenderer = smr;
this.blendShapeName = blendShapeName;
this.blendShapeIndex = blendShapeIndex;
this.openWeight = openWeight;
this.player = player;
}
private void Start()
{
if ((Object)(object)skinnedMeshRenderer == (Object)null)
{
skinnedMeshRenderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
}
if ((Object)(object)skinnedMeshRenderer != (Object)null && blendShapeIndex < 0)
{
blendShapeIndex = ResolveBlendShapeIndex(skinnedMeshRenderer, blendShapeName);
}
}
private void Update()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
if ((Object)StartOfRound.Instance.voiceChatModule == (Object)null)
{
return;
}
if (voice == null)
{
initVoice();
}
else
{
if ((Object)(object)skinnedMeshRenderer == (Object)null || (Object)(object)skinnedMeshRenderer.sharedMesh == (Object)null || skinnedMeshRenderer.sharedMesh.blendShapeCount == 0)
{
return;
}
if (blendShapeIndex < 0)
{
blendShapeIndex = ResolveBlendShapeIndex(skinnedMeshRenderer, blendShapeName);
}
if (blendShapeIndex >= 0)
{
float num = closedWeight;
if (voice.IsSpeaking && (Object)(object)player != (Object)null && !player.isPlayerDead)
{
float num2 = Map(voice.Amplitude * sensitivity, 0f, 1f, closedWeight, openWeight);
num = Mathf.Clamp(num2, closedWeight, openWeight);
}
skinnedMeshRenderer.SetBlendShapeWeight(blendShapeIndex, num);
}
}
}
private void initVoice()
{
//IL_003c: 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_0055: Expected O, but got Unknown
//IL_0055: Expected O, but got Unknown
StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
if ((Object)(object)player != (Object)null)
{
voice = player.voicePlayerState;
if (voice == null && (Object)player == (Object)StartOfRound.Instance.localPlayerController)
{
voice = StartOfRound.Instance.voiceChatModule.FindPlayer(StartOfRound.Instance.voiceChatModule.LocalPlayerName);
}
}
}
private int ResolveBlendShapeIndex(SkinnedMeshRenderer smr, string preferredName)
{
Mesh sharedMesh = smr.sharedMesh;
if ((Object)(object)sharedMesh == (Object)null)
{
return -1;
}
if (!string.IsNullOrEmpty(preferredName))
{
int num = sharedMesh.GetBlendShapeIndex(preferredName);
if (num >= 0)
{
return num;
}
}
string[] array = new string[7] { "MouthOpen", "mouthOpen", "open_mouth", "JawOpen", "jawOpen", "viseme_aa", "vrc.v_aa" };
string[] array2 = array;
foreach (string text in array2)
{
int num2 = sharedMesh.GetBlendShapeIndex(text);
if (num2 >= 0)
{
return num2;
}
}
if (sharedMesh.blendShapeCount > 0)
{
return 0;
}
return -1;
}
private float Map(float value, float min1, float max1, float min2, float max2)
{
float num = (value - min1) / (max1 - min1);
return num * (max2 - min2) + min2;
}
private void OnDisable()
{
if ((Object)(object)skinnedMeshRenderer != (Object)null && blendShapeIndex >= 0)
{
skinnedMeshRenderer.SetBlendShapeWeight(blendShapeIndex, closedWeight);
}
}
}
public class BlendShapeMouthSpeakRiko : MonoBehaviour
{
[CompilerGenerated]
private sealed class <PhonemeHoldCoroutine>d__22 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int idx;
public float holdDuration;
public bool willClose;
public BlendShapeMouthSpeakRiko <>4__this;
private float <t>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <PhonemeHoldCoroutine>d__22(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;
<t>5__1 = 0f;
break;
case 1:
<>1__state = -1;
break;
}
if (<t>5__1 < holdDuration)
{
<t>5__1 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
if (willClose)
{
<>4__this.targetWeights[idx] = <>4__this.closedWeight;
}
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();
}
}
public SkinnedMeshRenderer skinnedMeshRenderer;
public string[] shapeNames = new string[6] { "a", "o", "i", "e", "u", "a2" };
private int[] shapeIndices;
private List<int> validShapeIndices = new List<int>();
public float openWeightMax = 100f;
public float closedWeight = 0f;
public PlayerControllerB player;
protected VoicePlayerState voice;
public float minPhonemeInterval = 0.06f;
public float maxPhonemeInterval = 0.18f;
public float minPhonemeHold = 0.04f;
public float maxPhonemeHold = 0.12f;
public float closeProbability = 0.8f;
public float weightSmoothSpeed = 15f;
private Dictionary<int, float> targetWeights = new Dictionary<int, float>();
private Dictionary<int, float> currentWeights = new Dictionary<int, float>();
public float sensitivity => Plugin.voiceSensitivity.Value;
public void Init(SkinnedMeshRenderer smr, PlayerControllerB player, float openWeightMax = 100f, float closeProbability = 0.8f)
{
skinnedMeshRenderer = smr;
this.player = player;
this.openWeightMax = openWeightMax;
this.closeProbability = Mathf.Clamp01(closeProbability);
ResolveShapeIndices();
targetWeights.Clear();
currentWeights.Clear();
foreach (int validShapeIndex in validShapeIndices)
{
targetWeights[validShapeIndex] = closedWeight;
currentWeights[validShapeIndex] = closedWeight;
skinnedMeshRenderer.SetBlendShapeWeight(validShapeIndex, closedWeight);
}
}
private void Start()
{
if ((Object)(object)skinnedMeshRenderer == (Object)null)
{
skinnedMeshRenderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
}
if ((Object)(object)skinnedMeshRenderer != (Object)null && (shapeIndices == null || shapeIndices.Length == 0))
{
ResolveShapeIndices();
}
}
private void Update()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
if ((Object)StartOfRound.Instance.voiceChatModule == (Object)null)
{
return;
}
if (voice == null)
{
initVoice();
}
else
{
if ((Object)(object)skinnedMeshRenderer == (Object)null || (Object)(object)skinnedMeshRenderer.sharedMesh == (Object)null || skinnedMeshRenderer.sharedMesh.blendShapeCount == 0)
{
return;
}
if (validShapeIndices.Count == 0)
{
ResolveShapeIndices();
if (validShapeIndices.Count == 0)
{
return;
}
}
if (voice.IsSpeaking && (Object)(object)player != (Object)null && !player.isPlayerDead)
{
if (!((MonoBehaviour)this).IsInvoking("TriggerRandomPhoneme"))
{
TriggerRandomPhoneme();
float num = Random.Range(minPhonemeInterval, maxPhonemeInterval);
((MonoBehaviour)this).Invoke("TriggerRandomPhoneme", num);
}
}
else
{
((MonoBehaviour)this).CancelInvoke("TriggerRandomPhoneme");
foreach (int validShapeIndex in validShapeIndices)
{
targetWeights[validShapeIndex] = closedWeight;
}
}
List<int> list = new List<int>(targetWeights.Keys);
foreach (int item in list)
{
float num2 = (currentWeights.ContainsKey(item) ? currentWeights[item] : 0f);
float num3 = targetWeights[item];
float num4 = Mathf.Lerp(num2, num3, 1f - Mathf.Exp((0f - weightSmoothSpeed) * Time.deltaTime));
currentWeights[item] = num4;
skinnedMeshRenderer.SetBlendShapeWeight(item, num4);
}
}
}
private void TriggerRandomPhoneme()
{
if (voice == null || (Object)(object)skinnedMeshRenderer == (Object)null || !voice.IsSpeaking || !((Object)(object)player != (Object)null) || player.isPlayerDead || validShapeIndices.Count == 0)
{
return;
}
int num = validShapeIndices[Random.Range(0, validShapeIndices.Count)];
foreach (int validShapeIndex in validShapeIndices)
{
targetWeights[validShapeIndex] = closedWeight;
}
float num2 = Map(voice.Amplitude * sensitivity, 0f, 1f, closedWeight, openWeightMax);
float value = Mathf.Clamp(num2, closedWeight, openWeightMax);
targetWeights[num] = value;
bool willClose = Random.value < closeProbability;
float holdDuration = Random.Range(minPhonemeHold, maxPhonemeHold);
((MonoBehaviour)this).StartCoroutine(PhonemeHoldCoroutine(num, holdDuration, willClose));
if (voice.IsSpeaking)
{
float num3 = Random.Range(minPhonemeInterval, maxPhonemeInterval);
((MonoBehaviour)this).Invoke("TriggerRandomPhoneme", num3);
}
}
[IteratorStateMachine(typeof(<PhonemeHoldCoroutine>d__22))]
private IEnumerator PhonemeHoldCoroutine(int idx, float holdDuration, bool willClose)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <PhonemeHoldCoroutine>d__22(0)
{
<>4__this = this,
idx = idx,
holdDuration = holdDuration,
willClose = willClose
};
}
private void initVoice()
{
//IL_003c: 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_0055: Expected O, but got Unknown
//IL_0055: Expected O, but got Unknown
StartOfRound.Instance.RefreshPlayerVoicePlaybackObjects();
if ((Object)(object)player != (Object)null)
{
voice = player.voicePlayerState;
if (voice == null && (Object)player == (Object)StartOfRound.Instance.localPlayerController)
{
voice = StartOfRound.Instance.voiceChatModule.FindPlayer(StartOfRound.Instance.voiceChatModule.LocalPlayerName);
}
}
}
private void ResolveShapeIndices()
{
validShapeIndices.Clear();
if ((Object)(object)skinnedMeshRenderer == (Object)null || (Object)(object)skinnedMeshRenderer.sharedMesh == (Object)null)
{
return;
}
Mesh sharedMesh = skinnedMeshRenderer.sharedMesh;
shapeIndices = new int[shapeNames.Length];
for (int i = 0; i < shapeNames.Length; i++)
{
string text = shapeNames[i];
int blendShapeIndex = sharedMesh.GetBlendShapeIndex(text);
shapeIndices[i] = blendShapeIndex;
if (blendShapeIndex >= 0)
{
validShapeIndices.Add(blendShapeIndex);
}
}
if (validShapeIndices.Count == 0 && sharedMesh.blendShapeCount > 0)
{
validShapeIndices.Add(0);
}
targetWeights.Clear();
currentWeights.Clear();
foreach (int validShapeIndex in validShapeIndices)
{
targetWeights[validShapeIndex] = closedWeight;
currentWeights[validShapeIndex] = closedWeight;
}
}
private float Map(float value, float min1, float max1, float min2, float max2)
{
float num = 0f;
if (max1 - min1 != 0f)
{
num = (value - min1) / (max1 - min1);
}
return num * (max2 - min2) + min2;
}
private void OnDisable()
{
((MonoBehaviour)this).CancelInvoke("TriggerRandomPhoneme");
((MonoBehaviour)this).StopAllCoroutines();
if (!((Object)(object)skinnedMeshRenderer != (Object)null))
{
return;
}
foreach (int validShapeIndex in validShapeIndices)
{
skinnedMeshRenderer.SetBlendShapeWeight(validShapeIndex, closedWeight);
}
}
}
[BepInPlugin("2floor.madeinabysssuits", "madeinabysssuits", "0.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static ConfigFile config;
public static ConfigEntry<bool> enableModelForAllSuits { get; private set; }
public static ConfigEntry<bool> enableModelAsDefault { get; private set; }
public static ConfigEntry<string> suitNamesToEnableModel { get; private set; }
public static ConfigEntry<float> voiceSensitivity { get; private set; }
private static void InitConfig()
{
enableModelForAllSuits = config.Bind<bool>("Suits to Replace Settings", "Enable Model for all Suits", false, "Enable to model replace every suit. Set to false to specify suits");
enableModelAsDefault = config.Bind<bool>("Suits to Replace Settings", "Enable Model as default", false, "Enable to model replace every suit that hasn't been otherwise registered.");
suitNamesToEnableModel = config.Bind<string>("Suits to Replace Settings", "Suits to enable Model for", "Default,Orange suit", "Enter a comma separated list of suit names.(Additionally, [Green suit,Pajama suit,Hazard suit])");
voiceSensitivity = config.Bind<float>("Voice Sensitivity For Models Jaw", "Sensitivity Value", 10f, "Number from 5 to 20");
}
private void Awake()
{
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Expected O, but got Unknown
config = ((BaseUnityPlugin)this).Config;
InitConfig();
Assets.PopulateAssets();
if (enableModelForAllSuits.Value)
{
ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRNANACHI));
ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRFAPUTA));
ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MROZEN));
ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRREG));
ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRPRUSHKA));
ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRRIKO));
ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRMARULK));
ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRLYZA));
}
if (enableModelAsDefault.Value)
{
ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRNANACHI));
ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRFAPUTA));
ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MROZEN));
ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRREG));
ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRPRUSHKA));
ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRRIKO));
ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRMARULK));
ModelReplacementAPI.RegisterModelReplacementDefault(typeof(MRLYZA));
}
ModelReplacementAPI.RegisterSuitModelReplacement("Nanachi", typeof(MRNANACHI));
ModelReplacementAPI.RegisterSuitModelReplacement("Faputa", typeof(MRFAPUTA));
ModelReplacementAPI.RegisterSuitModelReplacement("Ozen", typeof(MROZEN));
ModelReplacementAPI.RegisterSuitModelReplacement("Reg", typeof(MRREG));
ModelReplacementAPI.RegisterSuitModelReplacement("Prushka", typeof(MRPRUSHKA));
ModelReplacementAPI.RegisterSuitModelReplacement("Riko", typeof(MRRIKO));
ModelReplacementAPI.RegisterSuitModelReplacement("Marulk", typeof(MRMARULK));
ModelReplacementAPI.RegisterSuitModelReplacement("Lyza", typeof(MRLYZA));
Harmony val = new Harmony("2floor.madeinabysssuits");
val.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin 2floor.madeinabysssuits is loaded!");
}
}
public static class Assets
{
public static string mainAssetBundleName = "madeinabyssbundle";
public static AssetBundle MainAssetBundle = null;
private static string GetAssemblyName()
{
return Assembly.GetExecutingAssembly().GetName().Name.Replace(" ", "_");
}
public static void PopulateAssets()
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName);
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName);
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}