using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Cryptography;
using System.Security.Permissions;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CoinFlip.Handlers;
using CoinFlip.Validators;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Photon.Pun;
using REPOLib.Commands;
using REPOLib.Modules;
using UnityEngine;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NotDrunkJustHigh")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a1b778bfdca6aa3daa7ebb9c1d7b99ea96fb668c")]
[assembly: AssemblyProduct("Coinflip")]
[assembly: AssemblyTitle("Coinflip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 CoinFlip
{
[BepInPlugin("NotDrunkJustHigh.Coinflip", "Coinflip", "2.0.0")]
public class Coinflip : BaseUnityPlugin
{
public static NetworkedEvent HandleCoinFlipResultEvent;
private static NetworkedEvent SyncConfigEvent;
public static NetworkedEvent UpgradeFlipEvent;
private float _configSyncTimer = 0f;
private const float CONFIG_SYNC_INTERVAL = 10f;
internal static Coinflip Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
public static bool ShopOnly { get; set; }
public static int MaxBetAmount { get; set; }
public static int MinBetAmount { get; set; }
public static bool TaxEnabled { get; set; }
public static float TaxAmount { get; set; }
public static bool SuperFlipEnabled { get; set; }
public static int SuperFlipMax { get; set; }
public static float SuperFlipMultiplier { get; set; }
private void Awake()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
Instance = this;
SetupConfig();
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
HandleCoinFlipResultEvent = new NetworkedEvent("Handle CoinFlip Result", (Action<EventData>)RPC_AddOrRemoveMoney);
SyncConfigEvent = new NetworkedEvent("SyncConfig", (Action<EventData>)RPC_SyncConfig);
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
if (PhotonNetwork.IsMasterClient && SemiFunc.RunIsShop())
{
_configSyncTimer += Time.deltaTime;
if (_configSyncTimer >= 10f)
{
_configSyncTimer = 0f;
RPC_ConfigSyncData rPC_ConfigSyncData = new RPC_ConfigSyncData
{
ShopOnly = ShopOnly,
MaxBetAmount = MaxBetAmount,
MinBetAmount = MinBetAmount,
TaxEnabled = TaxEnabled,
TaxAmount = TaxAmount,
SuperFlipEnabled = SuperFlipEnabled,
SuperFlipMax = SuperFlipMax,
SuperFlipMultiplier = SuperFlipMultiplier
};
string text = JsonConvert.SerializeObject((object)rPC_ConfigSyncData);
SyncConfigEvent.RaiseEvent((object)text, NetworkingEvents.RaiseOthers, SendOptions.SendUnreliable);
Logger.LogDebug((object)"[CoinFlip] Sent config sync to all clients");
}
}
}
public void SetupConfig()
{
ConfigEntry<bool> shopOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Shop Only", true, "Whether you can flip coins only within the shop");
shopOnly.SettingChanged += delegate
{
ShopOnly = shopOnly.Value;
};
ShopOnly = shopOnly.Value;
ConfigEntry<int> maxBetAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Bet Limitations", "Max Bet Amount", 1000, "The maximum amount of money that can be bet. 1 is equal 1,000(100 would set a max of 100,000) ");
ConfigEntry<int> minBetAmount = ((BaseUnityPlugin)this).Config.Bind<int>("Bet Limitations", "Min Bet Amount", 1, "The minimum amount of money that can be bet. 1 is equal 1,000");
maxBetAmount.SettingChanged += delegate
{
MaxBetAmount = maxBetAmount.Value;
};
minBetAmount.SettingChanged += delegate
{
MinBetAmount = minBetAmount.Value;
};
MaxBetAmount = maxBetAmount.Value;
MinBetAmount = minBetAmount.Value;
ConfigEntry<bool> taxEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Taxes", "Tax Enabled", false, "Whether or not tax is enabled");
ConfigEntry<float> taxAmount = ((BaseUnityPlugin)this).Config.Bind<float>("Taxes", "Tax Amount", 0.1f, "The amount of money that is taxed on every win");
taxEnabled.SettingChanged += delegate
{
TaxEnabled = taxEnabled.Value;
};
taxAmount.SettingChanged += delegate
{
TaxAmount = taxAmount.Value;
};
TaxEnabled = taxEnabled.Value;
TaxAmount = taxAmount.Value;
ConfigEntry<bool> superFlipEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Super Flips", "Super Flips Enabled", true, "Whether or not super flips are enabled");
ConfigEntry<int> superFlipMax = ((BaseUnityPlugin)this).Config.Bind<int>("Super Flips", "Super Flips Max", 5, "The maximum amount of super flips that can be played");
ConfigEntry<float> superFlipMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Super Flips", "Super Flips Multiplier", 2.75f, "The multiplier per flip that is applied to the amount of money won on a super flip");
superFlipEnabled.SettingChanged += delegate
{
SuperFlipEnabled = superFlipEnabled.Value;
};
superFlipMax.SettingChanged += delegate
{
SuperFlipMax = superFlipMax.Value;
};
superFlipMultiplier.SettingChanged += delegate
{
SuperFlipMultiplier = superFlipMultiplier.Value;
};
SuperFlipEnabled = superFlipEnabled.Value;
SuperFlipMax = superFlipMax.Value;
SuperFlipMultiplier = superFlipMultiplier.Value;
}
public void RPC_AddOrRemoveMoney(EventData eventData)
{
Logger.LogDebug((object)"[CoinFlip] Received RPC to add or remove money.");
int sender = eventData.Sender;
if (!PhotonNetwork.IsMasterClient)
{
Logger.LogDebug((object)"[CoinFlip] Received RPC but we are not the host. Ignoring.");
return;
}
int num = SemiFunc.StatGetRunCurrency();
string[] array = ((string)eventData.CustomData).Split(' ');
int num2 = int.Parse(array[0]);
string text = array[1];
int num3 = num + ((text == "won") ? num2 : (-num2));
Logger.LogDebug((object)$"[CoinFlip] Received request to modify currency by {num2} from {sender} with action {text}.");
SemiFunc.StatSetRunCurrency(num3);
int num4 = SemiFunc.StatGetRunCurrency();
if (num3 != num4)
{
Logger.LogError((object)$"[CoinFlip] Currency was not updated correctly. Expected: {num3} | Actual: {num4}");
}
}
public void RPC_SyncConfig(EventData eventData)
{
Logger.LogDebug((object)"[CoinFlip] Received RPC to sync config.");
if (PhotonNetwork.IsMasterClient)
{
Logger.LogDebug((object)"[CoinFlip] Received RPC to sync config, but current client is host. Ignoring.");
return;
}
Logger.LogDebug((object)"[CoinFlip] Received RPC to sync config. Attempting to sync config...");
if (!(eventData.CustomData is string text))
{
Logger.LogError((object)"[CoinFlip] Received Config was null");
return;
}
RPC_ConfigSyncData rPC_ConfigSyncData = JsonConvert.DeserializeObject<RPC_ConfigSyncData>(text);
if (rPC_ConfigSyncData != null)
{
ShopOnly = rPC_ConfigSyncData.ShopOnly;
MaxBetAmount = rPC_ConfigSyncData.MaxBetAmount;
MinBetAmount = rPC_ConfigSyncData.MinBetAmount;
TaxEnabled = rPC_ConfigSyncData.TaxEnabled;
TaxAmount = rPC_ConfigSyncData.TaxAmount;
SuperFlipEnabled = rPC_ConfigSyncData.SuperFlipEnabled;
SuperFlipMax = rPC_ConfigSyncData.SuperFlipMax;
SuperFlipMultiplier = rPC_ConfigSyncData.SuperFlipMultiplier;
Logger.LogDebug((object)"[CoinFlip] Received and set Config successfully");
}
else
{
Logger.LogError((object)"[CoinFlip] Received Config could not be serialized");
}
}
}
public class RPC_ConfigSyncData
{
public bool ShopOnly { get; set; }
public int MaxBetAmount { get; set; }
public int MinBetAmount { get; set; }
public bool TaxEnabled { get; set; }
public float TaxAmount { get; set; }
public bool SuperFlipEnabled { get; set; }
public int SuperFlipMax { get; set; }
public float SuperFlipMultiplier { get; set; }
}
}
namespace CoinFlip.Validators
{
public static class LocationValidator
{
public static bool CanGambleInCurrentLocation()
{
if (Coinflip.ShopOnly && !SemiFunc.RunIsShop())
{
Coinflip.Logger.LogInfo((object)"[CoinFlip] Player is not in the shop and shop only gaming is enabled. Not continuing.");
return false;
}
Coinflip.Logger.LogInfo((object)"[CoinFlip] Player is in the shop. Continuing...");
return true;
}
}
}
namespace CoinFlip.Handlers
{
public static class CoinFlipMessenger
{
public static void SendIncorrectLocationMessage()
{
SendMessageWithRedEyes("I can only gamble in the shop!", sendInTaxManChat: false);
}
public static void SendWonMessage(int amount)
{
string message = FormatMessage(amount, won: true);
SendMessageWithGreenEyes(message, sendInTaxManChat: true);
}
public static void SendLostMessage(int amount)
{
string message = FormatMessage(amount, won: false);
SendMessageWithRedEyes(message, sendInTaxManChat: true);
}
private static string FormatMessage(int amount, bool won)
{
string arg = (won ? "won" : "lost");
if (amount >= 1000)
{
return $"I {arg} {amount} million from coin flipping";
}
return $"I {arg} {amount} thousand from coin flipping";
}
public static void SendMessageWithGreenEyes(string message, bool sendInTaxManChat)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
SendChatMessage(message, (PossessChatID)5, sendInTaxManChat, Color.green);
}
public static void SendMessageWithRedEyes(string message, bool sendInTaxManChat)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
SendChatMessage(message, (PossessChatID)3, sendInTaxManChat, Color.red);
}
public static void SendChatMessage(string message = "I forgot what I was going to say", PossessChatID possessChat = 3, bool sendInTaxmanChat = false, Color color = default(Color))
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
Coinflip.Logger.LogDebug((object)"[CoinFlip] Sending public chat message");
ChatManager.instance.PossessChatScheduleStart(-1);
ChatManager.instance.PossessChat(possessChat, message, 4f, color, 0f, sendInTaxmanChat, 0, (UnityEvent)null);
ChatManager.instance.PossessChatScheduleEnd();
}
}
public class CoinFlipper
{
public static bool FlipCoin()
{
return GenerateRandomBoolean();
}
public static (bool success, string message) SuperFlip(string totalSuperFlipsString, double initialMultiplier, out bool won, out double finalMultiplier)
{
if (!Coinflip.SuperFlipEnabled)
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] Super Flips are not enabled");
won = false;
finalMultiplier = 0.0;
return (false, "Super Flips are not enabled");
}
int? superFlipAmount;
(bool, string) result = BetValidator.TryParseSuperFlipAndValidateAmount(totalSuperFlipsString, out superFlipAmount);
if (!result.Item1)
{
Coinflip.Logger.LogDebug((object)("[CoinFlip] Super Flips amount was not valid. " + totalSuperFlipsString));
won = false;
finalMultiplier = 0.0;
return result;
}
double num = initialMultiplier;
double num2 = 1.0;
for (int i = 2; i < superFlipAmount; i++)
{
if (!FlipCoin())
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] User lost the CF.");
won = false;
finalMultiplier = 1.0;
return (true, string.Empty);
}
num2 /= 2.0;
num += initialMultiplier - initialMultiplier * (1.0 - num2);
}
Coinflip.Logger.LogDebug((object)"[CoinFlip] Coin was heads but player chose to flip tails.");
won = true;
finalMultiplier = num;
return (true, string.Empty);
}
private static bool GenerateRandomBoolean()
{
return (int)GenerateRandomPercentage(2) == 0;
}
private static float GenerateRandomPercentage(int maxNumber = 100)
{
using RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
byte[] array = new byte[1];
randomNumberGenerator.GetBytes(array);
return array[0] % maxNumber;
}
}
public static class CurrencyManager
{
public static int ProcessGambleResult(bool userWon, int amount, double superFlipMultiplier = 1.0)
{
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
int num = SemiFunc.StatGetRunCurrency();
amount = (int)((double)amount * superFlipMultiplier);
if (Coinflip.TaxEnabled && userWon)
{
float taxAmount = Coinflip.TaxAmount;
Coinflip.Logger.LogDebug((object)$"[CoinFlip] Tax enabled with a tax percent of {taxAmount}");
int num2 = (int)((float)amount * taxAmount);
amount -= num2;
Coinflip.Logger.LogDebug((object)$"[CoinFlip] Total Tax: {num2} | new amount: {amount}");
}
if (SemiFunc.IsMultiplayer())
{
if (PhotonNetwork.IsMasterClient)
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] User is host. modifying directly");
SemiFunc.StatSetRunCurrency(num + (userWon ? amount : (-amount)));
return amount;
}
Coinflip.Logger.LogInfo((object)"[CoinFlip] Sending handle CoinFlip result event to master client");
string arg = (userWon ? "won" : "lost");
string text = $"{amount} {arg}";
Coinflip.HandleCoinFlipResultEvent.RaiseEvent((object)text, NetworkingEvents.RaiseMasterClient, SendOptions.SendReliable);
return amount;
}
Coinflip.Logger.LogInfo((object)"[CoinFlip] Single player detected. Updating currency directly.");
SemiFunc.StatSetRunCurrency(num + (userWon ? amount : (-amount)));
return amount;
}
public static void ProcessUpgradeFlipResult(bool userWon, string type, int amount)
{
throw new NotImplementedException();
}
}
public static class BetValidator
{
private static bool AmountIsValid(int amount)
{
return amount <= Coinflip.MaxBetAmount && amount >= Coinflip.MinBetAmount;
}
private static bool UsersHaveEnoughMoney(int required)
{
return required <= SemiFunc.StatGetRunCurrency();
}
public static (bool success, string message) TryParseBetAmount(string betAmount, out int amount)
{
amount = 0;
if (betAmount.EndsWith('k'))
{
string text = betAmount;
string s = text.Substring(0, text.Length - 1);
if (int.TryParse(s, out var result))
{
amount = result;
}
}
else if (betAmount.EndsWith('m'))
{
string text = betAmount;
string s2 = text.Substring(0, text.Length - 1);
if (int.TryParse(s2, out var result2))
{
amount = result2 * 1000;
}
}
else
{
if (betAmount.Length < 4)
{
return (false, "I have to specify a valid amount. Like 1k or 1000");
}
if (int.TryParse(betAmount, out var result3))
{
amount = result3 / 1000;
}
}
if (!UsersHaveEnoughMoney(amount))
{
Coinflip.Logger.LogDebug((object)$"[CoinFlip] Amount: {amount} ActualAmount: {SemiFunc.StatGetRunCurrency()} | UsersHaveEnoughMoney: {UsersHaveEnoughMoney(amount)}");
return (false, "We don't have enough money to make that bet.");
}
if (!AmountIsValid(amount))
{
return (false, $"My bet must be between {Coinflip.MinBetAmount} and {Coinflip.MaxBetAmount}");
}
return (true, string.Empty);
}
public static (bool success, string message) TryParseCoinSide(string side, out bool isHeads)
{
string text = side.ToLower();
if ((text == "heads" || text == "h") ? true : false)
{
isHeads = true;
return (true, string.Empty);
}
text = side.ToLower();
if ((text == "tails" || text == "t") ? true : false)
{
isHeads = false;
return (true, string.Empty);
}
isHeads = false;
return (false, "Invalid coin side. Must be heads or tails");
}
public static (bool success, string message) TryParseSuperFlipAndValidateAmount(string superFlipAmountString, out int? superFlipAmount)
{
bool superFlipEnabled = Coinflip.SuperFlipEnabled;
int superFlipMax = Coinflip.SuperFlipMax;
Coinflip.Logger.LogDebug((object)$"[CoinFlip] SuperFlipEnabled: {superFlipEnabled} | SuperFlipMax: {superFlipMax}");
if (!superFlipEnabled)
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] Super Flips are not enabled. Stopping execution");
superFlipAmount = null;
return (false, "Super Flips are not enabled");
}
if (!int.TryParse(superFlipAmountString, out var result))
{
superFlipAmount = null;
return (false, "Super Flip Amount must be a number");
}
if (result < 2)
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] Super Flips amount was less than 2. This is not allowed.");
superFlipAmount = null;
return (false, "I need to super flip at least 2 times");
}
if (result > superFlipMax)
{
Coinflip.Logger.LogDebug((object)$"[CoinFlip] Super Flip Amount: {result} | SuperFlipMax: {superFlipMax}");
superFlipAmount = null;
return (false, $"My super flip can't be more than {superFlipMax}");
}
Coinflip.Logger.LogDebug((object)"[CoinFlip] Super Flip validation passed");
superFlipAmount = result;
return (true, "Success");
}
public static bool TryParseUpgradeType(string amountString, string upgradeType, out int amount)
{
throw new NotImplementedException();
}
}
}
namespace CoinFlip.Commands
{
public static class CoinFlipCommand
{
[CommandExecution("coinflip", "Gamble your money by flipping a coin. Try /cf 1k h", true, false)]
[CommandAlias("cf")]
[CommandAlias("coinflip")]
public static async Task Execute(string args)
{
PlayerAvatar avatar = PlayerAvatar.instance;
bool isMasterClient = PhotonNetwork.IsMasterClient;
bool isMultiplayer = SemiFunc.IsMultiplayer();
Coinflip.Logger.LogDebug((object)$"[CoinFlip] IsMasterClient: {isMasterClient} | IsMultiplayer: {isMultiplayer} | PlayerName: {avatar.playerName}");
if (!LocationValidator.CanGambleInCurrentLocation())
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] Player is not in the shop.");
CoinFlipMessenger.SendIncorrectLocationMessage();
return;
}
string[] coinFlipArgs = args.Split(' ');
Coinflip.Logger.LogDebug((object)$"[CoinFlip] Args are {args} arg length {coinFlipArgs.Length}");
string amountBetString = coinFlipArgs[0];
int amount;
(bool success, string message) betValidatorResult = BetValidator.TryParseBetAmount(amountBetString, out amount);
if (!betValidatorResult.success)
{
Coinflip.Logger.LogDebug((object)("[CoinFlip] Amount was not valid. " + amountBetString));
await Task.Delay(3200);
CoinFlipMessenger.SendMessageWithRedEyes(betValidatorResult.message, sendInTaxManChat: false);
return;
}
string betChoiceString = coinFlipArgs[1];
bool isHeads;
(bool success, string message) coinSideResult = BetValidator.TryParseCoinSide(betChoiceString, out isHeads);
if (!coinSideResult.success)
{
Coinflip.Logger.LogDebug((object)("[CoinFlip] Coin side was not valid. " + betChoiceString));
await Task.Delay(3200);
CoinFlipMessenger.SendMessageWithRedEyes(coinSideResult.message, sendInTaxManChat: false);
return;
}
if (coinFlipArgs.Length == 2)
{
bool headsWon = CoinFlipper.FlipCoin();
if (!headsWon && isHeads)
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] Coin was heads but player chose to flip tails.");
int amountLost2 = CurrencyManager.ProcessGambleResult(userWon: false, amount);
await Task.Delay(3200);
CoinFlipMessenger.SendLostMessage(amountLost2);
}
else
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] Coin was tails but player chose to flip heads.");
int amountWon2 = CurrencyManager.ProcessGambleResult(userWon: true, amount);
await Task.Delay(3200);
CoinFlipMessenger.SendWonMessage(amountWon2);
}
return;
}
string totalSuperFlipsString = coinFlipArgs[2];
bool won;
double multiplier;
(bool success, string message) superFlipResult = CoinFlipper.SuperFlip(totalSuperFlipsString, Coinflip.SuperFlipMultiplier, out won, out multiplier);
if (!superFlipResult.success)
{
Coinflip.Logger.LogDebug((object)("[CoinFlip] Super flip was not valid. " + totalSuperFlipsString));
CoinFlipMessenger.SendMessageWithRedEyes(superFlipResult.message, sendInTaxManChat: false);
}
else if (!won)
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] Super flip was not won.");
int amountLost2 = CurrencyManager.ProcessGambleResult(userWon: false, amount, multiplier);
await Task.Delay(3200);
CoinFlipMessenger.SendLostMessage(amountLost2);
}
else
{
Coinflip.Logger.LogDebug((object)"[CoinFlip] Super flip was won.");
int amountWon2 = CurrencyManager.ProcessGambleResult(userWon: true, amount, multiplier);
await Task.Delay(3200);
CoinFlipMessenger.SendWonMessage(amountWon2);
}
}
}
}