Decompiled source of PEAK BLACKJACK v1.0.1
plugins/PeakBlackjack.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Peak.Afflictions; using PeakBlackjack.Localization; using PeakBlackjack.Net; using PeakBlackjack.Placement; using PeakBlackjack.Table; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ThomasAusHH")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A blackjack table for PEAK. Hit, stand, double - the dealer stands on 17 and the house always wins.")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1+d3b39fb59fb7018a10ea43379cc2d267b92eacb3")] [assembly: AssemblyProduct("PeakBlackjack")] [assembly: AssemblyTitle("PeakBlackjack")] [assembly: AssemblyMetadata("RepositoryUrl", "https://discord.gg/nKUHvzdmVp")] [assembly: AssemblyVersion("1.0.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PeakBlackjack { public enum BlackjackLogLevel { Error, Warning, Info, Debug } internal static class BlackjackLog { private const string Prefix = "[PeakBlackjack] "; public static void Error(string message) { if (Enabled(BlackjackLogLevel.Error)) { Plugin.Log.LogError((object)("[PeakBlackjack] " + message)); } } public static void Warning(string message) { if (Enabled(BlackjackLogLevel.Warning)) { Plugin.Log.LogWarning((object)("[PeakBlackjack] " + message)); } } public static void Info(string message) { if (Enabled(BlackjackLogLevel.Info)) { Plugin.Log.LogInfo((object)("[PeakBlackjack] " + message)); } } public static void Debug(string message) { if (Enabled(BlackjackLogLevel.Debug)) { Plugin.Log.LogInfo((object)("[PeakBlackjack] " + message)); } } private static bool Enabled(BlackjackLogLevel level) { if (Plugin.Log == null) { return false; } BlackjackLogLevel blackjackLogLevel = ((Plugin.LogLevel != null) ? Plugin.LogLevel.Value : BlackjackLogLevel.Info); return level <= blackjackLogLevel; } } public static class BundleAssets { private const string ResourceName = "PeakBlackjack.Assets.peakblackjack.bundle"; private static AssetBundle _bundle; private static bool _tried; private static readonly Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>(); public static GameObject Table => Prefab("BlackjackTable"); public static GameObject Card => Prefab("Card"); public static GameObject Chip => Prefab("Chip"); public static GameObject Prefab(string name) { if (Prefabs.TryGetValue(name, out var value) && (Object)(object)value != (Object)null) { return value; } if (!_tried) { _tried = true; try { Load(); } catch (Exception arg) { BlackjackLog.Error($"[Bundle] Laden fehlgeschlagen: {arg}"); } } if ((Object)(object)_bundle == (Object)null) { return null; } GameObject val = _bundle.LoadAsset<GameObject>(name); if ((Object)(object)val == (Object)null) { BlackjackLog.Warning("[Bundle] Prefab '" + name + "' nicht im Bundle. Inhalt: " + string.Join(", ", _bundle.GetAllAssetNames())); return null; } RebindShaders(val); Prefabs[name] = val; return val; } private static void Load() { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("PeakBlackjack.Assets.peakblackjack.bundle"); if (stream == null) { BlackjackLog.Warning("[Bundle] Kein eingebettetes Bundle in der DLL."); return; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); byte[] array = memoryStream.ToArray(); _bundle = AssetBundle.LoadFromMemory(array); if ((Object)(object)_bundle == (Object)null) { BlackjackLog.Warning($"[Bundle] AssetBundle.LoadFromMemory lieferte null ({array.Length} Bytes)."); } else { BlackjackLog.Info(string.Format("[Bundle] Geladen: {0} KB, Inhalt: {1}", array.Length / 1024, string.Join(", ", _bundle.GetAllAssetNames()))); } } private static void RebindShaders(GameObject prefab) { HashSet<Material> hashSet = new HashSet<Material>(); int num = 0; Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] sharedMaterials = componentsInChildren[i].sharedMaterials; foreach (Material val in sharedMaterials) { if (!((Object)(object)val == (Object)null) && hashSet.Add(val) && !((Object)(object)val.shader == (Object)null)) { Shader val2 = Shader.Find(((Object)val.shader).name); if ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)val.shader) { val.shader = val2; num++; } } } } BlackjackLog.Debug($"[Bundle] {((Object)prefab).name}: {hashSet.Count} Materialien, {num} Shader neu gebunden."); } } [BepInPlugin("com.thomasaushh.peakblackjack", "PEAK BLACKJACK", "1.0.1")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.thomasaushh.peakblackjack"; public const string PluginName = "PEAK BLACKJACK"; public const string PluginVersion = "1.0.1"; public const string VersionLabel = ""; public static string DisplayVersion { get { if (!string.IsNullOrEmpty("")) { return "1.0.1 "; } return "1.0.1"; } } internal static ManualLogSource Log { get; private set; } internal static Plugin Instance { get; private set; } internal static ConfigEntry<bool> EnableAtCampfires { get; private set; } internal static ConfigEntry<bool> EnableAtAirport { get; private set; } internal static ConfigEntry<int> ChipPercent { get; private set; } internal static ConfigEntry<int> MaxChipsPerRound { get; private set; } internal static ConfigEntry<float> BettingSeconds { get; private set; } internal static ConfigEntry<float> TurnSeconds { get; private set; } internal static ConfigEntry<bool> BankCurse { get; private set; } internal static ConfigEntry<bool> PeakShader { get; private set; } internal static ConfigEntry<float> SoundVolume { get; private set; } internal static ConfigEntry<float> AttractVolume { get; private set; } internal static ConfigEntry<BlackjackLogLevel> LogLevel { get; private set; } private void Awake() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("PEAK BLACKJACK " + DisplayVersion + " geladen.")); EnableAtCampfires = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableAtCampfires", true, "Ein Blackjack-Tisch neben jedem Lagerfeuer auf der Insel."); EnableAtAirport = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableAtAirport", true, "Ein Tisch im Flughafen (Freispiel: Chips kosten nichts, Gewinne wirken nicht - das Spiel blockt dort Statuswerte)."); ChipPercent = ((BaseUnityPlugin)this).Config.Bind<int>("Balance", "ChipPercent", 1, new ConfigDescription("Wert eines Chips in Prozent der Lebensleiste (wird beim Setzen als Verletzung abgezogen).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); MaxChipsPerRound = ((BaseUnityPlugin)this).Config.Bind<int>("Balance", "MaxChipsPerRound", 20, new ConfigDescription("Hoechstzahl Chips je Spieler und Runde (vor dem Verdoppeln).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 60), Array.Empty<object>())); BettingSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Balance", "BettingSeconds", 15f, new ConfigDescription("Sekunden vom ersten Chip bis zum Austeilen (jeder weitere Chip haelt mindestens 5 s offen).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 90f), Array.Empty<object>())); TurnSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Balance", "TurnSeconds", 20f, new ConfigDescription("Bedenkzeit je Zug; danach haelt der Spieler automatisch.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 90f), Array.Empty<object>())); BankCurse = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance", "BankCurse", true, "Hat der Dealer einen Blackjack, verflucht die Bank alle am Tisch, die keinen haben."); PeakShader = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "PeakShader", true, "Korpus im Spiel-Look (Shader W/Peak_Standard mit gemalten Schichten). Aus = glattes URP-Material."); SoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "Volume", 1f, new ConfigDescription("Lautstaerke des Mods, zusaetzlich zu Master- und SFX-Regler des Spiels. 0 = stumm.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); AttractVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "AttractVolume", 1f, new ConfigDescription("Lautstaerke der Lockmelodie im Leerlauf, zusaetzlich zu Audio.Volume. 0 = aus.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); LogLevel = ((BaseUnityPlugin)this).Config.Bind<BlackjackLogLevel>("Logging", "LogLevel", BlackjackLogLevel.Info, "Wie gespraechig der Mod im BepInEx-Log ist."); Loc.Initialize(); BlackjackNet.Register(); SceneManager.sceneLoaded += OnSceneLoaded; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) Loc.Refresh(); try { if ((int)mode == 0) { BlackjackLog.Info("[Plugin] Szene '" + ((Scene)(ref scene)).name + "' geladen."); ((MonoBehaviour)this).StartCoroutine(TablePlacer.PlaceForScene(((Scene)(ref scene)).name)); } } catch (Exception arg) { BlackjackLog.Error($"[Plugin] Fehler in OnSceneLoaded: {arg}"); } } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; } } internal static class BuildInfo { public const string Version = "1.0.1"; public const string Label = ""; public const string ProductName = "PEAK BLACKJACK"; } } namespace PeakBlackjack.Table { public static class BlackjackAudio { private const int Rate = 44100; private static AudioMixerGroup _sfxGroup; private static float _nextSearch; private static AudioClip _chip; private static AudioClip _card; private static AudioClip _flip; private static AudioClip _win; private static AudioClip _jackpot; private static AudioClip _lose; private static AudioClip _curse; private static AudioClip _coin; private static AudioClip _attract; private static uint _noiseState = 2654435769u; public static float Volume { get { if (Plugin.SoundVolume == null) { return 1f; } return Mathf.Clamp(Plugin.SoundVolume.Value, 0f, 2f); } } public static float AttractVolume => Volume * ((Plugin.AttractVolume != null) ? Mathf.Clamp(Plugin.AttractVolume.Value, 0f, 2f) : 1f); public static AudioMixerGroup SfxGroup { get { if ((Object)(object)_sfxGroup != (Object)null) { return _sfxGroup; } if (Time.unscaledTime < _nextSearch) { return null; } _nextSearch = Time.unscaledTime + 5f; try { SFX_Player val = Object.FindFirstObjectByType<SFX_Player>(); if ((Object)(object)val != (Object)null && (Object)(object)val.defaultMixerGroup != (Object)null) { _sfxGroup = val.defaultMixerGroup; } AudioMixer val2 = (((Object)(object)_sfxGroup != (Object)null) ? _sfxGroup.audioMixer : MasterMixer); if ((Object)(object)_sfxGroup == (Object)null && (Object)(object)val2 != (Object)null) { _sfxGroup = FindSfx(val2); } if ((Object)(object)_sfxGroup == (Object)null) { AudioMixerGroup val3 = null; AudioMixerGroup[] array = Resources.FindObjectsOfTypeAll<AudioMixerGroup>(); float num = default(float); foreach (AudioMixerGroup val4 in array) { if (!((Object)(object)val4 == (Object)null) && !((Object)(object)val4.audioMixer == (Object)null) && val4.audioMixer.GetFloat("SFXVolume", ref num)) { if (string.Equals(((Object)val4).name, "SFX", StringComparison.OrdinalIgnoreCase)) { _sfxGroup = val4; break; } if ((Object)(object)val3 == (Object)null && ((Object)val4).name.IndexOf("sfx", StringComparison.OrdinalIgnoreCase) >= 0) { val3 = val4; } if (val2 == null) { val2 = val4.audioMixer; } } } if (_sfxGroup == null) { _sfxGroup = val3; } } if ((Object)(object)_sfxGroup == (Object)null && (Object)(object)val2 != (Object)null) { AudioMixerGroup[] array2 = val2.FindMatchingGroups("Master"); if (array2 != null && array2.Length != 0) { _sfxGroup = array2[0]; } } if ((Object)(object)_sfxGroup != (Object)null) { BlackjackLog.Info("[Audio] Ausgabe ueber Mixer-Gruppe '" + ((Object)_sfxGroup).name + "' (" + ((Object)_sfxGroup.audioMixer).name + ") - folgt Master- und SFX-Regler."); } else { BlackjackLog.Warning("[Audio] Keine Mixergruppe gefunden - Lautstaerke folgt den Spielreglern nicht (Config: Audio.Volume)."); } } catch (Exception ex) { BlackjackLog.Warning("[Audio] Mixer-Suche fehlgeschlagen: " + ex.Message); } return _sfxGroup; } } private static AudioMixer MasterMixer { get { try { AudioMixerGroup val = (((Object)(object)SingletonAsset<StaticReferences>.Instance != (Object)null) ? SingletonAsset<StaticReferences>.Instance.masterMixerGroup : null); return ((Object)(object)val != (Object)null) ? val.audioMixer : null; } catch (Exception ex) { BlackjackLog.Debug("[Audio] StaticReferences nicht lesbar: " + ex.Message); return null; } } } public static AudioClip Chip => _chip ?? (_chip = Build("PeakBlackjack_Chip", 0.16f, (float t, float d) => Mathf.Sin(MathF.PI * 5800f * t) * Env(t, 0f, 0.01f, 60f) * 0.7f + Noise(t) * Env(t, 0f, 0.004f, 120f) * 0.5f)); public static AudioClip Card => _card ?? (_card = Build("PeakBlackjack_Card", 0.32f, delegate(float t, float d) { float num = Noise(t) * Env(t, 0.02f, 0.06f, 30f) * 0.35f * (0.5f + 0.5f * Mathf.Sin(MathF.PI * 22f * t)); float num2 = t - 0.22f; float num3 = ((num2 >= 0f) ? ((Mathf.Sin(MathF.PI * 1800f * num2) * 0.6f + Noise(t) * 0.5f) * Env(num2, 0f, 0.006f, 110f)) : 0f); return num + num3; })); public static AudioClip Flip => _flip ?? (_flip = Build("PeakBlackjack_Flip", 0.14f, (float t, float d) => Noise(t) * Env(t, 0f, 0.008f, 90f) * 0.6f + Mathf.Sin(MathF.PI * 2800f * t) * Env(t, 0.004f, 0.01f, 70f) * 0.4f)); public static AudioClip Win => _win ?? (_win = Build("PeakBlackjack_Win", 0.95f, (float t, float d) => Arpeggio(t, new float[4] { 523.25f, 659.25f, 783.99f, 1046.5f }, 0.17f, 0.9f))); public static AudioClip Jackpot => _jackpot ?? (_jackpot = Build("PeakBlackjack_Jackpot", 2.4f, delegate(float t, float d) { if (t < 1.1f) { return Arpeggio(t, new float[7] { 523.25f, 659.25f, 783.99f, 1046.5f, 1318.5f, 1568f, 2093f }, 0.11f, 0.9f); } float num = t - 1.1f; float num2 = Mathf.Sin(MathF.PI * 2093f * num) + Mathf.Sin(MathF.PI * 2637f * num) + Mathf.Sin(MathF.PI * 3136f * num); float num3 = 1f + 0.02f * Mathf.Sin(MathF.PI * 12f * num); return num2 / 3f * num3 * Env(num, 0.02f, 1.2f, 2.2f) * 0.8f; })); public static AudioClip Lose => _lose ?? (_lose = Build("PeakBlackjack_Lose", 0.7f, (float t, float d) => Saw(Mathf.Lerp(170f, 85f, t / d), t) * Env(t, 0.01f, 0.6f, 3f) * 0.45f)); public static AudioClip Curse => _curse ?? (_curse = Build("PeakBlackjack_Curse", 1.4f, delegate(float t, float d) { float num = Mathf.Lerp(240f, 95f, t / d); float num2 = Mathf.Sin(MathF.PI * 2f * num * t); float num3 = Mathf.Sin(MathF.PI * 2f * (num * 1.06f) * t); float num4 = 0.6f + 0.4f * Mathf.Sin(MathF.PI * 18f * t); return (num2 + num3) * 0.5f * num4 * Env(t, 0.05f, 1.2f, 1.8f) * 0.7f; })); public static AudioClip Coin => _coin ?? (_coin = Build("PeakBlackjack_Coin", 0.5f, delegate(float t, float d) { float num = ((t < 0.22f) ? t : (t - 0.22f)); return (Mathf.Sin(MathF.PI * 4700f * num) + 0.6f * Mathf.Sin(MathF.PI * 7040f * num)) * Env(num, 0f, 0.2f, 22f) * 0.5f; })); public static AudioClip Attract => _attract ?? (_attract = Build("PeakBlackjack_Attract", 6f, delegate(float t, float d) { float[] array = new float[16] { 587.33f, 698.46f, 880f, 1174.7f, 880f, 698.46f, 587.33f, 523.25f, 659.25f, 783.99f, 987.77f, 1318.5f, 987.77f, 783.99f, 659.25f, 493.88f }; float num = 0f; int num2 = (int)(t / 0.18f); if (num2 < array.Length) { float num3 = t - (float)num2 * 0.18f; float num4 = array[num2]; float num5 = Mathf.Sin(MathF.PI * 2f * num4 * num3) + 0.4f * Mathf.Sin(MathF.PI * 2f * num4 * 2f * num3) + 0.12f * Mathf.Sin(MathF.PI * 2f * num4 * 4f * num3); num += num5 / 1.5f * Env(num3, 0.004f, 0.03f, 9f) * 0.5f; } float num6 = t - 3.3f; if (num6 >= 0f) { int num7 = (int)(num6 / 0.18f); if (num7 < array.Length) { float num8 = num6 - (float)num7 * 0.18f; float num9 = array[num7] * 0.5f; num += Mathf.Sin(MathF.PI * 2f * num9 * num8) * Env(num8, 0.005f, 0.05f, 10f) * 0.28f; } } float[] array2 = new float[2] { 2.95f, 5.85f }; foreach (float num10 in array2) { float num11 = t - num10; if (num11 >= 0f && num11 < 0.25f) { num += (Mathf.Sin(MathF.PI * 4700f * num11) + 0.5f * Mathf.Sin(MathF.PI * 7040f * num11)) * Env(num11, 0f, 0.05f, 24f) * 0.22f; } } return num; })); private static AudioMixerGroup FindSfx(AudioMixer mixer) { float num = default(float); if ((Object)(object)mixer == (Object)null || !mixer.GetFloat("SFXVolume", ref num)) { return null; } string[] array = new string[3] { "SFX", "Sfx", "sfx" }; foreach (string text in array) { AudioMixerGroup[] array2 = mixer.FindMatchingGroups(text); if (array2 != null && array2.Length != 0) { return array2[0]; } } return null; } public static bool Route(AudioSource source) { if ((Object)(object)source == (Object)null) { return false; } AudioMixerGroup sfxGroup = SfxGroup; if ((Object)(object)sfxGroup == (Object)null) { return false; } source.outputAudioMixerGroup = sfxGroup; return true; } private static float Env(float t, float attack, float hold, float decayRate) { if (t < 0f) { return 0f; } if (t < attack) { return t / attack; } float num = t - attack - hold; if (!(num <= 0f)) { return Mathf.Exp((0f - num) * decayRate); } return 1f; } private static float Saw(float freq, float t) { float num = freq * t % 1f; return 2f * num - 1f; } private static float Noise(float t) { _noiseState ^= _noiseState << 13; _noiseState ^= _noiseState >> 17; _noiseState ^= _noiseState << 5; return (float)_noiseState / 4.2949673E+09f * 2f - 1f; } private static float Arpeggio(float t, float[] notes, float noteLength, float gain) { int num = Mathf.Min(notes.Length - 1, (int)(t / noteLength)); float num2 = t - (float)num * noteLength; float num3 = notes[num]; float num4 = Mathf.Sin(MathF.PI * 2f * num3 * num2) + 0.35f * Mathf.Sin(MathF.PI * 2f * num3 * 2f * num2) + 0.15f * Mathf.Sin(MathF.PI * 2f * num3 * 3f * num2); float hold = ((num == notes.Length - 1) ? 0.5f : 0.02f); return num4 / 1.5f * Env(num2, 0.005f, hold, 12f) * gain; } private static AudioClip Build(string name, float seconds, Func<float, float, float> generator) { int num = (int)(seconds * 44100f); float[] array = new float[num]; float num2 = 0.001f; for (int i = 0; i < num; i++) { float arg = (float)i / 44100f; num2 = Mathf.Max(num2, Mathf.Abs(array[i] = generator(arg, seconds))); } float num3 = Mathf.Min(1f, 0.85f / num2); for (int j = 0; j < num; j++) { array[j] = Mathf.Clamp(array[j] * num3, -1f, 1f); } AudioClip obj = AudioClip.Create(name, num, 1, 44100, false); obj.SetData(array, 0); return obj; } } public enum PlayerAction : byte { Hit, Stand, Double } public enum SeatOutcome { None, Bust, Lose, Push, Win, Blackjack, DealerBlackjack } public static class BlackjackRules { public const int Seats = 5; public const int Decks = 6; public static int Rank(byte card) { return card % 13; } public static int Suit(byte card) { return card / 13; } public static int Value(byte card) { int num = Rank(card); if (num == 0) { return 11; } if (num < 9) { return num + 1; } return 10; } public static int HandValue(IReadOnlyList<byte> cards, out bool soft) { int num = 0; int num2 = 0; foreach (byte card in cards) { num += Value(card); if (Rank(card) == 0) { num2++; } } while (num > 21 && num2 > 0) { num -= 10; num2--; } soft = num2 > 0; return num; } public static int HandValue(IReadOnlyList<byte> cards) { bool soft; return HandValue(cards, out soft); } public static bool IsBlackjack(IReadOnlyList<byte> cards) { if (cards.Count == 2) { return HandValue(cards) == 21; } return false; } public static bool IsBust(IReadOnlyList<byte> cards) { return HandValue(cards) > 21; } public static string ValueText(IReadOnlyList<byte> cards) { if (cards == null || cards.Count == 0) { return "-"; } if (IsBlackjack(cards)) { return Loc.T("value.blackjack"); } bool soft; int num = HandValue(cards, out soft); if (num > 21) { return Loc.T("value.bust"); } if (!soft || num >= 21) { return num.ToString(); } return $"{num - 10}/{num}"; } public static byte[] Shoe(int seed) { byte[] array = new byte[312]; for (int i = 0; i < 6; i++) { for (int j = 0; j < 52; j++) { array[i * 52 + j] = (byte)j; } } Random random = new Random(seed); for (int num = array.Length - 1; num > 0; num--) { int num2 = random.Next(num + 1); ref byte reference = ref array[num]; ref byte reference2 = ref array[num2]; byte b = array[num2]; byte b2 = array[num]; reference = b; reference2 = b2; } return array; } public static SeatOutcome Outcome(IReadOnlyList<byte> player, IReadOnlyList<byte> dealer) { if (IsBust(player)) { return SeatOutcome.Bust; } bool flag = IsBlackjack(player); if (IsBlackjack(dealer)) { if (!flag) { return SeatOutcome.DealerBlackjack; } return SeatOutcome.Push; } if (flag) { return SeatOutcome.Blackjack; } int num = HandValue(player); int num2 = HandValue(dealer); if (num2 > 21) { return SeatOutcome.Win; } if (num > num2) { return SeatOutcome.Win; } if (num < num2) { return SeatOutcome.Lose; } return SeatOutcome.Push; } public static int Payout(SeatOutcome outcome, int stake) { return outcome switch { SeatOutcome.Win => stake * 2, SeatOutcome.Blackjack => stake * 2 + stake / 2 + ((stake % 2 == 1) ? 1 : 0), SeatOutcome.Push => stake, _ => 0, }; } public static Color ChipColor(int actorNumber) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_004d: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) Color[] array = (Color[])(object)new Color[8] { new Color(0.85f, 0.12f, 0.12f), new Color(0.15f, 0.35f, 0.85f), new Color(0.15f, 0.6f, 0.22f), new Color(0.1f, 0.1f, 0.12f), new Color(0.95f, 0.75f, 0.2f), new Color(0.6f, 0.2f, 0.75f), new Color(0.95f, 0.5f, 0.15f), new Color(0.2f, 0.75f, 0.8f) }; int num = ((actorNumber >= 0) ? (actorNumber % array.Length) : 0); return array[num]; } } public class BlackjackTable : MonoBehaviour { public enum TableState { Idle, Betting, Dealing, Playing, DealerTurn, Result } public sealed class Seat { public int Actor = -1; public string Name = ""; public int Chips; public bool Doubled; public bool Done; public readonly List<byte> Cards = new List<byte>(); public readonly List<GameObject> ChipObjects = new List<GameObject>(); public readonly List<GameObject> CardObjects = new List<GameObject>(); public SeatOutcome Outcome; public bool Occupied { get { if (Actor >= 0) { return Chips > 0; } return false; } } public void Clear() { Actor = -1; Name = ""; Chips = 0; Doubled = false; Done = false; Cards.Clear(); Outcome = SeatOutcome.None; foreach (GameObject chipObject in ChipObjects) { if ((Object)(object)chipObject != (Object)null) { Object.Destroy((Object)(object)chipObject); } } foreach (GameObject cardObject in CardObjects) { if ((Object)(object)cardObject != (Object)null) { Object.Destroy((Object)(object)cardObject); } } ChipObjects.Clear(); CardObjects.Clear(); } } public static readonly Dictionary<int, BlackjackTable> Registry = new Dictionary<int, BlackjackTable>(); private const float ResultSeconds = 8f; private const float MinSecondsAfterBet = 5f; private const float AmbientVolume = 0.1f; private const float OneShotVolume = 0.5f; private const float CardFlight = 0.35f; private static readonly Vector3 CardStep = new Vector3(0.022f, 0.001f, 0.012f); public int Id; public bool IsAirport; public GameObject ChipPrefab; public GameObject CardPrefab; public Material ChipMaterial; public Transform[] BetSpots = (Transform[])(object)new Transform[5]; public Transform[] HandSpots = (Transform[])(object)new Transform[5]; public Transform DealerHand; public Transform ShoeAnchor; public Renderer[] Lights; public Material LightOff; public Material LightOn; public Material LightBright; public TMP_Text TitleText; public TMP_Text MessageText; public AudioSource Audio; public AudioSource AmbientAudio; public Light MarqueeLight; public ParticleSystem FxCoins; public ParticleSystem FxLose; public ParticleSystem FxDeal; public ParticleSystem FxConfetti; public ParticleSystem FxRays; public ParticleSystem FxSparkle; public readonly Seat[] Seats = new Seat[5]; public readonly List<byte> DealerCards = new List<byte>(); private readonly List<GameObject> _dealerCardObjects = new List<GameObject>(); private GameObject _holeCard; private readonly Dictionary<int, Material> _chipMaterials = new Dictionary<int, Material>(); private readonly Dictionary<byte, Material> _cardMaterials = new Dictionary<byte, Material>(); private readonly Queue<(int seat, PlayerAction action)> _pending = new Queue<(int, PlayerAction)>(); private byte[] _deck; private int _deckPos; private float _betsCloseAt; private float _turnEndsAt; private bool _busy; private float _lightClock; private int _lightMode; private float _marqueeLightBase = 1.2f; private Color _marqueeLightColor = Color.white; private static readonly Color CurseLight = new Color(0.6f, 0.15f, 0.9f); private int _lastShownSeconds = -1; private bool _audioRouted; public TableState State { get; private set; } public int TurnSeat { get; private set; } = -1; public bool HoleRevealed { get; private set; } public bool BetsOpen { get { if (State != TableState.Idle) { return State == TableState.Betting; } return true; } } public bool AnySeatOccupied { get { Seat[] seats = Seats; for (int i = 0; i < seats.Length; i++) { if (seats[i].Occupied) { return true; } } return false; } } public int LocalSeat => SeatOf(BlackjackNet.LocalActor); public BlackjackTable() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < Seats.Length; i++) { Seats[i] = new Seat(); } } public void Initialize() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Registry[Id] = this; RefreshTexts(); Loc.LanguageChanged += RefreshTexts; if ((Object)(object)MarqueeLight != (Object)null) { _marqueeLightBase = MarqueeLight.intensity; _marqueeLightColor = MarqueeLight.color; } if ((Object)(object)AmbientAudio != (Object)null) { try { AmbientAudio.clip = BlackjackAudio.Attract; AmbientAudio.time = Random.Range(0f, 5.9f); AmbientAudio.Play(); } catch (Exception ex) { BlackjackLog.Debug("[Audio] Lockmelodie: " + ex.Message); } } } private void OnDestroy() { InteractionRange.Forget(Id); Loc.LanguageChanged -= RefreshTexts; if (Registry.TryGetValue(Id, out var value) && (Object)(object)value == (Object)(object)this) { Registry.Remove(Id); } } public void RefreshTexts() { if ((Object)(object)TitleText != (Object)null) { TitleText.text = Loc.T("table.name"); } if (State == TableState.Idle && (Object)(object)MessageText != (Object)null) { MessageText.text = IdleText(); } } private string IdleText() { return Loc.T(IsAirport ? "screen.idle.airport" : "screen.idle"); } public string DealerVisibleText() { if (DealerCards.Count == 0) { return "-"; } if (HoleRevealed || DealerCards.Count == 1) { return BlackjackRules.ValueText(DealerCards); } return BlackjackRules.ValueText(new List<byte> { DealerCards[0] }); } private void SetMessage(string text) { if ((Object)(object)MessageText != (Object)null) { MessageText.text = text; } } public int SeatOf(int actor) { for (int i = 0; i < Seats.Length; i++) { if (Seats[i].Actor == actor && Seats[i].Chips > 0) { return i; } } return -1; } public bool IsMyTurn(int seat) { if (State == TableState.Playing && !_busy && TurnSeat == seat) { return Seats[seat].Actor == BlackjackNet.LocalActor; } return false; } public bool CanLocalBet(int seat, out string reasonKey) { reasonKey = null; if (!BetsOpen) { reasonKey = "interact.bet.closed"; return false; } int localActor = BlackjackNet.LocalActor; Seat seat2 = Seats[seat]; if (seat2.Occupied && seat2.Actor != localActor) { reasonKey = "interact.bet.taken"; return false; } int localSeat = LocalSeat; if (localSeat >= 0 && localSeat != seat) { reasonKey = "interact.bet.seats"; return false; } int num = ((Plugin.MaxChipsPerRound != null) ? Plugin.MaxChipsPerRound.Value : 20); if (seat2.Actor == localActor && seat2.Chips >= num) { reasonKey = "interact.bet.limit"; return false; } if (!IsAirport && !RewardService.CanAfford()) { reasonKey = "interact.bet.life"; return false; } return true; } public void LocalBet(int seat) { if (CanLocalBet(seat, out var _)) { if (BlackjackNet.IsAuthority) { MasterBet(seat, BlackjackNet.LocalActor, BlackjackNet.LocalName); } else { BlackjackNet.SendBetRequest(Id, seat, BlackjackNet.LocalName); } } } public void MasterBet(int seat, int actor, string name) { if (!BetsOpen || seat < 0 || seat >= Seats.Length) { return; } Seat seat2 = Seats[seat]; if (seat2.Occupied && seat2.Actor != actor) { return; } int num = SeatOf(actor); if (num < 0 || num == seat) { int num2 = ((Plugin.MaxChipsPerRound != null) ? Plugin.MaxChipsPerRound.Value : 20); if (seat2.Actor != actor || seat2.Chips < num2) { BlackjackNet.SendBet(Id, seat, actor, name); ApplyBet(seat, actor, name); } } } public void ApplyBet(int seat, int actor, string name) { if (!BetsOpen || seat < 0 || seat >= Seats.Length) { return; } Seat seat2 = Seats[seat]; if (!seat2.Occupied || seat2.Actor == actor) { if (actor == BlackjackNet.LocalActor && !IsAirport && !RewardService.Pay(1)) { BlackjackLog.Info("[Bet] Chip nicht bezahlt - Chip liegt trotzdem (Ablehnung kam zu spaet)."); } seat2.Actor = actor; seat2.Name = name ?? "SCOUT"; seat2.Chips++; SpawnChip(seat2, seat); Play(BlackjackAudio.Chip, 0.8f); if (State == TableState.Idle) { State = TableState.Betting; float num = ((Plugin.BettingSeconds != null) ? Plugin.BettingSeconds.Value : 15f); _betsCloseAt = Time.time + Mathf.Max(5f, num); _lastShownSeconds = -1; } else if (_betsCloseAt - Time.time < 5f) { _betsCloseAt = Time.time + 5f; } BlackjackLog.Debug($"[Bet] {seat2.Name} (Actor {actor}) hat {seat2.Chips} Chip(s) auf Platz {seat}."); } } private void SpawnChip(Seat s, int seat) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ChipPrefab == (Object)null || (Object)(object)BetSpots[seat] == (Object)null) { return; } try { int count = s.ChipObjects.Count; GameObject val = Object.Instantiate<GameObject>(ChipPrefab, BetSpots[seat]); ((Object)val).name = $"Chip_{s.Actor}"; val.transform.localPosition = new Vector3(0f, (float)count * 0.0046f, 0f); val.transform.localRotation = Quaternion.Euler(0f, (float)count * 23f + (float)s.Actor * 41f, 0f); SetLayerRecursive(val.transform, ((Component)this).gameObject.layer); Material sharedMaterial = ChipMaterialFor(s.Actor); Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(); foreach (Renderer val2 in componentsInChildren) { if ((Object)(object)val2.sharedMaterial != (Object)null && ((Object)val2.sharedMaterial).name.StartsWith("M_Chip", StringComparison.Ordinal)) { val2.sharedMaterial = sharedMaterial; } Collider component = ((Component)val2).GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } s.ChipObjects.Add(val); } catch (Exception ex) { BlackjackLog.Warning("[Bet] Chip konnte nicht gesetzt werden: " + ex.Message); } } private Material ChipMaterialFor(int actor) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (_chipMaterials.TryGetValue(actor, out var value) && (Object)(object)value != (Object)null) { return value; } value = (((Object)(object)ChipMaterial != (Object)null) ? new Material(ChipMaterial) : new Material(Shader.Find("Universal Render Pipeline/Lit"))); value.SetColor("_BaseColor", BlackjackRules.ChipColor(actor)); _chipMaterials[actor] = value; return value; } private static void SetLayerRecursive(Transform t, int layer) { ((Component)t).gameObject.layer = layer; for (int i = 0; i < t.childCount; i++) { SetLayerRecursive(t.GetChild(i), layer); } } public void MasterDeal() { if (State == TableState.Betting && AnySeatOccupied) { int seed = (Environment.TickCount * 397) ^ Id ^ (int)(Time.realtimeSinceStartup * 1000f); BlackjackNet.SendDeal(Id, seed); ApplyDeal(seed); } } public void ApplyDeal(int seed) { if (!BetsOpen || !AnySeatOccupied) { BlackjackLog.Debug($"[Deal] Tisch {Id}: Austeilen in {State} ignoriert."); } else { ((MonoBehaviour)this).StartCoroutine(DealRoutine(seed)); } } private byte Draw() { if (_deck == null || _deckPos >= _deck.Length) { _deck = BlackjackRules.Shoe(Id * 31 + 7); _deckPos = 0; } return _deck[_deckPos++]; } private IEnumerator DealRoutine(int seed) { State = TableState.Dealing; _busy = true; _lightMode = 0; _deck = BlackjackRules.Shoe(seed); _deckPos = 0; DealerCards.Clear(); foreach (GameObject dealerCardObject in _dealerCardObjects) { if ((Object)(object)dealerCardObject != (Object)null) { Object.Destroy((Object)(object)dealerCardObject); } } _dealerCardObjects.Clear(); _holeCard = null; HoleRevealed = false; SetMessage(Loc.T("screen.dealing")); BlackjackLog.Info($"[Deal] Tisch {Id}: Seed {seed}, {OccupiedCount()} Plaetze."); for (int round = 0; round < 2; round++) { for (int i = 0; i < Seats.Length; i++) { if (Seats[i].Occupied) { yield return DealToSeat(i, faceUp: true); } } byte b = Draw(); DealerCards.Add(b); bool flag = round == 0; GameObject val = SpawnCard(DealerHand, _dealerCardObjects.Count, b, flag); if (!flag) { _holeCard = val; } _dealerCardObjects.Add(val); yield return (object)new WaitForSeconds(0.45f); } Seat[] seats = Seats; foreach (Seat seat in seats) { if (seat.Occupied && BlackjackRules.IsBlackjack(seat.Cards)) { seat.Done = true; } } if (BlackjackRules.IsBlackjack(DealerCards)) { yield return RevealHole(); _busy = false; yield return FinishRoutine(); } else { State = TableState.Playing; _busy = false; TurnSeat = -1; NextTurn(); } } private int OccupiedCount() { int num = 0; Seat[] seats = Seats; for (int i = 0; i < seats.Length; i++) { if (seats[i].Occupied) { num++; } } return num; } private IEnumerator DealToSeat(int seat, bool faceUp) { Seat seat2 = Seats[seat]; byte b = Draw(); seat2.Cards.Add(b); GameObject item = SpawnCard(HandSpots[seat], seat2.CardObjects.Count, b, faceUp); seat2.CardObjects.Add(item); yield return (object)new WaitForSeconds(0.45f); } private void NextTurn() { for (int i = TurnSeat + 1; i < Seats.Length; i++) { if (Seats[i].Occupied && !Seats[i].Done) { TurnSeat = i; float num = ((Plugin.TurnSeconds != null) ? Plugin.TurnSeconds.Value : 20f); _turnEndsAt = Time.time + num; _lastShownSeconds = -1; return; } } TurnSeat = -1; ((MonoBehaviour)this).StartCoroutine(DealerRoutine()); } public void LocalAction(int seat, PlayerAction action) { if (IsMyTurn(seat) && (action != PlayerAction.Double || Seats[seat].Cards.Count == 2)) { if (BlackjackNet.IsAuthority) { MasterAction(seat, BlackjackNet.LocalActor, action); } else { BlackjackNet.SendActionRequest(Id, seat, action); } } } public void MasterAction(int seat, int actor, PlayerAction action) { if (State == TableState.Playing && !_busy && seat == TurnSeat && seat >= 0 && seat < Seats.Length) { Seat seat2 = Seats[seat]; if ((actor == -2 || seat2.Actor == actor) && (action != PlayerAction.Double || seat2.Cards.Count == 2)) { BlackjackNet.SendAction(Id, seat, action); ApplyAction(seat, action); } } } public void ApplyAction(int seat, PlayerAction action) { if (State == TableState.Playing) { _pending.Enqueue((seat, action)); PumpActions(); } } private void PumpActions() { if (!_busy && State == TableState.Playing && _pending.Count != 0) { var (num, playerAction) = _pending.Dequeue(); if (num != TurnSeat) { BlackjackLog.Debug($"[Action] {playerAction} fuer Platz {num} ignoriert (am Zug: {TurnSeat})."); PumpActions(); } else { ((MonoBehaviour)this).StartCoroutine(ActionRoutine(num, playerAction)); } } } private IEnumerator ActionRoutine(int seat, PlayerAction action) { _busy = true; Seat s = Seats[seat]; BlackjackLog.Info($"[Action] {s.Name}: {action} (Hand {BlackjackRules.ValueText(s.Cards)})."); switch (action) { case PlayerAction.Hit: yield return DealToSeat(seat, faceUp: true); if (BlackjackRules.HandValue(s.Cards) >= 21) { s.Done = true; } break; case PlayerAction.Double: if (s.Cards.Count == 2) { int chips = s.Chips; if (s.Actor == BlackjackNet.LocalActor && !IsAirport && !RewardService.Pay(chips)) { BlackjackLog.Info("[Action] Verdoppeln nicht bezahlt - gilt trotzdem."); } for (int i = 0; i < chips; i++) { SpawnChip(s, seat); } s.Chips += chips; s.Doubled = true; Play(BlackjackAudio.Chip, 0.8f); yield return DealToSeat(seat, faceUp: true); } s.Done = true; break; default: s.Done = true; break; } if (BlackjackRules.IsBust(s.Cards)) { Play(BlackjackAudio.Lose, 0.6f); if ((Object)(object)FxLose != (Object)null && (Object)(object)HandSpots[seat] != (Object)null) { ((Component)FxLose).transform.position = HandSpots[seat].position; PlayFx(FxLose); } } _busy = false; if (s.Done) { NextTurn(); } else { float num = ((Plugin.TurnSeconds != null) ? Plugin.TurnSeconds.Value : 20f); _turnEndsAt = Time.time + num; } PumpActions(); } private IEnumerator RevealHole() { HoleRevealed = true; if ((Object)(object)_holeCard != (Object)null) { Play(BlackjackAudio.Flip, 0.8f); float t = 0f; Quaternion from = _holeCard.transform.localRotation; while (t < 0.3f) { t += Time.deltaTime; float num = Mathf.Clamp01(t / 0.3f); _holeCard.transform.localRotation = Quaternion.Slerp(from, Quaternion.identity, num); _holeCard.transform.localPosition = new Vector3(_holeCard.transform.localPosition.x, 0.001f + Mathf.Sin(num * MathF.PI) * 0.04f, _holeCard.transform.localPosition.z); yield return null; } _holeCard.transform.localRotation = Quaternion.identity; _holeCard.transform.localPosition = new Vector3(_holeCard.transform.localPosition.x, 0.001f, _holeCard.transform.localPosition.z); } yield return (object)new WaitForSeconds(0.3f); } private IEnumerator DealerRoutine() { State = TableState.DealerTurn; _busy = true; SetMessage(Loc.T("screen.dealer")); yield return RevealHole(); bool anyoneAlive = false; Seat[] seats = Seats; foreach (Seat seat in seats) { if (seat.Occupied && !BlackjackRules.IsBust(seat.Cards) && !BlackjackRules.IsBlackjack(seat.Cards)) { anyoneAlive = true; } } SetMessage(Loc.T("screen.dealer.value", BlackjackRules.ValueText(DealerCards))); while (anyoneAlive && BlackjackRules.HandValue(DealerCards) < 17) { yield return (object)new WaitForSeconds(0.5f); byte b = Draw(); DealerCards.Add(b); _dealerCardObjects.Add(SpawnCard(DealerHand, _dealerCardObjects.Count, b, faceUp: true)); yield return (object)new WaitForSeconds(0.55f); SetMessage(Loc.T(BlackjackRules.IsBust(DealerCards) ? "screen.dealer.bust" : "screen.dealer.value", BlackjackRules.ValueText(DealerCards))); } yield return (object)new WaitForSeconds(0.6f); _busy = false; yield return FinishRoutine(); } private IEnumerator FinishRoutine() { State = TableState.Result; TurnSeat = -1; bool dealerNatural = BlackjackRules.IsBlackjack(DealerCards); RoundOutcome roundOutcome = RoundOutcome.NotPlaying; int netPercent = 0; Seat[] seats = Seats; foreach (Seat seat in seats) { if (!seat.Occupied) { continue; } seat.Outcome = BlackjackRules.Outcome(seat.Cards, DealerCards); if (seat.Actor == BlackjackNet.LocalActor) { try { roundOutcome = RewardService.Settle(seat.Outcome, seat.Chips, seat.Doubled, IsAirport, out netPercent); } catch (Exception arg) { BlackjackLog.Error($"[Result] Abrechnung fehlgeschlagen: {arg}"); } } } BlackjackLog.Info($"[Result] Tisch {Id}: Dealer {BlackjackRules.ValueText(DealerCards)}, lokal {roundOutcome} ({netPercent:+0;-0;0}%)."); if (dealerNatural) { SetMessage(Loc.T("screen.dealer.blackjack")); Play(BlackjackAudio.Curse); _lightMode = 2; } else { SetMessage(ResultsLine()); PlayOutcome(roundOutcome); } yield return (object)new WaitForSeconds(dealerNatural ? 3f : 0f); if (dealerNatural) { SetMessage(ResultsLine()); } yield return (object)new WaitForSeconds(8f); seats = Seats; for (int i = 0; i < seats.Length; i++) { seats[i].Clear(); } DealerCards.Clear(); foreach (GameObject dealerCardObject in _dealerCardObjects) { if ((Object)(object)dealerCardObject != (Object)null) { Object.Destroy((Object)(object)dealerCardObject); } } _dealerCardObjects.Clear(); _holeCard = null; _pending.Clear(); _lightMode = 0; State = TableState.Idle; SetMessage(IdleText()); } private string ResultsLine() { StringBuilder stringBuilder = new StringBuilder(); int chipPercent = RewardService.ChipPercent; Seat[] seats = Seats; foreach (Seat seat in seats) { if (seat.Occupied) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } string text = seat.Name.ToUpperInvariant(); int num = BlackjackRules.Payout(seat.Outcome, seat.Chips); switch (seat.Outcome) { case SeatOutcome.Blackjack: stringBuilder.Append(Loc.T("result.blackjack", text, (num - seat.Chips) * chipPercent)); break; case SeatOutcome.Win: stringBuilder.Append(Loc.T("result.win", text, (num - seat.Chips) * chipPercent)); break; case SeatOutcome.Push: stringBuilder.Append(Loc.T("result.push", text)); break; case SeatOutcome.Bust: stringBuilder.Append(Loc.T("result.bust", text)); break; default: stringBuilder.Append(Loc.T("result.lose", text, seat.Chips * chipPercent)); break; } } } if (stringBuilder.Length != 0) { return stringBuilder.ToString(); } return Loc.T("screen.nowinners"); } private void PlayOutcome(RoundOutcome outcome) { //IL_0061: 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) switch (outcome) { case RoundOutcome.Blackjack: Play(BlackjackAudio.Jackpot); PlayFx(FxCoins); PlayFx(FxConfetti); PlayFx(FxRays); PlaySparkle(new Color(1f, 0.95f, 0.6f), new Color(1f, 0.7f, 0.2f)); _lightMode = 1; break; case RoundOutcome.Win: Play(BlackjackAudio.Win); Play(BlackjackAudio.Coin, 0.8f); PlayFx(FxCoins); _lightMode = 1; break; case RoundOutcome.Push: Play(BlackjackAudio.Coin, 0.6f); break; case RoundOutcome.Lose: Play(BlackjackAudio.Lose, 0.8f); break; default: Play(BlackjackAudio.Coin, 0.4f); break; } } private GameObject SpawnCard(Transform hand, int index, byte card, bool faceUp) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CardPrefab == (Object)null || (Object)(object)hand == (Object)null) { return null; } try { GameObject val = Object.Instantiate<GameObject>(CardPrefab, hand); ((Object)val).name = $"Card_{card}"; SetLayerRecursive(val.transform, ((Component)this).gameObject.layer); MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(); if ((Object)(object)componentInChildren != (Object)null) { Material[] sharedMaterials = ((Renderer)componentInChildren).sharedMaterials; if (sharedMaterials.Length != 0) { sharedMaterials[0] = CardMaterialFor(card, sharedMaterials[0]); } ((Renderer)componentInChildren).sharedMaterials = sharedMaterials; Collider component = ((Component)componentInChildren).GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } Vector3 val2 = CardStep * (float)index; Quaternion val3 = (faceUp ? Quaternion.identity : Quaternion.Euler(0f, 0f, 180f)); val.transform.localPosition = val2; val.transform.localRotation = val3; ((MonoBehaviour)this).StartCoroutine(FlyCard(val.transform, hand, val2, val3)); Play(BlackjackAudio.Card, 0.9f); if ((Object)(object)FxDeal != (Object)null) { ((Component)FxDeal).transform.position = hand.TransformPoint(val2); PlayFx(FxDeal); } return val; } catch (Exception ex) { BlackjackLog.Warning("[Card] Karte konnte nicht gelegt werden: " + ex.Message); return null; } } private IEnumerator FlyCard(Transform card, Transform hand, Vector3 target, Quaternion targetRot) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Vector3 start = (((Object)(object)ShoeAnchor != (Object)null) ? hand.InverseTransformPoint(ShoeAnchor.position) : (target + Vector3.up * 0.3f)); float t = 0f; while (t < 0.35f && (Object)(object)card != (Object)null) { t += Time.deltaTime; float num = Mathf.SmoothStep(0f, 1f, t / 0.35f); card.localPosition = Vector3.Lerp(start, target, num) + Vector3.up * Mathf.Sin(num * MathF.PI) * 0.12f; card.localRotation = Quaternion.Slerp(Quaternion.Euler(0f, 0f, 180f), targetRot, num); yield return null; } if (!((Object)(object)card == (Object)null)) { card.localPosition = target; card.localRotation = targetRot; } } private Material CardMaterialFor(byte card, Material proto) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_002d: 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) if (_cardMaterials.TryGetValue(card, out var value) && (Object)(object)value != (Object)null) { return value; } value = new Material(proto); value.mainTextureScale = new Vector2(1f / 13f, 0.25f); value.mainTextureOffset = new Vector2((float)BlackjackRules.Rank(card) / 13f, (float)BlackjackRules.Suit(card) / 4f); _cardMaterials[card] = value; return value; } private void Update() { //IL_0192: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) if (State == TableState.Betting) { float num = Mathf.Max(0f, _betsCloseAt - Time.time); int num2 = Mathf.CeilToInt(num); if (num2 != _lastShownSeconds) { _lastShownSeconds = num2; SetMessage(Loc.T("screen.betting", num2)); } if (num <= 0f && BlackjackNet.IsAuthority) { MasterDeal(); } } else if (State == TableState.Playing && TurnSeat >= 0) { float num3 = Mathf.Max(0f, _turnEndsAt - Time.time); int num4 = Mathf.CeilToInt(num3); if (num4 != _lastShownSeconds) { _lastShownSeconds = num4; SetMessage(Loc.T("screen.turn", Seats[TurnSeat].Name.ToUpperInvariant(), num4)); } if (num3 <= 0f && !_busy && BlackjackNet.IsAuthority) { MasterAction(TurnSeat, -2, PlayerAction.Stand); } } UpdateLights(); if (!_audioRouted && (Object)(object)BlackjackAudio.SfxGroup != (Object)null) { BlackjackAudio.Route(Audio); BlackjackAudio.Route(AmbientAudio); _audioRouted = true; } Transform val = (((Object)(object)MainCamera.instance != (Object)null) ? ((Component)MainCamera.instance).transform : null); if ((Object)(object)val != (Object)null) { Vector3 val2 = ((Component)this).transform.TransformPoint(new Vector3(0f, 0.8f, 0f)); int id = Id; Vector3 val3 = val.position - val2; InteractionRange.Report(id, ((Vector3)(ref val3)).sqrMagnitude < 20.25f); } if ((Object)(object)AmbientAudio != (Object)null) { float num5 = ((State == TableState.Idle) ? (0.1f * BlackjackAudio.AttractVolume) : 0f); AmbientAudio.volume = Mathf.MoveTowards(AmbientAudio.volume, num5, Time.deltaTime * 0.5f); } } private void UpdateLights() { //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_013e: 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_0148: Unknown result type (might be due to invalid IL or missing references) if (Lights == null || Lights.Length == 0) { return; } _lightClock += Time.deltaTime; if ((Object)(object)MarqueeLight != (Object)null) { float num = _lightMode switch { 1 => 1.6f + 0.8f * Mathf.Abs(Mathf.Sin(_lightClock * 12f)), 2 => 0.6f + 0.5f * Mathf.PerlinNoise(_lightClock * 9f, 0.3f), _ => 1f + 0.08f * Mathf.Sin(_lightClock * 3f), }; MarqueeLight.intensity = _marqueeLightBase * num; Light marqueeLight = MarqueeLight; marqueeLight.color = (Color)(_lightMode switch { 1 => Color.Lerp(_marqueeLightColor, Color.white, 0.5f + 0.5f * Mathf.Sin(_lightClock * 12f)), 2 => Color.Lerp(_marqueeLightColor, CurseLight, 0.6f + 0.4f * Mathf.PerlinNoise(_lightClock * 7f, 0.7f)), _ => _marqueeLightColor, }); } switch (_lightMode) { case 1: { bool flag2 = Mathf.FloorToInt(_lightClock * 8f) % 2 == 0; Renderer[] lights = Lights; for (int k = 0; k < lights.Length; k++) { lights[k].sharedMaterial = (flag2 ? LightBright : LightOff); } break; } case 2: { int num4 = Mathf.FloorToInt(_lightClock * 14f); for (int j = 0; j < Lights.Length; j++) { bool flag = (num4 * 31 + j * 17) % 7 < 3; Lights[j].sharedMaterial = (flag ? LightOn : LightOff); } break; } default: { float num2 = ((State == TableState.Dealing || State == TableState.DealerTurn) ? 18f : ((State == TableState.Idle) ? 5f : 9f)); int num3 = Mathf.FloorToInt(_lightClock * num2); for (int i = 0; i < Lights.Length; i++) { Lights[i].sharedMaterial = (((i + num3) % 3 == 0) ? LightOn : LightOff); } break; } } } private void Play(AudioClip clip, float volume = 1f) { if (!((Object)(object)Audio == (Object)null) && !((Object)(object)clip == (Object)null)) { Audio.PlayOneShot(clip, volume * 0.5f * BlackjackAudio.Volume); } } private void PlayFx(ParticleSystem fx) { if ((Object)(object)fx == (Object)null) { return; } try { fx.Play(true); } catch (Exception ex) { BlackjackLog.Debug("[Fx] " + ((Object)fx).name + ": " + ex.Message); } } private void PlaySparkle(Color a, Color b) { //IL_0016: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)FxSparkle == (Object)null)) { try { MainModule main = FxSparkle.main; ((MainModule)(ref main)).startColor = new MinMaxGradient(a, b); } catch (Exception ex) { BlackjackLog.Debug("[Fx] Sparkle-Farbe: " + ex.Message); } PlayFx(FxSparkle); } } } public class DealerSpot : MonoBehaviour, IInteractible { public BlackjackTable Table; public bool IsInteractible(Character interactor) { if ((Object)(object)interactor == (Object)null || !interactor.IsLocal || (Object)(object)Table == (Object)null) { return false; } return Table.DealerCards.Count > 0; } public void Interact(Character interactor) { } public void HoverEnter() { } public void HoverExit() { } public Vector3 Center() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public Transform GetTransform() { return ((Component)this).transform; } public string GetInteractionText() { if ((Object)(object)Table == (Object)null || Table.DealerCards.Count == 0) { return string.Empty; } return Loc.T(Table.HoleRevealed ? "interact.dealer.value" : "interact.dealer.shows", Table.DealerVisibleText()); } public string GetName() { return Loc.T("dealer.name"); } } public class HandSpot : MonoBehaviour, IInteractibleConstant, IInteractible { private const float CastSeconds = 0.25f; public BlackjackTable Table; public int Seat; public GameObject Highlight; public bool holdOnFinish => false; public bool IsInteractible(Character interactor) { if ((Object)(object)interactor == (Object)null || !interactor.IsLocal || (Object)(object)Table == (Object)null) { return false; } if ((Object)(object)interactor.data == (Object)null || interactor.data.dead || interactor.data.fullyPassedOut) { return false; } if (!Table.IsMyTurn(Seat)) { return Table.Seats[Seat].Cards.Count > 0; } return true; } public void Interact(Character interactor) { } public void HoverEnter() { if ((Object)(object)Highlight != (Object)null) { Highlight.SetActive(true); } } public void HoverExit() { if ((Object)(object)Highlight != (Object)null) { Highlight.SetActive(false); } } public Vector3 Center() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public Transform GetTransform() { return ((Component)this).transform; } public string GetInteractionText() { if ((Object)(object)Table == (Object)null) { return string.Empty; } BlackjackTable.Seat seat = Table.Seats[Seat]; if (Table.IsMyTurn(Seat)) { return Loc.T("interact.hit", BlackjackRules.ValueText(seat.Cards)); } if (seat.Cards.Count <= 0) { return Loc.T("interact.wait"); } return Loc.T("interact.hand.value", seat.Name.ToUpperInvariant(), BlackjackRules.ValueText(seat.Cards)); } public string GetName() { BlackjackTable.Seat seat = (((Object)(object)Table != (Object)null) ? Table.Seats[Seat] : null); if (seat == null || !seat.Occupied) { return Loc.T("hand.name.free"); } return Loc.T("hand.name", seat.Name.ToUpperInvariant()); } public bool IsConstantlyInteractable(Character interactor) { return IsInteractible(interactor); } public float GetInteractTime(Character interactor) { return 0.25f; } public void Interact_CastFinished(Character interactor) { if (!((Object)(object)interactor == (Object)null) && interactor.IsLocal && !((Object)(object)Table == (Object)null)) { Table.LocalAction(Seat, PlayerAction.Hit); } } public void CancelCast(Character interactor) { } public void ReleaseInteract(Character interactor) { } } internal static class InteractionRange { private const float Extended = 3.4f; private static readonly HashSet<int> NearTables = new HashSet<int>(); private static float _original = -1f; private static bool _extended; public static void Report(int tableId, bool near) { if (near) { NearTables.Add(tableId); } else { NearTables.Remove(tableId); } Apply(); } public static void Forget(int tableId) { if (NearTables.Remove(tableId)) { Apply(); } } private static void Apply() { try { Interaction instance = Interaction.instance; if ((Object)(object)instance == (Object)null) { return; } bool flag = NearTables.Count > 0; if (flag != _extended) { if (flag) { _original = instance.distance; instance.distance = Mathf.Max(instance.distance, 3.4f); } else if (_original > 0f) { instance.distance = _original; } _extended = flag; } } catch (Exception ex) { BlackjackLog.Debug("[Range] " + ex.Message); } } } public static class PeakStyle { private const string ShaderName = "W/Peak_Standard"; private static Material _template; private static bool _searched; private static readonly Dictionary<string, Material> Cache = new Dictionary<string, Material>(); private static readonly string[] PreferredNames = new string[9] { "Kiosk", "Counter", "Desk", "Table", "Chair", "Bench", "Crate", "Box", "Wood" }; public static bool Enabled { get { if (Plugin.PeakShader != null) { return Plugin.PeakShader.Value; } return true; } } public static Material Template { get { if ((Object)(object)_template != (Object)null || _searched) { return _template; } _searched = true; try { Material val = null; Material[] array = Resources.FindObjectsOfTypeAll<Material>(); foreach (Material val2 in array) { if ((Object)(object)val2 == (Object)null || (Object)(object)val2.shader == (Object)null || ((Object)val2.shader).name != "W/Peak_Standard" || ((Object)val2).name.Contains("(Instance)") || val2.GetFloat("_UseAlpha") > 0.5f) { continue; } if ((Object)(object)val == (Object)null) { val = val2; } string[] preferredNames = PreferredNames; foreach (string value in preferredNames) { if (((Object)val2).name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { _template = val2; break; } } if ((Object)(object)_template != (Object)null) { break; } } if (_template == null) { _template = val; } BlackjackLog.Info(((Object)(object)_template != (Object)null) ? ("[Style] PEAK-Vorlage: '" + ((Object)_template).name + "'") : "[Style] Kein Material mit W/Peak_Standard geladen - URP-Fallback."); } catch (Exception ex) { BlackjackLog.Warning("[Style] Vorlagensuche fehlgeschlagen: " + ex.Message); } return _template; } } public static Material Styled(string key, Material urpFallback, Color color, float smoothness, float metallic) { //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if (Cache.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } Material val = null; Material val2 = (Enabled ? Template : null); if ((Object)(object)val2 != (Object)null) { try { val = new Material(val2) { name = "PeakBlackjack_" + key }; val.SetTexture("_BaseTexture", (Texture)null); val.SetFloat("_BaseTexAmount", 0f); val.SetFloat("_UseUV2", 0f); val.DisableKeyword("_USEUV2_ON"); val.SetColor("_BaseColor", color); val.SetColor("_Tint", Color.white); val.SetFloat("_BaseSmooth", smoothness); val.SetFloat("_BaseMetallic", metallic); val.SetFloat("_Triplanar1On", 1f); val.SetFloat("_Triplanar2On", 1f); val.SetFloat("_Triplanar3On", 1f); val.SetFloat("_VertexColorAmount", 0f); val.SetFloat("_Interactable", 0f); val.EnableKeyword("_INTERACTABLE_ON"); } catch (Exception ex) { BlackjackLog.Warning("[Style] Klonen fehlgeschlagen: " + ex.Message); val = null; } } if ((Object)(object)val == (Object)null) { val = new Material(urpFallback) { name = "PeakBlackjack_" + key + "_URP" }; val.SetColor("_BaseColor", color); val.SetFloat("_Smoothness", smoothness); val.SetFloat("_Metallic", metallic); val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", Color.black); } Cache[key] = val; return val; } } public enum RoundOutcome { NotPlaying, Lose, Push, Win, Blackjack, Cursed } public static class RewardService { private const float Step = 0.025f; private const float Epsilon = 0.0001f; private static float _pending; private static Character _ledgerOwner; public static float ChipFraction => (float)Mathf.Clamp((Plugin.ChipPercent == null) ? 1 : Plugin.ChipPercent.Value, 1, 10) / 100f; public static int ChipPercent => Mathf.RoundToInt(ChipFraction * 100f); public static float Pending { get { if (!(_pending > 0f)) { return 0f; } return _pending; } } public static bool CanAfford(int chips = 1) { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || localCharacter.refs == null || (Object)(object)localCharacter.refs.afflictions == (Object)null) { return false; } try { return localCharacter.refs.afflictions.statusSum + Pending + ChipFraction * (float)chips < 0.93f; } catch { return true; } } public static bool Pay(int chips) { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || chips <= 0) { return false; } return ChargeInjury(localCharacter, ChipFraction * (float)chips, chips); } private static void SyncLedger(Character character) { if (!((Object)(object)_ledgerOwner == (Object)(object)character)) { _ledgerOwner = character; _pending = 0f; } } private static bool ChargeInjury(Character character, float amount, int chips) { SyncLedger(character); _pending += amount; int num = Mathf.FloorToInt(_pending / 0.025f + 0.0001f); if (num <= 0) { BlackjackLog.Info($"[Reward] {chips} Chip(s) gesetzt: {_pending * 100f:F1} % angeschrieben (Leiste kennt nur 2,5-%-Stufen)."); return true; } float num2 = (float)num * 0.025f; bool flag = character.refs.afflictions.AddStatus((STATUSTYPE)0, num2, false, true, true, false); _pending = (flag ? (_pending - num2) : 0f); BlackjackLog.Info(string.Format("[Reward] {0} Chip(s) gesetzt: Injury +{1:F3} ({2}), Rest {3:F1} %.", chips, num2, flag ? "angewendet" : "vom Spiel abgelehnt", _pending * 100f)); return flag; } private static void HealInjury(Character character, float amount) { SyncLedger(character); _pending -= amount; if (_pending >= 0f) { return; } float currentStatus = character.refs.afflictions.GetCurrentStatus((STATUSTYPE)0); if (currentStatus <= 0f) { _pending = 0f; return; } int num = Mathf.FloorToInt((0f - _pending) / 0.025f + 0.0001f); if (num > 0) { float num2 = Mathf.Min((float)num * 0.025f, currentStatus); character.refs.afflictions.SubtractStatus((STATUSTYPE)0, num2, false, false); _pending += (float)num * 0.025f; } } public static RoundOutcome Settle(SeatOutcome outcome, int stake, bool doubled, bool airport, out int netPercent) { int num = BlackjackRules.Payout(outcome, stake); netPercent = Mathf.RoundToInt((float)(num - stake) * ChipFraction * 100f); RoundOutcome result = outcome switch { SeatOutcome.Blackjack => RoundOutcome.Blackjack, SeatOutcome.Win => RoundOutcome.Win, SeatOutcome.Push => RoundOutcome.Push, SeatOutcome.DealerBlackjack => RoundOutcome.Cursed, _ => RoundOutcome.Lose, }; if (airport) { return result; } Character character = Character.localCharacter; if ((Object)(object)character == (Object)null) { return result; } if (outcome == SeatOutcome.DealerBlackjack) { if (Plugin.BankCurse == null || Plugin.BankCurse.Value) { float curse = Mathf.Clamp(0.1f + 0.01f * (float)stake, 0.1f, 0.3f); Apply(delegate { character.refs.afflictions.AddStatus((STATUSTYPE)5, curse, false, true, true, false); }, $"Bank verflucht: Curse +{curse:F2}"); } return RoundOutcome.Cursed; } if (num <= 0) { return RoundOutcome.Lose; } float heal = (float)num * ChipFraction; Apply(delegate { HealInjury(character, heal); }, $"Heilung {heal:F2}"); int n = Mathf.Max(1, stake); switch (outcome) { case SeatOutcome.Blackjack: Apply(delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown character.refs.afflictions.AddAffliction((Affliction)new Affliction_HealAll { maxHealing = heal * 0.5f, totalTime = 0.1f }, false); }, "Heilung aller Werte"); Apply(delegate { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown character.refs.afflictions.AddAffliction((Affliction)new Affliction_InfiniteStamina(Mathf.Min(180f, 60f + 20f * (float)n)), false); }, "unendliche Ausdauer"); Apply(delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown character.refs.afflictions.AddAffliction((Affliction)new Affliction_FasterBoi { totalTime = 45f, moveSpeedMod = 0.3f, climbSpeedMod = 0.3f, drowsyOnEnd = 0.05f }, false); }, "Tempo"); break; case SeatOutcome.Win: if (doubled) { Apply(delegate { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown character.refs.afflictions.AddAffliction((Affliction)new Affliction_FasterBoi { totalTime = Mathf.Min(90f, 30f + 10f * (float)n), moveSpeedMod = 0.3f, climbSpeedMod = 0.3f, drowsyOnEnd = 0.05f }, false); }, "Tempo"); } else { Apply(delegate { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown character.refs.afflictions.AddAffliction((Affliction)new Affliction_AddBonusStamina(Mathf.Min(0.5f, 0.2f + 0.05f * (float)n), 0.1f), false); }, "Bonus-Ausdauer"); } break; } return result; } private static void Apply(Action action, string what) { try { action(); BlackjackLog.Info("[Reward] " + what + "."); } catch (Exception ex) { BlackjackLog.Warning("[Reward] " + what + " fehlgeschlagen: " + ex.Message); } } } public class SeatSpot : MonoBehaviour, IInteractibleConstant, IInteractible { private const float CastSeconds = 0.25f; public BlackjackTable Table; public int Seat; public GameObject Highlight; public bool holdOnFinish => false; private bool Alive(Character interactor) { if ((Object)(object)interactor != (Object)null && interactor.IsLocal && (Object)(object)Table != (Object)null && (Object)(object)interactor.data != (Object)null && !interactor.data.dead) { return !interactor.data.fullyPassedOut; } return false; } public bool IsInteractible(Character interactor) { if (!Alive(interactor)) { return false; } if (!Table.BetsOpen) { return Table.IsMyTurn(Seat); } return true; } public void Interact(Character interactor) { } public void HoverEnter() { if ((Object)(object)Highlight != (Object)null) { Highlight.SetActive(true); } } public void HoverExit() { if ((Object)(object)Highlight != (Object)null) { Highlight.SetActive(false); } } public Vector3 Center() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public Transform GetTransform() { return ((Component)this).transform; } public string GetInteractionText() { if ((Object)(object)Table == (Object)null) { return string.Empty; } BlackjackTable.Seat seat = Table.Seats[Seat]; if (Table.State == BlackjackTable.TableState.Playing) { if (!Table.IsMyTurn(Seat)) { return Loc.T("interact.wait"); } return Loc.T("interact.stand", BlackjackRules.ValueText(seat.Cards)); } if (!Table.CanLocalBet(Seat, out var reasonKey)) { if (!(reasonKey == "interact.bet.taken")) { return Loc.T(reasonKey); } return Loc.T(reasonKey, seat.Name.ToUpperInvariant()); } int chipPercent = RewardService.ChipPercent; if (Table.IsAirport) { return Loc.T("interact.bet.free"); } if (seat.Chips <= 0) { return Loc.T("interact.bet", chipPercent); } return Loc.T("interact.bet.more", chipPercent, seat.Chips * chipPercent); } public string GetName() { BlackjackTable.Seat seat = (((Object)(object)Table != (Object)null) ? Table.Seats[Seat] : null); if (seat == null || !seat.Occupied) { return Loc.T("seat.name", Seat + 1); } return Loc.T("interact.bet.taken", seat.Name.ToUpperInvariant()); } public bool IsConstantlyInteractable(Character interactor) { return IsInteractible(interactor); } public float GetInteractTime(Character interactor) { return 0.25f; } public void Interact_CastFinished(Character interactor) { if (Alive(interactor)) { if (Table.State == BlackjackTable.TableState.Playing) { Table.LocalAction(Seat, PlayerAction.Stand); } else { Table.LocalBet(Seat); } } } public void CancelCast(Character interactor) { } public void ReleaseInteract(Character interactor) { } } public class ShoeInteract : MonoBehaviour, IInteractibleConstant, IInteractible { private const float CastSeconds = 0.4f; public BlackjackTable Table; public Renderer[] HoverRenderers; private MaterialPropertyBlock _block; private bool _hovered; public bool holdOnFinish => false; private bool CanDouble() { if ((Object)(object)Table == (Object)null) { return false; } int turnSeat = Table.TurnSeat; if (turnSeat < 0 || !Table.IsMyTurn(turnSeat)) { return false; } BlackjackTable.Seat seat = Table.Seats[turnSeat]; if (seat.Cards.Count != 2) { return false; } if (!Table.IsAirport) { return RewardService.CanAfford(seat.Chips); } return true; } public bool IsInteractible(Character interactor) { if ((Object)(object)interactor == (Object)null || !interactor.IsLocal) { return false; } if ((Object)(object)interactor.data == (Object)null || interactor.data.dead || interactor.data.fullyPassedOut) { return false; } return CanDouble(); } public void Interact(Character interactor) { } public void HoverEnter() { SetHover(on: true); } public void HoverExit() { SetHover(on: false); } private void SetHover(bool on) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (_hovered == on || HoverRenderers == null) { return; } _hovered = on; if (_block == null) { _block = new MaterialPropertyBlock(); } _block.SetColor("_EmissionColor", (Color)(on ? new Color(0.4f, 0.3f, 0.1f) : Color.black)); Renderer[] hoverRenderers = HoverRenderers; foreach (Renderer val in hoverRenderers) { if ((Object)(object)val != (Object)null) { val.SetPropertyBlock(_block); } } } public Vector3 Center() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.position; } public Transform GetTransform() { return ((Component)this).transform; } public string GetInteractionText() { if ((Object)(object)Table == (Object)null || !CanDouble()) { return Loc.T("interact.wait"); } if (Table.IsAirport) { return Loc.T("interact.double.free"); } return Loc.T("interact.double", Table.Seats[Table.TurnSeat].Chips * RewardService.ChipPercent); } public string GetName() { return Loc.T("shoe.name"); } public bool IsConstantlyInteractable(Character interactor) { return IsInteractible(interactor); } public float GetInteractTime(Character interactor) { return 0.4f; } public void Interact_CastFinished(Character interactor) { if (!((Object)(object)interactor == (Object)null) && interactor.IsLocal && !((Object)(object)Table == (Object)null) && CanDouble()) { Table.LocalAction(Table.TurnSeat, PlayerAction.Double); } } public void CancelCast(Character interactor) { } public void ReleaseInteract(Character interactor) { } } public static class TableBuilder { private static readonly Color BodyColor = new Color(0.85f, 0.65f, 0.15f); private static readonly Color TrimColor = new Color(0.45f, 0.1f, 0.1f); private static readonly Color Glow = new Color(1f, 0.85f, 0.25f); private const float TableTop = 0.8f; private static TMP_FontAsset _font; private static bool _fontSearched; private static Material _highlightMaterial; public static BlackjackTable Build(int id, Vector3 position, Quaternion rotation, bool airport = false) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025e: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: 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_0621: 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_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0647: Unknown result type (might be due to invalid IL or missing references) //IL_065c: 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_067c: Unknown result type (might be due to invalid IL or missing references) //IL_068e: 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_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_07c5: Unknown result type (might be due to invalid IL or missing references) //IL_07ca: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_07e0: Unknown result type (might be due to invalid IL or missing references) //IL_07f1: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_080c: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0822: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_0831: Expected O, but got Unknown GameObject table = BundleAssets.Table; if ((Object)(object)table == (Object)null) { throw new Exception("Tisch-Prefab fehlt (Bundle nicht geladen)."); } GameObject val = Object.Instantiate<GameObject>(table, position, rotation); ((Object)val).name = $"PeakBlackjack_Table_{id}"; SetLayerRecursive(val.transform, LayerMask.NameToLayer("Default")); Material val2 = null; Material val3 = null; Material val4 = null; Material val5 = null; Material chipMaterial = null; List<Renderer> list = new List<Renderer>(); List<Renderer> list2 = new List<Renderer>(); Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val6 in componentsInChildren) { if (val6 is ParticleSystemRenderer) { continue; } Material[] sharedMaterials = val6.sharedMaterials; bool flag = false; for (int j = 0; j < sharedMaterials.Length; j++) { Material val7 = sharedMaterials[j]; if ((Object)(object)val7 == (Object)null) { continue; } switch (((Object)val7).name) { case "M_Body": if (val2 == null) { val2 = PeakStyle.Styled("Body", val7, BodyColor, 0.55f, 0.4f); } sharedMaterials[j] = val2; flag = true; break; case "M_Trim": if (val3 == null) { val3 = PeakStyle.Styled("Trim", val7, TrimColor, 0.6f, 0.5f); } sharedMaterials[j] = val3; flag = true; break; case "M_Lamp": val4 = val7; if (((Object)val6).name.StartsWith("Lamp_", StringComparison.Ordinal)) { list.Add(val6); } break; case "M_Marquee": if (val5 == null) { val5 = Emissive(val7, Glow, Glow); } sharedMaterials[j] = val5; flag = true; break; } } if (flag) { val6.sharedMaterials = sharedMaterials; } if (((Object)val6).name.StartsWith("Shoe", StringComparison.Ordinal)) { list2.Add(val6); } } GameObject chip = BundleAssets.Chip; if ((Object)(object)chip != (Object)null) { componentsInChildren = chip.GetComponentsInChildren<Renderer>(true); foreach (Renderer val8 in componentsInChildren) { if ((Object)(object)val8.sharedMaterial != (Object)null && ((Object)val8.sharedMaterial).name == "M_Chip") { chipMaterial = val8.sharedMaterial; break; } } } object proto = (((Object)(object)val4 != (Object)null) ? ((object)val4) : ((object)new Material(Shader.Find("Universal Render Pipeline/Lit")))); Material val9 = Emissive((Material)proto, Glow * 0.35f, Glow * 0.15f); Material lightOn = Emissive((Material)proto, Glow, Glow * 1.6f); Material lightBright = Emissive((Material)proto, Color.white, Glow * 4f); foreach (Renderer item in list) { item.sharedMaterial = val9; } Light componentInChildren = val.GetComponentInChildren<Light>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.color = Glow; } BlackjackTable blackjackTable = val.AddComponent<BlackjackTable>(); blackjackTable.Id = id; blackjackTable.IsAirport = airport; blackjackTable.ChipPrefab = chip; blackjackTable.CardPrefab = BundleAssets.Card; blackjackTable.ChipMaterial = chipMaterial; blackjackTable.Lights = list.ToArray(); blackjackTable.LightOff = val9; blackjackTable.LightOn = lightOn; blackjackTable.LightBright = lightBright; blackjackTable.MarqueeLight = componentInChildren; blackjackTable.DealerHand = Require(val, "DealerHand"); blackjackTable.ShoeAnchor = val.transform.Find("ShoeAnchor"); blackjackTable.FxCoins = FindFx(val, "FX_Coins"); blackjackTable.FxLose = FindFx(val, "FX_Lose"); blackjackTable.FxDeal = FindFx(val, "FX_Deal"); blackjackTable.FxConfetti = FindFx(val, "FX_Confetti"); blackjackTable.FxRays = FindFx(val, "FX_Rays"); blackjackTable.FxSparkle = FindFx(val, "FX_Sparkle"); for (int k = 0; k < 5; k++) { blackjackTable.BetSpots[k] = Require(val, $"BetSpot_{k}"); blackjackTable.HandSpots[k] = Require(val, $"HandSpot_{k}"); } Transform val10 = Require(val, "TitleAnchor"); Transform val11 = Require(val, "MessageAnchor"); blackjackTable.TitleText = Text(val, "TitleText", val10.localPosition, 70f, 20f, 40f, 120f, Glow); blackjackTable.MessageText = Text(val, "MessageText", val11.localPosition, 56f, 8f, 16f, 60f, new Color(1f, 0.85f, 0.4f)); BoxCollider obj = val.AddComponent<BoxCollider>(); obj.center = new Vector3(0f, 0.4f, 0f); obj.size = new Vector3(1.9f, 0.8f, 1.1f); for (int l = 0; l < 5; l++) { GameObject highlight; SeatSpot seatSpot = Spot(val, $"Seat_{l}_Bet", blackjackTable.BetSpots[l].localPosition, new Vector2(0.11f, 0.11f), out highlight).AddComponent<SeatSpot>(); seatSpot.Table = blackjackTable; seatSpot.Seat = l; seatSpot.Highlight = highlight; GameObject highlight2; HandSpot handSpot = Spot(val, $"Seat_{l}_Hand", blackjackTable.HandSpots[l].localPosition, new Vector2(0.15f, 0.13f), out highlight2).AddComponent<HandSpot>(); handSpot.Table = blackjackTable; handSpot.Seat = l; handSpot.Highlight = highlight2; } GameObject val12 = new GameObject("DealerSpot"); val12.transform.SetParent(val.transform, false); val12.transform.localPosition = new Vector3(blackjackTable.DealerHand.localPosition.x + 0.03f, 0.82f, blackjackTable.DealerHand.localPosition.z - 0.01f); val12.layer = val.layer; val12.AddComponent<BoxCollider>().size = new Vector3(0.26f, 0.04f, 0.16f); val12.AddComponent<DealerSpot>().Table = blackjackTable; GameObject val13 = new GameObject("ShoeInteract"); val13.transform.SetParent(val.transform, false); val13.transform.localPosition = new Vector3(-0.62f, 0.85f, -0.33f); val13.layer = val.layer; val13.AddComponent<BoxCollider>().size = new Vector3(0.15f, 0.12f, 0.27f); ShoeInteract shoeInteract = val13.AddComponent<ShoeInteract>(); shoeInteract.Table = blackjackTable; shoeInteract.HoverRenderers = list2.ToArray(); AudioSource val14 = val.AddComponent<AudioSource>(); val14.spatialBlend = 1f; val14.rolloffMode = (AudioRolloffMode)1; val14.minDistance = 2f; val14.maxDistance = 28f; val14.playOnAwake = false; val14.dopplerLevel = 0f; blackjackTable.Audio = val14; GameObject val15 = new GameObject("AmbientAudio"); val15.transform.SetParent(val.transform, false); val15.transform.localPosition = new Vector3(0f, 1.9f, -0.5f); AudioSource val16 = val15.AddComponent<AudioSource>(); val16.spatialBlend = 1f; val16.rolloffMode = (AudioRolloffMode)2; val16.minDistance = 1f; val16.maxDistance = 18f; val16.SetCustomCurve((AudioSourceCurveType)0, new AnimationCurve((Keyframe[])(object)new Keyframe[5] { new Keyframe(0f, 1f), new Keyframe(0.12f, 0.6f), new Keyframe(0.4f, 0.22f), new Keyframe(0.75f, 0.06f), new Keyframe(1f, 0f) })); val16.playOnAwake = false; val16.loop = true; val16.volume = 0f; val16.dopplerLevel = 0f; val16.spread = 20f; blackjackTable.AmbientAudio = val16; BlackjackAudio.Route(val14); BlackjackAudio.Route(val16); blackjackTable.Initialize(); return blackjackTable; } private static GameObject Spot(GameObject root, string name, Vector3 anchorLocal, Vector2 size, out GameObject highlight) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(root.transform, false); val.transform.localPosition = new Vector3(anchorLocal.x, 0.82f, anchorLocal.z); val.layer = root.layer; val.AddComponent<BoxCollider>().size = new Vector3(size.x, 0.04f, size.y); GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val2).name = name + "_Highlight"; Collider component = val2.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } val2.transform.SetParent(root.transform, false); val2.transform.localPosition = new Vector3(anchorLocal.x, 0.8085f, anchorLocal.z); val2.transform.localScale = new Vector3(size.x, 0.003f, size.y); val2.layer = root.layer; Renderer component2 = val2.GetComponent<Renderer>(); component2.sharedMaterial = HighlightMaterial(); component2.shadowCastingMode = (ShadowCastingMode)0; val2.SetActive(false); highlight = val2; return val; } private static Material HighlightMaterial() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00e3: Expected O, but got Unknown //IL_00e4: Expected O, but got Unknown if ((Object)(object)_highlightMaterial != (Object)null) { return _highlightMaterial; } Material val = new Material(Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Universal Render Pipeline/Lit")) { name = "PeakBlackjack_Highlight" }; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.9f, 0.3f, 0.45f); val.SetColor("_BaseColor", val2); val.SetColor("_Color", val2); val.SetFloat("_Surface", 1f); val.SetFloat("_Blend", 0f); val.SetFloat("_ZWrite", 0f); val.SetInt("_SrcBlend", 5); val.SetInt("_DstBlend", 10); val.SetOverrideTag("RenderType", "Transparent"); val.renderQueue = 3000; val.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); _highlightMaterial = val; return val; } private static Transform Require(GameObject root, string path) { Transform obj = root.transform.Find(path); if ((Object)(object)obj == (Object)null) { throw new Exception("'" + path + "' fehlt im Prefab"); } return obj; } private static ParticleSystem FindFx(GameObject root, string name) { Transform val = root.transform.Find(name); if (!((Object)(object)val != (Object)null)) { return null; } return ((Component)val).GetComponent<ParticleSystem>(); } private static Material Emissive(Material proto, Color color, Color emission) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) /