Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BazaarCasino v1.10.10
plugins/BazaarCasino/BazaarCasino.dll
Decompiled 9 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using KinematicCharacterController; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.UI; using Rewired; using RoR2; using RoR2.Artifacts; using RoR2.ConVar; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Animations; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Playables; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BazaarCasino")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BazaarCasino")] [assembly: AssemblyTitle("BazaarCasino")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BazaarCasino { internal static class CaseArtwork { private static readonly Dictionary<string, AsyncOperationHandle<Sprite>> images = new Dictionary<string, AsyncOperationHandle<Sprite>>(); internal static void Assign(Image target, ItemDef item) { //IL_007a: 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_008b: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)item)) { ((Behaviour)target).enabled = false; return; } if (Object.op_Implicit((Object)(object)item.pickupIconSprite)) { target.sprite = item.pickupIconSprite; return; } AssetReferenceT<Sprite> pickupIconSpriteReference = item.pickupIconSpriteReference; if (pickupIconSpriteReference == null || !((AssetReference)pickupIconSpriteReference).RuntimeKeyIsValid()) { ((Behaviour)target).enabled = false; return; } if (!images.TryGetValue(((Object)item).name, out var value)) { value = Addressables.LoadAssetAsync<Sprite>(((AssetReference)pickupIconSpriteReference).RuntimeKey); images[((Object)item).name] = value; } if (value.IsDone) { target.sprite = value.Result; ((Behaviour)target).enabled = Object.op_Implicit((Object)(object)target.sprite); return; } ((Behaviour)target).enabled = false; value.Completed += delegate(AsyncOperationHandle<Sprite> loaded) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)target)) { target.sprite = (((int)loaded.Status == 1) ? loaded.Result : null); ((Behaviour)target).enabled = Object.op_Implicit((Object)(object)target.sprite); } }; } internal static void Release() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) foreach (AsyncOperationHandle<Sprite> value in images.Values) { if (value.IsValid()) { Addressables.Release<Sprite>(value); } } images.Clear(); } } internal sealed class WorldCaseMachine : MonoBehaviour, IInteractable { private sealed class ReelRow { internal RectTransform strip; internal Image marker; internal float stride; } private MachineCanvas screen; private MachineCanvas controls; private MachineCanvas info; private RectTransform viewport; private ReelRow[] rows = Array.Empty<ReelRow>(); private static readonly int[] BatchCounts = new int[3] { 1, 5, 10 }; private TextMeshProUGUI openButton; private TextMeshProUGUI wallet; private TextMeshProUGUI odds; private TextMeshProUGUI notice; private readonly TextMeshProUGUI[] batchButtons = (TextMeshProUGUI[])(object)new TextMeshProUGUI[3]; private Transform cabinet; private Transform display; private Transform marquee; private readonly Transform[] trims = (Transform[])(object)new Transform[2]; private TextMeshPro title; private BoxCollider interaction; private const float cabinetHeight = 5.75f; private Highlight cabinetOutline; private uint receipt; private Coroutine animation; private bool focused; private int lastPrice; private bool lastAvailable; private CasinoState lastState; private int[] previewItems; internal float CameraHeight => 2.875f; internal float CameraDistance => Mathf.Max(4.2f, 2.875f / Mathf.Tan(MathF.PI / 8f) * 1.12f); internal int SelectedCount { get; private set; } = 1; internal bool IsOpening { get; private set; } internal void SelectCount(int count) { if (!IsOpening && CaseBatchRules.ValidCount(count) && count != SelectedCount) { SelectedCount = count; ShowPreview(lastState); } } internal static WorldCaseMachine Create(CasinoLounge room) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0032: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_012f: 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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0284: 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_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("LunarCacheMachine"); val.transform.SetParent(((Component)room).transform, false); val.transform.localPosition = new Vector3(21f, 0f, -27.5f); val.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); val.transform.localScale = Vector3.one * 1.65f; val.layer = LayerIndex.defaultLayer.intVal; val.AddComponent<EntityLocator>().entity = val; WorldCaseMachine worldCaseMachine = val.AddComponent<WorldCaseMachine>(); worldCaseMachine.interaction = val.AddComponent<BoxCollider>(); ((Collider)worldCaseMachine.interaction).isTrigger = true; GameObject val2 = room.Cube("CacheCabinet", new Vector3(0f, 1.65f, 0f), new Vector3(3.5f, 3.3f, 1.6f), new Color(0.08f, 0.16f, 0.19f), solid: true, val.transform); worldCaseMachine.cabinet = val2.transform; worldCaseMachine.cabinetOutline = val.AddComponent<Highlight>(); worldCaseMachine.cabinetOutline.targetRenderer = val2.GetComponent<Renderer>(); worldCaseMachine.cabinetOutline.highlightColor = (HighlightColor)0; worldCaseMachine.marquee = room.Cube("CacheMarquee", new Vector3(0f, 3.35f, 0f), new Vector3(3.65f, 0.18f, 1.8f), new Color(0.32f, 0.85f, 0.68f), solid: false, val.transform).transform; worldCaseMachine.display = room.Cube("CacheDisplay", new Vector3(0f, 1.93f, -0.86f), new Vector3(3.25f, 1.36f, 0.14f), new Color(0.04f, 0.1f, 0.11f), solid: false, val.transform).transform; room.Cube("CacheControls", new Vector3(0f, 0.94f, -0.875f), new Vector3(3.25f, 0.8f, 0.14f), new Color(0.05f, 0.13f, 0.15f), solid: false, val.transform); for (int i = 0; i < 2; i++) { worldCaseMachine.trims[i] = room.Cube("CacheTrim", new Vector3((float)(i * 2 - 1) * 1.68f, 1.65f, -0.85f), new Vector3(0.06f, 2.8f, 0.1f), new Color(0.4f, 0.9f, 0.72f), solid: false, val.transform).transform; } worldCaseMachine.title = room.Label("LUNAR CACHE", new Vector3(0f, 2.94f, -0.92f), 2f, new Vector2(3.2f, 0.5f), Quaternion.identity, val.transform); worldCaseMachine.Build(); return worldCaseMachine; } private void Build() { //IL_001b: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) screen = new MachineCanvas(((Component)this).transform, "CaseScreen3D", new Vector3(0f, 1.93f, -0.945f), new Vector2(630f, 230f), 0.005f); viewport = MachineCanvas.Rect((Transform)(object)screen.Root, "Physical case window"); MachineCanvas.Place(viewport, 0f, 0f, 1f, 1f); Image obj = ((Component)viewport).gameObject.AddComponent<Image>(); ((Graphic)obj).color = new Color(0.025f, 0.045f, 0.06f, 1f); ((Graphic)obj).raycastTarget = false; ((Component)viewport).gameObject.AddComponent<RectMask2D>(); controls = new MachineCanvas(((Component)this).transform, "CacheControls3D", new Vector3(0f, 0.94f, -0.957f), new Vector2(630f, 148f), 0.005f); for (int i = 0; i < 3; i++) { batchButtons[i] = controls.Button(i + 1, (new string[3] { "1x", "5x", "10x" })[i], 17f, (float)i * 0.24f, 0.73f, (float)(i + 1) * 0.24f - 0.02f, 0.98f); } openButton = controls.Button(0, "OPEN CASE", 17f, 0.2f, 0.32f, 0.74f, 0.69f); controls.Button(4, "ESC · Exit", 14f, 0.77f, 0.32f, 1f, 0.69f); wallet = controls.Text("E · Use machine", 13f, Color.white, 0f, 0.02f, 0.37f, 0.26f); notice = controls.Text("Random item drops", 13f, Color.white, 0.38f, 0.02f, 1f, 0.26f); info = new MachineCanvas(((Component)this).transform, "CaseOdds3D", new Vector3(0f, 2.65f, -0.95f), new Vector2(630f, 26f), 0.005f); odds = info.Text("COMMON → LEGENDARY", 14f, new Color(0.6f, 0.91f, 0.77f), 0f, 0f, 1f, 1f); ConfigureCabinet(); ShowPreview(null); } private void ConfigureCabinet() { //IL_0021: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00ed: 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_0135: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) float num = 3.15f; float num2 = 4.95f; cabinet.localPosition = new Vector3(0f, 2.875f, 0f); cabinet.localScale = new Vector3(3.5f, 5.75f, 1.6f); display.localPosition = new Vector3(0f, num, -0.86f); display.localScale = new Vector3(3.25f, 3.74f, 0.14f); marquee.localPosition = new Vector3(0f, num2 + 0.85f, 0f); title.transform.localPosition = new Vector3(0f, num2 + 0.44f, -0.92f); for (int i = 0; i < 2; i++) { trims[i].localPosition = new Vector3((float)(i * 2 - 1) * 1.68f, 2.875f, -0.85f); trims[i].localScale = new Vector3(0.06f, 5.25f, 0.1f); } interaction.center = new Vector3(0f, 2.875f, 0f); interaction.size = new Vector3(3.6f, 5.85f, 2f); ((Transform)screen.Root).localPosition = new Vector3(0f, num, -0.945f); screen.Root.sizeDelta = new Vector2(630f, 720f); ((Transform)info.Root).localPosition = new Vector3(0f, num2 + 0.15f, -0.95f); } private void BuildRows(int count) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_011f: 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) foreach (Transform item in (Transform)viewport) { ((Component)item).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)item).gameObject); } rows = new ReelRow[count]; for (int i = 0; i < count; i++) { CaseLayout.RowBounds(count, i, out var bottom, out var top); RectTransform obj = MachineCanvas.Rect((Transform)(object)viewport, "Case reel " + (i + 1)); MachineCanvas.Place(obj, 0f, bottom, 1f, top); Image obj2 = ((Component)obj).gameObject.AddComponent<Image>(); ((Graphic)obj2).color = new Color(0.025f, 0.045f, 0.06f, 1f); ((Graphic)obj2).raycastTarget = false; ((Component)obj).gameObject.AddComponent<RectMask2D>(); RectTransform val2 = MachineCanvas.Rect((Transform)(object)obj, "Item strip"); val2.anchorMin = Vector2.zero; val2.anchorMax = new Vector2(0f, 1f); val2.pivot = new Vector2(0f, 0.5f); val2.sizeDelta = Vector2.zero; RectTransform obj3 = MachineCanvas.Rect((Transform)(object)obj, "Prize marker"); MachineCanvas.Place(obj3, 0.498f, 0.03f, 0.502f, 0.97f); Image val3 = ((Component)obj3).gameObject.AddComponent<Image>(); ((Graphic)val3).color = new Color(0.95f, 0.77f, 0.35f); ((Graphic)val3).raycastTarget = false; rows[i] = new ReelRow { strip = val2, marker = val3, stride = ((count == 1) ? 144 : 105) }; } } internal void SetFocus(bool value) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) focused = value; if (!value) { controls.Hover(default(Ray), enabled: false); ((TMP_Text)wallet).text = "E · Use machine"; } } private void LateUpdate() { if (focused && Object.op_Implicit((Object)(object)cabinetOutline)) { cabinetOutline.isOn = false; } } internal int HoverControls(Ray ray, bool enabled) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return controls.Hover(ray, enabled, focused); } internal void ControlState(CasinoState state, uint gold, bool waiting, string message) { //IL_020d: Unknown result type (might be due to invalid IL or missing references) lastPrice = state?.casePrice ?? 0; lastAvailable = state?.caseEnabled ?? false; ((TMP_Text)wallet).text = "Gold " + gold.ToString("N0"); int total = (state?.caseWeights?.Sum()).GetValueOrDefault(); ((TMP_Text)odds).text = ((total > 0) ? string.Join(" · ", new string[3] { "Common", "Uncommon", "Legendary" }.Select((string name, int i) => name + " " + ((float)state.caseWeights[i] * 100f / (float)total).ToString("0.#") + "%")) : "Loading reward pool…"); TextMeshProUGUI obj = openButton; object text; if (!IsOpening) { if (!waiting) { CasinoState casinoState = state; text = ((casinoState != null && casinoState.caseEnabled && state.casePrice > 0) ? ("OPEN " + SelectedCount + "x · " + CaseBatchRules.Total(state.casePrice, SelectedCount).ToString("N0") + " GOLD") : "UNAVAILABLE"); } else { text = "WAITING…"; } } else { text = "OPENING…"; } ((TMP_Text)obj).text = (string)text; for (int num = 0; num < 3; num++) { ((TMP_Text)batchButtons[num]).text = ((SelectedCount == BatchCounts[num]) ? "▶ " : "") + BatchCounts[num] + "x"; } if (message != null && !IsOpening) { ((TMP_Text)notice).text = message; ((Graphic)notice).color = Color.white; } } internal void Preview(CasinoState state) { lastState = state; if (receipt == 0 && !IsOpening) { ShowPreview(state); } } private void ShowPreview(CasinoState state) { //IL_0125: 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) int[] array = state?.caseItems ?? Array.Empty<int>(); if (rows.Length == SelectedCount && previewItems != null && previewItems.SequenceEqual(array)) { return; } previewItems = array.ToArray(); BuildRows(SelectedCount); ItemDef[] array2 = (from i in array select ItemCatalog.GetItemDef((ItemIndex)i) into d where Object.op_Implicit((Object)(object)d) select d).ToArray(); for (int num = 0; num < rows.Length; num++) { for (int num2 = 0; num2 < 9; num2++) { AddCard(rows[num], (array2.Length != 0) ? array2[(num2 + num * 3) % array2.Length] : null, num2); } rows[num].strip.anchoredPosition = new Vector2(0f - rows[num].stride, 0f); } ((TMP_Text)notice).text = "Choose a batch, then open"; ((Graphic)notice).color = Color.white; } private static Color Rarity(ItemDef item) { //IL_000c: 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_002b: 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_001f: Unknown result type (might be due to invalid IL or missing references) ItemTierDef val = (Object.op_Implicit((Object)(object)item) ? ItemTierCatalog.GetItemTierDef(item.tier) : null); if (!Object.op_Implicit((Object)(object)val)) { return Color.white; } return Color32.op_Implicit(ColorCatalog.GetColor(val.colorIndex)); } private void AddCard(ReelRow row, ItemDef item, int index) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0058: 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_0082: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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) RectTransform val = MachineCanvas.Rect((Transform)(object)row.strip, "Reward card"); val.anchorMin = Vector2.zero; val.anchorMax = new Vector2(0f, 1f); val.pivot = new Vector2(0f, 0.5f); val.sizeDelta = new Vector2(row.stride - 8f, -6f); val.anchoredPosition = new Vector2((float)index * row.stride + 4f, 0f); Color val2 = Rarity(item); Image obj = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)obj).color = new Color(val2.r * 0.13f + 0.025f, val2.g * 0.13f + 0.025f, val2.b * 0.13f + 0.025f, 1f); ((Graphic)obj).raycastTarget = false; RectTransform obj2 = MachineCanvas.Rect((Transform)(object)val, "Rarity"); MachineCanvas.Place(obj2, 0f, 0.96f, 1f, 1f); Image obj3 = ((Component)obj2).gameObject.AddComponent<Image>(); ((Graphic)obj3).color = val2; ((Graphic)obj3).raycastTarget = false; Image obj4 = ((Component)MachineCanvas.Rect((Transform)(object)val, "Item icon")).gameObject.AddComponent<Image>(); obj4.preserveAspect = true; ((Graphic)obj4).raycastTarget = false; MachineCanvas.Place(((Graphic)obj4).rectTransform, 0.1f, 0.23f, 0.9f, 0.92f); CaseArtwork.Assign(obj4, item); TextMeshProUGUI obj5 = screen.Text((Transform)(object)val, Object.op_Implicit((Object)(object)item) ? Language.GetString(item.nameToken) : "?", (rows.Length == 1) ? 16 : 10, Color.white, (TextAlignmentOptions)514); MachineCanvas.Place(((TMP_Text)obj5).rectTransform, 0.03f, 0.025f, 0.97f, 0.22f); ((TMP_Text)obj5).enableWordWrapping = false; ((TMP_Text)obj5).enableAutoSizing = true; ((TMP_Text)obj5).fontSizeMin = ((rows.Length == 1) ? 12 : 8); ((TMP_Text)obj5).fontSizeMax = ((rows.Length == 1) ? 16 : 10); } internal void Receive(CasinoState state) { if (state == null) { return; } lastState = state; if (state.caseToken == 0) { Preview(state); } else if (state.caseToken != receipt) { receipt = state.caseToken; if (animation != null) { ((MonoBehaviour)this).StopCoroutine(animation); } animation = ((MonoBehaviour)this).StartCoroutine(Animate(state)); } } private IEnumerator Animate(CasinoState state) { int[] caseRewards = state.caseRewards; int[] source = ((caseRewards != null && caseRewards.Length != 0) ? state.caseRewards : new int[1] { state.caseItem }); ItemDef[] rewards = source.Select((int i) => ItemCatalog.GetItemDef((ItemIndex)i)).ToArray(); ItemDef[] array = (from i in state.caseItems ?? Array.Empty<int>() select ItemCatalog.GetItemDef((ItemIndex)i) into d where Object.op_Implicit((Object)(object)d) select d).ToArray(); if (!CaseBatchRules.ValidCount(rewards.Length) || rewards.Any((ItemDef d) => !Object.op_Implicit((Object)(object)d)) || array.Length == 0) { ((TMP_Text)notice).text = "Collect rewards below"; IsOpening = false; yield break; } IsOpening = true; previewItems = null; ((TMP_Text)notice).text = "Opening " + rewards.Length + " cases…"; ((Graphic)notice).color = Color.white; BuildRows(rewards.Length); ItemDef[][] array2 = new ItemDef[3][] { array.Where((ItemDef d) => (int)d.tier == 0).ToArray(), array.Where((ItemDef d) => (int)d.tier == 1).ToArray(), array.Where((ItemDef d) => (int)d.tier == 2).ToArray() }; bool[] available = array2.Select((ItemDef[] p) => p.Length != 0).ToArray(); float[] jitter = new float[rows.Length]; for (int num = 0; num < rows.Length; num++) { Random random = new Random(state.caseSeed + num * 7919); for (int num2 = 0; num2 < 31; num2++) { ItemDef item = rewards[num]; if (num2 != 23) { int num3 = GachaRules.ChooseTier(random.NextDouble(), state.caseWeights ?? new int[3] { 70, 27, 3 }, available); ItemDef[] array3 = ((num3 >= 0) ? array2[num3] : array); item = array3[random.Next(array3.Length)]; } AddCard(rows[num], item, num2); } jitter[num] = ((float)random.NextDouble() - 0.5f) * rows[num].stride * 0.12f; } float start = Time.unscaledTime - Mathf.Max(0f, state.caseElapsed); while (true) { float num4 = Time.unscaledTime - start; for (int num5 = 0; num5 < rows.Length; num5++) { float num6 = GachaRules.ReelElapsed(num4, num5, rows.Length); rows[num5].strip.anchoredPosition = new Vector2(GachaRules.CardOffset(630f, 23, jitter[num5], num6, rows[num5].stride), 0f); if (num6 >= 5.2f) { ((Graphic)rows[num5].marker).color = Rarity(rewards[num5]); } } if (num4 >= 5.2f) { break; } yield return null; } ((TMP_Text)notice).text = rewards.Length + (state.caseCommand ? " essences · collect below" : " items · collect below"); ((Graphic)notice).color = (rewards.Any((ItemDef d) => (int)d.tier == 2) ? Rarity(rewards.First((ItemDef d) => (int)d.tier == 2)) : Rarity(rewards[0])); IsOpening = false; animation = null; ((TMP_Text)openButton).text = ((lastAvailable && lastPrice > 0) ? ("OPEN " + SelectedCount + "x · " + CaseBatchRules.Total(lastPrice, SelectedCount).ToString("N0") + " GOLD") : "OPEN CASE"); } public string GetContextString(Interactor actor) { return "Use Lunar Cache — random item"; } public Interactability GetInteractability(Interactor actor) { if (CasinoPlugin.InBazaar) { return (Interactability)2; } return (Interactability)0; } public void OnInteractionBegin(Interactor actor) { CasinoPlugin.Instance?.OpenCaseMachine(actor, this); } public bool ShouldIgnoreSpherecastForInteractibility(Interactor actor) { return false; } public bool ShouldShowOnScanner() { return true; } public bool ShouldProximityHighlight() { return true; } } internal sealed class CasinoUI : MonoBehaviour, ICameraStateProvider { private sealed class ReelView { internal RectTransform strip; internal readonly List<Image> symbols = new List<Image>(); } private GameObject casePanel; private WorldCaseMachine activeCase; private string caseMessage; private static readonly Color Gold = new Color(0.95f, 0.77f, 0.32f); private static readonly Color Muted = new Color(0.65f, 0.69f, 0.76f); private RectTransform modalFrame; private RectTransform wagerBar; private TextMeshProUGUI modalTitle; private TextMeshProUGUI modalRules; private GameObject canvasRoot; private GameObject modal; private GameObject buttonPrefab; private RectTransform content; private TextMeshProUGUI wallet; private TextMeshProUGUI status; private TextMeshProUGUI wagerText; private TMP_FontAsset font; private int pageIndex = 3; private int bet = 10; private WorldSlotMachine activeSlotMachine; private int selectedItem = -1; private bool animating; private bool ready; private float retryInitAt; private string notice = "Gold wagers • gold payouts"; private int lastWheel = -1; private int[] lastReels; private Texture2D wheelTexture; private Coroutine animation; private readonly List<AsyncOperationHandle<Sprite>> iconHandles = new List<AsyncOperationHandle<Sprite>>(); private readonly CasinoArt art = new CasinoArt(); private readonly List<Image> playerCards = new List<Image>(); private readonly List<Image> dealerCards = new List<Image>(); private int[] shownPlayer = Array.Empty<int>(); private int[] shownDealer = Array.Empty<int>(); private TextMeshProUGUI dealerTitle; private TextMeshProUGUI playerTitle; private readonly List<RouletteBet> chips = new List<RouletteBet>(); private RectTransform wheel; private RectTransform ball; private RectTransform lever; private TextMeshProUGUI wheelResult; private readonly List<ReelView> reels = new List<ReelView>(); private ActionKind lastAction; private readonly List<Tuple<int, int, int>> chipHistory = new List<Tuple<int, int, int>>(); private readonly InteractionReleaseGate interactionGate = new InteractionReleaseGate(); private GameObject slotPanel; private CharacterModel slotModel; private readonly Dictionary<Renderer, bool> machineAvatarRenderers = new Dictionary<Renderer, bool>(); private readonly List<CameraRigController> slotCameras = new List<CameraRigController>(); private string slotResponse = "Click lever to spin"; private GameObject racePanel; private WorldCrabRace activeRace; private int raceLane; private int raceWager; private string raceMessage; private TextMeshProUGUI raceViewStatus; private GameObject tablePanel; private RectTransform tableFrame; private RectTransform sharedCardLayer; private TableKind selectedTable; private TextMeshProUGUI tableClock; private TextMeshProUGUI tableNotice; private TextMeshProUGUI tableWallet; private TextMeshProUGUI tableHover; private string tableMessage = "Choose your wager. ESC stands up."; private int tableBet = 10; private int tableDrawnRevision = -1; private int tableDraftRound = -1; private int sharedCardRound = -1; private int draftVersion; private int sentDraftVersion; private bool draftDirty; private bool betInFlight; private bool topTableView; private float nextDraftSubmit; private readonly List<RouletteBet> tableDraft = new List<RouletteBet>(); private readonly Dictionary<string, int> sharedCardValues = new Dictionary<string, int>(); private readonly Dictionary<string, Image> sharedCardImages = new Dictionary<string, Image>(); private readonly List<Tuple<Button, bool, bool>> sharedButtons = new List<Tuple<Button, bool, bool>>(); internal bool IsCaseOpen { get { if (Object.op_Implicit((Object)(object)casePanel) && casePanel.activeSelf) { return Object.op_Implicit((Object)(object)activeCase); } return false; } } internal bool IsWorldMachineFocused { get { if (!IsSlotFocused && !IsCaseOpen) { return IsRaceFocused; } return true; } } internal bool IsOpen { get { if (!Object.op_Implicit((Object)(object)modal) || !modal.activeSelf) { return IsWorldMachineFocused; } return true; } } private CasinoPlugin Plugin => CasinoPlugin.Instance; private CasinoState State => Plugin?.State; internal int EscapeConsumedFrame { get; private set; } = -1; internal bool InteractionBlocked => interactionGate.Blocked(Time.unscaledTime); internal bool CanOpenInteraction { get { if (!IsAnyCasinoOpen) { return !InteractionBlocked; } return false; } } internal bool IsAnyCasinoOpen { get { if (!IsOpen) { if (Object.op_Implicit((Object)(object)tablePanel)) { return tablePanel.activeSelf; } return false; } return true; } } internal bool IsSlotFocused { get { if (Object.op_Implicit((Object)(object)slotPanel) && slotPanel.activeSelf) { return Object.op_Implicit((Object)(object)activeSlotMachine); } return false; } } internal bool IsRaceFocused { get { if (Object.op_Implicit((Object)(object)racePanel) && racePanel.activeSelf) { return Object.op_Implicit((Object)(object)activeRace); } return false; } } private uint MyId { get { //IL_0018: 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) if (!Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster)) { return 0u; } NetworkInstanceId netId = ((Component)CasinoPlugin.LocalMaster).GetComponent<NetworkIdentity>().netId; return ((NetworkInstanceId)(ref netId)).Value; } } private CasinoSeat MySeat { get { if (!Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) || !Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster.GetBody())) { return null; } return ((Component)CasinoPlugin.LocalMaster.GetBody()).GetComponent<CasinoSeat>(); } } private void BuildCaseOverlay() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)casePanel)) { casePanel = ((Component)Rect(canvasRoot.transform, "CacheCursorLifetime")).gameObject; Stretch((RectTransform)casePanel.transform); casePanel.SetActive(false); casePanel.AddComponent<MPEventSystemProvider>().fallBackToMainEventSystem = true; casePanel.AddComponent<CursorOpener>(); } } internal void OpenCase(WorldCaseMachine machine) { if (Object.op_Implicit((Object)(object)machine) && CasinoPlugin.InBazaar && Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) && Init()) { Close(); activeCase = machine; BuildCaseOverlay(); HideMachineAvatar(); casePanel.SetActive(true); machine.SetFocus(value: true); caseMessage = null; machine.Preview(State); AttachSlotCamera(); Plugin.Send(ActionKind.State); } } private void CaseResponse(CasinoState state) { activeCase?.Receive(state); caseMessage = ((state.game == 5 || state.message == "Welcome to the Bazaar Casino.") ? null : state.message); } private void UpdateCaseOverlay() { //IL_011c: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)casePanel) || !casePanel.activeSelf) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) ? CasinoPlugin.LocalMaster.GetBody() : null); if (!CasinoPlugin.InBazaar || !Object.op_Implicit((Object)(object)activeCase) || !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.healthComponent) || !val.healthComponent.alive || SceneExitController.isRunning) { Close(); return; } AttachSlotCamera(); CasinoState state = State; int num; if (state != null && state.caseEnabled && state.casePrice > 0) { int[] caseWeights = state.caseWeights; if (caseWeights != null && caseWeights.Sum() > 0 && !activeCase.IsOpening) { num = ((!Plugin.Waiting) ? 1 : 0); goto IL_00cf; } } num = 0; goto IL_00cf; IL_00cf: bool flag = (byte)num != 0; Camera viewCamera = CasinoBillboard.ViewCamera; bool flag2 = MPEventSystem.readOnlyInstancesList.Any((MPEventSystem e) => Object.op_Implicit((Object)(object)e) && ((EventSystem)e).IsPointerOverGameObject()); int num2 = activeCase.HoverControls((Ray)(Object.op_Implicit((Object)(object)viewCamera) ? viewCamera.ScreenPointToRay(Input.mousePosition) : default(Ray)), Object.op_Implicit((Object)(object)viewCamera) && !flag2 && flag); if (Input.GetMouseButtonDown(0)) { if (num2 == 4) { Close(); return; } if (flag && (num2 == 1 || num2 == 2 || num2 == 3)) { activeCase.SelectCount(num2 switch { 2 => 5, 1 => 1, _ => 10, }); caseMessage = null; } if (num2 == 0 && flag && CasinoPlugin.LocalMaster.money >= (uint)CaseBatchRules.Total(state.casePrice, activeCase.SelectedCount)) { caseMessage = "Waiting for host…"; Plugin.Send(ActionKind.CaseRedeem, CaseBatchRules.Total(state.casePrice, activeCase.SelectedCount), 0, activeCase.SelectedCount); } } string message = caseMessage; if (!activeCase.IsOpening && !Plugin.Waiting && state != null && state.caseEnabled && state.casePrice > 0 && CasinoPlugin.LocalMaster.money < (uint)CaseBatchRules.Total(state.casePrice, activeCase.SelectedCount)) { message = "Not enough gold"; } activeCase.ControlState(state, CasinoPlugin.LocalMaster.money, Plugin.Waiting, message); } private void CloseCaseOverlay() { if (Object.op_Implicit((Object)(object)activeCase)) { activeCase.SetFocus(value: false); } activeCase = null; if (Object.op_Implicit((Object)(object)casePanel)) { ReleaseCasinoFocus(casePanel); casePanel.SetActive(false); } } internal void CaseTimedOut() { if (IsCaseOpen) { caseMessage = "No host reply · Reopen to refresh"; } } internal void Toggle() { if (IsOpen || (Object.op_Implicit((Object)(object)tablePanel) && tablePanel.activeSelf)) { Close(); } } internal bool Prepare() { return Init(); } private bool Init() { if (Object.op_Implicit((Object)(object)canvasRoot) && ready) { return true; } if (Time.unscaledTime < retryInitAt) { return false; } retryInitAt = Time.unscaledTime + 1f; try { return BuildUI(); } catch (Exception ex) { ready = false; if (Object.op_Implicit((Object)(object)canvasRoot)) { canvasRoot.SetActive(false); Object.Destroy((Object)(object)canvasRoot); } canvasRoot = null; modal = null; content = null; Debug.LogError((object)("[BazaarCasino] UI initialization failed; discarded incomplete panel: " + ex)); return false; } } private bool BuildUI() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Expected O, but got Unknown //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Expected O, but got Unknown //IL_0388: 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_03dd: Expected O, but got Unknown //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Expected O, but got Unknown //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Expected O, but got Unknown //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) GameObject commandCubePrefab = CommandArtifactManager.commandCubePrefab; GameObject val = ((!Object.op_Implicit((Object)(object)commandCubePrefab)) ? null : commandCubePrefab.GetComponent<PickupPickerController>()?.panelPrefab); HGButton val2 = (Object.op_Implicit((Object)(object)val) ? ((IEnumerable<HGButton>)val.GetComponentsInChildren<HGButton>(true)).FirstOrDefault((Func<HGButton, bool>)((HGButton b) => ((Object)b).name == "CancelButton")) : null); if (!Object.op_Implicit((Object)(object)val2)) { return false; } buttonPrefab = ((Component)val2).gameObject; TextMeshProUGUI componentInChildren = ((Component)val2).GetComponentInChildren<TextMeshProUGUI>(true); font = ((componentInChildren != null) ? ((TMP_Text)componentInChildren).font : null) ?? TMP_Settings.defaultFontAsset; canvasRoot = new GameObject("BazaarCasinoCanvas", new Type[1] { typeof(RectTransform) }); canvasRoot.SetActive(false); Canvas obj = canvasRoot.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 90; CanvasScaler obj2 = canvasRoot.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.matchWidthOrHeight = 0.5f; canvasRoot.AddComponent<GraphicRaycaster>(); Object.DontDestroyOnLoad((Object)(object)canvasRoot); modal = ((Component)Rect(canvasRoot.transform, "CasinoModal")).gameObject; Stretch((RectTransform)modal.transform); modal.SetActive(false); ((Graphic)modal.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.82f); modal.AddComponent<MPEventSystemProvider>().fallBackToMainEventSystem = true; modal.AddComponent<CursorOpener>(); RectTransform val3 = (modalFrame = Rect(modal.transform, "Frame")); Anchors(val3, 0.075f, 0.07f, 0.925f, 0.93f); ((Graphic)((Component)val3).gameObject.AddComponent<Image>()).color = new Color(0.045f, 0.055f, 0.08f, 1f); Anchors(((TMP_Text)(modalTitle = Label((Transform)(object)val3, "LUNAR BROKER", 32f, Gold, (TextAlignmentOptions)4097))).rectTransform, 0.035f, 0.89f, 0.53f, 0.97f); wallet = Label((Transform)(object)val3, "Gold: —", 24f, Gold, (TextAlignmentOptions)4100); Anchors(((TMP_Text)wallet).rectTransform, 0.55f, 0.9f, 0.85f, 0.96f); Transform transform = ((Component)Button((Transform)(object)val3, "Close", new UnityAction(Close))).transform; Anchors((RectTransform)(object)((transform is RectTransform) ? transform : null), 0.87f, 0.9f, 0.97f, 0.96f); content = Rect((Transform)(object)val3, "Content"); Anchors(content, 0.035f, 0.2f, 0.965f, 0.77f); wagerBar = Rect((Transform)(object)val3, "SlotWagerControls"); Anchors(wagerBar, 0.035f, 0.105f, 0.505f, 0.17f); Transform transform2 = ((Component)Button((Transform)(object)wagerBar, "−", (UnityAction)delegate { ChangeBet(-10); })).transform; Anchors((RectTransform)(object)((transform2 is RectTransform) ? transform2 : null), 0f, 0f, 0.12f, 1f); wagerText = Label((Transform)(object)wagerBar, "Wager: 10", 22f, Color.white, (TextAlignmentOptions)514); Anchors(((TMP_Text)wagerText).rectTransform, 0.13f, 0f, 0.45f, 1f); Transform transform3 = ((Component)Button((Transform)(object)wagerBar, "+", (UnityAction)delegate { ChangeBet(10); })).transform; Anchors((RectTransform)(object)((transform3 is RectTransform) ? transform3 : null), 0.46f, 0f, 0.58f, 1f); Transform transform4 = ((Component)Button((Transform)(object)wagerBar, "×10", (UnityAction)delegate { SetBet((long)bet * 10L); })).transform; Anchors((RectTransform)(object)((transform4 is RectTransform) ? transform4 : null), 0.6f, 0f, 0.78f, 1f); Transform transform5 = ((Component)Button((Transform)(object)wagerBar, "÷10", (UnityAction)delegate { SetBet(bet / 10); })).transform; Anchors((RectTransform)(object)((transform5 is RectTransform) ? transform5 : null), 0.8f, 0f, 1f, 1f); Anchors(((TMP_Text)(modalRules = Label((Transform)(object)val3, "Payouts include your wager. ESC / F6 to close.", 16f, Muted, (TextAlignmentOptions)4100))).rectTransform, 0.52f, 0.1f, 0.965f, 0.18f); status = Label((Transform)(object)val3, notice, 19f, Color.white, (TextAlignmentOptions)4097); Anchors(((TMP_Text)status).rectTransform, 0.035f, 0.02f, 0.965f, 0.085f); canvasRoot.SetActive(true); BuildSlotOverlay(); BuildCaseOverlay(); ready = true; return true; } private void OpenFocusedPanel() { if (CasinoPlugin.InBazaar && Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) && Init()) { Close(); pageIndex = 3; selectedItem = -1; ((TMP_Text)modalTitle).text = "LUNAR BROKER"; ((Component)wagerBar).gameObject.SetActive(false); ((Component)modalRules).gameObject.SetActive(false); Anchors(modalFrame, 0.16f, 0.1f, 0.84f, 0.9f); Anchors(content, 0.035f, 0.09f, 0.965f, 0.86f); notice = "Select an item to sell for gold."; modal.SetActive(true); Notify(notice); DrawPage(); Plugin.Send(ActionKind.State); } } internal void OpenBroker() { OpenFocusedPanel(); } internal void OpenSlots(WorldSlotMachine machine) { OpenSlotOverlay(machine); } internal void Close() { if (IsAnyCasinoOpen) { interactionGate.Close(Time.unscaledTime); } CloseSharedTable(); CloseSlotOverlay(); CloseCaseOverlay(); CloseRaceOverlay(); activeSlotMachine = null; if (Object.op_Implicit((Object)(object)modal)) { if (animation != null) { ((MonoBehaviour)this).StopCoroutine(animation); animation = null; } RememberCards(State); if (State?.reels != null) { lastReels = State.reels.ToArray(); } CasinoState state = State; if (state != null && state.wheelNumber >= 0) { lastWheel = State.wheelNumber; } animating = false; ReleaseCasinoFocus(modal); modal.SetActive(false); } } private void Update() { ObserveInteractionRelease(); if (CasinoPlugin.InBazaar && !Object.op_Implicit((Object)(object)canvasRoot)) { Init(); } if (Object.op_Implicit((Object)(object)canvasRoot)) { canvasRoot.SetActive(CasinoPlugin.InBazaar); } UpdateSlotOverlay(); UpdateCaseOverlay(); UpdateRaceOverlay(); if (IsOpen) { if (Input.GetKeyDown((KeyCode)27)) { CloseFromEscape(); } if (Object.op_Implicit((Object)(object)wallet) && !animating && !Plugin.Waiting) { ((TMP_Text)wallet).text = "Gold: " + (Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) ? CasinoPlugin.LocalMaster.money.ToString("N0") : "—"); } } } internal void Notify(string message) { notice = message; if (Object.op_Implicit((Object)(object)status)) { ((TMP_Text)status).text = message; } } internal void Receive(CasinoState state) { if (state == null) { return; } SetWagerLimits(state.minBet, state.maxBet); if (IsSlotFocused) { SlotResponse(state); return; } if (IsCaseOpen) { CaseResponse(state); return; } if (state.message != "Welcome to the Bazaar Casino." || notice == "Gold wagers • gold payouts") { Notify(ResultText(state)); } RememberCards(state); if (IsOpen) { DrawPage(); } } internal void SetWagerLimits(int minimum, int maximum) { if (minimum > 0 && maximum >= minimum) { bet = Mathf.Clamp(bet, minimum, maximum); int num = tableBet; tableBet = Mathf.Clamp(tableBet, minimum, maximum); if (num != tableBet && Object.op_Implicit((Object)(object)tablePanel) && tablePanel.activeSelf) { DrawTableControls(); } } } private string ResultText(CasinoState state) { if (state.game >= 1 && state.game <= 3 && !state.handActive) { return state.message + " | Returned: " + state.payout.ToString("N0") + " gold | Net: " + (state.payout - state.wager).ToString("+0;-0;0"); } return state.message; } private void ChangeBet(int delta) { SetBet((long)bet + (long)delta); } private void SetBet(long amount) { if (animating || Plugin.Waiting) { return; } CasinoState state = State; if (state == null || !state.handActive) { bet = (int)Math.Max(Plugin.MinimumBet, Math.Min(Plugin.MaximumBet, amount)); if (Object.op_Implicit((Object)(object)wagerText)) { ((TMP_Text)wagerText).text = "Wager: " + bet.ToString("N0"); } if (Object.op_Implicit((Object)(object)modal) && modal.activeSelf) { DrawPage(); } } } private void Act(ActionKind action, int choice = 0, int number = 0) { if (!animating && !Plugin.Waiting && (action == ActionKind.Slots || action == ActionKind.Sell)) { if (action == ActionKind.Slots && Object.op_Implicit((Object)(object)activeSlotMachine)) { number = activeSlotMachine.Index + 1; } lastAction = action; Notify("Processing…"); Plugin.Send(action, bet, choice, number); } } private void ClearPage() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) foreach (AsyncOperationHandle<Sprite> iconHandle in iconHandles) { if (iconHandle.IsValid()) { Addressables.Release<Sprite>(iconHandle); } } iconHandles.Clear(); foreach (Transform item in (Transform)content) { ((Component)item).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)item).gameObject); } } private void DrawPage() { if (Object.op_Implicit((Object)(object)content)) { ClearPage(); if (Object.op_Implicit((Object)(object)wagerText)) { ((TMP_Text)wagerText).text = "Wager: " + bet.ToString("N0"); } DrawSales(); } } private void DrawSales() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Expected O, but got Unknown //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) Anchors(((TMP_Text)Label((Transform)(object)content, "Sell one permanent item at a time. Select an item, then confirm the sale.", 19f, Muted, (TextAlignmentOptions)514)).rectTransform, 0f, 0.88f, 1f, 1f); RectTransform val = Rect((Transform)(object)content, "SellScroll"); Anchors(val, 0f, 0.18f, 1f, 0.85f); ScrollRect obj = ((Component)val).gameObject.AddComponent<ScrollRect>(); obj.horizontal = false; ((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = new Color(0.03f, 0.035f, 0.05f, 0.4f); ((Component)val).gameObject.AddComponent<RectMask2D>(); RectTransform val2 = Rect((Transform)(object)val, "Items"); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(1f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = Vector2.zero; VerticalLayoutGroup obj2 = ((Component)val2).gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 6f; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((Component)val2).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; obj.content = val2; obj.viewport = val; SaleItem[] array = State?.items; if (array == null || array.Length == 0) { ((Component)Label((Transform)(object)val2, "No sellable permanent items in your inventory.", 22f, Muted, (TextAlignmentOptions)514)).gameObject.AddComponent<LayoutElement>().preferredHeight = 60f; } else { SaleItem[] array2 = array; foreach (SaleItem saleItem in array2) { ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)saleItem.index); if (!Object.op_Implicit((Object)(object)itemDef)) { continue; } int index = saleItem.index; MPButton val3 = Button((Transform)(object)val2, "", (UnityAction)delegate { selectedItem = index; DrawPage(); }); ((Component)val3).gameObject.AddComponent<LayoutElement>().preferredHeight = 54f; if (selectedItem == index) { ((Component)val3).GetComponent<TableButtonStyle>().SetPrimary(value: true); } RectTransform val4 = Rect(((Component)val3).transform, "ItemIcon"); Anchors(val4, 0.012f, 0.1f, 0.062f, 0.9f); Image image = ((Component)val4).gameObject.AddComponent<Image>(); ((Graphic)image).raycastTarget = false; image.sprite = itemDef.pickupIconSprite; ((Behaviour)image).enabled = Object.op_Implicit((Object)(object)image.sprite); if (!Object.op_Implicit((Object)(object)image.sprite) && itemDef.pickupIconSpriteReference != null && ((AssetReference)itemDef.pickupIconSpriteReference).RuntimeKeyIsValid()) { AsyncOperationHandle<Sprite> item = Addressables.LoadAssetAsync<Sprite>(((AssetReference)itemDef.pickupIconSpriteReference).RuntimeKey); iconHandles.Add(item); item.Completed += delegate(AsyncOperationHandle<Sprite> h) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)image) && (int)h.Status == 1) { image.sprite = h.Result; ((Behaviour)image).enabled = true; } }; } Anchors(((TMP_Text)Label(((Component)val3).transform, Language.GetString(itemDef.nameToken) + " ×" + saleItem.count, 20f, Color.white, (TextAlignmentOptions)4097)).rectTransform, 0.08f, 0f, 0.76f, 1f); Anchors(((TMP_Text)Label(((Component)val3).transform, "+" + saleItem.price.ToString("N0") + " gold", 20f, Gold, (TextAlignmentOptions)4100)).rectTransform, 0.77f, 0f, 0.98f, 1f); TooltipProvider obj3 = ((Component)val3).gameObject.AddComponent<TooltipProvider>(); obj3.titleToken = itemDef.nameToken; obj3.bodyToken = itemDef.descriptionToken; } } SaleItem saleItem2 = array?.FirstOrDefault((SaleItem saleItem3) => saleItem3.index == selectedItem); ((Selectable)PlaceButton((saleItem2 == null) ? "Select an item" : ("Sell 1 for " + saleItem2.price.ToString("N0") + " gold"), 0.23f, 0f, 0.77f, 0.15f, (UnityAction)delegate { if (selectedItem >= 0) { Act(ActionKind.Sell, selectedItem); } })).interactable = saleItem2 != null; } private Texture2D MakeWheel() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00d9: 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_00c3: 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_0138: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[65536]; for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { float num = (float)j - 127.5f; float num2 = (float)i - 127.5f; float num3 = Mathf.Sqrt(num * num + num2 * num2); float num4 = Mathf.Atan2(num, num2) + MathF.PI / 37f; if (num4 < 0f) { num4 += MathF.PI * 2f; } int num5 = Mathf.FloorToInt(num4 * 37f / (MathF.PI * 2f)) % 37; int num6 = Games.Wheel[num5]; Color val2 = ((num6 == 0) ? new Color(0.12f, 0.4f, 0.28f) : (Games.IsRed(num6) ? new Color(0.65f, 0.1f, 0.17f) : new Color(0.09f, 0.11f, 0.16f))); array[i * 256 + j] = (Color)((num3 > 127f) ? Color.clear : ((num3 > 123f || (num3 > 74f && num3 < 78f)) ? Gold : ((num3 < 74f) ? new Color(0.055f, 0.065f, 0.09f) : val2))); } } val.SetPixels(array); val.Apply(); return val; } private MPButton PlaceButton(string text, float x0, float y0, float x1, float y1, UnityAction action) { MPButton obj = Button((Transform)(object)content, text, action); Transform transform = ((Component)obj).transform; Anchors((RectTransform)(object)((transform is RectTransform) ? transform : null), x0, y0, x1, y1); ((Selectable)obj).interactable = !animating && !Plugin.Waiting; return obj; } private MPButton Button(Transform parent, string text, UnityAction action) { //IL_002e: 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) RectTransform val = Rect(parent, "CasinoButton"); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)val2).color = new Color(0.065f, 0.105f, 0.14f, 0.94f); MPButton obj = ((Component)val).gameObject.AddComponent<MPButton>(); ((Selectable)obj).targetGraphic = (Graphic)(object)val2; ((UnityEvent)((Button)obj).onClick).AddListener(action); TextMeshProUGUI val3 = Label((Transform)(object)val, text, 21f, Color.white, (TextAlignmentOptions)514); Anchors(((TMP_Text)val3).rectTransform, 0.055f, 0.06f, 0.945f, 0.94f); ((TMP_Text)val3).enableAutoSizing = true; ((TMP_Text)val3).fontSizeMin = 14f; ((TMP_Text)val3).fontSizeMax = 22f; TableButtonStyle.Apply((Button)(object)obj, val2, val3, primary: false); return obj; } private RectTransform Rect(Transform parent, string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0031: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return (RectTransform)val.transform; } private TextMeshProUGUI Label(Transform parent, string text, float size, Color color, TextAlignmentOptions alignment = (TextAlignmentOptions)514) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI obj = ((Component)Rect(parent, "Label")).gameObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)obj).font = font; ((TMP_Text)obj).text = text; ((TMP_Text)obj).fontSize = size; ((Graphic)obj).color = color; ((TMP_Text)obj).alignment = alignment; ((Graphic)obj).raycastTarget = false; ((TMP_Text)obj).enableWordWrapping = false; ((TMP_Text)obj).overflowMode = (TextOverflowModes)1; return obj; } private static void Anchors(RectTransform rect, float x0, float y0, float x1, float y1) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_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_0029: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = new Vector2(x0, y0); rect.anchorMax = new Vector2(x1, y1); Vector2 offsetMin = (rect.offsetMax = Vector2.zero); rect.offsetMin = offsetMin; } private static void Stretch(RectTransform rect) { Anchors(rect, 0f, 0f, 1f, 1f); } private void OnDestroy() { //IL_0026: 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_0035: Unknown result type (might be due to invalid IL or missing references) art.Dispose(); Close(); CaseArtwork.Release(); foreach (AsyncOperationHandle<Sprite> iconHandle in iconHandles) { if (iconHandle.IsValid()) { Addressables.Release<Sprite>(iconHandle); } } if (Object.op_Implicit((Object)(object)canvasRoot)) { Object.Destroy((Object)(object)canvasRoot); } if (Object.op_Implicit((Object)(object)wheelTexture)) { Object.Destroy((Object)(object)wheelTexture); } TableButtonStyle.Release(); } private Image Artwork(Transform parent, string name, string asset) { Image obj = ((Component)Rect(parent, name)).gameObject.AddComponent<Image>(); obj.sprite = art.Get(asset); obj.preserveAspect = true; ((Graphic)obj).raycastTarget = false; return obj; } private void RememberCards(CasinoState state) { shownPlayer = state?.player?.ToArray() ?? Array.Empty<int>(); shownDealer = state?.dealer?.ToArray() ?? Array.Empty<int>(); } private void DrawBlackjack() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Expected O, but got Unknown //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Expected O, but got Unknown //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Expected O, but got Unknown RectTransform obj = Rect((Transform)(object)content, "BlackjackFelt"); Stretch(obj); ((Graphic)((Component)obj).gameObject.AddComponent<Image>()).color = new Color(0.045f, 0.19f, 0.15f); Anchors(((TMP_Text)Label((Transform)(object)content, "6 decks • Dealer stands on all 17s • Blackjack pays 3:2", 17f, Muted, (TextAlignmentOptions)514)).rectTransform, 0f, 0.92f, 1f, 1f); bool flag = State?.handActive ?? false; dealerTitle = Label((Transform)(object)content, "DEALER" + ((!flag && State?.dealer != null) ? (" · " + State.dealerTotal) : ""), 20f, Gold, (TextAlignmentOptions)514); Anchors(((TMP_Text)dealerTitle).rectTransform, 0f, 0.83f, 1f, 0.92f); DrawCards(State?.dealer, 0.53f, 0.82f, dealerCards); playerTitle = Label((Transform)(object)content, "YOUR HAND" + ((State?.player != null) ? (" · " + State.playerTotal) : ""), 20f, Gold, (TextAlignmentOptions)514); Anchors(((TMP_Text)playerTitle).rectTransform, 0f, 0.42f, 1f, 0.52f); DrawCards(State?.player, 0.12f, 0.41f, playerCards); Image obj2 = Artwork((Transform)(object)content, "Deck", "back"); Anchors(((Graphic)obj2).rectTransform, 0.89f, 0.48f, 0.97f, 0.78f); ((Transform)((Graphic)obj2).rectTransform).localEulerAngles = new Vector3(0f, 0f, -12f); if (flag) { PlaceButton("Hit", 0.1f, 0f, 0.32f, 0.105f, (UnityAction)delegate { Act(ActionKind.Hit); }); PlaceButton("Stand", 0.39f, 0f, 0.61f, 0.105f, (UnityAction)delegate { Act(ActionKind.Stand); }); ((Selectable)PlaceButton("Double", 0.68f, 0f, 0.9f, 0.105f, (UnityAction)delegate { Act(ActionKind.Double); })).interactable = !animating && !Plugin.Waiting && State.canDouble; } else { PlaceButton("Deal — " + bet.ToString("N0") + " gold", 0.3f, 0f, 0.7f, 0.105f, (UnityAction)delegate { Act(ActionKind.Deal); }); } } private void DrawCards(int[] cards, float y0, float y1, List<Image> images) { images.Clear(); if (cards != null && cards.Length != 0) { float num = Mathf.Min(0.087f, 0.76f / (float)cards.Length); float num2 = 0.48f - (float)cards.Length * num / 2f; for (int i = 0; i < cards.Length; i++) { Image val = Artwork((Transform)(object)content, "PlayingCard", (cards[i] < 0) ? "back" : ("card" + cards[i])); Anchors(((Graphic)val).rectTransform, num2 + (float)i * num + 0.003f, y0, num2 + (float)(i + 1) * num - 0.003f, y1); images.Add(val); } } } private IEnumerator DealCard(Image image, int card, bool flipOnly = false) { ((Component)image).gameObject.SetActive(true); RectTransform rect = ((Graphic)image).rectTransform; if (flipOnly) { image.sprite = art.Get("back"); for (float t = 0f; t < 0.42f; t += Time.unscaledDeltaTime) { float num = t / 0.42f; ((Transform)rect).localScale = new Vector3(Mathf.Abs(1f - 2f * num), 1f, 1f); if (num >= 0.5f) { image.sprite = art.Get((card < 0) ? "back" : ("card" + card)); } yield return null; } } else { image.sprite = art.Get((card < 0) ? "back" : ("card" + card)); for (float t = 0f; t < 0.34f; t += Time.unscaledDeltaTime) { float num2 = 1f - Mathf.Pow(1f - Mathf.Clamp01(t / 0.34f), 3f); rect.anchoredPosition = new Vector2(500f, 140f) * (1f - num2); ((Transform)rect).localEulerAngles = new Vector3(0f, 0f, -25f * (1f - num2)); ((Transform)rect).localScale = Vector3.one * (0.65f + 0.35f * num2); yield return null; } } rect.anchoredPosition = Vector2.zero; ((Transform)rect).localScale = Vector3.one; ((Transform)rect).localEulerAngles = Vector3.zero; yield return (object)new WaitForSecondsRealtime(0.1f); } private IEnumerator AnimateCards(CasinoState state) { if (pageIndex != 0) { yield break; } ((TMP_Text)dealerTitle).text = "DEALER"; ((TMP_Text)playerTitle).text = "YOUR HAND"; bool flag = lastAction == ActionKind.Deal; int num = ((!flag) ? shownPlayer.Length : 0); int oldDealer = ((!flag) ? shownDealer.Length : 0); for (int i = num; i < playerCards.Count; i++) { ((Component)playerCards[i]).gameObject.SetActive(false); } for (int j = oldDealer; j < dealerCards.Count; j++) { ((Component)dealerCards[j]).gameObject.SetActive(false); } bool reveal = !flag && shownDealer.Length > 1 && shownDealer[1] < 0 && state.dealer.Length > 1 && state.dealer[1] >= 0; if (reveal) { dealerCards[1].sprite = art.Get("back"); } if (flag) { for (int k = 0; k < 2; k++) { yield return DealCard(playerCards[k], state.player[k]); yield return DealCard(dealerCards[k], (k == 1) ? (-1) : state.dealer[k]); } if (!state.handActive) { yield return DealCard(dealerCards[1], state.dealer[1], flipOnly: true); } } else { for (int k = num; k < playerCards.Count; k++) { yield return DealCard(playerCards[k], state.player[k]); } if (reveal) { yield return DealCard(dealerCards[1], state.dealer[1], flipOnly: true); } for (int k = Math.Max(2, oldDealer); k < dealerCards.Count; k++) { yield return DealCard(dealerCards[k], state.dealer[k]); } } RememberCards(state); } private void DrawRoulette() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_033f: 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_035d: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0464: 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_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: 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_073a: Unknown result type (might be due to invalid IL or missing references) //IL_0788: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Expected O, but got Unknown //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Expected O, but got Unknown //IL_07e0: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: Expected O, but got Unknown //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) Anchors(((TMP_Text)Label((Transform)(object)content, "Click a spot to add a chip • Right-click to remove one • Each chip = " + bet.ToString("N0") + " gold • Single zero", 16f, Muted, (TextAlignmentOptions)514)).rectTransform, 0f, 0.93f, 1f, 1f); RectTransform val = Rect((Transform)(object)content, "WheelHolder"); Anchors(val, 0f, 0.22f, 0.3f, 0.93f); RectTransform val2 = Rect((Transform)(object)val, "WheelArea"); Stretch(val2); AspectRatioFitter obj = ((Component)val2).gameObject.AddComponent<AspectRatioFitter>(); obj.aspectMode = (AspectMode)3; obj.aspectRatio = 1f; wheel = Rect((Transform)(object)val2, "Rotor"); Stretch(wheel); if (!Object.op_Implicit((Object)(object)wheelTexture)) { wheelTexture = MakeWheel(); } ((Component)wheel).gameObject.AddComponent<RawImage>().texture = (Texture)(object)wheelTexture; Vector2 val4 = default(Vector2); for (int i = 0; i < 37; i++) { float num = (float)i * MathF.PI * 2f / 37f; TextMeshProUGUI val3 = Label((Transform)(object)wheel, Games.Wheel[i].ToString(), 14f, Color.white, (TextAlignmentOptions)514); RectTransform rectTransform = ((TMP_Text)val3).rectTransform; RectTransform rectTransform2 = ((TMP_Text)val3).rectTransform; ((Vector2)(ref val4))..ctor(0.5f + Mathf.Sin(num) * 0.43f, 0.5f + Mathf.Cos(num) * 0.43f); rectTransform2.anchorMax = val4; rectTransform.anchorMin = val4; ((TMP_Text)val3).rectTransform.sizeDelta = new Vector2(22f, 22f); ((Transform)((TMP_Text)val3).rectTransform).localEulerAngles = new Vector3(0f, 0f, (float)(-i) * 360f / 37f); } wheelResult = Label((Transform)(object)val2, (lastWheel < 0) ? "SPIN" : lastWheel.ToString(), 34f, Gold, (TextAlignmentOptions)514); Anchors(((TMP_Text)wheelResult).rectTransform, 0.3f, 0.32f, 0.7f, 0.68f); for (int j = 0; j < 8; j++) { float num2 = (float)j * MathF.PI / 4f; RectTransform obj2 = Rect((Transform)(object)val2, "BowlDeflector"); ((Vector2)(ref val4))..ctor(0.5f + Mathf.Sin(num2) * 0.452f, 0.5f + Mathf.Cos(num2) * 0.452f); obj2.anchorMax = val4; obj2.anchorMin = val4; obj2.sizeDelta = new Vector2(3f, 7f); ((Transform)obj2).localEulerAngles = new Vector3(0f, 0f, (float)(-j * 45)); Image obj3 = ((Component)obj2).gameObject.AddComponent<Image>(); ((Graphic)obj3).color = Gold; ((Graphic)obj3).raycastTarget = false; } ball = ((Graphic)Artwork((Transform)(object)val2, "Ball", "ball")).rectTransform; RectTransform obj4 = ball; RectTransform obj5 = ball; ((Vector2)(ref val4))..ctor(0.5f, 0.5f); obj5.anchorMax = val4; obj4.anchorMin = val4; ball.sizeDelta = new Vector2(11f, 11f); ((Component)ball).gameObject.SetActive(animating || lastWheel >= 0); if (lastWheel >= 0) { PositionBall(new BallFrame(0f, (double)Array.IndexOf(Games.Wheel, lastWheel) * Math.PI * 2.0 / 37.0, 0.8, 0.0)); } RectTransform val5 = Rect((Transform)(object)content, "RouletteTable"); Anchors(val5, 0.32f, 0.22f, 1f, 0.91f); ((Graphic)((Component)val5).gameObject.AddComponent<Image>()).color = new Color(0.045f, 0.24f, 0.17f); Spot((Transform)(object)val5, "0", 6, 0, 0f, 0.34f, 0.065f, 0.98f, new Color(0.07f, 0.4f, 0.25f)); for (int k = 0; k < 12; k++) { for (int l = 0; l < 3; l++) { int num3 = k * 3 + 3 - l; float num4 = 0.07f + (float)k * 0.0712f; float num5 = 0.765f - (float)l * 0.215f; Spot((Transform)(object)val5, num3.ToString(), 6, num3, num4, num5, num4 + 0.068f, num5 + 0.205f, Games.IsRed(num3) ? new Color(0.64f, 0.12f, 0.17f) : new Color(0.055f, 0.07f, 0.09f)); } } for (int m = 0; m < 3; m++) { float num6 = 0.765f - (float)m * 0.215f; Spot((Transform)(object)val5, "2:1", 12 - m, 0, 0.93f, num6, 0.998f, num6 + 0.205f, new Color(0.08f, 0.29f, 0.21f)); } for (int n = 0; n < 3; n++) { Spot((Transform)(object)val5, (new string[3] { "1st 12", "2nd 12", "3rd 12" })[n], 7 + n, 0, 0.07f + (float)n * 0.285f, 0.175f, 0.07f + (float)(n + 1) * 0.285f - 0.005f, 0.325f, new Color(0.08f, 0.29f, 0.21f)); } string[] array = new string[6] { "1–18", "Even", "Red", "Black", "Odd", "19–36" }; int[] array2 = new int[6] { 4, 2, 0, 1, 3, 5 }; for (int num7 = 0; num7 < 6; num7++) { Spot((Transform)(object)val5, array[num7], array2[num7], 0, 0.07f + (float)num7 * 0.1425f, 0.01f, 0.07f + (float)(num7 + 1) * 0.1425f - 0.004f, 0.16f, (Color)(num7 switch { 3 => new Color(0.055f, 0.07f, 0.09f), 2 => new Color(0.64f, 0.12f, 0.17f), _ => new Color(0.08f, 0.29f, 0.21f), })); } Anchors(((TMP_Text)Label((Transform)(object)content, "On table: " + chips.Sum((RouletteBet c) => c.amount).ToString("N0") + " gold", 20f, Gold, (TextAlignmentOptions)514)).rectTransform, 0.32f, 0.115f, 0.65f, 0.21f); PlaceButton("Undo chip", 0.02f, 0.015f, 0.15f, 0.105f, new UnityAction(UndoChip)); PlaceButton("Clear", 0.17f, 0.015f, 0.29f, 0.105f, (UnityAction)delegate { if (!animating && !Plugin.Waiting) { chips.Clear(); chipHistory.Clear(); DrawPage(); } }); ((Selectable)PlaceButton("SPIN", 0.68f, 0.025f, 0.99f, 0.15f, new UnityAction(SpinRoulette))).interactable = !animating && !Plugin.Waiting && chips.Count > 0; } private void SpinRoulette() { if (chips.Count != 0 && !animating && !Plugin.Waiting) { lastAction = ActionKind.Roulette; Notify("Launching ball…"); Plugin.Send(ActionKind.Roulette, 0, 0, 0, chips.Select((RouletteBet c) => new RouletteBet { choice = c.choice, number = c.number, amount = c.amount }).ToArray()); } } private void UndoChip() { if (!animating && !Plugin.Waiting && chipHistory.Count != 0) { Tuple<int, int, int> tuple = chipHistory[chipHistory.Count - 1]; chipHistory.RemoveAt(chipHistory.Count - 1); RemoveChip(tuple.Item1, tuple.Item2, tuple.Item3); DrawPage(); } } private void RemoveChip(int choice, int number, int amount) { RouletteBet rouletteBet = chips.FirstOrDefault((RouletteBet c) => c.choice == choice && c.number == number); if (rouletteBet != null) { rouletteBet.amount -= Math.Min(rouletteBet.amount, amount); if (rouletteBet.amount == 0) { chips.Remove(rouletteBet); } } } private void Spot(Transform parent, string text, int choice, int number, float x0, float y0, float x1, float y1, Color color) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect(parent, "Spot_" + choice + "_" + number); Anchors(val, x0, y0, x1, y1); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)val2).color = color; Outline obj = ((Component)val).gameObject.AddComponent<Outline>(); ((Shadow)obj).effectColor = new Color(0.8f, 0.85f, 0.77f, 0.6f); ((Shadow)obj).effectDistance = new Vector2(1f, -1f); Button obj2 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)obj2).targetGraphic = (Graphic)(object)val2; ((Selectable)obj2).interactable = !animating && !Plugin.Waiting; TextMeshProUGUI obj3 = Label((Transform)(object)val, text, 17f, Color.white, (TextAlignmentOptions)514); Anchors(((TMP_Text)obj3).rectTransform, 0f, 0.12f, 1f, 0.95f); ((TMP_Text)obj3).enableAutoSizing = true; ((TMP_Text)obj3).fontSizeMin = 11f; ((TMP_Text)obj3).fontSizeMax = 17f; ((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate { AddChip(choice, number); }); ((Component)val).gameObject.AddComponent<CasinoRightClick>().clicked = delegate { if (!animating && !Plugin.Waiting) { int num = chipHistory.FindLastIndex((Tuple<int, int, int> c) => c.Item1 == choice && c.Item2 == number); if (num >= 0) { Tuple<int, int, int> tuple = chipHistory[num]; chipHistory.RemoveAt(num); RemoveChip(choice, number, tuple.Item3); DrawPage(); } } }; RouletteBet rouletteBet = chips.FirstOrDefault((RouletteBet c) => c.choice == choice && c.number == number); if (rouletteBet != null) { Image val3 = Artwork((Transform)(object)val, "PlacedChip", "chip"); Anchors(((Graphic)val3).rectTransform, 0.38f, 0f, 0.99f, 0.59f); TextMeshProUGUI obj4 = Label(((Component)val3).transform, Compact(rouletteBet.amount), 11f, new Color(0.12f, 0.08f, 0.025f), (TextAlignmentOptions)514); Stretch(((TMP_Text)obj4).rectTransform); ((TMP_Text)obj4).fontStyle = (FontStyles)1; } } private static string Compact(int amount) { if (amount < 1000000) { if (amount < 1000) { return amount.ToString(); } return ((float)amount / 1000f).ToString("0.#") + "k"; } return ((float)amount / 1000000f).ToString("0.#") + "m"; } private void AddChip(int choice, int number) { if (animating || Plugin.Waiting) { return; } long num = (long)chips.Sum((RouletteBet c) => c.amount) + (long)bet; if (num > (State?.maxBet ?? 100000) || num > (Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) ? CasinoPlugin.LocalMaster.money : 0)) { Notify("Not enough gold or table limit reached."); return; } CasinoState state = State; if (state != null && state.handActive) { Notify("Finish your blackjack hand first."); return; } RouletteBet rouletteBet = chips.FirstOrDefault((RouletteBet c) => c.choice == choice && c.number == number); if (rouletteBet == null) { rouletteBet = new RouletteBet { choice = choice, number = number }; chips.Add(rouletteBet); } rouletteBet.amount += bet; chipHistory.Add(Tuple.Create(choice, number, bet)); DrawPage(); CasinoRightClick? casinoRightClick = ((Component)content).GetComponentsInChildren<CasinoRightClick>().FirstOrDefault((CasinoRightClick c) => ((Object)c).name == "Spot_" + choice + "_" + number); Transform obj = ((casinoRightClick != null) ? ((Component)casinoRightClick).transform.Find("PlacedChip") : null); RectTransform val = (RectTransform)(object)((obj is RectTransform) ? obj : null); if (Object.op_Implicit((Object)(object)val)) { ((MonoBehaviour)this).StartCoroutine(DropChip(val)); } } private IEnumerator DropChip(RectTransform chip) { for (float t = 0f; t < 0.22f; t += Time.unscaledDeltaTime) { if (!Object.op_Implicit((Object)(object)chip)) { yield break; } float num = Mathf.Clamp01(t / 0.22f); chip.anchoredPosition = new Vector2(0f, (1f - num) * (1f - num) * 50f); ((Transform)chip).localScale = Vector3.one * (1f + 0.2f * Mathf.Sin(num * MathF.PI)); yield return null; } if (Object.op_Implicit((Object)(object)chip)) { chip.anchoredPosition = Vector2.zero; ((Transform)chip).localScale = Vector3.one; } } private void PositionBall(BallFrame frame) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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) if (Object.op_Implicit((Object)(object)ball) && Object.op_Implicit((Object)(object)wheel)) { ((Transform)wheel).localEulerAngles = new Vector3(0f, 0f, (0f - frame.wheel) * 57.29578f); RectTransform obj = ball; RectTransform obj2 = ball; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f + Mathf.Sin(frame.angle) * frame.radius * 0.5f, 0.5f + Mathf.Cos(frame.angle) * frame.radius * 0.5f); obj2.anchorMax = val; obj.anchorMin = val; ball.anchoredPosition = Vector2.zero; } } private IEnumerator AnimateWheel(CasinoState state) { RouletteSpin physics = new RouletteSpin(state.spinSeed); if (physics.number != state.wheelNumber) { Debug.LogWarning((object)"[BazaarCasino] Roulette replay differs from authoritative result."); } float start = Time.unscaledTime; int index = 0; while (Time.unscaledTime - start < physics.duration) { float num; for (num = Time.unscaledTime - start; index + 1 < physics.frames.Count && physics.frames[index + 1].time <= num; index++) { } BallFrame ballFrame = physics.frames[index]; BallFrame ballFrame2 = physics.frames[Math.Min(index + 1, physics.frames.Count - 1)]; float num2 = ((ballFrame2.time > ballFrame.time) ? Mathf.Clamp01((num - ballFrame.time) / (ballFrame2.time - ballFrame.time)) : 1f); PositionBall(new BallFrame(num, Mathf.Lerp(ballFrame.angle, ballFrame2.angle, num2), Mathf.Lerp(ballFrame.radius, ballFrame2.radius, num2), Mathf.Lerp(ballFrame.wheel, ballFrame2.wheel, num2))); if (Object.op_Implicit((Object)(object)wheelResult)) { ((TMP_Text)wheelResult).text = "…"; } yield return null; } PositionBall(physics.frames[physics.frames.Count - 1]); lastWheel = state.wheelNumber; if (Object.op_Implicit((Object)(object)wheelResult)) { ((TMP_Text)wheelResult).text = lastWheel.ToString(); } } private void DrawSlots() { //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) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Expected O, but got Unknown //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Expected O, but got Unknown reels.Clear(); RectTransform val = Rect((Transform)(object)content, "SlotCabinet"); Anchors(val, 0.1f, 0.17f, 0.88f, 0.98f); ((Graphic)((Component)val).gameObject.AddComponent<Image>()).color = new Color(0.11f, 0.12f, 0.19f); Outline obj = ((Component)val).gameObject.AddComponent<Outline>(); ((Shadow)obj).effectColor = Gold; ((Shadow)obj).effectDistance = new Vector2(3f, -3f); Anchors(((TMP_Text)Label((Transform)(object)val, "BAZAAR JACKPOT", 31f, Gold, (TextAlignmentOptions)514)).rectTransform, 0.05f, 0.8f, 0.95f, 0.99f); for (int i = 0; i < 3; i++) { RectTransform val2 = Rect((Transform)(object)val, "ReelWindow"); Anchors(val2, 0.08f + (float)i * 0.29f, 0.16f, 0.34f + (float)i * 0.29f, 0.78f); ((Graphic)((Component)val2).gameObject.AddComponent<Image>()).color = new Color(0.045f, 0.065f, 0.09f); ((Component)val2).gameObject.AddComponent<RectMask2D>(); ReelView reelView = new ReelView { strip = Rect((Transform)(object)val2, "SlidingReel") }; Stretch(reelView.strip); reels.Add(reelView); for (int j = 0; j < 3; j++) { Image val3 = Artwork((Transform)(object)reelView.strip, "ReelSymbol", "slot" + ((lastReels == null) ? i : lastReels[i])); Anchors(((Graphic)val3).rectTransform, 0.08f, ReelLayout.Lower(j), 0.92f, ReelLayout.Upper(j)); reelView.symbols.Add(val3); } } RectTransform obj2 = Rect((Transform)(object)val, "PayLine"); Anchors(obj2, 0.07f, 0.468f, 0.93f, 0.472f); ((Graphic)((Component)obj2).gameObject.AddComponent<Image>()).color = new Color(1f, 0.83f, 0.35f, 0.35f); ((Graphic)((Component)obj2).GetComponent<Image>()).raycastTarget = false; Anchors(((TMP_Text)Label((Transform)(object)val, "3 matching symbols win • Any pair returns your wager", 15f, Muted, (TextAlignmentOptions)514)).rectTransform, 0.02f, 0.025f, 0.98f, 0.13f); RectTransform obj3 = Rect((Transform)(object)content, "LeverRail"); Anchors(obj3, 0.92f, 0.33f, 0.937f, 0.72f); ((Graphic)((Component)obj3).gameObject.AddComponent<Image>()).color = Gold; lever = Rect((Transform)(object)content, "PullLever"); Anchors(lever, 0.895f, 0.63f, 0.965f, 0.82f); Image val4 = ((Component)lever).gameObject.AddComponent<Image>(); val4.sprite = art.Get("ball"); ((Graphic)val4).color = new Color(0.95f, 0.28f, 0.36f); val4.preserveAspect = true; Button obj4 = ((Component)lever).gameObject.AddComponent<Button>(); ((Selectable)obj4).targetGraphic = (Graphic)(object)val4; ((UnityEvent)obj4.onClick).AddListener((UnityAction)delegate { Act(ActionKind.Slots); }); ((Selectable)obj4).interactable = !animating && !Plugin.Waiting; Anchors(((TMP_Text)Label((Transform)(object)content, "PULL", 16f, Gold, (TextAlignmentOptions)514)).rectTransform, 0.885f, 0.25f, 0.98f, 0.33f); Anchors(((TMP_Text)Label((Transform)(object)content, "Cherry 3× Lemon 5× Bell 8× Star 12× Seven 25× Moon 60×", 17f, Muted, (TextAlignmentOptions)514)).rectTransform, 0.02f, 0.09f, 0.98f, 0.16f); PlaceButton("Pull lever — " + bet.ToString("N0") + " gold", 0.3f, 0f, 0.7f, 0.085f, (UnityAction)delegate { Act(ActionKind.Slots); }); } private IEnumerator AnimateReels(CasinoState state) { if (pageIndex != 2) { yield break; } Canvas.ForceUpdateCanvases(); Random random = new Random(state.requestId.GetHashCode()); int[,] strips = new int[3, 43]; for (int i = 0; i < 3; i++) { for (int j = 0; j < 43; j++) { strips[i, j] = random.Next(6); } } float[] durations = new float[3] { 2.6f, 3.15f, 3.7f }; int[] turns = new int[3] { 24, 31, 38 }; for (int k = 0; k < 3; k++) { strips[k, turns[k]] = state.reels[k]; } bool[] stopped = new bool[3]; float start = Time.unscaledTime; while (Time.unscaledTime - start < 3.85f) { float num = Time.unscaledTime - start; if (Object.op_Implicit((Object)(object)lever)) { float num2 = ((num < 0.25f) ? (num / 0.25f) : (1f - Mathf.Clamp01((num - 0.25f) / 0.4f))); lever.anchoredPosition = new Vector2(0f, -115f * num2); ((Transform)lever).localEulerAngles = new Vector3(0f, 0f, 10f * num2); } for (int l = 0; l < reels.Count; l++) { float num3 = Mathf.Clamp01(num / durations[l]); float num4 = (float)turns[l] * (1f - Mathf.Pow(1f - num3, 3f)); int num5 = Mathf.Min(turns[l], Mathf.FloorToInt(num4)); float num6 = num4 - (float)num5; for (int m = 0; m < 3; m++) { reels[l].symbols[m].sprite = art.Get("slot" + strips[l, Mathf.Clamp(num5 + m - 1, 0, 42)]); } RectTransform strip = reels[l].strip; float num7 = 0f - num6; Rect rect = reels[l].strip.rect; strip.anchoredPosition = new Vector2(0f, num7 * ((Rect)(ref rect)).height); if (num3 >= 1f && !stopped[l]) { stopped[l] = true; ((MonoBehaviour)this).StartCoroutine(ReelBounce(reels[l].strip)); } } yield return null; } lastReels = state.reels; if (Object.op_Implicit((Object)(object)lever)) { lever.anchoredPosition = Vector2.zero; ((Transform)lever).localEulerAngles = Vector3.zero; } foreach (ReelView reel in reels) { reel.strip.anchoredPosition = Vector2.zero; } } private IEnumerator ReelBounce(RectTransform strip) { for (float t = 0f; t < 0.16f; t += Time.unscaledDeltaTime) { if (!Object.op_Implicit((Object)(object)strip)) { yield break; } ((Transform)strip).localScale = new Vector3(1f, 1f + 0.05f * Mathf.Sin(t / 0.16f * MathF.PI), 1f); yield return null; } if (Object.op_Implicit((Object)(object)strip)) { ((Transform)strip).localScale = Vector3.one; } } private IEnumerator AnimateGame(CasinoState state) { if (state.game == 1) { yield return AnimateCards(state); } else if (state.game == 2) { yield return AnimateWheel(state); } else { yield return AnimateReels(state); } Notify(ResultText(state)); bool flag = state.game != 1 || !state.handActive; if (flag && state.payout > state.wager) { yield return Celebrate(state.game == 3 && state.reels.Distinct().Count() == 1 && state.reels[0] >= 4, state.payout - state.wager); } else if (flag && state.payout == state.wager && state.payout > 0) { yield return ResultBanner("WAGER RETURNED", Muted, 0.7f); } animating = false; animation = null; RememberCards(state); if (state.game == 2 && pageIndex == 1) { Button[] componentsInChildren = ((Component)content).GetComponentsInChildren<Button>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Selectable)componentsInChildren[i]).interactable = true; } } else { DrawPage(); } } private IEnumerator ResultBanner(string text, Color color, float duration) { //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) TextMeshProUGUI banner = Label((Transform)(object)content, text, 40f, color, (TextAlignmentOptions)514); Anchors(((TMP_Text)banner).rectTransform, 0.2f, 0.43f, 0.8f, 0.62f); ((TMP_Text)banner).fontStyle = (FontStyles)1; ((TMP_Text)banner).outlineWidth = 0.2f; ((TMP_Text)banner).outlineColor = Color32.op_Implicit(new Color(0f, 0f, 0f, 0.9f)); for (float t = 0f; t < duration; t += Time.unscaledDeltaTime) { ((Transform)((TMP_Text)banner).rectTransform).localScale = Vector3.one * (1f + 0.07f * Mathf.Sin(t * 10f)); yield return null; } Object.Destroy((Object)(object)((Component)banner).gameObject); } private IEnumerator Celebrate(bool jackpot, int net) { RectTransform effects = Rect((Transform)(object)content, "WinEffects"); Stretch(effects); Image overlay = ((Component)effects).gameObject.AddComponent<Image>(); ((Graphic)overlay).color = new Color(1f, 0.8f, 0.25f, 0.08f); ((Graphic)overlay).raycastTarget = false; TextMeshProUGUI banner = Label((Transform)(object)effects, (jackpot ? "JACKPOT!" : "YOU WIN") + "\n+" + net.ToString("N0") + " GOLD", jackpot ? 48 : 39, Gold, (TextAlignmentOptions)514); Anchors(((TMP_Text)banner).rectTransform, 0.2f, 0.37f, 0.8f, 0.67f); ((TMP_Text)banner).enableWordWrapping = true; ((TMP_Text)banner).fontStyle = (FontStyles)1; ((TMP_Text)banner).outlineWidth = 0.25f; ((TMP_Text)banner).outlineColor = Color32.op_Implicit(Color.black); Random random = new Random(); List<RectTransform> particles = new List<RectTransform>(); int count = (jackpot ? 58 : 28); float[] speed = new float[count]; float[] phase = new float[count]; Vector2 val = default(Vector2); for (int i = 0; i < count; i++) { RectTransform rectTransform = ((Graphic)Artwork((Transform)(object)effects, "WinCoin", "chip")).rectTransform; ((Vector2)(ref val))..ctor((float)random.NextDouble(), 1.15f); rectTransform.anchorMax = val; rectTransform.anchorMin = val; rectTransform.sizeDelta = new Vector2((float)(18 + random.Next(16)), (float)(18 + random.Next(16))); particles.Add(rectTransform); speed[i] = 170 + random.Next(280); phase[i] = (float)random.NextDouble() * 6f; } float duration = (jackpot ? 2.4f : 1.5f); for (float t = 0f; t < duration; t += Time.unscaledDeltaTime) { ((Graphic)overlay).color = new Color(1f, 0.8f, 0.25f, 0.04f + 0.08f * Mathf.Abs(Mathf.Sin(t * 6f))); ((Transform)((TMP_Text)banner).rectTransform).localScale = Vector3.one * (1f + 0.065f * Mathf.Sin(t * 8f) * Mathf.Exp(0f - t)); for (int j = 0; j < count; j++) { particles[j].anchoredPosition = new Vector2(Mathf.Sin(t * 3f + phase[j]) * 35f, (0f - t) * speed[j]); ((Transform)particles[j]).localEulerAngles = new Vector3(0f, 0f, t * 100f + phase[j] * 90f); } yield return null; } ((Component)effects).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)effects).gameObject); } private void ObserveInteractionRelease() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); Player val = ((firstLocalUser != null) ? firstLocalUser.inputPlayer : null); interactionGate.Observe(Input.GetMouseButton(0) || Input.GetKey((KeyCode)101) || (val != null && val.GetButton(5))); } internal void CloseFromEscape() { EscapeConsumedFrame = Time.frameCount; Close(); } private void OpenSlotOverlay(WorldSlotMachine machine) { if (Object.op_Implicit((Object)(object)machine) && CasinoPlugin.InBazaar && Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) && Init()) { Close(); activeSlotMachine = machine; bet = Mathf.Clamp(bet, Plugin.MinimumBet, Plugin.MaximumBet); BuildSlotOverlay(); HideMachineAvatar(); slotResponse = "Click lever to spin"; slotPanel.SetActive(true); machine.SetFocus(value: true); AttachSlotCamera(); Plugin.Send(ActionKind.State); } } private void BuildSlotOverlay() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)slotPanel)) { slotPanel = ((Component)Rect(canvasRoot.transform, "SlotCursorLifetime")).gameObject; Stretch((RectTransform)slotPanel.transform); slotPanel.SetActive(false); slotPanel.AddComponent<MPEventSystemProvider>().fallBackToMainEventSystem = true; slotPanel.AddComponent<CursorOpener>(); } } private void HideMachineAvatar() { CharacterBody val = (Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) ? CasinoPlugin.LocalMaster.GetBody() : null); slotModel = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.modelLocator) && Object.op_Implicit((Object)(object)val.modelLocator.modelTransform)) ? ((Component)val.modelLocator.modelTransform).GetComponent<CharacterModel>() : null); if (Object.op_Implicit((Object)(object)slotModel)) { CharacterModel obj = slotModel; int invisibilityCount = obj.invisibilityCount; obj.invisibilityCount = invisibilityCount + 1; } if (!Object.op_Implicit((Object)(object)val)) { return; } Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2) && !machineAvatarRenderers.ContainsKey(val2)) { machineAvatarRenderers[val2] = val2.forceRenderingOff; val2.forceRenderingOff = true; } } } private void PullWorldSlot() { if (IsSlotFocused && !activeSlotMachine.IsSpinning && !Plugin.Waiting) { slotResponse = "Waiting for host…"; Plugin.Send(ActionKind.Slots, bet, 0, activeSlotMachine.Index + 1); } } private void SlotResponse(CasinoState state) { if (state.game == 3) { slotResponse = null; } else if (state.message != "Welcome to the Bazaar Casino.") { slotResponse = state.message; } } internal void SlotTimedOut() { if (IsSlotFocused) { slotResponse = "Host did not respond. Reopen machine."; } } private void AttachSlotCamera() { CharacterBody val = (Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) ? CasinoPlugin.LocalMaster.GetBody() : null); foreach (CameraRigController readOnlyInstances in CameraRigController.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && Object.op_Implicit((Object)(object)val) && (Object)(object)readOnlyInstances.targetBody == (Object)(object)val && !slotCameras.Contains(readOnlyInstances) && !readOnlyInstances.hasOverride) { readOnlyInstances.SetOverrideCam((ICameraStateProvider)(object)this, 0.35f); slotCameras.Add(readOnlyInstances); } } } private void UpdateSlotOverlay() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_011e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)slotPanel) || !slotPanel.activeSelf) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)CasinoPlugin.LocalMaster) ? CasinoPlugin.LocalMaster.GetBody() : null); if (!CasinoPlugin.InBazaar || !Object.op_Implicit((Object)(object)activeSlotMachine) || !Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.healthComponent) || !val.healthComponent.alive || SceneExitController.isRunning) { Close(); return; } AttachSlotCamera(); bool flag = activeSlotMachine.IsSpinning || Plugin.Waiting; Camera viewCamera = CasinoBillboard.ViewCamera; bool flag2 = MPEventSystem.readOnlyInstancesList.Any((MPEventSystem e) => Object.op_Implicit((Object)(object)e) && ((EventSystem)e).IsPointerOverGameObject()); Ray ray = (Ray)(Object.op_Implicit((Object)(object)viewCamera) ? viewCamera.ScreenPointToRay(Input.mousePosition) : default(Ray)); int num = activeSlotMachine.HoverControls(ray, Object.op_Implicit((Object)(object)