Decompiled source of All Monkey Terminal Casino v1.2.2
BRCGambling.dll
Decompiled 5 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.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BombRushMP.Common.Packets; using BombRushMP.Plugin; using BombRushMP.Plugin.Gamemodes; using CommonAPI; using CommonAPI.Phone; using HarmonyLib; using Microsoft.CodeAnalysis; using Reptile; using TMPro; using UnityEngine; using UnityEngine.UI; using WallPlant; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BRCGambling")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8bea24d85093e52e470ed5e90278ffa2f3717a5e")] [assembly: AssemblyProduct("BRCGambling")] [assembly: AssemblyTitle("BRCGambling")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace BRCGambling { public enum EffectTrigger { Looping, OnSpray, OnJump, OnLand, OnWallPlant, OnBoostTrick, OnSlide, OnGraceEnd, OnDeath, OnEmote } public enum EffectPosition { Feet, Torso, AboveHead } public class EffectDefinition { public string Id; public string DisplayName; public string PrefabName; public RewardTier Rarity; public EffectPosition Position; public EffectTrigger Trigger; public Vector3 PositionOffset = Vector3.zero; public EffectDefinition(string id, string displayName, string prefabName, RewardTier rarity, EffectPosition position, EffectTrigger trigger, Vector3 offset = default(Vector3)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) Id = id; DisplayName = displayName; PrefabName = prefabName; Rarity = rarity; Position = position; Trigger = trigger; PositionOffset = offset; } } public static class EffectRegistry { public static readonly Dictionary<string, EffectDefinition> All = new Dictionary<string, EffectDefinition>(); public static void Register(EffectDefinition def) { All[def.Id] = def; } public static EffectDefinition Get(string id) { EffectDefinition value; return All.TryGetValue(id, out value) ? value : null; } public static List<EffectDefinition> GetPool(RewardTier rarity) { List<EffectDefinition> list = new List<EffectDefinition>(); foreach (EffectDefinition value in All.Values) { if (value.Rarity == rarity) { list.Add(value); } } return list; } public static void InitializeDefaults() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04fb: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0521: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05b9: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05e5: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_069d: 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) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06ca: Unknown result type (might be due to invalid IL or missing references) //IL_06ea: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_0762: Unknown result type (might be due to invalid IL or missing references) //IL_0782: 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_07a8: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07ce: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Unknown result type (might be due to invalid IL or missing references) Register(new EffectDefinition("common_skull_head", "Skull Head", "CFXR2 Skull Head Alt 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.Looping)); Register(new EffectDefinition("common_ground_hit", "Ground Hit", "CFXR2 Ground Hit 1", RewardTier.Common, EffectPosition.Feet, EffectTrigger.OnLand)); Register(new EffectDefinition("common_bubble_breath", "Bubble Breath", "CFXR4 Bubbles Breath Underwater Loop 1", RewardTier.Common, EffectPosition.Feet, EffectTrigger.Looping)); Register(new EffectDefinition("common_flash", "Flash", "CFXR Flash 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("common_magic_poof", "Magic Poof", "CFXR Magic Poof 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("common_smoke_source", "Smoke Source", "CFXR Smoke Source 3D 1", RewardTier.Common, EffectPosition.Feet, EffectTrigger.Looping)); Register(new EffectDefinition("common_poison_cloud", "Poison Cloud", "CFXR2 Poison Cloud 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.Looping)); Register(new EffectDefinition("common_ambient_glows", "Ambient Glows", "CFXR3 Ambient Glows 1", RewardTier.Common, EffectPosition.Feet, EffectTrigger.Looping)); Register(new EffectDefinition("common_wallplant_smoke", "Smoke Hit", "CFXR3 Hit Misc F Smoke 1", RewardTier.Common, EffectPosition.Torso, EffectTrigger.OnWallPlant)); Register(new EffectDefinition("rare_fire_hit", "Fire Hit", "CFXR3 Hit Fire B (Air) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_sun", "Sun", "CFXR4 Sun 1", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.Looping)); Register(new EffectDefinition("rare_electric_hit", "Electric Hit", "CFXR3 Hit Electric C (Air) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_explosion", "Explosion", "CFXR Explosion Smoke 2 Solo (HDR) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnGraceEnd)); Register(new EffectDefinition("rare_firework_shoot", "Firework Shoot", "CFXR4 Firework HDR Shoot Single (Random Color) 1", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_water_splash", "Water Splash", "CFXR Water Splash (Smaller) 1", RewardTier.Rare, EffectPosition.Feet, EffectTrigger.OnLand)); Register(new EffectDefinition("rare_broken_heart", "Broken Heart", "CFXR2 Broken Heart 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnDeath)); Register(new EffectDefinition("rare_smoke_hit", "Smoke Hit", "CFXR3 Hit Misc A 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_rain_fall", "Rain Fall", "CFXR4 Rain Falling 1", RewardTier.Rare, EffectPosition.AboveHead, EffectTrigger.Looping)); Register(new EffectDefinition("rare_ice_trail_wide", "Ice Trail (Wide)", "CFXR4 Sword Trail ICE (360 Thin Spiral) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_ice_trail_small", "Ice Trail (Small)", "CFXR4 Sword Trail ICE (360 Spiral) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_ice_hit", "Ice Hit", "CFXR4 Sword Hit ICE (Cross) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_fire_trail_wide", "Fire Trail (Wide)", "CFXR4 Sword Trail FIRE (360 Thin Spiral) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_fire_trail_small", "Fire Trail (Small)", "CFXR4 Sword Trail FIRE (360 Spiral) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("rare_fire_sword_hit", "Fire Hit (Sword)", "CFXR4 Sword Hit FIRE (Cross) 1", RewardTier.Rare, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("epic_big_explosion_smoke", "Big Explosion Smoke", "CFXR Explosion 2", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnGraceEnd)); Register(new EffectDefinition("epic_fire_explosion", "Fire Explosion", "CFXR3 Fire Explosion B 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("epic_firework", "Firework", "CFXR4 Firework 1 Cyan-Purple (HDR) 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("epic_hit_ice", "Hit Ice", "CFXR3 Hit Ice B (Air) 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnBoostTrick)); Register(new EffectDefinition("epic_falling_stars", "Falling Stars", "CFXR4 Falling Stars 1", RewardTier.Epic, EffectPosition.AboveHead, EffectTrigger.Looping)); Register(new EffectDefinition("epic_cartoon_fight", "Cartoon Fight", "CFXR2 Cartoon Fight (Loop) 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("epic_word_wow", "WOW", "CFXR3 _WOW_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnBoostTrick)); Register(new EffectDefinition("epic_word_wham", "WHAM", "CFXR2 _WHAM_ 4", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnBoostTrick)); Register(new EffectDefinition("epic_word_cursed", "CURSED", "CFXR2 _CURSED_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("epic_word_slash", "SLASH", "CFXR _SLASH_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("epic_word_pow", "POW", "CFXR _POW_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnWallPlant)); Register(new EffectDefinition("epic_word_boom", "BOOM", "CFXR _BOOM_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnGraceEnd)); Register(new EffectDefinition("epic_word_boing", "BOING", "CFXR _BOING_ 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnJump)); Register(new EffectDefinition("epic_hit_leaves", "Hit Leaves", "CFXR3 Hit Leaves A (Lit) 1", RewardTier.Epic, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("epic_water_ripples", "Water Ripples", "CFXR Water Ripples 1", RewardTier.Epic, EffectPosition.Feet, EffectTrigger.OnLand)); Register(new EffectDefinition("legendary_fire", "Fire", "CFXR Fire 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping)); Register(new EffectDefinition("legendary_souls_escape", "Souls Escape", "CFXR2 Souls Escape 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping)); Register(new EffectDefinition("legendary_purple_explosion", "Purple Explosion", "CFXR2 WW Enemy Explosion 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnGraceEnd)); Register(new EffectDefinition("legendary_electrified", "Electrified", "CFXR Electrified 4", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping)); Register(new EffectDefinition("legendary_cartoon_explosion", "Explosion", "CFXR2 WW Explosion 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnGraceEnd)); Register(new EffectDefinition("legendary_yellow_hit", "Yellow Hit", "CFXR Hit D 3D (Yellow) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnBoostTrick)); Register(new EffectDefinition("legendary_glowing_impact", "Glowing Impact", "CFXR Impact Glowing HDR (Blue) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnEmote)); Register(new EffectDefinition("legendary_hit_light", "Hit Light", "CFXR3 Hit Light B (Air) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.OnSpray)); Register(new EffectDefinition("legendary_light_glow", "Light Glow", "CFXR3 LightGlow A (Loop) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping)); Register(new EffectDefinition("legendary_magic_aura", "Magic Aura", "CFXR3 Magic Aura A (Runic) 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping)); Register(new EffectDefinition("legendary_shiny_aura", "Shiny Aura", "CFXR2 Shiny Item (Loop) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping)); Register(new EffectDefinition("legendary_leaves_shield", "Leaves Shield", "CFXR3 Shield Leaves A (Lit) 1", RewardTier.Legendary, EffectPosition.Feet, EffectTrigger.Looping)); Register(new EffectDefinition("legendary_bouncing_glow_bubble", "Bouncing Glow Bubble", "CFXR4 Bouncing Glows Bubble (Blue Purple) 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping)); Register(new EffectDefinition("legendary_fire_breath", "Fire Breath", "CFXR Fire Breath 1", RewardTier.Legendary, EffectPosition.Torso, EffectTrigger.Looping)); } } public class GamblingSaveData : CustomSaveData { public int Rep = 0; public List<string> OwnedEffectIds = new List<string>(); public List<string> EquippedEffectIds = new List<string>(); public const int MaxEquipped = 5; public static GamblingSaveData Instance { get; private set; } public bool IsEquipped(string effectId) { return EquippedEffectIds.Contains(effectId); } public GamblingSaveData() : base("BRCGambling", "gambling_save_{0}.dat") { Instance = this; } public static void Register() { new GamblingSaveData(); } public override void Read(BinaryReader reader) { Rep = reader.ReadInt32(); Debug.Log((object)$"[BRCGambling] Read called, loaded Rep={Rep}"); int num = reader.ReadInt32(); OwnedEffectIds = new List<string>(); for (int i = 0; i < num; i++) { OwnedEffectIds.Add(reader.ReadString()); } int num2 = reader.ReadInt32(); EquippedEffectIds = new List<string>(); for (int j = 0; j < num2; j++) { EquippedEffectIds.Add(reader.ReadString()); } } public override void Write(BinaryWriter writer) { writer.Write(Rep); writer.Write(OwnedEffectIds.Count); foreach (string ownedEffectId in OwnedEffectIds) { writer.Write(ownedEffectId); } writer.Write(EquippedEffectIds.Count); foreach (string equippedEffectId in EquippedEffectIds) { writer.Write(equippedEffectId); } } public void AddEffect(string effectId) { if (!OwnedEffectIds.Contains(effectId)) { OwnedEffectIds.Add(effectId); } ((CustomSaveData)this).Save(); } public bool TryEquip(string effectId) { if (IsEquipped(effectId)) { return true; } if (EquippedEffectIds.Count >= 5) { return false; } EquippedEffectIds.Add(effectId); ((CustomSaveData)this).Save(); EffectTriggerManager.RefreshLoopingEffects(); return true; } public void Unequip(string effectId) { EquippedEffectIds.Remove(effectId); ((CustomSaveData)this).Save(); EffectTriggerManager.RefreshLoopingEffects(); } public void RemoveEffect(string effectId) { OwnedEffectIds.Remove(effectId); EquippedEffectIds.Remove(effectId); ((CustomSaveData)this).Save(); EffectTriggerManager.RefreshLoopingEffects(); } } public class AppCaseOpening : CustomApp { public override void OnAppInit() { ((CustomApp)this).OnAppInit(); ((CustomApp)this).CreateTitleBar("Opening...", (Sprite)null, 80f); } } public class AppGambling : CustomApp { private enum AppScreen { MainMenu, CaseOpening, Inventory, ItemConfirm, SellConfirm, Result } private static Sprite IconSprite; private PhoneButton repDisplayButton; private bool isOpening = false; public static AppGambling Instance; private AppScreen currentScreen = AppScreen.MainMenu; private EffectDefinition currentConfirmDef; public static void Initialize() { PhoneAPI.RegisterApp<AppGambling>("Gambling!", GamblingPlugin.AppIcon); } public override void OnAppInit() { Instance = this; ((CustomApp)this).OnAppInit(); ((CustomApp)this).CreateTitleBar("Monkey Casino", GamblingPlugin.AppIcon, 80f); base.ScrollView = PhoneScrollView.Create((CustomApp)(object)this, 275f, 1600f); ShowMainMenu(); } private void ShowMainMenu() { currentScreen = AppScreen.MainMenu; base.ScrollView.RemoveAllButtons(); repDisplayButton = (PhoneButton)(object)PhoneUIUtility.CreateSimpleButton($"REP: {GamblingManager.Rep}"); base.ScrollView.AddButton(repDisplayButton); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Open Spray Case"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowCaseOpening(); }); base.ScrollView.AddButton((PhoneButton)(object)val); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton("Inventory"); ((PhoneButton)val2).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val2).OnConfirm, (Action)delegate { ShowInventory(); }); base.ScrollView.AddButton((PhoneButton)(object)val2); } private void ShowCaseOpening() { currentScreen = AppScreen.CaseOpening; base.ScrollView.RemoveAllButtons(); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"A case costs {GamblingManager.SpinCost} REP"); base.ScrollView.AddButton((PhoneButton)(object)val2); if (GamblingManager.Rep >= GamblingManager.SpinCost) { SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Purchase? YES"); ((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate { GamblingManager.Rep -= GamblingManager.SpinCost; base.ScrollView.RemoveAllButtons(); SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton("Opening..."); base.ScrollView.AddButton((PhoneButton)(object)val8); ((MonoBehaviour)this).StartCoroutine(LaunchOverlay()); }); base.ScrollView.AddButton((PhoneButton)(object)val3); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("Purchase? NO"); ((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate { ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val4); } else { SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Not enough REP, boss up and get some."); base.ScrollView.AddButton((PhoneButton)(object)val5); } if (GamblingManager.Rep >= 1000) { SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("── Multi Open ──"); base.ScrollView.AddButton((PhoneButton)(object)val6); SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton("Open x10 Cases (1000 REP)"); ((PhoneButton)val7).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val7).OnConfirm, (Action)delegate { GamblingManager.Rep -= 1000; base.ScrollView.RemoveAllButtons(); SimplePhoneButton val8 = PhoneUIUtility.CreateSimpleButton("Opening 10 cases..."); base.ScrollView.AddButton((PhoneButton)(object)val8); ((MonoBehaviour)this).StartCoroutine(LaunchMultiOverlay()); }); base.ScrollView.AddButton((PhoneButton)(object)val7); } } private IEnumerator LaunchOverlay() { yield return null; CaseOpeningOverlay.Create((MonoBehaviour)(object)this, delegate(RewardTier result, EffectDefinition effect) { isOpening = false; ShowResult(result, effect); }); } private void ShowResult(RewardTier result, EffectDefinition effect) { currentScreen = AppScreen.Result; base.ScrollView.RemoveAllButtons(); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val); string text = ((effect != null) ? effect.DisplayName : "Unknown Item"); if (1 == 0) { } string text2 = result switch { RewardTier.Common => "COMMON - " + text, RewardTier.Rare => "RARE - " + text, RewardTier.Epic => "EPIC - " + text, RewardTier.Legendary => "LEGENDARY - " + text, _ => "???", }; if (1 == 0) { } string text3 = text2; SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton(text3); base.ScrollView.AddButton((PhoneButton)(object)val2); if (effect != null) { bool flag = GamblingSaveData.Instance.OwnedEffectIds.Contains(effect.Id); int sellValue = GamblingManager.GetSellValue(effect.Rarity); if (flag) { SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("You already own this effect!"); base.ScrollView.AddButton((PhoneButton)(object)val3); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton($"Sell for {sellValue} REP"); ((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate { GamblingManager.Rep += sellValue; ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val4); SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Keep (no duplicate stored)"); ((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate { ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val5); } else { GamblingSaveData.Instance.AddEffect(effect.Id); SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("Added to inventory!"); base.ScrollView.AddButton((PhoneButton)(object)val6); } } if (result == RewardTier.Epic || result == RewardTier.Legendary) { string text4 = ((result == RewardTier.Legendary) ? ("You opened a <color=yellow>LEGENDARY " + text + "</color>") : ("You opened a <color=red>EPIC " + text + "</color>")); ChatUI instance = ChatUI.Instance; if ((Object)(object)instance != (Object)null && GamblingPlugin.ShowChatMessages.Value) { instance.AddMessage(text4); } } } private string GetRarityColor(RewardTier rarity) { return rarity switch { RewardTier.Legendary => "#FFD700", RewardTier.Epic => "#FF4444", RewardTier.Rare => "#CC44FF", RewardTier.Common => "#4488FF", _ => "#FFFFFF", }; } private void ShowInventory() { currentScreen = AppScreen.Inventory; base.ScrollView.RemoveAllButtons(); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"Equipped: {GamblingSaveData.Instance.EquippedEffectIds.Count}/{5}"); base.ScrollView.AddButton((PhoneButton)(object)val2); if (GamblingSaveData.Instance.OwnedEffectIds.Count == 0) { SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("No items owned yet. Open a case!"); base.ScrollView.AddButton((PhoneButton)(object)val3); return; } IOrderedEnumerable<EffectDefinition> orderedEnumerable = (from id in GamblingSaveData.Instance.OwnedEffectIds select EffectRegistry.Get(id) into effectDefinition where effectDefinition != null select effectDefinition).OrderBy(delegate(EffectDefinition effectDefinition) { RewardTier rarity = effectDefinition.Rarity; if (1 == 0) { } int result = rarity switch { RewardTier.Legendary => 0, RewardTier.Epic => 1, RewardTier.Rare => 2, RewardTier.Common => 3, _ => 4, }; if (1 == 0) { } return result; }); foreach (EffectDefinition def in orderedEnumerable) { bool flag = GamblingSaveData.Instance.IsEquipped(def.Id); string rarityColor = GetRarityColor(def.Rarity); string text = (flag ? " <color=#44FF44>(Equipped)</color>" : ""); string text2 = $"<color={rarityColor}>[{def.Rarity}] {def.DisplayName}</color>{text}"; SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton(text2); ((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate { ShowItemConfirm(def); }); base.ScrollView.AddButton((PhoneButton)(object)val4); } } private void ShowItemConfirm(EffectDefinition def) { currentScreen = AppScreen.ItemConfirm; currentConfirmDef = def; base.ScrollView.RemoveAllButtons(); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowInventory(); }); base.ScrollView.AddButton((PhoneButton)(object)val); bool flag = GamblingSaveData.Instance.IsEquipped(def.Id); string rarityColor = GetRarityColor(def.Rarity); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"<color={rarityColor}>[{def.Rarity}] {def.DisplayName}</color>"); base.ScrollView.AddButton((PhoneButton)(object)val2); if (flag) { SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Unequip"); ((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate { GamblingSaveData.Instance.Unequip(def.Id); ShowInventory(); }); base.ScrollView.AddButton((PhoneButton)(object)val3); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("Unequip to sell this item."); base.ScrollView.AddButton((PhoneButton)(object)val4); return; } if (GamblingSaveData.Instance.EquippedEffectIds.Count < 5) { SimplePhoneButton val5 = PhoneUIUtility.CreateSimpleButton("Equip"); ((PhoneButton)val5).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val5).OnConfirm, (Action)delegate { GamblingSaveData.Instance.TryEquip(def.Id); ShowInventory(); }); base.ScrollView.AddButton((PhoneButton)(object)val5); } else { SimplePhoneButton val6 = PhoneUIUtility.CreateSimpleButton("You need to unequip an effect first."); base.ScrollView.AddButton((PhoneButton)(object)val6); } int sellValue = GamblingManager.GetSellValue(def.Rarity); SimplePhoneButton val7 = PhoneUIUtility.CreateSimpleButton($"Sell for {sellValue} REP"); ((PhoneButton)val7).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val7).OnConfirm, (Action)delegate { ShowSellConfirm(def, sellValue); }); base.ScrollView.AddButton((PhoneButton)(object)val7); } private void ShowSellConfirm(EffectDefinition def, int sellValue) { currentScreen = AppScreen.SellConfirm; currentConfirmDef = def; base.ScrollView.RemoveAllButtons(); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowItemConfirm(def); }); base.ScrollView.AddButton((PhoneButton)(object)val); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"Sell {def.DisplayName} for {sellValue} REP? This cannot be undone."); base.ScrollView.AddButton((PhoneButton)(object)val2); SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton("Confirm Sell"); ((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate { GamblingSaveData.Instance.RemoveEffect(def.Id); GamblingManager.Rep += sellValue; ShowInventory(); }); base.ScrollView.AddButton((PhoneButton)(object)val3); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("Cancel"); ((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate { ShowItemConfirm(def); }); base.ScrollView.AddButton((PhoneButton)(object)val4); } private IEnumerator LaunchMultiOverlay() { yield return null; CaseOpeningOverlay.CreateMulti((MonoBehaviour)(object)this, delegate(List<(RewardTier, EffectDefinition)> results) { ShowMultiResult(results); }); } private void ShowMultiResult(List<(RewardTier tier, EffectDefinition effect)> results) { currentScreen = AppScreen.Result; base.ScrollView.RemoveAllButtons(); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val); List<EffectDefinition> newItems = new List<EffectDefinition>(); List<EffectDefinition> list = new List<EffectDefinition>(); foreach (var result in results) { var (rewardTier, effect) = result; if (effect != null) { bool flag = GamblingSaveData.Instance.OwnedEffectIds.Contains(effect.Id); bool flag2 = newItems.Any((EffectDefinition e) => e.Id == effect.Id); if (flag || flag2) { list.Add(effect); } else { newItems.Add(effect); } } } foreach (EffectDefinition item in newItems) { GamblingSaveData.Instance.AddEffect(item.Id); } if (list.Count > 0) { int totalSellValue = 0; foreach (EffectDefinition item2 in list) { totalSellValue += GamblingManager.GetSellValue(item2.Rarity); } SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"You rolled {list.Count} duplicate(s)!"); base.ScrollView.AddButton((PhoneButton)(object)val2); SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton($"Sell all duplicates for {totalSellValue} REP"); ((PhoneButton)val3).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val3).OnConfirm, (Action)delegate { GamblingManager.Rep += totalSellValue; ShowMultiSummary(newItems); }); base.ScrollView.AddButton((PhoneButton)(object)val3); SimplePhoneButton val4 = PhoneUIUtility.CreateSimpleButton("Keep (duplicates not saved)"); ((PhoneButton)val4).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val4).OnConfirm, (Action)delegate { ShowMultiSummary(newItems); }); base.ScrollView.AddButton((PhoneButton)(object)val4); } else { ShowMultiSummary(newItems); } } private void ShowMultiSummary(List<EffectDefinition> newItems) { base.ScrollView.RemoveAllButtons(); SimplePhoneButton val = PhoneUIUtility.CreateSimpleButton("Back"); ((PhoneButton)val).OnConfirm = (Action)Delegate.Combine(((PhoneButton)val).OnConfirm, (Action)delegate { ShowMainMenu(); }); base.ScrollView.AddButton((PhoneButton)(object)val); SimplePhoneButton val2 = PhoneUIUtility.CreateSimpleButton($"Added {newItems.Count} new item(s) to inventory!"); base.ScrollView.AddButton((PhoneButton)(object)val2); foreach (EffectDefinition newItem in newItems) { string rarityColor = GetRarityColor(newItem.Rarity); SimplePhoneButton val3 = PhoneUIUtility.CreateSimpleButton($"<color={rarityColor}>[{newItem.Rarity}] {newItem.DisplayName}</color>"); base.ScrollView.AddButton((PhoneButton)(object)val3); } } public static void RefreshRepDisplay() { if (!((Object)(object)Instance == (Object)null) && !((Object)(object)Instance.repDisplayButton == (Object)null)) { TextMeshProUGUI componentInChildren = ((Component)Instance.repDisplayButton).GetComponentInChildren<TextMeshProUGUI>(); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = $"REP: {GamblingManager.Rep}"; } } } } public class CaseOpeningOverlay : MonoBehaviour { private const int VisibleCount = 7; private const float ItemWidth = 120f; private const float ItemHeight = 140f; private const float ItemSpacing = 12f; private const float PanelWidth = 924f; private const float PanelHeight = 200f; private const float MultiItemWidth = 100f; private const float MultiItemHeight = 80f; private const float MultiItemSpacing = 8f; private const int MultiVisibleCount = 7; private const float MultiPanelWidth = 756f; private const float MultiColumnGap = 20f; private const float MultiStaggerDelay = 0.4f; private bool isMultiOpen = false; private Action<List<(RewardTier, EffectDefinition)>> onMultiComplete; private List<RectTransform> multiReelStrips = new List<RectTransform>(); private List<RectTransform> multiDividers = new List<RectTransform>(); private static readonly Color ColorCommon = new Color(0.27f, 0.53f, 1f); private static readonly Color ColorRare = new Color(0.8f, 0.27f, 1f); private static readonly Color ColorEpic = new Color(1f, 0.27f, 0.27f); private static readonly Color ColorLegendary = new Color(1f, 0.84f, 0f); private GameObject overlayRoot; private RectTransform reelStrip; private RectTransform reelContainerRt; private RectTransform dividerRect; private Action<RewardTier, EffectDefinition> onComplete; private bool isSpinning = false; private static readonly List<RewardTier> ReelPool = new List<RewardTier> { RewardTier.Common, RewardTier.Common, RewardTier.Common, RewardTier.Common, RewardTier.Common, RewardTier.Common, RewardTier.Common, RewardTier.Common, RewardTier.Rare, RewardTier.Rare, RewardTier.Rare, RewardTier.Rare, RewardTier.Epic, RewardTier.Epic, RewardTier.Legendary }; public static CaseOpeningOverlay Create(MonoBehaviour host, Action<RewardTier, EffectDefinition> onComplete) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("CaseOpeningOverlay"); CaseOpeningOverlay caseOpeningOverlay = val.AddComponent<CaseOpeningOverlay>(); caseOpeningOverlay.onComplete = onComplete; caseOpeningOverlay.Build(); return caseOpeningOverlay; } public static CaseOpeningOverlay CreateMulti(MonoBehaviour host, Action<List<(RewardTier, EffectDefinition)>> onMultiComplete) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("CaseOpeningOverlayMulti"); CaseOpeningOverlay caseOpeningOverlay = val.AddComponent<CaseOpeningOverlay>(); caseOpeningOverlay.onMultiComplete = onMultiComplete; caseOpeningOverlay.isMultiOpen = true; caseOpeningOverlay.BuildMulti(); return caseOpeningOverlay; } private void Build(int rollCount = 1) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0147: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01c4: Unknown result type (might be due to invalid IL or missing references) overlayRoot = new GameObject("CaseCanvas"); Canvas val = overlayRoot.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 200; CanvasScaler val2 = overlayRoot.AddComponent<CanvasScaler>(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; overlayRoot.AddComponent<GraphicRaycaster>(); float num = 210f * (float)rollCount + 20f; GameObject val3 = new GameObject("Panel"); val3.transform.SetParent(overlayRoot.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = new Vector2(0.5f, 0.5f); val4.anchorMax = new Vector2(0.5f, 0.5f); val4.pivot = new Vector2(0.5f, 0.5f); val4.sizeDelta = new Vector2(964f, num); val4.anchoredPosition = Vector2.zero; Image val5 = val3.AddComponent<Image>(); ((Graphic)val5).color = new Color(0.05f, 0.05f, 0.05f, 0.95f); GameObject val6 = new GameObject("ReelContainer"); val6.transform.SetParent(val3.transform, false); RectTransform val7 = val6.AddComponent<RectTransform>(); val7.anchorMin = new Vector2(0.5f, 0.5f); val7.anchorMax = new Vector2(0.5f, 0.5f); val7.pivot = new Vector2(0.5f, 0.5f); val7.sizeDelta = new Vector2(924f, num - 20f); val7.anchoredPosition = Vector2.zero; reelContainerRt = val7; BuildReel(val6, 0); ((MonoBehaviour)this).StartCoroutine(SpinReel()); } private void BuildReel(GameObject container, int reelIndex) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) float num = 210f; float num2 = 0f - (float)reelIndex * num; GameObject val = new GameObject($"Viewport_{reelIndex}"); val.transform.SetParent(container.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 1f); val2.anchorMax = new Vector2(0.5f, 1f); val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = new Vector2(924f, 160f); val2.anchoredPosition = new Vector2(0f, num2); val.AddComponent<RectMask2D>(); GameObject val3 = new GameObject($"ReelStrip_{reelIndex}"); val3.transform.SetParent(val.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = new Vector2(0f, 0.5f); val4.anchorMax = new Vector2(0f, 0.5f); val4.pivot = new Vector2(0f, 0.5f); val4.anchoredPosition = Vector2.zero; reelStrip = val4; GameObject val5 = new GameObject("Divider"); val5.transform.SetParent(container.transform, false); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMin = new Vector2(0.5f, 1f); val6.anchorMax = new Vector2(0.5f, 1f); val6.pivot = new Vector2(0.5f, 0.5f); val6.sizeDelta = new Vector2(2f, 164f); val6.anchoredPosition = new Vector2(0f, num2 - 70f - 10f); ((Graphic)val5.AddComponent<Image>()).color = Color.white; dividerRect = val6; } private GameObject CreateLine(GameObject parent, Vector2 pos, Vector2 size) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Line"); val.transform.SetParent(parent.transform, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = new Vector2(0.5f, 0.5f); val2.anchorMax = new Vector2(0.5f, 0.5f); val2.pivot = new Vector2(0.5f, 0.5f); val2.sizeDelta = size; val2.anchoredPosition = pos; Image val3 = val.AddComponent<Image>(); ((Graphic)val3).color = Color.white; return val; } private IEnumerator SpinReel() { if (isSpinning) { yield break; } isSpinning = true; float stepX = 132f; RewardTier result = ReelPool[Random.Range(0, ReelPool.Count)]; List<RewardTier> items = new List<RewardTier>(); int totalItems = 60; for (int i = 0; i < totalItems; i++) { items.Add(ReelPool[Random.Range(0, ReelPool.Count)]); } int landingIndex = totalItems - 11; items[landingIndex] = result; for (int j = 0; j < items.Count; j++) { GameObject item = CreateReelItem(items[j]); item.transform.SetParent((Transform)(object)reelStrip, false); item.GetComponent<RectTransform>().anchoredPosition = new Vector2((float)j * stepX, 0f); } reelStrip.sizeDelta = new Vector2((float)items.Count * stepX, 140f); float targetX = 462f - (float)landingIndex * stepX - 120f; float duration = 8f; float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float t = elapsed / duration; float eased = 1f - Mathf.Pow(1f - t, 3f); reelStrip.anchoredPosition = new Vector2(Mathf.Lerp(0f, targetX, eased), 0f); yield return null; } reelStrip.anchoredPosition = new Vector2(targetX, 0f); Canvas.ForceUpdateCanvases(); float dividerWorldX = ((Transform)dividerRect).position.x; float minDist = float.MaxValue; int closestIndex = 0; for (int k = 0; k < ((Transform)reelStrip).childCount; k++) { Transform child = ((Transform)reelStrip).GetChild(k); RectTransform child2 = (RectTransform)(object)((child is RectTransform) ? child : null); float dist = Mathf.Abs(((Transform)child2).position.x - dividerWorldX); if (dist < minDist) { minDist = dist; closestIndex = k; } } RewardTier visualResult = items[closestIndex]; Debug.Log((object)$"[BRCGambling] Divider worldX={dividerWorldX} closest index={closestIndex} tier={visualResult}"); yield return ((MonoBehaviour)this).StartCoroutine(PlayWinReveal(closestIndex)); GamblingManager.ApplyReward(visualResult); List<EffectDefinition> pool = EffectRegistry.GetPool(visualResult); EffectDefinition wonEffect = ((pool.Count > 0) ? pool[Random.Range(0, pool.Count)] : null); yield return (object)new WaitForSeconds(1.5f); onComplete?.Invoke(visualResult, wonEffect); Object.Destroy((Object)(object)overlayRoot); Object.Destroy((Object)(object)((Component)this).gameObject); } private IEnumerator PlayWinReveal(int winnerIndex) { float duration = 0.55f; float elapsed = 0f; int count = ((Transform)reelStrip).childCount; RectTransform[] children = (RectTransform[])(object)new RectTransform[count]; CanvasGroup[] groups = (CanvasGroup[])(object)new CanvasGroup[count]; Vector3[] startScales = (Vector3[])(object)new Vector3[count]; for (int i = 0; i < count; i++) { ref RectTransform reference = ref children[i]; Transform child = ((Transform)reelStrip).GetChild(i); reference = (RectTransform)(object)((child is RectTransform) ? child : null); startScales[i] = ((Transform)children[i]).localScale; groups[i] = ((Component)children[i]).GetComponent<CanvasGroup>(); if ((Object)(object)groups[i] == (Object)null) { groups[i] = ((Component)children[i]).gameObject.AddComponent<CanvasGroup>(); } } Vector3 winnerTargetScale = new Vector3(1.18f, 1.18f, 1f); Vector3 surroundTargetScale = new Vector3(0.82f, 0.82f, 1f); Transform winnerChild = ((Transform)reelStrip).GetChild(winnerIndex); Transform winnerCard = ((winnerChild != null) ? winnerChild.Find("Card") : null); if ((Object)(object)winnerCard != (Object)null) { CreateOutlineFrame(winnerCard, 3f, new Color(1f, 0.85f, 0f, 0f)); } while (elapsed < duration) { elapsed += Time.deltaTime; float t = Mathf.Clamp01(elapsed / duration); float e = 1f - Mathf.Pow(1f - t, 3f); for (int j = 0; j < count; j++) { if (j == winnerIndex) { ((Transform)children[j]).localScale = Vector3.Lerp(startScales[j], winnerTargetScale, e); groups[j].alpha = 1f; } else { ((Transform)children[j]).localScale = Vector3.Lerp(startScales[j], surroundTargetScale, e); groups[j].alpha = Mathf.Lerp(1f, 0.28f, e); } } if ((Object)(object)winnerCard != (Object)null) { Color edgeColor = new Color(1f, 0.85f, 0f, Mathf.Lerp(0f, 1f, e)); Image[] componentsInChildren = ((Component)winnerCard).GetComponentsInChildren<Image>(); foreach (Image edge in componentsInChildren) { if (((Object)((Component)edge).gameObject).name == "OutlineEdge") { ((Graphic)edge).color = edgeColor; } } } yield return null; } yield return (object)new WaitForSeconds(1f); } private Image CreateOutlineFrame(Transform parent, float thickness, Color startColor) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) Image val = null; (Vector2, Vector2, Vector2, Vector2)[] array = new(Vector2, Vector2, Vector2, Vector2)[4] { (new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f - thickness, 0f), new Vector2(thickness, thickness)), (new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f - thickness, 0f - thickness), new Vector2(thickness, 0f)), (new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(0f - thickness, 0f - thickness), new Vector2(0f, thickness)), (new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 0f - thickness), new Vector2(thickness, thickness)) }; (Vector2, Vector2, Vector2, Vector2)[] array2 = array; for (int i = 0; i < array2.Length; i++) { (Vector2, Vector2, Vector2, Vector2) tuple = array2[i]; GameObject val2 = new GameObject("OutlineEdge"); val2.transform.SetParent(parent, false); RectTransform val3 = val2.AddComponent<RectTransform>(); val3.anchorMin = tuple.Item1; val3.anchorMax = tuple.Item2; val3.offsetMin = tuple.Item3; val3.offsetMax = tuple.Item4; Image val4 = val2.AddComponent<Image>(); ((Graphic)val4).color = startColor; if ((Object)(object)val == (Object)null) { val = val4; } } return val; } private GameObject CreateReelItem(RewardTier tier) { //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_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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_00c9: 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_00e0: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019e: 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_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } Color val = (Color)(tier switch { RewardTier.Common => ColorCommon, RewardTier.Rare => ColorRare, RewardTier.Epic => ColorEpic, RewardTier.Legendary => ColorLegendary, _ => Color.white, }); if (1 == 0) { } Color color = val; if (1 == 0) { } string text = tier switch { RewardTier.Common => "COM", RewardTier.Rare => "RARE", RewardTier.Epic => "EPIC", RewardTier.Legendary => "LEG", _ => "?", }; if (1 == 0) { } string text2 = text; GameObject val2 = new GameObject($"Item_{tier}"); RectTransform val3 = val2.AddComponent<RectTransform>(); val3.sizeDelta = new Vector2(120f, 140f); GameObject val4 = new GameObject("Card"); val4.transform.SetParent(val2.transform, false); RectTransform val5 = val4.AddComponent<RectTransform>(); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val5.offsetMin = Vector2.zero; val5.offsetMax = new Vector2(0f, -20f); Image val6 = val4.AddComponent<Image>(); ((Graphic)val6).color = new Color(0.15f, 0.15f, 0.15f, 1f); GameObject val7 = new GameObject("Label"); val7.transform.SetParent(val4.transform, false); RectTransform val8 = val7.AddComponent<RectTransform>(); val8.anchorMin = Vector2.zero; val8.anchorMax = Vector2.one; val8.offsetMin = Vector2.zero; val8.offsetMax = Vector2.zero; TextMeshProUGUI val9 = val7.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val9).text = text2; ((TMP_Text)val9).alignment = (TextAlignmentOptions)514; ((TMP_Text)val9).fontSize = 18f; ((Graphic)val9).color = Color.white; GameObject val10 = new GameObject("RarityBar"); val10.transform.SetParent(val2.transform, false); RectTransform val11 = val10.AddComponent<RectTransform>(); val11.anchorMin = new Vector2(0f, 0f); val11.anchorMax = new Vector2(1f, 0f); val11.pivot = new Vector2(0.5f, 0f); val11.sizeDelta = new Vector2(0f, 18f); val11.anchoredPosition = Vector2.zero; Image val12 = val10.AddComponent<Image>(); ((Graphic)val12).color = color; return val2; } private void BuildMulti() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) overlayRoot = new GameObject("CaseCanvas"); Canvas val = overlayRoot.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 200; CanvasScaler val2 = overlayRoot.AddComponent<CanvasScaler>(); val2.uiScaleMode = (ScaleMode)1; val2.referenceResolution = new Vector2(1920f, 1080f); val2.matchWidthOrHeight = 0.5f; overlayRoot.AddComponent<GraphicRaycaster>(); float num = 796f; float num2 = num * 2f + 20f; float num3 = 110f; float num4 = num3 * 5f + 40f; GameObject val3 = new GameObject("Panel"); val3.transform.SetParent(overlayRoot.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = new Vector2(0.5f, 0.5f); val4.anchorMax = new Vector2(0.5f, 0.5f); val4.pivot = new Vector2(0.5f, 0.5f); val4.sizeDelta = new Vector2(num2, num4); val4.anchoredPosition = Vector2.zero; ((Graphic)val3.AddComponent<Image>()).color = new Color(0.05f, 0.05f, 0.05f, 0.95f); for (int i = 0; i < 2; i++) { float num5 = ((i == 0) ? (0f - (num * 0.5f + 10f)) : (num * 0.5f + 10f)); for (int j = 0; j < 5; j++) { int num6 = i * 5 + j; float num7 = num4 * 0.5f - 20f - (float)j * num3 - num3 * 0.5f; GameObject val5 = new GameObject($"Viewport_{num6}"); val5.transform.SetParent(val3.transform, false); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMin = new Vector2(0.5f, 0.5f); val6.anchorMax = new Vector2(0.5f, 0.5f); val6.pivot = new Vector2(0.5f, 0.5f); val6.sizeDelta = new Vector2(756f, 90f); val6.anchoredPosition = new Vector2(num5, num7); val5.AddComponent<RectMask2D>(); GameObject val7 = new GameObject($"ReelStrip_{num6}"); val7.transform.SetParent(val5.transform, false); RectTransform val8 = val7.AddComponent<RectTransform>(); val8.anchorMin = new Vector2(0f, 0.5f); val8.anchorMax = new Vector2(0f, 0.5f); val8.pivot = new Vector2(0f, 0.5f); val8.anchoredPosition = Vector2.zero; multiReelStrips.Add(val8); GameObject val9 = new GameObject($"Divider_{num6}"); val9.transform.SetParent(val3.transform, false); RectTransform val10 = val9.AddComponent<RectTransform>(); val10.anchorMin = new Vector2(0.5f, 0.5f); val10.anchorMax = new Vector2(0.5f, 0.5f); val10.pivot = new Vector2(0.5f, 0.5f); val10.sizeDelta = new Vector2(2f, 94f); val10.anchoredPosition = new Vector2(num5, num7); ((Graphic)val9.AddComponent<Image>()).color = Color.white; multiDividers.Add(val10); } } ((MonoBehaviour)this).StartCoroutine(SpinMultiReel()); } private IEnumerator SpinMultiReel() { float stepX = 108f; int totalItems = 40; int landingIndex = totalItems - 8; List<(RewardTier tier, EffectDefinition effect)> results = new List<(RewardTier, EffectDefinition)>(); new List<Coroutine>(); List<RewardTier> rolledTiers = new List<RewardTier>(); List<EffectDefinition> rolledEffects = new List<EffectDefinition>(); for (int i = 0; i < 10; i++) { RewardTier tier = ReelPool[Random.Range(0, ReelPool.Count)]; List<EffectDefinition> pool = EffectRegistry.GetPool(tier); EffectDefinition effect = ((pool.Count > 0) ? pool[Random.Range(0, pool.Count)] : null); rolledTiers.Add(tier); rolledEffects.Add(effect); } bool[] reelDone = new bool[10]; for (int j = 0; j < 10; j++) { int capturedI = j; ((MonoBehaviour)this).StartCoroutine(SpinSingleMultiReel(multiReelStrips[capturedI], multiDividers[capturedI], rolledTiers[capturedI], stepX, totalItems, landingIndex, delegate { reelDone[capturedI] = true; })); yield return (object)new WaitForSeconds(0.4f); } bool allDone = false; while (!allDone) { allDone = true; for (int i2 = 0; i2 < 10; i2++) { if (!reelDone[i2]) { allDone = false; break; } } yield return null; } yield return (object)new WaitForSeconds(3f); for (int i3 = 0; i3 < 10; i3++) { results.Add((rolledTiers[i3], rolledEffects[i3])); } onMultiComplete?.Invoke(results); Object.Destroy((Object)(object)overlayRoot); Object.Destroy((Object)(object)((Component)this).gameObject); } private IEnumerator SpinSingleMultiReel(RectTransform strip, RectTransform divider, RewardTier result, float stepX, int totalItems, int landingIndex, Action onDone) { List<RewardTier> items = new List<RewardTier>(); for (int i = 0; i < totalItems; i++) { items.Add(ReelPool[Random.Range(0, ReelPool.Count)]); } items[landingIndex] = result; for (int j = 0; j < items.Count; j++) { GameObject item = CreateMultiReelItem(items[j]); item.transform.SetParent((Transform)(object)strip, false); item.GetComponent<RectTransform>().anchoredPosition = new Vector2((float)j * stepX, 0f); } strip.sizeDelta = new Vector2((float)items.Count * stepX, 80f); float targetX = 378f - (float)landingIndex * stepX - 100f; float duration = 5f; float elapsed = 0f; while (elapsed < duration) { elapsed += Time.deltaTime; float t = elapsed / duration; float eased = 1f - Mathf.Pow(1f - t, 3f); strip.anchoredPosition = new Vector2(Mathf.Lerp(0f, targetX, eased), 0f); yield return null; } strip.anchoredPosition = new Vector2(targetX, 0f); onDone?.Invoke(); } private GameObject CreateMultiReelItem(RewardTier tier) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00f3: Expected O, but got Unknown //IL_0103: 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_0119: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Expected O, but got Unknown //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_0290: 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_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } Color val = (Color)(tier switch { RewardTier.Common => new Color(0.27f, 0.53f, 1f), RewardTier.Rare => new Color(0.8f, 0.27f, 1f), RewardTier.Epic => new Color(1f, 0.27f, 0.27f), RewardTier.Legendary => new Color(1f, 0.84f, 0f), _ => Color.white, }); if (1 == 0) { } Color color = val; if (1 == 0) { } string text = tier switch { RewardTier.Common => "COM", RewardTier.Rare => "RARE", RewardTier.Epic => "EPIC", RewardTier.Legendary => "LEG", _ => "?", }; if (1 == 0) { } string text2 = text; GameObject val2 = new GameObject($"Item_{tier}"); val2.AddComponent<RectTransform>().sizeDelta = new Vector2(100f, 80f); GameObject val3 = new GameObject("Card"); val3.transform.SetParent(val2.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = Vector2.zero; val4.offsetMax = new Vector2(0f, -14f); ((Graphic)val3.AddComponent<Image>()).color = new Color(0.15f, 0.15f, 0.15f, 1f); GameObject val5 = new GameObject("Label"); val5.transform.SetParent(val3.transform, false); RectTransform val6 = val5.AddComponent<RectTransform>(); val6.anchorMin = Vector2.zero; val6.anchorMax = Vector2.one; val6.offsetMin = Vector2.zero; val6.offsetMax = Vector2.zero; TextMeshProUGUI val7 = val5.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val7).text = text2; ((TMP_Text)val7).alignment = (TextAlignmentOptions)514; ((TMP_Text)val7).fontSize = 14f; ((Graphic)val7).color = Color.white; GameObject val8 = new GameObject("RarityBar"); val8.transform.SetParent(val2.transform, false); RectTransform val9 = val8.AddComponent<RectTransform>(); val9.anchorMin = new Vector2(0f, 0f); val9.anchorMax = new Vector2(1f, 0f); val9.pivot = new Vector2(0.5f, 0f); val9.sizeDelta = new Vector2(0f, 12f); val9.anchoredPosition = Vector2.zero; ((Graphic)val8.AddComponent<Image>()).color = color; return val2; } } public static class EffectTriggerManager { private static Dictionary<string, GameObject> activeLoopingEffects = new Dictionary<string, GameObject>(); public static void RefreshLoopingEffects() { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) List<string> list = new List<string>(); foreach (KeyValuePair<string, GameObject> activeLoopingEffect in activeLoopingEffects) { if (!GamblingSaveData.Instance.IsEquipped(activeLoopingEffect.Key)) { if ((Object)(object)activeLoopingEffect.Value != (Object)null) { Object.Destroy((Object)(object)activeLoopingEffect.Value); } list.Add(activeLoopingEffect.Key); } } foreach (string item in list) { activeLoopingEffects.Remove(item); } foreach (string equippedEffectId in GamblingSaveData.Instance.EquippedEffectIds) { EffectDefinition effectDefinition = EffectRegistry.Get(equippedEffectId); if (effectDefinition == null || effectDefinition.Trigger != EffectTrigger.Looping || activeLoopingEffects.ContainsKey(equippedEffectId)) { continue; } Transform localPlayerTransform = PlayerEffects.GetLocalPlayerTransform(); if (!((Object)(object)localPlayerTransform == (Object)null)) { Vector3 localOffset = GetOffsetForPosition(effectDefinition.Position) + effectDefinition.PositionOffset; GameObject val = PlayerEffects.SpawnPersistentEffectByName(effectDefinition.PrefabName, localPlayerTransform, localOffset); if ((Object)(object)val != (Object)null) { activeLoopingEffects[equippedEffectId] = val; } } } } public static void PlayOneShot(EffectTrigger trigger) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) foreach (string equippedEffectId in GamblingSaveData.Instance.EquippedEffectIds) { EffectDefinition effectDefinition = EffectRegistry.Get(equippedEffectId); if (effectDefinition != null && effectDefinition.Trigger == trigger) { Transform localPlayerTransform = PlayerEffects.GetLocalPlayerTransform(); if (!((Object)(object)localPlayerTransform == (Object)null)) { Vector3 localOffset = GetOffsetForPosition(effectDefinition.Position) + effectDefinition.PositionOffset; PlayerEffects.SpawnEffectByName(effectDefinition.PrefabName, localPlayerTransform, localOffset, 5f); } } } } public static Vector3 GetOffsetForPosition(EffectPosition pos) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) return (Vector3)(pos switch { EffectPosition.Feet => new Vector3(0f, 0.1f, 0f), EffectPosition.Torso => new Vector3(0f, 1f, 0f), EffectPosition.AboveHead => new Vector3(0f, 2.2f, 0f), _ => Vector3.zero, }); } public static void ClearAll() { foreach (KeyValuePair<string, GameObject> activeLoopingEffect in activeLoopingEffects) { if ((Object)(object)activeLoopingEffect.Value != (Object)null) { Object.Destroy((Object)(object)activeLoopingEffect.Value); } } activeLoopingEffects.Clear(); } } public static class GamblingManager { public static int ConsecutiveLosses = 0; public static double? BestTimeAtRaceStart = null; public static float ScoreMultiplier = 1f; public static float SpeedBonus = 0f; public static float BuffTimeRemaining = 0f; public static int MaxPossibleScore = 0; public static int SpinCost => 100; public static int StartingRep => 500; public static int Rep { get { return GamblingSaveData.Instance?.Rep ?? 0; } set { if (GamblingSaveData.Instance != null) { GamblingSaveData.Instance.Rep = value; ((CustomSaveData)GamblingSaveData.Instance).Save(); AppGambling.RefreshRepDisplay(); } } } public static void ApplyReward(RewardTier tier) { switch (tier) { case RewardTier.Common: ScoreMultiplier = 1.2f; SpeedBonus = 0f; BuffTimeRemaining = 30f; break; case RewardTier.Rare: ScoreMultiplier = 1.5f; SpeedBonus = 0f; BuffTimeRemaining = 45f; break; case RewardTier.Epic: ScoreMultiplier = 1.5f; SpeedBonus = 2f; BuffTimeRemaining = 45f; break; case RewardTier.Legendary: ScoreMultiplier = 2f; SpeedBonus = 4f; BuffTimeRemaining = 60f; break; } } public static void Tick(float deltaTime) { if (!(BuffTimeRemaining <= 0f)) { BuffTimeRemaining -= deltaTime; if (BuffTimeRemaining <= 0f) { ScoreMultiplier = 1f; SpeedBonus = 0f; } } } public static int GetSellValue(RewardTier rarity) { return rarity switch { RewardTier.Common => 15, RewardTier.Rare => 60, RewardTier.Epic => 220, RewardTier.Legendary => 400, _ => 0, }; } } public enum RewardTier { Common, Rare, Epic, Legendary } [BepInPlugin("com.chimp.brcgambling", "BRC Gambling", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class GamblingPlugin : BaseUnityPlugin { public static GamblingPlugin Instance; public static AssetBundle EffectsBundle; public static ConfigEntry<string> DevKey; public static ConfigEntry<bool> ShowChatMessages; public static Sprite AppIcon; private float effectRefreshTimer = 0f; private void Awake() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown Instance = this; DevKey = ((BaseUnityPlugin)this).Config.Bind<string>("Dev", "DevKey", "", "Developer access key."); ShowChatMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "ShowChatMessages", true, "Show REP reward messages in chat."); GamblingSaveData.Register(); LoadAppIcon(); AppGambling.Initialize(); LoadAssetBundle(); EffectRegistry.InitializeDefaults(); Harmony val = new Harmony("com.chimp.brcgambling"); val.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[BRCGambling] Loaded."); } private void Update() { effectRefreshTimer += Time.deltaTime; if (effectRefreshTimer >= 3f) { effectRefreshTimer = 0f; EffectTriggerManager.RefreshLoopingEffects(); } } private void LoadAppIcon() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon_gambling.png"); if (File.Exists(path)) { byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, array); AppIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } } public static void DestroyAfter(GameObject obj, float delay) { ((MonoBehaviour)Instance).StartCoroutine(DestroyCoroutine(obj, delay)); } private static IEnumerator DestroyCoroutine(GameObject obj, float delay) { yield return (object)new WaitForSeconds(delay); if ((Object)(object)obj != (Object)null) { Object.Destroy((Object)(object)obj); } } private void LoadAssetBundle() { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "spraycasino"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[BRCGambling] Looking for bundle at: " + text)); EffectsBundle = AssetBundle.LoadFromFile(text); if ((Object)(object)EffectsBundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"[BRCGambling] Failed to load spraycasino AssetBundle!"); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[BRCGambling] AssetBundle loaded successfully."); } } } public static class PlayerEffects { public static void SpawnLegendaryEffect(float duration) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00dc: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Expected O, but got Unknown Debug.Log((object)"[BRCGambling] SpawnLegendaryEffect called"); Transform localPlayerTransform = GetLocalPlayerTransform(); if ((Object)(object)localPlayerTransform == (Object)null) { Debug.Log((object)"[BRCGambling] Player transform is null, aborting effect"); return; } Debug.Log((object)$"[BRCGambling] Got player transform at {localPlayerTransform.position}"); try { GameObject val = new GameObject("LegendaryFireEffect"); Debug.Log((object)"[BRCGambling] Created GameObject"); val.transform.SetParent(localPlayerTransform); val.transform.localPosition = new Vector3(0f, 0.1f, 0f); Debug.Log((object)"[BRCGambling] Set parent and position"); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); MainModule main = val2.main; ((MainModule)(ref main)).duration = duration; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.5f, 1f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.5f, 1.5f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.12f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(1f, 0.3f, 0f), new Color(1f, 0.8f, 0f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.3f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(25f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; ((ShapeModule)(ref shape)).radius = 0.4f; ((ShapeModule)(ref shape)).rotation = new Vector3(90f, 0f, 0f); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(1f, 0.5f, 0f), 0f), new GradientColorKey(new Color(1f, 0.8f, 0f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); ((Renderer)component).material = new Material(Shader.Find("Particles/Standard Unlit")); Debug.Log((object)"[BRCGambling] Added ParticleSystem component"); val2.Play(); Debug.Log((object)"[BRCGambling] Particle system playing"); GamblingPlugin.DestroyAfter(val, duration); } catch (Exception ex) { Debug.Log((object)("[BRCGambling] Effect failed: " + ex.Message)); } } public static void SpawnEpicEffect(float duration) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_010a: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) Transform localPlayerTransform = GetLocalPlayerTransform(); if (!((Object)(object)localPlayerTransform == (Object)null)) { GameObject val = new GameObject("EpicHaloEffect"); val.transform.SetParent(localPlayerTransform); val.transform.localPosition = new Vector3(0f, 2.2f, 0f); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); MainModule main = val2.main; ((MainModule)(ref main)).duration = duration; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(1f); ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.1f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.5f, 0.2f, 1f, 1f), new Color(0.8f, 0.4f, 1f, 0.5f)); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(40f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)10; ((ShapeModule)(ref shape)).radius = 0.5f; ((ShapeModule)(ref shape)).rotation = new Vector3(90f, 0f, 0f); ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(0.7f, 0.3f, 1f), 0f), new GradientColorKey(new Color(0.5f, 0.2f, 1f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); val2.Play(); GamblingPlugin.DestroyAfter(val, duration); } } public static void SpawnEffectByName(string prefabName, Transform parent, Vector3 localOffset, float duration) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GamblingPlugin.EffectsBundle == (Object)null) { Debug.Log((object)"[BRCGambling] EffectsBundle is null, cannot spawn effect"); return; } GameObject val = GamblingPlugin.EffectsBundle.LoadAsset<GameObject>(prefabName); if ((Object)(object)val == (Object)null) { Debug.Log((object)("[BRCGambling] Prefab '" + prefabName + "' not found in bundle")); return; } GameObject val2 = Object.Instantiate<GameObject>(val, parent); val2.transform.localPosition = localOffset; GamblingPlugin.DestroyAfter(val2, duration); } public static Transform GetLocalPlayerTransform() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) try { WorldHandler instance = WorldHandler.instance; Player val = ((instance != null) ? instance.GetCurrentPlayer() : null); if ((Object)(object)val != (Object)null) { Debug.Log((object)$"[BRCGambling] Found player via WorldHandler at {((Component)val).transform.position}"); return ((Component)val).transform; } Debug.Log((object)"[BRCGambling] WorldHandler returned null player"); } catch (Exception ex) { Debug.Log((object)("[BRCGambling] WorldHandler error: " + ex.Message)); } return null; } public static GameObject SpawnPersistentEffectByName(string prefabName, Transform parent, Vector3 localOffset) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)GamblingPlugin.EffectsBundle == (Object)null) { return null; } GameObject val = GamblingPlugin.EffectsBundle.LoadAsset<GameObject>(prefabName); if ((Object)(object)val == (Object)null) { Debug.Log((object)("[BRCGambling] Prefab '" + prefabName + "' not found in bundle")); return null; } GameObject val2 = Object.Instantiate<GameObject>(val, parent); val2.transform.localPosition = localOffset; return val2; } } } namespace BRCGambling.Patches { [HarmonyPatch(typeof(DieAbility), "OnStartAbility")] internal class DeathTriggerPatch { private static void Postfix(DieAbility __instance) { EffectTriggerManager.PlayOneShot(EffectTrigger.OnDeath); } } [HarmonyPatch(typeof(GraffitiRace), "OnReceive_GraffitiRaceData")] internal class GraffitiRaceDataPatch { private static void Postfix(GraffitiRace __instance, ClientGraffitiRaceGSpots packet) { GamblingManager.MaxPossibleScore += packet.GraffitiSpots.Count; } } [HarmonyPatch(typeof(GraffitiRace), "OnEnd")] internal class GraffitiRaceWinPatch { [HarmonyPostfix] private static void Postfix(GraffitiRace __instance) { ClientController instance = ClientController.Instance; if ((Object)(object)instance == (Object)null) { return; } ClientLobbyManager clientLobbyManager = instance.ClientLobbyManager; Lobby val = ((clientLobbyManager != null) ? clientLobbyManager.CurrentLobby : null); if (val == null) { return; } ushort localID = instance.LocalID; int maxPossibleScore = GamblingManager.MaxPossibleScore; if (maxPossibleScore <= 0) { return; } float num = 0f; bool flag = false; if (((Gamemode)__instance).TeamBased) { if (val.LobbyState.Players.ContainsKey(localID)) { byte team = val.LobbyState.Players[localID].Team; float scoreForTeam = val.LobbyState.GetScoreForTeam(team); flag = scoreForTeam >= (float)maxPossibleScore && scoreForTeam > 0f; } } else if (val.LobbyState.Players.ContainsKey(localID)) { num = val.LobbyState.Players[localID].Score; flag = num >= (float)maxPossibleScore && num > 0f; } ChatUI instance2 = ChatUI.Instance; if (flag) { GamblingManager.ConsecutiveLosses = 0; int count = val.LobbyState.Players.Count; int num2 = 0; if (count == 2) { num2 = 25; } else if (count == 3) { num2 = 50; } else if (count >= 4) { num2 = 75; } GamblingManager.Rep += 25 + num2; if ((Object)(object)instance2 != (Object)null && GamblingPlugin.ShowChatMessages.Value) { if (num2 > 0) { instance2.AddMessage($"<color=blue>+{25 + num2} REP for gracing with {count} players! Total REP: {GamblingManager.Rep}</color>"); } else { instance2.AddMessage($"<color=green>+25 REP for winning a GRACE! Total REP: {GamblingManager.Rep}</color>"); } } } else { GamblingManager.ConsecutiveLosses++; if (GamblingManager.ConsecutiveLosses >= 7) { int num3 = (int)num; int num4 = 0; if (num3 < 6) { num4 = 15; } else if (num3 >= 6 && num3 < 8) { num4 = 25; } else if (num3 >= 8) { num4 = 40; } GamblingManager.Rep += num4; if ((Object)(object)instance2 != (Object)null && GamblingPlugin.ShowChatMessages.Value) { instance2.AddMessage($"<color=orange>[Pity] +{num4} REP