using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MacadamiaNuts.Golden;
using MacadamiaNuts.States;
using MacadamiaNuts.States.CommonNuts;
using MacadamiaNuts.Timer;
using MacadamiaNuts.Valuables;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[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-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("DanizHereAndNow")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+1851cbae50be2df3a3d5183081e8a5d68e7a0fcc")]
[assembly: AssemblyProduct("MacadamiaNuts")]
[assembly: AssemblyTitle("MacadamiaNuts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MacadamiaNuts
{
[BepInPlugin("DanizHereAndNow.MacadamiaNuts", "MacadamiaNuts", "1.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MacadamiaNuts : BaseUnityPlugin
{
internal static MacadamiaNuts Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}
namespace MacadamiaNuts.Valuables
{
public class BigNutValuable : MonoBehaviour
{
[SerializeField]
private float _maxDistance = 2f;
[SerializeField]
private Sound _meAndTheBirds;
private PhysGrabObject _physGrabObject;
private bool _isPushing;
private void Awake()
{
_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
}
private void Update()
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
if (_physGrabObject.playerGrabbing.Any())
{
foreach (PhysGrabber item in _physGrabObject.playerGrabbing.ToList())
{
item.ReleaseObject(0.1f);
}
}
_meAndTheBirds.PlayLoop(_isPushing, 0.5f, 1f, 1f);
Collider[] array = Physics.OverlapSphere(((Component)this).transform.position, _maxDistance);
Collider[] array2 = array;
foreach (Collider val in array2)
{
if (((Component)val).gameObject.CompareTag("Player"))
{
_isPushing = true;
break;
}
_isPushing = false;
}
}
private void OnDrawGizmos()
{
//IL_0001: 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)
Gizmos.color = Color.blue;
Gizmos.DrawWireSphere(((Component)this).transform.position, _maxDistance);
}
}
public class GoldenNutValuable : MonoBehaviour
{
[SerializeField]
private GameObject _goldenPrefab;
[SerializeField]
private Renderer _prefabGoldenRender;
[SerializeField]
private ParticleSystem _shiningParticles;
[SerializeField]
private Sound _corryptSound;
private HashSet<PlayerAvatar> _corryptedPlayers = new HashSet<PlayerAvatar>();
private List<PlayerAvatar> _players = new List<PlayerAvatar>();
private PhysGrabObject _physGrabObject;
private bool _isGrabbed => _physGrabObject.playerGrabbing.Any();
private bool _isShining => _shiningParticles.isPlaying;
private void Awake()
{
_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
MonoBehaviour.print((object)((Object)((Component)this).GetComponentInChildren<Renderer>().material.shader).name);
MonoBehaviour.print((object)((Component)this).GetComponentInChildren<Renderer>().material.shader);
}
private void Update()
{
if (!_isGrabbed)
{
if (!_isShining)
{
_shiningParticles.Play();
}
else
{
_shiningParticles.Stop();
}
UpdatePlayerList();
}
else
{
TryCorrypt();
}
}
public void RemoveCorryptedPlayer(PlayerAvatar avatar)
{
if (_corryptedPlayers.Contains(avatar))
{
_corryptedPlayers.Remove(avatar);
}
}
private void UpdatePlayerList()
{
_players.Clear();
_players = _physGrabObject.playerGrabbing.Select((PhysGrabber x) => x.playerAvatar).ToList();
}
private void Corrypt(List<PhysGrabber> players)
{
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
Color val = default(Color);
((Color)(ref val))..ctor(1f, 0.3f, 0.6f, 1f);
uint num = Convert.ToUInt32(players.Count - 1 - _players.Count);
for (uint num2 = num; num2 < players.Count; num2++)
{
PlayerAvatar playerAvatar = players[(int)num2].playerAvatar;
PlayerAvatarVisuals componentInChildren = ((Component)((Component)players[(int)num2]).transform.parent).GetComponentInChildren<PlayerAvatarVisuals>();
GoldenPlayerAvatar componentInChildren2 = ((Component)playerAvatar).GetComponentInChildren<GoldenPlayerAvatar>();
if ((Object)(object)componentInChildren2 != (Object)null)
{
componentInChildren2.IncreaseCorryption();
_corryptSound.Play(((Component)playerAvatar).transform.position, 1f, 1f, 1f, 1f);
}
else if (_corryptedPlayers.Add(playerAvatar))
{
GameObject val2 = Object.Instantiate<GameObject>(_goldenPrefab, ((Component)playerAvatar).transform);
GoldenPlayerAvatar component = val2.GetComponent<GoldenPlayerAvatar>();
component.Initialize(playerAvatar, componentInChildren, this);
if (SemiFunc.IsMultiplayer())
{
ChatManager.instance.PossessChatScheduleStart(15);
ChatManager.instance.PossessChat((PossessChatID)0, "Oh, this is a very creepy feeling >//<", 1f, val, 0f, false, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
}
}
}
UpdatePlayerList();
}
private void TryCorrypt()
{
List<PhysGrabber> playerGrabbing = _physGrabObject.playerGrabbing;
if (playerGrabbing.Count <= _players.Count)
{
UpdatePlayerList();
}
else
{
Corrypt(playerGrabbing);
}
}
}
public class NutsValuable : MonoBehaviour
{
[CompilerGenerated]
private sealed class <TryGetCart>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public NutsValuable <>4__this;
private int <attempts>5__1;
private int <i>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <TryGetCart>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<attempts>5__1 = 5;
<i>5__2 = 0;
break;
case 1:
<>1__state = -1;
<i>5__2++;
break;
}
if (<i>5__2 < <attempts>5__1)
{
<>4__this._cart = Object.FindAnyObjectByType<PhysGrabCart>();
if (!((Object)(object)<>4__this._cart != (Object)null))
{
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
}
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private const float MAX_ANGLE = 80f;
[SerializeField]
private MacadamiaTimerData _activeTimerData;
[SerializeField]
private MacadamiaTimerData _idleTimerData;
[SerializeField]
private GameObject _firstLayer;
[SerializeField]
private GameObject _secondLayer;
[SerializeField]
private GameObject _thirdLayer;
[SerializeField]
private Sound _soundCrack;
[SerializeField]
private Sound _semiEat;
private Queue<GameObject> _nutsLayers = new Queue<GameObject>();
private List<string> _objections = new List<string>();
private ParticleSystem _particle;
private PhysGrabObject _physGrabObject;
private PhotonView _photonView;
private PhysGrabCart _cart;
private MacadamiaStateMachine _stateMachine;
private bool _isGrabbed => _physGrabObject.playerGrabbing.Any();
private void Awake()
{
_photonView = ((Component)this).GetComponent<PhotonView>();
_particle = ((Component)this).GetComponentInChildren<ParticleSystem>();
_physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
_nutsLayers.Enqueue(_firstLayer);
_nutsLayers.Enqueue(_secondLayer);
_nutsLayers.Enqueue(_thirdLayer);
((MonoBehaviour)this).StartCoroutine(TryGetCart());
_stateMachine = new MacadamiaStateMachine();
ActiveMacadamiaNuts component = ((Component)this).GetComponent<ActiveMacadamiaNuts>();
component.Initialize(_activeTimerData, 1, _semiEat, _physGrabObject, _photonView, _nutsLayers, _particle);
IdleMacadamiaNuts component2 = ((Component)this).GetComponent<IdleMacadamiaNuts>();
component2.Initialize(_idleTimerData, _particle, _nutsLayers, _soundCrack, _physGrabObject, _cart, ((Component)this).transform, 80f);
_stateMachine.AddState(component);
_stateMachine.AddState(component2);
}
private void Update()
{
if (_isGrabbed)
{
_stateMachine.SetState<ActiveMacadamiaNuts>();
}
else if (!_isGrabbed)
{
_stateMachine.SetState<IdleMacadamiaNuts>();
}
_stateMachine.ExecuteState();
}
public void NutsCracked()
{
_particle.Play();
}
private void InitializeObjections()
{
string[] collection = new string[1] { " , fuk, ma macafamia nuff ar clumflinf" };
_objections.AddRange(collection);
}
[IteratorStateMachine(typeof(<TryGetCart>d__21))]
private IEnumerator TryGetCart()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <TryGetCart>d__21(0)
{
<>4__this = this
};
}
}
}
namespace MacadamiaNuts.Timer
{
public class MacadamiaTimer
{
private float _timer = 0f;
private float _counter = 0f;
public MacadamiaTimer(float baseCounter)
{
_counter = baseCounter;
}
public void UpdateCounter(float newValue)
{
_counter = newValue;
_timer = 0f;
}
public void Countdown(float deltaTime, Action onEnd = null)
{
if (_timer < _counter)
{
_timer += deltaTime;
}
else
{
onEnd?.Invoke();
}
}
}
[CreateAssetMenu(fileName = "Timer - _____", menuName = "Macadamia Nuts/Timer Data")]
public class MacadamiaTimerData : ScriptableObject
{
public float Min;
public float Max;
public float StartTime;
}
}
namespace MacadamiaNuts.States
{
public abstract class MacadamiaState : MonoBehaviour
{
public abstract void Enter();
public abstract void Execute();
public abstract void Exit();
public override string ToString()
{
return ((object)this).GetType().Name;
}
}
public class MacadamiaStateMachine
{
private Dictionary<string, MacadamiaState> _states = new Dictionary<string, MacadamiaState>();
private MacadamiaState _currentState;
public void AddState(MacadamiaState state)
{
string text = ((object)state).ToString();
if (!_states.ContainsKey(text))
{
_states.Add(text, state);
Debug.Log((object)("New state (" + text + ") was added."));
}
}
public void SetState<T>() where T : MacadamiaState
{
string name = typeof(T).Name;
if (_states.TryGetValue(name, out MacadamiaState value))
{
if (!object.Equals(value, _currentState))
{
_currentState?.Exit();
_currentState = value;
_currentState.Enter();
Debug.Log((object)("This state (" + name + ") is current"));
}
}
else
{
Debug.LogWarning((object)("This state (" + name + ") doesnt exist"));
}
}
public void ExecuteState()
{
_currentState?.Execute();
}
}
}
namespace MacadamiaNuts.States.CommonNuts
{
public class ActiveMacadamiaNuts : MacadamiaState
{
private Queue<GameObject> _layers = new Queue<GameObject>();
private MacadamiaTimer _timer;
private float _min = 0f;
private float _max = 0f;
private int _damage = 1;
private PhysGrabObject _grabObject;
private PhotonView _photonView;
private bool _isHurting;
private Sound _semiEat;
private ParticleSystem _particleSystem;
private bool _isFilled => _layers.Any();
public void Initialize(MacadamiaTimerData macadamiaTimerData, int damage, Sound semiEat, PhysGrabObject physGrabObject, PhotonView photonView, Queue<GameObject> layers, ParticleSystem particleSystem)
{
_min = macadamiaTimerData.Min;
_max = macadamiaTimerData.Max;
_grabObject = physGrabObject;
_timer = new MacadamiaTimer(macadamiaTimerData.StartTime);
_damage = damage;
_photonView = photonView;
_semiEat = semiEat;
_particleSystem = particleSystem;
_layers = layers;
}
public override void Enter()
{
}
public override void Exit()
{
_timer.UpdateCounter(Random.Range(_min, _max));
}
public override void Execute()
{
if (_isFilled && _isHurting)
{
HurtPlayerEffect();
}
_timer.Countdown(Time.deltaTime, delegate
{
List<PhysGrabber> playerGrabbing = _grabObject.playerGrabbing;
if (playerGrabbing.Any())
{
HurtPlayer();
}
_timer.UpdateCounter(Random.Range(_min, _max));
});
}
private void HurtPlayerEffect()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
foreach (PhysGrabber item in _grabObject.playerGrabbing)
{
_semiEat.Stop();
item.playerAvatar.playerHealth.Hurt(_damage, false, -1);
_semiEat.Play(((Component)item).transform.position, 1f, 1f, 1f, 1f);
if (_isFilled)
{
_damage = Random.Range(1, 3);
}
Emit(15, item.playerAvatar.spectatePoint);
}
_isHurting = false;
}
private void Emit(int count, Transform transform)
{
for (int i = 0; i < count; i++)
{
Emit(transform);
}
}
private void Emit(Transform basePoint)
{
//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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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)
//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_004e: 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_005f: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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)
Vector3 val = basePoint.position + basePoint.forward * 0.3f;
val += new Vector3(Random.Range(-0.1f, 0.1f), Random.Range(-0.05f, 0.1f), 0f);
EmitParams val2 = default(EmitParams);
((EmitParams)(ref val2)).position = val;
((EmitParams)(ref val2)).velocity = Vector3.up * 0.2f;
EmitParams val3 = val2;
_particleSystem.Emit(val3, 1);
}
private void HurtPlayer()
{
//IL_0033: 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)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (SemiFunc.IsMultiplayer())
{
_photonView.RPC("HurtPlayerRPC", (RpcTarget)0, Array.Empty<object>());
}
else
{
HurtPlayerRPC();
}
}
}
[PunRPC]
private void HurtPlayerRPC(PhotonMessageInfo _info = default(PhotonMessageInfo))
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.MasterOnlyRPC(_info))
{
_isHurting = true;
}
}
}
public class IdleMacadamiaNuts : MacadamiaState
{
private float MAX_ANGLE;
private Transform _objectTransform;
private Queue<GameObject> _layers = new Queue<GameObject>();
private PhysGrabCart _cart;
private MacadamiaTimer _timer;
private float _min = 0f;
private float _max = 0f;
private ParticleSystem _particleSystem;
private Sound _soundCrack;
private PhysGrabObject _physGrabObject;
private bool _isFilledByOne => _layers.Count == 1;
private bool _isObjectInCart => _cart.itemsInCart.Contains(_physGrabObject);
private bool _isRotatedDown
{
get
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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_0038: Unknown result type (might be due to invalid IL or missing references)
Quaternion rotation = ((Component)_objectTransform).transform.rotation;
int result;
if (!(((Quaternion)(ref rotation)).eulerAngles.x > MAX_ANGLE))
{
rotation = ((Component)_objectTransform).transform.rotation;
result = ((((Quaternion)(ref rotation)).eulerAngles.z > MAX_ANGLE) ? 1 : 0);
}
else
{
result = 1;
}
return (byte)result != 0;
}
}
public void Initialize(MacadamiaTimerData macadamiaTimerData, ParticleSystem particleSystem, Queue<GameObject> layers, Sound soundCrack, PhysGrabObject physGrabObject, PhysGrabCart physGrabCart, Transform transform, float angle)
{
_min = macadamiaTimerData.Min;
_max = macadamiaTimerData.Max;
_timer = new MacadamiaTimer(macadamiaTimerData.StartTime);
_particleSystem = particleSystem;
_layers = layers;
MAX_ANGLE = angle;
_objectTransform = transform;
_cart = physGrabCart;
_physGrabObject = physGrabObject;
_soundCrack = soundCrack;
}
public override void Enter()
{
}
public override void Exit()
{
_timer.UpdateCounter(Random.Range(_min, _max));
}
public override void Execute()
{
if (!_isObjectInCart && _isRotatedDown)
{
_timer.Countdown(Time.deltaTime, delegate
{
NutsCrackes();
_timer.UpdateCounter(Random.Range(_min, _max));
});
}
}
private void NutsCrackes()
{
//IL_005e: 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)
_particleSystem.Play();
if (_isFilledByOne)
{
_physGrabObject.impactDetector.DestroyObject(true);
}
if (_layers.Any())
{
GameObject val = _layers.Dequeue();
val.SetActive(false);
_physGrabObject.impactDetector.BreakMedium(_physGrabObject.centerPoint, true);
_soundCrack.Play(_physGrabObject.centerPoint, 1f, 1f, 1f, 1f);
}
}
}
}
namespace MacadamiaNuts.Golden
{
public class GoldenHead : MonoBehaviour
{
public void Initialize()
{
}
}
public class GoldenPlayerAvatar : MonoBehaviour
{
[CompilerGenerated]
private sealed class <UpdateCorryptionCoroutine>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float counter;
public GoldenPlayerAvatar <>4__this;
private MeshRenderer[] <>s__1;
private int <>s__2;
private Renderer <renderer>5__3;
private Material <material>5__4;
private float <currentCorryption>5__5;
private Material <oldMaterial>5__6;
private Material[] <>s__7;
private int <>s__8;
private Material <m>5__9;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <UpdateCorryptionCoroutine>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__1 = null;
<renderer>5__3 = null;
<material>5__4 = null;
<oldMaterial>5__6 = null;
<>s__7 = null;
<m>5__9 = null;
<>1__state = -2;
}
private bool MoveNext()
{
int num = <>1__state;
if (num != 0)
{
if (num != 1)
{
return false;
}
<>1__state = -1;
goto IL_018a;
}
<>1__state = -1;
<>s__1 = <>4__this._playerRenderers;
<>s__2 = 0;
goto IL_01e2;
IL_01e2:
if (<>s__2 < <>s__1.Length)
{
<renderer>5__3 = (Renderer)(object)<>s__1[<>s__2];
<material>5__4 = ((IEnumerable<Material>)<renderer>5__3.materials).FirstOrDefault((Func<Material, bool>)((Material x) => ((Object)x).name == "GoldCorryption"));
<>s__7 = <renderer>5__3.materials;
for (<>s__8 = 0; <>s__8 < <>s__7.Length; <>s__8++)
{
<m>5__9 = <>s__7[<>s__8];
Debug.Log((object)<m>5__9);
<m>5__9 = null;
}
<>s__7 = null;
if (!Object.op_Implicit((Object)(object)<material>5__4))
{
goto IL_01d4;
}
<currentCorryption>5__5 = <material>5__4.GetFloat("_GoldCorryption");
<oldMaterial>5__6 = <renderer>5__3.materials[0];
<renderer>5__3.materials[0] = <material>5__4;
goto IL_018a;
}
<>s__1 = null;
return false;
IL_018a:
if (<currentCorryption>5__5 >= counter * <>4__this._step)
{
<currentCorryption>5__5 -= Time.deltaTime;
<material>5__4.SetFloat("_GoldCorryption", <currentCorryption>5__5);
<>2__current = null;
<>1__state = 1;
return true;
}
<renderer>5__3.materials[0] = <oldMaterial>5__6;
<material>5__4 = null;
<oldMaterial>5__6 = null;
<renderer>5__3 = null;
goto IL_01d4;
IL_01d4:
<>s__2++;
goto IL_01e2;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private const string MAIN_TEXTURE = "_MainTex";
private const string EDGE_STEP = "_GoldCorryption";
private const float MAX_GOLD = 1f;
private const float MIN_GOLD = 0f;
private float _counter = 5f;
private float _maxCorruption = 0f;
private Animator _animator;
private PlayerAvatar _playerAvatar;
private PlayerAvatarVisuals _playerAvatarVisuals;
private GoldenNutValuable _corryptioner;
private GoldenVingette _vingette;
private MeshRenderer[] _playerRenderers;
private Shader _goldenShader;
private float _step => 1f / _maxCorruption;
private bool _isFullCorrupted => _maxCorruption == _counter;
public void Initialize(PlayerAvatar player, PlayerAvatarVisuals rig, GoldenNutValuable corryptioner)
{
_corryptioner = corryptioner;
_playerAvatar = player;
_playerAvatarVisuals = rig;
GameObject meshParent = _playerAvatarVisuals.meshParent;
_animator = ((Component)_playerAvatarVisuals).GetComponent<Animator>();
_vingette = ((Component)this).GetComponent<GoldenVingette>();
_goldenShader = ((Component)this).GetComponent<Renderer>().material.shader;
_counter = Random.Range(2, 7);
_playerRenderers = ((Component)meshParent.transform).GetComponentsInChildren<MeshRenderer>(true);
AddMaterial();
}
public void IncreaseCorryption()
{
if (_isFullCorrupted)
{
Death();
return;
}
_counter -= 1f;
((MonoBehaviour)this).StartCoroutine(UpdateCorryptionCoroutine(_counter));
_vingette.ShowCurrentVignette(_counter);
}
public void Revive()
{
Object.Destroy((Object)(object)this);
}
private void Death()
{
((MonoBehaviour)this).StartCoroutine(UpdateCorryptionCoroutine(0f));
_animator.speed = 0f;
_corryptioner.RemoveCorryptedPlayer(_playerAvatar);
_playerAvatar.physGrabber.ReleaseObject(0.1f);
_playerAvatar.SetSpectate();
}
[IteratorStateMachine(typeof(<UpdateCorryptionCoroutine>d__21))]
private IEnumerator UpdateCorryptionCoroutine(float counter)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <UpdateCorryptionCoroutine>d__21(0)
{
<>4__this = this,
counter = counter
};
}
private void AddMaterial()
{
//IL_0071: 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_0084: Expected O, but got Unknown
MeshRenderer[] playerRenderers = _playerRenderers;
for (int i = 0; i < playerRenderers.Length; i++)
{
Renderer val = (Renderer)(object)playerRenderers[i];
Texture val2;
if (val.material.HasProperty("_AlbedoTexture"))
{
val2 = val.material.GetTexture("_AlbedoTexture");
}
else
{
if (!val.material.HasProperty("_MainTex"))
{
continue;
}
val2 = val.material.mainTexture;
}
Material val3 = new Material(_goldenShader)
{
name = "GoldCorryption"
};
val3.SetTexture("_MainTex", val2);
val3.SetFloat("_GoldCorryption", 1f);
Material[] array = (Material[])(object)new Material[val.materials.Length + 1];
val.materials.CopyTo(array, 0);
array[^1] = val3;
Material[] array2 = array;
foreach (Material val4 in array2)
{
Debug.Log((object)val4);
}
val.materials = array;
}
}
}
public class GoldenVingette : MonoBehaviour
{
[CompilerGenerated]
private sealed class <ShowCurrentVignetteCoroutine>d__10 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float counter;
public GoldenVingette <>4__this;
private float <newValue>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ShowCurrentVignetteCoroutine>d__10(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;
if (!<>4__this._material.HasProperty("_MinValue"))
{
Debug.Log((object)"This material doesnt has property: _MinValue");
return false;
}
<newValue>5__1 = 0.8f - 0.4f / counter;
<>4__this._currentVignette = <>4__this._material.GetFloat("_MinValue");
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this._currentVignette > <newValue>5__1)
{
<>4__this._currentVignette -= Time.deltaTime;
<>4__this._material.SetFloat("_MinValue", <>4__this._currentVignette);
<>2__current = null;
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private const string VINGETTE_KEY = "_MinValue";
private const float MIN_VALUE = 0.4f;
private const float MAX_VALUE = 0.8f;
private Image _vingette;
private float _currentVignette;
private Material _material;
private void Awake()
{
_vingette = ((Component)this).GetComponentInChildren<Image>();
_material = ((Graphic)_vingette).material;
if (!_material.HasProperty("_MinValue"))
{
Debug.Log((object)"This material doesnt has property: _MinValue");
}
else
{
_material.SetFloat("_MinValue", 0.8f);
}
}
public void Show()
{
((Component)_vingette).gameObject.SetActive(true);
}
public void Hide()
{
((Component)_vingette).gameObject.SetActive(false);
}
public void ShowCurrentVignette(float counter)
{
((MonoBehaviour)this).StartCoroutine(ShowCurrentVignetteCoroutine(counter));
}
[IteratorStateMachine(typeof(<ShowCurrentVignetteCoroutine>d__10))]
private IEnumerator ShowCurrentVignetteCoroutine(float counter)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ShowCurrentVignetteCoroutine>d__10(0)
{
<>4__this = this,
counter = counter
};
}
}
}