Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Truck Slot Machine v1.0.1
EmpressSlots.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Empress")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5f1b735e473ca4ccf3b383128fbebd889cb564da")] [assembly: AssemblyProduct("EmpressSlots")] [assembly: AssemblyTitle("EmpressSlots")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Empress.REPO.EmpressSlots { internal static class EmpressSlotBundleVisuals { private const string BundleFileName = "empressslots"; private static readonly Dictionary<string, GameObject?> VisualPrefabs = new Dictionary<string, GameObject>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, AudioClip> AudioClipsByName = new Dictionary<string, AudioClip>(StringComparer.OrdinalIgnoreCase); private static readonly List<AudioClip> AudioClips = new List<AudioClip>(); private static ManualLogSource? _log; private static AssetBundle? _bundle; private static bool _loadAttempted; private static bool _audioLoaded; public static void Initialize(string pluginDirectory, ManualLogSource log) { _log = log; if (_loadAttempted) { return; } _loadAttempted = true; string text = Path.Combine(pluginDirectory, "empressslots"); if (!File.Exists(text)) { log.LogWarning((object)("Empress Slots asset bundle was not found at " + text + ". Falling back to procedural visuals.")); return; } try { foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles()) { if (string.Equals(((Object)allLoadedAssetBundle).name, "empressslots", StringComparison.OrdinalIgnoreCase)) { _bundle = allLoadedAssetBundle; log.LogInfo((object)"Using already-loaded Empress Slots asset bundle: empressslots"); return; } } _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle == (Object)null) { log.LogWarning((object)("Unity returned null when loading " + text + ". Falling back to procedural visuals.")); } else { log.LogInfo((object)("Loaded Empress Slots asset bundle: " + text)); } } catch (Exception arg) { log.LogWarning((object)$"Failed to load Empress Slots asset bundle {text}: {arg}"); _bundle = null; } } public static bool TryAttach(Transform parent, EmpressSlotDefinition definition) { //IL_0031: 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_0051: Unknown result type (might be due to invalid IL or missing references) GameObject val = LoadVisualPrefab(definition.PrefabName); if ((Object)(object)val == (Object)null) { return false; } GameObject val2 = Object.Instantiate<GameObject>(val, parent, false); ((Object)val2).name = "EmpressSlotVisual"; val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; ((Object)val2).hideFlags = (HideFlags)52; SetLayerRecursively(val2.transform, ((Component)parent).gameObject.layer); Collider[] componentsInChildren = val2.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } StripParticleEffects(val2); return true; } public static AudioClip? LoadAudioClip(string name) { LoadAllAudioClips(); if (!AudioClipsByName.TryGetValue(name, out AudioClip value)) { return null; } return value; } private static AudioClip[] LoadAllAudioClips() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (_audioLoaded) { return AudioClips.ToArray(); } _audioLoaded = true; if ((Object)(object)_bundle == (Object)null) { return Array.Empty<AudioClip>(); } try { AudioClip[] array = _bundle.LoadAllAssets<AudioClip>(); foreach (AudioClip val in array) { if (!((Object)(object)val == (Object)null)) { if ((int)val.loadState == 0) { val.LoadAudioData(); } AudioClips.Add(val); AudioClipsByName[((Object)val).name] = val; } } } catch (Exception arg) { ManualLogSource? log = _log; if (log != null) { log.LogWarning((object)$"Failed to load Empress Slots audio clips from bundle: {arg}"); } } return AudioClips.ToArray(); } private static GameObject? LoadVisualPrefab(string prefabName) { if (VisualPrefabs.TryGetValue(prefabName, out GameObject value)) { return value; } if ((Object)(object)_bundle == (Object)null) { VisualPrefabs[prefabName] = null; return null; } try { GameObject val = _bundle.LoadAsset<GameObject>(prefabName); if ((Object)(object)val == (Object)null) { val = _bundle.LoadAsset<GameObject>("Assets/EmpressSlots/Prefabs/" + prefabName + ".prefab"); } if ((Object)(object)val == (Object)null) { ManualLogSource? log = _log; if (log != null) { log.LogWarning((object)("Empress Slots bundle is missing visual prefab '" + prefabName + "'.")); } } VisualPrefabs[prefabName] = val; return val; } catch (Exception arg) { ManualLogSource? log2 = _log; if (log2 != null) { log2.LogWarning((object)$"Failed to load visual prefab '{prefabName}' from Empress Slots bundle: {arg}"); } VisualPrefabs[prefabName] = null; return null; } } private static void SetLayerRecursively(Transform root, int layer) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown ((Component)root).gameObject.layer = layer; foreach (Transform item in root) { SetLayerRecursively(item, layer); } } private static void StripParticleEffects(GameObject root) { ParticleSystem[] componentsInChildren = root.GetComponentsInChildren<ParticleSystem>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } ParticleSystemRenderer[] componentsInChildren2 = root.GetComponentsInChildren<ParticleSystemRenderer>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.Destroy((Object)(object)componentsInChildren2[i]); } TrailRenderer[] componentsInChildren3 = root.GetComponentsInChildren<TrailRenderer>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.Destroy((Object)(object)componentsInChildren3[i]); } LineRenderer[] componentsInChildren4 = root.GetComponentsInChildren<LineRenderer>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { Object.Destroy((Object)(object)componentsInChildren4[i]); } } } internal sealed class EmpressSlotDefinition { public string PrefabName { get; } public string DisplayName { get; } public Type VolumeType { get; } public int ValueMin { get; } public int ValueMax { get; } public float Fragility { get; } public float Durability { get; } public float Mass { get; } public Color Primary { get; } public Color Secondary { get; } public Color Accent { get; } public Vector3 GrabBoundsCenter { get; } public Vector3 GrabBoundsSize { get; } public EmpressSlotDefinition(string prefabName, string displayName, Type volumeType, int valueMin, int valueMax, float fragility, float durability, float mass, Color primary, Color secondary, Color accent, Vector3 grabBoundsCenter, Vector3 grabBoundsSize) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_004c: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0066: Unknown result type (might be due to invalid IL or missing references) PrefabName = prefabName; DisplayName = displayName; VolumeType = volumeType; ValueMin = valueMin; ValueMax = valueMax; Fragility = fragility; Durability = durability; Mass = mass; Primary = primary; Secondary = secondary; Accent = accent; GrabBoundsCenter = grabBoundsCenter; GrabBoundsSize = grabBoundsSize; } } internal static class EmpressSlotDefinitions { public const string SlotMachinePrefabName = "EmpressSlotMachineVisual"; public static readonly EmpressSlotDefinition SlotMachine = new EmpressSlotDefinition("EmpressSlotMachineVisual", "Empress Slot Machine", (Type)3, 0, 0, 5f, 500f, 100f, C(98, 62, 110), C(227, 184, 75), C(byte.MaxValue, 96, 200), new Vector3(0f, 0.62f, 0f), new Vector3(1.18f, 1.22f, 1.02f)); public static EmpressSlotDefinition? FindByPrefabName(string prefabName) { if (!string.Equals(prefabName, "EmpressSlotMachineVisual", StringComparison.OrdinalIgnoreCase)) { return null; } return SlotMachine; } private static Color C(byte r, byte g, byte b) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Color((float)(int)r / 255f, (float)(int)g / 255f, (float)(int)b / 255f); } } internal static class EmpressSlotFallbackVisuals { public static readonly Type[] VolumeTypes; public static void Build(Transform root, EmpressSlotDefinition definition) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("EmpressSlotProceduralVisual"); val.transform.SetParent(root, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; val.transform.localScale = Vector3.one; string text = definition.PrefabName.ToLowerInvariant(); if (text.Contains("dog")) { BuildDog(val.transform, definition); } else if (text.Contains("van")) { BuildVan(val.transform, definition); } else { BuildProp(val.transform, definition); } } private static void BuildDog(Transform root, EmpressSlotDefinition definition) { //IL_0011: 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_004f: 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_0084: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) Material material = MaterialFor(definition.PrefabName + " Body", definition.Primary); Material material2 = MaterialFor(definition.PrefabName + " Accent", definition.Accent, emission: true); AddSphere(root, "Body", new Vector3(0f, 0.34f, 0f), new Vector3(0.34f, 0.2f, 0.2f), material); AddSphere(root, "Head", new Vector3(0f, 0.5f, -0.24f), new Vector3(0.18f, 0.16f, 0.16f), material); AddCube(root, "Ears", new Vector3(0f, 0.62f, -0.24f), new Vector3(0.34f, 0.06f, 0.08f), material2); AddCylinder(root, "Stand", new Vector3(0f, 0.035f, 0f), Quaternion.identity, new Vector3(0.56f, 0.035f, 0.56f), MaterialFor(definition.PrefabName + " Stand", definition.Secondary)); } private static void BuildVan(Transform root, EmpressSlotDefinition definition) { //IL_0011: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) Material material = MaterialFor(definition.PrefabName + " Body", definition.Primary); Material material2 = MaterialFor(definition.PrefabName + " Trim", definition.Secondary); Material material3 = MaterialFor(definition.PrefabName + " Lights", definition.Accent, emission: true); AddCube(root, "Body", new Vector3(0f, 0.35f, 0f), new Vector3(0.78f, 0.36f, 0.42f), material); AddCube(root, "Cabin", new Vector3(0.16f, 0.58f, 0f), new Vector3(0.4f, 0.22f, 0.38f), material2); AddCube(root, "Lights", new Vector3(0.4f, 0.36f, -0.22f), new Vector3(0.22f, 0.06f, 0.025f), material3); AddCylinder(root, "Front Wheel", new Vector3(0.26f, 0.14f, -0.25f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.13f, 0.08f, 0.13f), material2); AddCylinder(root, "Rear Wheel", new Vector3(-0.26f, 0.14f, -0.25f), Quaternion.Euler(90f, 0f, 0f), new Vector3(0.13f, 0.08f, 0.13f), material2); } private static void BuildProp(Transform root, EmpressSlotDefinition definition) { //IL_0011: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) Material material = MaterialFor(definition.PrefabName + " Primary", definition.Primary); Material material2 = MaterialFor(definition.PrefabName + " Secondary", definition.Secondary); Material material3 = MaterialFor(definition.PrefabName + " Accent", definition.Accent, emission: true); AddCube(root, "Core", new Vector3(0f, 0.36f, 0f), new Vector3(0.5f, 0.52f, 0.38f), material); AddCube(root, "Face", new Vector3(0f, 0.42f, -0.2f), new Vector3(0.42f, 0.2f, 0.025f), material3); AddCylinder(root, "Base", new Vector3(0f, 0.035f, 0f), Quaternion.identity, new Vector3(0.58f, 0.035f, 0.58f), material2); } private static GameObject AddCube(Transform parent, string name, Vector3 localPosition, Vector3 localScale, Material material) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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) return AddPrimitive(parent, name, (PrimitiveType)3, localPosition, Quaternion.identity, localScale, material); } private static GameObject AddSphere(Transform parent, string name, Vector3 localPosition, Vector3 localScale, Material material) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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) return AddPrimitive(parent, name, (PrimitiveType)0, localPosition, Quaternion.identity, localScale, material); } private static GameObject AddCylinder(Transform parent, string name, Vector3 localPosition, Quaternion localRotation, Vector3 localScale, Material material) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return AddPrimitive(parent, name, (PrimitiveType)2, localPosition, localRotation, localScale, material); } private static GameObject AddPrimitive(Transform parent, string name, PrimitiveType primitiveType, Vector3 localPosition, Quaternion localRotation, Vector3 localScale, Material material) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive(primitiveType); ((Object)obj).name = name; obj.transform.SetParent(parent, false); obj.transform.localPosition = localPosition; obj.transform.localRotation = localRotation; obj.transform.localScale = localScale; Collider component = obj.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } obj.GetComponent<Renderer>().sharedMaterial = material; return obj; } private static Material MaterialFor(string name, Color color, bool emission = false) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_003a: 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) Material val = new Material(Shader.Find("Standard")) { name = name, color = color, hideFlags = (HideFlags)61 }; if (emission) { val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", color * 0.85f); } return val; } static EmpressSlotFallbackVisuals() { Type[] array = new Type[7]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); VolumeTypes = (Type[])(object)array; } } internal static class EmpressSlotGrabBounds { private const int MaxColliderTriangles = 40; private const float MinColliderExtent = 0.015f; public static void Add(Transform root, EmpressSlotDefinition definition) { RemoveTemplateColliders(root); if (AddMeshColliders(root) == 0) { AddFallbackBox(root, definition); EmpressSlotsPlugin.Log.LogWarning((object)(definition.DisplayName + " had no usable renderer meshes for grab colliders; using fitted fallback bounds.")); } } private static int AddMeshColliders(Transform root) { int num = 0; Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (val.enabled && !(val is ParticleSystemRenderer)) { Mesh val2 = CreateCollisionMesh(val); if ((Object)(object)val2 == (Object)null || !HasValidCollisionShape(val2)) { DestroyMesh(val2); continue; } MeshCollider obj = ((Component)val).gameObject.AddComponent<MeshCollider>(); obj.cookingOptions = (MeshColliderCookingOptions)14; obj.convex = true; ((Collider)obj).isTrigger = false; obj.sharedMesh = val2; ConfigureColliderObject(((Component)val).gameObject); ((Component)val).gameObject.AddComponent<PhysGrabObjectCollider>(); EmpressSlotsAccess.HideGrabMeshColliderGizmo(((Component)val).gameObject.AddComponent<PhysGrabObjectMeshCollider>()); num++; } } return num; } private static Mesh? CreateCollisionMesh(Renderer renderer) { //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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Mesh val = null; Mesh val2 = null; SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((renderer is SkinnedMeshRenderer) ? renderer : null); if (val3 != null && (Object)(object)val3.sharedMesh != (Object)null) { val2 = new Mesh { name = ((Object)renderer).name + "_EmpressSlotGrabCollider", hideFlags = (HideFlags)61 }; try { val3.BakeMesh(val2); val = val2; } catch { val = val3.sharedMesh; } } else { MeshFilter component = ((Component)renderer).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { val = component.sharedMesh; } } Mesh val4 = CreateReducedMesh(val, ((Object)renderer).name + "_EmpressSlotGrabCollider"); if ((Object)(object)val4 == (Object)null && (Object)(object)val != (Object)null) { val4 = CreateBoxMesh(val.bounds, ((Object)renderer).name + "_EmpressSlotGrabCollider"); } DestroyMesh(val2); return val4; } private static Mesh? CreateReducedMesh(Mesh? sourceMesh, string name) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_0111: Expected O, but got Unknown //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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sourceMesh == (Object)null) { return null; } if (!sourceMesh.isReadable) { return null; } Vector3[] vertices = sourceMesh.vertices; int[] triangles = sourceMesh.triangles; if (!HasValidVertexSet(vertices, sourceMesh.bounds) || triangles.Length < 3) { return null; } int num = triangles.Length / 3; int num2 = Mathf.Min(num, 40); Vector3[] array = (Vector3[])(object)new Vector3[num2 * 3]; int[] array2 = new int[num2 * 3]; for (int i = 0; i < num2; i++) { int num3 = ((num2 > 1) ? Mathf.RoundToInt((float)i * ((float)num - 1f) / ((float)num2 - 1f)) : 0) * 3; int num4 = i * 3; array[num4] = vertices[triangles[num3]]; array[num4 + 1] = vertices[triangles[num3 + 1]]; array[num4 + 2] = vertices[triangles[num3 + 2]]; array2[num4] = num4; array2[num4 + 1] = num4 + 1; array2[num4 + 2] = num4 + 2; } Mesh val = new Mesh { name = name, hideFlags = (HideFlags)61 }; val.vertices = array; val.triangles = array2; val.RecalculateBounds(); if (!HasValidCollisionShape(val)) { DestroyMesh(val); return null; } return val; } private static Mesh? CreateBoxMesh(Bounds bounds, string name) { //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_0010: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_005b: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0097: 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_00a9: 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_00b5: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown Vector3 size = ((Bounds)(ref bounds)).size; if (Mathf.Max(new float[3] { size.x, size.y, size.z }) < 0.015f) { return null; } Vector3 min = ((Bounds)(ref bounds)).min; Vector3 max = ((Bounds)(ref bounds)).max; Vector3[] vertices = (Vector3[])(object)new Vector3[8] { new Vector3(min.x, min.y, min.z), new Vector3(max.x, min.y, min.z), new Vector3(max.x, max.y, min.z), new Vector3(min.x, max.y, min.z), new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), new Vector3(max.x, max.y, max.z), new Vector3(min.x, max.y, max.z) }; int[] triangles = new int[36] { 0, 2, 1, 0, 3, 2, 4, 5, 6, 4, 6, 7, 0, 1, 5, 0, 5, 4, 2, 3, 7, 2, 7, 6, 1, 2, 6, 1, 6, 5, 3, 0, 4, 3, 4, 7 }; Mesh val = new Mesh { name = name, hideFlags = (HideFlags)61, vertices = vertices, triangles = triangles }; val.RecalculateBounds(); return val; } private static bool HasValidCollisionShape(Mesh mesh) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (mesh.isReadable && mesh.vertexCount >= 3) { return HasValidVertexSet(mesh.vertices, mesh.bounds); } return false; } private static bool HasValidVertexSet(IReadOnlyList<Vector3> vertices, Bounds bounds) { //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_0010: 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_0022: 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_004a: 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_006c: 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) Vector3 size = ((Bounds)(ref bounds)).size; if (Mathf.Max(new float[3] { size.x, size.y, size.z }) < 0.015f) { return false; } HashSet<Vector3Int> hashSet = new HashSet<Vector3Int>(); for (int i = 0; i < vertices.Count; i++) { Vector3 val = vertices[i]; hashSet.Add(new Vector3Int(Mathf.RoundToInt(val.x * 10000f), Mathf.RoundToInt(val.y * 10000f), Mathf.RoundToInt(val.z * 10000f))); if (hashSet.Count >= 3) { return true; } } return false; } private static void AddFallbackBox(Transform root, EmpressSlotDefinition definition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_007a: 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_00bc: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) Bounds val = CalculateVisualBounds(root); GameObject val2 = new GameObject("EmpressSlotFallbackGrabBounds"); val2.transform.SetParent(root, false); val2.transform.localPosition = root.InverseTransformPoint(((Bounds)(ref val)).center); val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; Vector3 size = ((Bounds)(ref val)).size; Vector3 lossyScale = root.lossyScale; size.x = ((lossyScale.x == 0f) ? definition.GrabBoundsSize.x : (size.x / Mathf.Abs(lossyScale.x))); size.y = ((lossyScale.y == 0f) ? definition.GrabBoundsSize.y : (size.y / Mathf.Abs(lossyScale.y))); size.z = ((lossyScale.z == 0f) ? definition.GrabBoundsSize.z : (size.z / Mathf.Abs(lossyScale.z))); BoxCollider obj = val2.AddComponent<BoxCollider>(); obj.center = Vector3.zero; obj.size = Vector3.Max(size, Vector3.one * 0.12f); ((Collider)obj).isTrigger = false; ConfigureColliderObject(val2); val2.AddComponent<PhysGrabObjectCollider>(); EmpressSlotsAccess.HideGrabBoxColliderGizmo(val2.AddComponent<PhysGrabObjectBoxCollider>()); } private static void ConfigureColliderObject(GameObject gameObject) { gameObject.tag = "Phys Grab Object"; int num = LayerMask.NameToLayer("PhysGrabObject"); if (num >= 0) { gameObject.layer = num; } } private static Bounds CalculateVisualBounds(Transform root) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); Bounds bounds = default(Bounds); ((Bounds)(ref bounds))..ctor(root.position, Vector3.one * 0.3f); bool flag = false; Renderer[] array = componentsInChildren; foreach (Renderer val in array) { if (val.enabled && !(val is ParticleSystemRenderer)) { if (flag) { ((Bounds)(ref bounds)).Encapsulate(val.bounds); continue; } bounds = val.bounds; flag = true; } } return bounds; } private static void RemoveTemplateColliders(Transform root) { PhysGrabObjectCollider[] componentsInChildren = ((Component)root).GetComponentsInChildren<PhysGrabObjectCollider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { DestroyComponent((Component)(object)componentsInChildren[i]); } PhysGrabObjectBoxCollider[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<PhysGrabObjectBoxCollider>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { DestroyComponent((Component)(object)componentsInChildren2[i]); } PhysGrabObjectMeshCollider[] componentsInChildren3 = ((Component)root).GetComponentsInChildren<PhysGrabObjectMeshCollider>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { DestroyComponent((Component)(object)componentsInChildren3[i]); } Collider[] componentsInChildren4 = ((Component)root).GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { DestroyComponent((Component)(object)componentsInChildren4[i]); } } private static void DestroyComponent(Component component) { if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } } private static void DestroyMesh(Mesh? mesh) { //IL_000a: 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 ((Object)(object)mesh != (Object)null && (((Object)mesh).hideFlags & 0x3D) != 0) { Object.DestroyImmediate((Object)(object)mesh); } } } internal sealed class EmpressSlotMachineController : MonoBehaviour { private enum Symbol { Cherry, Lemon, Grape, Watermelon, Bell, Seven } private enum Outcome { Jackpot, BigWin, SmallWin, MiniWin, NoWin } private static readonly float[] ReelDurations = new float[3] { 1.35f, 1.75f, 2.15f }; private static readonly string[] LevelUpgradeNames = new string[11] { "Health", "Stamina", "ExtraJump", "Launch", "Speed", "Strength", "Range", "Throw", "CrouchRest", "TumbleWings", "TumbleClimb" }; private EmpressSlotDefinition? _definition; private PhotonView? _photonView; private PhysGrabObject? _physGrabObject; private Rigidbody? _rigidbody; private AudioSource? _audioSource; private Transform? _handle; private Quaternion _handleRestRotation; private Transform[] _rollers = (Transform[])(object)new Transform[3]; private Vector3[] _rollerBaseEuler = (Vector3[])(object)new Vector3[3]; private Vector3 _homePosition; private Quaternion _homeRotation; private bool _homePoseSet; private bool _partsCached; private bool _isSpinning; private float _nextGrabTime; private Coroutine? _spinRoutine; private string? _lastInteractorSteamId; private string? _pendingLevelRewardSteamId; private string? _pendingLevelRewardUpgrade; private int _pendingShopWinAmount; public void ConfigurePrefab(EmpressSlotDefinition definition) { _definition = definition; } internal static void TriggerFrom(PhysGrabObject physGrabObject, string source) { EmpressSlotMachineController empressSlotMachineController = ResolveController(physGrabObject); if (!((Object)(object)empressSlotMachineController == (Object)null)) { empressSlotMachineController.RememberInteractor(EmpressSlotsAccess.GetPrimaryGrabberSteamId(physGrabObject)); empressSlotMachineController.OnGrabbed(source); } } internal static void TriggerFrom(PhysGrabObject physGrabObject, string source, PhysGrabber? grabber) { EmpressSlotMachineController empressSlotMachineController = ResolveController(physGrabObject); if (!((Object)(object)empressSlotMachineController == (Object)null)) { empressSlotMachineController.RememberInteractor(EmpressSlotsAccess.GetGrabberSteamId(grabber)); empressSlotMachineController.OnGrabbed(source); } } internal static void TriggerFrom(PhysGrabObject physGrabObject, string source, int playerPhotonId) { EmpressSlotMachineController empressSlotMachineController = ResolveController(physGrabObject); if (!((Object)(object)empressSlotMachineController == (Object)null)) { empressSlotMachineController.RememberInteractor(EmpressSlotsAccess.GetGrabberSteamId(playerPhotonId)); empressSlotMachineController.OnGrabbed(source); } } public void SetHomePose(Vector3 position, Quaternion rotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) _homePosition = position; _homeRotation = rotation; _homePoseSet = true; } public void TeleportHomeImmediate() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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 (_homePoseSet) { ((Component)this).transform.SetPositionAndRotation(_homePosition, _homeRotation); if ((Object)(object)_rigidbody != (Object)null) { _rigidbody.position = _homePosition; _rigidbody.rotation = _homeRotation; StopRigidbodyMotion(); } } } public int ForceVisibleRenderers() { Transform val = ((Component)this).transform.Find("EmpressSlotVisual"); Transform obj = (((Object)(object)val != (Object)null) ? val : ((Component)this).transform); int num = 0; Renderer[] componentsInChildren = ((Component)obj).GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { if (!(val2 is ParticleSystemRenderer)) { val2.enabled = true; num++; } } if (num == 0) { CreateFallbackBeacon(); num = 1; } return num; } public void BroadcastHomePose() { //IL_003a: 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) if (_homePoseSet && IsHost() && SemiFunc.IsMultiplayer() && !((Object)(object)_photonView == (Object)null)) { _photonView.RPC("SetHomePoseRPC", (RpcTarget)1, new object[2] { _homePosition, _homeRotation }); } } private void Awake() { if (_definition == null) { _definition = EmpressSlotDefinitions.FindByPrefabName("EmpressSlotMachineVisual"); } _photonView = ((Component)this).GetComponent<PhotonView>(); _physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); _rigidbody = ((Component)this).GetComponent<Rigidbody>(); _audioSource = ((Component)this).GetComponent<AudioSource>() ?? ((Component)this).gameObject.AddComponent<AudioSource>(); _audioSource.playOnAwake = false; _audioSource.spatialBlend = 1f; _audioSource.rolloffMode = (AudioRolloffMode)1; _audioSource.minDistance = 1.5f; _audioSource.maxDistance = 18f; } private void Start() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) CacheParts(); if (!_homePoseSet) { SetHomePose(((Component)this).transform.position, ((Component)this).transform.rotation); } } private void FixedUpdate() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (IsHost() && _homePoseSet) { if ((Object)(object)_physGrabObject != (Object)null) { _physGrabObject.OverrideGrabForceZero(); } if ((Object)(object)_rigidbody != (Object)null) { _rigidbody.useGravity = false; _rigidbody.constraints = (RigidbodyConstraints)126; StopRigidbodyMotion(); } if (Vector3.Distance(((Component)this).transform.position, _homePosition) > 0.03f || Quaternion.Angle(((Component)this).transform.rotation, _homeRotation) > 1f) { TeleportHomeImmediate(); } } } private void OnGrabbed(string source) { if (!(Time.time < _nextGrabTime)) { _nextGrabTime = Time.time + 1.25f; if (IsHost()) { TryStartSpin(); } } } private void TryStartSpin() { //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) if (_isSpinning) { return; } bool flag = IsShopScene(); bool flag2 = IsLevelScene(); if (!flag && !flag2) { return; } string text = ResolveInteractorSteamId(); int num = 0; int num2 = 0; _pendingShopWinAmount = 0; _pendingLevelRewardSteamId = null; _pendingLevelRewardUpgrade = null; if (flag) { int num3 = SemiFunc.StatGetRunCurrency(); num = EmpressSlotsConfig.ShopSpinCostK; if (num3 < num) { SendNoMoneyFeedback(); return; } SemiFunc.StatSetRunCurrency(num3 - num); } else if (!TryChargeLevelHealth(text)) { SendNoMoneyFeedback(); return; } Symbol[] array = GenerateSymbols(); Outcome outcome = EvaluateOutcome(array); if (flag) { num2 = GetWinAmount(outcome, num); if (num2 > 0) { _pendingShopWinAmount = num2; } } else if (outcome != Outcome.NoWin) { num2 = 1; _pendingLevelRewardSteamId = text; _pendingLevelRewardUpgrade = PickRandomUpgradeName(); } if (SemiFunc.IsMultiplayer() && (Object)(object)_photonView != (Object)null) { _photonView.RPC("SpinRPC", (RpcTarget)0, new object[6] { (int)array[0], (int)array[1], (int)array[2], num, num2, (int)outcome }); } else { SpinRPC((int)array[0], (int)array[1], (int)array[2], num, num2, (int)outcome); } } private void SendNoMoneyFeedback() { //IL_002f: 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) if (SemiFunc.IsMultiplayer() && (Object)(object)_photonView != (Object)null) { _photonView.RPC("NoMoneyRPC", (RpcTarget)0, Array.Empty<object>()); } else { NoMoneyRPC(); } } [PunRPC] private void SpinRPC(int symbol0, int symbol1, int symbol2, int betAmount, int winAmount, int outcome, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMultiplayer() || SemiFunc.MasterOnlyRPC(info)) { Symbol[] symbols = new Symbol[3] { ClampSymbol(symbol0), ClampSymbol(symbol1), ClampSymbol(symbol2) }; if (_spinRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_spinRoutine); } _spinRoutine = ((MonoBehaviour)this).StartCoroutine(SpinRoutine(symbols, winAmount, (Outcome)Mathf.Clamp(outcome, 0, 4))); } } [PunRPC] private void SetHomePoseRPC(Vector3 position, Quaternion rotation, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0011: 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_0007: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMultiplayer() || SemiFunc.MasterOnlyRPC(info)) { SetHomePose(position, rotation); TeleportHomeImmediate(); } } [PunRPC] private void NoMoneyRPC(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMultiplayer() || SemiFunc.MasterOnlyRPC(info)) { if (_spinRoutine != null) { ((MonoBehaviour)this).StopCoroutine(_spinRoutine); } _spinRoutine = ((MonoBehaviour)this).StartCoroutine(NoMoneyRoutine()); } } private IEnumerator SpinRoutine(Symbol[] symbols, int winAmount, Outcome outcome) { _isSpinning = true; CacheParts(); PlayClip("Electronic_Slot_Machine_Pull_Handle_01", 0.9f); ((MonoBehaviour)this).StartCoroutine(PullHandleRoutine()); float[] startAngles = new float[_rollers.Length]; float[] targetAngles = new float[_rollers.Length]; bool[] stopped = new bool[_rollers.Length]; for (int i = 0; i < _rollers.Length; i++) { startAngles[i] = (((Object)(object)_rollers[i] != (Object)null) ? _rollers[i].localEulerAngles.x : 0f); targetAngles[i] = GetSpinTarget(startAngles[i], symbols[Mathf.Min(i, symbols.Length - 1)], i); } float totalDuration = ReelDurations[ReelDurations.Length - 1] + 0.15f; float timer = 0f; while (timer < totalDuration) { timer += Time.deltaTime; for (int j = 0; j < _rollers.Length; j++) { if ((Object)(object)_rollers[j] == (Object)null) { continue; } float num = ReelDurations[Mathf.Min(j, ReelDurations.Length - 1)]; if (timer < num) { float num2 = Mathf.Clamp01(timer / num); float num3 = 1f - Mathf.Pow(1f - num2, 3f); SetReelAngle(j, Mathf.Lerp(startAngles[j], targetAngles[j], num3)); continue; } SetReelAngle(j, SymbolToRotation(symbols[Mathf.Min(j, symbols.Length - 1)])); if (!stopped[j]) { stopped[j] = true; PlayClip("slot_machine_spin_stop_03", 0.75f); } } yield return null; } for (int k = 0; k < _rollers.Length; k++) { if ((Object)(object)_rollers[k] != (Object)null) { SetReelAngle(k, SymbolToRotation(symbols[Mathf.Min(k, symbols.Length - 1)])); } } if (winAmount > 0) { PlayClip("slot_machine_win_07", (outcome == Outcome.Jackpot) ? 1.15f : 0.9f); ((MonoBehaviour)this).StartCoroutine(WinPulseRoutine(outcome)); GrantPendingShopReward(); GrantPendingLevelReward(); } yield return (object)new WaitForSeconds(0.25f); _isSpinning = false; _spinRoutine = null; } private IEnumerator NoMoneyRoutine() { _isSpinning = true; CacheParts(); PlayClip("slot_machine_spin_stop_03", 0.8f); yield return PullHandleRoutine(); yield return (object)new WaitForSeconds(0.35f); _isSpinning = false; _spinRoutine = null; } private IEnumerator PullHandleRoutine() { if (!((Object)(object)_handle == (Object)null)) { Quaternion rest = _handleRestRotation; Quaternion pulled = rest * Quaternion.Euler(-42f, 0f, 0f); float timer2 = 0f; while (timer2 < 0.16f) { timer2 += Time.deltaTime; _handle.localRotation = Quaternion.Slerp(rest, pulled, Mathf.Clamp01(timer2 / 0.16f)); yield return null; } timer2 = 0f; while (timer2 < 0.38f) { timer2 += Time.deltaTime; _handle.localRotation = Quaternion.Slerp(pulled, rest, Mathf.Clamp01(timer2 / 0.38f)); yield return null; } _handle.localRotation = rest; } } private IEnumerator WinPulseRoutine(Outcome outcome) { Color color = (Color)(outcome switch { Outcome.Jackpot => new Color(1f, 0.25f, 0.95f), Outcome.BigWin => new Color(1f, 0.78f, 0.15f), Outcome.SmallWin => new Color(0.25f, 1f, 0.55f), _ => new Color(0.4f, 0.85f, 1f), }); GameObject lightObject = new GameObject("EmpressSlotMachineWinLight") { hideFlags = (HideFlags)61 }; lightObject.transform.SetParent(((Component)this).transform, false); lightObject.transform.localPosition = new Vector3(0f, 1.05f, 0f); Light light = lightObject.AddComponent<Light>(); light.type = (LightType)2; light.color = color; light.range = ((outcome == Outcome.Jackpot) ? 4.5f : 2.8f); float timer = 0f; while (timer < 1.25f) { timer += Time.deltaTime; float num = Mathf.Sin(timer * 22f) * 0.5f + 0.5f; light.intensity = Mathf.Lerp(0.5f, (outcome == Outcome.Jackpot) ? 5f : 2.5f, num) * (1f - timer / 1.25f); yield return null; } Object.Destroy((Object)(object)lightObject); } private void CacheParts() { //IL_0079: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_012b: 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_0130: Unknown result type (might be due to invalid IL or missing references) if (_partsCached && _rollers.Length >= 3 && (Object)(object)_rollers[0] != (Object)null && (Object)(object)_rollers[1] != (Object)null && (Object)(object)_rollers[2] != (Object)null) { return; } Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); _handle = FindByName(componentsInChildren, "Handle"); _handleRestRotation = (((Object)(object)_handle != (Object)null) ? _handle.localRotation : Quaternion.identity); List<Transform> list = new List<Transform>(3); Transform[] array = componentsInChildren; foreach (Transform val in array) { if (((Object)val).name == "Roller") { list.Add(val); } } list.Sort((Transform left, Transform right) => left.position.x.CompareTo(right.position.x)); for (int j = 0; j < _rollers.Length; j++) { _rollers[j] = ((j < list.Count) ? list[j] : null); _rollerBaseEuler[j] = (((Object)(object)_rollers[j] != (Object)null) ? _rollers[j].localEulerAngles : Vector3.zero); } _partsCached = true; } private void StopRigidbodyMotion() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rigidbody == (Object)null) && !_rigidbody.isKinematic) { _rigidbody.velocity = Vector3.zero; _rigidbody.angularVelocity = Vector3.zero; } } private void CreateFallbackBeacon() { //IL_0051: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown if (!((Object)(object)((Component)this).transform.Find("EmpressSlotMachineFallbackBeacon") != (Object)null)) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = "EmpressSlotMachineFallbackBeacon"; obj.transform.SetParent(((Component)this).transform, false); obj.transform.localPosition = new Vector3(0f, 0.85f, 0f); obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = new Vector3(0.55f, 1.1f, 0.35f); Collider component = obj.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = obj.GetComponent<Renderer>(); if ((Object)(object)component2 != (Object)null) { component2.sharedMaterial = new Material(Shader.Find("Standard")) { color = new Color(1f, 0.12f, 0.8f, 1f) }; } } } private static EmpressSlotMachineController? ResolveController(PhysGrabObject physGrabObject) { if ((Object)(object)physGrabObject == (Object)null) { return null; } EmpressSlotMachineController empressSlotMachineController = ((Component)physGrabObject).GetComponent<EmpressSlotMachineController>(); if ((Object)(object)empressSlotMachineController == (Object)null) { empressSlotMachineController = ((Component)physGrabObject).GetComponentInChildren<EmpressSlotMachineController>(true); } return empressSlotMachineController; } private void RememberInteractor(string? steamId) { if (!string.IsNullOrWhiteSpace(steamId)) { _lastInteractorSteamId = steamId; } } private string? ResolveInteractorSteamId() { if (!string.IsNullOrWhiteSpace(_lastInteractorSteamId)) { return _lastInteractorSteamId; } string primaryGrabberSteamId = EmpressSlotsAccess.GetPrimaryGrabberSteamId(_physGrabObject); if (!string.IsNullOrWhiteSpace(primaryGrabberSteamId)) { _lastInteractorSteamId = primaryGrabberSteamId; return primaryGrabberSteamId; } string playerSteamId = EmpressSlotsAccess.GetPlayerSteamId(EmpressSlotsAccess.GetLocalPlayerAvatar()); if (!string.IsNullOrWhiteSpace(playerSteamId)) { _lastInteractorSteamId = playerSteamId; } return _lastInteractorSteamId; } private static bool TryChargeLevelHealth(string? steamId) { PlayerAvatar val = EmpressSlotsAccess.GetPlayerAvatarFromSteamId(steamId) ?? EmpressSlotsAccess.GetLocalPlayerAvatar(); if ((Object)(object)val == (Object)null || !EmpressSlotsAccess.CanAffectPlayer(val)) { return false; } EmpressSlotsAccess.HurtPlayer(val, EmpressSlotsConfig.LevelSpinHealthCost); return true; } private void GrantPendingShopReward() { if (IsHost() && _pendingShopWinAmount > 0 && IsShopScene()) { SemiFunc.StatSetRunCurrency(SemiFunc.StatGetRunCurrency() + _pendingShopWinAmount); _pendingShopWinAmount = 0; } } private void GrantPendingLevelReward() { if (IsHost() && !string.IsNullOrWhiteSpace(_pendingLevelRewardSteamId) && !string.IsNullOrWhiteSpace(_pendingLevelRewardUpgrade)) { EmpressSlotsAccess.GrantPlayerUpgrade(_pendingLevelRewardSteamId, _pendingLevelRewardUpgrade, 1); _pendingLevelRewardSteamId = null; _pendingLevelRewardUpgrade = null; } } private static string PickRandomUpgradeName() { return LevelUpgradeNames[Random.Range(0, LevelUpgradeNames.Length)]; } private static Transform? FindByName(Transform[] transforms, string name) { foreach (Transform val in transforms) { if (((Object)val).name == name) { return val; } } return null; } private void SetReelAngle(int index, float angle) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (index >= 0 && index < _rollers.Length && !((Object)(object)_rollers[index] == (Object)null)) { Vector3 localEulerAngles = _rollerBaseEuler[index]; localEulerAngles.x = Mathf.Repeat(angle, 360f); _rollers[index].localEulerAngles = localEulerAngles; } } private void PlayClip(string clipName, float volume) { if (!((Object)(object)_audioSource == (Object)null)) { AudioClip val = EmpressSlotBundleVisuals.LoadAudioClip(clipName); if (!((Object)(object)val == (Object)null)) { _audioSource.PlayOneShot(val, volume); } } } private static Symbol[] GenerateSymbols() { return new Symbol[3] { (Symbol)Random.Range(0, 6), (Symbol)Random.Range(0, 6), (Symbol)Random.Range(0, 6) }; } private static Outcome EvaluateOutcome(Symbol[] symbols) { if (IsUniform(symbols)) { if (symbols[0] != Symbol.Seven) { return Outcome.BigWin; } return Outcome.Jackpot; } return Outcome.NoWin; } private static int GetWinAmount(Outcome outcome, int betAmount) { return outcome switch { Outcome.Jackpot => betAmount * 25, Outcome.BigWin => betAmount * 10, Outcome.SmallWin => betAmount * 4, Outcome.MiniWin => betAmount * 2, _ => 0, }; } private static bool IsUniform(Symbol[] symbols) { if (symbols[0] == symbols[1]) { return symbols[1] == symbols[2]; } return false; } private static float GetSpinTarget(float startAngle, Symbol symbol, int reelIndex) { float num = SymbolToRotation(symbol); float num2 = Mathf.DeltaAngle(Mathf.Repeat(startAngle, 360f), num); if (num2 < 0f) { num2 += 360f; } return startAngle + num2 + 360f * (float)(4 + reelIndex); } private static float SymbolToRotation(Symbol symbol) { return symbol switch { Symbol.Cherry => 120f, Symbol.Lemon => 240f, Symbol.Grape => 300f, Symbol.Watermelon => 60f, Symbol.Bell => 180f, Symbol.Seven => 0f, _ => 0f, }; } private static Symbol ClampSymbol(int value) { return (Symbol)Mathf.Clamp(value, 0, 5); } private static bool IsHost() { try { return SemiFunc.IsMasterClientOrSingleplayer(); } catch { return false; } } private static bool IsShopScene() { try { return (Object)(object)EmpressSlotsAccess.GetRunManagerInstance() != (Object)null && SemiFunc.RunIsShop(); } catch { return false; } } private static bool IsLevelScene() { try { return (Object)(object)EmpressSlotsAccess.GetRunManagerInstance() != (Object)null && SemiFunc.RunIsLevel(); } catch { return false; } } } internal sealed class EmpressSlotMachinePrefabFactory { public const string PrefabId = "Empress.EmpressSlots.SlotMachine"; public const string PrefabName = "EmpressSlotMachine"; private readonly ManualLogSource _log; private readonly Dictionary<Type, GameObject> _templates = new Dictionary<Type, GameObject>(); private GameObject? _prefabBank; public EmpressSlotMachinePrefabFactory(ManualLogSource log) { _log = log; } public PrefabRef? TryRegister() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) EmpressSlotDefinition empressSlotDefinition = EmpressSlotDefinitions.FindByPrefabName("EmpressSlotMachineVisual"); if (empressSlotDefinition == null) { _log.LogWarning((object)"Slot machine definition is missing."); return null; } ResolveTemplates(); GameObject template = GetTemplate(empressSlotDefinition.VolumeType); if ((Object)(object)template == (Object)null) { return null; } GameObject val = CreatePrefab(empressSlotDefinition, template); return NetworkPrefabs.RegisterNetworkPrefab("Empress.EmpressSlots.SlotMachine", val); } private void ResolveTemplates() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) _templates.Clear(); foreach (LevelValuables value in ValuablePresets.AllValuablePresets.Values) { Type[] volumeTypes = EmpressSlotFallbackVisuals.VolumeTypes; foreach (Type val in volumeTypes) { if (!_templates.ContainsKey(val)) { GameObject val2 = FindTemplateInList(EmpressSlotsAccess.GetList(value, val)); if ((Object)(object)val2 != (Object)null) { _templates.Add(val, val2); } } } } } private static GameObject? FindTemplateInList(List<PrefabRef>? prefabRefs) { if (prefabRefs == null) { return null; } foreach (PrefabRef prefabRef in prefabRefs) { if (prefabRef != null && prefabRef.IsValid()) { GameObject prefab = prefabRef.Prefab; if ((Object)(object)prefab != (Object)null && (Object)(object)prefab.GetComponent<PhysGrabObject>() != (Object)null && (Object)(object)prefab.GetComponent<PhotonView>() != (Object)null) { return prefab; } } } return null; } private GameObject? GetTemplate(Type type) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (_templates.TryGetValue(type, out GameObject value) && (Object)(object)value != (Object)null) { return value; } if (_templates.TryGetValue((Type)3, out value) && (Object)(object)value != (Object)null) { return value; } if (_templates.TryGetValue((Type)2, out value) && (Object)(object)value != (Object)null) { return value; } foreach (GameObject value2 in _templates.Values) { if ((Object)(object)value2 != (Object)null) { return value2; } } return null; } private GameObject CreatePrefab(EmpressSlotDefinition definition, GameObject template) { GameObject val = EnsurePrefabBank(); GameObject val2 = Object.Instantiate<GameObject>(template, val.transform, false); ((Object)val2).name = "EmpressSlotMachine"; ((Object)val2).hideFlags = (HideFlags)61; val2.SetActive(true); RemoveTemplateVisuals(val2); RemoveValuableIdentity(val2); if (!EmpressSlotBundleVisuals.TryAttach(val2.transform, definition)) { EmpressSlotFallbackVisuals.Build(val2.transform, definition); } EmpressSlotGrabBounds.Add(val2.transform, definition); ConfigureStationaryPhysics(val2); (val2.GetComponent<EmpressSlotMachineController>() ?? val2.AddComponent<EmpressSlotMachineController>()).ConfigurePrefab(definition); return val2; } private GameObject EnsurePrefabBank() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if ((Object)(object)_prefabBank != (Object)null) { return _prefabBank; } _prefabBank = new GameObject("Empress Slots Prefab Bank") { hideFlags = (HideFlags)61 }; _prefabBank.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_prefabBank); return _prefabBank; } private static void RemoveTemplateVisuals(GameObject prefab) { Renderer[] componentsInChildren = prefab.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } MeshFilter[] componentsInChildren2 = prefab.GetComponentsInChildren<MeshFilter>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } } private static void RemoveValuableIdentity(GameObject prefab) { ValuableObject[] componentsInChildren = prefab.GetComponentsInChildren<ValuableObject>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } ValuableDiscoverCustom[] componentsInChildren2 = prefab.GetComponentsInChildren<ValuableDiscoverCustom>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } WorldSpaceUIValue[] componentsInChildren3 = prefab.GetComponentsInChildren<WorldSpaceUIValue>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } } private static void ConfigureStationaryPhysics(GameObject prefab) { Rigidbody component = prefab.GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.mass = 100f; component.drag = 20f; component.angularDrag = 20f; component.useGravity = false; component.constraints = (RigidbodyConstraints)126; } PhysGrabObject component2 = prefab.GetComponent<PhysGrabObject>(); if ((Object)(object)component2 != (Object)null) { EmpressSlotsAccess.MarkPhysGrabObjectSpawned(component2); } PhysGrabObjectImpactDetector component3 = prefab.GetComponent<PhysGrabObjectImpactDetector>(); if ((Object)(object)component3 != (Object)null) { EmpressSlotsAccess.ConfigureStationaryImpactDetector(component3); } } } internal sealed class EmpressSlotMachineSpawner : MonoBehaviour { private static readonly Vector3 ShopWorldPosition = new Vector3(-1.815f, 0.657f, -8.235f); private static readonly Vector3 ShopWorldEuler = new Vector3(0f, 90.556f, 0f); private const float LevelStationSideClearance = 0.9f; private const float LevelSlotPivotHeightFromStationFloor = 0.58f; private PrefabRef? _slotMachinePrefab; private ManualLogSource? _log; private GameObject? _spawned; private float _shopCheckTimer; public void Configure(PrefabRef slotMachinePrefab, ManualLogSource log) { _slotMachinePrefab = slotMachinePrefab; _log = log; } private void Update() { if (_slotMachinePrefab != null) { _shopCheckTimer -= Time.deltaTime; if (!(_shopCheckTimer > 0f)) { _shopCheckTimer = 0.5f; TickPresence(); } } } private void TickPresence() { //IL_0095: 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_00ba: Unknown result type (might be due to invalid IL or missing references) PrefabRef slotMachinePrefab = _slotMachinePrefab; if (slotMachinePrefab == null) { return; } if (!IsAllowedScene()) { DestroySpawnedIfHost(); return; } if (!IsHost()) { EmpressSlotMachineController? empressSlotMachineController = FindExistingMachine(); _spawned = ((empressSlotMachineController != null) ? ((Component)empressSlotMachineController).gameObject : null); return; } if ((Object)(object)_spawned != (Object)null) { MoveSelectedToHome(_spawned); return; } EmpressSlotMachineController empressSlotMachineController2 = FindExistingMachine(); Vector3 position; Quaternion rotation; if ((Object)(object)empressSlotMachineController2 != (Object)null) { _spawned = ((Component)empressSlotMachineController2).gameObject; DestroyExtraMachinesExcept(_spawned); MoveSelectedToHome(_spawned); } else if (ResolveHomePose(out position, out rotation)) { _spawned = NetworkPrefabs.SpawnNetworkPrefab(slotMachinePrefab, position, rotation, (byte)0, (object[])null); if (!((Object)(object)_spawned == (Object)null)) { ApplyHomePose(_spawned, ref position, rotation); } } } private void DestroySpawnedIfHost() { if (!IsHost()) { _spawned = null; return; } DestroyExtraMachinesExcept(null); _spawned = null; } private void MoveSelectedToHome(GameObject selected) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)selected == (Object)null) && ResolveHomePose(out var position, out var rotation) && !((Object)(object)selected.GetComponent<EmpressSlotMachineController>() == (Object)null)) { ApplyHomePose(selected, ref position, rotation); } } private static EmpressSlotMachineController? ApplyHomePose(GameObject selected, ref Vector3 position, Quaternion rotation) { //IL_001b: 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) EmpressSlotMachineController component = selected.GetComponent<EmpressSlotMachineController>(); if ((Object)(object)component == (Object)null) { return null; } component.ForceVisibleRenderers(); TryGroundLevelPose(selected, ref position, rotation); component.SetHomePose(position, rotation); component.TeleportHomeImmediate(); component.BroadcastHomePose(); return component; } private void DestroyExtraMachinesExcept(GameObject? keep) { if (!IsHost()) { return; } EmpressSlotMachineController[] array = Object.FindObjectsOfType<EmpressSlotMachineController>(); foreach (EmpressSlotMachineController empressSlotMachineController in array) { if (!((Object)(object)empressSlotMachineController == (Object)null) && !((Object)(object)((Component)empressSlotMachineController).gameObject == (Object)(object)keep)) { DestroyMachine(((Component)empressSlotMachineController).gameObject); } } } private static void DestroyMachine(GameObject target) { if ((Object)(object)target == (Object)null) { return; } try { if (SemiFunc.IsMultiplayer()) { PhotonNetwork.Destroy(target); } else { Object.Destroy((Object)(object)target); } } catch { Object.Destroy((Object)(object)target); } } private static bool ResolveHomePose(out Vector3 position, out Quaternion rotation) { //IL_0008: 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_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_001d: 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_0031: 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_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) if (IsShopScene()) { position = ShopWorldPosition; rotation = Quaternion.Euler(ShopWorldEuler); return true; } if (!IsLevelScene()) { position = ShopWorldPosition; rotation = Quaternion.Euler(ShopWorldEuler); return true; } Transform chargingStationTransform = EmpressSlotsAccess.GetChargingStationTransform(); if ((Object)(object)chargingStationTransform == (Object)null) { position = Vector3.zero; rotation = Quaternion.identity; return false; } ResolveChargingStationPose(chargingStationTransform, out position, out rotation); return true; } private static void ResolveChargingStationPose(Transform chargingStation, out Vector3 position, out Quaternion rotation) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_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_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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_00c5: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_0065: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.ProjectOnPlane(chargingStation.right, Vector3.up); Vector3 val2 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val2)).sqrMagnitude < 0.01f) { val2 = Vector3.right; } val = Vector3.ProjectOnPlane(chargingStation.forward, Vector3.up); Vector3 val3 = ((Vector3)(ref val)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.01f) { val3 = Vector3.forward; } if (TryGetUsefulBounds(chargingStation, out var bounds)) { float num = ProjectBoundsExtent(bounds, val2); position = ((Bounds)(ref bounds)).center + val2 * (num + 0.9f); position -= val3 * 0.1f; position.y = ((Bounds)(ref bounds)).min.y + 0.58f; } else { position = chargingStation.position + val2 * 1.6f - val3 * 0.1f; position.y = chargingStation.position.y + 0.58f; } rotation = Quaternion.LookRotation(val3, Vector3.up); } private static bool TryGroundLevelPose(GameObject selected, ref Vector3 position, Quaternion rotation) { //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0043: 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_0052: Unknown result type (might be due to invalid IL or missing references) if (!IsLevelScene() || IsShopScene() || !TryGetChargingStationFloor(out var floorY)) { return false; } Transform transform = selected.transform; Vector3 position2 = transform.position; Quaternion rotation2 = transform.rotation; transform.SetPositionAndRotation(position, rotation); Bounds bounds; bool flag = TryGetUsefulBounds(transform, out bounds); transform.SetPositionAndRotation(position2, rotation2); if (!flag) { return false; } float num = floorY - ((Bounds)(ref bounds)).min.y + 0.01f; if (Mathf.Abs(num) < 0.002f) { return false; } position.y += num; return true; } private static bool TryGetChargingStationFloor(out float floorY) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) floorY = 0f; Transform chargingStationTransform = EmpressSlotsAccess.GetChargingStationTransform(); if ((Object)(object)chargingStationTransform == (Object)null || !TryGetUsefulBounds(chargingStationTransform, out var bounds)) { return false; } floorY = ((Bounds)(ref bounds)).min.y; return true; } private static bool TryGetUsefulBounds(Transform root, out Bounds bounds) { //IL_0004: 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_000e: 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_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_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_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_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_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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) bool flag = false; bounds = new Bounds(root.position, Vector3.zero); Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(false); Bounds bounds2; Vector3 size; foreach (Renderer val in componentsInChildren) { if ((Object)(object)val == (Object)null || val is ParticleSystemRenderer || val is LineRenderer) { continue; } bounds2 = val.bounds; size = ((Bounds)(ref bounds2)).size; if (((Vector3)(ref size)).sqrMagnitude <= 0.001f) { continue; } bounds2 = val.bounds; size = ((Bounds)(ref bounds2)).size; if (!(((Vector3)(ref size)).sqrMagnitude > 100f)) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } if (flag) { return true; } Collider[] componentsInChildren2 = ((Component)root).GetComponentsInChildren<Collider>(false); foreach (Collider val2 in componentsInChildren2) { if ((Object)(object)val2 == (Object)null || val2.isTrigger) { continue; } bounds2 = val2.bounds; size = ((Bounds)(ref bounds2)).size; if (((Vector3)(ref size)).sqrMagnitude <= 0.001f) { continue; } bounds2 = val2.bounds; size = ((Bounds)(ref bounds2)).size; if (!(((Vector3)(ref size)).sqrMagnitude > 100f)) { if (!flag) { bounds = val2.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val2.bounds); } } } return flag; } private static float ProjectBoundsExtent(Bounds bounds, Vector3 direction) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Vector3 normalized = ((Vector3)(ref direction)).normalized; return Mathf.Abs(normalized.x) * ((Bounds)(ref bounds)).extents.x + Mathf.Abs(normalized.y) * ((Bounds)(ref bounds)).extents.y + Mathf.Abs(normalized.z) * ((Bounds)(ref bounds)).extents.z; } private static bool IsAllowedScene() { try { return (Object)(object)EmpressSlotsAccess.GetRunManagerInstance() != (Object)null && (SemiFunc.RunIsShop() || EmpressSlotsAccess.CurrentLevelLooksLikeShop() || SemiFunc.RunIsLevel()); } catch { return false; } } private static bool IsShopScene() { try { return (Object)(object)EmpressSlotsAccess.GetRunManagerInstance() != (Object)null && (SemiFunc.RunIsShop() || EmpressSlotsAccess.CurrentLevelLooksLikeShop()); } catch { return false; } } private static bool IsLevelScene() { try { return (Object)(object)EmpressSlotsAccess.GetRunManagerInstance() != (Object)null && SemiFunc.RunIsLevel(); } catch { return false; } } private static bool IsHost() { try { return SemiFunc.IsMasterClientOrSingleplayer(); } catch { return false; } } private static EmpressSlotMachineController? FindExistingMachine() { return Object.FindObjectOfType<EmpressSlotMachineController>(); } } internal static class EmpressSlotsAccess { internal readonly struct TruckAnchorCandidate { public string Kind { get; } public Transform Transform { get; } public TruckAnchorCandidate(string kind, Transform transform) { Kind = kind; Transform = transform; } } private delegate void PlayerHealthHurtOtherDelegate(PlayerHealth instance, int damage, Vector3 hurtPosition, bool savingGrace, int enemyIndex, bool hurtByHeal); private delegate void PlayerTumbleRequestDelegate(PlayerTumble instance, bool isTumbling, bool playerInput); private delegate void PlayerTumbleOverrideTimeDelegate(PlayerTumble instance, float time); private delegate void EnemyHealthHurtDelegate(EnemyHealth instance, int damage, Vector3 hurtDirection); private delegate void ImpactDestroyObjectDelegate(PhysGrabObjectImpactDetector instance, bool effects); private delegate PlayerAvatar? PlayerAvatarFromSteamIdDelegate(string steamID); private delegate void PunTesterUpgradeCommandDelegate(PunManager instance, string steamID, string upgradeName, int upgradeNum, PhotonMessageInfo info); private static readonly FieldRef<RunManager> RunManagerInstanceRef = AccessTools.StaticFieldRefAccess<RunManager>(RequiredField(typeof(RunManager), "instance")); private static readonly FieldRef<PlayerAvatar> PlayerAvatarInstanceRef = AccessTools.StaticFieldRefAccess<PlayerAvatar>(RequiredField(typeof(PlayerAvatar), "instance")); private static readonly FieldRef<PunManager> PunManagerInstanceRef = AccessTools.StaticFieldRefAccess<PunManager>(RequiredField(typeof(PunManager), "instance")); private static readonly FieldRef<LevelGenerator> LevelGeneratorInstanceRef = AccessTools.StaticFieldRefAccess<LevelGenerator>(RequiredField(typeof(LevelGenerator), "Instance")); private static readonly FieldRef<TruckSafetySpawnPoint> TruckSafetySpawnPointInstanceRef = AccessTools.StaticFieldRefAccess<TruckSafetySpawnPoint>(RequiredField(typeof(TruckSafetySpawnPoint), "instance")); private static readonly FieldRef<TruckHealer> TruckHealerInstanceRef = AccessTools.StaticFieldRefAccess<TruckHealer>(RequiredField(typeof(TruckHealer), "instance")); private static readonly FieldRef<TruckScreenText> TruckScreenTextInstanceRef = AccessTools.StaticFieldRefAccess<TruckScreenText>(RequiredField(typeof(TruckScreenText), "instance")); private static readonly FieldRef<ChargingStation> ChargingStationInstanceRef = AccessTools.StaticFieldRefAccess<ChargingStation>(RequiredField(typeof(ChargingStation), "instance")); private static readonly FieldRef<LevelValuables, List<PrefabRef>> TinyRef = AccessTools.FieldRefAccess<LevelValuables, List<PrefabRef>>("tiny"); private static readonly FieldRef<LevelValuables, List<PrefabRef>> SmallRef = AccessTools.FieldRefAccess<LevelValuables, List<PrefabRef>>("small"); private static readonly FieldRef<LevelValuables, List<PrefabRef>> MediumRef = AccessTools.FieldRefAccess<LevelValuables, List<PrefabRef>>("medium"); private static readonly FieldRef<LevelValuables, List<PrefabRef>> BigRef = AccessTools.FieldRefAccess<LevelValuables, List<PrefabRef>>("big"); private static readonly FieldRef<LevelValuables, List<PrefabRef>> WideRef = AccessTools.FieldRefAccess<LevelValuables, List<PrefabRef>>("wide"); private static readonly FieldRef<LevelValuables, List<PrefabRef>> TallRef = AccessTools.FieldRefAccess<LevelValuables, List<PrefabRef>>("tall"); private static readonly FieldRef<LevelValuables, List<PrefabRef>> VeryTallRef = AccessTools.FieldRefAccess<LevelValuables, List<PrefabRef>>("veryTall"); private static readonly FieldRef<ValuableObject, Value> ValuePresetRef = AccessTools.FieldRefAccess<ValuableObject, Value>("valuePreset"); private static readonly FieldRef<ValuableObject, Durability> DurabilityPresetRef = AccessTools.FieldRefAccess<ValuableObject, Durability>("durabilityPreset"); private static readonly FieldRef<ValuableObject, PhysAttribute> PhysAttributePresetRef = AccessTools.FieldRefAccess<ValuableObject, PhysAttribute>("physAttributePreset"); private static readonly FieldRef<ValuableObject, Type> VolumeTypeRef = AccessTools.FieldRefAccess<ValuableObject, Type>("volumeType"); private static readonly FieldRef<ValuableObject, int> DollarValueOverrideRef = AccessTools.FieldRefAccess<ValuableObject, int>("dollarValueOverride"); private static readonly FieldRef<ValuableObject, bool> DebugVolumeRef = AccessTools.FieldRefAccess<ValuableObject, bool>("debugVolume"); private static readonly FieldRef<ValuableObject, Gradient> ParticleColorsRef = AccessTools.FieldRefAccess<ValuableObject, Gradient>("particleColors"); private static readonly FieldRef<Value, float> ValueMinRef = AccessTools.FieldRefAccess<Value, float>("valueMin"); private static readonly FieldRef<Value, float> ValueMaxRef = AccessTools.FieldRefAccess<Value, float>("valueMax"); private static readonly FieldRef<Durability, float> FragilityRef = AccessTools.FieldRefAccess<Durability, float>("fragility"); private static readonly FieldRef<Durability, float> DurabilityRef = AccessTools.FieldRefAccess<Durability, float>("durability"); private static readonly FieldRef<PhysAttribute, float> MassRef = AccessTools.FieldRefAccess<PhysAttribute, float>("mass"); private static readonly FieldRef<PhysGrabObject, bool> GrabbedRef = AccessTools.FieldRefAccess<PhysGrabObject, bool>("grabbed"); private static readonly FieldRef<PhysGrabObject, bool> GrabbedLocalRef = AccessTools.FieldRefAccess<PhysGrabObject, bool>("grabbedLocal"); private static readonly FieldRef<PhysGrabObject, bool> HeldByLocalPlayerRef = AccessTools.FieldRefAccess<PhysGrabObject, bool>("heldByLocalPlayer"); private static readonly FieldRef<PhysGrabObject, List<PhysGrabber>> PlayerGrabbingRef = AccessTools.FieldRefAccess<PhysGrabObject, List<PhysGrabber>>("playerGrabbing"); private static readonly FieldRef<PhysGrabObject, bool> SpawnedRef = AccessTools.FieldRefAccess<PhysGrabObject, bool>("spawned"); private static readonly FieldRef<PhysGrabObjectImpactDetector, int> BreakLevelHeavyRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, int>("breakLevelHeavy"); private static readonly FieldRef<PhysGrabObjectImpactDetector, int> BreakLevelMediumRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, int>("breakLevelMedium"); private static readonly FieldRef<PhysGrabObjectImpactDetector, int> BreakLevelLightRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, int>("breakLevelLight"); private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> DestroyDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("destroyDisable"); private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> DestroyInvestigateRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("destroyInvestigate"); private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ImpactDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("impactDisable"); private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> PlayerHurtDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("playerHurtDisable"); private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ParticleDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("particleDisable"); private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> ParticleBreakSmokeDisableRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("particleBreakSmokeDisable"); private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> IsIndestructibleRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("isIndestructible"); private static readonly FieldRef<PhysGrabObjectImpactDetector, bool> IndestructibleBreakEffectsRef = AccessTools.FieldRefAccess<PhysGrabObjectImpactDetector, bool>("indestructibleBreakEffects"); private static readonly FieldRef<RunManager, Level> RunManagerLevelCurrentRef = AccessTools.FieldRefAccess<RunManager, Level>("levelCurrent"); private static readonly FieldRef<Level, string> LevelNarrativeNameRef = AccessTools.FieldRefAccess<Level, string>("NarrativeName"); private static readonly FieldRef<PlayerAvatar, bool> PlayerIsDisabledRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isDisabled"); private static readonly FieldRef<PlayerAvatar, bool> PlayerDeadSetRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("deadSet"); private static readonly FieldRef<PlayerAvatar, string> PlayerSteamIdRef = AccessTools.FieldRefAccess<PlayerAvatar, string>("steamID"); private static readonly FieldRef<PlayerAvatar, PlayerHealth> PlayerHealthRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerHealth>("playerHealth"); private static readonly FieldRef<PlayerAvatar, PlayerTumble> PlayerTumbleRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble"); private static readonly FieldRef<PhysGrabber, PlayerAvatar> GrabberPlayerAvatarRef = AccessTools.FieldRefAccess<PhysGrabber, PlayerAvatar>("playerAvatar"); private static readonly FieldRef<PunManager, PhotonView> PunManagerPhotonViewRef = AccessTools.FieldRefAccess<PunManager, PhotonView>("photonView"); private static readonly FieldRef<LevelGenerator, LevelPoint> LevelPathTruckRef = AccessTools.FieldRefAccess<LevelGenerator, LevelPoint>("LevelPathTruck"); private static readonly FieldRef<LevelPoint, RoomVolume> LevelPointRoomRef = AccessTools.FieldRefAccess<LevelPoint, RoomVolume>("Room"); private static readonly FieldRef<RoomVolume, bool> RoomVolumeTruckRef = AccessTools.FieldRefAccess<RoomVolume, bool>("Truck"); private static readonly FieldRef<RoomVolume, Module> RoomVolumeModuleRef = AccessTools.FieldRefAccess<RoomVolume, Module>("Module"); private static readonly FieldRef<