using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using REPOLib.Modules;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d27a08b8-2a01-4dab-bc84-6e1201deecea")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RepoCasino")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RepoCasino")]
[assembly: AssemblyTitle("RepoCasino")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RepoCasino;
public class BetArray
{
private BetEntry[] _bets = new BetEntry[10];
public BetEntry this[BetType type]
{
get
{
return _bets[(int)type];
}
set
{
_bets[(int)type] = value;
}
}
public BetArray()
{
int num = 10;
_bets = new BetEntry[num];
for (int i = 0; i < num; i++)
{
_bets[i] = new BetEntry();
}
}
public void Clear()
{
for (int i = 0; i < 10; i++)
{
_bets[i].Clear();
}
}
}
public enum BetType
{
Money,
Energy,
ExtraJump,
GrabRange,
GrabStrength,
Health,
SprintSpeed,
TumbleLaunch,
TumbleWings,
CrouchRest,
Count
}
public class BetButton : MonoBehaviourPun
{
[SerializeField]
private GameObject _chips;
[SerializeField]
private AudioClip _chipsDrop;
[SerializeField]
private BetManager _betManager;
[SerializeField]
private TvManager _tvManager;
[SerializeField]
private bool _isRoulette;
[SerializeField]
private bool _isOccupied;
[SerializeField]
private PhysGrabObjectGrabArea _grabArea;
private AudioSource _audioSource;
[field: SerializeField]
public BetArray BetArray { get; private set; } = new BetArray();
[field: SerializeField]
public bool IsBetPlaced { get; private set; }
[field: SerializeField]
public int[] WinningNumbers { get; private set; }
[field: SerializeField]
public int PayoutMultiplier { get; private set; }
[field: SerializeField]
public int LossMultiplier { get; private set; }
private void Awake()
{
if ((Object)(object)_grabArea == (Object)null)
{
_grabArea = ((Component)this).GetComponent<PhysGrabObjectGrabArea>();
}
_audioSource = ((Component)this).GetComponent<AudioSource>();
}
public void SetBet()
{
if (!_isRoulette || !Roulette.Instance.IsSpinning)
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("SetBetRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
SetBetRpc();
}
}
}
[PunRPC]
private void SetBetRpc()
{
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
int count = _betManager.GetCount();
string text = SemiFunc.PlayerGetSteamID(_grabArea.GetLatestGrabber());
if ((Object)(object)PlayerAvatar.instance != (Object)(object)SemiFunc.PlayerAvatarGetFromSteamID(text))
{
return;
}
if (!_betManager.CanSetBet(text, LossMultiplier, count))
{
if (SemiFunc.PlayerGetSteamID(PlayerAvatar.instance) != text)
{
return;
}
ChatManager instance = ChatManager.instance;
if ((Object)(object)instance == (Object)null || !SemiFunc.IsMultiplayer())
{
return;
}
string text2 = "I'm too broke to bet — not enough " + _betManager.Type;
if (_betManager.Type == BetType.Money)
{
text2 = "No cash — no bet";
if (BetManager.DepositedMoney > SemiFunc.StatGetRunCurrency())
{
text2 = "I’m not betting my soul. Again";
}
}
instance.PossessChatScheduleStart(-1);
instance.PossessChat((PossessChatID)3, text2, 2f, Color.red, 0f, false, 0, (UnityEvent)null);
instance.PossessChatScheduleEnd();
}
else
{
string arg = SemiFunc.PlayerGetName(SemiFunc.PlayerAvatarGetFromSteamID(text));
string text3 = $"{arg} <color=red>bet</color> <color=green>{count * LossMultiplier} {_betManager.Type.ToString()}" + (_isRoulette ? (" to " + ((Object)((Component)this).gameObject).name + "</color><sprite=6><sprite=1>") : "");
if (_betManager.Type == BetType.Money)
{
text3 = $"{arg} <color=red>bet</color> <color=green>{count}k {_betManager.Type.ToString()}" + (_isRoulette ? (" to " + ((Object)((Component)this).gameObject).name + "</color> <sprite=6><sprite=1>") : "");
}
_tvManager.SpawnPrefab(text3);
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("SetBetRpcLocal", (RpcTarget)0, new object[3]
{
(int)_betManager.Type,
count,
text
});
}
else
{
SetBetRpcLocal((int)_betManager.Type, count, text);
}
}
}
[PunRPC]
private void SetBetRpcLocal(int type, int count, string steamID)
{
IsBetPlaced = true;
_chips.SetActive(true);
_audioSource.PlayOneShot(_chipsDrop);
BetArray[(BetType)type].Amounts.Add(count);
BetArray[(BetType)type].SteamIDs.Add(steamID);
if (type == 0)
{
BetManager.DepositedMoney += count;
_betManager.UpdateDepositText("Deposited " + BetManager.DepositedMoney + "k/" + SemiFunc.StatGetRunCurrency() + "k");
}
}
public void ResetBet()
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("ResetBetRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
ResetBetRpc();
}
}
[PunRPC]
public void ResetBetRpc()
{
IsBetPlaced = false;
_chips.SetActive(false);
BetArray.Clear();
BetManager.DepositedMoney = 0;
_betManager.UpdateDepositText("Deposited " + BetManager.DepositedMoney + "k/" + SemiFunc.StatGetRunCurrency() + "k");
}
}
public class BetEntry
{
public List<string> SteamIDs = new List<string>();
public List<int> Amounts = new List<int>();
public void Clear()
{
SteamIDs.Clear();
Amounts.Clear();
}
}
public class BetManager : MonoBehaviourPun
{
public static int DepositedMoney;
public PhysGrabObjectGrabArea ResetBets;
[SerializeField]
private TMP_Text _moneyCount;
[SerializeField]
private List<BetButton> _buttons = new List<BetButton>();
[SerializeField]
private List<Renderer> _buttonDep = new List<Renderer>();
[SerializeField]
private List<BetManager> _managers = new List<BetManager>();
[SerializeField]
private TvManager _tvManagaer;
public bool IsGameStarted;
private StatsManager statsManager;
public BetType Type { get; private set; }
public int Count { get; private set; } = 1;
[field: SerializeField]
public TMP_Text DepositedMoneyText { get; private set; }
private void Awake()
{
statsManager = StatsManager.instance;
_managers.AddRange(Object.FindObjectsOfType<BetManager>());
SetType(0);
}
public void AddMoney()
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("AddMoneyRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
AddMoneyRpc();
}
}
public void UpdateDepositText(string text)
{
_managers.ForEach(delegate(BetManager m)
{
m.UpdateDepositText2(text);
});
}
private void UpdateDepositText2(string text)
{
DepositedMoneyText.text = text;
}
[PunRPC]
private void AddMoneyRpc()
{
if (Count != 1000000)
{
if (Count < 10)
{
Count++;
}
else if (Count < 100 && Count < 1000)
{
Count += 10;
}
else if (Count < 1000 && Count < 100000)
{
Count += 100;
}
else if (Count < 10000 && Count < 100000)
{
Count += 1000;
}
else if (Count < 100000 && Count < 1000000)
{
Count += 10000;
}
_moneyCount.text = Count + "k";
}
}
public void RemoveMoney()
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("RemoveMoneyRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
RemoveMoneyRpc();
}
}
[PunRPC]
private void RemoveMoneyRpc()
{
if (Count != 0)
{
if (Count <= 10)
{
Count--;
}
else if (Count <= 100)
{
Count -= 10;
}
else if (Count <= 1000)
{
Count -= 100;
}
else if (Count <= 10000)
{
Count -= 1000;
}
else if (Count <= 100000)
{
Count -= 10000;
}
_moneyCount.text = Count + "k";
}
}
public void SetType(int type)
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("SetTypeRpc", (RpcTarget)0, new object[1] { type });
}
else
{
SetTypeRpc(type);
}
}
[PunRPC]
private void SetTypeRpc(int type)
{
//IL_0039: 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_0069: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)PlayerAvatar.instance != (Object)(object)((Component)_buttonDep[type]).GetComponent<PhysGrabObjectGrabArea>().GetLatestGrabber()))
{
_buttonDep[(int)Type].material.color = Color.white;
_buttonDep[type].material.color = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)165, (byte)0, byte.MaxValue));
Type = (BetType)type;
}
}
public int GetCount()
{
if (Type == BetType.Money)
{
return Count;
}
return 1;
}
public bool CanSetBet(string steamID, int lossMultiplier, int count)
{
return Type switch
{
BetType.Money => DepositedMoney + count <= SemiFunc.StatGetRunCurrency(),
BetType.Energy => statsManager.playerUpgradeStamina[steamID] - SumBetUpgrade(BetType.Energy, steamID) >= lossMultiplier,
BetType.ExtraJump => statsManager.playerUpgradeExtraJump[steamID] - SumBetUpgrade(BetType.ExtraJump, steamID) >= lossMultiplier,
BetType.GrabRange => statsManager.playerUpgradeRange[steamID] - SumBetUpgrade(BetType.GrabRange, steamID) >= lossMultiplier,
BetType.GrabStrength => statsManager.playerUpgradeStrength[steamID] - SumBetUpgrade(BetType.GrabStrength, steamID) >= lossMultiplier,
BetType.Health => statsManager.playerUpgradeHealth[steamID] - SumBetUpgrade(BetType.Health, steamID) >= lossMultiplier,
BetType.SprintSpeed => statsManager.playerUpgradeSpeed[steamID] - SumBetUpgrade(BetType.SprintSpeed, steamID) >= lossMultiplier,
BetType.TumbleLaunch => statsManager.playerUpgradeLaunch[steamID] - SumBetUpgrade(BetType.TumbleLaunch, steamID) >= lossMultiplier,
BetType.TumbleWings => statsManager.playerUpgradeTumbleWings[steamID] - SumBetUpgrade(BetType.TumbleWings, steamID) >= lossMultiplier,
BetType.CrouchRest => statsManager.playerUpgradeCrouchRest[steamID] - SumBetUpgrade(BetType.CrouchRest, steamID) >= lossMultiplier,
_ => false,
};
}
private int SumBetUpgrade(BetType betType, string steamID)
{
int num = 0;
foreach (BetButton button in _buttons)
{
if (!button.IsBetPlaced)
{
continue;
}
List<string> steamIDs = button.BetArray[betType].SteamIDs;
List<int> amounts = button.BetArray[betType].Amounts;
for (int i = 0; i < steamIDs.Count; i++)
{
if (steamIDs[i] == steamID)
{
num += amounts[i] * button.LossMultiplier;
}
}
}
return num;
}
public void CalculatePrize(int number)
{
Dictionary<string, Dictionary<BetType, int>> dictionary = new Dictionary<string, Dictionary<BetType, int>>();
Dictionary<string, Dictionary<BetType, int>> dictionary2 = new Dictionary<string, Dictionary<BetType, int>>();
foreach (BetButton button in _buttons)
{
if (!button.IsBetPlaced)
{
continue;
}
bool flag = button.WinningNumbers.Contains(number);
int num = button.BetArray[BetType.Money].Amounts.Sum();
if (flag)
{
int num2 = num * button.PayoutMultiplier;
SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() + num2);
}
else
{
int num3 = num;
SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() - num3);
}
for (int i = 0; i < 10; i++)
{
BetType betType = (BetType)i;
List<string> steamIDs = button.BetArray[betType].SteamIDs;
List<int> amounts = button.BetArray[betType].Amounts;
foreach (KeyValuePair<string, int> item in (from x in steamIDs.Select((string steamID, int index) => new
{
steamID = steamID,
amount = amounts[index]
})
group x by x.steamID).ToDictionary(g => g.Key, g => g.Sum(x => x.amount)))
{
string key = item.Key;
int value = item.Value;
int num4 = (flag ? (value * button.PayoutMultiplier) : ((betType == BetType.Money) ? value : (value * button.LossMultiplier)));
Dictionary<string, Dictionary<BetType, int>> dictionary3 = (flag ? dictionary : dictionary2);
if (!dictionary3.ContainsKey(key))
{
dictionary3[key] = new Dictionary<BetType, int>();
}
if (dictionary3[key].ContainsKey(betType))
{
dictionary3[key][betType] += num4;
}
else
{
dictionary3[key][betType] = num4;
}
if (SemiFunc.IsMultiplayer())
{
string text = (flag ? "ApplyUpgrade" : "DowngradeUpgrade");
((MonoBehaviourPun)this).photonView.RPC(text, (RpcTarget)0, new object[3] { i, key, num4 });
}
else if (flag)
{
ApplyUpgrade(i, key, num4);
}
else
{
DowngradeUpgrade(i, key, num4);
}
}
}
}
_tvManagaer.SpawnPrefab($"<color=blue>Roulette landed on: {number}");
SendBetMessages(dictionary, "<color=green>won! Payout:", "<sprite=20><sprite=124>");
SendBetMessages(dictionary2, "<color=red>lost", "<sprite=21><sprite=25>");
void SendBetMessages(Dictionary<string, Dictionary<BetType, int>> bets, string messagePrefix, string extra)
{
foreach (KeyValuePair<string, Dictionary<BetType, int>> bet in bets)
{
string text2 = SemiFunc.PlayerGetName(SemiFunc.PlayerAvatarGetFromSteamID(bet.Key));
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(text2 + " " + messagePrefix);
foreach (KeyValuePair<BetType, int> item2 in bet.Value)
{
if (item2.Key == BetType.Money)
{
stringBuilder.Append($" {item2.Value}k {item2.Key},");
}
else
{
stringBuilder.Append($" {item2.Value} {item2.Key},");
}
}
if (stringBuilder.Length > 0)
{
stringBuilder.Length--;
}
_tvManagaer.SpawnPrefab(stringBuilder.ToString() + extra);
}
}
}
public void CalculatePrizeBlackJack(CardSpawn cardSpawn, int number)
{
Dictionary<string, Dictionary<BetType, int>> dictionary = new Dictionary<string, Dictionary<BetType, int>>();
Dictionary<string, Dictionary<BetType, int>> dictionary2 = new Dictionary<string, Dictionary<BetType, int>>();
BetButton button = cardSpawn.Button;
if (!button.IsBetPlaced)
{
return;
}
bool flag = IsPlayerWin(cardSpawn.AllPoints, number);
if (!flag)
{
flag = IsPlayerWin(cardSpawn.AllAcePoints, number);
}
if ((cardSpawn.Points == number && cardSpawn.Points <= 21) || (cardSpawn.AcePoints == number && cardSpawn.AcePoints <= 21))
{
string text = SemiFunc.PlayerGetName(cardSpawn.Avatar);
_tvManagaer.SpawnPrefab(text + " draw, bets were returned");
return;
}
if (cardSpawn.IsLose)
{
flag = false;
}
int num = button.BetArray[BetType.Money].Amounts.Sum();
if (flag)
{
int num2 = num * button.PayoutMultiplier;
SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() + num2);
}
else
{
int num3 = num;
SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() - num3);
}
for (int i = 0; i < 10; i++)
{
BetType betType = (BetType)i;
List<string> steamIDs = button.BetArray[betType].SteamIDs;
List<int> amounts = button.BetArray[betType].Amounts;
foreach (KeyValuePair<string, int> item in (from x in steamIDs.Select((string steamID, int index) => new
{
steamID = steamID,
amount = amounts[index]
})
group x by x.steamID).ToDictionary(g => g.Key, g => g.Sum(x => x.amount)))
{
string key = item.Key;
int value = item.Value;
int num4 = (flag ? (value * button.PayoutMultiplier) : ((betType == BetType.Money) ? value : (value * button.LossMultiplier)));
Dictionary<string, Dictionary<BetType, int>> dictionary3 = (flag ? dictionary : dictionary2);
if (!dictionary3.ContainsKey(key))
{
dictionary3[key] = new Dictionary<BetType, int>();
}
if (dictionary3[key].ContainsKey(betType))
{
dictionary3[key][betType] += num4;
}
else
{
dictionary3[key][betType] = num4;
}
if (SemiFunc.IsMultiplayer())
{
string text2 = (flag ? "ApplyUpgrade" : "DowngradeUpgrade");
((MonoBehaviourPun)this).photonView.RPC(text2, (RpcTarget)0, new object[3] { i, key, num4 });
}
else if (flag)
{
ApplyUpgrade(i, key, num4);
}
else
{
DowngradeUpgrade(i, key, num4);
}
}
}
SendBetMessages(dictionary, "<color=green>won! Payout:", "<sprite=20><sprite=124>");
SendBetMessages(dictionary2, "<color=red>lost", "<sprite=21><sprite=25>");
void SendBetMessages(Dictionary<string, Dictionary<BetType, int>> bets, string messagePrefix, string extra)
{
foreach (KeyValuePair<string, Dictionary<BetType, int>> bet in bets)
{
string text3 = SemiFunc.PlayerGetName(SemiFunc.PlayerAvatarGetFromSteamID(bet.Key));
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.Append(text3 + " " + messagePrefix);
foreach (KeyValuePair<BetType, int> item2 in bet.Value)
{
if (item2.Key == BetType.Money)
{
stringBuilder.Append($" {item2.Value}k {item2.Key},");
}
else
{
stringBuilder.Append($" {item2.Value} {item2.Key},");
}
}
if (stringBuilder.Length > 0)
{
stringBuilder.Length--;
}
_tvManagaer.SpawnPrefab(stringBuilder.ToString() + extra);
}
}
}
private bool IsPlayerWin(int playerPoints, int dealerPoints)
{
bool num = playerPoints <= 21;
bool flag = dealerPoints > 21;
bool flag2 = playerPoints > dealerPoints;
if (num)
{
return flag || flag2;
}
return false;
}
[PunRPC]
public void ApplyUpgrade(int betType, string steamID, int count)
{
if (betType == 0)
{
return;
}
for (int i = 0; i < count; i++)
{
switch (betType)
{
case 1:
PunManager.instance.UpgradePlayerEnergy(steamID);
break;
case 2:
PunManager.instance.UpgradePlayerExtraJump(steamID);
break;
case 3:
PunManager.instance.UpgradePlayerGrabRange(steamID);
break;
case 4:
PunManager.instance.UpgradePlayerGrabStrength(steamID);
break;
case 5:
PunManager.instance.UpgradePlayerHealth(steamID);
break;
case 6:
PunManager.instance.UpgradePlayerSprintSpeed(steamID);
break;
case 7:
PunManager.instance.UpgradePlayerTumbleLaunch(steamID);
break;
case 8:
PunManager.instance.UpgradePlayerTumbleWings(steamID);
break;
case 9:
PunManager.instance.UpgradePlayerCrouchRest(steamID);
break;
}
}
}
[PunRPC]
public void DowngradeUpgrade(int betType, string steamID, int count)
{
for (int i = 0; i < count; i++)
{
switch (betType)
{
case 1:
DowngradePlayerEnergy(steamID);
break;
case 2:
DowngradePlayerExtraJump(steamID);
break;
case 3:
DowngradePlayerGrabRange(steamID);
break;
case 4:
DowngradePlayerGrabStrength(steamID);
break;
case 5:
DowngradePlayerHealth(steamID);
break;
case 6:
DowngradePlayerSprintSpeed(steamID);
break;
case 7:
DowngradePlayerTumbleLaunch(steamID);
break;
case 8:
DowngradePlayerTumbleWings(steamID);
break;
case 9:
DowngradePlayerCrouchRest(steamID);
break;
}
}
}
public void Reset()
{
if (!IsGameStarted)
{
_buttons.ForEach(delegate(BetButton b)
{
b.ResetBet();
});
}
}
public int DowngradePlayerHealth(string _steamID)
{
statsManager.playerUpgradeHealth[_steamID]--;
UpdateHealthOnDowngrade(_steamID);
return statsManager.playerUpgradeHealth[_steamID];
}
private void UpdateHealthOnDowngrade(string _steamID)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerHealth), "maxHealth");
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(_steamID);
if ((Object)(object)val == (Object)(object)SemiFunc.PlayerAvatarLocal())
{
fieldInfo.SetValue(val.playerHealth, Convert.ToInt32(fieldInfo.GetValue(val.playerHealth)) - 20);
val.playerHealth.Hurt(20, false, -1);
}
}
public int DowngradePlayerEnergy(string _steamID)
{
statsManager.playerUpgradeStamina[_steamID]--;
UpdateEnergyOnDowngrade(_steamID);
return statsManager.playerUpgradeStamina[_steamID];
}
private void UpdateEnergyOnDowngrade(string _steamID)
{
if ((Object)(object)SemiFunc.PlayerAvatarGetFromSteamID(_steamID) == (Object)(object)SemiFunc.PlayerAvatarLocal())
{
PlayerController instance = PlayerController.instance;
instance.EnergyStart -= 10f;
PlayerController.instance.EnergyCurrent = Mathf.Min(PlayerController.instance.EnergyCurrent, PlayerController.instance.EnergyStart);
}
}
public int DowngradePlayerExtraJump(string _steamID)
{
statsManager.playerUpgradeExtraJump[_steamID]--;
UpdateExtraJumpOnDowngrade(_steamID);
return statsManager.playerUpgradeExtraJump[_steamID];
}
private void UpdateExtraJumpOnDowngrade(string _steamID)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerController), "JumpExtra");
if ((Object)(object)SemiFunc.PlayerAvatarGetFromSteamID(_steamID) == (Object)(object)SemiFunc.PlayerAvatarLocal())
{
fieldInfo.SetValue(PlayerController.instance, Convert.ToInt32(fieldInfo.GetValue(PlayerController.instance)) - 1);
}
}
public int DowngradePlayerTumbleLaunch(string _steamID)
{
statsManager.playerUpgradeLaunch[_steamID]--;
UpdateTumbleLaunchOnDowngrade(_steamID);
return statsManager.playerUpgradeLaunch[_steamID];
}
private void UpdateTumbleLaunchOnDowngrade(string _steamID)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerTumble), "tumbleLaunch");
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(_steamID);
if (Object.op_Implicit((Object)(object)val))
{
fieldInfo.SetValue(val.tumble, Convert.ToInt32(fieldInfo.GetValue(val.tumble)) - 1);
}
}
public int DowngradePlayerTumbleWings(string _steamID)
{
statsManager.playerUpgradeTumbleWings[_steamID]--;
UpdateTumbleWingsOnDowngrade(_steamID);
return statsManager.playerUpgradeTumbleWings[_steamID];
}
private void UpdateTumbleWingsOnDowngrade(string _steamID)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerAvatar), "upgradeTumbleWings");
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(_steamID);
if (Object.op_Implicit((Object)(object)val))
{
fieldInfo.SetValue(val, float.Parse(fieldInfo.GetValue(val).ToString()) - 1f);
}
}
public int DowngradePlayerSprintSpeed(string _steamID)
{
statsManager.playerUpgradeSpeed[_steamID]--;
UpdateSprintSpeedOnDowngrade(_steamID);
return statsManager.playerUpgradeSpeed[_steamID];
}
private void UpdateSprintSpeedOnDowngrade(string _steamID)
{
if ((Object)(object)SemiFunc.PlayerAvatarGetFromSteamID(_steamID) == (Object)(object)SemiFunc.PlayerAvatarLocal())
{
PlayerController instance = PlayerController.instance;
instance.SprintSpeed -= 1f;
PlayerController instance2 = PlayerController.instance;
instance2.SprintSpeedUpgrades -= 1f;
}
}
public int DowngradePlayerCrouchRest(string _steamID)
{
statsManager.playerUpgradeCrouchRest[_steamID]--;
UpdateCrouchRestOnDowngrade(_steamID);
return statsManager.playerUpgradeCrouchRest[_steamID];
}
private void UpdateCrouchRestOnDowngrade(string _steamID)
{
if ((Object)(object)SemiFunc.PlayerAvatarGetFromSteamID(_steamID) == (Object)(object)SemiFunc.PlayerAvatarLocal())
{
FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerAvatar), "upgradeCrouchRest");
fieldInfo.SetValue(PlayerAvatar.instance, float.Parse(fieldInfo.GetValue(PlayerAvatar.instance).ToString()) - 1f);
}
}
public int DowngradePlayerGrabStrength(string _steamID)
{
statsManager.playerUpgradeStrength[_steamID]--;
UpdateGrabStrengthOnDowngrade(_steamID);
return statsManager.playerUpgradeStrength[_steamID];
}
private void UpdateGrabStrengthOnDowngrade(string _steamID)
{
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(_steamID);
if (Object.op_Implicit((Object)(object)val))
{
PhysGrabber physGrabber = val.physGrabber;
physGrabber.grabStrength -= 0.2f;
}
}
public int DowngradePlayerGrabRange(string _steamID)
{
statsManager.playerUpgradeRange[_steamID]--;
UpdateGrabRangeOnDowngrade(_steamID);
return statsManager.playerUpgradeRange[_steamID];
}
private void UpdateGrabRangeOnDowngrade(string _steamID)
{
PlayerAvatar val = SemiFunc.PlayerAvatarGetFromSteamID(_steamID);
if (Object.op_Implicit((Object)(object)val))
{
PhysGrabber physGrabber = val.physGrabber;
physGrabber.grabRange -= 1f;
}
}
}
public class BetText : MonoBehaviourPun
{
[PunRPC]
public void SetupRpc(string text, int parentViewId)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
PhotonView val = PhotonView.Find(parentViewId);
((Component)this).transform.SetParent(((Component)val).transform);
((Component)this).transform.localPosition = Vector3.zero;
((Component)this).transform.localScale = Vector3.one;
((Component)this).transform.localRotation = Quaternion.identity;
((Component)this).GetComponent<TMP_Text>().text = text;
((Component)this).gameObject.SetActive(false);
((Component)this).gameObject.SetActive(true);
}
public void Setup(string text, Transform parent)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.SetParent(parent);
((Component)this).transform.localPosition = Vector3.zero;
((Component)this).transform.localScale = Vector3.one;
((Component)this).transform.localRotation = Quaternion.identity;
((Component)this).GetComponent<TMP_Text>().text = text;
((Component)this).gameObject.SetActive(false);
((Component)this).gameObject.SetActive(true);
}
}
public class BlackJack : MonoBehaviourPun
{
public List<CardSpawn> CardSpawns = new List<CardSpawn>();
[SerializeField]
private TvManager _tvManager;
[SerializeField]
private BetManager _betManager;
[SerializeField]
private CardSpawn _dealerCardSpawn;
[SerializeField]
private List<Card> _originalCards = new List<Card>();
[SerializeField]
private AudioSource _cardSpawnPoint;
[SerializeField]
private AudioClip _hitClip;
[SerializeField]
private AudioClip _flipClip;
private List<Card> _cards = new List<Card>();
public static BlackJack Instance { get; private set; }
public bool IsGameStarted { get; private set; }
private void Awake()
{
foreach (Card originalCard in _originalCards)
{
NetworkPrefabs.RegisterNetworkPrefab(((Object)originalCard).name, ((Component)originalCard).gameObject);
}
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
}
public void StartGame()
{
if (!IsGameStarted)
{
_tvManager.IsGameStarted = true;
_betManager.IsGameStarted = true;
_tvManager.SpawnPrefab("<color=red>Game Started!</color><sprite=38>");
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("StartGameRpc", (RpcTarget)2, Array.Empty<object>());
}
else
{
StartGameRpc();
}
}
}
[PunRPC]
private void StartGameRpc()
{
_cards.Clear();
IsGameStarted = true;
for (int i = 0; i < 5; i++)
{
_cards.AddRange(_originalCards);
}
SetupDealer();
SetupPlayers();
if (!CardSpawns.Any((CardSpawn c) => c.IsOccupied))
{
Calculate();
}
}
private void SetupDealer()
{
List<Card> list = new List<Card>();
for (int i = 0; i < 2; i++)
{
Card card = _cards[Random.Range(0, _cards.Count)];
_cards.Remove(card);
list.Add(card);
if (i == 0)
{
_tvManager.SpawnPrefab("<color=red>Dealer</color> <color=green>hits card — " + card.Points + (card.IsAce ? "(1)" : "") + " points, total: " + card.Points + (card.IsAce ? "(1)" : "") + "</color>");
}
CardIssuance(card, _dealerCardSpawn);
}
if ((list[0].Points == 10 || list[0].IsAce) && list[0].Points + list[1].Points == 21)
{
((MonoBehaviour)this).StartCoroutine(SetupCoroutine(_dealerCardSpawn));
_tvManager.SpawnPrefab("<color=red>Blackjack for the dealer! Tough luck</color><sprite=70>");
}
((MonoBehaviour)this).StartCoroutine(SetupCoroutine(_dealerCardSpawn));
}
private IEnumerator SetupCoroutine(CardSpawn cardSpawn)
{
yield return (object)new WaitForSeconds(1f);
cardSpawn.FlipOldestCard();
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("SetupRpc", (RpcTarget)0, new object[1] { ((Component)cardSpawn).GetComponent<PhotonView>().ViewID });
}
else
{
SetupLocal(cardSpawn);
}
}
[PunRPC]
private void SetupRpc(int cardSpawnId)
{
((Component)PhotonView.Find(cardSpawnId)).GetComponent<AudioSource>().PlayOneShot(_flipClip);
}
private void SetupLocal(CardSpawn cardSpawn)
{
cardSpawn.AudioSource.PlayOneShot(_flipClip);
}
private void SetupPlayers()
{
foreach (CardSpawn cardSpawn in CardSpawns)
{
if (cardSpawn.IsOccupied)
{
for (int i = 0; i < 2; i++)
{
Card card = _cards[Random.Range(0, _cards.Count)];
_cards.Remove(card);
CardIssuance(card, cardSpawn);
((MonoBehaviour)this).StartCoroutine(SetupCoroutine(cardSpawn));
_tvManager.SpawnPrefab("<color=green>" + SemiFunc.PlayerGetName(cardSpawn.Avatar) + " hits card - " + card.Points + (card.IsAce ? "(1)" : "") + " points, total: " + cardSpawn.AllPoints + $"({cardSpawn.AllAcePoints})" + "</color>");
}
}
}
}
private void CardIssuance(Card card, CardSpawn cardSpawn)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
GameObject val = NetworkPrefabs.SpawnNetworkPrefab(((Object)card).name, ((Component)_cardSpawnPoint).transform.position, ((Component)_cardSpawnPoint).transform.rotation, (byte)0, (object[])null);
cardSpawn.SetCard(val.GetComponent<PhotonView>().ViewID, val.GetComponent<Card>());
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("CardIssuanceRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
CardIssuanceRpc();
}
}
[PunRPC]
private void CardIssuanceRpc()
{
_cardSpawnPoint.PlayOneShot(_hitClip);
}
public void Hit(CardSpawn cardSpawn)
{
if (IsGameStarted && cardSpawn.CanMove && !((Object)(object)cardSpawn.Avatar != (Object)(object)cardSpawn.Hit.GetLatestGrabber()))
{
Card card = _cards[Random.Range(0, _cards.Count)];
_cards.Remove(card);
CardIssuance(card, cardSpawn);
((MonoBehaviour)this).StartCoroutine(SetupCoroutine(cardSpawn));
_tvManager.SpawnPrefab(SemiFunc.PlayerGetName(cardSpawn.Avatar) + " <color=green>called for a hit, hits card - " + card.Points + (card.IsAce ? "(1)" : "") + ", total: " + cardSpawn.AllPoints + $"({cardSpawn.AllAcePoints})" + "</color><sprite=89>");
Calculate();
}
}
public void Stand(CardSpawn cardSpawn)
{
if (IsGameStarted && cardSpawn.CanMove && !((Object)(object)cardSpawn.Avatar != (Object)(object)cardSpawn.Stand.GetLatestGrabber()))
{
cardSpawn.CanMove = false;
_tvManager.SpawnPrefab(SemiFunc.PlayerGetName(cardSpawn.Avatar) + " didn't bet this round<sprite=93>");
Calculate();
}
}
public void Double(CardSpawn cardSpawn)
{
if (!IsGameStarted || !cardSpawn.CanMove || (Object)(object)cardSpawn.Avatar != (Object)(object)cardSpawn.Double.GetLatestGrabber())
{
return;
}
bool flag = true;
for (int i = 0; i < 10; i++)
{
if (!_betManager.CanSetBet(SemiFunc.PlayerGetSteamID(cardSpawn.Avatar), cardSpawn.Button.LossMultiplier, cardSpawn.Button.BetArray[(BetType)i].Amounts.Sum()))
{
flag = false;
break;
}
}
if (!flag)
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("DoubleRpc", (RpcTarget)0, new object[1] { ((Component)cardSpawn).GetComponent<PhotonView>().ViewID });
}
return;
}
for (int j = 0; j < 10; j++)
{
for (int k = 0; k < cardSpawn.Button.BetArray[(BetType)j].Amounts.Count; k++)
{
cardSpawn.Button.BetArray[(BetType)j].Amounts[k] = cardSpawn.Button.BetArray[(BetType)j].Amounts[k] * 2;
}
}
Card card = _cards[Random.Range(0, _cards.Count)];
_cards.Remove(card);
CardIssuance(card, cardSpawn);
((MonoBehaviour)this).StartCoroutine(SetupCoroutine(cardSpawn));
cardSpawn.CanMove = false;
_tvManager.SpawnPrefab(SemiFunc.PlayerGetName(cardSpawn.Avatar) + " <color=green>doubled their bets!</color><sprite=26>");
Calculate();
}
[PunRPC]
private void DoubleRpc(int cardSpawnID)
{
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Component)PhotonView.Find(cardSpawnID)).GetComponent<CardSpawn>().Avatar != (Object)(object)PlayerAvatar.instance)
{
return;
}
ChatManager instance = ChatManager.instance;
if (!((Object)(object)instance == (Object)null) && SemiFunc.IsMultiplayer())
{
string text = "I'm too broke to double bet not enough " + _betManager.Type;
if (_betManager.Type == BetType.Money)
{
text = "I'm not betting my soul. Again";
}
instance.PossessChatScheduleStart(-1);
instance.PossessChat((PossessChatID)3, text, 2f, Color.red, 0f, false, 0, (UnityEvent)null);
instance.PossessChatScheduleEnd();
}
}
private void Calculate()
{
foreach (CardSpawn cardSpawn in CardSpawns)
{
if (!cardSpawn.IsOccupied)
{
cardSpawn.IsLose = true;
cardSpawn.CanMove = false;
}
else if (!cardSpawn.IsLose && cardSpawn.AllPoints > 21 && cardSpawn.AllAcePoints > 21)
{
cardSpawn.IsLose = true;
cardSpawn.CanMove = false;
_betManager.CalculatePrizeBlackJack(cardSpawn, 0);
}
}
bool flag = false;
foreach (CardSpawn cardSpawn2 in CardSpawns)
{
if (cardSpawn2.CanMove)
{
flag = true;
break;
}
}
if (!flag)
{
((MonoBehaviour)this).StartCoroutine(CalculateCoroutine());
}
}
private IEnumerator CalculateCoroutine()
{
yield return ((MonoBehaviour)this).StartCoroutine(SetupCoroutine(_dealerCardSpawn));
_tvManager.SpawnPrefab("<color=red>Dealer shows card - " + _dealerCardSpawn.Cards[1].Points + (_dealerCardSpawn.Cards[1].IsAce ? "(1)" : "") + " points, total: " + _dealerCardSpawn.AllPoints + $"({_dealerCardSpawn.AllAcePoints})" + "</color>");
while (ShouldDealerHit())
{
yield return (object)new WaitForSeconds(2.5f);
Card card = _cards[Random.Range(0, _cards.Count)];
_cards.Remove(card);
CardIssuance(card, _dealerCardSpawn);
yield return ((MonoBehaviour)this).StartCoroutine(SetupCoroutine(_dealerCardSpawn));
_tvManager.SpawnPrefab("<color=red>Dealer hits card - " + card.Points + (card.IsAce ? "(1)" : "") + " points, total: " + _dealerCardSpawn.AllPoints + $"({_dealerCardSpawn.AllAcePoints})" + " </color>");
}
int number = ((_dealerCardSpawn.AllPoints <= 21) ? _dealerCardSpawn.AllPoints : _dealerCardSpawn.AllAcePoints);
foreach (CardSpawn cardSpawn in CardSpawns)
{
if (!cardSpawn.IsLose && cardSpawn.IsOccupied)
{
_betManager.CalculatePrizeBlackJack(cardSpawn, number);
}
}
yield return (object)new WaitForSeconds(2f);
IsGameStarted = false;
Reset();
}
private bool ShouldDealerHit()
{
return ((_dealerCardSpawn.AllPoints <= 21) ? _dealerCardSpawn.AllPoints : _dealerCardSpawn.AllAcePoints) < 17;
}
public void Reset()
{
if (!IsGameStarted)
{
_tvManager.IsGameStarted = false;
_betManager.IsGameStarted = false;
_dealerCardSpawn.Reset();
_betManager.Reset();
IsGameStarted = false;
CardSpawns.ForEach(delegate(CardSpawn c)
{
c.Reset();
});
}
}
}
public class Card : MonoBehaviourPun
{
[SerializeField]
public bool IsFlipped;
[SerializeField]
private Animator _animator;
[SerializeField]
private float _speed = 5f;
[SerializeField]
private float _snapThreshold = 0.01f;
private Vector3 _targetPosition;
private Quaternion _targetRotation;
private bool _isAnimating;
[field: SerializeField]
public int Points { get; private set; }
[field: SerializeField]
public bool IsAce { get; private set; }
public void Animate(Vector3 position, Quaternion rotation)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
_targetPosition = position;
_targetRotation = rotation;
_isAnimating = true;
}
public void Setup(Vector3 position, Quaternion rotation, int photonID)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
PhotonView val = PhotonView.Find(photonID);
((Component)this).transform.parent = ((Component)val).transform;
Animate(position, rotation);
}
public void SetupLocal(Vector3 position, Quaternion rotation, Transform parent)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.parent = parent;
Animate(position, rotation);
}
private void Update()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: 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)
if (_isAnimating)
{
float num = Vector3.Distance(((Component)this).transform.localPosition, _targetPosition);
float num2 = Quaternion.Angle(((Component)this).transform.localRotation, _targetRotation);
if (num < _snapThreshold && num2 < _snapThreshold)
{
((Component)this).transform.localPosition = _targetPosition;
((Component)this).transform.localRotation = _targetRotation;
_isAnimating = false;
}
else
{
((Component)this).transform.localPosition = Vector3.Lerp(((Component)this).transform.localPosition, _targetPosition, _speed * Time.deltaTime);
((Component)this).transform.localRotation = Quaternion.Lerp(((Component)this).transform.localRotation, _targetRotation, _speed * Time.deltaTime);
}
}
}
public void Flip()
{
_animator.Play("CardFlip");
IsFlipped = true;
}
}
public class CardSpawn : MonoBehaviourPun
{
public PlayerAvatar Avatar;
public BetButton Button;
public PhysGrabObjectGrabArea PhysGrabObjectGrabArea;
public PhysGrabObjectGrabArea Hit;
public PhysGrabObjectGrabArea Double;
public PhysGrabObjectGrabArea Stand;
public AudioSource AudioSource;
[SerializeField]
private TMP_Text _pointsText;
public List<Card> Cards = new List<Card>();
[SerializeField]
private GameObject _position;
[SerializeField]
private List<GameObject> _buttons = new List<GameObject>();
[SerializeField]
private Vector3 _offset;
public bool IsLose;
public bool CanMove = true;
[field: SerializeField]
public bool IsOccupied { get; private set; }
[field: SerializeField]
public bool IsDealer { get; private set; }
public int Points { get; private set; }
public int AcePoints { get; private set; }
public int AllPoints { get; private set; }
public int AllAcePoints { get; private set; }
public void Occupy()
{
if ((!IsOccupied || !((Object)(object)Avatar != (Object)(object)PhysGrabObjectGrabArea.GetLatestGrabber())) && !BlackJack.Instance.IsGameStarted)
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("OccupyRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
OccupyRpc();
}
Button.SetBet();
}
}
[PunRPC]
private void OccupyRpc()
{
IsOccupied = true;
_buttons.ForEach(delegate(GameObject b)
{
b.SetActive(true);
});
Avatar = PhysGrabObjectGrabArea.GetLatestGrabber();
}
public void SetCard(int cardID, Card card)
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("SetCardRpc", (RpcTarget)0, new object[1] { cardID });
}
else
{
SetCardLocal(card);
}
}
[PunRPC]
private void SetCardRpc(int cardID)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
Card component = ((Component)PhotonView.Find(cardID)).GetComponent<Card>();
Cards.Add(component);
component.Setup(Vector3.zero + (float)(Cards.Count - 1) * _offset, Quaternion.Euler(0f, 180f, 0f), _position.GetComponent<PhotonView>().ViewID);
Points = (from c in Cards
where c.IsFlipped
select c.Points).Sum();
AcePoints = (from c in Cards
where c.IsFlipped
select c.IsAce ? 1 : c.Points).Sum();
AllPoints = Cards.Select((Card c) => c.Points).Sum();
AllAcePoints = Cards.Select((Card c) => c.IsAce ? 1 : c.Points).Sum();
_pointsText.text = Points + " (" + AcePoints + ")";
}
private void SetCardLocal(Card card)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
Cards.Add(card);
card.SetupLocal(Vector3.zero + (float)(Cards.Count - 1) * _offset, Quaternion.Euler(0f, 180f, 0f), _position.transform);
Points = (from c in Cards
where c.IsFlipped
select c.Points).Sum();
AcePoints = (from c in Cards
where c.IsFlipped
select c.IsAce ? 1 : c.Points).Sum();
AllPoints = Cards.Select((Card c) => c.Points).Sum();
AllAcePoints = Cards.Select((Card c) => c.IsAce ? 1 : c.Points).Sum();
_pointsText.text = Points + " (" + AcePoints + ")";
}
public void FlipOldestCard()
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("FlipOldestCardRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
FlipOldestCardRpc();
}
}
[PunRPC]
private void FlipOldestCardRpc()
{
for (int i = 0; i < Cards.Count; i++)
{
if (!Cards[i].IsFlipped)
{
Cards[i].Flip();
Points = (from c in Cards
where c.IsFlipped
select c.Points).Sum();
AcePoints = (from c in Cards
where c.IsFlipped
select c.IsAce ? 1 : c.Points).Sum();
_pointsText.text = Points + " (" + AcePoints + ")";
break;
}
}
}
public void Reset()
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("ResetRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
ResetRpc();
}
}
[PunRPC]
private void ResetRpc()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
foreach (Card card in Cards)
{
((Component)card).transform.parent = null;
((Component)card).gameObject.SetActive(false);
((Component)card).transform.position = new Vector3(1488f, 1488f, 1488f);
}
Cards.Clear();
_buttons.ForEach(delegate(GameObject b)
{
b.SetActive(false);
});
_pointsText.text = "0";
CanMove = true;
IsOccupied = false;
Avatar = null;
IsLose = false;
Points = 0;
AcePoints = 0;
}
}
[HarmonyPatch(typeof(LevelGenerator), "Start")]
public class LevelGeneratorStartPatch
{
[HarmonyPostfix]
public static void Prefix()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.IsMasterClient || !SemiFunc.IsMultiplayer())
{
RunManager instance = RunManager.instance;
if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.levelCurrent != (Object)(object)instance.levelShop))
{
NetworkPrefabs.SpawnNetworkPrefab(((Object)RepoCasinoPlugin.Instance.Module).name, new Vector3(0f, 30f, 0f), Quaternion.identity, (byte)0, (object[])null);
}
}
}
}
public class MusicChanger : MonoBehaviourPun
{
[SerializeField]
private AudioSource _audioSource;
[SerializeField]
private List<AudioClip> _clips = new List<AudioClip>();
private int _currentIndex;
public void Change()
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("ChangeRpc", (RpcTarget)0, Array.Empty<object>());
return;
}
_currentIndex = (_currentIndex + 1) % _clips.Count;
_audioSource.clip = _clips[_currentIndex];
_audioSource.Play();
}
[PunRPC]
public void ChangeRpc()
{
_currentIndex = (_currentIndex + 1) % _clips.Count;
_audioSource.clip = _clips[_currentIndex];
_audioSource.Play();
}
}
[BepInPlugin("y_meny_IJJu3a.Casino", "RepoCasino", "1.0.0")]
public class RepoCasinoPlugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("y_meny_IJJu3a.Casino");
public AssetBundle Bundle { get; private set; }
public ManualLogSource _Logger { get; private set; }
public GameObject Module { get; private set; }
public static RepoCasinoPlugin Instance { get; private set; }
private void Awake()
{
_Logger = ((BaseUnityPlugin)this).Logger;
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
((BaseUnityPlugin)this).Logger.LogInfo((object)" ______ _ __ __ __");
((BaseUnityPlugin)this).Logger.LogInfo((object)" / ____/___ ______(_)___ ____ / / ____ ____ _____/ /__ ____/ /");
((BaseUnityPlugin)this).Logger.LogInfo((object)" / / / __ `/ ___/ / __ \\/ __ \\ / / / __ \\/ __ `/ __ / _ \\/ __ / ");
((BaseUnityPlugin)this).Logger.LogInfo((object)"/ /___/ /_/ (__ ) / / / / /_/ / / /___/ /_/ / /_/ / /_/ / __/ /_/ / ");
((BaseUnityPlugin)this).Logger.LogInfo((object)"\\____/\\__,_/____/_/_/ /_/\\____/ /_____/\\____/\\__,_/\\__,_/\\___/\\__,_/ ");
Bundle = LoadAssetBundle("repoCasino");
GameObject val = Bundle.LoadAsset<GameObject>("Module - Shop - Casino");
MeshRenderer[] componentsInChildren = val.GetComponentsInChildren<MeshRenderer>();
foreach (MeshRenderer val2 in componentsInChildren)
{
if (!(((Object)((Component)val2).gameObject).name == "Window Shop Glass"))
{
Shader val3 = Shader.Find(((Object)((Renderer)val2).material.shader).name);
if ((Object)(object)val3 != (Object)null)
{
((Renderer)val2).material.shader = val3;
}
}
}
Utilities.FixAudioMixerGroups(val);
NetworkPrefabs.RegisterNetworkPrefab(((Object)val).name, val);
Module = val;
harmony.PatchAll();
}
public void DestroyNetworkObject(GameObject gameObject)
{
PhotonNetwork.Destroy(gameObject);
}
private AssetBundle LoadAssetBundle(string name)
{
return AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), name));
}
}
public class ResetManager : MonoBehaviourPun
{
public static ResetManager Instance { get; private set; }
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
}
public void ResetBlackJack()
{
}
public void ResetRoulette()
{
}
}
public class Roulette : MonoBehaviourPun
{
[SerializeField]
private AudioSource _audioSource;
[SerializeField]
private Animator _rouletteAnimator;
[SerializeField]
private Animator _ballAnimator;
[SerializeField]
private BetManager _betManager;
[SerializeField]
private TvManager _tvManager;
[SerializeField]
private float _delay;
private int _number;
private float _timer;
public static Roulette Instance { get; private set; }
public bool IsSpinning { get; private set; }
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
}
private void Update()
{
if (_timer < _delay)
{
_timer += Time.deltaTime;
}
}
public void Spin()
{
if (!(_timer < _delay))
{
IsSpinning = false;
int num = Random.Range(0, 37);
_tvManager.IsGameStarted = true;
_betManager.IsGameStarted = true;
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("SpinRpc", (RpcTarget)0, new object[1] { num });
}
else
{
SpinRpc(num);
}
}
}
[PunRPC]
private void SpinRpc(int number)
{
IsSpinning = true;
_timer = 0f;
_rouletteAnimator.Rebind();
_rouletteAnimator.Update(0f);
_ballAnimator.Rebind();
_ballAnimator.Update(0f);
_rouletteAnimator.Play("RouletteSpin");
_ballAnimator.Play(number.ToString());
_audioSource.Play();
_number = number;
((MonoBehaviour)this).StartCoroutine(WaitPrize());
}
private IEnumerator WaitPrize()
{
yield return (object)new WaitForSeconds(8.5f);
if (SemiFunc.IsMasterClient() || !SemiFunc.IsMultiplayer())
{
_betManager.CalculatePrize(_number);
}
_tvManager.IsGameStarted = false;
_betManager.IsGameStarted = false;
_betManager.Reset();
IsSpinning = false;
}
}
public class SoundReactiveScale : MonoBehaviour
{
private AudioSource _audioSource;
private Vector3 _baseScale;
private float[] _samples = new float[64];
private float _currentAmplitude;
private float _scaleMultiplier = 0.2f;
private float _smoothing = 15f;
private void Start()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
_audioSource = ((Component)this).GetComponentInChildren<AudioSource>();
_baseScale = ((Component)this).transform.localScale;
}
private void Update()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
GetAmplitude();
Vector3 val = _baseScale + Vector3.one * _currentAmplitude * _scaleMultiplier;
((Component)this).transform.localScale = Vector3.Lerp(((Component)this).transform.localScale, val, Time.deltaTime * _smoothing);
}
private void GetAmplitude()
{
_audioSource.GetSpectrumData(_samples, 0, (FFTWindow)5);
float num = 0f;
float[] samples = _samples;
foreach (float num2 in samples)
{
if (num2 > num)
{
num = num2;
}
}
_currentAmplitude = num;
}
}
public class TeleportationTrigger : MonoBehaviour
{
[SerializeField]
private Transform _teleportPosition;
private void OnTriggerEnter(Collider collider)
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)collider == (Object)null))
{
PlayerController componentInParent = ((Component)collider).GetComponentInParent<PlayerController>();
Rigidbody val = ((Component)collider).GetComponent<Rigidbody>();
if ((Object)(object)val == (Object)null && (Object)(object)((Component)collider).transform.parent != (Object)null)
{
val = ((Component)collider).GetComponentInParent<Rigidbody>();
}
if ((Object)(object)val == (Object)null && ((Component)collider).transform.childCount > 0)
{
val = ((Component)collider).GetComponentInChildren<Rigidbody>();
}
Teleport(_teleportPosition.position, val, componentInParent);
}
}
private void Teleport(Vector3 position, Rigidbody rigidbody, PlayerController controller)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
if ((Object)(object)controller != (Object)null)
{
((Component)controller).gameObject.SetActive(false);
((Component)controller).transform.position = position;
((Component)controller).gameObject.SetActive(true);
CameraAim.Instance.AimTargetSoftSet(_teleportPosition.position + _teleportPosition.forward, 0.1f, 200f, 100f, ((Component)this).gameObject, 100);
}
if ((Object)(object)rigidbody != (Object)null)
{
rigidbody.position = position;
}
Physics.SyncTransforms();
}
}
public class TextSample : MonoBehaviourPun
{
}
public class TvManager : MonoBehaviourPun
{
[SerializeField]
private GameObject _textPrefab;
[SerializeField]
private Transform _parent;
[SerializeField]
private ScrollRect _scrollRect;
[SerializeField]
private List<GameObject> _textList = new List<GameObject>();
public bool IsGameStarted;
private void Awake()
{
NetworkPrefabs.RegisterNetworkPrefab(((Object)_textPrefab).name, _textPrefab);
}
private void LateUpdate()
{
Canvas.ForceUpdateCanvases();
_scrollRect.verticalNormalizedPosition = 0f;
Canvas.ForceUpdateCanvases();
}
public void SpawnPrefab(string text)
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("SpawnPrefabRpc", (RpcTarget)0, new object[1] { text });
}
else
{
SpawnPrefabRpc(text);
}
}
[PunRPC]
private void SpawnPrefabRpc(string text)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(_textPrefab, Vector3.zero, Quaternion.identity);
if (SemiFunc.IsMultiplayer())
{
_ = val.GetComponent<PhotonView>().ViewID;
val.GetComponent<BetText>().Setup(text, ((Component)_parent).transform);
_textList.Add(val);
}
else
{
val.GetComponent<BetText>().Setup(text, _parent);
_textList.Add(val);
}
}
public void Clear()
{
if (!IsGameStarted)
{
if (SemiFunc.IsMultiplayer())
{
((MonoBehaviourPun)this).photonView.RPC("ClearRpc", (RpcTarget)0, Array.Empty<object>());
}
else
{
ClearRpc();
}
}
}
[PunRPC]
private void ClearRpc()
{
foreach (GameObject text in _textList)
{
Object.Destroy((Object)(object)text);
}
_textList.Clear();
}
}