Decompiled source of ScarletJackpot v1.0.0
ScarletJackpot.dll
Decompiled 2 weeks 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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.CastleBuilding; using ProjectM.Gameplay.Systems; using ProjectM.Network; using ProjectM.Shared; using ProjectM.Tiles; using ScarletCore; using ScarletCore.Data; using ScarletCore.Events; using ScarletCore.Services; using ScarletCore.Systems; using ScarletCore.Utils; using ScarletJackpot.Constants; using ScarletJackpot.Data; using ScarletJackpot.Models; using ScarletJackpot.Patches; using ScarletJackpot.Services; using ScarletJackpot.Utils; using Stunlock.Core; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Transforms; using VampireCommandFramework; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("ScarletJackpot")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Scarlet Template")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+24b3ac8739f7b79b34c6a59de99ec9289f733eb4")] [assembly: AssemblyProduct("ScarletJackpot")] [assembly: AssemblyTitle("ScarletJackpot")] [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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal static class GameData { public static NativeParallelHashMap<PrefabGUID, Entity> PrefabGuidToEntityMap => GameSystems.PrefabCollectionSystem._PrefabGuidToEntityMap; } namespace ScarletJackpot { internal static class IdHelper { public static string GetId(this Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!entity.HasId()) { return null; } DynamicBuffer<UserMapZonePackedRevealElement> val = ECSExtensions.ReadBuffer<UserMapZonePackedRevealElement>(entity); if (val.Length == 0) { return null; } byte[] array = new byte[val.Length]; for (int i = 0; i < val.Length; i++) { array[i] = val[i].PackedPixel; } return Encoding.UTF8.GetString(array).TrimEnd('\0'); } public static void SetId(this Entity entity, string id) { //IL_0001: 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) //IL_0018: 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) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (ECSExtensions.Exists(entity) && !ECSExtensions.Has<PlayerCharacter>(entity)) { if (!ECSExtensions.Has<UserMapZonePackedRevealElement>(entity)) { ECSExtensions.AddBuffer<UserMapZonePackedRevealElement>(entity); } byte[] bytes = Encoding.UTF8.GetBytes(id); DynamicBuffer<UserMapZonePackedRevealElement> val = ECSExtensions.ReadBuffer<UserMapZonePackedRevealElement>(entity); val.Clear(); foreach (byte packedPixel in bytes) { val.Add(new UserMapZonePackedRevealElement { PackedPixel = packedPixel }); } } } public static bool HasId(this Entity entity) { //IL_0001: 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) //IL_0011: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!ECSExtensions.Exists(entity) || !ECSExtensions.Has<UserMapZonePackedRevealElement>(entity) || ECSExtensions.Has<PlayerCharacter>(entity)) { return false; } return ECSExtensions.ReadBuffer<UserMapZonePackedRevealElement>(entity).Length > 0; } public static bool IdEquals(this Entity entity, string id) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!entity.HasId()) { return false; } return entity.GetId() == id; } public static bool IdEqualsAny(this Entity entity, params string[] ids) { //IL_0001: 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) if (!entity.HasId()) { return false; } foreach (string text in ids) { if (entity.GetId() == text) { return true; } } return false; } } [BepInPlugin("ScarletJackpot", "ScarletJackpot", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { private static Harmony _harmony; public static Harmony Harmony => _harmony; public static Plugin Instance { get; private set; } public static ManualLogSource LogInstance { get; private set; } public static Settings Settings { get; private set; } public override void Load() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown Instance = this; LogInstance = ((BasePlugin)this).Log; ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ScarletJackpot"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); _harmony = new Harmony("ScarletJackpot"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Settings = new Settings("ScarletJackpot", (BasePlugin)(object)Instance); LoadSettings(); if (GameSystems.Initialized) { OnInitialized(null, null); } else { EventManager.OnInitialize += OnInitialized; } CommandRegistry.RegisterAll(); } public override bool Unload() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } ActionScheduler.UnregisterAssembly(Assembly.GetExecutingAssembly()); EventManager.UnregisterAssembly(Assembly.GetExecutingAssembly()); CommandRegistry.UnregisterAssembly(); return true; } public static void OnInitialized(object _, object __) { EventManager.OnInitialize -= OnInitialized; SlotService.Initialize(); } public static void ReloadSettings() { LoadSettings(); } public static void LoadSettings() { Settings.Section("General").Add<bool>("EnableAnimation", true, "Enable slot machine lighting animations.").Add<bool>("EnableSound", true, "Enable slot machine sound effects.") .Add<bool>("EnableWinVoiceLine", true, "Enable voice line when player wins.") .Add<bool>("EnableRuggedHands", true, "If enabled, the Rugged Hands item will steal the current prizes from the slot machine (if any). (1% chance)"); Settings.Section("Spin Cost").Add<int>("CostPrefabGUID", 862477668, "The PrefabGUID of the item to be consumed for each spin.").Add<int>("MinAmount", 100, "The minimum amount of the item to be consumed for each spin.") .Add<int>("MaxAmount", 1000, "The maximum amount of the item to be consumed for each spin.") .Add<float>("MaxBetMultiplier", 3f, "Maximum prize multiplier. Min bet = 1x multiplier, Max bet = this value. Example: 3.0 means max bet gives 3x more prizes than min bet."); Settings.Section("RTP Control").Add<float>("RTPRate", 0.85f, "Return to Player rate (0.0 to 1.0). Higher values = more player-friendly.").Add<float>("BaseWinChance", 0.05f, "Base chance for winning lines (0.0 to 1.0). Higher values = more wins.") .Add<bool>("EnableRTPControl", true, "Enable sophisticated RTP control system for casino-like behavior."); Settings.Section("Prize Pool").Add<int>("Fish", 0, "The PrefabGUID of the prize item for a row of fish.").Add<int>("FishAmount", 0, "The amount of items given for a row of fish.") .Add<int>("DuskCaller", 0, "The PrefabGUID of the prize item for a row of DuskCaller.") .Add<int>("DuskCallerAmount", 0, "The amount of items given for a row of DuskCaller.") .Add<int>("Gem", 0, "The PrefabGUID of the prize item for a row of gems.") .Add<int>("GemAmount", 0, "The amount of items given for a row of gems.") .Add<int>("Jewel", 0, "The PrefabGUID of the prize item for a row of jewels.") .Add<int>("JewelAmount", 0, "The amount of items given for a row of jewels.") .Add<int>("MagicStone", 0, "The PrefabGUID of the prize item for a row of magic stones.") .Add<int>("MagicAmount", 0, "The amount of items given for a row of magic stones.") .Add<int>("DemonFragment", 0, "The PrefabGUID of the prize item for a row of demon fragments (JACKPOT).") .Add<int>("DemonAmount", 0, "The amount of items given for a row of demon fragments."); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "ScarletJackpot"; public const string PLUGIN_NAME = "ScarletJackpot"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace ScarletJackpot.Utils { internal static class WeightedRandomSelector { public static PrefabGUID SelectItem(Dictionary<PrefabGUID, int> weightedItems, Random random) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) if (weightedItems == null || weightedItems.Count == 0) { throw new ArgumentException("Weighted items cannot be null or empty"); } int maxValue = weightedItems.Values.Sum(); int num = random.Next(maxValue); int num2 = 0; foreach (KeyValuePair<PrefabGUID, int> weightedItem in weightedItems) { num2 += weightedItem.Value; if (num < num2) { return weightedItem.Key; } } return weightedItems.Keys.First(); } public static PrefabGUID SelectItem(Dictionary<PrefabGUID, float> weightedItems, Random random) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009b: Unknown result type (might be due to invalid IL or missing references) if (weightedItems == null || weightedItems.Count == 0) { throw new ArgumentException("Weighted items cannot be null or empty"); } float num = weightedItems.Values.Sum(); float num2 = (float)random.NextDouble() * num; float num3 = 0f; foreach (KeyValuePair<PrefabGUID, float> weightedItem in weightedItems) { num3 += weightedItem.Value; if (num2 < num3) { return weightedItem.Key; } } return weightedItems.Keys.First(); } } } namespace ScarletJackpot.Services { internal class SlotGameLogic { private const int TOTAL_COLUMNS = 7; private const int TOTAL_ROWS = 3; private const int ANIMATION_INITIAL_FRAME_SPEED = 2; private const int ANIMATION_STOP_ITERATIONS = 75; private const int DELAYED_FRAMES = 10; private const int COLUMN_START_DELAY = 5; private const int LAMP_COLOR_COUNT = 10; private const int LAMP_COLOR_CHANGE_FREQUENCY = 3; private readonly int[] _itemColumns = new int[3] { 1, 3, 5 }; private readonly SlotModel _slotModel; private Dictionary<int, PrefabGUID> _plannedWins = new Dictionary<int, PrefabGUID>(); private PrefabGUID[,] _finalResults = new PrefabGUID[3, 3]; private readonly Dictionary<int, int> _columnPlacementCounter = new Dictionary<int, int>(); private bool _hasPlannedResults = false; private byte _currentLampColor = 0; public SlotGameLogic(SlotModel slotModel) { _slotModel = slotModel ?? throw new ArgumentNullException("slotModel"); } public void StartAnimation() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) ClearWinIndicators(); PrepareSlotResults(); _currentLampColor = 0; ActionScheduler.DelayedFrames((Action)StartStaggeredAnimation, 10); } public void AnimateAllColumnsSync() { Random random = new Random(); int[] itemColumns = _itemColumns; foreach (int col in itemColumns) { ProcessColumnAnimation(col, random); } } public void PopulateSlots() { //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_0044: Unknown result type (might be due to invalid IL or missing references) StopLampColorAnimation(); Random random = new Random(); Dictionary<int, HashSet<PrefabGUID>> usedPerColumn = InitializeUsedItemsPerColumn(); ClearWinIndicators(); for (int i = 0; i < 3; i++) { int[] itemColumns = _itemColumns; foreach (int col in itemColumns) { PrefabGUID prefabguid = SelectUniqueWeightedItemForColumn(col, usedPerColumn, random); AddItemToSlot(i, col, prefabguid); } } } private void PrepareSlotResults() { _plannedWins.Clear(); _columnPlacementCounter.Clear(); _hasPlannedResults = true; Random random = new Random(); int[] itemColumns = _itemColumns; foreach (int key in itemColumns) { _columnPlacementCounter[key] = 0; } FillMatrixWithUniqueColumns(random); ApplyWinningLines(random); } private void FillMatrixWithUniqueColumns(Random random) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 3; i++) { HashSet<PrefabGUID> usedItems = new HashSet<PrefabGUID>(); for (int j = 0; j < 3; j++) { Dictionary<PrefabGUID, int> dictionary = SlotItems.WeightedItems.Where((KeyValuePair<PrefabGUID, int> kvp) => !usedItems.Contains(kvp.Key)).ToDictionary((KeyValuePair<PrefabGUID, int> kvp) => kvp.Key, (KeyValuePair<PrefabGUID, int> kvp) => kvp.Value); if (dictionary.Count == 0) { usedItems.Clear(); dictionary = SlotItems.WeightedItems; } PrefabGUID val = WeightedRandomSelector.SelectItem(dictionary, random); _finalResults[j, i] = val; usedItems.Add(val); } } } private void ApplyWinningLines(Random random) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 3; i++) { if (ShouldCreateWinForRow(random)) { PrefabGUID val = SelectWinningItem(random); _plannedWins[i] = val; for (int j = 0; j < 3; j++) { _finalResults[i, j] = val; } } } EnsureNoColumnRepeatsAfterWins(random); } private void EnsureNoColumnRepeatsAfterWins(Random random) { for (int i = 0; i < 3; i++) { FixColumnRepeatsSmartly(i, random); } } private void FixColumnRepeatsSmartly(int col, Random random) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) List<PrefabGUID> list = new List<PrefabGUID>(); for (int i = 0; i < 3; i++) { list.Add(_finalResults[i, col]); } if (list.Distinct().Count() == list.Count) { return; } HashSet<PrefabGUID> usedItems = new HashSet<PrefabGUID>(); for (int j = 0; j < 3; j++) { PrefabGUID item = _finalResults[j, col]; if (usedItems.Contains(item)) { if (_plannedWins.ContainsKey(j)) { FixColumnKeepingWinningLines(col, random); break; } Dictionary<PrefabGUID, int> dictionary = SlotItems.WeightedItems.Where((KeyValuePair<PrefabGUID, int> kvp) => !usedItems.Contains(kvp.Key)).ToDictionary((KeyValuePair<PrefabGUID, int> kvp) => kvp.Key, (KeyValuePair<PrefabGUID, int> kvp) => kvp.Value); if (dictionary.Count > 0) { PrefabGUID val = WeightedRandomSelector.SelectItem(dictionary, random); _finalResults[j, col] = val; usedItems.Add(val); } } else { usedItems.Add(item); } } } private void FixColumnKeepingWinningLines(int col, Random random) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: 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) HashSet<int> hashSet = new HashSet<int>(); List<int> list = new List<int>(); for (int i = 0; i < 3; i++) { if (_plannedWins.ContainsKey(i)) { hashSet.Add(i); } else { list.Add(i); } } HashSet<PrefabGUID> hashSet2 = new HashSet<PrefabGUID>(); foreach (int item2 in hashSet) { hashSet2.Add(_finalResults[item2, col]); } HashSet<PrefabGUID> usedItems = new HashSet<PrefabGUID>(hashSet2); foreach (int item3 in list) { PrefabGUID item = _finalResults[item3, col]; if (usedItems.Contains(item)) { Dictionary<PrefabGUID, int> dictionary = SlotItems.WeightedItems.Where((KeyValuePair<PrefabGUID, int> kvp) => !usedItems.Contains(kvp.Key)).ToDictionary((KeyValuePair<PrefabGUID, int> kvp) => kvp.Key, (KeyValuePair<PrefabGUID, int> kvp) => kvp.Value); if (dictionary.Count > 0) { PrefabGUID val = WeightedRandomSelector.SelectItem(dictionary, random); _finalResults[item3, col] = val; usedItems.Add(val); } } else { usedItems.Add(item); } } } private bool ShouldCreateWinForRow(Random random) { return random.NextDouble() < (double)ScarletJackpot.Constants.Constants.BASE_WIN_CHANCE; } private PrefabGUID SelectWinningItem(Random random) { //IL_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0074: Unknown result type (might be due to invalid IL or missing references) Dictionary<PrefabGUID, float> dictionary = new Dictionary<PrefabGUID, float>(); foreach (PrefabGUID key in SlotItems.WeightedItems.Keys) { int num = SlotItems.WeightedItems[key]; float valueOrDefault = SlotItems.WinMultipliers.GetValueOrDefault(key, 1f); dictionary[key] = (float)num * valueOrDefault; } return WeightedRandomSelector.SelectItem(dictionary, random); } private void StopLampColorAnimation() { _currentLampColor = 0; _slotModel.ChangeLampColor(_currentLampColor); } private void StartStaggeredAnimation() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _itemColumns.Length; i++) { int columnIndex = i; int column = _itemColumns[i]; int num = i * 5; int columnSpeed = 2; ActionScheduler.DelayedFrames((Action)delegate { StartColumnAnimation(column, columnSpeed, columnIndex); }, num); } } private void StartColumnAnimation(int column, int initialSpeed, int columnIndex) { AnimateColumnWithDelay(column, 0, initialSpeed, columnIndex); } private void AnimateColumnWithDelay(int column, int iteration, int frameSpeed, int columnIndex) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) if (iteration >= 75) { if (columnIndex == _itemColumns.Length - 1) { ProcessSlotResults(); } return; } if (_hasPlannedResults && ShouldPlaceWinningItems(iteration, columnIndex)) { AnimateSingleColumnWithPlannedResults(column, columnIndex); } else { AnimateSingleColumn(column); } int nextFrameSpeed = frameSpeed; if (iteration >= 60) { nextFrameSpeed = frameSpeed + 1; } if (ScarletJackpot.Constants.Constants.SOUND_ENABLED) { BuffService.TryRemoveBuff(_slotModel.Dummy, Buffs.SlotGameBuff); BuffService.TryApplyBuff(_slotModel.Dummy, Buffs.SlotGameBuff, 0f); } if (ScarletJackpot.Constants.Constants.ANIMATION_ENABLED) { _currentLampColor = (byte)((_currentLampColor + 1) % 10); _slotModel.ChangeLampColor(_currentLampColor); } ActionScheduler.DelayedFrames((Action)delegate { AnimateColumnWithDelay(column, iteration + 1, nextFrameSpeed, columnIndex); }, nextFrameSpeed); } private bool ShouldPlaceWinningItems(int iteration, int columnIndex) { int num = 75 - iteration; return num <= 3 && num > 0; } private void AnimateSingleColumnWithPlannedResults(int column, int columnIndex) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_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_0058: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(); List<PrefabGUID> currentColumnItems = GetCurrentColumnItems(column); RemoveBottomItem(column); MoveItemsDown(column); PrefabGUID val = SelectItemFromPlannedMatrix(column, columnIndex, random); InventoryService.RemoveItemAtSlot(_slotModel.SlotChest, column); InventoryService.AddWithMaxAmount(_slotModel.SlotChest, val, column, 1, 1); SlotModel.SetAllItemsMaxAmount(_slotModel.SlotChest, 1); } private PrefabGUID SelectItemFromPlannedMatrix(int column, int columnIndex, Random random) { //IL_0078: 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_0081: 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_0069: 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) int num = Array.IndexOf(_itemColumns, column); if (num >= 0 && num < 3) { int num2 = _columnPlacementCounter[column]; if (num2 >= 0 && num2 < 3) { PrefabGUID result = _finalResults[num2, num]; _columnPlacementCounter[column]++; return result; } } return SelectNewItemWithWeight(GetCurrentColumnItems(column), random); } private void AnimateSingleColumn(int column) { Random random = new Random(); ProcessColumnAnimation(column, random); } private void ProcessColumnAnimation(int col, Random random) { List<PrefabGUID> currentColumnItems = GetCurrentColumnItems(col); RemoveBottomItem(col); MoveItemsDown(col); AddNewTopItem(col, currentColumnItems, random); } private List<PrefabGUID> GetCurrentColumnItems(int col) { //IL_0018: 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_0028: Unknown result type (might be due to invalid IL or missing references) List<PrefabGUID> list = new List<PrefabGUID>(); InventoryBuffer val = default(InventoryBuffer); for (int i = 0; i < 3; i++) { int num = i * 7 + col; InventoryService.TryGetItemAtSlot(_slotModel.SlotChest, num, ref val); list.Add(val.ItemType); } return list; } private void RemoveBottomItem(int col) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) int num = 14 + col; InventoryService.RemoveItemAtSlot(_slotModel.SlotChest, num); } private void MoveItemsDown(int col) { //IL_001a: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) InventoryBuffer val = default(InventoryBuffer); for (int num = 2; num > 0; num--) { int num2 = (num - 1) * 7 + col; int num3 = num * 7 + col; InventoryService.RemoveItemAtSlot(_slotModel.SlotChest, num3); if (InventoryService.TryGetItemAtSlot(_slotModel.SlotChest, num2, ref val)) { InventoryService.AddWithMaxAmount(_slotModel.SlotChest, val.ItemType, num3, 1, 1); } } } private void AddNewTopItem(int col, List<PrefabGUID> currentItems, Random random) { //IL_0003: 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_0011: 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_0028: 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) PrefabGUID val = SelectNewItemWithWeight(currentItems, random); InventoryService.RemoveItemAtSlot(_slotModel.SlotChest, col); InventoryService.AddWithMaxAmount(_slotModel.SlotChest, val, col, 1, 1); SlotModel.SetAllItemsMaxAmount(_slotModel.SlotChest, 1); } private static PrefabGUID SelectNewItemWithWeight(List<PrefabGUID> currentItems, Random random) { //IL_001b: 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_0099: 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_00a2: Unknown result type (might be due to invalid IL or missing references) HashSet<PrefabGUID> used = new HashSet<PrefabGUID>(currentItems); used.Remove(default(PrefabGUID)); Dictionary<PrefabGUID, int> dictionary = SlotItems.WeightedItems.Where((KeyValuePair<PrefabGUID, int> kvp) => !used.Contains(kvp.Key)).ToDictionary((KeyValuePair<PrefabGUID, int> kvp) => kvp.Key, (KeyValuePair<PrefabGUID, int> kvp) => kvp.Value); if (dictionary.Count == 0) { dictionary = SlotItems.WeightedItems; } return WeightedRandomSelector.SelectItem(dictionary, random); } private void ProcessSlotResults() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) StopLampColorAnimation(); Dictionary<int, PrefabGUID> dictionary = DetectWins(); if (dictionary.ContainsValue(ScarletJackpot.Constants.Constants.RAGHANDS_PREFAB)) { ClearWinIndicators(); if (ScarletJackpot.Constants.Constants.SOUND_ENABLED) { BuffService.TryApplyBuff(_slotModel.Dummy, Buffs.RuggedHandsStealBuff, 0f); BuffService.TryRemoveBuff(_slotModel.Dummy, Buffs.RuggedHandsStealBuff); } } else if (dictionary.Count > 0) { AddWinIndicators(dictionary); DeliverWinRewards(dictionary); } else { ClearWinIndicators(); } _plannedWins.Clear(); _columnPlacementCounter.Clear(); _hasPlannedResults = false; _slotModel.OnAnimationFinished(); } private void AddWinIndicators(Dictionary<int, PrefabGUID> wins) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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) foreach (int key in wins.Keys) { int num = key * 7; int num2 = key * 7 + 6; InventoryService.RemoveItemAtSlot(_slotModel.SlotChest, num); InventoryService.AddWithMaxAmount(_slotModel.SlotChest, ScarletJackpot.Constants.Constants.WIN_INDICATOR, num, 1, 1); InventoryService.RemoveItemAtSlot(_slotModel.SlotChest, num2); InventoryService.AddWithMaxAmount(_slotModel.SlotChest, ScarletJackpot.Constants.Constants.WIN_INDICATOR, num2, 1, 1); } SlotModel.SetAllItemsMaxAmount(_slotModel.SlotChest, 1); } private void ClearWinIndicators() { //IL_0019: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00b7: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 3; i++) { int num = i * 7; int num2 = i * 7 + 6; InventoryService.RemoveItemAtSlot(_slotModel.SlotChest, num); InventoryService.RemoveItemAtSlot(_slotModel.SlotChest, num2); DynamicBuffer<InventoryBuffer> inventoryItems = InventoryService.GetInventoryItems(_slotModel.SlotChest); if (num < inventoryItems.Length) { InventoryBuffer val = inventoryItems[num]; val.ItemType = new PrefabGUID(0); val.Amount = 0; inventoryItems[num] = val; } if (num2 < inventoryItems.Length) { InventoryBuffer val2 = inventoryItems[num2]; val2.ItemType = new PrefabGUID(0); val2.Amount = 0; inventoryItems[num2] = val2; } } } private Dictionary<int, PrefabGUID> DetectWins() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Dictionary<int, PrefabGUID> dictionary = new Dictionary<int, PrefabGUID>(); for (int i = 0; i < 3; i++) { PrefabGUID[] rowItems = GetRowItems(i); if (rowItems[0] != default(PrefabGUID) && rowItems[0] == rowItems[1] && rowItems[1] == rowItems[2]) { dictionary[i] = rowItems[0]; } } return dictionary; } private PrefabGUID[] GetRowItems(int row) { //IL_0022: 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_003a: 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) PrefabGUID[] array = (PrefabGUID[])(object)new PrefabGUID[3]; InventoryBuffer val = default(InventoryBuffer); for (int i = 0; i < _itemColumns.Length; i++) { int num = _itemColumns[i]; int num2 = row * 7 + num; if (InventoryService.TryGetItemAtSlot(_slotModel.SlotChest, num2, ref val)) { array[i] = val.ItemType; } } return array; } private void DeliverWinRewards(Dictionary<int, PrefabGUID> wins) { //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_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) //IL_001a: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_011e: 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) Entity currentPlayer = _slotModel.CurrentPlayer; if (currentPlayer == Entity.Null || !ECSExtensions.Exists(currentPlayer) || !ECSExtensions.Has<PlayerCharacter>(currentPlayer)) { return; } if (ScarletJackpot.Constants.Constants.VOICE_LINE_ENABLED) { BuffService.TryApplyBuff(currentPlayer, Buffs.VictoryVoiceLineBuff, 0f); } if (ScarletJackpot.Constants.Constants.SOUND_ENABLED) { BuffService.TryApplyBuff(_slotModel.Dummy, Buffs.VictorySlotBuff, 0f); BuffService.TryRemoveBuff(_slotModel.Dummy, Buffs.VictorySlotBuff); } PlayerData playerData = PlayerDataExtensions.GetPlayerData(currentPlayer); int betAmount = SlotService.GetBetAmount(playerData.PlatformId); float num = CalculateBetMultiplier(betAmount); PrefabGUID val = default(PrefabGUID); foreach (KeyValuePair<int, PrefabGUID> win in wins) { PrefabGUID value = win.Value; Prize prizeForItem = GetPrizeForItem(value); if (prizeForItem.Prefab != 0 && prizeForItem.Amount > 0) { ((PrefabGUID)(ref val))..ctor(prizeForItem.Prefab); float num2 = (float)prizeForItem.Amount * num; int num3 = (int)Math.Ceiling(num2); try { InventoryService.AddItem(currentPlayer, val, num3); } catch (Exception ex) { Log.Error((object)("Error delivering prize to player: " + ex.Message)); } } } } private Prize GetPrizeForItem(PrefabGUID item) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return PrizeItemMap.Prizes.GetValueOrDefault(item, new Prize(0, 0)); } public static float CalculateBetMultiplier(int betAmount) { int sPIN_MIN_AMOUNT = ScarletJackpot.Constants.Constants.SPIN_MIN_AMOUNT; int sPIN_MAX_AMOUNT = ScarletJackpot.Constants.Constants.SPIN_MAX_AMOUNT; float mAX_BET_MULTIPLIER = ScarletJackpot.Constants.Constants.MAX_BET_MULTIPLIER; if (sPIN_MIN_AMOUNT >= sPIN_MAX_AMOUNT) { return 1f; } float val = (float)(betAmount - sPIN_MIN_AMOUNT) / (float)(sPIN_MAX_AMOUNT - sPIN_MIN_AMOUNT); val = Math.Max(0f, Math.Min(1f, val)); return 1f + val * (mAX_BET_MULTIPLIER - 1f); } private Dictionary<int, HashSet<PrefabGUID>> InitializeUsedItemsPerColumn() { Dictionary<int, HashSet<PrefabGUID>> dictionary = new Dictionary<int, HashSet<PrefabGUID>>(); int[] itemColumns = _itemColumns; foreach (int key in itemColumns) { dictionary[key] = new HashSet<PrefabGUID>(); } return dictionary; } private static PrefabGUID SelectUniqueWeightedItemForColumn(int col, Dictionary<int, HashSet<PrefabGUID>> usedPerColumn, Random random) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) Dictionary<PrefabGUID, int> dictionary = SlotItems.WeightedItems.Where((KeyValuePair<PrefabGUID, int> kvp) => !usedPerColumn[col].Contains(kvp.Key)).ToDictionary((KeyValuePair<PrefabGUID, int> kvp) => kvp.Key, (KeyValuePair<PrefabGUID, int> kvp) => kvp.Value); if (dictionary.Count == 0) { usedPerColumn[col].Clear(); dictionary = SlotItems.WeightedItems; } PrefabGUID val = WeightedRandomSelector.SelectItem(dictionary, random); usedPerColumn[col].Add(val); return val; } private void AddItemToSlot(int row, int col, PrefabGUID prefabguid) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //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) int num = row * 7 + col; InventoryService.AddWithMaxAmount(_slotModel.SlotChest, prefabguid, num, 1, 1); SlotModel.SetAllItemsMaxAmount(_slotModel.SlotChest, 1); } } internal static class SlotService { public static Dictionary<Entity, SlotModel> FromSlot { get; set; } = new Dictionary<Entity, SlotModel>(); public static Dictionary<Entity, SlotModel> FromSlotChest { get; set; } = new Dictionary<Entity, SlotModel>(); public static Dictionary<ulong, int> CurrentBetAmount { get; set; } = new Dictionary<ulong, int>(); public static void Initialize() { //IL_001a: 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_0034: 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) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0080: 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) FromSlot.Clear(); FromSlotChest.Clear(); EntityQueryBuilder val = default(EntityQueryBuilder); ((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2)); ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<UserMapZonePackedRevealElement>()); ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)2); EntityManager entityManager = GameSystems.EntityManager; EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val); Enumerator<Entity> enumerator = ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (current.HasId() && current.IdEquals("__ScarletJackpot.Slot__")) { SlotModel slot = new SlotModel(current); Register(slot); } } } public static void SetBetAmount(PlayerData player, int amount) { ulong platformId = player.PlatformId; float value = SlotGameLogic.CalculateBetMultiplier(amount); player.SendMessage(RichTextFormatter.FormatSuccess($"Bet set to ~{amount}~ (Prize multiplier: ~{value:F2}x~)")); CurrentBetAmount[platformId] = amount; } public static bool HasBet(ulong playerId) { return CurrentBetAmount.ContainsKey(playerId); } public static int GetBetAmount(ulong playerId) { if (CurrentBetAmount.TryGetValue(playerId, out var value)) { return value; } return 0; } public static void Register(SlotModel slot) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (slot != null && !(slot.Slot == Entity.Null) && !(slot.SlotChest == Entity.Null)) { FromSlot[slot.Slot] = slot; FromSlotChest[slot.SlotChest] = slot; } } public static void Unregister(SlotModel slot) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) if (slot != null && !(slot.Slot == Entity.Null) && !(slot.SlotChest == Entity.Null)) { FromSlot.Remove(slot.Slot); FromSlotChest.Remove(slot.SlotChest); } } public static SlotModel Get(Entity slot) { //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_0019: 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) if (slot == Entity.Null) { return null; } if (FromSlot.TryGetValue(slot, out var value)) { return value; } if (FromSlotChest.TryGetValue(slot, out value)) { return value; } return null; } public static bool Has(Entity slot) { //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_0019: 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) if (slot == Entity.Null) { return false; } return FromSlot.ContainsKey(slot) || FromSlotChest.ContainsKey(slot); } public static SlotModel GetSlotFromPlayerHover(Entity player) { //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_000e: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (player == Entity.Null || !ECSExtensions.Has<EntityInput>(player)) { return null; } EntityInput val = ECSExtensions.Read<EntityInput>(player); Entity hoveredEntity = val.HoveredEntity; if (hoveredEntity == Entity.Null) { return null; } return Get(hoveredEntity); } public static SlotModel GetSlotFromPlayerCursor(Entity player, float maxDistance = 5f) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (player == Entity.Null || !ECSExtensions.Has<EntityInput>(player)) { return null; } EntityInput val = ECSExtensions.Read<EntityInput>(player); float3 aimPosition = val.AimPosition; SlotModel result = null; float num = float.MaxValue; foreach (SlotModel value in FromSlot.Values) { if (value == null) { continue; } float3 position = value.Position; if (!((float3)(ref position)).Equals(float3.zero)) { float num2 = math.distance(aimPosition, value.Position); if (num2 <= maxDistance && num2 < num) { num = num2; result = value; } } } return result; } public static SlotModel GetClosestSlot(float3 playerPosition, float maxDistance = 10f) { //IL_0029: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) SlotModel result = null; float num = float.MaxValue; foreach (SlotModel value in FromSlot.Values) { if (value == null) { continue; } float3 position = value.Position; if (!((float3)(ref position)).Equals(float3.zero)) { float num2 = math.distance(playerPosition, value.Position); if (num2 <= maxDistance && num2 < num) { num = num2; result = value; } } } return result; } public static void ClearAll() { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0033: 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_003c: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) EntityQueryBuilder val = default(EntityQueryBuilder); ((EntityQueryBuilder)(ref val))..ctor(AllocatorHandle.op_Implicit((Allocator)2)); ((EntityQueryBuilder)(ref val)).AddAll(ComponentType.ReadOnly<UserMapZonePackedRevealElement>()); ((EntityQueryBuilder)(ref val)).WithOptions((EntityQueryOptions)2); EntityManager entityManager = GameSystems.EntityManager; EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val); Enumerator<Entity> enumerator = ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)).GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (!current.HasId() || !current.IdEquals("__ScarletJackpot.Slot__")) { continue; } if (ECSExtensions.Has<Follower>(current)) { Entity value = ECSExtensions.Read<Follower>(current).Followed._Value; if (ECSExtensions.Has<Follower>(value)) { Entity value2 = ECSExtensions.Read<Follower>(value).Followed._Value; ECSExtensions.Destroy(value2, false); } ECSExtensions.Destroy(value, false); } ECSExtensions.Destroy(current, false); } } public static void CheckAndClearInactivePlayers() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) InteractPatch.CleanupInactivePlayers(); foreach (SlotModel value in FromSlotChest.Values) { if (value.HasCurrentPlayer() && !value.IsPlayerInteracting(value.CurrentPlayer)) { value.ClearCurrentPlayer(); } } } } } namespace ScarletJackpot.Patches { [HarmonyPatch(typeof(InteractValidateAndStopSystemServer), "OnUpdate")] public static class InteractPatch { private static readonly Dictionary<Entity, Entity> _lastKnownPlayer = new Dictionary<Entity, Entity>(); [HarmonyPrefix] public static void Prefix(InteractValidateAndStopSystemServer __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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_002d: 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_0033: 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_0049: 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_0053: 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) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00f1: Unknown result type (might be due to invalid IL or missing references) EntityQuery _query_195794971_ = __instance.__query_195794971_3; NativeArray<Entity> val = ((EntityQuery)(ref _query_195794971_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (ECSExtensions.GetPrefabGuid(current) != Buffs.SlotInteractBuff) { continue; } Entity owner = ECSExtensions.Read<EntityOwner>(current).Owner; if (owner == Entity.Null || !ECSExtensions.Has<PlayerCharacter>(owner)) { continue; } Entity target = ECSExtensions.Read<Interactor>(owner).Target; if (!SlotService.FromSlotChest.TryGetValue(target, out var value)) { continue; } if (value.SetCurrentPlayer(owner)) { _lastKnownPlayer[target] = owner; continue; } PlayerData playerData = PlayerDataExtensions.GetPlayerData(owner); if (playerData != null) { MessageService.Send(playerData, RichTextFormatter.FormatError("Slot machine is being used by another player!")); } CancelInteraction(owner); } val.Dispose(); } public static void CancelInteraction(Entity entity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (ECSExtensions.Exists(entity)) { BuffService.TryRemoveBuff(entity, Buffs.SlotInteractBuff); } } public static void CleanupInactivePlayers() { //IL_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) List<Entity> list = new List<Entity>(); foreach (KeyValuePair<Entity, Entity> item in _lastKnownPlayer) { Entity key = item.Key; Entity value = item.Value; if (!SlotService.FromSlotChest.TryGetValue(key, out var value2)) { list.Add(key); } else if (!value2.IsPlayerInteracting(value)) { list.Add(key); value2.ClearCurrentPlayer(); } } foreach (Entity item2 in list) { _lastKnownPlayer.Remove(item2); } } } [HarmonyPatch] internal static class InventoryPatches { [HarmonyPatch(typeof(MoveItemBetweenInventoriesSystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(MoveItemBetweenInventoriesSystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery _query_133601321_ = __instance.__query_133601321_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_133601321_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); Entity val3 = default(Entity); InventoryBuffer val5 = default(InventoryBuffer); while (enumerator.MoveNext()) { Entity current = enumerator.Current; MoveItemBetweenInventoriesEvent val2 = ECSExtensions.Read<MoveItemBetweenInventoriesEvent>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (!networkIdToEntityMap.TryGetValue(val2.ToInventory, ref slot) || !networkIdToEntityMap.TryGetValue(val2.FromInventory, ref val3) || (!SlotService.Has(slot) && !SlotService.Has(val3))) { continue; } bool flag = SlotService.Has(slot); FromCharacter val4 = ECSExtensions.Read<FromCharacter>(current); if (!ECSExtensions.Has<PlayerCharacter>(val4.Character) || !ECSExtensions.Has<User>(val4.User)) { ECSExtensions.Destroy(current, true); continue; } PlayerData playerData = PlayerDataExtensions.GetPlayerData(val4.Character); if (flag && InventoryService.TryGetItemAtSlot(val3, val2.FromSlot, ref val5) && val5.ItemType == ScarletJackpot.Constants.Constants.SPIN_COST_PREFAB && val5.Amount >= ScarletJackpot.Constants.Constants.SPIN_MIN_AMOUNT && val5.Amount <= ScarletJackpot.Constants.Constants.SPIN_MAX_AMOUNT) { SlotModel slotModel = SlotService.Get(slot); if (slotModel.CurrentPlayer != val4.Character) { PlayerData playerData2 = PlayerDataExtensions.GetPlayerData(val4.Character); if (playerData2 != null) { MessageService.Send(playerData2, "You must be interacting with the slot machine to place bets!"); } ECSExtensions.Destroy(current, true); continue; } SlotService.SetBetAmount(playerData, val5.Amount); } ECSExtensions.Destroy(current, true); } } catch (Exception ex) { Log.Error((object)("Error in MoveItemBetweenInventoriesSystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(DropInventoryItemSystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(DropInventoryItemSystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery _query_1470978904_ = __instance.__query_1470978904_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_1470978904_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; DropInventoryItemEvent val2 = ECSExtensions.Read<DropInventoryItemEvent>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (networkIdToEntityMap.TryGetValue(val2.Inventory, ref slot) && SlotService.Has(slot)) { ECSExtensions.Destroy(current, true); } } } catch (Exception ex) { Log.Error((object)("Error in DropInventoryItemSystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(SortSingleInventorySystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(SortSingleInventorySystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery eventQuery = __instance._EventQuery; NativeArray<Entity> val = ((EntityQuery)(ref eventQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; SortSingleInventoryEvent val2 = ECSExtensions.Read<SortSingleInventoryEvent>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (networkIdToEntityMap.TryGetValue(val2.Inventory, ref slot) && SlotService.Has(slot)) { ECSExtensions.Destroy(current, true); } } } catch (Exception ex) { Log.Error((object)("Error in SortSingleInventorySystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(SortAllInventoriesSystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(SortAllInventoriesSystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery _query_133601798_ = __instance.__query_133601798_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_133601798_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; SortAllInventoriesEvent val2 = ECSExtensions.Read<SortAllInventoriesEvent>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (networkIdToEntityMap.TryGetValue(val2.Inventory, ref slot) && SlotService.Has(slot)) { ECSExtensions.Destroy(current, true); } } } catch (Exception ex) { Log.Error((object)("Error in SortAllInventoriesSystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(MoveAllItemsBetweenInventoriesSystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(MoveAllItemsBetweenInventoriesSystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery _query_133601579_ = __instance.__query_133601579_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_133601579_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity val3 = default(Entity); Entity slot = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; MoveAllItemsBetweenInventoriesEvent val2 = ECSExtensions.Read<MoveAllItemsBetweenInventoriesEvent>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (!networkIdToEntityMap.TryGetValue(val2.ToInventory, ref val3) || !networkIdToEntityMap.TryGetValue(val2.FromInventory, ref slot) || (!SlotService.Has(val3) && !SlotService.Has(slot))) { continue; } if (ECSExtensions.IsPlayer(val3)) { PlayerData playerData = PlayerDataExtensions.GetPlayerData(val3); if (SlotService.HasBet(playerData.PlatformId)) { int betAmount = SlotService.GetBetAmount(playerData.PlatformId); SlotModel slotModel = SlotService.Get(slot); if (slotModel.IsRunning) { Log.Info((object)"Slot machine is already running - bet rejected!"); ECSExtensions.Destroy(current, true); continue; } if (slotModel.CurrentPlayer != val3) { PlayerData playerData2 = PlayerDataExtensions.GetPlayerData(val3); if (playerData2 != null) { MessageService.Send(playerData2, "You must be interacting with the slot machine to spin!"); } ECSExtensions.Destroy(current, true); continue; } if (InventoryService.HasAmount(val3, ScarletJackpot.Constants.Constants.SPIN_COST_PREFAB, betAmount)) { InventoryService.RemoveItem(val3, ScarletJackpot.Constants.Constants.SPIN_COST_PREFAB, betAmount); slotModel.InitializeSlotAnimation(val3); } } } ECSExtensions.Destroy(current, true); } } catch (Exception ex) { Log.Error((object)("Error in MoveAllItemsBetweenInventoriesSystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(MoveAllItemsBetweenInventoriesV2System), "OnUpdate")] [HarmonyPrefix] public static void Prefix(MoveAllItemsBetweenInventoriesV2System __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery _query_133601631_ = __instance.__query_133601631_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_133601631_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); Entity slot2 = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; MoveAllItemsBetweenInventoriesEventV2 val2 = ECSExtensions.Read<MoveAllItemsBetweenInventoriesEventV2>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (networkIdToEntityMap.TryGetValue(val2.ToInventory, ref slot) && networkIdToEntityMap.TryGetValue(val2.FromInventory, ref slot2) && (SlotService.Has(slot) || SlotService.Has(slot2))) { ECSExtensions.Destroy(current, true); } } } catch (Exception ex) { Log.Error((object)("Error in MoveAllItemsBetweenInventoriesV2SystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(SplitItemSystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(SplitItemSystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery query = __instance._Query; NativeArray<Entity> val = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; SplitItemEvent val2 = ECSExtensions.Read<SplitItemEvent>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (networkIdToEntityMap.TryGetValue(val2.Inventory, ref slot) && SlotService.Has(slot)) { ECSExtensions.Destroy(current, true); } } } catch (Exception ex) { Log.Error((object)("Error in SplitItemSystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(SplitItemV2System), "OnUpdate")] [HarmonyPrefix] public static void Prefix(SplitItemV2System __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery query = __instance._Query; NativeArray<Entity> val = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); Entity slot2 = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; SplitItemEventV2 val2 = ECSExtensions.Read<SplitItemEventV2>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (networkIdToEntityMap.TryGetValue(val2.FromInventory, ref slot) && networkIdToEntityMap.TryGetValue(val2.ToInventory, ref slot2) && (SlotService.Has(slot2) || SlotService.Has(slot))) { ECSExtensions.Destroy(current, true); } } } catch (Exception ex) { Log.Error((object)("Error in SplitItemV2SystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(SmartMergeItemsBetweenInventoriesSystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(SmartMergeItemsBetweenInventoriesSystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery _query_133601682_ = __instance.__query_133601682_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_133601682_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); Entity slot2 = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; SmartMergeItemsBetweenInventoriesEvent val2 = ECSExtensions.Read<SmartMergeItemsBetweenInventoriesEvent>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (networkIdToEntityMap.TryGetValue(val2.ToInventory, ref slot) && networkIdToEntityMap.TryGetValue(val2.FromInventory, ref slot2) && (SlotService.Has(slot) || SlotService.Has(slot2))) { ECSExtensions.Destroy(current, true); } } } catch (Exception ex) { Log.Error((object)("Error in SmartMergeItemsBetweenInventoriesSystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(EquipItemFromInventorySystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(EquipItemFromInventorySystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!GameSystems.Initialized) { return; } EntityQuery query = __instance._Query; NativeArray<Entity> val = ((EntityQuery)(ref query)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val.GetEnumerator(); Entity slot = default(Entity); while (enumerator.MoveNext()) { Entity current = enumerator.Current; EquipItemFromInventoryEvent val2 = ECSExtensions.Read<EquipItemFromInventoryEvent>(current); NativeParallelHashMap<NetworkId, Entity> networkIdToEntityMap = GameSystems.NetworkIdSystem._NetworkIdLookupMap._NetworkIdToEntityMap; if (networkIdToEntityMap.TryGetValue(val2.FromInventory, ref slot) && SlotService.Has(slot)) { ECSExtensions.Destroy(current, true); } } } catch (Exception ex) { Log.Error((object)("Error in UnEquipItemSystemPatch: " + ex.Message)); } finally { val.Dispose(); } } [HarmonyPatch(typeof(UnEquipItemSystem), "OnUpdate")] [HarmonyPrefix] public static void Prefix(UnEquipItemSystem __instance) { //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) //IL_001c: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to