Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ValheimCasino v0.10.0
ValheimCasino.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("ValheimCasino")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f96c5a1f5d7cf3808d46d7db62aaddeb39046cc1")] [assembly: AssemblyProduct("ValheimCasino")] [assembly: AssemblyTitle("ValheimCasino")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ValheimCasino { public class BetPanel : MonoBehaviour { public sealed class Cell { public int Id; public string Label; public float X; public float Y; public float W = 1f; public float H = 1f; public Color Tint = Color.white; } public interface IHost { string Title { get; } bool CanTakeBack { get; } string Status(); int Chips(int id); void Add(int id); bool Available(int id); void ClearMine(); bool StillOpen(); } [CompilerGenerated] private static class <>O { public static UnityAction <0>__Close; } private const float Unit = 52f; private const float RowUnit = 44f; private const float Margin = 22f; private const float TitleH = 46f; private const float StatusH = 30f; private const float FooterH = 56f; private static BetPanel open; private IHost host; private readonly List<Cell> cells = new List<Cell>(); private readonly List<GameObject> buttons = new List<GameObject>(); private Text status; private float nextRefresh; private bool closeNextFrame; public static bool IsOpen => (Object)(object)open != (Object)null; public static void Open(IHost host, IList<Cell> layout, float gridW, float gridH) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Expected O, but got Unknown Close(); if (GUIManager.Instance == null || (Object)(object)GUIManager.CustomGUIFront == (Object)null) { return; } float num = gridW * 52f + 44f; float num2 = 76f + gridH * 44f + 56f + 44f; GameObject val = GUIManager.Instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0f, -40f), num, num2, false); ((Object)val).name = "CasinoBetPanel"; BetPanel me = val.AddComponent<BetPanel>(); me.host = host; open = me; me.Label(host.Title, new Vector2(0f, -45f), num - 44f, 46f, 30, GUIManager.Instance.ValheimOrange); me.status = me.Label("", new Vector2(0f, -83f), num - 44f, 30f, 18, new Color(0.92f, 0.88f, 0.78f)); float num3 = 98f; Vector2 val2 = default(Vector2); foreach (Cell item in layout) { ((Vector2)(ref val2))..ctor(22f + (item.X + item.W / 2f) * 52f, 0f - (num3 + (item.Y + item.H / 2f) * 44f)); GameObject val3 = GUIManager.Instance.CreateButton(item.Label, val.transform, new Vector2(0f, 1f), new Vector2(0f, 1f), val2, item.W * 52f - 4f, item.H * 44f - 4f); Image component = val3.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = item.Tint; } int id = item.Id; ((UnityEvent)val3.GetComponent<Button>().onClick).AddListener((UnityAction)delegate { me.host.Add(id); }); me.cells.Add(item); me.buttons.Add(val3); } float num4 = 0f - (num2 - 22f - 28f); if (host.CanTakeBack) { ((UnityEvent)GUIManager.Instance.CreateButton("Take my bets back", val.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(-110f, num4), 200f, 40f).GetComponent<Button>().onClick).AddListener((UnityAction)delegate { me.host.ClearMine(); }); } ButtonClickedEvent onClick = GUIManager.Instance.CreateButton("Close", val.transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(host.CanTakeBack ? 110f : 0f, num4), 200f, 40f).GetComponent<Button>().onClick; object obj = <>O.<0>__Close; if (obj == null) { UnityAction val4 = Close; <>O.<0>__Close = val4; obj = (object)val4; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GUIManager.BlockInput(true); me.Refresh(); } public static void Close() { if (!((Object)(object)open == (Object)null)) { GameObject gameObject = ((Component)open).gameObject; open = null; GUIManager.BlockInput(false); Object.Destroy((Object)(object)gameObject); } } private Text Label(string text, Vector2 pos, float width, float height, int size, Color colour) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_003a: Unknown result type (might be due to invalid IL or missing references) Text component = GUIManager.Instance.CreateText(text, ((Component)this).transform, new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), pos, GUIManager.Instance.AveriaSerifBold, size, colour, true, Color.black, width, height, false).GetComponent<Text>(); if ((Object)(object)component != (Object)null) { component.alignment = (TextAnchor)4; } return component; } private void Update() { if (host == null || !host.StillOpen() || Menu.IsVisible() || closeNextFrame) { Close(); } else if (ZInput.GetKeyDown((KeyCode)27, false) || ZInput.GetButtonDown("JoyMenu") || ZInput.GetButtonDown("JoyButtonB")) { closeNextFrame = true; } else if (!(Time.time < nextRefresh)) { nextRefresh = Time.time + 0.15f; Refresh(); } } private void Refresh() { if ((Object)(object)status != (Object)null) { status.text = host.Status(); } for (int i = 0; i < cells.Count; i++) { int num = host.Chips(cells[i].Id); SetText(buttons[i], (num > 0) ? (cells[i].Label + " <color=#FFD54A>x" + num + "</color>") : cells[i].Label); Button component = buttons[i].GetComponent<Button>(); if ((Object)(object)component != (Object)null) { ((Selectable)component).interactable = host.Available(cells[i].Id); } } } private static void SetText(GameObject button, string text) { TMP_Text componentInChildren = button.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.richText = true; componentInChildren.text = text; return; } Text componentInChildren2 = button.GetComponentInChildren<Text>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.supportRichText = true; componentInChildren2.text = text; } } private void OnDestroy() { if ((Object)(object)open == (Object)(object)this) { open = null; GUIManager.BlockInput(false); } } } public struct BetPile { public int Slot; public int Coins; public char State; public bool Silver; } public struct SeatInfo { public long Peer; public int Slot; public string Flags; } public static class BetPiles { public const char Acting = 'P'; public const char Waiting = 'S'; public const char Won = 'W'; public const char Push = 'T'; public const char Lost = 'L'; public const int StakeCoins = 6; private const int MaxPerStack = 12; private const int MaxStacks = 7; public static string Encode(IEnumerable<BetPile> piles) { StringBuilder stringBuilder = new StringBuilder(); foreach (BetPile pile in piles) { if (pile.Slot >= 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(';'); } int slot = pile.Slot; stringBuilder.Append(slot.ToString(CultureInfo.InvariantCulture)).Append(':').Append(Math.Max(0, pile.Coins).ToString(CultureInfo.InvariantCulture)) .Append(':') .Append(pile.State) .Append(':') .Append(pile.Silver ? 's' : 'g'); } } return stringBuilder.ToString(); } public static List<BetPile> Decode(string state) { List<BetPile> list = new List<BetPile>(); if (string.IsNullOrEmpty(state)) { return list; } string[] array = state.Split(new char[1] { ';' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { ':' }); if (array2.Length >= 3 && array2[2].Length == 1 && int.TryParse(array2[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && result >= 0 && int.TryParse(array2[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2) && result2 >= 0) { list.Add(new BetPile { Slot = result, Coins = result2, State = array2[2][0], Silver = (array2.Length > 3 && array2[3] == "s") }); } } return list; } public static string EncodeSeats(IEnumerable<SeatInfo> seats) { StringBuilder stringBuilder = new StringBuilder(); foreach (SeatInfo seat in seats) { if (stringBuilder.Length > 0) { stringBuilder.Append(';'); } long peer = seat.Peer; StringBuilder stringBuilder2 = stringBuilder.Append(peer.ToString(CultureInfo.InvariantCulture)).Append(':'); int slot = seat.Slot; stringBuilder2.Append(slot.ToString(CultureInfo.InvariantCulture)).Append(':').Append(seat.Flags ?? ""); } return stringBuilder.ToString(); } public static bool FindSeat(string state, long peer, out SeatInfo seat) { seat = new SeatInfo { Peer = peer, Slot = -1, Flags = "" }; if (string.IsNullOrEmpty(state)) { return false; } string[] array = state.Split(new char[1] { ';' }); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { ':' }); if (array2.Length >= 2 && long.TryParse(array2[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) && result == peer && int.TryParse(array2[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2)) { seat.Slot = result2; seat.Flags = ((array2.Length > 2) ? array2[2] : ""); return true; } } return false; } public static int CoinsFor(double multiple) { if (double.IsNaN(multiple) || multiple <= 0.0) { return 0; } return Math.Max(1, Math.Min(84, (int)Math.Round(6.0 * multiple))); } public static int[] Stacks(int coins) { coins = Math.Max(0, Math.Min(84, coins)); List<int> list = new List<int>(); while (coins > 0) { int num = Math.Min(12, coins); list.Add(num); coins -= num; } return list.ToArray(); } public static void RingSpot(float seatAngle, float radius, out float x, out float z) { double num = (double)seatAngle * Math.PI / 180.0; x = (float)Math.Sin(num) * radius; z = (float)Math.Cos(num) * radius; } public static void RideBusSpot(float seatAngle, float shipHalfWidth, float shipHalfLength, out float x, out float z) { double num = (double)seatAngle * Math.PI / 180.0; z = (float)(1.6 * Math.Cos(num)); double num2 = (double)(shipHalfWidth * shipHalfWidth + shipHalfLength * shipHalfLength) / (2.0 * (double)shipHalfWidth); double num3 = Math.Sqrt(Math.Max(0.0, num2 * num2 - (double)(z * z))) - (num2 - (double)shipHalfWidth); x = (float)((num3 - 0.29) * (double)((Math.Sin(num) > 0.0) ? 1 : (-1))); } } public enum BjStatus { Playing, Stood, Bust, Blackjack } public enum BjActionResult { NotSeated, Ignored, Acted, NotAllowed } public class BjHand { public readonly List<int> Cards = new List<int>(); public BjStatus Status; public int Bet; public bool Doubled; public bool FromSplit; public int Payout; public string Result; } public class BjSeat { public long Peer; public string Name; public int Bet; public readonly List<BjHand> Hands = new List<BjHand> { new BjHand() }; public int Payout; public string Result; public List<int> Cards => Hands[0].Cards; public int Staked => Hands.Sum((BjHand h) => h.Bet); public BjHand Active => Hands.FirstOrDefault((BjHand h) => h.Status == BjStatus.Playing); public BjStatus Status { get { if (Hands.Count == 1) { return Hands[0].Status; } if (Hands.Any((BjHand h) => h.Status == BjStatus.Playing)) { return BjStatus.Playing; } if (!Hands.All((BjHand h) => h.Status == BjStatus.Bust)) { return BjStatus.Stood; } return BjStatus.Bust; } } } public class BjPayment { public BjSeat Seat; public int Payout; public string Note; } public class BjResult { public int DealerTotal; public string DealerText; public List<BjPayment> Payments = new List<BjPayment>(); } public class BlackjackEngine { private static readonly string[] Ranks = new string[13] { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" }; private static readonly string[] Suits = new string[4] { "s", "h", "d", "c" }; public readonly List<BjSeat> Seats = new List<BjSeat>(); public readonly List<int> Dealer = new List<int>(); private readonly List<int> deck; private readonly Random rng; public bool AnyPlaying => Seats.Any((BjSeat s) => s.Status == BjStatus.Playing); public BlackjackEngine(List<int> deck, Random rng = null) { this.deck = deck; this.rng = rng ?? new Random(); } public static List<int> ShuffledDeck(Random rng) { List<int> list = Enumerable.Range(0, 52).ToList(); for (int num = 51; num > 0; num--) { int index = rng.Next(num + 1); int value = list[num]; list[num] = list[index]; list[index] = value; } return list; } public BjSeat AddSeat(long peer, string name, int bet) { BjSeat bjSeat = new BjSeat { Peer = peer, Name = name, Bet = bet }; bjSeat.Hands[0].Bet = bet; Seats.Add(bjSeat); return bjSeat; } public BjSeat SeatFor(long peer) { return Seats.FirstOrDefault((BjSeat s) => s.Peer == peer); } public bool Deal() { for (int i = 0; i < 2; i++) { foreach (BjSeat seat in Seats) { seat.Cards.Add(Draw()); } Dealer.Add(Draw()); } foreach (BjSeat seat2 in Seats) { if (Total(seat2.Cards) == 21) { seat2.Hands[0].Status = BjStatus.Blackjack; } } if (Total(Dealer) != 21) { return !AnyPlaying; } return true; } public BjActionResult Act(long peer, bool hit) { BjSeat bjSeat = SeatFor(peer); if (bjSeat == null) { return BjActionResult.NotSeated; } BjHand active = bjSeat.Active; if (active == null) { return BjActionResult.Ignored; } if (hit) { active.Cards.Add(Draw()); int num = Total(active.Cards); if (num > 21) { active.Status = BjStatus.Bust; } else if (num == 21) { active.Status = BjStatus.Stood; } } else { active.Status = BjStatus.Stood; } return BjActionResult.Acted; } public bool CanDouble(BjSeat seat) { BjHand bjHand = seat?.Active; if (bjHand != null && bjHand.Cards.Count == 2) { return !bjHand.Doubled; } return false; } public bool CanSplit(BjSeat seat) { if (seat == null || seat.Hands.Count != 1) { return false; } BjHand bjHand = seat.Hands[0]; if (bjHand.Status == BjStatus.Playing && bjHand.Cards.Count == 2) { return bjHand.Cards[0] % 13 == bjHand.Cards[1] % 13; } return false; } public BjActionResult Double(long peer) { BjSeat bjSeat = SeatFor(peer); if (bjSeat == null) { return BjActionResult.NotSeated; } if (bjSeat.Active == null) { return BjActionResult.Ignored; } if (!CanDouble(bjSeat)) { return BjActionResult.NotAllowed; } BjHand active = bjSeat.Active; active.Bet += bjSeat.Bet; active.Doubled = true; active.Cards.Add(Draw()); active.Status = ((Total(active.Cards) <= 21) ? BjStatus.Stood : BjStatus.Bust); return BjActionResult.Acted; } public BjActionResult Split(long peer) { BjSeat bjSeat = SeatFor(peer); if (bjSeat == null) { return BjActionResult.NotSeated; } if (bjSeat.Active == null) { return BjActionResult.Ignored; } if (!CanSplit(bjSeat)) { return BjActionResult.NotAllowed; } BjHand bjHand = bjSeat.Hands[0]; BjHand bjHand2 = new BjHand { Bet = bjSeat.Bet, FromSplit = true }; bool flag = bjHand.Cards[0] % 13 == 0; bjHand2.Cards.Add(bjHand.Cards[1]); bjHand.Cards.RemoveAt(1); bjHand.FromSplit = true; bjSeat.Hands.Add(bjHand2); foreach (BjHand hand in bjSeat.Hands) { hand.Cards.Add(Draw()); if (flag || Total(hand.Cards) == 21) { hand.Status = BjStatus.Stood; } } return BjActionResult.Acted; } public void StandAll() { foreach (BjSeat seat in Seats) { foreach (BjHand item in seat.Hands.Where((BjHand h) => h.Status == BjStatus.Playing)) { item.Status = BjStatus.Stood; } } } public BjResult Settle(float blackjackPayout) { bool num = Seats.Any((BjSeat s) => s.Hands.Any((BjHand h) => h.Status != BjStatus.Bust)); bool flag = Dealer.Count == 2 && Total(Dealer) == 21; if (num && !flag) { while (Total(Dealer) < 17) { Dealer.Add(Draw()); } } int num2 = Total(Dealer); BjResult bjResult = new BjResult { DealerTotal = num2, DealerText = "Dealer finishes on " + num2 + ((num2 > 21) ? " (bust)." : ".") }; foreach (BjSeat seat in Seats) { foreach (BjHand hand in seat.Hands) { int num3 = Total(hand.Cards); if (hand.Status == BjStatus.Bust) { hand.Payout = 0; } else if (hand.Status == BjStatus.Blackjack) { hand.Payout = (flag ? hand.Bet : ((int)Math.Round((float)hand.Bet * blackjackPayout))); } else if (flag) { hand.Payout = 0; } else if (num2 > 21 || num3 > num2) { hand.Payout = hand.Bet * 2; } else if (num3 == num2) { hand.Payout = hand.Bet; } else { hand.Payout = 0; } hand.Result = Outcome(hand.Payout, hand.Bet); } seat.Payout = seat.Hands.Sum((BjHand h) => h.Payout); seat.Result = Outcome(seat.Payout, seat.Staked); string note = ((seat.Hands.Count == 1) ? ("Dealer " + num2 + ", you " + Total(seat.Cards) + ": " + seat.Result) : ("Dealer " + num2 + ". " + string.Join(", ", seat.Hands.Select((BjHand h, int i) => "hand " + (i + 1) + " " + Total(h.Cards) + " " + h.Result).ToArray()) + ". Overall: " + seat.Result)); bjResult.Payments.Add(new BjPayment { Seat = seat, Payout = seat.Payout, Note = note }); } return bjResult; } private static string Outcome(int payout, int staked) { if (payout <= staked) { if (payout != staked) { return "LOSE -" + (staked - payout); } return "PUSH"; } return "WIN +" + (payout - staked); } public static string Describe(BjSeat s) { return string.Join(" | ", s.Hands.Select(Describe).ToArray()); } public static string Describe(BjHand h) { string text = ((h.Status == BjStatus.Bust) ? " BUST" : ((h.Status == BjStatus.Blackjack) ? " BLACKJACK" : ((h.Status != BjStatus.Stood) ? "" : (h.Doubled ? " (doubled)" : " (stand)")))); return CardsText(h.Cards) + " = " + Total(h.Cards) + text; } public static string CardName(int card) { return Ranks[card % 13] + Suits[card / 13]; } public static string CardsText(List<int> cards) { return string.Join(" ", cards.Select(CardName).ToArray()); } public static int Total(List<int> cards) { int num = 0; int num2 = 0; foreach (int card in cards) { int num3 = card % 13; if (num3 == 0) { num2++; num += 11; } else { num += ((num3 >= 9) ? 10 : (num3 + 1)); } } while (num > 21 && num2 > 0) { num -= 10; num2--; } return num; } private int Draw() { if (deck.Count == 0) { deck.AddRange(ShuffledDeck(rng)); } int result = deck[deck.Count - 1]; deck.RemoveAt(deck.Count - 1); return result; } } public class BlackjackTable : CasinoTableBase { private enum Phase { Idle, Lobby, Playing } private const string KeyPhase = "bj_phase"; private const string KeyView = "bj_view"; internal const string KeyCards = "bj_cards"; internal const string KeyPiles = "bj_piles"; internal static readonly float[] Seats = new float[5] { 100f, 140f, 180f, 220f, 260f }; private readonly Random rng = new Random(); private BlackjackEngine game; private Phase phase; private readonly Dictionary<long, int> slots = new Dictionary<long, int>(); private const int ExtraDouble = 1; private const int ExtraSplit = 2; protected override string TableName => "Blackjack Table"; protected override int ConfiguredBet => CasinoPlugin.BlackjackBet.Value; protected override float[] SeatAngles => Seats; protected override float SeatRadius => CasinoPlugin.ChairRadius.Value + 0.2f; protected override bool Busy => phase != Phase.Idle; protected override int BankCoverNeeded { get { int num = nview.GetZDO().GetInt("casino_bet", 100); return Math.Max(num * 2, (int)Math.Round((float)num * CasinoPlugin.BlackjackPayout.Value)) - num; } } protected override void RegisterGameRpcs() { nview.Register<int, string, int>("BJ_Join", (Action<long, int, string, int>)RPC_Join); nview.Register<bool>("BJ_Action", (Action<long, bool>)RPC_Action); nview.Register<int, int>("BJ_Extra", (Action<long, int, int>)RPC_Extra); } protected override string GameHoverText(ZDO zdo) { int num = zdo.GetInt("casino_bet", 100); Phase phase = (Phase)zdo.GetInt("bj_phase", 0); string text = zdo.GetString("bj_view", ""); int value = CasinoTableBase.SecondsLeft(zdo); StringBuilder stringBuilder = new StringBuilder("Blackjack - " + num + " coins a hand"); if (text.Length > 0) { stringBuilder.Append('\n').Append(text); } switch (phase) { case Phase.Playing: stringBuilder.Append('\n').Append("[<color=yellow><b>$KEY_Use</b></color>]").Append(" Hit ") .Append("[<color=yellow><b>$KEY_AltPlace</b></color> + <color=yellow><b>$KEY_Use</b></color>]") .Append(" Stand (") .Append(value) .Append("s)"); stringBuilder.Append(ExtrasHoverLine(num)); break; case Phase.Lobby: stringBuilder.Append('\n').Append("[<color=yellow><b>$KEY_Use</b></color>]").Append(" Sit in (dealing in ") .Append(value) .Append("s)"); break; default: stringBuilder.Append('\n').Append("[<color=yellow><b>$KEY_Use</b></color>]").Append(" Sit in for ") .Append(num) .Append(" coins"); break; } return stringBuilder.ToString(); } private string ExtrasHoverLine(int bet) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) if (!LocalSeat(out var seat) || string.IsNullOrEmpty(seat.Flags)) { return ""; } bool flag = seat.Flags.IndexOf('D') >= 0; bool flag2 = seat.Flags.IndexOf('S') >= 0; if (!flag && !flag2) { return ""; } string text = "\n"; KeyboardShortcut value; if (flag) { string text2 = text; value = CasinoPlugin.DoubleKey.Value; text = text2 + "[<color=yellow><b>" + ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString() + "</b></color>] Double down "; } if (flag2) { string text3 = text; value = CasinoPlugin.SplitKey.Value; text = text3 + "[<color=yellow><b>" + ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString() + "</b></color>] Split "; } text = text + "(" + bet + " more coins)"; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || TextInput.IsVisible() || Console.IsVisible() || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus())) { return text; } int num; if (flag) { value = CasinoPlugin.DoubleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { num = 1; goto IL_014c; } } if (flag2) { value = CasinoPlugin.SplitKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { num = 2; goto IL_014c; } } num = 0; goto IL_014c; IL_014c: int num2 = num; if (num2 != 0 && TakeStake(localPlayer, out var bet2)) { nview.InvokeRPC("BJ_Extra", new object[2] { num2, bet2 }); } return text; } protected override void OnPlayerInteract(Player player, bool alt) { int bet; if (nview.GetZDO().GetInt("bj_phase", 0) == 2) { nview.InvokeRPC("BJ_Action", new object[1] { !alt }); } else if (TakeStake(player, out bet)) { nview.InvokeRPC("BJ_Join", new object[3] { bet, player.GetPlayerName(), NearestSeat(player) }); } } private void Update() { if ((Object)(object)nview == (Object)null || !nview.IsValid() || !nview.IsOwner()) { return; } ZDO zDO = nview.GetZDO(); if (phase == Phase.Idle) { if (zDO.GetInt("bj_phase", 0) != 0) { zDO.Set("bj_phase", 0); zDO.Set("bj_view", "The previous hand was abandoned."); zDO.Set("bj_cards", ""); zDO.Set("bj_piles", ""); zDO.Set("casino_who", ""); } HouseRelease(); } else if (TimerExpired()) { if (phase == Phase.Lobby) { StartHand(); return; } game.StandAll(); Settle(); } } protected override void OnCountdown(int secondsLeft) { if (game == null || secondsLeft < 1 || secondsLeft > 3) { return; } foreach (BjSeat seat in game.Seats) { if (phase == Phase.Lobby) { Tell(seat.Peer, "Dealing in " + secondsLeft + "..."); } else if (phase == Phase.Playing && seat.Status == BjStatus.Playing) { Tell(seat.Peer, "Hit or stand! " + secondsLeft + "..."); } } } private void RPC_Join(long sender, int bet, string playerName, int chair) { if (!nview.IsOwner()) { return; } if (bet != nview.GetZDO().GetInt("casino_bet", 100)) { Refund(sender, bet, "Wrong bet size, stake returned."); return; } if (phase == Phase.Playing) { Refund(sender, bet, "A hand is in progress, stake returned. Join the next one."); return; } if (phase == Phase.Idle) { game = new BlackjackEngine(BlackjackEngine.ShuffledDeck(rng), rng); slots.Clear(); } if (game.Seats.Any((BjSeat s) => s.Peer == sender)) { Refund(sender, bet, "You're already in this hand, stake returned."); } else if (game.Seats.Count >= CasinoPlugin.MaxPlayers.Value) { Refund(sender, bet, "Table is full, stake returned."); } else if (HouseTake(sender, bet, Math.Max(bet * 2, (int)Math.Round((float)bet * CasinoPlugin.BlackjackPayout.Value)))) { if (phase == Phase.Idle) { phase = Phase.Lobby; StartTimer(CasinoPlugin.LobbySeconds.Value); } game.AddSeat(sender, playerName, bet); slots[sender] = CardTables.AssignSlot(slots.Values, chair, Seats.Length); Publish(revealDealer: false); Announce(playerName + " sits in for " + bet + " coins."); Sound(CasinoSound.Bet); } } private void StartHand() { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) phase = Phase.Playing; bool flag = game.Deal(); StartTimer(CasinoPlugin.TurnSeconds.Value); foreach (BjSeat seat in game.Seats) { object obj; KeyboardShortcut value; if (!game.CanSplit(seat)) { if (!game.CanDouble(seat)) { obj = ""; } else { value = CasinoPlugin.DoubleKey.Value; obj = " (" + ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString() + " doubles)"; } } else { string[] obj2 = new string[5] { " (", null, null, null, null }; value = CasinoPlugin.DoubleKey.Value; obj2[1] = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString(); obj2[2] = " doubles, "; value = CasinoPlugin.SplitKey.Value; obj2[3] = ((object)((KeyboardShortcut)(ref value)).MainKey/*cast due to .constrained prefix*/).ToString(); obj2[4] = " splits)"; obj = string.Concat(obj2); } string text = (string)obj; Tell(seat.Peer, "Your hand: " + BlackjackEngine.Describe(seat) + text); } Announce("Cards are out! Dealer shows " + BlackjackEngine.CardName(game.Dealer[0]) + "."); Sound(CasinoSound.Card); if (flag) { Settle(); } else { Publish(revealDealer: false); } } private void RPC_Action(long sender, bool hit) { if (!nview.IsOwner() || phase != Phase.Playing) { return; } switch (game.Act(sender, hit)) { case BjActionResult.NotSeated: Tell(sender, "You're not in this hand."); return; case BjActionResult.Ignored: return; } Tell(sender, "Your hand: " + BlackjackEngine.Describe(game.SeatFor(sender))); if (hit) { Sound(CasinoSound.Card); } if (game.AnyPlaying) { Publish(revealDealer: false); } else { Settle(); } } private void RPC_Extra(long sender, int kind, int bet) { if (!nview.IsOwner()) { return; } string text = ((kind == 1) ? "double down" : "split"); if (phase != Phase.Playing || game == null) { Refund(sender, bet, "There's no hand to " + text + " on, stake returned."); return; } BjSeat bjSeat = game.SeatFor(sender); if (bjSeat == null) { Refund(sender, bet, "You're not in this hand, stake returned."); } else if (bet != bjSeat.Bet) { Refund(sender, bet, "Wrong bet size, stake returned."); } else if (kind != 1 && kind != 2) { Refund(sender, bet, "Stake returned."); } else if ((kind == 1) ? (!game.CanDouble(bjSeat)) : (!game.CanSplit(bjSeat))) { Refund(sender, bet, "You can't " + text + " now, stake returned."); } else if (HouseTake(sender, bet, bet * 2)) { if (kind == 1) { game.Double(sender); } else { game.Split(sender); StartTimer(CasinoPlugin.TurnSeconds.Value); } Tell(sender, "Your hand: " + BlackjackEngine.Describe(bjSeat)); Announce(bjSeat.Name + ((kind == 1) ? " doubles down." : " splits.")); Sound(CasinoSound.Bet); Sound(CasinoSound.Card); if (game.AnyPlaying) { Publish(revealDealer: false); } else { Settle(); } } } private void Settle() { StopTimer(); BjResult bjResult = game.Settle(CasinoPlugin.BlackjackPayout.Value); phase = Phase.Idle; Publish(revealDealer: true); foreach (BjPayment payment in bjResult.Payments) { try { PayOutcome(payment.Seat.Peer, payment.Payout, payment.Seat.Staked, payment.Note, payment.Seat.Status == BjStatus.Blackjack); } catch (Exception ex) { CasinoPlugin.Log.LogError((object)("Blackjack payout failed: " + ex)); } } HouseRelease(); try { Announce(bjResult.DealerText); } catch (Exception ex2) { CasinoPlugin.Log.LogError((object)("Blackjack announce failed: " + ex2)); } } private void Publish(bool revealDealer) { ZDO zDO = nview.GetZDO(); zDO.Set("bj_phase", (int)phase); zDO.Set("bj_view", BuildView(revealDealer)); zDO.Set("bj_cards", BuildCards(revealDealer)); zDO.Set("bj_piles", BuildPiles()); zDO.Set("casino_who", BuildWho()); } private string BuildWho() { if (game == null) { return ""; } return BetPiles.EncodeSeats(game.Seats.Select(delegate(BjSeat s) { if (!slots.TryGetValue(s.Peer, out var value)) { value = -1; } string flags = ((phase != Phase.Playing) ? "" : ((game.CanDouble(s) ? "D" : "") + (game.CanSplit(s) ? "S" : ""))); return new SeatInfo { Peer = s.Peer, Slot = value, Flags = flags }; })); } private string BuildPiles() { if (game == null) { return ""; } List<BetPile> list = new List<BetPile>(); foreach (BjSeat seat in game.Seats) { if (!slots.TryGetValue(seat.Peer, out var value) || value < 0) { continue; } BetPile item = new BetPile { Slot = value, Coins = BetPiles.CoinsFor((double)seat.Staked / (double)Math.Max(1, seat.Bet)) }; if (seat.Result != null) { item.State = ((seat.Payout <= 0) ? 'L' : ((seat.Payout > seat.Staked) ? 'W' : 'T')); if (seat.Payout > 0) { item.Coins = BetPiles.CoinsFor((double)seat.Payout / (double)Math.Max(1, seat.Bet)); } } else if (seat.Status == BjStatus.Bust) { item.State = 'L'; } else { item.State = ((phase == Phase.Playing && seat.Status == BjStatus.Playing) ? 'P' : 'S'); } list.Add(item); } return BetPiles.Encode(list); } private string BuildCards(bool revealDealer) { if (game == null) { return ""; } List<int> list = new List<int>(); for (int i = 0; i < game.Dealer.Count; i++) { list.Add((revealDealer || i == 0) ? game.Dealer[i] : (-1)); } List<KeyValuePair<int, IList<IList<int>>>> list2 = new List<KeyValuePair<int, IList<IList<int>>>>(); foreach (BjSeat seat in game.Seats) { if (slots.TryGetValue(seat.Peer, out var value) && value >= 0) { list2.Add(new KeyValuePair<int, IList<IList<int>>>(value, ((IEnumerable<BjHand>)seat.Hands).Select((Func<BjHand, IList<int>>)((BjHand h) => h.Cards)).ToList())); } } return CardTables.EncodeBlackjack(list, list2); } private string BuildView(bool revealDealer) { if (game == null) { return ""; } StringBuilder stringBuilder = new StringBuilder(); if (game.Dealer.Count > 0) { stringBuilder.Append("Dealer: "); if (revealDealer) { stringBuilder.Append(BlackjackEngine.CardsText(game.Dealer)).Append(" = ").Append(BlackjackEngine.Total(game.Dealer)); } else { stringBuilder.Append(BlackjackEngine.CardName(game.Dealer[0])).Append(" ??"); } stringBuilder.Append('\n'); } foreach (BjSeat seat in game.Seats) { stringBuilder.Append(seat.Name).Append(" (").Append(seat.Bet) .Append(")"); if (seat.Cards.Count > 0) { stringBuilder.Append(": ").Append(BlackjackEngine.Describe(seat)); } if (seat.Result != null) { stringBuilder.Append(" - ").Append(seat.Result); } stringBuilder.Append('\n'); } return stringBuilder.ToString().TrimEnd(new char[1] { '\n' }); } } public static class BlackjackTableModel { public const string RootName = "BlackjackVisual"; internal const float TopY = 0.8f; internal static readonly Vector3 DeckPosition = new Vector3(0.57f, 0.845f, 0.32f); public static void Build(GameObject prefab) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_07f2: Unknown result type (might be due to invalid IL or missing references) //IL_0806: Unknown result type (might be due to invalid IL or missing references) //IL_080b: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08dd: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_05fe: 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_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0682: Unknown result type (might be due to invalid IL or missing references) //IL_0696: Unknown result type (might be due to invalid IL or missing references) //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06b7: Unknown result type (might be due to invalid IL or missing references) //IL_06cb: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_0701: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Unknown result type (might be due to invalid IL or missing references) //IL_0737: Unknown result type (might be due to invalid IL or missing references) //IL_073c: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_07a2: Unknown result type (might be due to invalid IL or missing references) TableModelKit.Strip(prefab); Transform val = TableModelKit.Root(prefab, "BlackjackVisual"); Texture2D texture = TableModelKit.WoodTexture(); Material mat = TableModelKit.Make(new Color(0.62f, 0.45f, 0.3f), texture, 0.15f, 0f); Material mat2 = TableModelKit.Make(new Color(0.36f, 0.24f, 0.16f), texture, 0.12f, 0f); Material mat3 = TableModelKit.Make(new Color(0.95f, 0.72f, 0.26f), null, 0.55f, 0.5f); Material mat4 = TableModelKit.Make(new Color(0.78f, 0.78f, 0.82f), null, 0.5f, 0.6f); Material val2 = TableModelKit.Make(new Color(0.62f, 0.12f, 0.1f), texture, 0.2f, 0f); Material val3 = TableModelKit.Make(new Color(0.14f, 0.28f, 0.5f), texture, 0.2f, 0f); Material mat5 = TableModelKit.Make(new Color(0.34f, 0.13f, 0.1f), TableModelKit.LeatherTexture(), 0.35f, 0f); Material mat6 = TableModelKit.Make(Color.white, TableModelKit.Png(TableArt.BlackjackFelt()), 0.05f, 0f); Material mat7 = TableModelKit.Make(new Color(0.42f, 0.28f, 0.12f), null, 0.5f, 0.6f); Material mat8 = TableModelKit.Glowing(new Color(1f, 0.85f, 0.45f), new Color(2.2f, 1.4f, 0.5f)); float num = 1.2f; float num2 = 0.45f; float rc = 0.14f; List<Vector2> list = TableModelKit.DOutline(num, num2, rc); TableModelKit.MeshPart(val, "Felt", TableModelKit.Cap(list, 0.8f, up: true, new Vector2(0f - num, 0f - num), new Vector2(num, num2)), mat6); List<Vector2> outline = TableModelKit.Offset(list, 0.1f); TableModelKit.MeshPart(val, "Apron", TableModelKit.Band(outline, 0.66f, 0.78f, 1.5f), mat2); TableModelKit.MeshPart(val, "Underside", TableModelKit.Cap(outline, 0.66f, up: false, new Vector2(0f - num - 1f, 0f - num - 1f), new Vector2(num + 1f, num2 + 1f)), mat2); List<Vector2> outline2 = TableModelKit.Offset(list, 0.102f); TableModelKit.MeshPart(val, "ApronTrimTop", TableModelKit.Tube(outline2, 0.775f, 0.01f, 6, 1f), mat3); TableModelKit.MeshPart(val, "ApronTrimBottom", TableModelKit.Tube(outline2, 0.665f, 0.01f, 6, 1f), mat3); List<Vector2> outline3 = TableModelKit.Offset(list, 0.07f); TableModelKit.MeshPart(val, "Rail", TableModelKit.Tube(outline3, 0.83f, 0.07f, 12, 2.2f), mat5); TableModelKit.MeshPart(val, "RailInlay", TableModelKit.Tube(outline3, 0.89599997f, 0.008f, 6, 1f), mat3); float[,] array = new float[4, 2] { { -0.8f, -0.45f }, { 0.8f, -0.45f }, { -1.02f, 0.26f }, { 1.02f, 0.26f } }; for (int i = 0; i < 4; i++) { float num3 = array[i, 0]; float num4 = array[i, 1]; TableModelKit.Part(val, "LegFoot", (PrimitiveType)3, new Vector3(num3, 0.03f, num4), new Vector3(0.24f, 0.06f, 0.24f), Vector3.zero, mat); TableModelKit.Part(val, "Leg", (PrimitiveType)3, new Vector3(num3, 0.34f, num4), new Vector3(0.14f, 0.56f, 0.14f), Vector3.zero, mat2); TableModelKit.Part(val, "LegBand", (PrimitiveType)3, new Vector3(num3, 0.52f, num4), new Vector3(0.17f, 0.03f, 0.17f), Vector3.zero, mat3); TableModelKit.Part(val, "LegCap", (PrimitiveType)3, new Vector3(num3, 0.64f, num4), new Vector3(0.2f, 0.05f, 0.2f), Vector3.zero, mat); } float[] array2 = new float[5] { 100f, 140f, 180f, 220f, 260f }; Vector3 val4 = default(Vector3); for (int j = 0; j < array2.Length; j++) { float num5 = array2[j] * ((float)Math.PI / 180f); ((Vector3)(ref val4))..ctor(Mathf.Sin(num5), 0f, Mathf.Cos(num5)); Quaternion rot = Quaternion.FromToRotation(Vector3.up, val4); float num6 = num + 0.1f; TableModelKit.Part(val, "Shield", (PrimitiveType)2, val4 * (num6 + 0.003f) + Vector3.up * 0.72f, new Vector3(0.1f, 0.006f, 0.1f), rot, ((j & 1) == 0) ? val2 : val3); TableModelKit.Part(val, "ShieldBoss", (PrimitiveType)0, val4 * (num6 + 0.008f) + Vector3.up * 0.72f, Vector3.one * 0.03f, Quaternion.identity, mat3); } float[] array3 = new float[2] { -1f, 1f }; foreach (float num7 in array3) { TableModelKit.Part(val, "Tray", (PrimitiveType)3, new Vector3(0.8f * num7, 0.806f, 0.28f), new Vector3(0.34f, 0.012f, 0.14f), Vector3.zero, mat2); float[] array4 = new float[3] { 0.036f, 0.054f, 0.03f }; for (int l = 0; l < array4.Length; l++) { float num8 = array4[l]; TableModelKit.Part(val, "CoinStack", (PrimitiveType)2, new Vector3(0.8f * num7 + (float)(l - 1) * 0.075f, 0.81200004f + num8 / 2f, 0.28f), new Vector3(0.064f, num8 / 2f, 0.064f), Vector3.zero, mat3); } TableModelKit.Part(val, "CoinStackSilver", (PrimitiveType)2, new Vector3(0.8f * num7 + 0.15f * num7, 0.832f, 0.28f), new Vector3(0.064f, 0.02f, 0.064f), Vector3.zero, mat4); float num9 = 1.02f * num7; float num10 = 0.3f; TableModelKit.Part(val, "LanternPost", (PrimitiveType)3, new Vector3(num9, 1f, num10), new Vector3(0.025f, 0.4f, 0.025f), Vector3.zero, mat2); TableModelKit.Part(val, "LanternFoot", (PrimitiveType)3, new Vector3(num9, 0.81f, num10), new Vector3(0.1f, 0.02f, 0.1f), Vector3.zero, mat7); TableModelKit.Part(val, "LanternBase", (PrimitiveType)3, new Vector3(num9, 1.205f, num10), new Vector3(0.12f, 0.02f, 0.12f), Vector3.zero, mat7); TableModelKit.Part(val, "LanternGlass", (PrimitiveType)3, new Vector3(num9, 1.27f, num10), new Vector3(0.09f, 0.11f, 0.09f), Vector3.zero, mat8); TableModelKit.Part(val, "LanternRoof", (PrimitiveType)3, new Vector3(num9, 1.3375001f, num10), new Vector3(0.14f, 0.025f, 0.14f), Vector3.zero, mat7); ((Component)TableModelKit.AddLight(val, "LanternLight", new Vector3(num9, 1.27f, num10), new Color(1f, 0.72f, 0.38f), 5f, 1.5f)).gameObject.AddComponent<CandleFlicker>(); } TableModelKit.Part(val, "Deck", (PrimitiveType)3, new Vector3(DeckPosition.x, 0.816f, DeckPosition.z), new Vector3(0.1f, 0.03f, 0.145f), Vector3.zero, val2); MeshFilter obj = CardDeck.Create(val, "DeckTop"); CardDeck.Show(obj, -1); ((Component)obj).transform.localPosition = new Vector3(DeckPosition.x, 0.833f, DeckPosition.z); ((Component)obj).transform.localScale = new Vector3(0.1f, 1f, 0.145f); ((Component)val).gameObject.AddComponent<BlackjackCards>(); ((Component)val).gameObject.AddComponent<BlackjackBets>(); ((Component)val).gameObject.AddComponent<RavenDealer>(); TableModelKit.AddBox(val, "ColliderDealer", new Vector3(0f, 0.45f, 0.175f), new Vector3(2.68f, 0.9f, 0.75f)); TableModelKit.AddBox(val, "ColliderPlayers", new Vector3(0f, 0.45f, -0.7f), new Vector3(2f, 0.9f, 1f)); } } public static class BoardPainter { public const float FaceW = 1.9f; public const float FaceH = 1.3f; public const int PixelsPerMetre = 400; public const int Width = 760; public const int Height = 520; public const int MaxNameChars = 12; private static readonly byte[] Gold = new byte[3] { 236, 186, 78 }; private static readonly byte[] Pale = new byte[3] { 232, 220, 190 }; private static readonly byte[] Dim = new byte[3] { 150, 112, 60 }; private const float RowH = 0.082f; private const float RowStroke = 0.013f; private const float RankX = 0.12f; private const float NameX = 0.27f; private const float AmountRight = 1.79f; private const float FirstRowY = 0.46f; private const float RowStep = 0.165f; public const float CashierFaceW = 1.8f; public const float CashierFaceH = 0.42f; public const int CashierW = 540; public const int CashierH = 126; public static byte[] Paint(IList<HighRoller> rollers) { StrokeSurface strokeSurface = new StrokeSurface(760, 520, 400f); strokeSurface.Planks(58f, 38f, 24f, 104); strokeSurface.Text("HIGH ROLLERS", 0.95f, 0.165f, 0.125f, 0.019f, Gold, 0); strokeSurface.Line(0.1f, 0.045f, 1.8f, 0.045f, 0.008f, Dim); strokeSurface.Line(0.16f, 0.305f, 1.74f, 0.305f, 0.01f, Gold); float[] array = new float[2] { 0.11f, 1.79f }; foreach (float num in array) { strokeSurface.Line(num - 0.03f, 0.305f, num, 0.275f, 0.008f, Gold); strokeSurface.Line(num, 0.275f, num + 0.03f, 0.305f, 0.008f, Gold); strokeSurface.Line(num + 0.03f, 0.305f, num, 0.335f, 0.008f, Gold); strokeSurface.Line(num, 0.335f, num - 0.03f, 0.305f, 0.008f, Gold); } for (int num2 = 0; num2 < 5; num2++) { float num3 = 0.46f + (float)num2 * 0.165f; int num4; object obj; if (rollers != null) { num4 = ((num2 < rollers.Count) ? 1 : 0); if (num4 != 0) { obj = ((num2 == 0) ? Gold : Pale); goto IL_0193; } } else { num4 = 0; } obj = Dim; goto IL_0193; IL_0193: byte[] col = (byte[])obj; strokeSurface.Text((num2 + 1).ToString(CultureInfo.InvariantCulture), 0.12f, num3, 0.082f, 0.013f, (num2 == 0) ? Gold : Dim, 0); if (num4 == 0) { strokeSurface.Line(0.27f, num3, 1.79f, num3, 0.004f, new byte[3] { 78, 58, 36 }); } else { strokeSurface.Text(BoardName(rollers[num2].Name), 0.27f, num3, 0.082f, 0.013f, col, -1); strokeSurface.Text(Amount(rollers[num2].Coins), 1.79f, num3, 0.082f, 0.013f, col, 1); } } strokeSurface.Line(0.1f, 1.255f, 1.8f, 1.255f, 0.008f, Dim); return strokeSurface.Pixels; } public static byte[] PaintCashier() { StrokeSurface strokeSurface = new StrokeSurface(540, 126, 300f); strokeSurface.Planks(58f, 38f, 24f, 63); strokeSurface.Text("CASHIER", 0.9f, 0.21499999f, 0.2f, 0.03f, Gold, 0); float[] array = new float[2] { 0.17f, 1.63f }; foreach (float num in array) { strokeSurface.Line(num, 0.21f, num, 0.21f, 0.2f, Dim); strokeSurface.Line(num, 0.21f, num, 0.21f, 0.17f, Gold); strokeSurface.Line(num - 0.02f, 0.16999999f, num + 0.03f, 0.26f, 0.016f, Dim); } strokeSurface.Line(0.32f, 0.04f, 1.48f, 0.04f, 0.008f, Dim); strokeSurface.Line(0.32f, 0.38f, 1.48f, 0.38f, 0.008f, Dim); return strokeSurface.Pixels; } public static string BoardName(string name) { StringBuilder stringBuilder = new StringBuilder(); string text = (name ?? "").Trim().ToUpperInvariant().Normalize(NormalizationForm.FormD); foreach (char c in text) { if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark) { switch (c) { case 'Ø': stringBuilder.Append('O'); break; case 'Æ': stringBuilder.Append("AE"); break; case 'Œ': stringBuilder.Append("OE"); break; case 'Þ': stringBuilder.Append("TH"); break; case 'Ð': stringBuilder.Append('D'); break; case 'ẞ': stringBuilder.Append("SS"); break; default: stringBuilder.Append(c); break; } } } string text2 = stringBuilder.ToString(); if (text2.Length <= 12) { return text2; } return text2.Substring(0, 12).TrimEnd(Array.Empty<char>()); } public static string Amount(long coins) { return Math.Min(Math.Max(0L, coins), 999999999L).ToString("N0", CultureInfo.InvariantCulture); } public static bool CanWrite(char ch) { return StrokeSurface.CanWrite(ch); } public static float TextWidth(string text, float height) { return StrokeSurface.TextWidth(text, height); } } public static class CardPainter { private sealed class Canvas { private const int W = 384; private const int H = 540; private readonly byte[] px = new byte[622080]; private float clipX0; private float clipY0; private float clipX1 = 128f; private float clipY1 = 180f; public bool Flip; public void Clip(float x0, float y0, float x1, float y1) { clipX0 = x0; clipY0 = y0; clipX1 = x1; clipY1 = y1; } public void NoClip() { clipX0 = 0f; clipY0 = 0f; clipX1 = 128f; clipY1 = 180f; } public void Fill(byte[] col) { for (int i = 0; i < px.Length; i += 3) { px[i] = col[0]; px[i + 1] = col[1]; px[i + 2] = col[2]; } } private float Tx(float x) { if (!Flip) { return x; } return 128f - x; } private float Ty(float y) { if (!Flip) { return y; } return 180f - y; } private void Paint(float x0, float y0, float x1, float y1, Func<float, float, bool> inside, byte[] col) { if (x0 > x1) { float num = x0; x0 = x1; x1 = num; } if (y0 > y1) { float num2 = y0; y0 = y1; y1 = num2; } int num3 = Math.Max(0, (int)Math.Floor(Math.Max(x0, clipX0) * 3f)); int num4 = Math.Min(383, (int)Math.Ceiling(Math.Min(x1, clipX1) * 3f)); int num5 = Math.Max(0, (int)Math.Floor(Math.Max(y0, clipY0) * 3f)); int num6 = Math.Min(539, (int)Math.Ceiling(Math.Min(y1, clipY1) * 3f)); for (int i = num5; i <= num6; i++) { float num7 = ((float)i + 0.5f) / 3f; if (num7 < clipY0 || num7 > clipY1) { continue; } for (int j = num3; j <= num4; j++) { float num8 = ((float)j + 0.5f) / 3f; if (!(num8 < clipX0) && !(num8 > clipX1) && inside(num8, num7)) { int num9 = (i * 384 + j) * 3; px[num9] = col[0]; px[num9 + 1] = col[1]; px[num9 + 2] = col[2]; } } } } public void Circle(float cx, float cy, float r, byte[] col) { cx = Tx(cx); cy = Ty(cy); float rr = r * r; Paint(cx - r, cy - r, cx + r, cy + r, (float x, float y) => (x - cx) * (x - cx) + (y - cy) * (y - cy) <= rr, col); } public void Line(float x0, float y0, float x1, float y1, float width, byte[] col) { x0 = Tx(x0); y0 = Ty(y0); x1 = Tx(x1); y1 = Ty(y1); float num = width / 2f; float hh = num * num; float dx = x1 - x0; float dy = y1 - y0; float len2 = dx * dx + dy * dy; Paint(Math.Min(x0, x1) - num, Math.Min(y0, y1) - num, Math.Max(x0, x1) + num, Math.Max(y0, y1) + num, delegate(float num3, float num4) { float num2 = ((len2 > 0f) ? (((num3 - x0) * dx + (num4 - y0) * dy) / len2) : 0f); num2 = ((num2 < 0f) ? 0f : ((num2 > 1f) ? 1f : num2)); float num5 = num3 - (x0 + dx * num2); float num6 = num4 - (y0 + dy * num2); return num5 * num5 + num6 * num6 <= hh; }, col); } public void Polyline(float[] p, float width, byte[] col) { for (int i = 0; i + 3 < p.Length; i += 2) { Line(p[i], p[i + 1], p[i + 2], p[i + 3], width, col); } } public void Frame(float x0, float y0, float x1, float y1, float width, byte[] col) { Polyline(new float[10] { x0, y0, x1, y0, x1, y1, x0, y1, x0, y0 }, width, col); } public void Poly(float[] p, byte[] col) { int n = p.Length / 2; float[] xs = new float[n]; float[] ys = new float[n]; float num = float.MaxValue; float num2 = float.MaxValue; float num3 = float.MinValue; float num4 = float.MinValue; for (int i = 0; i < n; i++) { xs[i] = Tx(p[i * 2]); ys[i] = Ty(p[i * 2 + 1]); num = Math.Min(num, xs[i]); num3 = Math.Max(num3, xs[i]); num2 = Math.Min(num2, ys[i]); num4 = Math.Max(num4, ys[i]); } Paint(num, num2, num3, num4, delegate(float x, float y) { bool flag = false; int num5 = 0; int num6 = n - 1; while (num5 < n) { if (ys[num5] > y != ys[num6] > y && x < (xs[num6] - xs[num5]) * (y - ys[num5]) / (ys[num6] - ys[num5]) + xs[num5]) { flag = !flag; } num6 = num5++; } return flag; }, col); } private float[] Place(float[] unit, float cx, float cy, float size) { float[] array = new float[unit.Length]; for (int i = 0; i < unit.Length; i += 2) { array[i] = cx + unit[i] * size; array[i + 1] = cy + unit[i + 1] * size; } return array; } public void Pip(int suit, float cx, float cy, float size, byte[] col) { switch (suit) { case 1: Circle(cx - 0.22f * size, cy - 0.18f * size, 0.25f * size, col); Circle(cx + 0.22f * size, cy - 0.18f * size, 0.25f * size, col); Poly(Place(new float[6] { -0.455f, -0.08f, 0.455f, -0.08f, 0f, 0.5f }, cx, cy, size), col); break; case 2: Poly(Place(new float[8] { 0f, -0.5f, 0.37f, 0f, 0f, 0.5f, -0.37f, 0f }, cx, cy, size), col); break; case 3: Circle(cx, cy - 0.25f * size, 0.22f * size, col); Circle(cx - 0.25f * size, cy + 0.08f * size, 0.22f * size, col); Circle(cx + 0.25f * size, cy + 0.08f * size, 0.22f * size, col); Circle(cx, cy, 0.13f * size, col); Poly(Place(new float[6] { 0f, 0f, -0.16f, 0.5f, 0.16f, 0.5f }, cx, cy, size), col); break; default: Circle(cx - 0.21f * size, cy + 0.08f * size, 0.235f * size, col); Circle(cx + 0.21f * size, cy + 0.08f * size, 0.235f * size, col); Poly(Place(new float[6] { -0.43f, 0f, 0.43f, 0f, 0f, -0.5f }, cx, cy, size), col); Poly(Place(new float[6] { 0f, 0.05f, -0.16f, 0.5f, 0.16f, 0.5f }, cx, cy, size), col); break; } } public void Glyph(int rank, float x, float y, float w, float h, float width, byte[] col) { float[][] array = Glyphs[rank]; foreach (float[] array2 in array) { float[] array3 = new float[array2.Length]; for (int j = 0; j < array2.Length; j += 2) { array3[j] = x + array2[j] * w; array3[j + 1] = y + array2[j + 1] * h; } Polyline(array3, width, col); } } public void Court(int rank, float cx, float cy, float size) { if (rank == 10) { Line(cx - 0.2f * size, cy + 0.48f * size, cx + 0.14f * size, cy - 0.46f * size, 0.09f * size, Wood); Poly(Place(new float[10] { 0.06f, -0.4f, 0.44f, -0.5f, 0.5f, -0.02f, 0.22f, -0.1f, 0.13f, -0.2f }, cx, cy, size), Steel); Line(cx + 0.44f * size, cy - 0.5f * size, cx + 0.5f * size, cy - 0.02f * size, 0.035f * size, Black); return; } bool flag = rank == 12; float num = (flag ? (-0.36f) : (-0.14f)); float num2 = (flag ? 0.04f : 0.12f); float num3 = (flag ? (-0.26f) : (-0.06f)); float[] obj = new float[14] { -0.45f, 0.3f, -0.45f, 0f, -0.22f, 0f, 0f, 0f, 0.22f, 0f, 0.45f, 0f, 0.45f, 0.3f }; obj[3] = num3; obj[5] = num2; obj[7] = num; obj[9] = num2; obj[11] = num3; Poly(Place(obj, cx, cy, size), Gold); Poly(Place(new float[8] { -0.47f, 0.3f, 0.47f, 0.3f, 0.47f, 0.44f, -0.47f, 0.44f }, cx, cy, size), GoldDark); byte[] col = (flag ? Red : Cream); float num4 = (flag ? 0.065f : 0.085f) * size; float[][] array = new float[3][] { new float[2] { -0.45f, num3 }, new float[2] { 0f, num }, new float[2] { 0.45f, num3 } }; foreach (float[] array2 in array) { Circle(cx + array2[0] * size, cy + array2[1] * size - num4 * 0.4f, num4 + 0.02f * size, GoldDark); Circle(cx + array2[0] * size, cy + array2[1] * size - num4 * 0.4f, num4, col); } } public byte[] Shrink() { byte[] array = new byte[92160]; for (int i = 0; i < 180; i++) { for (int j = 0; j < 128; j++) { int num = 0; int num2 = 0; int num3 = 0; for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { int num4 = ((i * 3 + k) * 384 + j * 3 + l) * 3; num += px[num4]; num2 += px[num4 + 1]; num3 += px[num4 + 2]; } } int num5 = (i * 128 + j) * 4; array[num5] = (byte)(num / 9); array[num5 + 1] = (byte)(num2 / 9); array[num5 + 2] = (byte)(num3 / 9); array[num5 + 3] = byte.MaxValue; } } return array; } } public const int CellW = 128; public const int CellH = 180; public const int Cols = 8; public const int Rows = 7; public const int Back = 52; public const int Width = 1024; public const int Height = 1260; private const int SS = 3; private static readonly byte[] Cream = new byte[3] { 240, 230, 204 }; private static readonly byte[] Edge = new byte[3] { 150, 120, 70 }; private static readonly byte[] Red = new byte[3] { 186, 32, 28 }; private static readonly byte[] Black = new byte[3] { 26, 24, 28 }; private static readonly byte[] Gold = new byte[3] { 206, 154, 54 }; private static readonly byte[] GoldDark = new byte[3] { 138, 96, 30 }; private static readonly byte[] Steel = new byte[3] { 112, 118, 130 }; private static readonly byte[] Wood = new byte[3] { 96, 62, 34 }; private static readonly byte[] BackRed = new byte[3] { 110, 28, 24 }; private static readonly byte[] BackDark = new byte[3] { 70, 16, 18 }; private static readonly byte[] BackLine = new byte[3] { 150, 58, 40 }; private static readonly float[][][] Glyphs = BuildGlyphs(); public static byte[] PaintAtlas() { byte[] array = new byte[5160960]; for (int i = 0; i < 56; i++) { byte[] src = PaintCard(Math.Min(i, 52)); int num = i % 8 * 128; int num2 = i / 8 * 180; for (int j = 0; j < 180; j++) { Buffer.BlockCopy(src, j * 128 * 4, array, ((num2 + j) * 1024 + num) * 4, 512); } } return array; } public static byte[] PaintCard(int card) { Canvas canvas = new Canvas(); if (card < 0 || card >= 52) { PaintBack(canvas); } else { PaintFace(canvas, card % 13, card / 13); } return canvas.Shrink(); } private static void PaintFace(Canvas c, int rank, int suit) { byte[] col = ((suit == 1 || suit == 2) ? Red : Black); c.Fill(Cream); c.Frame(3.5f, 3.5f, 124.5f, 176.5f, 1.4f, Edge); for (int i = 0; i < 2; i++) { c.Flip = i == 1; float w = ((rank == 9) ? 36f : 26f); c.Glyph(rank, 9f, 10f, w, 42f, 5.2f, col); c.Pip(suit, 22f, 70f, 23f, col); } c.Flip = false; if (rank >= 10) { c.Court(rank, 64f, 80f, 54f); c.Pip(suit, 64f, 128f, 24f, col); } else { c.Pip(suit, 64f, 90f, (rank == 0) ? 72f : 54f, col); } } private static void PaintBack(Canvas c) { c.Fill(BackRed); c.Clip(12f, 12f, 116f, 168f); for (float num = -180f; num < 308f; num += 16f) { c.Line(num, 0f, num + 180f, 180f, 1.6f, BackLine); c.Line(num, 180f, num + 180f, 0f, 1.6f, BackLine); } c.NoClip(); c.Frame(5f, 5f, 123f, 175f, 2.4f, Gold); c.Frame(11f, 11f, 117f, 169f, 1.2f, GoldDark); float num2 = 64f; float num3 = 90f; c.Circle(num2, num3, 27f, Gold); c.Circle(num2, num3, 24f, BackDark); c.Polyline(new float[10] { num2 - 7f, num3 + 15f, num2 - 7f, num3 - 15f, num2 + 8f, num3 - 7f, num2 - 7f, num3 + 1f, num2 + 9f, num3 + 15f }, 3.4f, Gold); } internal static float[][] DigitStrokes(int digit) { return digit switch { 0 => new float[1][] { Oval(0.5f, 0.5f, 0.44f, 0.5f) }, 1 => new float[1][] { new float[6] { 0.22f, 0.22f, 0.55f, 0f, 0.55f, 1f } }, _ => Glyphs[digit - 1], }; } private static float[] Oval(float cx, float cy, float rx, float ry) { List<float> list = new List<float>(); for (int i = 0; i <= 20; i++) { double num = Math.PI * 2.0 * (double)i / 20.0; list.Add(cx + rx * (float)Math.Sin(num)); list.Add(cy - ry * (float)Math.Cos(num)); } return list.ToArray(); } private static float[] Turned(float[] p) { float[] array = new float[p.Length]; for (int i = 0; i < p.Length; i++) { array[i] = 1f - p[i]; } return array; } private static float[][][] BuildGlyphs() { float[] array = new float[26] { 0.86f, 0.06f, 0.52f, 0f, 0.22f, 0.14f, 0.05f, 0.48f, 0.07f, 0.8f, 0.28f, 0.97f, 0.58f, 1f, 0.86f, 0.88f, 0.95f, 0.68f, 0.83f, 0.5f, 0.56f, 0.43f, 0.26f, 0.5f, 0.07f, 0.66f }; return new float[13][][] { new float[2][] { new float[6] { 0f, 1f, 0.5f, 0f, 1f, 1f }, new float[4] { 0.2f, 0.64f, 0.8f, 0.64f } }, new float[1][] { new float[16] { 0.05f, 0.24f, 0.2f, 0.05f, 0.5f, 0f, 0.8f, 0.05f, 0.95f, 0.25f, 0.85f, 0.46f, 0.05f, 1f, 1f, 1f } }, new float[2][] { new float[12] { 0.05f, 0.1f, 0.4f, 0f, 0.8f, 0.05f, 0.92f, 0.25f, 0.8f, 0.44f, 0.45f, 0.5f }, new float[12] { 0.45f, 0.5f, 0.82f, 0.56f, 0.97f, 0.75f, 0.82f, 0.95f, 0.4f, 1f, 0.03f, 0.9f } }, new float[1][] { new float[8] { 0.75f, 1f, 0.75f, 0f, 0f, 0.7f, 1f, 0.7f } }, new float[1][] { new float[18] { 0.9f, 0f, 0.15f, 0f, 0.08f, 0.45f, 0.5f, 0.38f, 0.85f, 0.48f, 0.97f, 0.7f, 0.85f, 0.92f, 0.5f, 1f, 0.05f, 0.9f } }, new float[1][] { array }, new float[1][] { new float[6] { 0f, 0f, 1f, 0f, 0.4f, 1f } }, new float[2][] { Oval(0.5f, 0.24f, 0.4f, 0.24f), Oval(0.5f, 0.74f, 0.47f, 0.26f) }, new float[1][] { Turned(array) }, new float[2][] { new float[6] { 0f, 0.2f, 0.16f, 0f, 0.16f, 1f }, Oval(0.68f, 0.5f, 0.3f, 0.5f) }, new float[2][] { new float[4] { 0.4f, 0f, 1f, 0f }, new float[12] { 0.75f, 0f, 0.75f, 0.74f, 0.6f, 0.95f, 0.38f, 1f, 0.15f, 0.92f, 0.05f, 0.72f } }, new float[2][] { Oval(0.5f, 0.48f, 0.47f, 0.48f), new float[4] { 0.58f, 0.72f, 1f, 1.04f } }, new float[3][] { new float[4] { 0.05f, 0f, 0.05f, 1f }, new float[4] { 0.95f, 0f, 0.05f, 0.6f }, new float[4] { 0.36f, 0.4f, 1f, 1f } } }; } } public struct CardSpot { public string Key; public int Card; public float X; public float Z; public float Yaw; public float W; public float H; public int Layer; } public static class CardTables { public const int FaceDown = -1; private const float BjHandRadius = 0.5f; private const float BjDealerZ = 0.2f; private const float BjW = 0.095f; private const float BjH = 0.135f; private const float BjDealerW = 0.1f; private const float BjDealerH = 0.145f; private const float BjSplitOffset = 0.082f; private static readonly float[] RideStations = new float[4] { -1.02f, -0.34f, 0.34f, 1.02f }; private const float RideW = 0.135f; private const float RideH = 0.19f; public static string EncodeBlackjack(IList<int> dealer, IEnumerable<KeyValuePair<int, IList<IList<int>>>> seats) { StringBuilder stringBuilder = new StringBuilder("D=").Append(Join(dealer)); foreach (KeyValuePair<int, IList<IList<int>>> seat in seats) { if (seat.Key >= 0 && seat.Value != null) { string[] array = (from h in seat.Value where h != null && h.Count > 0 select Join(h)).ToArray(); if (array.Length != 0) { stringBuilder.Append(';').Append(seat.Key.ToString(CultureInfo.InvariantCulture)).Append('=') .Append(string.Join("/", array)); } } } return stringBuilder.ToString(); } public static List<CardSpot> BlackjackSpots(string state, float[] seatAngles) { List<CardSpot> list = new List<CardSpot>(); if (string.IsNullOrEmpty(state)) { return list; } string[] array = state.Split(new char[1] { ';' }); foreach (string text in array) { int num = text.IndexOf('='); if (num <= 0) { continue; } string text2 = text.Substring(0, num); string[] array2 = text.Substring(num + 1).Split(new char[1] { '/' }); List<int> list2 = Parse(array2[0]); if (list2.Count == 0) { continue; } if (text2 == "D") { float num2 = Step(list2.Count, 0.12f, 0.5f); for (int j = 0; j < list2.Count; j++) { list.Add(new CardSpot { Key = "d" + j, Card = list2[j], X = ((float)j - (float)(list2.Count - 1) / 2f) * num2, Z = 0.2f, Yaw = 0f, W = 0.1f, H = 0.145f, Layer = j }); } } else { if (!int.TryParse(text2, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) || result < 0 || result >= seatAngles.Length) { continue; } double num3 = (double)seatAngles[result] * Math.PI / 180.0; float num4 = (float)Math.Sin(num3); float num5 = (float)Math.Cos(num3); float num6 = 0f - num5; float num7 = num4; bool flag = array2.Length > 1; for (int k = 0; k < array2.Length && k < 2; k++) { if (k > 0) { list2 = Parse(array2[k]); } float num8 = ((!flag) ? 0f : ((k == 0) ? (-0.082f) : 0.082f)); float num9 = (flag ? Step(list2.Count, 0.045f, 0.06f) : Step(list2.Count, 0.07f, 0.22f)); for (int l = 0; l < list2.Count; l++) { float num10 = num8 + ((float)l - (float)(list2.Count - 1) / 2f) * num9; list.Add(new CardSpot { Key = "s" + result + "." + k + "." + l, Card = list2[l], X = num4 * 0.5f + num6 * num10, Z = num5 * 0.5f + num7 * num10, Yaw = seatAngles[result] + 180f, W = 0.095f, H = 0.135f, Layer = l }); } } } } return list; } private static float Step(int count, float normal, float span) { if (count > 1) { return Math.Min(normal, span / (float)(count - 1)); } return 0f; } public static int AssignSlot(ICollection<int> taken, int preferred, int count) { if (preferred >= 0 && preferred < count && !taken.Contains(preferred)) { return preferred; } for (int i = 0; i < count; i++) { if (!taken.Contains(i)) { return i; } } return -1; } public static int NearestSeat(float degrees, float[] seatAngles) { int result = -1; float num = float.MaxValue; for (int i = 0; i < seatAngles.Length; i++) { float num2 = Math.Abs(((degrees - seatAngles[i]) % 360f + 540f) % 360f - 180f); if (num2 < num) { num = num2; result = i; } } return result; } public static string EncodeRideBus(IList<int> drawn, bool nextWaiting) { List<int> list = drawn.Take(RideStations.Length).ToList(); if (nextWaiting && list.Count < RideStations.Length) { list.Add(-1); } return Join(list); } public static List<CardSpot> RideBusSpots(string state) { List<CardSpot> list = new List<CardSpot>(); List<int> list2 = Parse(state); for (int i = 0; i < list2.Count && i < RideStations.Length; i++) { list.Add(new CardSpot { Key = "r" + i, Card = list2[i], X = 0f, Z = RideStations[i], Yaw = 90f, W = 0.135f, H = 0.19f, Layer = 0 }); } return list; } private static string Join(IEnumerable<int> cards) { return string.Join(",", cards.Select((int c) => c.ToString(CultureInfo.InvariantCulture)).ToArray()); } private static List<int> Parse(string text) { List<int> list = new List<int>(); if (string.IsNullOrEmpty(text)) { return list; } string[] array = text.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { if (int.TryParse(array[i], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { list.Add((result >= 0 && result < 52) ? result : (-1)); } } return list; } } public class CashierCage : MonoBehaviour, Hoverable, Interactable { public string GetHoverName() { return "Cashier's Cage"; } public float GetHoverOffset() { return 0f; } public string GetHoverText() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; long num = (((Object)(object)localPlayer != (Object)null) ? CoinUtil.Owed(localPlayer) : 0); if (num <= 0) { return "Cashier's Cage\nNo winnings are waiting for you."; } KeyboardShortcut value = CasinoPlugin.CollectKey.Value; if (((KeyboardShortcut)(ref value)).IsDown() && !TextInput.IsVisible() && !Console.IsVisible() && ((Object)(object)Chat.instance == (Object)null || !Chat.instance.HasFocus())) { num = CasinoTableBase.CollectWinnings(localPlayer); if (num <= 0) { return "Cashier's Cage\nNo winnings are waiting for you."; } } return Localization.instance.Localize("Cashier's Cage\nWinnings waiting: " + num.ToString("N0") + " coins\n[<color=yellow><b>$KEY_Use</b></color>] Collect"); } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } Player val = (Player)(object)((user is Player) ? user : null); if ((Object)(object)val == (Object)null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return false; } if (CoinUtil.Owed(val) <= 0) { ((Character)val).Message((MessageType)2, "No winnings are waiting for you.", 0, (Sprite)null, false); return true; } CasinoTableBase.CollectWinnings(val); return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } } public static class CasinoDecor { private static Material oak; private static Material oakDark; private static Material iron; private static Material gold; private static Material red; private static Material blue; private static Material bronze; private static Material velvet; private static void Materials() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)oak != (Object)null)) { Texture2D texture = TableModelKit.WoodTexture(); oak = TableModelKit.Make(new Color(0.62f, 0.45f, 0.3f), texture, 0.15f, 0f); oakDark = TableModelKit.Make(new Color(0.36f, 0.24f, 0.16f), texture, 0.12f, 0f); iron = TableModelKit.Make(new Color(0.2f, 0.21f, 0.24f), null, 0.45f, 0.6f); gold = TableModelKit.Make(new Color(0.95f, 0.72f, 0.26f), null, 0.55f, 0.5f); red = TableModelKit.Make(new Color(0.62f, 0.12f, 0.1f), texture, 0.2f, 0f); blue = TableModelKit.Make(new Color(0.14f, 0.28f, 0.5f), texture, 0.2f, 0f); bronze = TableModelKit.Make(new Color(0.42f, 0.28f, 0.12f), null, 0.5f, 0.6f); velvet = TableModelKit.Make(new Color(0.5f, 0.08f, 0.1f), TableModelKit.LeatherTexture(), 0.25f, 0f); } } private static void Lantern(Transform root, Vector3 centre, float size, float range, float intensity) { //IL_000f: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_009a: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) Material mat = TableModelKit.Glowing(new Color(1f, 0.85f, 0.45f), new Color(2.2f, 1.4f, 0.5f)); float num = 0.1f * size; float num2 = 0.13f * size; TableModelKit.Part(root, "LanternBase", (PrimitiveType)3, centre - new Vector3(0f, num2 / 2f + 0.01f * size, 0f), new Vector3(num * 1.3f, 0.02f * size, num * 1.3f), Vector3.zero, bronze); TableModelKit.Part(root, "LanternGlass", (PrimitiveType)3, centre, new Vector3(num, num2, num), Vector3.zero, mat); TableModelKit.Part(root, "LanternRoof", (PrimitiveType)3, centre + new Vector3(0f, num2 / 2f + 0.0125f * size, 0f), new Vector3(num * 1.6f, 0.025f * size, num * 1.6f), Vector3.zero, bronze); if (range <= 0f) { GameObject val = new GameObject("LanternFlame") { layer = TableModelKit.PieceLayer }; val.transform.SetParent(root, false); val.transform.localPosition = centre; val.AddComponent<CandleFlicker>(); } else { ((Component)TableModelKit.AddLight(root, "LanternLight", centre, new Color(1f, 0.72f, 0.38f), range, intensity)).gameObject.AddComponent<CandleFlicker>(); } } public static void BuildSign(GameObject prefab) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0530: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053f: 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_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_05bd: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) TableModelKit.Strip(prefab); Materials(); Transform val = TableModelKit.Root(prefab, "CasinoSignVisual"); TableModelKit.Part(val, "Foot", (PrimitiveType)3, new Vector3(-0.8f, 0.05f, 0f), new Vector3(0.5f, 0.1f, 0.5f), Vector3.zero, oak); TableModelKit.Part(val, "Post", (PrimitiveType)3, new Vector3(-0.8f, 1.55f, 0f), new Vector3(0.13f, 3f, 0.13f), Vector3.zero, oakDark); TableModelKit.Part(val, "PostBand", (PrimitiveType)3, new Vector3(-0.8f, 0.3f, 0f), new Vector3(0.16f, 0.05f, 0.16f), Vector3.zero, gold); TableModelKit.Part(val, "PostCap", (PrimitiveType)0, new Vector3(-0.8f, 3.1f, 0f), Vector3.one * 0.18f, Quaternion.identity, gold); TableModelKit.Part(val, "Arm", (PrimitiveType)3, new Vector3(0.05f, 2.95f, 0f), new Vector3(1.85f, 0.1f, 0.1f), Vector3.zero, oakDark); TableModelKit.Link(val, "Brace", new Vector3(-0.8f, 2.45f, 0f), new Vector3(-0.3f, 2.92f, 0f), 0.07f, oakDark); TableModelKit.Part(val, "ArmTip", (PrimitiveType)0, new Vector3(0.98f, 2.95f, 0f), Vector3.one * 0.14f, Quaternion.identity, gold); float[] array = new float[2] { -1f, 1f }; foreach (float num in array) { TableModelKit.Part(val, "Chain", (PrimitiveType)3, new Vector3(0.1f + 0.45f * num, 2.7949998f, 0f), new Vector3(0.02f, 0.31000006f, 0.02f), Vector3.zero, iron); } TableModelKit.Part(val, "Board", (PrimitiveType)3, new Vector3(0.1f, 2.25f, 0f), new Vector3(1.2f, 0.78f, 0.07f), Vector3.zero, oakDark); TableModelKit.Part(val, "FrameTop", (PrimitiveType)3, new Vector3(0.1f, 2.6399999f, 0f), new Vector3(1.26f, 0.045f, 0.1f), Vector3.zero, gold); TableModelKit.Part(val, "FrameBottom", (PrimitiveType)3, new Vector3(0.1f, 1.86f, 0f), new Vector3(1.26f, 0.045f, 0.1f), Vector3.zero, gold); array = new float[2] { -1f, 1f }; foreach (float num2 in array) { TableModelKit.Part(val, "FrameSide", (PrimitiveType)3, new Vector3(0.1f + 0.6f * num2, 2.25f, 0f), new Vector3(0.045f, 0.78f, 0.1f), Vector3.zero, gold); } array = new float[2] { 1f, -1f }; foreach (float side in array) { float z = 0.05f * side; Func<float, float, Vector3> func = (float x, float y) => new Vector3(0.1f - x * side, 2.25f + y, z); TableModelKit.Link(val, "RuneStave", func(-0.09f, -0.27f), func(-0.09f, 0.27f), 0.055f, gold); TableModelKit.Link(val, "RuneBranch", func(-0.09f, 0f), func(0.13f, 0.26f), 0.05f, gold); TableModelKit.Link(val, "RuneBranch", func(-0.09f, -0.16f), func(0.13f, 0.1f), 0.05f, gold); Quaternion rot = Quaternion.Euler(90f, 0f, 0f); TableModelKit.Part(val, "Shield", (PrimitiveType)2, func(-0.4f, 0f), new Vector3(0.26f, 0.008f, 0.26f), rot, red); TableModelKit.Part(val, "ShieldBoss", (PrimitiveType)0, func(-0.4f, 0f), Vector3.one * 0.07f, Quaternion.identity, gold); TableModelKit.Part(val, "Shield", (PrimitiveType)2, func(0.4f, 0f), new Vector3(0.26f, 0.008f, 0.26f), rot, blue); TableModelKit.Part(val, "ShieldBoss", (PrimitiveType)0, func(0.4f, 0f), Vector3.one * 0.07f, Quaternion.identity, gold); TableModelKit.AddLight(val, "SignLight", new Vector3(0.1f, 2.35f, 0.75f * side), new Color(1f, 0.78f, 0.5f), 2.6f, 1.1f); } TableModelKit.Part(val, "LanternChain", (PrimitiveType)3, new Vector3(0.98f, 2.78f, 0f), new Vector3(0.012f, 0.22f, 0.012f), Vector3.zero, iron); Lantern(val, new Vector3(0.98f, 2.58f, 0f), 1.2f, 6f, 1.5f); TableModelKit.AddBox(val, "ColliderPost", new Vector3(-0.8f, 1.55f, 0f), new Vector3(0.22f, 3.1f, 0.22f)); TableModelKit.AddBox(val, "ColliderFoot", new Vector3(-0.8f, 0.05f, 0f), new Vector3(0.5f, 0.1f, 0.5f)); TableModelKit.AddBox(val, "ColliderBoard", new Vector3(0.1f, 2.25f, 0f), new Vector3(1.26f, 0.83f, 0.1f)); } public static void BuildLanternPost(GameObject prefab) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) TableModelKit.Strip(prefab); Materials(); Transform val = TableModelKit.Root(prefab, "CasinoLanternVisual"); TableModelKit.Part(val, "Foot", (PrimitiveType)2, new Vector3(0f, 0.04f, 0f), new Vector3(0.5f, 0.04f, 0.5f), Vector3.zero, iron); TableModelKit.Part(val, "FootRing", (PrimitiveType)2, new Vector3(0f, 0.09f, 0f), new Vector3(0.3f, 0.02f, 0.3f), Vector3.zero, gold); TableModelKit.Part(val, "Post", (PrimitiveType)2, new Vector3(0f, 1.275f, 0f), new Vector3(0.07f, 1.275f, 0.07f), Vector3.zero, iron); TableModelKit.Part(val, "PostBand", (PrimitiveType)2, new Vector3(0f, 1.2f, 0f), new Vector3(0.1f, 0.03f, 0.1f), Vector3.zero, gold); TableModelKit.Part(val, "Crossbar", (PrimitiveType)3, new Vector3(0f, 2.55f, 0f), new Vector3(1.2f, 0.06f, 0.06f), Vector3.zero, iron); TableModelKit.Part(val, "Finial", (PrimitiveType)0, new Vector3(0f, 2.6699998f, 0f), Vector3.one * 0.16f, Quaternion.identity, gold); float[] array = new float[2] { -1f, 1f }; foreach (float num in array) { float num2 = 0.55f * num; TableModelKit.Link(val, "Scroll", new Vector3(0.05f * num, 2.1499999f, 0f), new Vector3(num2 * 0.75f, 2.51f, 0f), 0.03f, iron); TableModelKit.Part(val, "BarEnd", (PrimitiveType)0, new Vector3(0.62f * num, 2.55f, 0f), Vector3.one * 0.09f, Quaternion.identity, gold); TableModelKit.Part(val, "LanternChain", (PrimitiveType)3, new Vector3(num2, 2.4099998f, 0f), new Vector3(0.012f, 0.22f, 0.012f), Vector3.zero, iron); Lantern(val, new Vector3(num2, 2.19f, 0f), 1.5f, 9f, 1.7f); } TableModelKit.AddBox(val, "ColliderPost", new Vector3(0f, 1.275f, 0f), new Vector3(0.16f, 2.55f, 0.16f)); TableModelKit.AddBox(val, "ColliderFoot", new Vector3(0f, 0.05f, 0f), new Vector3(0.45f, 0.1f, 0.45f)); } public static void BuildRope(GameObject prefab) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_01ab: Unknown result type (might be due to invalid IL or missing references) TableModelKit.Strip(prefab); Materials(); Transform parent = TableModelKit.Root(prefab, "CasinoRopeVisual"); float[] array = new float[2] { -1f, 1f }; foreach (float num in array) { float num2 = 0.75f * num; TableModelKit.Part(parent, "Foot", (PrimitiveType)2, new Vector3(num2, 0.025f, 0f), new Vector3(0.32f, 0.025f, 0.32f), Vector3.zero, gold); TableModelKit.Part(parent, "Post", (PrimitiveType)2, new Vector3(num2, 0.5f, 0f), new Vector3(0.06f, 0.5f, 0.06f), Vector3.zero, gold); TableModelKit.Part(parent, "Collar", (PrimitiveType)2, new Vector3(num2, 0.9f, 0f), new Vector3(0.09f, 0.02f, 0.09f), Vector3.zero, bronze); TableModelKit.Part(parent, "Cap", (PrimitiveType)0, new Vector3(num2, 1.03f, 0f), Vector3.one * 0.13f, Quaternion.identity, gold); } Vector3 a = Vector3.zero; Vector3 val = default(Vector3); for (int j = 0; j <= 10; j++) { float num3 = (float)j / 10f; float num4 = 0.24f * (1f - (2f * num3 - 1f) * (2f * num3 - 1f)); ((Vector3)(ref val))..ctor(-0.75f + 1.5f * num3, 0.9f - num4, 0f); if (j > 0) { TableModelKit.Link(parent, "Rope", a, val, 0.05f, velvet); } a = val; } TableModelKit.AddBox(parent, "Collider", new Vector3(0f, 0.5f, 0f), new Vector3(1.7f, 1f, 0.14f)); } public static void BuildChandelier(GameObject prefab) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due t