Decompiled source of All Monkey Terminal Casino v1.6.3

BRCGambling.dll

Decompiled 3 weeks ago
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.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BombRushMP.Common;
using BombRushMP.Common.Networking;
using BombRushMP.Common.Packets;
using BombRushMP.Mono.Runtime;
using BombRushMP.Plugin;
using BombRushMP.Plugin.Gamemodes;
using CommonAPI;
using CommonAPI.Phone;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reptile;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
using WallPlant;

[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: AssemblyCompany("BRCGambling")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8bea24d85093e52e470ed5e90278ffa2f3717a5e")]
[assembly: AssemblyProduct("BRCGambling")]
[assembly: AssemblyTitle("BRCGambling")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace BRCGambling
{
	public static class PassiveSync
	{
		private const string PACKET_ID = "com.chimp.brcgambling.passive";

		private const string MSG_HELLO = "PH:";

		private const string MSG_STATE = "PS:";

		private static Dictionary<ushort, Dictionary<string, GameObject>> remotePassives = new Dictionary<ushort, Dictionary<string, GameObject>>();

		public static void Init()
		{
			try
			{
				ClientController.RegisterCustomPacketHandler("com.chimp.brcgambling.passive", (Action<ushort, byte[]>)OnPacket);
				ClientController.PlayerDisconnected = (Action<ushort>)Delegate.Combine(ClientController.PlayerDisconnected, new Action<ushort>(OnPlayerDisconnected));
				ClientController.ClientStatesUpdate = (Action)Delegate.Combine(ClientController.ClientStatesUpdate, new Action(OnClientStatesUpdate));
			}
			catch (Exception ex)
			{
				Debug.Log((object)("[PassiveSync] Init failed: " + ex.Message));
			}
		}

		public static void Shutdown()
		{
			ClientController.UnregisterCustomPacketHandler("com.chimp.brcgambling.passive");
			ClientController.PlayerDisconnected = (Action<ushort>)Delegate.Remove(ClientController.PlayerDisconnected, new Action<ushort>(OnPlayerDisconnected));
			ClientController.ClientStatesUpdate = (Action)Delegate.Remove(ClientController.ClientStatesUpdate, new Action(OnClientStatesUpdate));
			ClearAllRemotePassives();
		}

		private static void OnClientStatesUpdate()
		{
			AnnounceState(isHello: true);
		}

		public static void AnnounceState(bool isHello = false)
		{
			ClientController instance = ClientController.Instance;
			if (!((Object)(object)instance == (Object)null))
			{
				string localPassiveIds = GetLocalPassiveIds();
				string text = (isHello ? "PH:" : "PS:");
				instance.BroadcastCustomPacket(Encode(text + localPassiveIds), "com.chimp.brcgambling.passive", (SendModes)2);
			}
		}

		public static void BroadcastStateUpdate()
		{
			AnnounceState();
		}

		private static string GetLocalPassiveIds()
		{
			if (GamblingSaveData.Instance == null)
			{
				return "";
			}
			List<string> list = new List<string>();
			foreach (string equippedEffectId in GamblingSaveData.Instance.EquippedEffectIds)
			{
				EffectDefinition effectDefinition = EffectRegistry.Get(equippedEffectId);
				if (effectDefinition != null && effectDefinition.IsPassive)
				{
					list.Add(equippedEffectId);
				}
			}
			return string.Join(",", list);
		}

		private static void OnPlayerDisconnected(ushort playerId)
		{
			ClearRemotePassives(playerId);
		}

		private static void OnPacket(ushort sender, byte[] data)
		{
			if (sender == (ClientController.Instance?.LocalID ?? 0))
			{
				return;
			}
			string text = Decode(data);
			if (text.StartsWith("PH:"))
			{
				string text2 = text.Substring("PH:".Length);
				string[] ids = (string.IsNullOrEmpty(text2) ? new string[0] : text2.Split(','));
				UpdateRemotePassives(sender, ids);
				ClientController instance = ClientController.Instance;
				if ((Object)(object)instance != (Object)null)
				{
					string localPassiveIds = GetLocalPassiveIds();
					instance.SendCustomPacketToPlayer(Encode("PS:" + localPassiveIds), "com.chimp.brcgambling.passive", sender, (SendModes)2);
				}
			}
			else if (text.StartsWith("PS:"))
			{
				string text3 = text.Substring("PS:".Length);
				string[] ids2 = (string.IsNullOrEmpty(text3) ? new string[0] : text3.Split(','));
				UpdateRemotePassives(sender, ids2);
			}
		}

		private static void UpdateRemotePassives(ushort playerId, string[] ids)
		{
			if (!remotePassives.ContainsKey(playerId))
			{
				remotePassives[playerId] = new Dictionary<string, GameObject>();
			}
			Dictionary<string, GameObject> dictionary = remotePassives[playerId];
			HashSet<string> hashSet = new HashSet<string>(ids);
			List<string> list = new List<string>();
			foreach (KeyValuePair<string, GameObject> item in dictionary)
			{
				if (!hashSet.Contains(item.Key))
				{
					if ((Object)(object)item.Value != (Object)null)
					{
						Object.Destroy((Object)(object)item.Value);
					}
					list.Add(item.Key);
				}
			}
			foreach (string item2 in list)
			{
				dictionary.Remove(item2);
			}
			foreach (string text in ids)
			{
				if (!string.IsNullOrEmpty(text) && !dictionary.ContainsKey(text))
				{
					SpawnRemotePassive(playerId, text);
				}
			}
		}

		private static void SpawnRemotePassive(ushort playerId, string effectId)
		{
			if (!GamblingPlugin.ShowOtherPlayerCrowns.Value)
			{
				return;
			}
			EffectDefinition effectDefinition = EffectRegistry.Get(effectId);
			if (effectDefinition == null)
			{
				return;
			}
			ClientController instance = ClientController.Instance;
			if (!((Object)(object)instance == (Object)null) && instance.Players.TryGetValue(playerId, out var value))
			{
				if ((Object)(object)value.Player == (Object)null)
				{
					((MonoBehaviour)GamblingPlugin.Instance).StartCoroutine(RetrySpawnRemotePassive(playerId, effectId));
				}
				else
				{
					SpawnPassiveOnPlayer(playerId, effectId, ((Component)value.Player).transform);
				}
			}
		}

		private static IEnumerator RetrySpawnRemotePassive(ushort playerId, string effectId)
		{
			float timeout = 10f;
			float elapsed = 0f;
			while (elapsed < timeout)
			{
				yield return (object)new WaitForSeconds(0.5f);
				elapsed += 0.5f;
				ClientController cc = ClientController.Instance;
				if ((Object)(object)cc == (Object)null || (remotePassives.ContainsKey(playerId) && remotePassives[playerId].ContainsKey(effectId)) || !cc.Players.TryGetValue(playerId, out var mpPlayer))
				{
					break;
				}
				if ((Object)(object)mpPlayer.Player == (Object)null)
				{
					continue;
				}
				SpawnPassiveOnPlayer(playerId, effectId, ((Component)mpPlayer.Player).transform);
				break;
			}
		}

		private static void SpawnPassiveOnPlayer(ushort playerId, string effectId, Transform parent)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			EffectDefinition effectDefinition = EffectRegistry.Get(effectId);
			if (effectDefinition != null && GamblingPlugin.CachedPrefabs.TryGetValue(effectDefinition.PrefabName, out GameObject value))
			{
				GameObject val = Object.Instantiate<GameObject>(value, parent);
				val.transform.localPosition = new Vector3(0f, GamblingPlugin.CrownHeightOffset.Value, 0f);
				val.transform.localRotation = Quaternion.Euler(GamblingPlugin.CrownRotationX.Value, GamblingPlugin.CrownRotationY.Value, 0f);
				ApplyPassiveColor(effectId, val);
				if (!remotePassives.ContainsKey(playerId))
				{
					remotePassives[playerId] = new Dictionary<string, GameObject>();
				}
				remotePassives[playerId][effectId] = val;
			}
		}

		public static void ApplyPassiveColor(string effectId, GameObject obj)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			if (effectId == "special_badge")
			{
				return;
			}
			Color crownColor = GamblingPlugin.GetCrownColor();
			string value;
			switch (effectId)
			{
			default:
				return;
			case "mythic_crown":
				value = "CrownMat";
				break;
			case "special_bday_hat":
				value = "BDAY_Mat";
				break;
			case "special_glasses":
				value = "Glass";
				break;
			}
			Renderer[] componentsInChildren = obj.GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				Material[] materials = val.materials;
				foreach (Material val2 in materials)
				{
					if (((Object)val2).name.Contains(value))
					{
						val2.color = crownColor;
					}
				}
			}
		}

		public static void RefreshRemotePassives()
		{
			if (!GamblingPlugin.ShowOtherPlayerCrowns.Value)
			{
				ClearAllRemotePassives();
			}
			else
			{
				AnnounceState(isHello: true);
			}
		}

		private static void ClearRemotePassives(ushort playerId)
		{
			if (!remotePassives.ContainsKey(playerId))
			{
				return;
			}
			foreach (KeyValuePair<string, GameObject> item in remotePassives[playerId])
			{
				if ((Object)(object)item.Value != (Object)null)
				{
					Object.Destroy((Object)(object)item.Value);
				}
			}
			remotePassives.Remove(playerId);
		}

		private static void ClearAllRemotePassives()
		{
			foreach (KeyValuePair<ushort, Dictionary<string, GameObject>> remotePassife in remotePassives)
			{
				foreach (KeyValuePair<string, GameObject> item in remotePassife.Value)
				{
					if ((Object)(object)item.Value != (Object)null)
					{
						Object.Destroy((Object)(object)item.Value);
					}
				}
			}
			remotePassives.Clear();
		}

		private static byte[] Encode(string msg)
		{
			using MemoryStream memoryStream = new MemoryStream();
			using BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
			binaryWriter.Write(msg);
			return memoryStream.ToArray();
		}

		private static string Decode(byte[] data)
		{
			using MemoryStream input = new MemoryStream(data);
			using BinaryReader binaryReader = new BinaryReader(input);
			return binaryReader.ReadString();
		}
	}
	public enum EffectTrigger
	{
		Looping,
		OnSpray,
		OnSprayAttempt,
		OnJump,
		OnLand,
		OnWallPlant,
		OnBoostTrick,
		OnSlide,
		OnGraceEnd,
		OnGraceStart,
		OnGraceStartLooping,
		OnDeath,
		OnEmote,
		OnGrind,
		OnGrindLooping,
		OnManual,
		OnBoost,
		OnBoostLooping,
		OnComboBank
	}
	public enum EffectPosition
	{
		Feet,
		Torso,
		AboveHead
	}
	public class EffectDefinition
	{
		public string Id;

		public string DisplayName;

		public string PrefabName;

		public RewardTier Rarity;

		public EffectPosition Position;

		public EffectTrigger Trigger;

		public Vector3 PositionOffset = Vector3.zero;

		public bool IsPassive = false;

		public bool IsNew = false;

		public EffectDefinition(string id, string displayName, string prefabName, RewardTier rarity, EffectPosition position, EffectTrigger trigger, Vector3 offset = default(Vector3))
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			Id = id;
			DisplayName = displayName;
			PrefabName = prefabName;
			Rarity = rarity;
			Position = position;
			Trigger = trigger;
			PositionOffset = offset;
		}
	}
	public static class EffectRegistry
	{
		public static readonly Dictionary<string, EffectDefinition> All = new Dictionary<string, EffectDefinition>();

		public static void Register(EffectDefinition def)
		{
			All[def.Id] = def;
		}

		public static void RegisterNew(EffectDefinition def)
		{
			def.IsNew = true;
			Register(def);
		}

		public static EffectDefinition Get(string id)
		{
			EffectDefinition value;
			return All.TryGetValue(id, out value) ? value : null;
		}

		public static List<EffectDefinition> GetPool(RewardTier rarity)
		{
			List<EffectDefinition> list = new List<EffectDefinition>();
			foreach (EffectDefinition value in All.Values)
			{
				if (value.Rarity == rarity)
				{
					list.Add(value);
				}
			}
			return list;
		}

		public static void InitializeDefaults()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0063: 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_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_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: 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)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			//IL_0269: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0418: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0440: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0495: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_057a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_063e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0644: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Unknown result type (might be due to invalid IL or missing references)
			//IL_068c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06da: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0701: Unknown result type (might be due to invalid IL or missing references)
			//IL_0707: Unknown result type (might be due to invalid IL or missing references)
			//IL_0728: Unknown result type (might be due to invalid IL or missing references)
			//IL_072e: Unknown result type (might be due to invalid IL or missing references)
			//IL_074f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0755: Unknown result type (might be due to invalid IL or missing references)
			//IL_0776: Unknown result type (might be due to invalid IL or missing references)
			//IL_077c: Unknown result type (might be due to invalid IL or missing references)
			//IL_079e: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0813: Unknown result type (might be due to invalid IL or missing references)
			//IL_0819: Unknown result type (might be due to invalid IL or missing references)
			//IL_083a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0840: Unknown result type (might be due to invalid IL or missing references)
			//IL_0861: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Unknown result type (might be due to invalid IL or missing references)
			//IL_0888: Unknown result type (might be due to invalid IL or missing references)
			//IL_088e: Unknown result type (might be due to invalid IL or missing references)
			//IL_08af: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0903: Unknown result type (might be due to invalid IL or missing references)
			//IL_0924: Unknown result type (might be due to invalid IL or missing references)
			//IL_092a: Unknown result type (might be due to invalid IL or missing references)
			//IL_094b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0951: Unknown result type (might be due to invalid IL or missing references)
			//IL_0972: Unknown result type (might be due to invalid IL or missing references)
			//IL_0978: Unknown result type (might be due to invalid IL or missing references)
			//IL_0999: Unknown result type (might be due to invalid IL or missing references)
			//IL_099f: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b48: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b4e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b70: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b76: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b97: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c35: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c5c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c62: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c83: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c89: Unknown result type (might be due to invalid IL or missing references)
			//IL_0caa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cb0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cfe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d74: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dbc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dc2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e0a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e10: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e31: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e37: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e59: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e5f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e80: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e86: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ea7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ead: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ece: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ed4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f44: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f4a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f71: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f9b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fa1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fcb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ffb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1001: Unknown result type (might be due to invalid IL or missing references)
			Register(new EffectDefinition("common_skull_head", "Skull Head", "CFXR2 Skull Head Alt 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.Looping));
			Register(new EffectDefinition("common_ground_hit", "Ground Hit", "CFXR2 Ground Hit 1", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnLand));
			Register(new EffectDefinition("common_bubble_breath", "Bubble Breath", "CFXR4 Bubbles Breath Underwater Loop 1", RewardTier.Common, EffectPosition.Feet, EffectTrigger.Looping));
			Register(new EffectDefinition("common_flash", "Flash", "CFXR Flash 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("common_magic_poof", "Magic Poof", "CFXR Magic Poof 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("common_smoke_source", "Smoke Source", "CFXR Smoke Source 3D 1", RewardTier.Common, EffectPosition.Feet, EffectTrigger.Looping));
			Register(new EffectDefinition("common_poison_cloud", "Poison Cloud", "CFXR2 Poison Cloud 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.Looping));
			Register(new EffectDefinition("common_ambient_glows", "Ambient Glows", "CFXR3 Ambient Glows 1", RewardTier.Common, EffectPosition.Feet, EffectTrigger.Looping));
			Register(new EffectDefinition("common_wallplant_smoke", "Smoke Hit", "CFXR3 Hit Misc F Smoke 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnWallPlant));
			RegisterNew(new EffectDefinition("common_debuff", "Debuff", "NEW - Debuff", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnGrindLooping));
			RegisterNew(new EffectDefinition("common_lightning_aura", "Lightning Aura", "NEW - Lightning aura", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnGraceStartLooping));
			RegisterNew(new EffectDefinition("common_electro_hit", "Electro Hit", "NEW - Electro hit", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("common_explosion", "Explosion", "NEW - Explosion", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnBoost));
			RegisterNew(new EffectDefinition("common_green_hit", "Green Hit", "NEW - Green hit", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("common_holy_hit", "Holy Hit", "NEW - Holy hit", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnBoost));
			RegisterNew(new EffectDefinition("common_love_hit", "Love Hit", "NEW - Love hit", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnGrind));
			RegisterNew(new EffectDefinition("common_star_hit", "Star Hit", "NEW - Star hit", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnGrind));
			RegisterNew(new EffectDefinition("common_snow_hit", "Snow Hit", "NEW - Snow hit", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnManual));
			RegisterNew(new EffectDefinition("common_stones_hit", "Stones Hit", "NEW - Stones hit", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnManual));
			RegisterNew(new EffectDefinition("common_electro_slash", "Electro Slash", "NEW - Electro slash", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("common_snow_slash", "Snow Slash", "NEW - Snow slash", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("common_stone_slash", "Stone Slash", "NEW - Stone slash", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("common_sparks_blue", "Blue Sparks", "NEW - Sparks blue", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnGrindLooping));
			RegisterNew(new EffectDefinition("common_sparks_pink", "Pink Sparks", "NEW - Sparks pink", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnGrindLooping));
			RegisterNew(new EffectDefinition("common_sparks_green", "Green Sparks", "NEW - Sparks green", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnGrindLooping));
			RegisterNew(new EffectDefinition("common_sparks_explode_blue", "Blue Spark Burst", "NEW - Sparks explode blue", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnBoost));
			RegisterNew(new EffectDefinition("common_sparks_explode_green", "Green Spark Burst", "NEW - Sparks explode green", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnBoost));
			RegisterNew(new EffectDefinition("common_sparks_explode_pink", "Pink Spark Burst", "NEW - Sparks explode pink", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnEmote));
			RegisterNew(new EffectDefinition("common_sparks_explode_red", "Red Spark Burst", "NEW - Sparks explode red", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("common_sparks_explode_white", "White Spark Burst", "NEW - Sparks explode white", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnComboBank));
			RegisterNew(new EffectDefinition("common_sparks_explode_yellow", "Yellow Spark Burst", "NEW - Sparks explode yellow", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnEmote));
			Register(new EffectDefinition("rare_fire_hit", "Fire Hit", "CFXR3 Hit Fire B (Air) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_sun", "Sun", "CFXR4 Sun 1", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.Looping));
			Register(new EffectDefinition("rare_electric_hit", "Electric Hit", "CFXR3 Hit Electric C (Air) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_explosion", "Explosion", "CFXR Explosion Smoke 2 Solo (HDR) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnGraceEnd));
			Register(new EffectDefinition("rare_firework_shoot", "Firework Shoot", "CFXR4 Firework HDR Shoot Single (Random Color) 1", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_water_splash", "Water Splash", "CFXR Water Splash (Smaller) 1", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.OnLand));
			Register(new EffectDefinition("rare_broken_heart", "Broken Heart", "CFXR2 Broken Heart 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnDeath));
			Register(new EffectDefinition("rare_smoke_hit", "Smoke Hit", "CFXR3 Hit Misc A 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_rain_fall", "Rain Fall", "CFXR4 Rain Falling 1", RewardTier.Rare, EffectPosition.AboveHead, EffectTrigger.Looping));
			Register(new EffectDefinition("rare_ice_trail_wide", "Ice Trail (Wide)", "CFXR4 Sword Trail ICE (360 Thin Spiral) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_ice_trail_small", "Ice Trail (Small)", "CFXR4 Sword Trail ICE (360 Spiral) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_ice_hit", "Ice Hit", "CFXR4 Sword Hit ICE (Cross) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_fire_trail_wide", "Fire Trail (Wide)", "CFXR4 Sword Trail FIRE (360 Thin Spiral) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_fire_trail_small", "Fire Trail (Small)", "CFXR4 Sword Trail FIRE (360 Spiral) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("rare_fire_sword_hit", "Fire Hit (Sword)", "CFXR4 Sword Hit FIRE (Cross) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("rare_aoe_slash_blue", "Blue AoE Slash", "NEW - AoE slash blue", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("rare_aoe_slash_green", "Green AoE Slash", "NEW - AoE slash green", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("rare_aoe_slash_orange", "Orange AoE Slash", "NEW - AoE slash orange", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray));
			RegisterNew(new EffectDefinition("rare_healing", "Healing", "NEW - Healing", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.OnBoostLooping));
			RegisterNew(new EffectDefinition("rare_magic_shield_blue", "Blue Magic Shield", "NEW - Magic shield blue", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.OnSlide));
			RegisterNew(new EffectDefinition("rare_magic_shield_yellow", "Yellow Magic Shield", "NEW - Magic shield yellow", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.OnSlide));
			RegisterNew(new EffectDefinition("rare_magic_shield_pink", "Pink Magic Shield", "NEW - Magic shield pink", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.OnSlide));
			RegisterNew(new EffectDefinition("rare_charge_slash_blue", "Blue Charge Slash", "NEW - Charge slash blue", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnBoostTrick));
			RegisterNew(new EffectDefinition("rare_charge_slash_purple", "Purple Charge Slash", "NEW - Charge slash purple", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnBoostTrick));
			RegisterNew(new EffectDefinition("rare_charge_slash_red", "Red Charge Slash", "NEW - Charge slash red", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnBoostTrick));
			Register(new EffectDefinition("epic_big_explosion_smoke", "Big Explosion Smoke", "CFXR Explosion 2", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnGraceEnd));
			Register(new EffectDefinition("epic_fire_explosion", "Fire Explosion", "CFXR3 Fire Explosion B 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("epic_firework", "Firework", "CFXR4 Firework 1 Cyan-Purple (HDR) 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("epic_hit_ice", "Hit Ice", "CFXR3 Hit Ice B (Air) 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnBoostTrick));
			Register(new EffectDefinition("epic_falling_stars", "Falling Stars", "CFXR4 Falling Stars 1", RewardTier.Epic, EffectPosition.AboveHead, EffectTrigger.Looping));
			Register(new EffectDefinition("epic_cartoon_fight", "Cartoon Fight", "CFXR2 Cartoon Fight (Loop) 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("epic_word_wow", "WOW", "CFXR3 _WOW_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnBoostTrick));
			Register(new EffectDefinition("epic_word_wham", "WHAM", "CFXR2 _WHAM_ 4", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnBoostTrick));
			Register(new EffectDefinition("epic_word_cursed", "CURSED", "CFXR2 _CURSED_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("epic_word_slash", "SLASH", "CFXR _SLASH_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("epic_word_pow", "POW", "CFXR _POW_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnWallPlant));
			Register(new EffectDefinition("epic_word_boom", "BOOM", "CFXR _BOOM_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnGraceEnd));
			Register(new EffectDefinition("epic_word_boing", "BOING", "CFXR _BOING_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnJump));
			Register(new EffectDefinition("epic_hit_leaves", "Hit Leaves", "CFXR3 Hit Leaves A (Lit) 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("epic_water_ripples", "Water Ripples", "CFXR Water Ripples 1", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnLand));
			RegisterNew(new EffectDefinition("epic_laser_aoe", "Laser AoE", "NEW - Laser AOE", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnGraceStartLooping));
			RegisterNew(new EffectDefinition("epic_plexus_aoe", "Plexus AoE", "NEW - Plexus AoE", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnBoostTrick));
			RegisterNew(new EffectDefinition("epic_red_energy_explosion", "Red Energy Explosion", "NEW - Red energy explosion", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnComboBank));
			RegisterNew(new EffectDefinition("epic_love_aura", "Love Aura", "NEW - Love aura", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnBoostLooping));
			RegisterNew(new EffectDefinition("epic_portal_blue", "Blue Portal", "NEW - Portal blue", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnGraceEnd));
			RegisterNew(new EffectDefinition("epic_portal_green", "Green Portal", "NEW - Portal green", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnGraceEnd));
			RegisterNew(new EffectDefinition("epic_portal_red", "Red Portal", "NEW - Portal red", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnGraceStartLooping));
			RegisterNew(new EffectDefinition("epic_portal_yellow", "Yellow Portal", "NEW - Portal yellow", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnGraceStartLooping));
			Register(new EffectDefinition("legendary_fire", "Fire", "CFXR Fire 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping));
			Register(new EffectDefinition("legendary_souls_escape", "Souls Escape", "CFXR2 Souls Escape 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping));
			Register(new EffectDefinition("legendary_purple_explosion", "Purple Explosion", "CFXR2 WW Enemy Explosion 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnGraceEnd));
			Register(new EffectDefinition("legendary_electrified", "Electrified", "CFXR Electrified 4", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping));
			Register(new EffectDefinition("legendary_cartoon_explosion", "Explosion", "CFXR2 WW Explosion 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.OnGraceEnd));
			Register(new EffectDefinition("legendary_yellow_hit", "Yellow Hit", "CFXR Hit D 3D (Yellow) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnBoostTrick));
			Register(new EffectDefinition("legendary_glowing_impact", "Glowing Impact", "CFXR Impact Glowing HDR (Blue) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnEmote));
			Register(new EffectDefinition("legendary_hit_light", "Hit Light", "CFXR3 Hit Light B (Air) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnSpray));
			Register(new EffectDefinition("legendary_light_glow", "Light Glow", "CFXR3 LightGlow A (Loop) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping));
			Register(new EffectDefinition("legendary_magic_aura", "Magic Aura", "CFXR3 Magic Aura A (Runic) 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping));
			Register(new EffectDefinition("legendary_shiny_aura", "Shiny Aura", "CFXR2 Shiny Item (Loop) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping));
			Register(new EffectDefinition("legendary_leaves_shield", "Leaves Shield", "CFXR3 Shield Leaves A (Lit) 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping));
			Register(new EffectDefinition("legendary_bouncing_glow_bubble", "Bouncing Glow Bubble", "CFXR4 Bouncing Glows Bubble (Blue Purple) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping));
			Register(new EffectDefinition("legendary_fire_breath", "Fire Breath", "CFXR Fire Breath 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping));
			RegisterNew(new EffectDefinition("legendary_buff", "Buff", "NEW - Buff", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.OnBoostLooping));
			RegisterNew(new EffectDefinition("legendary_plexus", "Plexus", "NEW - Plexus", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping));
			RegisterNew(new EffectDefinition("legendary_star_aura", "Star Aura", "NEW - Star aura", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping));
			RegisterNew(new EffectDefinition("legendary_freeze_circle", "Freeze Circle", "NEW - Freeze circle", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.OnSprayAttempt));
			RegisterNew(new EffectDefinition("legendary_healing_circle", "Healing Circle", "NEW - Healing circle", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.OnSprayAttempt));
			RegisterNew(new EffectDefinition("legendary_magic_circle", "Magic Circle", "NEW - Magic circle", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.OnEmote));
			RegisterNew(new EffectDefinition("legendary_magic_circle_2", "Magic Circle 2", "NEW - Magic circle 2", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.OnSprayAttempt));
			EffectDefinition effectDefinition = new EffectDefinition("mythic_crown", "Mythic Crown", "MythicCrown", RewardTier.Mythic, EffectPosition.AboveHead, EffectTrigger.Looping);
			effectDefinition.IsPassive = true;
			Register(effectDefinition);
			EffectDefinition effectDefinition2 = new EffectDefinition("special_bday_hat", "Birthday Hat", "BDAY", RewardTier.Special, EffectPosition.AboveHead, EffectTrigger.Looping);
			effectDefinition2.IsPassive = true;
			Register(effectDefinition2);
			EffectDefinition effectDefinition3 = new EffectDefinition("special_badge", "AMT Badge", "AMT_Badge", RewardTier.Special, EffectPosition.Torso, EffectTrigger.Looping);
			effectDefinition3.IsPassive = true;
			Register(effectDefinition3);
			EffectDefinition effectDefinition4 = new EffectDefinition("special_glasses", "Glasses", "glasses", RewardTier.Special, EffectPosition.AboveHead, EffectTrigger.Looping);
			effectDefinition4.IsPassive = true;
			Register(effectDefinition4);
		}
	}
	public class GamblingSaveData : CustomSaveData
	{
		public bool HasReceivedStartingRep = false;

		public int Rep = 0;

		public List<string> OwnedEffectIds = new List<string>();

		public List<string> EquippedEffectIds = new List<string>();

		public const int MaxEquipped = 5;

		public int TotalCasesOpened = 0;

		public long TotalRepEarned = 0L;

		public long TotalRepSpent = 0L;

		public float BiggestComboScore = 0f;

		public int GraceWins = 0;

		public int GraceLosses = 0;

		public int WagerWins = 0;

		public int WagerLosses = 0;

		public int BiggestWagerWon = 0;

		public int RarestItemRank = 0;

		public string RarestItemName = "";

		public string RarestItemRarity = "";

		public int BlackjackLosses = 0;

		public long BlackjackNetRep = 0L;

		private bool isDirty = false;

		public static GamblingSaveData Instance { get; private set; }

		public bool IsEquipped(string effectId)
		{
			return EquippedEffectIds.Contains(effectId);
		}

		public GamblingSaveData()
			: base("BRCGambling", "gambling_save_{0}.dat")
		{
			Instance = this;
		}

		public static void Register()
		{
			new GamblingSaveData();
		}

		public override void Initialize()
		{
			if (!HasReceivedStartingRep)
			{
				Rep = 500;
				HasReceivedStartingRep = true;
				((CustomSaveData)this).Save();
			}
		}

		public override void Read(BinaryReader reader)
		{
			Rep = reader.ReadInt32();
			int num = reader.ReadInt32();
			OwnedEffectIds = new List<string>();
			for (int i = 0; i < num; i++)
			{
				OwnedEffectIds.Add(reader.ReadString());
			}
			int num2 = reader.ReadInt32();
			EquippedEffectIds = new List<string>();
			for (int j = 0; j < num2; j++)
			{
				EquippedEffectIds.Add(reader.ReadString());
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				HasReceivedStartingRep = reader.ReadBoolean();
			}
			else
			{
				HasReceivedStartingRep = true;
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				TotalCasesOpened = reader.ReadInt32();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				TotalRepEarned = reader.ReadInt64();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				TotalRepSpent = reader.ReadInt64();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				BiggestComboScore = reader.ReadSingle();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				GraceWins = reader.ReadInt32();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				GraceLosses = reader.ReadInt32();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				WagerWins = reader.ReadInt32();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				WagerLosses = reader.ReadInt32();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				BiggestWagerWon = reader.ReadInt32();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				RarestItemRank = reader.ReadInt32();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				RarestItemName = reader.ReadString();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				RarestItemRarity = reader.ReadString();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				BlackjackLosses = reader.ReadInt32();
			}
			if (reader.BaseStream.Position < reader.BaseStream.Length)
			{
				BlackjackNetRep = reader.ReadInt64();
			}
		}

		public override void Write(BinaryWriter writer)
		{
			writer.Write(Rep);
			writer.Write(OwnedEffectIds.Count);
			foreach (string ownedEffectId in OwnedEffectIds)
			{
				writer.Write(ownedEffectId);
			}
			writer.Write(EquippedEffectIds.Count);
			foreach (string equippedEffectId in EquippedEffectIds)
			{
				writer.Write(equippedEffectId);
			}
			writer.Write(HasReceivedStartingRep);
			writer.Write(TotalCasesOpened);
			writer.Write(TotalRepEarned);
			writer.Write(TotalRepSpent);
			writer.Write(BiggestComboScore);
			writer.Write(GraceWins);
			writer.Write(GraceLosses);
			writer.Write(WagerWins);
			writer.Write(WagerLosses);
			writer.Write(BiggestWagerWon);
			writer.Write(RarestItemRank);
			writer.Write(RarestItemName);
			writer.Write(RarestItemRarity);
			writer.Write(BlackjackLosses);
			writer.Write(BlackjackNetRep);
		}

		public void TrackRarestItem(EffectDefinition def)
		{
			int rarityRank = GetRarityRank(def.Rarity);
			if (rarityRank > RarestItemRank)
			{
				RarestItemRank = rarityRank;
				RarestItemName = def.DisplayName;
				RarestItemRarity = def.Rarity.ToString();
			}
		}

		public static int GetRarityRank(RewardTier rarity)
		{
			return rarity switch
			{
				RewardTier.Common => 1, 
				RewardTier.Rare => 2, 
				RewardTier.Epic => 3, 
				RewardTier.Legendary => 4, 
				RewardTier.Mythic => 5, 
				RewardTier.Special => 6, 
				_ => 0, 
			};
		}

		public void AddEffect(string effectId)
		{
			if (!OwnedEffectIds.Contains(effectId))
			{
				OwnedEffectIds.Add(effectId);
				EffectDefinition effectDefinition = EffectRegistry.Get(effectId);
				if (effectDefinition != null)
				{
					TrackRarestItem(effectDefinition);
				}
			}
			MarkDirty();
			((CustomSaveData)this).Save();
		}

		public bool TryEquip(string effectId)
		{
			if (IsEquipped(effectId))
			{
				return true;
			}
			bool flag = EffectRegistry.Get(effectId)?.IsPassive ?? false;
			if (!flag)
			{
				int num = (from id in EquippedEffectIds
					select EffectRegistry.Get(id) into d
					where d != null && !d.IsPassive
					select d).Count();
				if (num >= 5)
				{
					return false;
				}
			}
			EquippedEffectIds.Add(effectId);
			((CustomSaveData)this).Save();
			EffectTriggerManager.RefreshLoopingEffects();
			if (flag)
			{
				PassiveSync.BroadcastStateUpdate();
			}
			return true;
		}

		public void Unequip(string effectId)
		{
			bool flag = EffectRegistry.Get(effectId)?.IsPassive ?? false;
			EquippedEffectIds.Remove(effectId);
			((CustomSaveData)this).Save();
			EffectTriggerManager.RefreshLoopingEffects();
			if (flag)
			{
				PassiveSync.BroadcastStateUpdate();
			}
		}

		public void RemoveEffect(string effectId)
		{
			bool flag = EffectRegistry.Get(effectId)?.IsPassive ?? false;
			bool flag2 = IsEquipped(effectId);
			OwnedEffectIds.Remove(effectId);
			EquippedEffectIds.Remove(effectId);
			((CustomSaveData)this).Save();
			EffectTriggerManager.RefreshLoopingEffects();
			if (flag && flag2)
			{
				PassiveSync.BroadcastStateUpdate();
			}
		}

		public void MarkDirty()
		{
			isDirty = true;
		}

		public void SaveIfDirty()
		{
			if (isDirty)
			{
				isDirty = false;
				((CustomSaveData)this).Save();
			}
		}
	}
	public class AppCaseOpening : CustomApp
	{
		public override void OnAppInit()
		{
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateTitleBar("Opening...", (Sprite)null, 80f);
		}
	}
	public class AppGambling : CustomApp
	{
		private enum AppScreen
		{
			MainMenu,
			CaseOpening,
			Inventory,
			ItemConfirm,
			Result,
			BlackjackBet,
			BlackjackGame,
			BlackjackResult,
			WagerMain,
			WagerLobby,
			Stats
		}

		private PhoneButton repDisplayButton;

		public static AppGambling Instance;

		private BlackjackGame currentBlackjackGame;

		private BlackjackOverlay currentBlackjackOverlay;

		private int savedInventoryIndex = 0;

		private int savedBlackjackBetIndex = 0;

		private int savedWagerLobbyIndex = 0;

		private int currentBet = 60;

		private const int BetIncrement = 20;

		private const int MinBet = 60;

		private const int MaxBet = 50000;

		private bool blackjackAnimating = false;

		private bool quickOpenEnabled = false;

		private AppScreen currentScreen = AppScreen.MainMenu;

		private EffectDefinition currentConfirmDef;

		private const string COLOR_HEADER = "#1A1A4E";

		private const string COLOR_DIVIDER = "#2A2A6E";

		private const string COLOR_REP = "#FFD700";

		private const string COLOR_POSITIVE = "#44FF44";

		private const string COLOR_NEGATIVE = "#FF4444";

		private const string COLOR_WAGER = "#FF8800";

		private const string COLOR_CASE = "#88CCFF";

		private const string COLOR_INVENTORY = "#CC44FF";

		private const string COLOR_BLACKJACK = "#44FF44";

		private const string COLOR_DESC = "#888888";

		private const string COLOR_REDEEM = "#FFD700";

		public static void Initialize()
		{
			PhoneAPI.RegisterApp<AppGambling>("Gambling!", GamblingPlugin.AppIcon);
		}

		public override void OnAppInit()
		{
			Instance = this;
			((CustomApp)this).OnAppInit();
			((CustomApp)this).CreateTitleBar("Monkey Casino", GamblingPlugin.AppIcon, 80f);
			base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f);
			WagerSync.OnLobbyUpdated = delegate
			{
				if (currentScreen == AppScreen.WagerLobby)
				{
					ShowWagerLobby();
				}
				else if (currentScreen == AppScreen.WagerMain)
				{
					ShowWagerMain();
				}
			};
			WagerSync.OnKicked = delegate
			{
				currentScreen = AppScreen.WagerMain;
				base.ScrollView.RemoveAllButtons();
				SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
				((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
				{
					ShowMainMenu();
				});
				base.ScrollView.AddButton((PhoneButton)(object)val);
				AddHeader("Wager Race");
				AddDescription("You were kicked from the wager lobby.");
				AddDescription("Host a new lobby or join another one.");
			};
			WagerSync.OnResolve = delegate(ushort winnerId, int matched, string winnerName)
			{
				ShowWagerResult(winnerId, matched, winnerName);
			};
			ShowMainMenu();
		}

		private void AddHeader(string text)
		{
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("<color=#1A1A4E>── " + text + " ──</color>");
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		private void AddDivider(string text)
		{
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("<color=#2A2A6E>── " + text + " ──</color>");
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		private void AddDescription(string text)
		{
			//IL_0051: 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)
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("<color=#888888>" + text + "</color>");
			TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren<TextMeshProUGUI>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				((TMP_Text)componentInChildren).enableWordWrapping = true;
				((TMP_Text)componentInChildren).ForceMeshUpdate(false, false);
				RectTransform component = ((Component)val).GetComponent<RectTransform>();
				if ((Object)(object)component != (Object)null)
				{
					component.sizeDelta = new Vector2(component.sizeDelta.x, ((TMP_Text)componentInChildren).preferredHeight + 16f);
				}
			}
			base.ScrollView.AddButton((PhoneButton)(object)val);
		}

		private void RestoreIndex(int index)
		{
			base.ScrollView.SelectedIndex = Mathf.Clamp(index, 0, base.ScrollView.Buttons.Count - 1);
			base.ScrollView.UpdateButtons();
		}

		private void ShowMainMenu()
		{
			currentScreen = AppScreen.MainMenu;
			base.ScrollView.RemoveAllButtons();
			int num = GamblingManager.Rep / GamblingManager.SpinCost;
			repDisplayButton = (PhoneButton)(object)PhoneUIUtility.CreateSimpleButton(string.Format("<color={0}>REP: {1} ({2} cases)</color>", "#FFD700", GamblingManager.Rep, num));
			base.ScrollView.AddButton(repDisplayButton);
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("<color=#88CCFF>Open Spray Case</color>");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowCaseOpening();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton("<color=#CC44FF>Inventory</color>");
			((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate
			{
				ShowInventory();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val2);
			SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("<color=#44FF44>Blackjack</color>");
			((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate
			{
				ShowBlackjackBet();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val3);
			SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("<color=#FF8800>Wager Race</color>");
			((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate
			{
				ShowWagerMain();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val4);
			SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("<color=#FFD700>Redeem Code</color>");
			((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate
			{
				TextInput.Instance.ShowOkCancel((Action<string>)delegate(string text)
				{
					((MonoBehaviour)this).StartCoroutine(RedeemCodeCoroutine(text.Trim()));
				}, (Action<string>)delegate
				{
				}, (Func<string, bool>)((string text) => text.Length > 0), "Enter your redemption code.", 30, "AMT-XXXXX-XXXXX", "");
			});
			base.ScrollView.AddButton((PhoneButton)(object)val5);
			SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("<color=#888888>Stats</color>");
			((PhoneButton)val6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val6).OnConfirm, (Action)delegate
			{
				ShowStats();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val6);
		}

		private void ShowCaseOpening()
		{
			currentScreen = AppScreen.CaseOpening;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowMainMenu();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			AddHeader("Open Spray Case");
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton(quickOpenEnabled ? "<color=#44FF44>Quick Open: ON</color>" : "<color=#888888>Quick Open: OFF</color>");
			((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate
			{
				int selectedIndex = base.ScrollView.SelectedIndex;
				quickOpenEnabled = !quickOpenEnabled;
				ShowCaseOpening();
				RestoreIndex(selectedIndex);
			});
			base.ScrollView.AddButton((PhoneButton)(object)val2);
			SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton($"A case costs {GamblingManager.SpinCost} REP");
			base.ScrollView.AddButton((PhoneButton)(object)val3);
			if (GamblingManager.Rep >= GamblingManager.SpinCost)
			{
				if (quickOpenEnabled)
				{
					SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton(string.Format("<color={0}>Open Case ({1} REP)</color>", "#88CCFF", GamblingManager.SpinCost));
					((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate
					{
						if (GamblingManager.Rep >= GamblingManager.SpinCost)
						{
							GamblingManager.Rep -= GamblingManager.SpinCost;
							base.ScrollView.RemoveAllButtons();
							SimplePhoneButton val10 = PhoneUIUtility.CreateSimpleButton("Opening...");
							base.ScrollView.AddButton((PhoneButton)(object)val10);
							((MonoBehaviour)this).StartCoroutine(LaunchOverlay(fast: true));
						}
					});
					base.ScrollView.AddButton((PhoneButton)(object)val4);
				}
				else
				{
					SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Purchase? YES");
					((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate
					{
						GamblingManager.Rep -= GamblingManager.SpinCost;
						base.ScrollView.RemoveAllButtons();
						SimplePhoneButton val10 = PhoneUIUtility.CreateSimpleButton("Opening...");
						base.ScrollView.AddButton((PhoneButton)(object)val10);
						((MonoBehaviour)this).StartCoroutine(LaunchOverlay());
					});
					base.ScrollView.AddButton((PhoneButton)(object)val5);
					SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("Purchase? NO");
					((PhoneButton)val6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val6).OnConfirm, (Action)delegate
					{
						ShowMainMenu();
					});
					base.ScrollView.AddButton((PhoneButton)(object)val6);
				}
			}
			else
			{
				SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton("Not enough REP, boss up and get some.");
				base.ScrollView.AddButton((PhoneButton)(object)val7);
			}
			if (GamblingManager.Rep < 1000)
			{
				return;
			}
			AddDivider("Multi Open");
			if (quickOpenEnabled)
			{
				SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton("<color=#88CCFF>Open x10 Cases (1000 REP)</color>");
				((PhoneButton)val8).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val8).OnConfirm, (Action)delegate
				{
					GamblingManager.Rep -= 1000;
					base.ScrollView.RemoveAllButtons();
					SimplePhoneButton val10 = PhoneUIUtility.CreateSimpleButton("Opening 10 cases...");
					base.ScrollView.AddButton((PhoneButton)(object)val10);
					((MonoBehaviour)this).StartCoroutine(LaunchMultiOverlay(fast: true));
				});
				base.ScrollView.AddButton((PhoneButton)(object)val8);
			}
			else
			{
				SimplePhoneButton val9 = PhoneUIUtility.CreateSimpleButton("Open x10 Cases (1000 REP)");
				((PhoneButton)val9).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val9).OnConfirm, (Action)delegate
				{
					GamblingManager.Rep -= 1000;
					base.ScrollView.RemoveAllButtons();
					SimplePhoneButton val10 = PhoneUIUtility.CreateSimpleButton("Opening 10 cases...");
					base.ScrollView.AddButton((PhoneButton)(object)val10);
					((MonoBehaviour)this).StartCoroutine(LaunchMultiOverlay());
				});
				base.ScrollView.AddButton((PhoneButton)(object)val9);
			}
		}

		private IEnumerator LaunchOverlay(bool fast = false)
		{
			GamblingSaveData.Instance.TotalCasesOpened++;
			yield return null;
			CaseOpeningOverlay.Create((MonoBehaviour)(object)this, fast, delegate(RewardTier result, EffectDefinition effect)
			{
				ShowResult(result, effect);
			});
		}

		private IEnumerator LaunchMultiOverlay(bool fast = false)
		{
			GamblingSaveData.Instance.TotalCasesOpened += 10;
			yield return null;
			CaseOpeningOverlay.CreateMulti((MonoBehaviour)(object)this, fast, delegate(List<(RewardTier, EffectDefinition)> results)
			{
				ShowMultiResult(results);
			});
		}

		private void ShowResult(RewardTier result, EffectDefinition effect)
		{
			currentScreen = AppScreen.Result;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowMainMenu();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			AddHeader("Case Result");
			string text = ((effect != null) ? effect.DisplayName : "Unknown Item");
			if (1 == 0)
			{
			}
			string text2 = result switch
			{
				RewardTier.Common => "COMMON - " + text, 
				RewardTier.Rare => "RARE - " + text, 
				RewardTier.Epic => "EPIC - " + text, 
				RewardTier.Legendary => "LEGENDARY - " + text, 
				RewardTier.Mythic => "<color=#FFFFFF>* MYTHIC * - " + text + "</color>", 
				_ => "???", 
			};
			if (1 == 0)
			{
			}
			string text3 = text2;
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton(text3);
			base.ScrollView.AddButton((PhoneButton)(object)val2);
			if (effect != null)
			{
				bool flag = GamblingSaveData.Instance.OwnedEffectIds.Contains(effect.Id);
				int sellValue = GamblingManager.GetSellValue(effect.Rarity);
				if (flag)
				{
					SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("You already own this effect!");
					base.ScrollView.AddButton((PhoneButton)(object)val3);
					SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton($"Sell for {sellValue} REP");
					((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate
					{
						GamblingManager.Rep += sellValue;
						ShowMainMenu();
					});
					base.ScrollView.AddButton((PhoneButton)(object)val4);
					SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Keep (no duplicate stored)");
					((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate
					{
						ShowMainMenu();
					});
					base.ScrollView.AddButton((PhoneButton)(object)val5);
				}
				else
				{
					GamblingSaveData.Instance.AddEffect(effect.Id);
					SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("Added to inventory!");
					base.ScrollView.AddButton((PhoneButton)(object)val6);
				}
			}
			if (result == RewardTier.Epic || result == RewardTier.Legendary || result == RewardTier.Mythic)
			{
				string text4 = result switch
				{
					RewardTier.Legendary => "You opened a <color=yellow>LEGENDARY " + text + "</color>", 
					RewardTier.Mythic => "<color=white>- MYTHIC - " + text + " has been unboxed!</color>", 
					_ => "You opened a <color=red>EPIC " + text + "</color>", 
				};
				ChatUI instance = ChatUI.Instance;
				if ((Object)(object)instance != (Object)null && GamblingPlugin.ShowChatMessages.Value)
				{
					instance.AddMessage(text4);
				}
			}
		}

		private string GetRarityColor(RewardTier rarity)
		{
			return rarity switch
			{
				RewardTier.Legendary => "#FFD700", 
				RewardTier.Epic => "#FF4444", 
				RewardTier.Rare => "#CC44FF", 
				RewardTier.Common => "#4488FF", 
				RewardTier.Mythic => "#FFFFFF", 
				RewardTier.Special => "#44FF88", 
				_ => "#FFFFFF", 
			};
		}

		private void ShowInventory()
		{
			currentScreen = AppScreen.Inventory;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowMainMenu();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			AddHeader("Inventory");
			int num = (from id in GamblingSaveData.Instance.EquippedEffectIds
				select EffectRegistry.Get(id) into d
				where d != null && !d.IsPassive
				select d).Count();
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"Equipped: {num}/{5}");
			base.ScrollView.AddButton((PhoneButton)(object)val2);
			if (GamblingSaveData.Instance.OwnedEffectIds.Count == 0)
			{
				AddDescription("No items owned yet. Open a case!");
				return;
			}
			int num2 = 0;
			int num3 = 0;
			int num4 = 0;
			int num5 = 0;
			int num6 = 0;
			int num7 = 0;
			foreach (string ownedEffectId in GamblingSaveData.Instance.OwnedEffectIds)
			{
				EffectDefinition effectDefinition = EffectRegistry.Get(ownedEffectId);
				if (effectDefinition != null)
				{
					switch (effectDefinition.Rarity)
					{
					case RewardTier.Common:
						num2++;
						break;
					case RewardTier.Rare:
						num3++;
						break;
					case RewardTier.Epic:
						num4++;
						break;
					case RewardTier.Legendary:
						num5++;
						break;
					case RewardTier.Mythic:
						num6++;
						break;
					case RewardTier.Special:
						num7++;
						break;
					}
				}
			}
			AddDivider("Browse by Rarity");
			if (num7 > 0)
			{
				SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton(string.Format("<color=#44FF88>[Special] — {0} item{1}</color>", num7, (num7 > 1) ? "s" : ""));
				((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate
				{
					ShowInventoryRarity(RewardTier.Special);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val3);
			}
			if (num6 > 0)
			{
				SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton(string.Format("<color=#FFFFFF>[Mythic] — {0} item{1}</color>", num6, (num6 > 1) ? "s" : ""));
				((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate
				{
					ShowInventoryRarity(RewardTier.Mythic);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val4);
			}
			if (num5 > 0)
			{
				int num8 = (from id in GamblingSaveData.Instance.EquippedEffectIds
					select EffectRegistry.Get(id) into d
					where d != null && d.Rarity == RewardTier.Legendary
					select d).Count();
				string arg = ((num8 > 0) ? $" <color=#44FF44>({num8} equipped)</color>" : "");
				SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton(string.Format("<color=#FFD700>[Legendary] — {0} item{1}</color>{2}", num5, (num5 > 1) ? "s" : "", arg));
				((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate
				{
					ShowInventoryRarity(RewardTier.Legendary);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val5);
			}
			if (num4 > 0)
			{
				int num9 = (from id in GamblingSaveData.Instance.EquippedEffectIds
					select EffectRegistry.Get(id) into d
					where d != null && d.Rarity == RewardTier.Epic
					select d).Count();
				string arg2 = ((num9 > 0) ? $" <color=#44FF44>({num9} equipped)</color>" : "");
				SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton(string.Format("<color=#FF4444>[Epic] — {0} item{1}</color>{2}", num4, (num4 > 1) ? "s" : "", arg2));
				((PhoneButton)val6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val6).OnConfirm, (Action)delegate
				{
					ShowInventoryRarity(RewardTier.Epic);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val6);
			}
			if (num3 > 0)
			{
				int num10 = (from id in GamblingSaveData.Instance.EquippedEffectIds
					select EffectRegistry.Get(id) into d
					where d != null && d.Rarity == RewardTier.Rare
					select d).Count();
				string arg3 = ((num10 > 0) ? $" <color=#44FF44>({num10} equipped)</color>" : "");
				SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton(string.Format("<color=#CC44FF>[Rare] — {0} item{1}</color>{2}", num3, (num3 > 1) ? "s" : "", arg3));
				((PhoneButton)val7).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val7).OnConfirm, (Action)delegate
				{
					ShowInventoryRarity(RewardTier.Rare);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val7);
			}
			if (num2 > 0)
			{
				int num11 = (from id in GamblingSaveData.Instance.EquippedEffectIds
					select EffectRegistry.Get(id) into d
					where d != null && d.Rarity == RewardTier.Common
					select d).Count();
				string arg4 = ((num11 > 0) ? $" <color=#44FF44>({num11} equipped)</color>" : "");
				SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton(string.Format("<color=#4488FF>[Common] — {0} item{1}</color>{2}", num2, (num2 > 1) ? "s" : "", arg4));
				((PhoneButton)val8).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val8).OnConfirm, (Action)delegate
				{
					ShowInventoryRarity(RewardTier.Common);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val8);
			}
		}

		private void ShowInventoryRarity(RewardTier rarity)
		{
			currentScreen = AppScreen.Inventory;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowInventory();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			string rarityColor = GetRarityColor(rarity);
			AddHeader($"{rarity} Effects");
			IOrderedEnumerable<EffectDefinition> orderedEnumerable = from id in GamblingSaveData.Instance.OwnedEffectIds
				select EffectRegistry.Get(id) into effectDefinition
				where effectDefinition != null && effectDefinition.Rarity == rarity
				orderby effectDefinition.DisplayName
				select effectDefinition;
			foreach (EffectDefinition def in orderedEnumerable)
			{
				string text = (GamblingSaveData.Instance.IsEquipped(def.Id) ? " <color=#44FF44>(Equipped)</color>" : "");
				string triggerDescription = GetTriggerDescription(def.Trigger);
				string text2 = (def.IsNew ? " <color=#8B8000>[NEW]</color>" : "");
				string text3 = "<color=" + rarityColor + ">" + def.DisplayName + "</color>" + text2 + text + " <color=#888888>" + triggerDescription + "</color>";
				SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton(text3);
				((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate
				{
					savedInventoryIndex = base.ScrollView.SelectedIndex;
					ShowItemConfirm(def);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val2);
			}
		}

		private string GetTriggerDescription(EffectTrigger trigger)
		{
			return trigger switch
			{
				EffectTrigger.Looping => "— always on", 
				EffectTrigger.OnSpray => "— on graffiti", 
				EffectTrigger.OnSprayAttempt => "— on spray press", 
				EffectTrigger.OnJump => "— on jump", 
				EffectTrigger.OnLand => "— on land", 
				EffectTrigger.OnWallPlant => "— on wall plant", 
				EffectTrigger.OnBoostTrick => "— on boost trick", 
				EffectTrigger.OnBoost => "— on boost", 
				EffectTrigger.OnBoostLooping => "— while boosting", 
				EffectTrigger.OnSlide => "— on slide", 
				EffectTrigger.OnGraceEnd => "— on grace end", 
				EffectTrigger.OnGraceStart => "— on grace start", 
				EffectTrigger.OnGraceStartLooping => "— during grace", 
				EffectTrigger.OnDeath => "— on death", 
				EffectTrigger.OnEmote => "— on emote", 
				EffectTrigger.OnGrind => "— on grind start", 
				EffectTrigger.OnGrindLooping => "— while grinding", 
				EffectTrigger.OnManual => "— on manual", 
				EffectTrigger.OnComboBank => "— on combo bank", 
				_ => "", 
			};
		}

		private void ShowItemConfirm(EffectDefinition def)
		{
			savedInventoryIndex = base.ScrollView.SelectedIndex;
			currentScreen = AppScreen.ItemConfirm;
			currentConfirmDef = def;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowInventoryRarity(def.Rarity);
				RestoreIndex(savedInventoryIndex);
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			string rarityColor = GetRarityColor(def.Rarity);
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"<color={rarityColor}>[{def.Rarity}] {def.DisplayName}</color>");
			base.ScrollView.AddButton((PhoneButton)(object)val2);
			if (GamblingSaveData.Instance.IsEquipped(def.Id))
			{
				SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Unequip");
				((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate
				{
					GamblingSaveData.Instance.Unequip(def.Id);
					ShowInventory();
					RestoreIndex(savedInventoryIndex);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val3);
				if (def.Rarity != RewardTier.Special && def.Rarity != RewardTier.Mythic)
				{
					SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("Unequip to sell this item.");
					base.ScrollView.AddButton((PhoneButton)(object)val4);
				}
				return;
			}
			if (def.IsPassive || (from id in GamblingSaveData.Instance.EquippedEffectIds
				select EffectRegistry.Get(id) into d
				where d != null && !d.IsPassive
				select d).Count() < 5)
			{
				SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Equip");
				((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate
				{
					GamblingSaveData.Instance.TryEquip(def.Id);
					ShowInventory();
					RestoreIndex(savedInventoryIndex);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val5);
			}
			else
			{
				SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("You need to unequip an effect first.");
				base.ScrollView.AddButton((PhoneButton)(object)val6);
			}
			if (def.Rarity == RewardTier.Special || def.Rarity == RewardTier.Mythic)
			{
				SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton("<color=#FF4444>This item cannot be sold.</color>");
				base.ScrollView.AddButton((PhoneButton)(object)val7);
				return;
			}
			int sellValue = GamblingManager.GetSellValue(def.Rarity);
			SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton($"Sell for {sellValue} REP");
			((PhoneButton)val8).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val8).OnConfirm, (Action)delegate
			{
				TextInput.Instance.ShowOkCancel((Action<string>)delegate
				{
					GamblingSaveData.Instance.RemoveEffect(def.Id);
					GamblingManager.Rep += sellValue;
					ShowInventory();
				}, (Action<string>)delegate
				{
				}, (Func<string, bool>)((string text) => true), $"Sell {def.DisplayName} for {sellValue} REP? This cannot be undone.", 1, "", "");
			});
			base.ScrollView.AddButton((PhoneButton)(object)val8);
		}

		private void ShowMultiResult(List<(RewardTier tier, EffectDefinition effect)> results)
		{
			currentScreen = AppScreen.Result;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowMainMenu();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			AddHeader("Multi Open Results");
			List<EffectDefinition> newItems = new List<EffectDefinition>();
			List<EffectDefinition> list = new List<EffectDefinition>();
			foreach (var result in results)
			{
				var (rewardTier, effect) = result;
				if (effect != null)
				{
					bool flag = GamblingSaveData.Instance.OwnedEffectIds.Contains(effect.Id);
					bool flag2 = newItems.Any((EffectDefinition e) => e.Id == effect.Id);
					if (flag || flag2)
					{
						list.Add(effect);
					}
					else
					{
						newItems.Add(effect);
					}
				}
			}
			foreach (EffectDefinition item in newItems)
			{
				GamblingSaveData.Instance.AddEffect(item.Id);
			}
			if (list.Count > 0)
			{
				int totalSellValue = 0;
				foreach (EffectDefinition item2 in list)
				{
					totalSellValue += GamblingManager.GetSellValue(item2.Rarity);
				}
				SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"You rolled {list.Count} duplicate(s)!");
				base.ScrollView.AddButton((PhoneButton)(object)val2);
				SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton($"Sell all duplicates for {totalSellValue} REP");
				((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate
				{
					GamblingManager.Rep += totalSellValue;
					ShowMultiSummary(newItems);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val3);
				SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("Keep (duplicates not saved)");
				((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate
				{
					ShowMultiSummary(newItems);
				});
				base.ScrollView.AddButton((PhoneButton)(object)val4);
				AddDivider("Duplicates");
				{
					foreach (EffectDefinition item3 in list)
					{
						string rarityColor = GetRarityColor(item3.Rarity);
						int sellValue = GamblingManager.GetSellValue(item3.Rarity);
						SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton($"<color={rarityColor}>[{item3.Rarity}] {item3.DisplayName}</color> ({sellValue} REP)");
						base.ScrollView.AddButton((PhoneButton)(object)val5);
					}
					return;
				}
			}
			ShowMultiSummary(newItems);
		}

		private void ShowMultiSummary(List<EffectDefinition> newItems)
		{
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowMainMenu();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			AddHeader("New Items");
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"Added {newItems.Count} new item(s) to inventory!");
			base.ScrollView.AddButton((PhoneButton)(object)val2);
			foreach (EffectDefinition newItem in newItems)
			{
				string rarityColor = GetRarityColor(newItem.Rarity);
				SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton($"<color={rarityColor}>[{newItem.Rarity}] {newItem.DisplayName}</color>");
				base.ScrollView.AddButton((PhoneButton)(object)val3);
			}
		}

		public static void RefreshRepDisplay()
		{
			if (!((Object)(object)Instance == (Object)null) && !((Object)(object)Instance.repDisplayButton == (Object)null))
			{
				TextMeshProUGUI componentInChildren = ((Component)Instance.repDisplayButton).GetComponentInChildren<TextMeshProUGUI>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					int num = GamblingManager.Rep / GamblingManager.SpinCost;
					((TMP_Text)componentInChildren).text = string.Format("<color={0}>REP: {1} ({2} cases)</color>", "#FFD700", GamblingManager.Rep, num);
				}
			}
		}

		private IEnumerator RedeemCodeCoroutine(string code)
		{
			string machineId = SystemInfo.deviceUniqueIdentifier;
			string url = "https://script.google.com/macros/s/AKfycbw5o0iymgetqflC2AxscMtq6KkRjgPCPHLsUENp5nhXxE11RJ2v93wTfkgccDwTyaM/exec?key=" + code + "&machineId=" + machineId;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton loadingLabel = PhoneUIUtility.CreateSimpleButton("Redeeming...");
			base.ScrollView.AddButton((PhoneButton)(object)loadingLabel);
			UnityWebRequest request = UnityWebRequest.Get(url);
			try
			{
				yield return request.SendWebRequest();
				base.ScrollView.RemoveAllButtons();
				SimplePhoneButton backButton = PhoneUIUtility.CreateSimpleButton("Back");
				((PhoneButton)backButton).OnConfirm = (Action)Delegate.Combine(((PhoneButton)backButton).OnConfirm, (Action)delegate
				{
					ShowMainMenu();
				});
				base.ScrollView.AddButton((PhoneButton)(object)backButton);
				AddHeader("Redeem Code");
				if ((int)request.result != 1)
				{
					AddDescription("Network error. Try again later.");
					yield break;
				}
				string json = request.downloadHandler.text;
				if (json.Contains("\"success\":true"))
				{
					if (json.Contains("\"purpose\":\"rep_200\""))
					{
						GamblingManager.Rep += 200;
						SimplePhoneButton s = PhoneUIUtility.CreateSimpleButton("<color=#44FF44>Code redeemed! +200 REP!</color>");
						base.ScrollView.AddButton((PhoneButton)(object)s);
					}
					else if (json.Contains("\"purpose\":\"mythic_crown\""))
					{
						if (!GamblingSaveData.Instance.OwnedEffectIds.Contains("mythic_crown"))
						{
							GamblingSaveData.Instance.AddEffect("mythic_crown");
							SimplePhoneButton s2 = PhoneUIUtility.CreateSimpleButton("<color=#FFFFFF>* MYTHIC * Mythic Crown added to inventory!</color>");
							base.ScrollView.AddButton((PhoneButton)(object)s2);
						}
						else
						{
							GamblingManager.Rep += 10000;
							SimplePhoneButton s3 = PhoneUIUtility.CreateSimpleButton("<color=#FFFFFF>You already own the crown! +10,000 REP instead.</color>");
							base.ScrollView.AddButton((PhoneButton)(object)s3);
						}
					}
					else if (json.Contains("\"purpose\":\"rep_10000\""))
					{
						GamblingManager.Rep += 10000;
						SimplePhoneButton s4 = PhoneUIUtility.CreateSimpleButton("<color=#44FF44>Code redeemed! +10000 REP!</color>");
						base.ScrollView.AddButton((PhoneButton)(object)s4);
					}
					else if (json.Contains("\"purpose\":\"special_bday_hat\""))
					{
						if (!GamblingSaveData.Instance.OwnedEffectIds.Contains("special_bday_hat"))
						{
							GamblingSaveData.Instance.AddEffect("special_bday_hat");
							SimplePhoneButton s5 = PhoneUIUtility.CreateSimpleButton("<color=#44FF88>[Special] Birthday Hat added to inventory!</color>");
							base.ScrollView.AddButton((PhoneButton)(object)s5);
						}
						else
						{
							GamblingManager.Rep += 5000;
							SimplePhoneButton s6 = PhoneUIUtility.CreateSimpleButton("<color=#44FF88>You already have the Birthday Hat! +5000 REP instead.</color>");
							base.ScrollView.AddButton((PhoneButton)(object)s6);
						}
					}
					else if (json.Contains("\"purpose\":\"special_badge\""))
					{
						if (!GamblingSaveData.Instance.OwnedEffectIds.Contains("special_badge"))
						{
							GamblingSaveData.Instance.AddEffect("special_badge");
							SimplePhoneButton s7 = PhoneUIUtility.CreateSimpleButton("<color=#44FF88>[Special] AMT Badge added to inventory!</color>");
							base.ScrollView.AddButton((PhoneButton)(object)s7);
						}
						else
						{
							GamblingManager.Rep += 5000;
							SimplePhoneButton s8 = PhoneUIUtility.CreateSimpleButton("<color=#44FF88>You already have the badge! +5000 REP instead.</color>");
							base.ScrollView.AddButton((PhoneButton)(object)s8);
						}
					}
					else if (json.Contains("\"purpose\":\"special_glasses\""))
					{
						if (!GamblingSaveData.Instance.OwnedEffectIds.Contains("special_glasses"))
						{
							GamblingSaveData.Instance.AddEffect("special_glasses");
							SimplePhoneButton successLabel = PhoneUIUtility.CreateSimpleButton("<color=#44FF88>[Special] Glasses added to inventory!</color>");
							base.ScrollView.AddButton((PhoneButton)(object)successLabel);
						}
						else
						{
							GamblingManager.Rep += 5000;
							SimplePhoneButton successLabel2 = PhoneUIUtility.CreateSimpleButton("<color=#44FF88>You already have the glasses! +5000 REP instead.</color>");
							base.ScrollView.AddButton((PhoneButton)(object)successLabel2);
						}
					}
					else
					{
						SimplePhoneButton s9 = PhoneUIUtility.CreateSimpleButton("<color=#44FF44>Code redeemed!</color>");
						base.ScrollView.AddButton((PhoneButton)(object)s9);
					}
				}
				else if (json.Contains("already_redeemed"))
				{
					SimplePhoneButton s10 = PhoneUIUtility.CreateSimpleButton("<color=#FF4444>This code has already been used.</color>");
					base.ScrollView.AddButton((PhoneButton)(object)s10);
				}
				else if (json.Contains("invalid_key"))
				{
					SimplePhoneButton s11 = PhoneUIUtility.CreateSimpleButton("<color=#FF4444>Invalid code.</color>");
					base.ScrollView.AddButton((PhoneButton)(object)s11);
				}
				else
				{
					SimplePhoneButton s12 = PhoneUIUtility.CreateSimpleButton("<color=#FF4444>Something went wrong. Try again.</color>");
					base.ScrollView.AddButton((PhoneButton)(object)s12);
				}
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		private void ShowBlackjackBet()
		{
			currentScreen = AppScreen.BlackjackBet;
			if ((Object)(object)currentBlackjackOverlay != (Object)null)
			{
				currentBlackjackOverlay.Cleanup();
				currentBlackjackOverlay = null;
			}
			currentBet = Mathf.Clamp(currentBet, 60, Mathf.Min(50000, GamblingManager.Rep));
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowMainMenu();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			AddHeader("Blackjack");
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"Your REP: {GamblingManager.Rep}");
			base.ScrollView.AddButton((PhoneButton)(object)val2);
			SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton($"Bet: {currentBet} REP");
			base.ScrollView.AddButton((PhoneButton)(object)val3);
			SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton(string.Format("<color={0}>+ {1} REP</color>", "#44FF44", 20));
			((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate
			{
				((CustomApp)this).PlaySelectSFX();
				int selectedIndex = base.ScrollView.SelectedIndex;
				currentBet = Mathf.Min(currentBet + 20, Mathf.Min(50000, GamblingManager.Rep));
				ShowBlackjackBet();
				RestoreIndex(selectedIndex);
			});
			base.ScrollView.AddButton((PhoneButton)(object)val4);
			SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton(string.Format("<color={0}>- {1} REP</color>", "#FF4444", 20));
			((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate
			{
				((CustomApp)this).PlaySelectSFX();
				int selectedIndex = base.ScrollView.SelectedIndex;
				currentBet = Mathf.Max(currentBet - 20, 60);
				ShowBlackjackBet();
				RestoreIndex(selectedIndex);
			});
			base.ScrollView.AddButton((PhoneButton)(object)val5);
			SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("<color=#888888>Enter custom bet</color>");
			((PhoneButton)val6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val6).OnConfirm, (Action)delegate
			{
				int result;
				TextInput.Instance.ShowOkCancel((Action<string>)delegate(string text)
				{
					if (int.TryParse(text, out result))
					{
						currentBet = Mathf.Clamp(result, 60, Mathf.Min(50000, GamblingManager.Rep));
						ShowBlackjackBet();
					}
				}, (Action<string>)delegate
				{
				}, (Func<string, bool>)((string text) => int.TryParse(text, out result) && result >= 60 && result <= 50000), $"Enter bet amount ({60} - {50000} REP).", 6, currentBet.ToString(), currentBet.ToString());
			});
			base.ScrollView.AddButton((PhoneButton)(object)val6);
			if (GamblingManager.Rep >= 60)
			{
				SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton("<color=#FFD700>DEAL</color>");
				((PhoneButton)val7).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val7).OnConfirm, (Action)delegate
				{
					if (GamblingManager.Rep >= currentBet)
					{
						((CustomApp)this).PlayConfirmSFX();
						savedBlackjackBetIndex = base.ScrollView.SelectedIndex;
						GamblingManager.Rep -= currentBet;
						currentBlackjackGame = new BlackjackGame();
						currentBlackjackGame.StartGame(currentBet);
						ShowBlackjackGame();
					}
				});
				base.ScrollView.AddButton((PhoneButton)(object)val7);
			}
			else
			{
				SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton("<color=#FF4444>Not enough REP to play!</color>");
				base.ScrollView.AddButton((PhoneButton)(object)val8);
			}
		}

		private void ShowBlackjackGame()
		{
			currentScreen = AppScreen.BlackjackGame;
			blackjackAnimating = true;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Dealing cards...");
			base.ScrollView.AddButton((PhoneButton)(object)val);
			currentBlackjackOverlay = BlackjackOverlay.Create((MonoBehaviour)(object)this, currentBlackjackGame, delegate
			{
				blackjackAnimating = false;
				if (currentBlackjackGame.Result != BlackjackResult.None)
				{
					HandleBlackjackEnd();
				}
				else
				{
					ShowBlackjackActions();
				}
			});
		}

		private void ShowBlackjackActions()
		{
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Hit");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				if (!blackjackAnimating)
				{
					blackjackAnimating = true;
					currentBlackjackGame.Hit();
					currentBlackjackOverlay.TriggerHit(delegate
					{
						blackjackAnimating = false;
						if (currentBlackjackGame.Result != BlackjackResult.None)
						{
							HandleBlackjackEnd();
						}
						else
						{
							ShowBlackjackActions();
						}
					});
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton("Stand");
			((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate
			{
				if (!blackjackAnimating)
				{
					blackjackAnimating = true;
					int count = currentBlackjackGame.DealerHand.Count;
					currentBlackjackGame.Stand();
					currentBlackjackOverlay.TriggerStand(count, delegate
					{
						HandleBlackjackEnd();
					});
				}
			});
			base.ScrollView.AddButton((PhoneButton)(object)val2);
		}

		private void HandleBlackjackEnd()
		{
			blackjackAnimating = true;
			BlackjackResult result = currentBlackjackGame.Result;
			int num = 0;
			switch (result)
			{
			case BlackjackResult.PlayerBlackjack:
				num = Mathf.RoundToInt((float)currentBlackjackGame.Bet * 1.5f);
				GamblingManager.Rep += currentBlackjackGame.Bet + num;
				GamblingSaveData.Instance.BlackjackNetRep += currentBlackjackGame.Bet + num;
				break;
			case BlackjackResult.PlayerWin:
			case BlackjackResult.DealerBust:
				num = currentBlackjackGame.Bet;
				GamblingManager.Rep += currentBlackjackGame.Bet + num;
				GamblingSaveData.Instance.BlackjackNetRep += currentBlackjackGame.Bet + num;
				break;
			case BlackjackResult.Push:
				GamblingManager.Rep += currentBlackjackGame.Bet;
				break;
			case BlackjackResult.DealerWin:
			case BlackjackResult.PlayerBust:
				GamblingSaveData.Instance.BlackjackLosses++;
				GamblingSaveData.Instance.BlackjackNetRep -= currentBlackjackGame.Bet;
				break;
			}
			currentBlackjackOverlay.TriggerResult(result, num, delegate
			{
				blackjackAnimating = false;
				currentBlackjackOverlay.Cleanup();
				currentBlackjackOverlay = null;
				ShowBlackjackBet();
				RestoreIndex(savedBlackjackBetIndex);
			});
		}

		private void ShowWagerMain()
		{
			currentScreen = AppScreen.WagerMain;
			base.ScrollView.RemoveAllButtons();
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				ShowMainMenu();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val);
			AddHeader("Wager Race");
			SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton("<color=#99FF99>How wager races work →</color>");
			((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate
			{
				InfoOverlay.Show((MonoBehaviour)(object)this, "HOW WAGER RACES WORK", new string[10] { "1. Host or join a wager lobby.", "2. Set your wager amount.", "3. Press Ready Up.", "4. Host locks the lobby when all ready.", "5. Exit the casino app.", "6. Start a grace through ACN as normal.", "7. Winner gets the matched pot automatically.", "", "The lobby stays active until the", "grace ends — do not close it!" });
			});
			base.ScrollView.AddButton((PhoneButton)(object)val2);
			if (WagerLobbyManager.State != WagerLobbyState.Idle)
			{
				SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("<color=#FF8800>View Current Lobby</color>");
				((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate
				{
					ShowWagerLobby();
				});
				base.ScrollView.AddButton((PhoneButton)(object)val3);
				return;
			}
			AddDivider("Host a Lobby");
			SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("Host Public Lobby");
			((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate
			{
				WagerSync.CreateLobby(isPublic: true);
				ShowWagerLobby();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val4);
			SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Host Private Lobby");
			((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate
			{
				WagerSync.CreateLobby(isPublic: false);
				ShowWagerLobby();
			});
			base.ScrollView.AddButton((PhoneButton)(object)val5);
			AddDivider("Join a Lobby");
			ClientController instance = ClientController.Instance;
			if ((Object)(object)instance != (Object)null && WagerLobbyManager.HostId != 0 && WagerLobbyManager.IsPublic && !WagerLobbyManager.LocalPlayerInLobby())
			{
				SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("<color=#44FF44>Join Available Public Lobby</color>");
				((PhoneButton)val6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val6).OnConfirm, (Action)delegate
				{
					WagerSync.RequestJoin();
					ShowWagerLobby();
				});
				base.ScrollView.AddButton((PhoneButton)(object)val6);
			}
			else if ((Object)(object)instance == (Object)null)
			{
				SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton("<color=#888888>ACN multiplayer required.</color>");
				base.ScrollView.AddButton((PhoneButton)(object)val7);
			}
			else
			{
				SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton("<color=#888888>No public lobbies available.</color>");
				base.ScrollView.AddButton((PhoneButton)(object)val8);
			}
		}

		private void ShowWagerLobby()
		{
			currentScreen = AppScreen.WagerLobby;
			base.ScrollView.RemoveAllButtons();
			bool isLocked = WagerLobbyManager.State == WagerLobbyState.Locked;
			SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton(isLocked ? "Back (lobby stays active)" : "Back");
			((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate
			{
				if (isLocked)
				{
					ShowWagerMain();
				}
				else if (WagerLobbyManager.IsHost)
				{
					TextInput.Instance.ShowOkCancel((Action<string>)delegate
					{
						WagerSync.CloseLobby();
						ShowWagerMain();
					}, (Action<string>)delegate
					{
					}, (Func<string, bool>)((string text8) => true), "Close the lobby? This will remove all players and c