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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Modules;
using ReiPlush;
using ReiPlush1.Behaviours;
using ReiPlush1.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ReiPlush1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ReiPlush1")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("844c071e-9e15-4059-85cf-a2958393343a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
public class ReiPlushItem : GrabbableObject
{
[CompilerGenerated]
private sealed class <ReturnToIdleAfter>d__60 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public float seconds;
public ReiPlushItem <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ReturnToIdleAfter>d__60(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(seconds);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.ResetToIdle();
<>4__this.hasPlayedHit = false;
<>4__this.hasPlayedIdleOnThrow = false;
<>4__this.hasPlayedIdleOnGrab = 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();
}
}
public AudioSource noiseAudio;
public AudioSource noiseAudioFar;
public AudioSource screamAudio;
public AudioClip[] noiseSFX;
public AudioClip[] noiseSFXFar;
public AudioClip[] screamSFX;
public AudioClip[] introSFX;
public AudioClip[] memeSFX;
public Animator triggerAnimator;
public float secretChance = 0f;
public AnimationCurve grenadeFallCurve;
public AnimationCurve grenadeVerticalFallCurve;
public AnimationCurve grenadeVerticalFallCurveNoBounce;
public RaycastHit grenadeHit;
public Ray grenadeThrowRay;
public float noiseRange;
public float maxLoudness;
public float minLoudness;
public float minPitch;
public float maxPitch;
private const int stunGrenadeMask = 268437761;
private bool hasCollided;
private PlayerControllerB playerThrownBy;
private Random noisemakerRandom;
private bool hasPlayedIdleOnGrab;
private bool hasPlayedIdleOnThrow;
private bool hasPlayedHit;
private int timesEquipped = 0;
private const int introRepeatInterval = 5;
private List<int> unplayedIntroIndexes;
private List<int> unplayedScreamIndexes;
private List<int> unplayedNoiseIndexes;
private List<int> unplayedMemeIndexes;
private float lastEquippedTime = 0f;
private const float throwAfterPickupCooldown = 0.15f;
private bool isInHitAnimation = false;
private static Dictionary<ulong, bool> clientMemeSettings = new Dictionary<ulong, bool>();
public override void Start()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Expected O, but got Unknown
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0178: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: 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_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Expected O, but got Unknown
//IL_0348: Unknown result type (might be due to invalid IL or missing references)
//IL_034e: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Start();
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
grenadeFallCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2]
{
new Keyframe(0f, 0f, 2f, 2f),
new Keyframe(1f, 1f, 0f, 0f)
});
grenadeFallCurve.preWrapMode = (WrapMode)1;
grenadeFallCurve.postWrapMode = (WrapMode)1;
grenadeVerticalFallCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[5]
{
new Keyframe(0f, 0f, 0.11690851f, 0.11690851f),
new Keyframe(0.49081117f, 1f, 4.1146584f, -1.81379f),
new Keyframe(0.7587703f, 1f, 1.4123471f, -1.3678839f),
new Keyframe(0.9393898f, 1f, 0.82654804f, -0.029021755f),
new Keyframe(1f, 1f, 0f, 0f)
});
grenadeVerticalFallCurve.preWrapMode = (WrapMode)1;
grenadeVerticalFallCurve.postWrapMode = (WrapMode)1;
grenadeVerticalFallCurveNoBounce = new AnimationCurve((Keyframe[])(object)new Keyframe[4]
{
new Keyframe(0f, 0f, 0.11690851f, 0.11690851f),
new Keyframe(0.49081117f, 1f, 4.1146584f, 0.06098772f),
new Keyframe(0.9393898f, 1f, 0.06394797f, -0.029021755f),
new Keyframe(1f, 1f, 0f, 0f)
});
grenadeVerticalFallCurveNoBounce.preWrapMode = (WrapMode)1;
grenadeVerticalFallCurveNoBounce.postWrapMode = (WrapMode)1;
unplayedIntroIndexes = new List<int>();
if (introSFX != null)
{
for (int i = 0; i < introSFX.Length; i++)
{
unplayedIntroIndexes.Add(i);
}
}
unplayedNoiseIndexes = new List<int>();
if (noiseSFX != null)
{
for (int j = 0; j < noiseSFX.Length; j++)
{
unplayedNoiseIndexes.Add(j);
}
}
unplayedScreamIndexes = new List<int>();
if (screamSFX != null)
{
for (int k = 0; k < screamSFX.Length; k++)
{
unplayedScreamIndexes.Add(k);
}
}
unplayedMemeIndexes = new List<int>();
if (Plugin.EnableMemeSFX.Value && memeSFX != null)
{
for (int l = 0; l < memeSFX.Length; l++)
{
unplayedMemeIndexes.Add(l);
}
}
if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsClient && !((NetworkBehaviour)this).IsHost)
{
ReportMemeSettingServerRpc(Plugin.EnableMemeSFX.Value);
}
Animator obj = triggerAnimator;
if (obj != null)
{
obj.SetTrigger("playIdle");
}
minLoudness = 0.7f;
maxLoudness = 1f;
minPitch = 0.95f;
maxPitch = 1.05f;
}
private void PlayNoiseClipByName(string clipName)
{
if ((Object)(object)noiseAudio == (Object)null || noiseSFX == null || noiseSFX.Length == 0)
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.LogWarning((object)"[ReiPlushItem] noiseAudio or noiseSFX missing.");
}
return;
}
AudioClip val = null;
AudioClip[] array = noiseSFX;
foreach (AudioClip val2 in array)
{
if ((Object)(object)val2 != (Object)null && ((Object)val2).name.Equals(clipName, StringComparison.OrdinalIgnoreCase))
{
val = val2;
break;
}
}
if ((Object)(object)val == (Object)null)
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.LogWarning((object)("[ReiPlushItem] No noiseSFX clip found with name '" + clipName + "'."));
}
return;
}
noiseAudio.Stop();
noiseAudio.pitch = 1f;
noiseAudio.PlayOneShot(val, 1f);
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)("[ReiPlushItem] Playing noiseSFX clip by name: " + ((Object)val).name));
}
}
public override void EquipItem()
{
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] EquipItem called.");
}
((GrabbableObject)this).EquipItem();
lastEquippedTime = Time.time;
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.equippedUsableItemQE = true;
}
hasCollided = false;
((GrabbableObject)this).EnableItemMeshes(true);
base.isPocketed = false;
timesEquipped++;
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)$"[ReiPlushItem] timesEquipped: {timesEquipped}");
}
if (!base.hasBeenHeld)
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] First time held, adding scrap value.");
}
base.hasBeenHeld = true;
if (!base.isInShipRoom && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
RoundManager instance = RoundManager.Instance;
instance.valueOfFoundScrapItems += base.scrapValue;
}
}
if ((timesEquipped == 1 || timesEquipped % 5 == 0) && introSFX != null && introSFX.Length != 0 && (Object)(object)noiseAudio != (Object)null)
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] Playing intro SFX.");
}
if (unplayedIntroIndexes == null || unplayedIntroIndexes.Count == 0)
{
unplayedIntroIndexes = new List<int>();
for (int i = 0; i < introSFX.Length; i++)
{
unplayedIntroIndexes.Add(i);
}
}
int index = noisemakerRandom.Next(0, unplayedIntroIndexes.Count);
int num = unplayedIntroIndexes[index];
unplayedIntroIndexes.RemoveAt(index);
if (Plugin.EnableDebugLogs.Value)
{
object arg = num;
AudioClip obj = introSFX[num];
Debug.Log((object)string.Format("[ReiPlushItem] Playing intro SFX index {0}: {1}", arg, ((obj != null) ? ((Object)obj).name : null) ?? "null"));
}
float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float num3 = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
num2 = Mathf.Clamp(num2, 0.01f, 1f);
num3 = Mathf.Clamp(num3, 0.5f, 2f);
RequestIntroSFXServerRpc(num, num2, num3);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if (minLoudness >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.timeSinceMakingLoudNoise = 0f;
}
}
if (!hasPlayedIdleOnGrab && (Object)(object)triggerAnimator != (Object)null)
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] Playing idle animation on grab.");
}
triggerAnimator.SetTrigger("playIdle");
hasPlayedIdleOnGrab = true;
}
}
public override void DiscardItem()
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] DiscardItem called.");
}
if ((Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.activatingItem = false;
base.playerHeldBy.equippedUsableItemQE = false;
}
base.isBeingUsed = false;
ResetToIdle();
hasPlayedIdleOnGrab = false;
hasPlayedIdleOnThrow = false;
hasPlayedHit = false;
((GrabbableObject)this).DiscardItem();
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)$"[ReiPlushItem] ItemActivate called. used={used}, buttonDown={buttonDown}");
}
if (Plugin.EnableDebugLogs.Value)
{
PlayerControllerB playerHeldBy = base.playerHeldBy;
string obj = ((playerHeldBy != null) ? ((Object)playerHeldBy).name : null);
PlayerControllerB obj2 = playerThrownBy;
Debug.Log((object)("[ReiPlushItem] playerHeldBy=" + obj + ", playerThrownBy=" + ((obj2 != null) ? ((Object)obj2).name : null)));
}
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)$"[ReiPlushItem] State: isHeld={base.isHeld}, isPocketed={base.isPocketed}, hasCollided={hasCollided}, hasPlayedIdleOnGrab={hasPlayedIdleOnGrab}, hasPlayedIdleOnThrow={hasPlayedIdleOnThrow}, hasPlayedHit={hasPlayedHit}");
}
if (Time.time - lastEquippedTime < 0.15f || (Object)(object)base.playerHeldBy == (Object)null || !base.isHeld)
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] Throw blocked: not ready after pickup or not held.");
}
return;
}
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((NetworkBehaviour)this).IsOwner)
{
return;
}
if (!hasPlayedIdleOnThrow && (Object)(object)triggerAnimator != (Object)null)
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] Playing throw animation on throw.");
}
triggerAnimator.SetTrigger("playThrow");
hasPlayedIdleOnThrow = true;
}
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] Discarding held object and playing scream.");
}
base.playerHeldBy.DiscardHeldObject(true, (NetworkObject)null, GetGrenadeThrowDestination(), true);
RequestScreamServerRpc();
}
public override void ItemInteractLeftRight(bool right)
{
((GrabbableObject)this).ItemInteractLeftRight(right);
if (!right)
{
if (Plugin.EnableMemeSFX.Value && memeSFX != null && memeSFX.Length != 0 && noisemakerRandom.NextDouble() < (double)(Plugin.MemeChance.Value / 100f))
{
PlayMemeNetworked();
}
else
{
PlayNoiseNetworked();
}
}
}
private int GetNextClipIndex(List<int> indexList, int clipCount, Random rng)
{
if (indexList == null || indexList.Count == 0)
{
indexList = Enumerable.Range(0, clipCount).ToList();
}
int index = rng.Next(0, indexList.Count);
int result = indexList[index];
indexList.RemoveAt(index);
return result;
}
private void PlayNoiseNetworked()
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] PlayNoise called.");
}
AudioClip[] array = memeSFX;
int num = ((array != null) ? array.Length : 0);
AudioClip[] array2 = noiseSFX;
int count = ((array2 != null) ? array2.Length : 0);
if (Plugin.EnableMemeSFX.Value && num > 0 && Random.value < Plugin.MemeChance.Value / 100f)
{
if (unplayedMemeIndexes == null || unplayedMemeIndexes.Count == 0)
{
unplayedMemeIndexes = Enumerable.Range(0, num).ToList();
}
int index = noisemakerRandom.Next(0, unplayedMemeIndexes.Count);
int index2 = unplayedMemeIndexes[index];
unplayedMemeIndexes.RemoveAt(index);
float vol = Random.Range(minLoudness, maxLoudness);
float pitch = Random.Range(minPitch, maxPitch);
RequestMemeSFXServerRpc(index2, vol, pitch);
}
else
{
if (unplayedNoiseIndexes == null || unplayedNoiseIndexes.Count == 0)
{
unplayedNoiseIndexes = Enumerable.Range(0, count).ToList();
}
int index3 = noisemakerRandom.Next(0, unplayedNoiseIndexes.Count);
int index4 = unplayedNoiseIndexes[index3];
unplayedNoiseIndexes.RemoveAt(index3);
float vol2 = Random.Range(minLoudness, maxLoudness);
float pitch2 = Random.Range(minPitch, maxPitch);
RequestNoiseSFXServerRpc(index4, vol2, pitch2);
}
}
private void PlayMemeNetworked()
{
if (!Plugin.EnableMemeSFX.Value || memeSFX == null || memeSFX.Length == 0)
{
return;
}
if (unplayedMemeIndexes == null || unplayedMemeIndexes.Count == 0)
{
unplayedMemeIndexes = new List<int>();
for (int i = 0; i < memeSFX.Length; i++)
{
unplayedMemeIndexes.Add(i);
}
}
int index = noisemakerRandom.Next(0, unplayedMemeIndexes.Count);
int index2 = unplayedMemeIndexes[index];
unplayedMemeIndexes.RemoveAt(index);
float vol = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
RequestMemeSFXServerRpc(index2, vol, pitch);
if (minLoudness >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.timeSinceMakingLoudNoise = 0f;
}
}
public override void FallWithCurve()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = base.startFallingPosition - base.targetFloorPosition;
float num = ((Vector3)(ref val)).magnitude;
if (num < 0.01f)
{
num = 0.01f;
}
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(base.itemProperties.restingRotation.x, ((Component)this).transform.eulerAngles.y, base.itemProperties.restingRotation.z), 14f * Time.deltaTime / num);
((Component)this).transform.localPosition = Vector3.Lerp(base.startFallingPosition, base.targetFloorPosition, grenadeFallCurve.Evaluate(base.fallTime));
AnimationCurve val2 = ((num > 5f) ? grenadeVerticalFallCurveNoBounce : grenadeVerticalFallCurve);
((Component)this).transform.localPosition = Vector3.Lerp(new Vector3(((Component)this).transform.localPosition.x, base.startFallingPosition.y, ((Component)this).transform.localPosition.z), new Vector3(((Component)this).transform.localPosition.x, base.targetFloorPosition.y, ((Component)this).transform.localPosition.z), val2.Evaluate(base.fallTime));
base.fallTime += Mathf.Abs(Time.deltaTime * 12f / num);
}
public override void OnHitGround()
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] OnHitGround called.");
}
((GrabbableObject)this).OnHitGround();
if ((Object)(object)playerThrownBy != (Object)null)
{
hasCollided = true;
}
if (hasPlayedHit || !((Object)(object)triggerAnimator != (Object)null))
{
return;
}
hasPlayedHit = true;
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] Hit animation triggered.");
}
if (Random.value < secretChance)
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] Gangnam Style animation triggered!");
}
triggerAnimator.SetTrigger("playGangnam");
}
else
{
triggerAnimator.SetTrigger("playHit");
((MonoBehaviour)this).StartCoroutine(ReturnToIdleAfter(1.2f));
}
}
public Vector3 GetGrenadeThrowDestination()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
Transform val = (((Object)(object)base.playerHeldBy != (Object)null) ? ((Component)base.playerHeldBy.gameplayCamera).transform : ((Component)Camera.main).transform);
grenadeThrowRay = new Ray(val.position, val.forward);
Vector3 val2 = (Physics.Raycast(grenadeThrowRay, ref grenadeHit, 12f, 268437761, (QueryTriggerInteraction)1) ? ((Ray)(ref grenadeThrowRay)).GetPoint(((RaycastHit)(ref grenadeHit)).distance - 0.05f) : ((Ray)(ref grenadeThrowRay)).GetPoint(10f));
grenadeThrowRay = new Ray(val2, Vector3.down);
return Physics.Raycast(grenadeThrowRay, ref grenadeHit, 30f, 268437761, (QueryTriggerInteraction)1) ? (((RaycastHit)(ref grenadeHit)).point + Vector3.up * 0.05f) : ((Ray)(ref grenadeThrowRay)).GetPoint(30f);
}
private void PlayScream()
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] PlayScream called.");
}
Animator obj = triggerAnimator;
if (obj != null)
{
obj.SetTrigger("playThrow");
}
StopAllAudio();
if (unplayedScreamIndexes == null || unplayedScreamIndexes.Count == 0)
{
unplayedScreamIndexes = new List<int>();
if (screamSFX != null)
{
for (int i = 0; i < screamSFX.Length; i++)
{
unplayedScreamIndexes.Add(i);
}
}
}
if (unplayedScreamIndexes != null && unplayedScreamIndexes.Count != 0 && screamSFX != null && screamSFX.Length != 0)
{
int index = noisemakerRandom.Next(0, unplayedScreamIndexes.Count);
int num = unplayedScreamIndexes[index];
unplayedScreamIndexes.RemoveAt(index);
if (!((Object)(object)screamAudio == (Object)null))
{
screamAudio.pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
screamAudio.PlayOneShot(screamSFX[num], (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void RequestIntroSFXServerRpc(int index, float vol, float pitch)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1314587342u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref vol, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pitch, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1314587342u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
PlayIntroSFXClientRpc(index, vol, pitch);
}
}
}
[ClientRpc]
public void PlayIntroSFXClientRpc(int index, float vol, float pitch)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(494574939u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref vol, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pitch, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 494574939u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && introSFX != null && index >= 0 && index < introSFX.Length)
{
StopAllAudio();
noiseAudio.pitch = pitch;
noiseAudio.PlayOneShot(introSFX[index], vol);
WalkieTalkie.TransmitOneShotAudio(noiseAudio, introSFX[index], vol);
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)$"[ReiPlushItem] (Networked) Playing intro SFX index {index} at volume {vol}, pitch {pitch}");
}
}
}
[ServerRpc(RequireOwnership = false)]
public void RequestNoiseSFXServerRpc(int index, float vol, float pitch)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1345785988u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref vol, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pitch, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1345785988u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
PlayNoiseSFXClientRpc(index, vol, pitch);
}
}
}
[ClientRpc]
public void PlayNoiseSFXClientRpc(int index, float vol, float pitch)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2605218768u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref vol, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pitch, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2605218768u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && noiseSFX != null && index >= 0 && index < noiseSFX.Length)
{
StopAllAudio();
noiseAudio.pitch = pitch;
noiseAudio.PlayOneShot(noiseSFX[index], vol);
WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[index], vol);
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)$"[ReiPlushItem] (Networked) Playing noise SFX index {index} at volume {vol}, pitch {pitch}");
}
}
}
[ServerRpc(RequireOwnership = false)]
public void RequestScreamServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3576944410u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3576944410u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
PlayScreamClientRpc();
}
}
}
[ClientRpc]
public void PlayScreamClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2016864707u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2016864707u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
PlayScream();
}
}
}
[ServerRpc(RequireOwnership = false)]
public void RequestMemeSFXServerRpc(int index, float vol, float pitch)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: 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_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4182652224u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, index);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref vol, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref pitch, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4182652224u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
if (clientMemeSettings.Count == 0)
{
PlayMemeSFXClientRpc(index, vol, pitch);
return;
}
foreach (KeyValuePair<ulong, bool> clientMemeSetting in clientMemeSettings)
{
if (clientMemeSetting.Value)
{
ClientRpcParams val3 = default(ClientRpcParams);
val3.Send = new ClientRpcSendParams
{
TargetClientIds = new ulong[1] { clientMemeSetting.Key }
};
ClientRpcParams clientRpcParams = val3;
PlayMemeSFXClientRpc(index, vol, pitch, clientRpcParams);
}
}
}
[ClientRpc]
public void PlayMemeSFXClientRpc(int index, float vol, float pitch, ClientRpcParams clientRpcParams = default(ClientRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(536283999u, clientRpcParams, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val, index);
((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref vol, default(ForPrimitives));
((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitch, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val, 536283999u, clientRpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && Plugin.EnableMemeSFX.Value && memeSFX != null && index >= 0 && index < memeSFX.Length && !((Object)(object)noiseAudio == (Object)null))
{
StopAllAudio();
noiseAudio.pitch = pitch;
noiseAudio.PlayOneShot(memeSFX[index], vol);
WalkieTalkie.TransmitOneShotAudio(noiseAudio, memeSFX[index], vol);
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)$"[ReiPlushItem] (Networked) Playing meme SFX index {index} at volume {vol}, pitch {pitch}");
}
}
}
[ServerRpc(RequireOwnership = false)]
public void ReportMemeSettingServerRpc(bool enabled, ServerRpcParams rpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(649038243u, rpcParams, (RpcDelivery)0);
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref enabled, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val, 649038243u, rpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ulong senderClientId = rpcParams.Receive.SenderClientId;
clientMemeSettings[senderClientId] = enabled;
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)$"[ReiPlushItem] Client {senderClientId} reported meme setting: {enabled}");
}
}
}
public override void OnDestroy()
{
if (((NetworkBehaviour)this).IsServer && clientMemeSettings.ContainsKey(((NetworkBehaviour)this).OwnerClientId))
{
clientMemeSettings.Remove(((NetworkBehaviour)this).OwnerClientId);
}
}
[IteratorStateMachine(typeof(<ReturnToIdleAfter>d__60))]
private IEnumerator ReturnToIdleAfter(float seconds)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ReturnToIdleAfter>d__60(0)
{
<>4__this = this,
seconds = seconds
};
}
private void ResetToIdle()
{
if ((Object)(object)triggerAnimator != (Object)null)
{
triggerAnimator.ResetTrigger("playHit");
triggerAnimator.ResetTrigger("playGangnam");
triggerAnimator.SetTrigger("playIdle");
}
}
private void StopAllAudio()
{
if (Plugin.EnableDebugLogs.Value)
{
Debug.Log((object)"[ReiPlushItem] Stopping all audio sources.");
}
AudioSource obj = noiseAudio;
if (obj != null)
{
obj.Stop();
}
AudioSource obj2 = noiseAudioFar;
if (obj2 != null)
{
obj2.Stop();
}
AudioSource obj3 = screamAudio;
if (obj3 != null)
{
obj3.Stop();
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_ReiPlushItem()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1314587342u, new RpcReceiveHandler(__rpc_handler_1314587342));
NetworkManager.__rpc_func_table.Add(494574939u, new RpcReceiveHandler(__rpc_handler_494574939));
NetworkManager.__rpc_func_table.Add(1345785988u, new RpcReceiveHandler(__rpc_handler_1345785988));
NetworkManager.__rpc_func_table.Add(2605218768u, new RpcReceiveHandler(__rpc_handler_2605218768));
NetworkManager.__rpc_func_table.Add(3576944410u, new RpcReceiveHandler(__rpc_handler_3576944410));
NetworkManager.__rpc_func_table.Add(2016864707u, new RpcReceiveHandler(__rpc_handler_2016864707));
NetworkManager.__rpc_func_table.Add(4182652224u, new RpcReceiveHandler(__rpc_handler_4182652224));
NetworkManager.__rpc_func_table.Add(536283999u, new RpcReceiveHandler(__rpc_handler_536283999));
NetworkManager.__rpc_func_table.Add(649038243u, new RpcReceiveHandler(__rpc_handler_649038243));
}
private static void __rpc_handler_1314587342(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
float vol = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref vol, default(ForPrimitives));
float pitch = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ReiPlushItem)(object)target).RequestIntroSFXServerRpc(index, vol, pitch);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_494574939(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
float vol = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref vol, default(ForPrimitives));
float pitch = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((ReiPlushItem)(object)target).PlayIntroSFXClientRpc(index, vol, pitch);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1345785988(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
float vol = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref vol, default(ForPrimitives));
float pitch = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ReiPlushItem)(object)target).RequestNoiseSFXServerRpc(index, vol, pitch);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2605218768(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
float vol = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref vol, default(ForPrimitives));
float pitch = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((ReiPlushItem)(object)target).PlayNoiseSFXClientRpc(index, vol, pitch);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3576944410(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((ReiPlushItem)(object)target).RequestScreamServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2016864707(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((ReiPlushItem)(object)target).PlayScreamClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4182652224(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
float vol = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref vol, default(ForPrimitives));
float pitch = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ReiPlushItem)(object)target).RequestMemeSFXServerRpc(index, vol, pitch);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_536283999(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int index = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref index);
float vol = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref vol, default(ForPrimitives));
float pitch = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitch, default(ForPrimitives));
ClientRpcParams client = rpcParams.Client;
target.__rpc_exec_stage = (__RpcExecStage)2;
((ReiPlushItem)(object)target).PlayMemeSFXClientRpc(index, vol, pitch, client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_649038243(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_003e: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool enabled = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enabled, default(ForPrimitives));
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((ReiPlushItem)(object)target).ReportMemeSettingServerRpc(enabled, server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "ReiPlushItem";
}
}
namespace ReiPlush1.Behaviours
{
public static class AudioLoader
{
public static AudioClip[] LoadClipsInFolder(AssetBundle bundle, string folderPath, ManualLogSource logger)
{
folderPath = folderPath.ToLower().TrimEnd(new char[1] { '/' }) + "/";
List<AudioClip> list = new List<AudioClip>();
string[] allAssetNames = bundle.GetAllAssetNames();
foreach (string text in allAssetNames)
{
if (text.StartsWith(folderPath) && text.EndsWith(".ogg"))
{
AudioClip val = bundle.LoadAsset<AudioClip>(text);
if ((Object)(object)val != (Object)null)
{
list.Add(val);
}
}
}
ConfigEntry<bool> enableDebugLogs = Plugin.EnableDebugLogs;
if (enableDebugLogs != null && enableDebugLogs.Value)
{
logger.LogInfo((object)$"[Rei Plush] Loaded {list.Count} audio clips from folder '{folderPath}'");
}
return list.ToArray();
}
}
}
namespace ReiPlush
{
public static class AssetLoader
{
private const string ItemAssetPath = "assets/reiplush/reiplush.asset";
private static AssetBundle cachedBundle;
public static AssetBundle LoadBundle(ManualLogSource logger)
{
if ((Object)(object)cachedBundle != (Object)null)
{
ConfigEntry<bool> enableDebugLogs = Plugin.EnableDebugLogs;
if (enableDebugLogs != null && enableDebugLogs.Value)
{
logger.LogInfo((object)"[Rei Plush] Using cached AssetBundle.");
}
return cachedBundle;
}
string directoryName = Path.GetDirectoryName(typeof(Plugin).Assembly.Location);
string text = Path.Combine(directoryName, "reiplush");
ConfigEntry<bool> enableDebugLogs2 = Plugin.EnableDebugLogs;
if (enableDebugLogs2 != null && enableDebugLogs2.Value)
{
logger.LogInfo((object)("[Rei Plush] Attempting to load bundle from: " + text));
}
if (!File.Exists(text))
{
ConfigEntry<bool> enableDebugLogs3 = Plugin.EnableDebugLogs;
if (enableDebugLogs3 != null && enableDebugLogs3.Value)
{
logger.LogError((object)("[Rei Plush] AssetBundle file not found at: " + text));
}
return null;
}
cachedBundle = AssetBundle.LoadFromFile(text);
if ((Object)(object)cachedBundle == (Object)null)
{
ConfigEntry<bool> enableDebugLogs4 = Plugin.EnableDebugLogs;
if (enableDebugLogs4 != null && enableDebugLogs4.Value)
{
logger.LogError((object)"[Rei Plush] Failed to load asset bundle.");
}
return null;
}
ConfigEntry<bool> enableDebugLogs5 = Plugin.EnableDebugLogs;
if (enableDebugLogs5 != null && enableDebugLogs5.Value)
{
logger.LogInfo((object)"[Rei Plush] Successfully loaded AssetBundle.");
}
return cachedBundle;
}
public static Item LoadItem(ManualLogSource logger)
{
AssetBundle val = LoadBundle(logger);
if ((Object)(object)val == (Object)null)
{
return null;
}
Item val2 = val.LoadAsset<Item>("assets/reiplush/reiplush.asset");
if ((Object)(object)val2 == (Object)null)
{
ConfigEntry<bool> enableDebugLogs = Plugin.EnableDebugLogs;
if (enableDebugLogs != null && enableDebugLogs.Value)
{
logger.LogError((object)"[Rei Plush] Failed to load item from bundle.");
}
return null;
}
ConfigEntry<bool> enableDebugLogs2 = Plugin.EnableDebugLogs;
if (enableDebugLogs2 != null && enableDebugLogs2.Value)
{
logger.LogInfo((object)("[Rei Plush] Loaded item: " + ((Object)val2).name));
}
return val2;
}
}
public static class ConfigManager
{
public static void BindConfigs(ConfigFile config)
{
Plugin.EnableDebugLogs = config.Bind<bool>("General", "EnableDebugLogs", false, "Toggle debug logging");
Plugin.PlushRarity = config.Bind<int>("General", "PlushRarity", 37, "Rarity value for Rei Plush (higher = more common, lower = more rare).");
Plugin.EnableMemeSFX = config.Bind<bool>("Meme", "EnableMemeSFX", true, "Client-side setting to enable or disable meme voice lines for this player only. Disabling it will prevent meme SFX from playing on this client.");
Plugin.MemeChance = config.Bind<float>("Meme", "MemeChance", 0.8f, "Chance percentage that a meme SFX plays when interacting with the plush.");
Plugin.MinScrapValue = config.Bind<int>("General", "MinScrapValue", 175, "Minimum internal scrap value for the item. Note: The actual in-game scrap value is approximately 40% of this number.\nFor example, setting 50 here will result in about 20 scrap value in-game.");
Plugin.MaxScrapValue = config.Bind<int>("General", "MaxScrapValue", 200, "Maximum internal scrap value for the item. Note: The actual in-game scrap value is approximately 40% of this number.\nFor example, setting 100 here will result in about 40 scrap value in-game.");
}
}
public static class ReiPlushItemSetup
{
public static void SetupReiPlushItem(Item reiItem, AssetBundle bundle, ManualLogSource logger)
{
reiItem.minValue = Plugin.MinScrapValue.Value;
reiItem.maxValue = Plugin.MaxScrapValue.Value;
GameObject spawnPrefab = reiItem.spawnPrefab;
ReiPlushItem reiPlushItem = spawnPrefab.GetComponent<ReiPlushItem>() ?? spawnPrefab.AddComponent<ReiPlushItem>();
((GrabbableObject)reiPlushItem).grabbable = true;
((GrabbableObject)reiPlushItem).grabbableToEnemies = true;
((GrabbableObject)reiPlushItem).itemProperties = reiItem;
reiPlushItem.noiseAudio = spawnPrefab.GetComponent<AudioSource>();
if ((Object)(object)reiPlushItem.noiseAudio == (Object)null)
{
ConfigEntry<bool> enableDebugLogs = Plugin.EnableDebugLogs;
if (enableDebugLogs != null && enableDebugLogs.Value)
{
logger.LogWarning((object)"[Rei Plush] noiseAudio AudioSource not found on root prefab.");
}
}
Transform val = spawnPrefab.transform.Find("FarAudio");
if ((Object)(object)val != (Object)null)
{
reiPlushItem.noiseAudioFar = ((Component)val).GetComponent<AudioSource>();
}
else
{
ConfigEntry<bool> enableDebugLogs2 = Plugin.EnableDebugLogs;
if (enableDebugLogs2 != null && enableDebugLogs2.Value)
{
logger.LogWarning((object)"[Rei Plush] 'FarAudio' child object not found.");
}
}
Transform val2 = spawnPrefab.transform.Find("ScreamAudio");
if ((Object)(object)val2 != (Object)null)
{
reiPlushItem.screamAudio = ((Component)val2).GetComponent<AudioSource>();
}
else
{
ConfigEntry<bool> enableDebugLogs3 = Plugin.EnableDebugLogs;
if (enableDebugLogs3 != null && enableDebugLogs3.Value)
{
logger.LogWarning((object)"[Rei Plush] 'ScreamAudio' child object not found.");
}
}
reiPlushItem.noiseSFX = AudioLoader.LoadClipsInFolder(bundle, "assets/reiplush/sound/quotes", logger);
reiPlushItem.screamSFX = AudioLoader.LoadClipsInFolder(bundle, "assets/reiplush/sound/scream", logger);
reiPlushItem.introSFX = AudioLoader.LoadClipsInFolder(bundle, "assets/reiplush/sound/introduction", logger);
ConfigEntry<bool> enableMemeSFX = Plugin.EnableMemeSFX;
if (enableMemeSFX != null && enableMemeSFX.Value)
{
reiPlushItem.memeSFX = AudioLoader.LoadClipsInFolder(bundle, "assets/reiplush/sound/meme", logger);
if (reiPlushItem.memeSFX == null || reiPlushItem.memeSFX.Length == 0)
{
ConfigEntry<bool> enableDebugLogs4 = Plugin.EnableDebugLogs;
if (enableDebugLogs4 != null && enableDebugLogs4.Value)
{
logger.LogWarning((object)"[Rei Plush] No meme SFX clips found in the meme folder.");
}
}
}
else
{
reiPlushItem.memeSFX = null;
}
Transform val3 = spawnPrefab.transform.Find("Rei");
if ((Object)(object)val3 != (Object)null)
{
reiPlushItem.triggerAnimator = ((Component)val3).GetComponent<Animator>();
if ((Object)(object)reiPlushItem.triggerAnimator == (Object)null)
{
ConfigEntry<bool> enableDebugLogs5 = Plugin.EnableDebugLogs;
if (enableDebugLogs5 != null && enableDebugLogs5.Value)
{
logger.LogWarning((object)"[Rei Plush] Animator component missing on 'Rei' object.");
}
}
}
else
{
ConfigEntry<bool> enableDebugLogs6 = Plugin.EnableDebugLogs;
if (enableDebugLogs6 != null && enableDebugLogs6.Value)
{
logger.LogWarning((object)"[Rei Plush] Couldn't find 'Rei' object in prefab for Animator assignment.");
}
}
}
}
[BepInPlugin("KoolKids.reiplush", "Rei Plush", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <WaitForNetworkManager>d__9 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public Plugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForNetworkManager>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)NetworkManager.Singleton == (Object)null)
{
ConfigEntry<bool> enableDebugLogs = EnableDebugLogs;
if (enableDebugLogs != null && enableDebugLogs.Value)
{
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"[Rei Plush] Waiting for NetworkManager.Singleton...");
}
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
}
NetworkManager.Singleton.AddNetworkPrefab(<>4__this.reiItem.spawnPrefab);
ConfigEntry<bool> enableDebugLogs2 = EnableDebugLogs;
if (enableDebugLogs2 != null && enableDebugLogs2.Value)
{
((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"[Rei Plush] Registered Rei Plush prefab with NetworkManager.");
}
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 static ConfigEntry<int> PlushRarity;
public static ConfigEntry<int> MinScrapValue;
public static ConfigEntry<int> MaxScrapValue;
public static ConfigEntry<bool> EnableMemeSFX;
public static ConfigEntry<float> MemeChance;
public static ConfigEntry<bool> EnableDebugLogs;
private Item reiItem;
private void Awake()
{
RegisterWithLobbyCompatibility();
ConfigManager.BindConfigs(((BaseUnityPlugin)this).Config);
AssetBundle val = AssetLoader.LoadBundle(((BaseUnityPlugin)this).Logger);
if ((Object)(object)val == (Object)null)
{
return;
}
reiItem = AssetLoader.LoadItem(((BaseUnityPlugin)this).Logger);
if ((Object)(object)reiItem == (Object)null)
{
return;
}
ReiPlushItemSetup.SetupReiPlushItem(reiItem, val, ((BaseUnityPlugin)this).Logger);
NetworkPrefabs.RegisterNetworkPrefab(reiItem.spawnPrefab);
Utilities.FixMixerGroups(reiItem.spawnPrefab);
reiItem.minValue = MinScrapValue.Value;
reiItem.maxValue = MaxScrapValue.Value;
try
{
Items.RegisterScrap(reiItem, PlushRarity.Value, (LevelTypes)(-1));
ConfigEntry<bool> enableDebugLogs = EnableDebugLogs;
if (enableDebugLogs != null && enableDebugLogs.Value)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"[Rei Plush] Registered scrap item with config min/max values.");
}
}
catch (ArgumentException ex)
{
if (!ex.Message.Contains("same key has already been added"))
{
throw;
}
ConfigEntry<bool> enableDebugLogs2 = EnableDebugLogs;
if (enableDebugLogs2 != null && enableDebugLogs2.Value)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"[Rei Plush] Scrap item already registered, skipping duplicate registration.");
}
}
((MonoBehaviour)this).StartCoroutine(WaitForNetworkManager());
Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"[Rei Plush] Mod loaded.");
try
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
if (((MemberInfo)methodInfo).GetCustomAttribute<RuntimeInitializeOnLoadMethodAttribute>() != null)
{
methodInfo.Invoke(null, null);
}
}
}
}
catch (Exception arg)
{
((BaseUnityPlugin)this).Logger.LogError((object)$"[Rei Plush] Failed to initialize patched NetworkBehaviours: {arg}");
}
}
private void RegisterWithLobbyCompatibility()
{
try
{
Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "BMX.LobbyCompatibility");
if (assembly == null)
{
ConfigEntry<bool> enableDebugLogs = EnableDebugLogs;
if (enableDebugLogs != null && enableDebugLogs.Value)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"[Rei Plush] LobbyCompatibility assembly not found, skipping registration.");
}
return;
}
Type type = assembly.GetType("LobbyCompatibility.Features.PluginHelper");
if (type == null)
{
ConfigEntry<bool> enableDebugLogs2 = EnableDebugLogs;
if (enableDebugLogs2 != null && enableDebugLogs2.Value)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"[Rei Plush] PluginHelper type not found in LobbyCompatibility assembly.");
}
return;
}
Type type2 = assembly.GetType("LobbyCompatibility.Enums.CompatibilityLevel");
Type type3 = assembly.GetType("LobbyCompatibility.Enums.VersionStrictness");
if (type2 == null || type3 == null)
{
ConfigEntry<bool> enableDebugLogs3 = EnableDebugLogs;
if (enableDebugLogs3 != null && enableDebugLogs3.Value)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"[Rei Plush] Enum types not found in LobbyCompatibility assembly.");
}
return;
}
object obj = Enum.Parse(type2, "Everyone");
object obj2 = Enum.Parse(type3, "Minor");
MethodInfo method = type.GetMethod("RegisterPlugin", new Type[4]
{
typeof(string),
typeof(Version),
type2,
type3
});
if (method == null)
{
ConfigEntry<bool> enableDebugLogs4 = EnableDebugLogs;
if (enableDebugLogs4 != null && enableDebugLogs4.Value)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"[Rei Plush] RegisterPlugin method not found in PluginHelper.");
}
return;
}
method.Invoke(null, new object[4]
{
"KoolKids.reiplush",
new Version(1, 1, 0),
obj,
obj2
});
ConfigEntry<bool> enableDebugLogs5 = EnableDebugLogs;
if (enableDebugLogs5 != null && enableDebugLogs5.Value)
{
((BaseUnityPlugin)this).Logger.LogInfo((object)"[Rei Plush] Registered with LobbyCompatibility.");
}
}
catch (Exception ex)
{
ConfigEntry<bool> enableDebugLogs6 = EnableDebugLogs;
if (enableDebugLogs6 != null && enableDebugLogs6.Value)
{
((BaseUnityPlugin)this).Logger.LogWarning((object)"[Rei Plush] Exception during LobbyCompatibility registration.");
((BaseUnityPlugin)this).Logger.LogDebug((object)ex.ToString());
}
}
}
[IteratorStateMachine(typeof(<WaitForNetworkManager>d__9))]
private IEnumerator WaitForNetworkManager()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForNetworkManager>d__9(0)
{
<>4__this = this
};
}
}
}
namespace ReiPlush1.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}