using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
[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("Lluciocc")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4+26b8804ae7d1b0bea513baf3de2f2e246613f86c")]
[assembly: AssemblyProduct("GamblingMachine")]
[assembly: AssemblyTitle("GamblingMachine")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.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 GamblingMachine
{
[BepInPlugin("Lluciocc.GamblingMachine", "GamblingMachine", "1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class GamblingMachine : BaseUnityPlugin
{
public static ConfigEntry<float> winrate;
public static ConfigEntry<int> bet;
public static ConfigEntry<float> winMultiplicator;
public static ConfigEntry<bool> debug;
internal static GamblingMachine Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
public static GameObject SlotMachinePrefab { get; private set; }
private void Awake()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Expected O, but got Unknown
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
bet = ((BaseUnityPlugin)this).Config.Bind<int>("Gameplay", "bet", 2, new ConfigDescription("Amount to bet", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
winMultiplicator = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "winMultiplicator", 2f, new ConfigDescription("Multiplicator of your bet when you win", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>()));
winrate = ((BaseUnityPlugin)this).Config.Bind<float>("Gameplay", "winrate", 0.5f, new ConfigDescription("Chance to win (0.5 is 50%)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
debug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "EnableDebug", false, "Enable Debug Mode");
LoadAssetBundle();
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
private void LoadAssetBundle()
{
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "slotbundle.machine");
AssetBundle val = AssetBundle.LoadFromFile(text);
if ((Object)(object)val == (Object)null)
{
Logger.LogError((object)"Cannot load AssetBundle !");
return;
}
SlotMachinePrefab = val.LoadAsset<GameObject>("machine");
if ((Object)(object)SlotMachinePrefab == (Object)null)
{
Logger.LogError((object)"Prefab 'machine' is unknown in the bundle !");
return;
}
NetworkPrefabs.RegisterNetworkPrefab(SlotMachinePrefab);
Logger.LogInfo((object)"Prefab 'machine' has been loaded and registered with sucess");
}
private 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();
}
}
}
public class GamblingMachineScript : MonoBehaviour
{
[CompilerGenerated]
private sealed class <LoadAudioClips>d__18 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GamblingMachineScript <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAudioClips>d__18(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;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip("spin.mp3", delegate(AudioClip clip)
{
<>4__this.spinClip = clip;
}));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip("win.mp3", delegate(AudioClip clip)
{
<>4__this.jackpotClip = clip;
}));
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip("loose.mp3", delegate(AudioClip clip)
{
<>4__this.looseClip = clip;
}));
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.LoadClip("cancel.mp3", delegate(AudioClip clip)
{
<>4__this.cancelClip = clip;
}));
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadClip>d__19 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public string relativePath;
public Action<AudioClip> onLoaded;
public GamblingMachineScript <>4__this;
private string <path>5__1;
private UnityWebRequest <www>5__2;
private AudioClip <clip>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadClip>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<path>5__1 = null;
<www>5__2 = null;
<clip>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Invalid comparison between Unknown and I4
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Invalid comparison between Unknown and I4
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<path>5__1 = "file://" + Path.Combine(<>4__this.modPath, relativePath);
<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(<path>5__1, (AudioType)13);
<>1__state = -3;
<>2__current = <www>5__2.SendWebRequest();
<>1__state = 1;
return true;
case 1:
<>1__state = -3;
if ((int)<www>5__2.result == 2 || (int)<www>5__2.result == 3)
{
Debug.LogError((object)("Error loading audio: " + <www>5__2.error));
}
else
{
<clip>5__3 = DownloadHandlerAudioClip.GetContent(<www>5__2);
onLoaded?.Invoke(<clip>5__3);
if (<>4__this.debug)
{
Debug.Log((object)("Loaded clip from: " + <path>5__1));
}
<clip>5__3 = null;
}
<>m__Finally1();
<www>5__2 = null;
return false;
}
}
catch
{
//try-fault
((IDisposable)this).Dispose();
throw;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
private void <>m__Finally1()
{
<>1__state = -1;
if (<www>5__2 != null)
{
((IDisposable)<www>5__2).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <NotEnoughMoney>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GamblingMachineScript <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <NotEnoughMoney>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if ((Object)(object)<>4__this.lightComponent != (Object)null)
{
<>4__this.lightComponent.color = Color.red;
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
}
GamblingMachine.Logger.LogWarning((object)"lightComponent not found!");
break;
case 1:
<>1__state = -1;
<>4__this.lightComponent.color = Color.white;
break;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <RotateReel>d__25 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GameObject reel;
public float duration;
public float endRotation;
public GamblingMachineScript <>4__this;
private float <timer>5__1;
private Vector3 <currentRotation>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RotateReel>d__25(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
reel.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
<timer>5__1 = 0f;
break;
case 1:
<>1__state = -1;
break;
}
if (<timer>5__1 < duration)
{
reel.transform.Rotate(Vector3.right * <>4__this.rotationSpeed * Time.deltaTime);
<timer>5__1 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
<currentRotation>5__2 = reel.transform.localEulerAngles;
reel.transform.localEulerAngles = new Vector3(endRotation, <currentRotation>5__2.y, <currentRotation>5__2.z);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SpinRoutine>d__24 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GamblingMachineScript <>4__this;
private bool <isJackpot>5__1;
private float <finalXRotation>5__2;
private int <i>5__3;
private float <targetRotation>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpinRoutine>d__24(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Expected O, but got Unknown
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.isSpinning = true;
<isJackpot>5__1 = Random.value < <>4__this.winrate;
<finalXRotation>5__2 = (<isJackpot>5__1 ? Random.Range(0f, 360f) : 0f);
<i>5__3 = 0;
goto IL_0116;
case 1:
<>1__state = -1;
<i>5__3++;
goto IL_0116;
case 2:
{
<>1__state = -1;
<>4__this.isSpinning = false;
if (<isJackpot>5__1)
{
<>4__this.PlaySound(<>4__this.jackpotClip);
SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() + Mathf.RoundToInt((float)<>4__this.prixMachine * <>4__this.winMulti));
}
else
{
<>4__this.PlaySound(<>4__this.looseClip);
GamblingMachine.Logger.LogWarning((object)"BIG L");
}
return false;
}
IL_0116:
if (<i>5__3 < <>4__this.reels.Length)
{
<targetRotation>5__4 = (<isJackpot>5__1 ? <finalXRotation>5__2 : Random.Range(0f, 360f));
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.RotateReel(<>4__this.reels[<i>5__3], <>4__this.spinTimePerReel, <targetRotation>5__4));
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
}
<>2__current = (object)new WaitForSeconds(<>4__this.spinTimePerReel + 0.5f);
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public GameObject[] reels;
public float spinTimePerReel = 1.5f;
public float rotationSpeed = 720f;
private bool isSpinning = false;
private int prixMachine = GamblingMachine.bet.Value;
private float winrate = GamblingMachine.winrate.Value;
private float winMulti = GamblingMachine.winMultiplicator.Value;
private bool debug = GamblingMachine.debug.Value;
private Light lightComponent;
private AudioClip spinClip;
private AudioClip jackpotClip;
private AudioClip looseClip;
private AudioClip cancelClip;
private string modPath;
private AudioSource audioSource;
private int playerId;
public GameObject machine;
private void Start()
{
modPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.spatialBlend = 1f;
audioSource.volume = 0.5f;
((MonoBehaviour)this).StartCoroutine(LoadAudioClips());
GameObject val = GameObject.Find("Light");
if ((Object)(object)val != (Object)null)
{
lightComponent = val.GetComponent<Light>();
}
else
{
GamblingMachine.Logger.LogWarning((object)"SlotMachineLight not found!");
}
}
[IteratorStateMachine(typeof(<LoadAudioClips>d__18))]
private IEnumerator LoadAudioClips()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAudioClips>d__18(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<LoadClip>d__19))]
private IEnumerator LoadClip(string relativePath, Action<AudioClip> onLoaded)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadClip>d__19(0)
{
<>4__this = this,
relativePath = relativePath,
onLoaded = onLoaded
};
}
public void Spin()
{
if (SemiFunc.StatGetRunCurrency() >= prixMachine && !isSpinning)
{
PlaySound(spinClip);
SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() - prixMachine);
((MonoBehaviour)this).StartCoroutine(SpinRoutine());
}
else
{
PlaySound(cancelClip);
((MonoBehaviour)this).StartCoroutine(NotEnoughMoney());
GamblingMachine.Logger.LogWarning((object)"Not enough money!");
}
}
[IteratorStateMachine(typeof(<NotEnoughMoney>d__21))]
private IEnumerator NotEnoughMoney()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <NotEnoughMoney>d__21(0)
{
<>4__this = this
};
}
public void SetPlayerId(int id)
{
playerId = id;
}
public int GetPlayerId()
{
return playerId;
}
[IteratorStateMachine(typeof(<SpinRoutine>d__24))]
private IEnumerator SpinRoutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpinRoutine>d__24(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<RotateReel>d__25))]
private IEnumerator RotateReel(GameObject reel, float duration, float endRotation)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RotateReel>d__25(0)
{
<>4__this = this,
reel = reel,
duration = duration,
endRotation = endRotation
};
}
private void PlaySound(AudioClip clip)
{
if ((Object)(object)clip != (Object)null)
{
if (audioSource.isPlaying)
{
audioSource.Stop();
}
audioSource.clip = clip;
audioSource.Play();
}
}
}
[HarmonyPatch(typeof(ShopManager), "ShopInitialize")]
public class ShopPatch
{
public int playerId;
private static bool debug = GamblingMachine.debug.Value;
private static void Postfix(ShopManager __instance)
{
//IL_007e: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Expected O, but got Unknown
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Expected O, but got Unknown
//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Expected O, but got Unknown
if ((Object)(object)GamblingMachine.SlotMachinePrefab == (Object)null)
{
if (debug)
{
GamblingMachine.Logger.LogWarning((object)"SlotMachinePrefab is null !");
}
return;
}
GameObject val = GameObject.Find("Shop Magazine Holder");
if ((Object)(object)val == (Object)null)
{
if (debug)
{
GamblingMachine.Logger.LogWarning((object)"Obj named 'Shop Magazine Holder' not found !");
}
return;
}
Transform parent = val.transform.parent;
Vector3 position = val.transform.position;
Quaternion val2 = val.transform.rotation * Quaternion.Euler(0f, 180f, 0f);
GameObject val3 = null;
if (!SemiFunc.IsMultiplayer() || SemiFunc.IsMasterClient())
{
if (SemiFunc.IsMultiplayer())
{
val3 = PhotonNetwork.Instantiate(((Object)GamblingMachine.SlotMachinePrefab).name, position, val2, (byte)0, (object[])null);
SetParent(parent, val3);
val3.transform.localScale = Vector3.one * 16f;
}
else
{
val3 = Object.Instantiate<GameObject>(GamblingMachine.SlotMachinePrefab, position, val2, parent);
}
val3.tag = "Phys Grab Object";
val3.layer = LayerMask.NameToLayer("PhysGrabObject");
GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)3);
((Object)val4).name = "ColliderHolder";
val4.tag = "Grab Area";
val4.layer = LayerMask.NameToLayer("Ignore Raycast");
val4.transform.SetParent(val3.transform);
val4.transform.localPosition = new Vector3(-0.0059814826f, 0.086336486f, 0.009972699f);
val4.transform.localScale = new Vector3(0.07835221f, 0.17263533f, 0.10167895f);
BoxCollider component = val4.GetComponent<BoxCollider>();
component.center = Vector3.zero;
component.size = Vector3.one;
((Collider)component).isTrigger = true;
ApplyTransparentMaterial(val4);
GameObject val5 = new GameObject("Light");
val5.transform.SetParent(val3.transform);
val5.transform.localPosition = new Vector3(0f, 0.0738f, 0.0687f);
Light val6 = val5.AddComponent<Light>();
val6.color = Color.white;
val6.intensity = 1.5f;
GamblingMachineScript gamblingMachineScript = val3.GetComponent<GamblingMachineScript>() ?? val3.AddComponent<GamblingMachineScript>();
StaticGrabObject val7 = val3.GetComponent<StaticGrabObject>() ?? val3.AddComponent<StaticGrabObject>();
val7.colliderTransform = val4.transform;
PhysGrabObjectGrabArea val8 = val3.GetComponent<PhysGrabObjectGrabArea>() ?? val3.AddComponent<PhysGrabObjectGrabArea>();
GrabArea val9 = new GrabArea();
val9.grabAreaTransform = val4.transform;
if (val7.playerGrabbing.Count > 0)
{
int ownerActorNr = val7.playerGrabbing[0].photonView.OwnerActorNr;
gamblingMachineScript.SetPlayerId(ownerActorNr);
}
else if (debug)
{
GamblingMachine.Logger.LogWarning((object)"No players are grabbing the object.");
}
if ((Object)(object)gamblingMachineScript != (Object)null)
{
GameObject[] array = (GameObject[])(object)new GameObject[4];
Transform obj = val3.transform.FindDeepChild("reel 1");
array[0] = ((obj != null) ? ((Component)obj).gameObject : null);
Transform obj2 = val3.transform.FindDeepChild("reel 2");
array[1] = ((obj2 != null) ? ((Component)obj2).gameObject : null);
Transform obj3 = val3.transform.FindDeepChild("reel 3");
array[2] = ((obj3 != null) ? ((Component)obj3).gameObject : null);
Transform obj4 = val3.transform.FindDeepChild("reel 4");
array[3] = ((obj4 != null) ? ((Component)obj4).gameObject : null);
gamblingMachineScript.reels = array;
}
else
{
GamblingMachine.Logger.LogWarning((object)"GamblingMachineScript script not found !");
}
val9.grabAreaEventOnStart.AddListener(new UnityAction(gamblingMachineScript.Spin));
val8.grabAreas.Add(val9);
Object.Destroy((Object)(object)val);
GamblingMachine.Logger.LogInfo((object)"GamblingMachine placed in shop !");
}
else
{
val.SetActive(false);
if (debug)
{
GamblingMachine.Logger.LogInfo((object)"Client non-host : objet désactivé.");
}
}
}
private static void SetParent(Transform parent, GameObject go)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
go.transform.SetParent(parent);
go.transform.localScale = Vector3.one;
}
private static void ApplyTransparentMaterial(GameObject obj)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
Material val = new Material(Shader.Find("Standard"));
val.color = new Color(0f, 0f, 0f, 0f);
val.SetFloat("_Mode", 3f);
val.SetInt("_SrcBlend", 5);
val.SetInt("_DstBlend", 10);
val.SetInt("_ZWrite", 0);
val.DisableKeyword("_ALPHATEST_ON");
val.EnableKeyword("_ALPHABLEND_ON");
val.DisableKeyword("_ALPHAPREMULTIPLY_ON");
val.renderQueue = 3000;
Renderer component = obj.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
component.material = val;
}
}
}
public static class TransformExtensions
{
public static Transform FindDeepChild(this Transform parent, string name)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
foreach (Transform item in parent)
{
Transform val = item;
if (((Object)val).name == name)
{
return val;
}
Transform val2 = val.FindDeepChild(name);
if ((Object)(object)val2 != (Object)null)
{
return val2;
}
}
return null;
}
}
}