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> remotePassives = new Dictionary>(); public static void Init() { try { ClientController.RegisterCustomPacketHandler("com.chimp.brcgambling.passive", (Action)OnPacket); ClientController.PlayerDisconnected = (Action)Delegate.Combine(ClientController.PlayerDisconnected, new Action(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)Delegate.Remove(ClientController.PlayerDisconnected, new Action(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 list = new List(); 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(); } Dictionary dictionary = remotePassives[playerId]; HashSet hashSet = new HashSet(ids); List list = new List(); foreach (KeyValuePair 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(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(); } 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(); 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 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> remotePassife in remotePassives) { foreach (KeyValuePair 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 All = new Dictionary(); 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 GetPool(RewardTier rarity) { List list = new List(); 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 OwnedEffectIds = new List(); public List EquippedEffectIds = new List(); 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(); for (int i = 0; i < num; i++) { OwnedEffectIds.Add(reader.ReadString()); } int num2 = reader.ReadInt32(); EquippedEffectIds = new List(); 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("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("── " + text + " ──"); base.ScrollView.AddButton((PhoneButton)(object)val); } private void AddDivider(string text) { SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("── " + text + " ──"); 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("" + text + ""); TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).enableWordWrapping = true; ((TMP_Text)componentInChildren).ForceMeshUpdate(false, false); RectTransform component = ((Component)val).GetComponent(); 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("REP: {1} ({2} cases)", "#FFD700", GamblingManager.Rep, num)); base.ScrollView.AddButton(repDisplayButton); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Open Spray Case"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowCaseOpening(); }); base.ScrollView.AddButton((PhoneButton)(object)val); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton("Inventory"); ((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate { ShowInventory(); }); base.ScrollView.AddButton((PhoneButton)(object)val2); SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Blackjack"); ((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate { ShowBlackjackBet(); }); base.ScrollView.AddButton((PhoneButton)(object)val3); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("Wager Race"); ((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate { ShowWagerMain(); }); base.ScrollView.AddButton((PhoneButton)(object)val4); SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Redeem Code"); ((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate { TextInput.Instance.ShowOkCancel((Action)delegate(string text) { ((MonoBehaviour)this).StartCoroutine(RedeemCodeCoroutine(text.Trim())); }, (Action)delegate { }, (Func)((string text) => text.Length > 0), "Enter your redemption code.", 30, "AMT-XXXXX-XXXXX", ""); }); base.ScrollView.AddButton((PhoneButton)(object)val5); SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("Stats"); ((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 ? "Quick Open: ON" : "Quick Open: OFF"); ((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("Open Case ({1} REP)", "#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("Open x10 Cases (1000 REP)"); ((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 => "* MYTHIC * - " + text + "", _ => "???", }; 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 LEGENDARY " + text + "", RewardTier.Mythic => "- MYTHIC - " + text + " has been unboxed!", _ => "You opened a EPIC " + text + "", }; 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("[Special] — {0} item{1}", 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("[Mythic] — {0} item{1}", 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) ? $" ({num8} equipped)" : ""); SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton(string.Format("[Legendary] — {0} item{1}{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) ? $" ({num9} equipped)" : ""); SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton(string.Format("[Epic] — {0} item{1}{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) ? $" ({num10} equipped)" : ""); SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton(string.Format("[Rare] — {0} item{1}{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) ? $" ({num11} equipped)" : ""); SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton(string.Format("[Common] — {0} item{1}{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 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) ? " (Equipped)" : ""); string triggerDescription = GetTriggerDescription(def.Trigger); string text2 = (def.IsNew ? " [NEW]" : ""); string text3 = "" + def.DisplayName + "" + text2 + text + " " + triggerDescription + ""; 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($"[{def.Rarity}] {def.DisplayName}"); 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("This item cannot be sold."); 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)delegate { GamblingSaveData.Instance.RemoveEffect(def.Id); GamblingManager.Rep += sellValue; ShowInventory(); }, (Action)delegate { }, (Func)((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 newItems = new List(); List list = new List(); 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($"[{item3.Rarity}] {item3.DisplayName} ({sellValue} REP)"); base.ScrollView.AddButton((PhoneButton)(object)val5); } return; } } ShowMultiSummary(newItems); } private void ShowMultiSummary(List 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($"[{newItem.Rarity}] {newItem.DisplayName}"); 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(); if ((Object)(object)componentInChildren != (Object)null) { int num = GamblingManager.Rep / GamblingManager.SpinCost; ((TMP_Text)componentInChildren).text = string.Format("REP: {1} ({2} cases)", "#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("Code redeemed! +200 REP!"); 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("* MYTHIC * Mythic Crown added to inventory!"); base.ScrollView.AddButton((PhoneButton)(object)s2); } else { GamblingManager.Rep += 10000; SimplePhoneButton s3 = PhoneUIUtility.CreateSimpleButton("You already own the crown! +10,000 REP instead."); base.ScrollView.AddButton((PhoneButton)(object)s3); } } else if (json.Contains("\"purpose\":\"rep_10000\"")) { GamblingManager.Rep += 10000; SimplePhoneButton s4 = PhoneUIUtility.CreateSimpleButton("Code redeemed! +10000 REP!"); 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("[Special] Birthday Hat added to inventory!"); base.ScrollView.AddButton((PhoneButton)(object)s5); } else { GamblingManager.Rep += 5000; SimplePhoneButton s6 = PhoneUIUtility.CreateSimpleButton("You already have the Birthday Hat! +5000 REP instead."); 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("[Special] AMT Badge added to inventory!"); base.ScrollView.AddButton((PhoneButton)(object)s7); } else { GamblingManager.Rep += 5000; SimplePhoneButton s8 = PhoneUIUtility.CreateSimpleButton("You already have the badge! +5000 REP instead."); 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("[Special] Glasses added to inventory!"); base.ScrollView.AddButton((PhoneButton)(object)successLabel); } else { GamblingManager.Rep += 5000; SimplePhoneButton successLabel2 = PhoneUIUtility.CreateSimpleButton("You already have the glasses! +5000 REP instead."); base.ScrollView.AddButton((PhoneButton)(object)successLabel2); } } else { SimplePhoneButton s9 = PhoneUIUtility.CreateSimpleButton("Code redeemed!"); base.ScrollView.AddButton((PhoneButton)(object)s9); } } else if (json.Contains("already_redeemed")) { SimplePhoneButton s10 = PhoneUIUtility.CreateSimpleButton("This code has already been used."); base.ScrollView.AddButton((PhoneButton)(object)s10); } else if (json.Contains("invalid_key")) { SimplePhoneButton s11 = PhoneUIUtility.CreateSimpleButton("Invalid code."); base.ScrollView.AddButton((PhoneButton)(object)s11); } else { SimplePhoneButton s12 = PhoneUIUtility.CreateSimpleButton("Something went wrong. Try again."); 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("+ {1} REP", "#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("- {1} REP", "#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("Enter custom bet"); ((PhoneButton)val6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val6).OnConfirm, (Action)delegate { int result; TextInput.Instance.ShowOkCancel((Action)delegate(string text) { if (int.TryParse(text, out result)) { currentBet = Mathf.Clamp(result, 60, Mathf.Min(50000, GamblingManager.Rep)); ShowBlackjackBet(); } }, (Action)delegate { }, (Func)((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("DEAL"); ((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("Not enough REP to play!"); 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("How wager races work →"); ((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("View Current Lobby"); ((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("Join Available Public Lobby"); ((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("ACN multiplayer required."); base.ScrollView.AddButton((PhoneButton)(object)val7); } else { SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton("No public lobbies available."); 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)delegate { WagerSync.CloseLobby(); ShowWagerMain(); }, (Action)delegate { }, (Func)((string text8) => true), "Close the lobby? This will remove all players and cancel the wager. Type anything to confirm.", 1, "", ""); } else { TextInput.Instance.ShowOkCancel((Action)delegate { WagerLobbyManager.Reset(); ShowWagerMain(); }, (Action)delegate { }, (Func)((string text8) => true), "Leave the wager lobby? You will need to rejoin to participate. Type anything to confirm.", 1, "", ""); } }); base.ScrollView.AddButton((PhoneButton)(object)val); string text = (WagerLobbyManager.IsPublic ? "Public" : "Private"); string text2 = (isLocked ? "Locked" : "Open"); AddHeader("Wager Lobby — " + text2 + " — " + text); if (isLocked) { WagerPlayer localPlayer = WagerLobbyManager.GetLocalPlayer(); string text3 = ((localPlayer != null && localPlayer.WagerAmount > 0) ? $"Your max risk: {localPlayer.WagerAmount} REP — Lobby Locked!" : "Lobby Locked!"); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton("" + text3 + ""); base.ScrollView.AddButton((PhoneButton)(object)val2); SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("How to start the grace →"); ((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate { InfoOverlay.Show((MonoBehaviour)(object)this, "STARTING THE GRACE", new string[10] { "Your wager lobby is locked and ready!", "", "1. Press 'Back (lobby stays active)'.", "2. Close the casino app.", "3. Open the ACN multiplayer menu.", "4. Start a grace as you normally would.", "", "REP transfers automatically when", "the grace ends. Do NOT close the", "lobby or the wager will be cancelled." }); }); base.ScrollView.AddButton((PhoneButton)(object)val3); } else { WagerPlayer localPlayer2 = WagerLobbyManager.GetLocalPlayer(); string text4 = ((localPlayer2 != null && localPlayer2.WagerAmount > 0) ? $"Your max risk: {localPlayer2.WagerAmount} REP (or less if an opponent wagers less)" : "Set your wager below to see your risk."); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton(text4); base.ScrollView.AddButton((PhoneButton)(object)val4); } AddDivider("Players"); foreach (KeyValuePair player in WagerLobbyManager.Players) { WagerPlayer value = player.Value; string text5 = (value.IsHost ? " [HOST]" : ""); string text6 = (value.IsReady ? " [READY]" : " [NOT READY]"); string text7 = ((value.WagerAmount > 0) ? $"{value.WagerAmount} REP" : "No wager set"); SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton(value.DisplayName + text5 + " — " + text7 + text6); base.ScrollView.AddButton((PhoneButton)(object)val5); if (WagerLobbyManager.IsHost && !value.IsHost) { ushort capturedKey = player.Key; SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("Kick " + value.DisplayName + ""); ((PhoneButton)val6).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val6).OnConfirm, (Action)delegate { savedWagerLobbyIndex = base.ScrollView.SelectedIndex; WagerSync.KickPlayer(capturedKey); ShowWagerLobby(); RestoreIndex(savedWagerLobbyIndex); }); base.ScrollView.AddButton((PhoneButton)(object)val6); } } if (WagerLobbyManager.State != WagerLobbyState.Open) { return; } AddDivider("Your Wager"); WagerPlayer localPlayer3 = WagerLobbyManager.GetLocalPlayer(); int currentWager = localPlayer3?.WagerAmount ?? 0; SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton((currentWager > 0) ? $"Change Wager ({currentWager} REP)" : "Set Wager (required to ready up)"); ((PhoneButton)val7).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val7).OnConfirm, (Action)delegate { int result; TextInput.Instance.ShowOkCancel((Action)delegate(string s) { if (int.TryParse(s, out result) && result > 0 && WagerLobbyManager.CanAffordWager(result)) { savedWagerLobbyIndex = base.ScrollView.SelectedIndex; WagerSync.SetWager(result); ShowWagerLobby(); RestoreIndex(savedWagerLobbyIndex); } }, (Action)delegate { }, (Func)((string s) => int.TryParse(s, out result) && result > 0 && GamblingManager.Rep >= result), $"Enter wager amount. You have {GamblingManager.Rep} REP.", 7, "100", (currentWager > 0) ? currentWager.ToString() : ""); }); base.ScrollView.AddButton((PhoneButton)(object)val7); if (localPlayer3 != null && localPlayer3.WagerAmount > 0) { bool isReady = localPlayer3.IsReady; SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton(isReady ? "Unready" : "Ready Up"); ((PhoneButton)val8).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val8).OnConfirm, (Action)delegate { savedWagerLobbyIndex = base.ScrollView.SelectedIndex; WagerSync.SetReady(!isReady); ShowWagerLobby(); RestoreIndex(savedWagerLobbyIndex); }); base.ScrollView.AddButton((PhoneButton)(object)val8); } else if (localPlayer3 != null) { AddDescription("Set a wager to ready up."); } if (!WagerLobbyManager.IsHost) { return; } AddDivider("Host Controls"); SimplePhoneButton val9 = PhoneUIUtility.CreateSimpleButton(WagerLobbyManager.IsPublic ? "Make Private" : "Make Public"); ((PhoneButton)val9).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val9).OnConfirm, (Action)delegate { savedWagerLobbyIndex = base.ScrollView.SelectedIndex; WagerSync.TogglePublic(); ShowWagerLobby(); RestoreIndex(savedWagerLobbyIndex); }); base.ScrollView.AddButton((PhoneButton)(object)val9); bool flag = WagerLobbyManager.Players.Count > 1; foreach (WagerPlayer value2 in WagerLobbyManager.Players.Values) { if (!value2.IsReady) { flag = false; break; } } if (flag) { SimplePhoneButton val10 = PhoneUIUtility.CreateSimpleButton("Lock Lobby & Start Wager Race"); ((PhoneButton)val10).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val10).OnConfirm, (Action)delegate { WagerSync.LockLobby(); ShowWagerLobby(); }); base.ScrollView.AddButton((PhoneButton)(object)val10); return; } int num = 0; foreach (WagerPlayer value3 in WagerLobbyManager.Players.Values) { if (value3.IsReady) { num++; } } AddDescription($"Waiting for players to ready up ({num}/{WagerLobbyManager.Players.Count} ready)..."); } private void ShowWagerResult(ushort winnerId, int repChange, string winnerName) { currentScreen = AppScreen.WagerMain; base.ScrollView.RemoveAllButtons(); AddHeader("Wager Result"); ClientController instance = ClientController.Instance; if ((Object)(object)instance != (Object)null && instance.LocalID == winnerId) { SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton(string.Format("You won the wager race! +{1} REP", "#44FF44", repChange)); base.ScrollView.AddButton((PhoneButton)(object)val); } else { SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton(string.Format("{1} won the wager race! {2} REP", "#FF4444", winnerName, repChange)); base.ScrollView.AddButton((PhoneButton)(object)val2); } SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton(string.Format("Total REP: {1}", "#FFD700", GamblingManager.Rep)); base.ScrollView.AddButton((PhoneButton)(object)val3); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("OK"); ((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate { ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val4); SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Host Another Wager"); ((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate { ShowWagerMain(); }); base.ScrollView.AddButton((PhoneButton)(object)val5); } private void ShowStats() { currentScreen = AppScreen.Stats; 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("Stats"); GamblingSaveData instance = GamblingSaveData.Instance; AddDivider("Cases"); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"Total cases opened: {instance.TotalCasesOpened}"); base.ScrollView.AddButton((PhoneButton)(object)val2); if (instance.RarestItemRank > 0) { string rarityColor = GetRarityColor((RewardTier)Enum.Parse(typeof(RewardTier), instance.RarestItemRarity)); SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Rarest roll: [" + instance.RarestItemRarity + "] " + instance.RarestItemName + ""); base.ScrollView.AddButton((PhoneButton)(object)val3); } AddDivider("REP"); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton(string.Format("Total REP earned: {1}", "#44FF44", instance.TotalRepEarned)); base.ScrollView.AddButton((PhoneButton)(object)val4); SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton(string.Format("Total REP spent: {1}", "#FF4444", instance.TotalRepSpent)); base.ScrollView.AddButton((PhoneButton)(object)val5); long num = instance.TotalRepEarned - instance.TotalRepSpent; string arg = ((num >= 0) ? "#44FF44" : "#FF4444"); SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton($"Net REP: {num}"); base.ScrollView.AddButton((PhoneButton)(object)val6); AddDivider("Grace Races"); SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton(string.Format("Wins: {1} ", "#44FF44", instance.GraceWins) + string.Format("Losses: {1}", "#FF4444", instance.GraceLosses)); base.ScrollView.AddButton((PhoneButton)(object)val7); int num2 = instance.GraceWins + instance.GraceLosses; if (num2 > 0) { float num3 = (float)instance.GraceWins / (float)num2 * 100f; SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton($"Win rate: {num3:F1}%"); base.ScrollView.AddButton((PhoneButton)(object)val8); } AddDivider("Combo Score"); SimplePhoneButton val9 = PhoneUIUtility.CreateSimpleButton($"Biggest combo: {instance.BiggestComboScore:N0}"); base.ScrollView.AddButton((PhoneButton)(object)val9); AddDivider("Wager Races"); SimplePhoneButton val10 = PhoneUIUtility.CreateSimpleButton(string.Format("Wins: {1} ", "#44FF44", instance.WagerWins) + string.Format("Losses: {1}", "#FF4444", instance.WagerLosses)); base.ScrollView.AddButton((PhoneButton)(object)val10); if (instance.BiggestWagerWon > 0) { SimplePhoneButton val11 = PhoneUIUtility.CreateSimpleButton(string.Format("Biggest wager won: {1} REP", "#44FF44", instance.BiggestWagerWon)); base.ScrollView.AddButton((PhoneButton)(object)val11); } AddDivider("Blackjack"); SimplePhoneButton val12 = PhoneUIUtility.CreateSimpleButton(string.Format("Losses: {1}", "#FF4444", instance.BlackjackLosses)); base.ScrollView.AddButton((PhoneButton)(object)val12); string arg2 = ((instance.BlackjackNetRep >= 0) ? "#44FF44" : "#FF4444"); string arg3 = ((instance.BlackjackNetRep >= 0) ? "+" : ""); SimplePhoneButton val13 = PhoneUIUtility.CreateSimpleButton("Net REP from blackjack: " + $"{arg3}{instance.BlackjackNetRep}"); base.ScrollView.AddButton((PhoneButton)(object)val13); } } public enum BlackjackResult { None, PlayerWin, DealerWin, Push, PlayerBlackjack, PlayerBust, DealerBust } public class BlackjackGame { public List<(int value, string rank, string suit)> PlayerHand = new List<(int, string, string)>(); public List<(int value, string rank, string suit)> DealerHand = new List<(int, string, string)>(); public BlackjackResult Result = BlackjackResult.None; public bool PlayerTurn = true; public int Bet = 0; private List<(int value, string rank, string suit)> deck = new List<(int, string, string)>(); private static readonly string[] Ranks = new string[13] { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" }; private static readonly string[] Suits = new string[4] { "S", "H", "D", "C" }; private static readonly int[] Values = new int[13] { 11, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10 }; public void StartGame(int bet) { Bet = bet; PlayerHand.Clear(); DealerHand.Clear(); Result = BlackjackResult.None; PlayerTurn = true; BuildDeck(); ShuffleDeck(); PlayerHand.Add(DrawCard()); DealerHand.Add(DrawCard()); PlayerHand.Add(DrawCard()); DealerHand.Add(DrawCard()); if (CalculateHand(PlayerHand) == 21) { Result = BlackjackResult.PlayerBlackjack; PlayerTurn = false; } } public void Hit() { if (PlayerTurn) { PlayerHand.Add(DrawCard()); if (CalculateHand(PlayerHand) > 21) { Result = BlackjackResult.PlayerBust; PlayerTurn = false; } } } public void Stand() { if (PlayerTurn) { PlayerTurn = false; RunDealer(); } } private void RunDealer() { while (CalculateHand(DealerHand) < 17) { DealerHand.Add(DrawCard()); } int num = CalculateHand(PlayerHand); int num2 = CalculateHand(DealerHand); if (num2 > 21) { Result = BlackjackResult.DealerBust; } else if (num > num2) { Result = BlackjackResult.PlayerWin; } else if (num2 > num) { Result = BlackjackResult.DealerWin; } else { Result = BlackjackResult.Push; } } public static int CalculateHand(List<(int value, string rank, string suit)> hand) { int num = 0; int num2 = 0; foreach (var item in hand) { num += item.value; if (item.rank == "A") { num2++; } } while (num > 21 && num2 > 0) { num -= 10; num2--; } return num; } private void BuildDeck() { deck.Clear(); for (int i = 0; i < Ranks.Length; i++) { string[] suits = Suits; foreach (string item in suits) { deck.Add((Values[i], Ranks[i], item)); } } } private void ShuffleDeck() { for (int num = deck.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); (int, string, string) value = deck[num]; deck[num] = deck[index]; deck[index] = value; } } private (int, string, string) DrawCard() { (int, string, string) result = deck[0]; deck.RemoveAt(0); return result; } } public class BlackjackOverlay : MonoBehaviour { private const float CARD_WIDTH = 75f; private const float CARD_HEIGHT = 105f; private const float CARD_SPACING = 88f; private const float DEAL_DURATION = 0.3f; private const float FLIP_HALF = 0.12f; private static readonly Color COLOR_FELT = new Color(0.06f, 0.22f, 0.06f, 0.97f); private static readonly Color COLOR_CARD_FACE = new Color(0.97f, 0.97f, 0.95f, 1f); private static readonly Color COLOR_CARD_BACK = new Color(0.12f, 0.18f, 0.55f, 1f); private static readonly Color COLOR_RED_SUIT = new Color(0.85f, 0.1f, 0.1f, 1f); private static readonly Color COLOR_BLACK_SUIT = new Color(0.1f, 0.1f, 0.1f, 1f); private static readonly Color COLOR_WIN = new Color(0.2f, 1f, 0.3f, 1f); private static readonly Color COLOR_LOSE = new Color(1f, 0.2f, 0.2f, 1f); private static readonly Color COLOR_PUSH = new Color(0.8f, 0.8f, 0.8f, 1f); private static readonly Color COLOR_BLACKJACK = new Color(1f, 0.84f, 0f, 1f); private BlackjackGame game; private Action onInitialDealDone; private GameObject overlayRoot; private Transform deckTransform; private Transform dealerCardParent; private Transform playerCardParent; private TextMeshProUGUI dealerScoreText; private TextMeshProUGUI playerScoreText; private TextMeshProUGUI resultText; private List dealerCards = new List(); private List playerCards = new List(); public static BlackjackOverlay Create(MonoBehaviour host, BlackjackGame game, Action onInitialDealDone) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("BlackjackOverlay"); BlackjackOverlay blackjackOverlay = val.AddComponent(); blackjackOverlay.game = game; blackjackOverlay.onInitialDealDone = onInitialDealDone; blackjackOverlay.Build(); return blackjackOverlay; } public void TriggerHit(Action onAnimDone) { (int, string, string) card = game.PlayerHand[game.PlayerHand.Count - 1]; ((MonoBehaviour)this).StartCoroutine(DealCard(playerCards, playerCardParent, card, faceDown: false, delegate { UpdateScores(hideDealerSecond: true); onAnimDone?.Invoke(); })); } public void TriggerStand(int dealerCardsBefore, Action onAnimDone) { ((MonoBehaviour)this).StartCoroutine(DealerReveal(dealerCardsBefore, onAnimDone)); } public void TriggerResult(BlackjackResult result, int repChange, Action onAnimDone) { ((MonoBehaviour)this).StartCoroutine(ShowResult(result, repChange, onAnimDone)); } public void Cleanup() { if ((Object)(object)overlayRoot != (Object)null) { Object.Destroy((Object)(object)overlayRoot); } Object.Destroy((Object)(object)((Component)this).gameObject); } private void Build() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Expected O, but got Unknown //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0549: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Expected O, but got Unknown //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0642: Unknown result type (might be due to invalid IL or missing references) //IL_065a: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Expected O, but got Unknown //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06e6: Unknown result type (might be due to invalid IL or missing references) overlayRoot = new GameObject("BlackjackCanvas"); Canvas val = overlayRoot.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 200; CanvasScaler val2 = overlayRoot.AddComponent(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; overlayRoot.AddComponent(); GameObject val3 = new GameObject("Panel"); val3.transform.SetParent(overlayRoot.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = new Vector2(0.5f, 0.5f); val4.anchorMax = new Vector2(0.5f, 0.5f); val4.pivot = new Vector2(0.5f, 0.5f); val4.sizeDelta = new Vector2(560f, 440f); val4.anchoredPosition = Vector2.zero; ((Graphic)val3.AddComponent()).color = COLOR_FELT; CreateBorderFrame(val3.transform, 560f, 440f, 3f, new Color(0.3f, 0.5f, 0.3f)); GameObject val5 = CreateCardBackObject(75f, 105f); val5.transform.SetParent(val3.transform, false); RectTransform component = val5.GetComponent(); component.anchorMin = new Vector2(1f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = new Vector2(-50f, -65f); deckTransform = (Transform)(object)component; GameObject val6 = new GameObject("Title"); val6.transform.SetParent(val3.transform, false); RectTransform val7 = val6.AddComponent(); val7.anchorMin = new Vector2(0.5f, 1f); val7.anchorMax = new Vector2(0.5f, 1f); val7.pivot = new Vector2(0.5f, 1f); val7.sizeDelta = new Vector2(420f, 36f); val7.anchoredPosition = new Vector2(0f, -10f); TextMeshProUGUI val8 = val6.AddComponent(); ((TMP_Text)val8).fontSize = 22f; ((TMP_Text)val8).fontStyle = (FontStyles)1; ((TMP_Text)val8).alignment = (TextAlignmentOptions)514; ((MonoBehaviour)this).StartCoroutine(SweepLightText(val8, "MONKEY CASINO", new Color(0.15f, 0.6f, 0.15f), new Color(0.75f, 1f, 0.75f), 0.07f)); MakeLabel(val3.transform, $"BET: {game.Bet} REP", 16f, Color.yellow, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(220f, 26f), new Vector2(-110f, -50f)); MakeLabel(val3.transform, "DEALER", 17f, new Color(0.5f, 1f, 0.5f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(100f, 26f), new Vector2(15f, -80f)); dealerScoreText = MakeLabel(val3.transform, "", 20f, Color.white, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(80f, 26f), new Vector2(125f, -80f)); GameObject val9 = new GameObject("DealerCards"); val9.transform.SetParent(val3.transform, false); RectTransform val10 = val9.AddComponent(); val10.anchorMin = new Vector2(0.5f, 1f); val10.anchorMax = new Vector2(0.5f, 1f); val10.pivot = new Vector2(0.5f, 1f); val10.sizeDelta = new Vector2(500f, 105f); val10.anchoredPosition = new Vector2(0f, -110f); dealerCardParent = (Transform)(object)val10; MakeHorizontalLine(val3.transform, new Vector2(0f, -228f), 500f, new Color(0.3f, 0.5f, 0.3f, 0.6f)); MakeLabel(val3.transform, "YOU", 17f, new Color(0.5f, 1f, 0.5f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(60f, 26f), new Vector2(15f, -245f)); playerScoreText = MakeLabel(val3.transform, "", 20f, Color.white, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(80f, 26f), new Vector2(80f, -245f)); GameObject val11 = new GameObject("PlayerCards"); val11.transform.SetParent(val3.transform, false); RectTransform val12 = val11.AddComponent(); val12.anchorMin = new Vector2(0.5f, 1f); val12.anchorMax = new Vector2(0.5f, 1f); val12.pivot = new Vector2(0.5f, 1f); val12.sizeDelta = new Vector2(500f, 105f); val12.anchoredPosition = new Vector2(0f, -275f); playerCardParent = (Transform)(object)val12; GameObject val13 = new GameObject("ResultText"); val13.transform.SetParent(val3.transform, false); RectTransform val14 = val13.AddComponent(); val14.anchorMin = new Vector2(0.5f, 1f); val14.anchorMax = new Vector2(0.5f, 1f); val14.pivot = new Vector2(0.5f, 0.5f); val14.sizeDelta = new Vector2(460f, 55f); val14.anchoredPosition = new Vector2(0f, -228f); resultText = val13.AddComponent(); ((TMP_Text)resultText).text = ""; ((TMP_Text)resultText).fontSize = 28f; ((TMP_Text)resultText).fontStyle = (FontStyles)1; ((TMP_Text)resultText).alignment = (TextAlignmentOptions)514; val13.SetActive(false); ((MonoBehaviour)this).StartCoroutine(DealInitial()); } private IEnumerator DealInitial() { yield return ((MonoBehaviour)this).StartCoroutine(DealCard(playerCards, playerCardParent, game.PlayerHand[0], faceDown: false, null)); yield return (object)new WaitForSeconds(0.15f); yield return ((MonoBehaviour)this).StartCoroutine(DealCard(dealerCards, dealerCardParent, game.DealerHand[0], faceDown: false, null)); yield return (object)new WaitForSeconds(0.15f); yield return ((MonoBehaviour)this).StartCoroutine(DealCard(playerCards, playerCardParent, game.PlayerHand[1], faceDown: false, null)); yield return (object)new WaitForSeconds(0.15f); yield return ((MonoBehaviour)this).StartCoroutine(DealCard(dealerCards, dealerCardParent, game.DealerHand[1], faceDown: true, null)); UpdateScores(hideDealerSecond: true); onInitialDealDone?.Invoke(); } private IEnumerator DealerReveal(int dealerCardsBefore, Action onDone) { if (dealerCards.Count > 1) { yield return ((MonoBehaviour)this).StartCoroutine(FlipCard(dealerCards[1], game.DealerHand[1])); } UpdateScores(hideDealerSecond: false); for (int i = dealerCardsBefore; i < game.DealerHand.Count; i++) { yield return (object)new WaitForSeconds(0.2f); yield return ((MonoBehaviour)this).StartCoroutine(DealCard(dealerCards, dealerCardParent, game.DealerHand[i], faceDown: false, null)); UpdateScores(hideDealerSecond: false); } yield return (object)new WaitForSeconds(0.3f); onDone?.Invoke(); } private IEnumerator DealCard(List cardList, Transform parent, (int value, string rank, string suit) card, bool faceDown, Action onDone) { int index = cardList.Count; GameObject cardObj = (faceDown ? CreateCardBackObject(75f, 105f) : CreateCardFaceObject(card)); cardObj.transform.SetParent(overlayRoot.transform, false); RectTransform cardRt = cardObj.GetComponent(); Vector3 startPos = deckTransform.position; float targetLocalX = GetCardX(index, index + 1); Vector3 targetPos = parent.TransformPoint(new Vector3(targetLocalX, -52.5f, 0f)); ((Transform)cardRt).position = startPos; float elapsed = 0f; while (elapsed < 0.3f) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / 0.3f); float eased = 1f - Mathf.Pow(1f - t, 3f); ((Transform)cardRt).position = Vector3.Lerp(startPos, targetPos, eased); yield return null; } cardObj.transform.SetParent(parent, true); cardList.Add(cardObj); RepositionCards(cardList); onDone?.Invoke(); } private IEnumerator FlipCard(GameObject cardObj, (int value, string rank, string suit) card) { RectTransform rt = cardObj.GetComponent(); float elapsed = 0f; while (elapsed < 0.12f) { elapsed += Time.deltaTime; ((Transform)rt).localScale = new Vector3(Mathf.Lerp(1f, 0f, elapsed / 0.12f), 1f, 1f); yield return null; } for (int i = cardObj.transform.childCount - 1; i >= 0; i--) { Object.Destroy((Object)(object)((Component)cardObj.transform.GetChild(i)).gameObject); } BuildCardFace(cardObj.transform, card); elapsed = 0f; while (elapsed < 0.12f) { elapsed += Time.deltaTime; ((Transform)rt).localScale = new Vector3(Mathf.Lerp(0f, 1f, elapsed / 0.12f), 1f, 1f); yield return null; } ((Transform)rt).localScale = Vector3.one; } private IEnumerator ShowResult(BlackjackResult result, int repChange, Action onDone) { string msg; Color flashColor; switch (result) { case BlackjackResult.PlayerBlackjack: msg = $"BLACKJACK! +{game.Bet + repChange} REP"; flashColor = COLOR_BLACKJACK; break; case BlackjackResult.PlayerWin: msg = $"YOU WIN! +{game.Bet + repChange} REP"; flashColor = COLOR_WIN; break; case BlackjackResult.DealerBust: msg = $"DEALER BUSTS! +{game.Bet + repChange} REP"; flashColor = COLOR_WIN; break; case BlackjackResult.Push: msg = "PUSH - Bet returned"; flashColor = COLOR_PUSH; break; case BlackjackResult.PlayerBust: msg = $"BUST! -{game.Bet} REP"; flashColor = COLOR_LOSE; break; default: msg = $"DEALER WINS -{game.Bet} REP"; flashColor = COLOR_LOSE; break; } yield return ((MonoBehaviour)this).StartCoroutine(FlashCards(playerCards, flashColor)); ((TMP_Text)resultText).text = msg; ((Graphic)resultText).color = flashColor; ((Component)resultText).gameObject.SetActive(true); CanvasGroup cg = ((Component)resultText).GetComponent() ?? ((Component)resultText).gameObject.AddComponent(); cg.alpha = 0f; float elapsed = 0f; while (elapsed < 0.4f) { elapsed += Time.deltaTime; cg.alpha = Mathf.Clamp01(elapsed / 0.4f); yield return null; } yield return (object)new WaitForSeconds(1.5f); onDone?.Invoke(); } private IEnumerator FlashCards(List cards, Color flashColor) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) List bgs = new List(); foreach (GameObject card in cards) { Transform obj = card.transform.Find("BG"); Image bg = ((obj != null) ? ((Component)obj).GetComponent() : null); if ((Object)(object)bg != (Object)null) { bgs.Add(bg); } } float elapsed = 0f; while (elapsed < 0.5f) { elapsed += Time.deltaTime; float t = Mathf.Sin(elapsed / 0.5f * MathF.PI); foreach (Image bg2 in bgs) { ((Graphic)bg2).color = Color.Lerp(COLOR_CARD_FACE, flashColor, t * 0.4f); } yield return null; } foreach (Image bg3 in bgs) { ((Graphic)bg3).color = COLOR_CARD_FACE; } } private void RepositionCards(List cardList) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < cardList.Count; i++) { RectTransform component = cardList[i].GetComponent(); if ((Object)(object)component != (Object)null) { component.anchoredPosition = new Vector2(GetCardX(i, cardList.Count), -52.5f); } } } private float GetCardX(int index, int total) { return (float)(-(total - 1)) * 88f * 0.5f + (float)index * 88f; } private void UpdateScores(bool hideDealerSecond) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) if (hideDealerSecond && game.DealerHand.Count > 1) { List<(int, string, string)> hand = new List<(int, string, string)> { game.DealerHand[0] }; ((TMP_Text)dealerScoreText).text = $"{BlackjackGame.CalculateHand(hand)} + ?"; ((Graphic)dealerScoreText).color = Color.white; } else { int num = BlackjackGame.CalculateHand(game.DealerHand); ((TMP_Text)dealerScoreText).text = num.ToString(); ((Graphic)dealerScoreText).color = ((num > 21) ? COLOR_LOSE : Color.white); } int num2 = BlackjackGame.CalculateHand(game.PlayerHand); ((TMP_Text)playerScoreText).text = num2.ToString(); ((Graphic)playerScoreText).color = ((num2 > 21) ? COLOR_LOSE : ((num2 == 21) ? Color.yellow : Color.white)); } private GameObject CreateCardFaceObject((int value, string rank, string suit) card) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Card_" + card.rank + card.suit); val.AddComponent().sizeDelta = new Vector2(75f, 105f); BuildCardFace(val.transform, card); return val; } private void BuildCardFace(Transform parent, (int value, string rank, string suit) card) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) Color color = ((card.suit == "H" || card.suit == "D") ? COLOR_RED_SUIT : COLOR_BLACK_SUIT); GameObject val = new GameObject("BG"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; Vector2 offsetMin = (val2.offsetMax = Vector2.zero); val2.offsetMin = offsetMin; ((Graphic)val.AddComponent()).color = COLOR_CARD_FACE; CreateBorderFrame(parent, 75f, 105f, 1.5f, new Color(0.6f, 0.6f, 0.6f)); MakeCardText(parent, card.rank, 13f, (FontStyles)1, color, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(26f, 20f), new Vector2(5f, -4f), (TextAlignmentOptions)257); MakeCardText(parent, card.suit, 10f, (FontStyles)0, color, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(20f, 16f), new Vector2(6f, -20f), (TextAlignmentOptions)257); MakeCardText(parent, card.suit, 26f, (FontStyles)1, color, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(40f, 40f), Vector2.zero, (TextAlignmentOptions)514); GameObject val3 = MakeCardText(parent, card.rank, 13f, (FontStyles)1, color, new Vector2(1f, 0f), new Vector2(1f, 0f), new Vector2(26f, 20f), new Vector2(-18f, 14f), (TextAlignmentOptions)257); RectTransform component = val3.GetComponent(); component.pivot = new Vector2(0.5f, 0.5f); val3.transform.localRotation = Quaternion.Euler(0f, 0f, 180f); } private GameObject CreateCardBackObject(float w, float h) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0045: 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) //IL_005e: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CardBack"); val.AddComponent().sizeDelta = new Vector2(w, h); GameObject val2 = new GameObject("BG"); val2.transform.SetParent(val.transform, false); RectTransform val3 = val2.AddComponent(); val3.anchorMin = Vector2.zero; val3.anchorMax = Vector2.one; Vector2 offsetMin = (val3.offsetMax = Vector2.zero); val3.offsetMin = offsetMin; ((Graphic)val2.AddComponent()).color = COLOR_CARD_BACK; CreateBorderFrame(val.transform, w, h, 1.5f, new Color(0.3f, 0.4f, 0.8f)); GameObject val4 = new GameObject("Pattern"); val4.transform.SetParent(val.transform, false); RectTransform val5 = val4.AddComponent(); val5.anchorMin = new Vector2(0.12f, 0.12f); val5.anchorMax = new Vector2(0.88f, 0.88f); offsetMin = (val5.offsetMax = Vector2.zero); val5.offsetMin = offsetMin; val4.transform.localRotation = Quaternion.Euler(0f, 0f, 45f); ((Graphic)val4.AddComponent()).color = new Color(0.18f, 0.25f, 0.65f); return val; } private TextMeshProUGUI MakeLabel(Transform parent, string text, float fontSize, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 size, Vector2 pos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Label"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = anchorMin; val2.anchorMax = anchorMax; val2.pivot = anchorMin; val2.sizeDelta = size; val2.anchoredPosition = pos; TextMeshProUGUI val3 = val.AddComponent(); ((TMP_Text)val3).text = text; ((TMP_Text)val3).fontSize = fontSize; ((Graphic)val3).color = color; ((TMP_Text)val3).alignment = (TextAlignmentOptions)513; return val3; } private GameObject MakeCardText(Transform parent, string text, float fontSize, FontStyles style, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 size, Vector2 pos, TextAlignmentOptions align) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("CardText"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = anchorMin; val2.anchorMax = anchorMax; val2.pivot = anchorMin; val2.sizeDelta = size; val2.anchoredPosition = pos; TextMeshProUGUI val3 = val.AddComponent(); ((TMP_Text)val3).text = text; ((TMP_Text)val3).fontSize = fontSize; ((TMP_Text)val3).fontStyle = style; ((Graphic)val3).color = color; ((TMP_Text)val3).alignment = align; return val; } private void CreateBorderFrame(Transform parent, float w, float h, float t, Color color) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) (Vector2, Vector2, Vector2, Vector2)[] array = new(Vector2, Vector2, Vector2, Vector2)[4] { (new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 0f - t), new Vector2(0f, 0f)), (new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 0f), new Vector2(0f, t)), (new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(t, 0f)), (new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f - t, 0f), new Vector2(0f, 0f)) }; (Vector2, Vector2, Vector2, Vector2)[] array2 = array; for (int i = 0; i < array2.Length; i++) { (Vector2, Vector2, Vector2, Vector2) tuple = array2[i]; GameObject val = new GameObject("Border"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = tuple.Item1; val2.anchorMax = tuple.Item2; val2.offsetMin = tuple.Item3; val2.offsetMax = tuple.Item4; ((Graphic)val.AddComponent()).color = color; } } private void MakeHorizontalLine(Transform parent, Vector2 pos, float width, Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_002c: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Line"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = new Vector2(0.5f, 1f); val2.anchorMax = new Vector2(0.5f, 1f); val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = new Vector2(width, 1f); val2.anchoredPosition = pos; ((Graphic)val.AddComponent()).color = color; } private IEnumerator SweepLightText(TextMeshProUGUI tmp, string text, Color baseColor, Color lightColor, float speed = 0.08f) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) int len = text.Length; int frame = 0; int totalFrames = len + 6; while ((Object)(object)tmp != (Object)null && (Object)(object)((Component)tmp).gameObject != (Object)null && ((Component)tmp).gameObject.activeInHierarchy) { StringBuilder sb = new StringBuilder(); int lightPos = frame % totalFrames - 3; for (int i = 0; i < len; i++) { if (text[i] == ' ') { sb.Append(' '); continue; } sb.Append($" lightColor, 1 => Color.Lerp(lightColor, baseColor, 0.55f), 2 => Color.Lerp(lightColor, baseColor, 0.85f), _ => baseColor, }))}>{text[i]}"); } ((TMP_Text)tmp).text = sb.ToString(); frame++; yield return (object)new WaitForSeconds(speed); } } } public class CaseOpeningOverlay : MonoBehaviour { private const int VisibleCount = 7; private const float ItemWidth = 120f; private const float ItemHeight = 140f; private const float ItemSpacing = 12f; private const float PanelWidth = 924f; private const float PanelHeight = 200f; private const float MultiItemWidth = 100f; private const float MultiItemHeight = 80f; private const float MultiItemSpacing = 8f; private const int MultiVisibleCount = 7; private const float MultiPanelWidth = 756f; private const float MultiColumnGap = 20f; private const float MultiStaggerDelay = 0.4f; private static readonly Color ColorCommon = new Color(0.27f, 0.53f, 1f); private static readonly Color ColorRare = new Color(0.8f, 0.27f, 1f); private static readonly Color ColorEpic = new Color(1f, 0.27f, 0.27f); private static readonly Color ColorLegendary = new Color(1f, 0.84f, 0f); private static readonly Color ColorMythic = new Color(1f, 1f, 1f); private GameObject overlayRoot; private RectTransform reelStrip; private RectTransform reelContainerRt; private RectTransform dividerRect; private Action onComplete; private Action> onMultiComplete; private bool isSpinning = false; private bool isMultiOpen = false; private List multiReelStrips = new List(); private List multiDividers = new List(); private bool fastMode = false; private static RewardTier RollRarity() { int num = Random.Range(0, 1000); if (num < 1) { return RewardTier.Mythic; } if (num < 68) { return RewardTier.Legendary; } if (num < 201) { return RewardTier.Epic; } if (num < 468) { return RewardTier.Rare; } return RewardTier.Common; } public static CaseOpeningOverlay Create(MonoBehaviour host, bool fast, Action onComplete) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("CaseOpeningOverlay"); CaseOpeningOverlay caseOpeningOverlay = val.AddComponent(); caseOpeningOverlay.onComplete = onComplete; caseOpeningOverlay.fastMode = fast; caseOpeningOverlay.Build(); return caseOpeningOverlay; } public static CaseOpeningOverlay CreateMulti(MonoBehaviour host, bool fast, Action> onMultiComplete) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("CaseOpeningOverlayMulti"); CaseOpeningOverlay caseOpeningOverlay = val.AddComponent(); caseOpeningOverlay.onMultiComplete = onMultiComplete; caseOpeningOverlay.isMultiOpen = true; caseOpeningOverlay.fastMode = fast; caseOpeningOverlay.BuildMulti(); return caseOpeningOverlay; } private void Build(int rollCount = 1) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) overlayRoot = new GameObject("CaseCanvas"); Canvas val = overlayRoot.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 200; CanvasScaler val2 = overlayRoot.AddComponent(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; overlayRoot.AddComponent(); float num = 210f * (float)rollCount + 20f; GameObject val3 = new GameObject("Panel"); val3.transform.SetParent(overlayRoot.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = new Vector2(0.5f, 0.5f); val4.anchorMax = new Vector2(0.5f, 0.5f); val4.pivot = new Vector2(0.5f, 0.5f); val4.sizeDelta = new Vector2(964f, num); val4.anchoredPosition = Vector2.zero; ((Graphic)val3.AddComponent()).color = new Color(0.05f, 0.05f, 0.05f, 0.95f); GameObject val5 = new GameObject("ReelContainer"); val5.transform.SetParent(val3.transform, false); RectTransform val6 = val5.AddComponent(); val6.anchorMin = new Vector2(0.5f, 0.5f); val6.anchorMax = new Vector2(0.5f, 0.5f); val6.pivot = new Vector2(0.5f, 0.5f); val6.sizeDelta = new Vector2(924f, num - 20f); val6.anchoredPosition = Vector2.zero; reelContainerRt = val6; BuildReel(val5, 0); ((MonoBehaviour)this).StartCoroutine(SpinReel()); } private void BuildReel(GameObject container, int reelIndex) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00ee: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) float num = 210f; float num2 = 0f - (float)reelIndex * num; GameObject val = new GameObject($"Viewport_{reelIndex}"); val.transform.SetParent(container.transform, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = new Vector2(0.5f, 1f); val2.anchorMax = new Vector2(0.5f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = new Vector2(924f, 160f); val2.anchoredPosition = new Vector2(0f, num2); val.AddComponent(); GameObject val3 = new GameObject($"ReelStrip_{reelIndex}"); val3.transform.SetParent(val.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = new Vector2(0f, 0.5f); val4.anchorMax = new Vector2(0f, 0.5f); val4.pivot = new Vector2(0f, 0.5f); val4.anchoredPosition = Vector2.zero; reelStrip = val4; GameObject val5 = new GameObject("Divider"); val5.transform.SetParent(container.transform, false); RectTransform val6 = val5.AddComponent(); val6.anchorMin = new Vector2(0.5f, 1f); val6.anchorMax = new Vector2(0.5f, 1f); val6.pivot = new Vector2(0.5f, 0.5f); val6.sizeDelta = new Vector2(2f, 164f); val6.anchoredPosition = new Vector2(0f, num2 - 70f - 10f); ((Graphic)val5.AddComponent()).color = Color.white; dividerRect = val6; } private void BuildMulti() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) overlayRoot = new GameObject("CaseCanvas"); Canvas val = overlayRoot.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 200; CanvasScaler val2 = overlayRoot.AddComponent(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; overlayRoot.AddComponent(); float num = 796f; float num2 = num * 2f + 20f; float num3 = 110f; float num4 = num3 * 5f + 40f; GameObject val3 = new GameObject("Panel"); val3.transform.SetParent(overlayRoot.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = new Vector2(0.5f, 0.5f); val4.anchorMax = new Vector2(0.5f, 0.5f); val4.pivot = new Vector2(0.5f, 0.5f); val4.sizeDelta = new Vector2(num2, num4); val4.anchoredPosition = Vector2.zero; ((Graphic)val3.AddComponent()).color = new Color(0.05f, 0.05f, 0.05f, 0.95f); for (int i = 0; i < 2; i++) { float num5 = ((i == 0) ? (0f - (num * 0.5f + 10f)) : (num * 0.5f + 10f)); for (int j = 0; j < 5; j++) { int num6 = i * 5 + j; float num7 = num4 * 0.5f - 20f - (float)j * num3 - num3 * 0.5f; GameObject val5 = new GameObject($"Viewport_{num6}"); val5.transform.SetParent(val3.transform, false); RectTransform val6 = val5.AddComponent(); val6.anchorMin = new Vector2(0.5f, 0.5f); val6.anchorMax = new Vector2(0.5f, 0.5f); val6.pivot = new Vector2(0.5f, 0.5f); val6.sizeDelta = new Vector2(756f, 90f); val6.anchoredPosition = new Vector2(num5, num7); val5.AddComponent(); GameObject val7 = new GameObject($"ReelStrip_{num6}"); val7.transform.SetParent(val5.transform, false); RectTransform val8 = val7.AddComponent(); val8.anchorMin = new Vector2(0f, 0.5f); val8.anchorMax = new Vector2(0f, 0.5f); val8.pivot = new Vector2(0f, 0.5f); val8.anchoredPosition = Vector2.zero; multiReelStrips.Add(val8); GameObject val9 = new GameObject($"Divider_{num6}"); val9.transform.SetParent(val3.transform, false); RectTransform val10 = val9.AddComponent(); val10.anchorMin = new Vector2(0.5f, 0.5f); val10.anchorMax = new Vector2(0.5f, 0.5f); val10.pivot = new Vector2(0.5f, 0.5f); val10.sizeDelta = new Vector2(2f, 94f); val10.anchoredPosition = new Vector2(num5, num7); ((Graphic)val9.AddComponent()).color = Color.white; multiDividers.Add(val10); } } ((MonoBehaviour)this).StartCoroutine(SpinMultiReel()); } private IEnumerator SpinReel() { if (isSpinning) { yield break; } isSpinning = true; float stepX = 132f; RewardTier result = RollRarity(); List items = new List(); int totalItems = 60; for (int i = 0; i < totalItems; i++) { items.Add(RollRarity()); } int landingIndex = totalItems - 11; items[landingIndex] = result; for (int j = 0; j < items.Count; j++) { GameObject item = CreateReelItem(items[j]); item.transform.SetParent((Transform)(object)reelStrip, false); item.GetComponent().anchoredPosition = new Vector2((float)j * stepX, 0f); } reelStrip.sizeDelta = new Vector2((float)items.Count * stepX, 140f); float targetX = 462f - (float)landingIndex * stepX - 120f; float duration = (fastMode ? 2.5f : 8f); float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float t = elapsed / duration; float eased = 1f - Mathf.Pow(1f - t, 3f); reelStrip.anchoredPosition = new Vector2(Mathf.Lerp(0f, targetX, eased), 0f); yield return null; } reelStrip.anchoredPosition = new Vector2(targetX, 0f); Canvas.ForceUpdateCanvases(); float dividerWorldX = ((Transform)dividerRect).position.x; float minDist = float.MaxValue; int closestIndex = 0; for (int k = 0; k < ((Transform)reelStrip).childCount; k++) { Transform child = ((Transform)reelStrip).GetChild(k); RectTransform child2 = (RectTransform)(object)((child is RectTransform) ? child : null); float dist = Mathf.Abs(((Transform)child2).position.x - dividerWorldX); if (dist < minDist) { minDist = dist; closestIndex = k; } } RewardTier visualResult = items[closestIndex]; yield return ((MonoBehaviour)this).StartCoroutine(PlayWinReveal(closestIndex)); GamblingManager.ApplyReward(visualResult); EffectDefinition wonEffect = GamblingManager.RollEffectFromPool(visualResult); yield return (object)new WaitForSeconds(fastMode ? 0.5f : 1.5f); onComplete?.Invoke(visualResult, wonEffect); Object.Destroy((Object)(object)overlayRoot); Object.Destroy((Object)(object)((Component)this).gameObject); } private IEnumerator SpinMultiReel() { float stepX = 108f; int totalItems = 40; int landingIndex = totalItems - 8; List rolledTiers = new List(); for (int i = 0; i < 10; i++) { rolledTiers.Add(RollRarity()); } RewardTier[] visualResults = new RewardTier[10]; bool[] reelDone = new bool[10]; for (int j = 0; j < 10; j++) { int capturedI = j; ((MonoBehaviour)this).StartCoroutine(SpinSingleMultiReel(multiReelStrips[capturedI], multiDividers[capturedI], rolledTiers[capturedI], stepX, totalItems, landingIndex, delegate(RewardTier visualResult) { visualResults[capturedI] = visualResult; reelDone[capturedI] = true; })); yield return (object)new WaitForSeconds(0.4f); } bool allDone = false; while (!allDone) { allDone = true; for (int i2 = 0; i2 < 10; i2++) { if (!reelDone[i2]) { allDone = false; break; } } yield return null; } yield return (object)new WaitForSeconds(3f); List<(RewardTier, EffectDefinition)> results = new List<(RewardTier, EffectDefinition)>(); for (int i3 = 0; i3 < 10; i3++) { results.Add(new ValueTuple(item2: GamblingManager.RollEffectFromPool(visualResults[i3]), item1: visualResults[i3])); } onMultiComplete?.Invoke(results); Object.Destroy((Object)(object)overlayRoot); Object.Destroy((Object)(object)((Component)this).gameObject); } private IEnumerator SpinSingleMultiReel(RectTransform strip, RectTransform divider, RewardTier result, float stepX, int totalItems, int landingIndex, Action onDone) { List items = new List(); for (int i = 0; i < totalItems; i++) { items.Add(RollRarity()); } items[landingIndex] = result; for (int j = 0; j < items.Count; j++) { GameObject item = CreateMultiReelItem(items[j]); item.transform.SetParent((Transform)(object)strip, false); item.GetComponent().anchoredPosition = new Vector2((float)j * stepX, 0f); } strip.sizeDelta = new Vector2((float)items.Count * stepX, 80f); float targetX = 378f - (float)landingIndex * stepX - 100f; float duration = (fastMode ? 1.5f : 5f); float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float t = elapsed / duration; float eased = 1f - Mathf.Pow(1f - t, 3f); strip.anchoredPosition = new Vector2(Mathf.Lerp(0f, targetX, eased), 0f); yield return null; } strip.anchoredPosition = new Vector2(targetX, 0f); Canvas.ForceUpdateCanvases(); float dividerWorldX = ((Transform)divider).position.x; float minDist = float.MaxValue; int closestIndex = 0; for (int k = 0; k < ((Transform)strip).childCount; k++) { Transform child = ((Transform)strip).GetChild(k); RectTransform child2 = (RectTransform)(object)((child is RectTransform) ? child : null); float dist = Mathf.Abs(((Transform)child2).position.x - dividerWorldX); if (dist < minDist) { minDist = dist; closestIndex = k; } } RewardTier visualResult = items[closestIndex]; onDone?.Invoke(visualResult); } private IEnumerator PlayWinReveal(int winnerIndex) { float duration = 0.55f; float elapsed = 0f; int count = ((Transform)reelStrip).childCount; RectTransform[] children = (RectTransform[])(object)new RectTransform[count]; CanvasGroup[] groups = (CanvasGroup[])(object)new CanvasGroup[count]; Vector3[] startScales = (Vector3[])(object)new Vector3[count]; for (int i = 0; i < count; i++) { ref RectTransform reference = ref children[i]; Transform child = ((Transform)reelStrip).GetChild(i); reference = (RectTransform)(object)((child is RectTransform) ? child : null); startScales[i] = ((Transform)children[i]).localScale; groups[i] = ((Component)children[i]).GetComponent(); if ((Object)(object)groups[i] == (Object)null) { groups[i] = ((Component)children[i]).gameObject.AddComponent(); } } Vector3 winnerTargetScale = new Vector3(1.18f, 1.18f, 1f); Vector3 surroundTargetScale = new Vector3(0.82f, 0.82f, 1f); Transform winnerChild = ((Transform)reelStrip).GetChild(winnerIndex); Transform winnerCard = ((winnerChild != null) ? winnerChild.Find("Card") : null); if ((Object)(object)winnerCard != (Object)null) { CreateOutlineFrame(winnerCard, 3f, new Color(1f, 0.85f, 0f, 0f)); } while (elapsed < duration) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / duration); float e = 1f - Mathf.Pow(1f - t, 3f); for (int j = 0; j < count; j++) { if (j == winnerIndex) { ((Transform)children[j]).localScale = Vector3.Lerp(startScales[j], winnerTargetScale, e); groups[j].alpha = 1f; } else { ((Transform)children[j]).localScale = Vector3.Lerp(startScales[j], surroundTargetScale, e); groups[j].alpha = Mathf.Lerp(1f, 0.28f, e); } } if ((Object)(object)winnerCard != (Object)null) { Color edgeColor = new Color(1f, 0.85f, 0f, Mathf.Lerp(0f, 1f, e)); Image[] componentsInChildren = ((Component)winnerCard).GetComponentsInChildren(); foreach (Image edge in componentsInChildren) { if (((Object)((Component)edge).gameObject).name == "OutlineEdge") { ((Graphic)edge).color = edgeColor; } } } yield return null; } yield return (object)new WaitForSeconds(1f); } private Image CreateOutlineFrame(Transform parent, float thickness, Color startColor) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) Image val = null; (Vector2, Vector2, Vector2, Vector2)[] array = new(Vector2, Vector2, Vector2, Vector2)[4] { (new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f - thickness, 0f), new Vector2(thickness, thickness)), (new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f - thickness, 0f - thickness), new Vector2(thickness, 0f)), (new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f - thickness, 0f - thickness), new Vector2(0f, thickness)), (new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 0f - thickness), new Vector2(thickness, thickness)) }; (Vector2, Vector2, Vector2, Vector2)[] array2 = array; for (int i = 0; i < array2.Length; i++) { (Vector2, Vector2, Vector2, Vector2) tuple = array2[i]; GameObject val2 = new GameObject("OutlineEdge"); val2.transform.SetParent(parent, false); RectTransform val3 = val2.AddComponent(); val3.anchorMin = tuple.Item1; val3.anchorMax = tuple.Item2; val3.offsetMin = tuple.Item3; val3.offsetMax = tuple.Item4; Image val4 = val2.AddComponent(); ((Graphic)val4).color = startColor; if ((Object)(object)val == (Object)null) { val = val4; } } return val; } private GameObject CreateReelItem(RewardTier tier) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0119: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Expected O, but got Unknown //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } Color val = (Color)(tier switch { RewardTier.Common => ColorCommon, RewardTier.Rare => ColorRare, RewardTier.Epic => ColorEpic, RewardTier.Legendary => ColorLegendary, RewardTier.Mythic => ColorMythic, _ => Color.white, }); if (1 == 0) { } Color color = val; if (1 == 0) { } string text = tier switch { RewardTier.Common => "COM", RewardTier.Rare => "RARE", RewardTier.Epic => "EPIC", RewardTier.Legendary => "LEG", RewardTier.Mythic => "", _ => "?", }; if (1 == 0) { } string text2 = text; GameObject val2 = new GameObject($"Item_{tier}"); RectTransform val3 = val2.AddComponent(); val3.sizeDelta = new Vector2(120f, 140f); GameObject val4 = new GameObject("Card"); val4.transform.SetParent(val2.transform, false); RectTransform val5 = val4.AddComponent(); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.offsetMin = Vector2.zero; val5.offsetMax = new Vector2(0f, -20f); ((Graphic)val4.AddComponent()).color = new Color(0.15f, 0.15f, 0.15f, 1f); if (tier == RewardTier.Mythic && (Object)(object)GamblingPlugin.CrownSprite != (Object)null) { GameObject val6 = new GameObject("CrownImage"); val6.transform.SetParent(val4.transform, false); RectTransform val7 = val6.AddComponent(); val7.anchorMin = new Vector2(0.1f, 0.1f); val7.anchorMax = new Vector2(0.9f, 0.9f); val7.offsetMin = Vector2.zero; val7.offsetMax = Vector2.zero; Image val8 = val6.AddComponent(); val8.sprite = GamblingPlugin.CrownSprite; val8.preserveAspect = true; } else { GameObject val9 = new GameObject("Label"); val9.transform.SetParent(val4.transform, false); RectTransform val10 = val9.AddComponent(); val10.anchorMin = Vector2.zero; val10.anchorMax = Vector2.one; val10.offsetMin = Vector2.zero; val10.offsetMax = Vector2.zero; TextMeshProUGUI val11 = val9.AddComponent(); ((TMP_Text)val11).text = text2; ((TMP_Text)val11).alignment = (TextAlignmentOptions)514; ((TMP_Text)val11).fontSize = 18f; ((Graphic)val11).color = Color.white; } GameObject val12 = new GameObject("RarityBar"); val12.transform.SetParent(val2.transform, false); RectTransform val13 = val12.AddComponent(); val13.anchorMin = new Vector2(0f, 0f); val13.anchorMax = new Vector2(1f, 0f); val13.pivot = new Vector2(0.5f, 0f); val13.sizeDelta = new Vector2(0f, 18f); val13.anchoredPosition = Vector2.zero; ((Graphic)val12.AddComponent()).color = color; return val2; } private GameObject CreateMultiReelItem(RewardTier tier) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027a: 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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } Color val = (Color)(tier switch { RewardTier.Common => ColorCommon, RewardTier.Rare => ColorRare, RewardTier.Epic => ColorEpic, RewardTier.Legendary => ColorLegendary, RewardTier.Mythic => ColorMythic, _ => Color.white, }); if (1 == 0) { } Color color = val; if (1 == 0) { } string text = tier switch { RewardTier.Common => "COM", RewardTier.Rare => "RARE", RewardTier.Epic => "EPIC", RewardTier.Legendary => "LEG", RewardTier.Mythic => "", _ => "?", }; if (1 == 0) { } string text2 = text; GameObject val2 = new GameObject($"Item_{tier}"); val2.AddComponent().sizeDelta = new Vector2(100f, 80f); GameObject val3 = new GameObject("Card"); val3.transform.SetParent(val2.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = Vector2.zero; val4.offsetMax = new Vector2(0f, -14f); ((Graphic)val3.AddComponent()).color = new Color(0.15f, 0.15f, 0.15f, 1f); if (tier == RewardTier.Mythic && (Object)(object)GamblingPlugin.CrownSprite != (Object)null) { GameObject val5 = new GameObject("CrownImage"); val5.transform.SetParent(val3.transform, false); RectTransform val6 = val5.AddComponent(); val6.anchorMin = new Vector2(0.1f, 0.1f); val6.anchorMax = new Vector2(0.9f, 0.9f); val6.offsetMin = Vector2.zero; val6.offsetMax = Vector2.zero; Image val7 = val5.AddComponent(); val7.sprite = GamblingPlugin.CrownSprite; val7.preserveAspect = true; } else { GameObject val8 = new GameObject("Label"); val8.transform.SetParent(val3.transform, false); RectTransform val9 = val8.AddComponent(); val9.anchorMin = Vector2.zero; val9.anchorMax = Vector2.one; val9.offsetMin = Vector2.zero; val9.offsetMax = Vector2.zero; TextMeshProUGUI val10 = val8.AddComponent(); ((TMP_Text)val10).text = text2; ((TMP_Text)val10).alignment = (TextAlignmentOptions)514; ((TMP_Text)val10).fontSize = 14f; ((Graphic)val10).color = Color.white; } GameObject val11 = new GameObject("RarityBar"); val11.transform.SetParent(val2.transform, false); RectTransform val12 = val11.AddComponent(); val12.anchorMin = new Vector2(0f, 0f); val12.anchorMax = new Vector2(1f, 0f); val12.pivot = new Vector2(0.5f, 0f); val12.sizeDelta = new Vector2(0f, 12f); val12.anchoredPosition = Vector2.zero; ((Graphic)val11.AddComponent()).color = color; return val2; } } public static class EffectTriggerManager { private static Dictionary activeLoopingEffects = new Dictionary(); private static Dictionary> conditionalLoopingEffects = new Dictionary>(); private static Transform cachedPlayerTransform; private static float transformCacheTimer = 0f; private const float TRANSFORM_CACHE_INTERVAL = 1f; private static Dictionary lastTriggerTime = new Dictionary(); private static readonly Dictionary triggerCooldowns = new Dictionary { { EffectTrigger.OnSlide, 2f }, { EffectTrigger.OnSpray, 1f }, { EffectTrigger.OnSprayAttempt, 0.5f }, { EffectTrigger.OnJump, 0.5f }, { EffectTrigger.OnLand, 0.5f }, { EffectTrigger.OnWallPlant, 0.5f }, { EffectTrigger.OnBoostTrick, 0.5f }, { EffectTrigger.OnBoost, 1f }, { EffectTrigger.OnGraceEnd, 3f }, { EffectTrigger.OnGraceStart, 5f }, { EffectTrigger.OnDeath, 3f }, { EffectTrigger.OnEmote, 1f }, { EffectTrigger.OnGrind, 0.5f }, { EffectTrigger.OnManual, 0.5f }, { EffectTrigger.OnComboBank, 1f } }; public static void RefreshLoopingEffects() { //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) List list = new List(); foreach (KeyValuePair activeLoopingEffect in activeLoopingEffects) { if (!GamblingSaveData.Instance.IsEquipped(activeLoopingEffect.Key)) { if ((Object)(object)activeLoopingEffect.Value != (Object)null) { Object.Destroy((Object)(object)activeLoopingEffect.Value); } list.Add(activeLoopingEffect.Key); } } foreach (string item in list) { activeLoopingEffects.Remove(item); } Vector3 localOffset = default(Vector3); foreach (string equippedEffectId in GamblingSaveData.Instance.EquippedEffectIds) { EffectDefinition effectDefinition = EffectRegistry.Get(equippedEffectId); if (effectDefinition == null || effectDefinition.Trigger != EffectTrigger.Looping || activeLoopingEffects.ContainsKey(equippedEffectId)) { continue; } Transform val = GetCachedPlayerTransform(); if ((Object)(object)val == (Object)null) { continue; } if (effectDefinition.IsPassive) { if (equippedEffectId == "special_badge") { ((Vector3)(ref localOffset))..ctor(0f, GamblingPlugin.CrownHeightOffset.Value - 0.4f, -0.35f); } else if (equippedEffectId == "special_glasses") { ((Vector3)(ref localOffset))..ctor(0f, GamblingPlugin.CrownHeightOffset.Value - 0.2f, 0.25f); } else { ((Vector3)(ref localOffset))..ctor(0f, GamblingPlugin.CrownHeightOffset.Value, 0f); } } else { localOffset = GetOffsetForPosition(effectDefinition.Position) + effectDefinition.PositionOffset; } GameObject val2 = PlayerEffects.SpawnPersistentEffectByName(effectDefinition.PrefabName, val, localOffset); if ((Object)(object)val2 != (Object)null) { if (effectDefinition.IsPassive) { val2.transform.localRotation = Quaternion.Euler(GamblingPlugin.CrownRotationX.Value, GamblingPlugin.CrownRotationY.Value, 0f); PassiveSync.ApplyPassiveColor(equippedEffectId, val2); } activeLoopingEffects[equippedEffectId] = val2; } } } public static void PlayOneShot(EffectTrigger trigger) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; float value; float num = (triggerCooldowns.TryGetValue(trigger, out value) ? value : 1f); if (lastTriggerTime.TryGetValue(trigger, out var value2) && time - value2 < num) { return; } lastTriggerTime[trigger] = time; foreach (string equippedEffectId in GamblingSaveData.Instance.EquippedEffectIds) { EffectDefinition effectDefinition = EffectRegistry.Get(equippedEffectId); if (effectDefinition != null && effectDefinition.Trigger == trigger) { Transform val = GetCachedPlayerTransform(); if (!((Object)(object)val == (Object)null)) { Vector3 localOffset = GetOffsetForPosition(effectDefinition.Position) + effectDefinition.PositionOffset; PlayerEffects.SpawnEffectByName(effectDefinition.PrefabName, val, localOffset, 5f); } } } } public static void StartConditionalLooping(EffectTrigger trigger) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00c1: Unknown result type (might be due to invalid IL or missing references) if (!conditionalLoopingEffects.ContainsKey(trigger)) { conditionalLoopingEffects[trigger] = new Dictionary(); } Transform val = GetCachedPlayerTransform(); if ((Object)(object)val == (Object)null) { return; } foreach (string equippedEffectId in GamblingSaveData.Instance.EquippedEffectIds) { EffectDefinition effectDefinition = EffectRegistry.Get(equippedEffectId); if (effectDefinition != null && effectDefinition.Trigger == trigger && !conditionalLoopingEffects[trigger].ContainsKey(equippedEffectId)) { Vector3 localOffset = GetOffsetForPosition(effectDefinition.Position) + effectDefinition.PositionOffset; GameObject val2 = PlayerEffects.SpawnPersistentEffectByName(effectDefinition.PrefabName, val, localOffset); if ((Object)(object)val2 != (Object)null) { conditionalLoopingEffects[trigger][equippedEffectId] = val2; } } } } public static void StopConditionalLooping(EffectTrigger trigger) { if (!conditionalLoopingEffects.ContainsKey(trigger)) { return; } foreach (KeyValuePair item in conditionalLoopingEffects[trigger]) { if ((Object)(object)item.Value != (Object)null) { Object.Destroy((Object)(object)item.Value); } } conditionalLoopingEffects[trigger].Clear(); } public static Vector3 GetOffsetForPosition(EffectPosition pos) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) return (Vector3)(pos switch { EffectPosition.Feet => new Vector3(0f, 0.1f, 0f), EffectPosition.Torso => new Vector3(0f, 1f, 0f), EffectPosition.AboveHead => new Vector3(0f, 2.2f, 0f), _ => Vector3.zero, }); } public static void ClearAll() { foreach (KeyValuePair activeLoopingEffect in activeLoopingEffects) { if ((Object)(object)activeLoopingEffect.Value != (Object)null) { Object.Destroy((Object)(object)activeLoopingEffect.Value); } } activeLoopingEffects.Clear(); foreach (Dictionary value in conditionalLoopingEffects.Values) { foreach (KeyValuePair item in value) { if ((Object)(object)item.Value != (Object)null) { Object.Destroy((Object)(object)item.Value); } } } conditionalLoopingEffects.Clear(); } public static Transform GetCachedPlayerTransform() { transformCacheTimer -= Time.deltaTime; if ((Object)(object)cachedPlayerTransform == (Object)null || transformCacheTimer <= 0f) { cachedPlayerTransform = PlayerEffects.GetLocalPlayerTransform(); transformCacheTimer = 1f; } return cachedPlayerTransform; } } public static class GamblingManager { public static int ConsecutiveLosses = 0; public static float ScoreMultiplier = 1f; public static float SpeedBonus = 0f; public static float BuffTimeRemaining = 0f; public static int MaxPossibleScore = 0; public static int SpinCost => 100; public static int Rep { get { return GamblingSaveData.Instance?.Rep ?? 0; } set { if (GamblingSaveData.Instance != null) { int num = value - GamblingSaveData.Instance.Rep; if (num > 0) { GamblingSaveData.Instance.TotalRepEarned += num; } else if (num < 0) { GamblingSaveData.Instance.TotalRepSpent += -num; } GamblingSaveData.Instance.Rep = value; GamblingSaveData.Instance.MarkDirty(); AppGambling.RefreshRepDisplay(); } } } public static void ApplyReward(RewardTier tier) { switch (tier) { case RewardTier.Common: ScoreMultiplier = 1.2f; SpeedBonus = 0f; BuffTimeRemaining = 30f; break; case RewardTier.Rare: ScoreMultiplier = 1.5f; SpeedBonus = 0f; BuffTimeRemaining = 45f; break; case RewardTier.Epic: ScoreMultiplier = 1.5f; SpeedBonus = 2f; BuffTimeRemaining = 45f; break; case RewardTier.Legendary: ScoreMultiplier = 2f; SpeedBonus = 4f; BuffTimeRemaining = 60f; break; case RewardTier.Mythic: ScoreMultiplier = 2f; SpeedBonus = 4f; BuffTimeRemaining = 60f; break; } } public static void Tick(float deltaTime) { if (!(BuffTimeRemaining <= 0f)) { BuffTimeRemaining -= deltaTime; if (BuffTimeRemaining <= 0f) { ScoreMultiplier = 1f; SpeedBonus = 0f; } } } public static int GetSellValue(RewardTier rarity) { return rarity switch { RewardTier.Common => 15, RewardTier.Rare => 60, RewardTier.Epic => 220, RewardTier.Legendary => 400, RewardTier.Mythic => 5000, RewardTier.Special => 0, _ => 0, }; } public static EffectDefinition RollEffectFromPool(RewardTier rarity) { List pool = EffectRegistry.GetPool(rarity); if (pool.Count == 0) { return null; } int num = 0; foreach (EffectDefinition item in pool) { if (GamblingSaveData.Instance.OwnedEffectIds.Contains(item.Id)) { num++; } } if (num < 6) { return pool[Random.Range(0, pool.Count)]; } float num2 = 0f; float[] array = new float[pool.Count]; for (int i = 0; i < pool.Count; i++) { bool flag = GamblingSaveData.Instance.OwnedEffectIds.Contains(pool[i].Id); array[i] = (flag ? 1f : 4f); num2 += array[i]; } float num3 = Random.Range(0f, num2); float num4 = 0f; for (int j = 0; j < pool.Count; j++) { num4 += array[j]; if (num3 <= num4) { return pool[j]; } } return pool[pool.Count - 1]; } } public enum RewardTier { Common, Rare, Epic, Legendary, Mythic, Special } [BepInPlugin("com.chimp.brcgambling", "BRC Gambling", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class GamblingPlugin : BaseUnityPlugin { public static GamblingPlugin Instance; public static AssetBundle EffectsBundle; public static Sprite AppIcon; public static Sprite CrownSprite; private float saveTimer = 0f; private float lastComboScore = 0f; private int comboScoreThresholdCount = 0; private bool wasGrinding = false; private bool wasBoosting = false; public static bool TrickGodInstalled = false; public static ConfigEntry ShowChatMessages; public static ConfigEntry ShowOtherPlayerCrowns; public static ConfigEntry CrownColor; public static ConfigEntry CrownHeightOffset; public static ConfigEntry CrownRotationX; public static ConfigEntry CrownRotationY; public static Dictionary CachedPrefabs = new Dictionary(); private float effectRefreshTimer = 0f; private void Awake() { //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown Instance = this; TrickGodInstalled = Chainloader.PluginInfos.ContainsKey("TrickGod"); if (TrickGodInstalled) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[BRCGambling] TrickGod detected — combo thresholds adjusted."); } ShowChatMessages = ((BaseUnityPlugin)this).Config.Bind("Settings", "ShowChatMessages", true, "Show REP reward messages in chat."); CrownHeightOffset = ((BaseUnityPlugin)this).Config.Bind("Mythic", "HeightOffset", 1.5f, "Height of the Mythic item above your character's head."); CrownRotationX = ((BaseUnityPlugin)this).Config.Bind("Mythic", "RotationX", -15f, "Forward/backward tilt of the Mythic item."); CrownRotationY = ((BaseUnityPlugin)this).Config.Bind("Mythic", "RotationY", 0f, "Rotation of the Mythic item around the vertical axis."); CrownColor = ((BaseUnityPlugin)this).Config.Bind("Mythic", "CrownColor", "#FFE100", "Hex color for the Mythic Crown (e.g. #FF0000 for red, #FFD700 for gold)."); ShowOtherPlayerCrowns = ((BaseUnityPlugin)this).Config.Bind("Mythic", "ShowOtherPlayerMythic", true, "Show Mythic items on other players."); GamblingSaveData.Register(); LoadAppIcon(); AppGambling.Initialize(); EffectRegistry.InitializeDefaults(); LoadAssetBundle(); Harmony val = new Harmony("com.chimp.brcgambling"); val.PatchAll(); InitPassiveSync(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[BRCGambling] Loaded."); } private void InitPassiveSync() { try { ShowOtherPlayerCrowns.SettingChanged += delegate { PassiveSync.RefreshRemotePassives(); }; if (Chainloader.PluginInfos.ContainsKey("BombRushMP.Plugin")) { PassiveSync.Init(); WagerSync.Init(); ((MonoBehaviour)this).StartCoroutine(DelayedAnnounce()); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("[BRCGambling] Sync failed to initialize: " + ex.Message)); } } private IEnumerator DelayedAnnounce() { yield return (object)new WaitForSeconds(5f); PassiveSync.AnnounceState(isHello: true); } private void OnApplicationQuit() { try { PassiveSync.Shutdown(); } catch { } try { WagerSync.Shutdown(); } catch { } WagerSync.OnLobbyUpdated = null; WagerSync.OnKicked = null; WagerSync.OnResolve = null; if (GamblingSaveData.Instance != null) { ((CustomSaveData)GamblingSaveData.Instance).Save(); } } private void Update() { effectRefreshTimer += Time.deltaTime; if (effectRefreshTimer >= 3f) { effectRefreshTimer = 0f; EffectTriggerManager.RefreshLoopingEffects(); } saveTimer += Time.deltaTime; if (saveTimer >= 5f) { saveTimer = 0f; GamblingSaveData.Instance?.SaveIfDirty(); } WorldHandler instance = WorldHandler.instance; Player val = ((instance != null) ? instance.GetCurrentPlayer() : null); if ((Object)(object)val != (Object)null) { float value = Traverse.Create((object)val).Field("baseScore").GetValue(); float value2 = Traverse.Create((object)val).Field("scoreMultiplier").GetValue(); float num = value * value2; float num2 = (TrickGodInstalled ? 5000000f : 1000000f); int num3 = (TrickGodInstalled ? 5 : 25); if (num < lastComboScore && lastComboScore > 0f) { if (lastComboScore > 1000f) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnComboBank); } comboScoreThresholdCount = 0; } int num4 = Mathf.FloorToInt(num / num2); if (num4 > comboScoreThresholdCount) { int num5 = (num4 - comboScoreThresholdCount) * num3; comboScoreThresholdCount = num4; GamblingManager.Rep += num5; ChatUI instance2 = ChatUI.Instance; if ((Object)(object)instance2 != (Object)null && ShowChatMessages.Value) { string arg = (TrickGodInstalled ? $"{num4 * 5}M" : $"{num4}M"); instance2.AddMessage($"+{num5} REP for {arg} combo! Total REP: {GamblingManager.Rep}"); } } lastComboScore = num; if (num > GamblingSaveData.Instance.BiggestComboScore) { GamblingSaveData.Instance.BiggestComboScore = num; GamblingSaveData.Instance.MarkDirty(); } Ability value3 = Traverse.Create((object)val).Field("ability").GetValue(); Ability value4 = Traverse.Create((object)val).Field("grindAbility").GetValue(); bool flag = value3 != null && value3 == value4; if (flag && !wasGrinding) { EffectTriggerManager.StartConditionalLooping(EffectTrigger.OnGrindLooping); } else if (!flag && wasGrinding) { EffectTriggerManager.StopConditionalLooping(EffectTrigger.OnGrindLooping); } wasGrinding = flag; bool value5 = Traverse.Create((object)val).Field("boosting").GetValue(); if (value5 && !wasBoosting) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnBoost); EffectTriggerManager.StartConditionalLooping(EffectTrigger.OnBoostLooping); } else if (!value5 && wasBoosting) { EffectTriggerManager.StopConditionalLooping(EffectTrigger.OnBoostLooping); } wasBoosting = value5; Core instance3 = Core.Instance; GameInput val2 = ((instance3 != null) ? instance3.GameInput : null); if (val2 != null && val2.GetButtonNew(10, 0)) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnSprayAttempt); } } else { lastComboScore = 0f; comboScoreThresholdCount = 0; wasGrinding = false; wasBoosting = false; } } private void LoadAppIcon() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon_gambling.png"); if (File.Exists(path)) { byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); AppIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } private void LoadAssetBundle() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "spraycasino"); EffectsBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)EffectsBundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[BRCGambling] Failed to load spraycasino AssetBundle!"); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[BRCGambling] AssetBundle loaded successfully."); CrownSprite = EffectsBundle.LoadAsset("Crown"); foreach (EffectDefinition value in EffectRegistry.All.Values) { if (!CachedPrefabs.ContainsKey(value.PrefabName)) { GameObject val = EffectsBundle.LoadAsset(value.PrefabName); if ((Object)(object)val != (Object)null) { CachedPrefabs[value.PrefabName] = val; } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[BRCGambling] Failed to cache prefab: " + value.PrefabName)); } } } GameObject val2 = EffectsBundle.LoadAsset("MythicCrown"); if ((Object)(object)val2 != (Object)null) { CachedPrefabs["MythicCrown"] = val2; } ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[BRCGambling] Cached {CachedPrefabs.Count} prefabs."); } public static void DestroyAfter(GameObject obj, float delay) { ((MonoBehaviour)Instance).StartCoroutine(DestroyCoroutine(obj, delay)); } private static IEnumerator DestroyCoroutine(GameObject obj, float delay) { yield return (object)new WaitForSeconds(delay); if ((Object)(object)obj != (Object)null) { Object.Destroy((Object)(object)obj); } } public static Color GetCrownColor() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); if (ColorUtility.TryParseHtmlString(CrownColor.Value, ref result)) { return result; } return Color.white; } } public static class PlayerEffects { public static void SpawnEffectByName(string prefabName, Transform parent, Vector3 localOffset, float duration) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (GamblingPlugin.CachedPrefabs.TryGetValue(prefabName, out GameObject value)) { GameObject val = Object.Instantiate(value, parent); val.transform.localPosition = localOffset; GamblingPlugin.DestroyAfter(val, duration); } } public static Transform GetLocalPlayerTransform() { try { WorldHandler instance = WorldHandler.instance; Player val = ((instance != null) ? instance.GetCurrentPlayer() : null); if ((Object)(object)val != (Object)null) { return ((Component)val).transform; } } catch { } return null; } public static GameObject SpawnPersistentEffectByName(string prefabName, Transform parent, Vector3 localOffset) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!GamblingPlugin.CachedPrefabs.TryGetValue(prefabName, out GameObject value)) { return null; } GameObject val = Object.Instantiate(value, parent); val.transform.localPosition = localOffset; return val; } } public class InfoOverlay : MonoBehaviour { private GameObject overlayRoot; private Action onClose; public static InfoOverlay Show(MonoBehaviour host, string title, string[] lines, Action onClose = null) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("InfoOverlay"); InfoOverlay infoOverlay = val.AddComponent(); infoOverlay.onClose = onClose; infoOverlay.Build(title, lines); return infoOverlay; } private void Build(string title, string[] lines) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_024f: 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_0270: Expected O, but got Unknown //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Expected O, but got Unknown //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Expected O, but got Unknown //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Expected O, but got Unknown //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_05a4: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05cc: Expected O, but got Unknown //IL_05cf: Unknown result type (might be due to invalid IL or missing references) Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; overlayRoot = new GameObject("InfoCanvas"); Canvas val = overlayRoot.AddComponent(); val.renderMode = (RenderMode)0; val.sortingOrder = 300; CanvasScaler val2 = overlayRoot.AddComponent(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; overlayRoot.AddComponent(); GameObject val3 = new GameObject("Panel"); val3.transform.SetParent(overlayRoot.transform, false); RectTransform val4 = val3.AddComponent(); val4.anchorMin = new Vector2(0.5f, 0.5f); val4.anchorMax = new Vector2(0.5f, 0.5f); val4.pivot = new Vector2(0.5f, 0.5f); val4.sizeDelta = new Vector2(520f, 420f); val4.anchoredPosition = Vector2.zero; ((Graphic)val3.AddComponent()).color = new Color(0.05f, 0.05f, 0.15f, 0.97f); CreateBorder(val3.transform, 520f, 420f, new Color(0.1f, 0.1f, 0.4f)); GameObject val5 = new GameObject("Title"); val5.transform.SetParent(val3.transform, false); RectTransform val6 = val5.AddComponent(); val6.anchorMin = new Vector2(0.5f, 1f); val6.anchorMax = new Vector2(0.5f, 1f); val6.pivot = new Vector2(0.5f, 1f); val6.sizeDelta = new Vector2(480f, 40f); val6.anchoredPosition = new Vector2(0f, -15f); TextMeshProUGUI val7 = val5.AddComponent(); ((TMP_Text)val7).fontSize = 20f; ((TMP_Text)val7).fontStyle = (FontStyles)1; ((TMP_Text)val7).alignment = (TextAlignmentOptions)514; ((MonoBehaviour)this).StartCoroutine(SweepLightText(val7, title, new Color(0.15f, 0.15f, 0.6f), new Color(0.6f, 0.6f, 1f), 0.07f)); GameObject val8 = new GameObject("Divider"); val8.transform.SetParent(val3.transform, false); RectTransform val9 = val8.AddComponent(); val9.anchorMin = new Vector2(0.5f, 1f); val9.anchorMax = new Vector2(0.5f, 1f); val9.pivot = new Vector2(0.5f, 0.5f); val9.sizeDelta = new Vector2(480f, 1f); val9.anchoredPosition = new Vector2(0f, -60f); ((Graphic)val8.AddComponent()).color = new Color(0.2f, 0.2f, 0.5f); float num = -75f; float num2 = 28f; for (int i = 0; i < lines.Length; i++) { GameObject val10 = new GameObject($"Line_{i}"); val10.transform.SetParent(val3.transform, false); RectTransform val11 = val10.AddComponent(); val11.anchorMin = new Vector2(0.5f, 1f); val11.anchorMax = new Vector2(0.5f, 1f); val11.pivot = new Vector2(0.5f, 1f); val11.sizeDelta = new Vector2(460f, num2); val11.anchoredPosition = new Vector2(0f, num - (float)i * num2); TextMeshProUGUI val12 = val10.AddComponent(); ((TMP_Text)val12).text = lines[i]; ((TMP_Text)val12).fontSize = 14f; ((Graphic)val12).color = new Color(0.85f, 0.85f, 0.85f); ((TMP_Text)val12).alignment = (TextAlignmentOptions)513; ((TMP_Text)val12).enableWordWrapping = true; } GameObject val13 = new GameObject("CloseBtn"); val13.transform.SetParent(val3.transform, false); RectTransform val14 = val13.AddComponent(); val14.anchorMin = new Vector2(0.5f, 0f); val14.anchorMax = new Vector2(0.5f, 0f); val14.pivot = new Vector2(0.5f, 0f); val14.sizeDelta = new Vector2(160f, 38f); val14.anchoredPosition = new Vector2(0f, 15f); ((Graphic)val13.AddComponent()).color = new Color(0.1f, 0.1f, 0.3f); GameObject val15 = new GameObject("Label"); val15.transform.SetParent(val13.transform, false); RectTransform val16 = val15.AddComponent(); val16.anchorMin = Vector2.zero; val16.anchorMax = Vector2.one; Vector2 offsetMin = (val16.offsetMax = Vector2.zero); val16.offsetMin = offsetMin; TextMeshProUGUI val17 = val15.AddComponent(); ((TMP_Text)val17).text = "[ OK ]"; ((TMP_Text)val17).fontSize = 16f; ((TMP_Text)val17).fontStyle = (FontStyles)1; ((Graphic)val17).color = new Color(0.4f, 0.8f, 0.4f); ((TMP_Text)val17).alignment = (TextAlignmentOptions)514; EventTrigger val18 = val13.AddComponent(); Entry val19 = new Entry(); val19.eventID = (EventTriggerType)4; ((UnityEvent)(object)val19.callback).AddListener((UnityAction)delegate { Close(); }); val18.triggers.Add(val19); } private IEnumerator SweepLightText(TextMeshProUGUI tmp, string text, Color baseColor, Color lightColor, float speed) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) int len = text.Length; int frame = 0; int totalFrames = len + 6; while ((Object)(object)tmp != (Object)null && ((Component)tmp).gameObject.activeInHierarchy) { StringBuilder sb = new StringBuilder(); int lightPos = frame % totalFrames - 3; for (int i = 0; i < len; i++) { if (text[i] == ' ') { sb.Append(' '); continue; } sb.Append($" Color.Lerp(lightColor, baseColor, 0.85f), 1 => Color.Lerp(lightColor, baseColor, 0.55f), 0 => lightColor, _ => baseColor, }))}>{text[i]}"); } ((TMP_Text)tmp).text = sb.ToString(); frame++; yield return (object)new WaitForSeconds(speed); } } private void CreateBorder(Transform parent, float w, float h, Color color) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) (Vector2, Vector2, Vector2, Vector2)[] array = new(Vector2, Vector2, Vector2, Vector2)[4] { (new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, -2f), new Vector2(0f, 0f)), (new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 0f), new Vector2(0f, 2f)), (new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f, 0f), new Vector2(2f, 0f)), (new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(-2f, 0f), new Vector2(0f, 0f)) }; (Vector2, Vector2, Vector2, Vector2)[] array2 = array; for (int i = 0; i < array2.Length; i++) { (Vector2, Vector2, Vector2, Vector2) tuple = array2[i]; GameObject val = new GameObject("Border"); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent(); val2.anchorMin = tuple.Item1; val2.anchorMax = tuple.Item2; val2.offsetMin = tuple.Item3; val2.offsetMax = tuple.Item4; ((Graphic)val.AddComponent()).color = color; } } public void Close() { Cursor.visible = false; Cursor.lockState = (CursorLockMode)1; onClose?.Invoke(); if ((Object)(object)overlayRoot != (Object)null) { Object.Destroy((Object)(object)overlayRoot); } Object.Destroy((Object)(object)((Component)this).gameObject); } } public enum WagerLobbyState { Idle, Open, Locked, InProgress, Resolving } public class WagerPlayer { public ushort PlayerId; public string DisplayName; public int WagerAmount; public bool IsReady; public bool IsHost; } public static class WagerLobbyManager { public static WagerLobbyState State = WagerLobbyState.Idle; public static bool IsHost = false; public static bool IsPublic = true; public static Dictionary Players = new Dictionary(); public static ushort HostId = 0; public static int LocalWager = 0; public static int MatchedAmount { get { if (Players.Count == 0) { return 0; } int num = int.MaxValue; foreach (WagerPlayer value in Players.Values) { if (value.WagerAmount > 0 && value.WagerAmount < num) { num = value.WagerAmount; } } return (num != int.MaxValue) ? num : 0; } } public static int GetPairwiseGain(ushort winnerId) { if (!Players.TryGetValue(winnerId, out WagerPlayer value)) { return 0; } int num = 0; foreach (KeyValuePair player in Players) { if (player.Key != winnerId) { num += Mathf.Min(value.WagerAmount, player.Value.WagerAmount); } } return num; } public static int GetPairwiseLoss(ushort winnerId, ushort loserId) { if (!Players.TryGetValue(winnerId, out WagerPlayer value)) { return 0; } if (!Players.TryGetValue(loserId, out WagerPlayer value2)) { return 0; } return Mathf.Min(value.WagerAmount, value2.WagerAmount); } public static void Reset() { State = WagerLobbyState.Idle; IsHost = false; IsPublic = true; Players.Clear(); HostId = 0; LocalWager = 0; } public static WagerPlayer GetLocalPlayer() { ClientController instance = ClientController.Instance; if ((Object)(object)instance == (Object)null) { return null; } Players.TryGetValue(instance.LocalID, out WagerPlayer value); return value; } public static bool LocalPlayerInLobby() { ClientController instance = ClientController.Instance; if ((Object)(object)instance == (Object)null) { return false; } return Players.ContainsKey(instance.LocalID); } public static bool CanAffordWager(int amount) { return GamblingManager.Rep >= amount; } } public static class WagerSync { private const string PACKET_ID = "com.chimp.brcgambling.wager"; private const string MSG_CREATE = "WC:"; private const string MSG_JOIN_REQ = "WJR:"; private const string MSG_JOIN_OK = "WJO:"; private const string MSG_JOIN_DENY = "WJD:"; private const string MSG_LOBBY_UPDATE = "WLU:"; private const string MSG_WAGER_SET = "WWS:"; private const string MSG_READY = "WRD:"; private const string MSG_KICK = "WKK:"; private const string MSG_CLOSE = "WCL:"; private const string MSG_RESOLVE = "WRV:"; private const string MSG_LOCK = "WLK:"; public static Action OnLobbyUpdated; public static Action OnKicked; public static Action OnResolve; public static void Init() { try { ClientController.RegisterCustomPacketHandler("com.chimp.brcgambling.wager", (Action)OnPacket); ClientController.PlayerDisconnected = (Action)Delegate.Combine(ClientController.PlayerDisconnected, new Action(OnPlayerDisconnected)); } catch (Exception ex) { Debug.Log((object)("[WagerSync] Init failed: " + ex.Message)); } } public static void Shutdown() { ClientController.UnregisterCustomPacketHandler("com.chimp.brcgambling.wager"); ClientController.PlayerDisconnected = (Action)Delegate.Remove(ClientController.PlayerDisconnected, new Action(OnPlayerDisconnected)); } public static void CreateLobby(bool isPublic) { ClientController instance = ClientController.Instance; if (!((Object)(object)instance == (Object)null)) { WagerLobbyManager.Reset(); WagerLobbyManager.IsHost = true; WagerLobbyManager.IsPublic = isPublic; WagerLobbyManager.HostId = instance.LocalID; WagerLobbyManager.State = WagerLobbyState.Open; WagerPlayer value = new WagerPlayer { PlayerId = instance.LocalID, DisplayName = GetLocalDisplayName(), WagerAmount = 0, IsReady = false, IsHost = true }; WagerLobbyManager.Players[instance.LocalID] = value; instance.BroadcastCustomPacket(Encode("WC:" + (isPublic ? "1" : "0") + ":" + instance.LocalID), "com.chimp.brcgambling.wager", (SendModes)2); BroadcastLobbyUpdate(); OnLobbyUpdated?.Invoke(); } } public static void SetWager(int amount) { ClientController instance = ClientController.Instance; if (!((Object)(object)instance == (Object)null)) { WagerLobbyManager.LocalWager = amount; if (WagerLobbyManager.Players.TryGetValue(instance.LocalID, out WagerPlayer value)) { value.WagerAmount = amount; } if (WagerLobbyManager.IsHost) { BroadcastLobbyUpdate(); } else { instance.SendCustomPacketToPlayer(Encode("WWS:" + amount), "com.chimp.brcgambling.wager", WagerLobbyManager.HostId, (SendModes)2); } OnLobbyUpdated?.Invoke(); } } public static void SetReady(bool ready) { ClientController instance = ClientController.Instance; if (!((Object)(object)instance == (Object)null)) { if (WagerLobbyManager.Players.TryGetValue(instance.LocalID, out WagerPlayer value)) { value.IsReady = ready; } if (WagerLobbyManager.IsHost) { BroadcastLobbyUpdate(); } else { instance.SendCustomPacketToPlayer(Encode("WRD:" + (ready ? "1" : "0")), "com.chimp.brcgambling.wager", WagerLobbyManager.HostId, (SendModes)2); } OnLobbyUpdated?.Invoke(); } } public static void KickPlayer(ushort playerId) { if (WagerLobbyManager.IsHost) { ClientController instance = ClientController.Instance; if (!((Object)(object)instance == (Object)null)) { WagerLobbyManager.Players.Remove(playerId); instance.SendCustomPacketToPlayer(Encode("WKK:"), "com.chimp.brcgambling.wager", playerId, (SendModes)2); BroadcastLobbyUpdate(); OnLobbyUpdated?.Invoke(); } } } public static void CloseLobby() { if (WagerLobbyManager.IsHost) { ClientController instance = ClientController.Instance; if (!((Object)(object)instance == (Object)null)) { instance.BroadcastCustomPacket(Encode("WCL:"), "com.chimp.brcgambling.wager", (SendModes)2); WagerLobbyManager.Reset(); OnLobbyUpdated?.Invoke(); } } } public static void LockLobby() { if (!WagerLobbyManager.IsHost) { return; } ClientController instance = ClientController.Instance; if ((Object)(object)instance == (Object)null) { return; } WagerLobbyManager.State = WagerLobbyState.Locked; instance.BroadcastCustomPacket(Encode("WLK:"), "com.chimp.brcgambling.wager", (SendModes)2); BroadcastLobbyUpdate(); ChatUI instance2 = ChatUI.Instance; if ((Object)(object)instance2 != (Object)null && GamblingPlugin.ShowChatMessages.Value) { List list = new List(); foreach (WagerPlayer value in WagerLobbyManager.Players.Values) { list.Add($"{value.DisplayName} ({value.WagerAmount} REP)"); } instance2.AddMessage("Wager race locked! " + string.Join(", ", list) + " — no one can lose more than their own wager. Start a grace through the multiplayer menu!"); } OnLobbyUpdated?.Invoke(); } public static void TogglePublic() { if (WagerLobbyManager.IsHost) { WagerLobbyManager.IsPublic = !WagerLobbyManager.IsPublic; BroadcastLobbyUpdate(); OnLobbyUpdated?.Invoke(); } } public static void RequestJoin() { ClientController instance = ClientController.Instance; if (!((Object)(object)instance == (Object)null)) { instance.SendCustomPacketToPlayer(Encode("WJR:" + GetLocalDisplayName()), "com.chimp.brcgambling.wager", WagerLobbyManager.HostId, (SendModes)2); } } public static void ResolveWager(ushort winnerId) { if (!WagerLobbyManager.IsHost) { return; } ClientController instance = ClientController.Instance; if ((Object)(object)instance == (Object)null || !WagerLobbyManager.Players.TryGetValue(winnerId, out WagerPlayer value)) { return; } int wagerAmount = value.WagerAmount; string displayName = value.DisplayName; int pairwiseGain = WagerLobbyManager.GetPairwiseGain(winnerId); int num; if (instance.LocalID == winnerId) { num = pairwiseGain; GamblingManager.Rep += num; GamblingSaveData.Instance.WagerWins++; if (pairwiseGain > GamblingSaveData.Instance.BiggestWagerWon) { GamblingSaveData.Instance.BiggestWagerWon = pairwiseGain; } } else { num = -WagerLobbyManager.GetPairwiseLoss(winnerId, instance.LocalID); GamblingManager.Rep += num; GamblingSaveData.Instance.WagerLosses++; } ChatUI instance2 = ChatUI.Instance; if ((Object)(object)instance2 != (Object)null && GamblingPlugin.ShowChatMessages.Value) { instance2.AddMessage($"Wager resolved! {displayName} wins {pairwiseGain} REP!"); } instance.BroadcastCustomPacket(Encode("WRV:" + winnerId + ":" + wagerAmount + ":" + displayName), "com.chimp.brcgambling.wager", (SendModes)2); OnResolve?.Invoke(winnerId, num, displayName); WagerLobbyManager.Reset(); OnLobbyUpdated?.Invoke(); } private static void OnPacket(ushort sender, byte[] data) { ClientController instance = ClientController.Instance; if ((Object)(object)instance == (Object)null) { return; } ushort localID = instance.LocalID; string text = Decode(data); if (text.StartsWith("WC:")) { string[] array = text.Substring("WC:".Length).Split(':'); if (array.Length >= 2) { bool isPublic = array[0] == "1"; WagerLobbyManager.HostId = sender; WagerLobbyManager.IsPublic = isPublic; OnLobbyUpdated?.Invoke(); } } else if (text.StartsWith("WJR:") && WagerLobbyManager.IsHost) { if (WagerLobbyManager.State == WagerLobbyState.Open) { string displayName = text.Substring("WJR:".Length); WagerLobbyManager.Players[sender] = new WagerPlayer { PlayerId = sender, DisplayName = displayName, WagerAmount = 0, IsReady = false, IsHost = false }; instance.SendCustomPacketToPlayer(Encode("WJO:" + instance.LocalID), "com.chimp.brcgambling.wager", sender, (SendModes)2); BroadcastLobbyUpdate(); OnLobbyUpdated?.Invoke(); } } else if (text.StartsWith("WJO:")) { if (ushort.TryParse(text.Substring("WJO:".Length), out var result)) { WagerLobbyManager.HostId = result; } WagerLobbyManager.State = WagerLobbyState.Open; WagerLobbyManager.Players[localID] = new WagerPlayer { PlayerId = localID, DisplayName = GetLocalDisplayName(), WagerAmount = 0, IsReady = false, IsHost = false }; OnLobbyUpdated?.Invoke(); } else if (text.StartsWith("WJD:")) { WagerLobbyManager.Reset(); OnLobbyUpdated?.Invoke(); } else if (text.StartsWith("WLU:") && !WagerLobbyManager.IsHost) { ParseLobbyUpdate(text.Substring("WLU:".Length)); OnLobbyUpdated?.Invoke(); } else if (text.StartsWith("WWS:") && WagerLobbyManager.IsHost) { if (int.TryParse(text.Substring("WWS:".Length), out var result2)) { if (WagerLobbyManager.Players.TryGetValue(sender, out WagerPlayer value)) { value.WagerAmount = result2; } BroadcastLobbyUpdate(); OnLobbyUpdated?.Invoke(); } } else if (text.StartsWith("WRD:") && WagerLobbyManager.IsHost) { bool isReady = text.Substring("WRD:".Length) == "1"; if (WagerLobbyManager.Players.TryGetValue(sender, out WagerPlayer value2)) { value2.IsReady = isReady; } BroadcastLobbyUpdate(); OnLobbyUpdated?.Invoke(); } else if (text.StartsWith("WKK:") && sender == WagerLobbyManager.HostId) { WagerLobbyManager.Reset(); OnKicked?.Invoke(); OnLobbyUpdated?.Invoke(); } else if (text.StartsWith("WCL:")) { WagerLobbyManager.Reset(); OnLobbyUpdated?.Invoke(); } else if (text.StartsWith("WLK:")) { WagerLobbyManager.State = WagerLobbyState.Locked; OnLobbyUpdated?.Invoke(); } else { if (!text.StartsWith("WRV:")) { return; } string text2 = text.Substring("WRV:".Length); string[] array2 = text2.Split(':'); if (array2.Length < 3 || !ushort.TryParse(array2[0], out var result3) || !int.TryParse(array2[1], out var result4)) { return; } string arg = array2[2]; if (WagerLobbyManager.Players.TryGetValue(result3, out WagerPlayer value3)) { value3.WagerAmount = result4; } int num; if (localID == result3) { num = WagerLobbyManager.GetPairwiseGain(result3); GamblingManager.Rep += num; GamblingSaveData.Instance.WagerWins++; if (num > GamblingSaveData.Instance.BiggestWagerWon) { GamblingSaveData.Instance.BiggestWagerWon = num; } } else { num = -WagerLobbyManager.GetPairwiseLoss(result3, localID); GamblingManager.Rep += num; GamblingSaveData.Instance.WagerLosses++; } OnResolve?.Invoke(result3, num, arg); WagerLobbyManager.Reset(); OnLobbyUpdated?.Invoke(); } } private static void OnPlayerDisconnected(ushort playerId) { if (!WagerLobbyManager.Players.ContainsKey(playerId)) { return; } if (playerId == WagerLobbyManager.HostId) { WagerLobbyManager.Reset(); ChatUI instance = ChatUI.Instance; if ((Object)(object)instance != (Object)null && GamblingPlugin.ShowChatMessages.Value) { instance.AddMessage("Wager lobby host disconnected. Lobby closed."); } OnLobbyUpdated?.Invoke(); } else if (WagerLobbyManager.IsHost) { WagerPlayer value; string text = (WagerLobbyManager.Players.TryGetValue(playerId, out value) ? value.DisplayName : "A player"); WagerLobbyManager.Players.Remove(playerId); ChatUI instance2 = ChatUI.Instance; if ((Object)(object)instance2 != (Object)null && GamblingPlugin.ShowChatMessages.Value) { instance2.AddMessage("" + text + " disconnected from the wager lobby."); } BroadcastLobbyUpdate(); OnLobbyUpdated?.Invoke(); } } private static void BroadcastLobbyUpdate() { ClientController instance = ClientController.Instance; if (!((Object)(object)instance == (Object)null)) { instance.BroadcastCustomPacket(Encode("WLU:" + SerializeLobby()), "com.chimp.brcgambling.wager", (SendModes)2); } } private static string SerializeLobby() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(WagerLobbyManager.IsPublic ? "1" : "0"); stringBuilder.Append("|"); stringBuilder.Append((int)WagerLobbyManager.State); stringBuilder.Append("|"); stringBuilder.Append(WagerLobbyManager.HostId); stringBuilder.Append("|"); List list = new List(); foreach (KeyValuePair player in WagerLobbyManager.Players) { list.Add($"{player.Key},{player.Value.DisplayName},{player.Value.WagerAmount}," + $"{(player.Value.IsReady ? 1 : 0)},{(player.Value.IsHost ? 1 : 0)}"); } stringBuilder.Append(string.Join(";", list)); return stringBuilder.ToString(); } private static void ParseLobbyUpdate(string data) { string[] array = data.Split('|'); if (array.Length < 4) { return; } WagerLobbyManager.IsPublic = array[0] == "1"; WagerLobbyManager.State = (WagerLobbyState)int.Parse(array[1]); if (ushort.TryParse(array[2], out var result)) { WagerLobbyManager.HostId = result; } ushort key = ClientController.Instance?.LocalID ?? 0; Dictionary dictionary = new Dictionary(); if (!string.IsNullOrEmpty(array[3])) { string[] array2 = array[3].Split(';'); foreach (string text in array2) { string[] array3 = text.Split(','); if (array3.Length >= 5) { ushort num = ushort.Parse(array3[0]); dictionary[num] = new WagerPlayer { PlayerId = num, DisplayName = array3[1], WagerAmount = int.Parse(array3[2]), IsReady = (array3[3] == "1"), IsHost = (array3[4] == "1") }; } } } WagerLobbyManager.Players = dictionary; if (dictionary.TryGetValue(key, out var value) && value.WagerAmount == 0 && WagerLobbyManager.LocalWager > 0) { value.WagerAmount = WagerLobbyManager.LocalWager; } } private static string GetLocalDisplayName() { WorldHandler instance = WorldHandler.instance; Player val = ((instance != null) ? instance.GetCurrentPlayer() : null); if ((Object)(object)val != (Object)null) { try { return Traverse.Create((object)val).Field("playerName").GetValue() ?? "Player"; } catch { } } return "Player"; } 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(); } } } namespace BRCGambling.Patches { [HarmonyPatch(typeof(DieAbility), "OnStartAbility")] internal class DeathTriggerPatch { private static void Postfix(DieAbility __instance) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnDeath); } } [HarmonyPatch(typeof(Gamemode), "OnStart")] internal class GamemodeStartTriggerPatch { private static void Postfix(Gamemode __instance) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnGraceStart); EffectTriggerManager.StartConditionalLooping(EffectTrigger.OnGraceStartLooping); } } [HarmonyPatch(typeof(Gamemode), "OnEnd")] internal class GamemodeEndTriggerPatch { private static void Postfix(Gamemode __instance, bool cancelled) { EffectTriggerManager.StopConditionalLooping(EffectTrigger.OnGraceStartLooping); } } [HarmonyPatch(typeof(GraffitiRace), "OnReceive_GraffitiRaceData")] internal class GraffitiRaceDataPatch { private static void Postfix(GraffitiRace __instance, ClientGraffitiRaceGSpots packet) { GamblingManager.MaxPossibleScore += packet.GraffitiSpots.Count; } } [HarmonyPatch(typeof(GraffitiRace), "OnEnd")] internal class GraffitiRaceWinPatch { [HarmonyPostfix] private static void Postfix(GraffitiRace __instance) { ClientController instance = ClientController.Instance; if ((Object)(object)instance == (Object)null) { return; } ClientLobbyManager clientLobbyManager = instance.ClientLobbyManager; Lobby val = ((clientLobbyManager != null) ? clientLobbyManager.CurrentLobby : null); if (val == null) { return; } ushort localID = instance.LocalID; int maxPossibleScore = GamblingManager.MaxPossibleScore; if (maxPossibleScore <= 0) { return; } float num = 0f; bool flag = false; if (((Gamemode)__instance).TeamBased) { if (val.LobbyState.Players.ContainsKey(localID)) { byte team = val.LobbyState.Players[localID].Team; float scoreForTeam = val.LobbyState.GetScoreForTeam(team); flag = scoreForTeam >= (float)maxPossibleScore && scoreForTeam > 0f; } } else if (val.LobbyState.Players.ContainsKey(localID)) { num = val.LobbyState.Players[localID].Score; flag = num >= (float)maxPossibleScore && num > 0f; } ChatUI instance2 = ChatUI.Instance; if (flag) { GamblingSaveData.Instance.GraceWins++; GamblingManager.ConsecutiveLosses = 0; int count = val.LobbyState.Players.Count; int num2 = 25; int num3 = 0; bool flag2 = maxPossibleScore < 5; if (flag2) { num2 = 5; } else if (count == 2) { num3 = 25; } else if (count == 3) { num3 = 50; } else if (count >= 4) { num3 = 75; } if (((Gamemode)__instance).TeamBased && count >= 3) { byte? b = null; bool flag3 = true; foreach (LobbyPlayer value3 in val.LobbyState.Players.Values) { if (!b.HasValue) { b = value3.Team; } else if (value3.Team != b) { flag3 = false; break; } } if (flag3) { num2 = 5; num3 = 0; } } GamblingManager.Rep += num2 + num3; if ((Object)(object)instance2 != (Object)null && GamblingPlugin.ShowChatMessages.Value) { if (flag2) { instance2.AddMessage($"+{num2} REP, Really? {maxPossibleScore} tag(s)? Boss up! Total REP: {GamblingManager.Rep}"); } else if (num3 > 0) { instance2.AddMessage($"+{num2 + num3} REP for gracing with {count} players! Total REP: {GamblingManager.Rep}"); } else { instance2.AddMessage($"+{num2} REP for winning a GRACE! Total REP: {GamblingManager.Rep}"); } } if (WagerLobbyManager.State == WagerLobbyState.Locked && WagerLobbyManager.IsHost) { ushort num4 = 0; float num5 = -1f; foreach (KeyValuePair player in WagerLobbyManager.Players) { ushort key = player.Key; if (val.LobbyState.Players.TryGetValue(key, out var value) && value.Score > num5) { num5 = value.Score; num4 = key; } } if (num4 != 0 && num5 >= (float)maxPossibleScore) { WagerSync.ResolveWager(num4); } } } else { GamblingSaveData.Instance.GraceLosses++; GamblingManager.ConsecutiveLosses++; if (GamblingManager.ConsecutiveLosses >= 7) { int num6 = (int)num; int num7 = 0; if (num6 < 6) { num7 = 15; } else if (num6 >= 6 && num6 < 8) { num7 = 25; } else if (num6 >= 8) { num7 = 40; } GamblingManager.Rep += num7; if ((Object)(object)instance2 != (Object)null && GamblingPlugin.ShowChatMessages.Value) { instance2.AddMessage($"[Pity] +{num7} REP for {num6} tags after {GamblingManager.ConsecutiveLosses} losses! Total REP: {GamblingManager.Rep}"); } } } if (WagerLobbyManager.State == WagerLobbyState.Locked && WagerLobbyManager.IsHost) { bool flag4 = true; foreach (KeyValuePair player2 in WagerLobbyManager.Players) { if (!val.LobbyState.Players.ContainsKey(player2.Key)) { flag4 = false; Debug.Log((object)("[BRCGambling] Wager player " + player2.Value.DisplayName + " not in grace lobby — skipping resolve.")); break; } } if (flag4) { ushort num8 = 0; float num9 = -1f; foreach (KeyValuePair player3 in WagerLobbyManager.Players) { ushort key2 = player3.Key; if (val.LobbyState.Players.TryGetValue(key2, out var value2) && value2.Score > num9) { num9 = value2.Score; num8 = key2; } } if (num8 != 0 && num9 >= (float)maxPossibleScore) { WagerSync.ResolveWager(num8); } } else { ChatUI instance3 = ChatUI.Instance; if ((Object)(object)instance3 != (Object)null && GamblingPlugin.ShowChatMessages.Value) { instance3.AddMessage("Wager not resolved — not all wager players were in the grace."); } } } GamblingManager.MaxPossibleScore = 0; EffectTriggerManager.PlayOneShot(EffectTrigger.OnGraceEnd); } } [HarmonyPatch(typeof(Player), "DoTrick")] internal class PlayerTrickTriggerPatch { private static void Postfix(Player __instance, TrickType type, string trickName, int trickNum) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected I4, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 WorldHandler instance = WorldHandler.instance; if ((Object)(object)__instance != (Object)(object)((instance != null) ? instance.GetCurrentPlayer() : null)) { return; } if ((int)type <= 8) { switch (type - 1) { default: if ((int)type != 8) { break; } goto case 2; case 2: case 4: EffectTriggerManager.PlayOneShot(EffectTrigger.OnBoostTrick); break; case 0: EffectTriggerManager.PlayOneShot(EffectTrigger.OnGrind); break; case 1: case 3: break; } } else if ((int)type != 12) { if (type - 16 <= 3) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnSpray); } } else if (Traverse.Create((object)__instance).Field("usingEquippedMovestyle").GetValue()) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnManual); } else { EffectTriggerManager.PlayOneShot(EffectTrigger.OnSlide); } } } [HarmonyPatch(typeof(Player), "Jump")] internal class PlayerJumpTriggerPatch { private static void Postfix(Player __instance) { WorldHandler instance = WorldHandler.instance; if (!((Object)(object)__instance != (Object)(object)((instance != null) ? instance.GetCurrentPlayer() : null))) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnJump); } } } [HarmonyPatch(typeof(Player), "OnLanded")] internal class PlayerLandTriggerPatch { private static void Postfix(Player __instance) { WorldHandler instance = WorldHandler.instance; if (!((Object)(object)__instance != (Object)(object)((instance != null) ? instance.GetCurrentPlayer() : null))) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnLand); } } } [HarmonyPatch(typeof(DanceAbility), "OnStartAbility")] internal class EmoteTriggerPatch { private static void Postfix(DanceAbility __instance) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnEmote); } } [HarmonyPatch(typeof(WallPlantAbility), "OnStartAbility")] internal class WallPlantTriggerPatch { private static void Postfix(WallPlantAbility __instance) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnWallPlant); } } }