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 The Club v1.0.0
BepInEx/plugins/Omniscye-Empress_Club/EmpressClub.dll
Decompiled 5 hours 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.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Empress_ShopLoaderAPI; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [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("Omniscye")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("EmpressClub")] [assembly: AssemblyTitle("EmpressClub")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Empress.REPO.EmpressClub { public sealed class EmpressClubAmbience : MonoBehaviour { private static readonly Color BaseAmbient = new Color(0.23f, 0.24f, 0.28f, 1f); private readonly List<Material> _reactiveMaterials = new List<Material>(); private readonly List<Color> _originalEmission = new List<Color>(); private readonly List<Light> _clubLights = new List<Light>(); private readonly List<float> _originalLightIntensity = new List<float>(); private readonly float[] _spectrum = new float[1024]; private AudioSource _music; private AudioSource _ambience; private Color _trackColor = new Color(0.2f, 0.75f, 1f, 1f); private Color _originalAmbient; private float _bassFloor; private float _bassPeak; private float _pulse; private int _trackIndex = -1; internal static string CurrentTrackName { get; private set; } = "the club mix"; private IEnumerator Start() { _originalAmbient = RenderSettings.ambientLight; CollectReactiveObjects(); CollectClubLights(); ApplyBrightness(); while (!EmpressClubAssets.AudioReady) { yield return null; } if ((Object)(object)EmpressClubAssets.Ambience != (Object)null) { _ambience = ((Component)this).gameObject.AddComponent<AudioSource>(); _ambience.clip = EmpressClubAssets.Ambience; _ambience.loop = true; _ambience.spatialBlend = 0f; _ambience.volume = 0.22f; _ambience.Play(); } if (EmpressClubAssets.MusicTracks.Count > 0) { _music = ((Component)this).gameObject.AddComponent<AudioSource>(); _music.loop = false; _music.spatialBlend = 0f; _music.volume = Mathf.Clamp01(EmpressClubPlugin.MusicVolume.Value); PlayTrack(0); } } private void Update() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_music != (Object)null && EmpressClubAssets.MusicTracks.Count > 0) { _music.volume = Mathf.Clamp01(EmpressClubPlugin.MusicVolume.Value); if (!_music.isPlaying) { PlayTrack((_trackIndex + 1) % EmpressClubAssets.MusicTracks.Count); } UpdateBass(); } else { _pulse = Mathf.Lerp(_pulse, 0f, 1f - Mathf.Exp(-4f * Time.deltaTime)); } ApplyBrightness(); float num = Mathf.Clamp(EmpressClubPlugin.ClubBrightness.Value, 0.1f, 1.5f); float num2 = Mathf.InverseLerp(0.1f, 1.5f, num); for (int i = 0; i < _reactiveMaterials.Count; i++) { Material obj = _reactiveMaterials[i]; Color val = _originalEmission[i]; float num3 = Mathf.Clamp(((Color)(ref val)).maxColorComponent, 0.7f, 1.35f); Color val2 = Color.white * num3 * Mathf.Lerp(0.12f, 0.42f, num2); Color val3 = _trackColor * num3 * Mathf.Lerp(0.95f, 2.35f, _pulse) * Mathf.Lerp(0.75f, 1.15f, num2); obj.SetColor("_EmissionColor", Color.Lerp(val2, val3, _pulse)); } } private void PlayTrack(int index) { //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) if (!((Object)(object)_music == (Object)null) && EmpressClubAssets.MusicTracks.Count != 0) { _trackIndex = Mathf.Clamp(index, 0, EmpressClubAssets.MusicTracks.Count - 1); AudioClip val = EmpressClubAssets.MusicTracks[_trackIndex]; _music.clip = val; _trackColor = TrackColor(((Object)val).name); _bassFloor = 0f; _bassPeak = 0f; CurrentTrackName = ((Object)val).name; _music.Play(); EmpressClubPlugin.Log.LogInfo((object)("Empress Club now playing " + ((Object)val).name + ".")); } } private void UpdateBass() { _music.GetSpectrumData(_spectrum, 0, (FFTWindow)5); float num = (float)AudioSettings.outputSampleRate * 0.5f / (float)_spectrum.Length; int num2 = Mathf.Max(1, Mathf.CeilToInt(38f / num)); int num3 = Mathf.Min(_spectrum.Length - 1, Mathf.FloorToInt(165f / num)); float num4 = 0f; int num5 = 0; for (int i = num2; i <= num3; i++) { float num6 = _spectrum[i]; num4 += num6 * num6; num5++; } float num7 = ((num5 > 0) ? Mathf.Sqrt(num4 / (float)num5) : 0f); if (_bassFloor <= 0f) { _bassFloor = num7 * 0.55f; } else { _bassFloor = Mathf.Lerp(_bassFloor, num7, 1f - Mathf.Exp(-0.22f * Time.deltaTime)); } _bassPeak = Mathf.Max(num7, _bassPeak * Mathf.Exp(-1.15f * Time.deltaTime)); float num8 = Mathf.Max(2E-06f, _bassPeak - _bassFloor); float num9 = _bassFloor + num8 * 0.38f; float num10 = Mathf.Pow(Mathf.Clamp01((num7 - num9) / Mathf.Max(2E-06f, _bassPeak - num9)), 2.25f); float num11 = ((num10 > _pulse) ? 13f : 4.5f); _pulse = Mathf.Lerp(_pulse, num10, 1f - Mathf.Exp((0f - num11) * Time.deltaTime)); } private void CollectReactiveObjects() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) HashSet<Material> hashSet = new HashSet<Material>(); Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(true); float num = default(float); float num2 = default(float); float num3 = default(float); foreach (Renderer val in componentsInChildren) { if (IsCharacter(((Component)val).transform)) { continue; } Material[] materials = val.materials; foreach (Material val2 in materials) { if (!((Object)(object)val2 == (Object)null) && val2.HasProperty("_EmissionColor") && !hashSet.Contains(val2)) { Color color = val2.GetColor("_EmissionColor"); Color.RGBToHSV(color, ref num, ref num2, ref num3); if (!(num3 < 0.65f) && !(num2 > 0.12f)) { val2.EnableKeyword("_EMISSION"); hashSet.Add(val2); _reactiveMaterials.Add(val2); _originalEmission.Add(color); } } } } } private void CollectClubLights() { Light[] componentsInChildren = ((Component)this).GetComponentsInChildren<Light>(true); foreach (Light val in componentsInChildren) { if (!(((Object)val).name != "EmpressClubKeyLight") || ((Object)val).name.StartsWith("EmpressClubFillLight") || ((Object)val).name.StartsWith("EmpressClubReactiveLight")) { _clubLights.Add(val); _originalLightIntensity.Add(val.intensity); } } } private void ApplyBrightness() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(EmpressClubPlugin.ClubBrightness.Value, 0.1f, 1.5f); RenderSettings.ambientLight = new Color(BaseAmbient.r * num, BaseAmbient.g * num, BaseAmbient.b * num, 1f); for (int i = 0; i < _clubLights.Count && i < _originalLightIntensity.Count; i++) { if (Object.op_Implicit((Object)(object)_clubLights[i])) { _clubLights[i].intensity = _originalLightIntensity[i] * num; } } } private static bool IsCharacter(Transform node) { Transform val = node; while ((Object)(object)val != (Object)null) { if (((Object)val).name == "EmpressClubDancer" || ((Object)val).name == "EmpressClubWalker" || ((Object)val).name.StartsWith("EmpressClubBot_")) { return true; } val = val.parent; } return false; } private static Color TrackColor(string name) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) uint num = 2166136261u; foreach (char c in name) { num ^= c; num *= 16777619; } return Color.HSVToRGB((float)(num & 0xFFFF) / 65535f, 0.82f, 1f); } private void OnDestroy() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) RenderSettings.ambientLight = _originalAmbient; for (int i = 0; i < _reactiveMaterials.Count && i < _originalEmission.Count; i++) { if (Object.op_Implicit((Object)(object)_reactiveMaterials[i])) { _reactiveMaterials[i].SetColor("_EmissionColor", _originalEmission[i]); } } for (int j = 0; j < _clubLights.Count && j < _originalLightIntensity.Count; j++) { if (Object.op_Implicit((Object)(object)_clubLights[j])) { _clubLights[j].intensity = _originalLightIntensity[j]; } } if (Object.op_Implicit((Object)(object)_music)) { _music.Stop(); } if (Object.op_Implicit((Object)(object)_ambience)) { _ambience.Stop(); } } } internal static class EmpressClubAssets { internal static readonly List<AudioClip> Notice = new List<AudioClip>(); internal static readonly List<AudioClip> Buy = new List<AudioClip>(); internal static readonly List<AudioClip> SoldOut = new List<AudioClip>(); internal static readonly List<AudioClip> Sell = new List<AudioClip>(); internal static readonly List<AudioClip> MusicTracks = new List<AudioClip>(); internal static AudioClip PortalStart; internal static AudioClip PortalLoop; internal static AudioClip PortalEnd; internal static AudioClip Music; internal static AudioClip Ambience; internal static bool AudioReady; internal static IEnumerator LoadAll(string pluginDirectory) { Notice.Clear(); Buy.Clear(); SoldOut.Clear(); Sell.Clear(); MusicTracks.Clear(); AudioReady = false; foreach (string item in from path in Directory.GetFiles(pluginDirectory, "*", SearchOption.AllDirectories) orderby path select path) { string extension = Path.GetExtension(item).ToLowerInvariant(); AudioType val; switch (extension) { case ".ogg": val = (AudioType)14; break; case ".wav": val = (AudioType)20; break; case ".mp3": val = (AudioType)13; break; default: continue; } string fileName = Path.GetFileNameWithoutExtension(item); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip("file://" + item, val); DownloadHandlerAudioClip val2 = (DownloadHandlerAudioClip)request.downloadHandler; val2.streamAudio = false; val2.compressed = false; yield return request.SendWebRequest(); if ((int)request.result != 1) { EmpressClubPlugin.Log.LogWarning((object)("Empress Club failed to load audio " + fileName)); continue; } AudioClip content = DownloadHandlerAudioClip.GetContent(request); if (!((Object)(object)content == (Object)null)) { ((Object)content).name = fileName; Sort(fileName, extension, content); } } Music = MusicTracks.FirstOrDefault(); AudioReady = true; EmpressClubPlugin.Log.LogInfo((object)("Empress Club loaded " + MusicTracks.Count + " music track(s).")); } private static void Sort(string fileName, string extension, AudioClip clip) { if (fileName.StartsWith("sfx_club_notice") || fileName.StartsWith("sfx_merchant_notice")) { Notice.Add(clip); return; } if (fileName.StartsWith("sfx_club_buy") || fileName.StartsWith("sfx_merchant_buy")) { Buy.Add(clip); return; } if (fileName.StartsWith("sfx_club_sold_out") || fileName.StartsWith("sfx_merchant_sold_out")) { SoldOut.Add(clip); return; } if (fileName.StartsWith("sfx_club_sell") || fileName.StartsWith("sfx_merchant_sell")) { Sell.Add(clip); return; } switch (fileName) { case "boton": Notice.Add(clip); Buy.Add(clip); SoldOut.Add(clip); Sell.Add(clip); break; case "quack": Notice.Add(clip); break; case "sfx_teleport_start": PortalStart = clip; break; case "sfx_teleport_activate_loop_a": PortalLoop = clip; break; case "sfx_teleport_end": PortalEnd = clip; break; case "club_music": MusicTracks.Add(clip); break; case "club_ambience": Ambience = clip; break; default: if (extension == ".ogg") { MusicTracks.Add(clip); } break; } } internal static List<AudioClip> Category(int category) { return category switch { 0 => Notice, 1 => Buy, 2 => SoldOut, 3 => Sell, _ => Notice, }; } } internal sealed class EmpressClubBotAvatar : MonoBehaviour { private const float DefaultSpeed = 4.2f; private const int MaxRandomCosmetics = 4; private static readonly string[] HiddenVisualNameParts = new string[7] { "grab", "grabb", "holder", "suction", "vacuum", "tool", "cart" }; private static readonly string[] PreferredVisibleLayers = new string[2] { "PlayerVisuals", "Default" }; private static readonly CosmeticType[] RandomCosmeticTypes; private static readonly FieldRef<PlayerAvatar, PlayerCosmetics> PlayerAvatarCosmeticsRef; private static readonly FieldRef<PlayerAvatarVisuals, PlayerCosmetics> VisualsPlayerCosmeticsRef; private static readonly FieldRef<PlayerCosmetics, PlayerAvatarVisuals> PlayerCosmeticsVisualsRef; private static readonly FieldRef<PlayerCosmetics, List<CosmeticParent>> CosmeticParentsRef; private static readonly FieldRef<CosmeticParent, CosmeticType> CosmeticParentTypeRef; private static readonly FieldRef<CosmeticParent, PlayerSpringImpulse> CosmeticParentSpringImpulseRef; private static readonly FieldRef<CosmeticParent, Transform> CosmeticParentParentRef; private static readonly FieldRef<CosmeticParent, bool> CosmeticParentResetTransformRef; private static readonly FieldRef<CosmeticParent, List<Transform>> BaseMeshParentsRef; private static readonly FieldRef<CosmeticParent, List<Transform>> BaseMeshesRef; private static readonly FieldRef<PlayerCosmetics, bool> FirstSetupRef; private static readonly FieldRef<PlayerCosmetics, bool> FirstSetupCoroutineRef; private static readonly FieldRef<MetaManager, List<CosmeticAsset>> CosmeticAssetsRef; private static readonly FieldRef<CosmeticAsset, CosmeticType> CosmeticAssetTypeRef; private static readonly FieldRef<CosmeticAsset, PrefabRef> CosmeticAssetPrefabRef; private static readonly MethodInfo InstantiateCosmeticMethod; private static readonly FieldRef<PlayerAvatarVisuals, Transform> HeadUpTransformRef; private static readonly FieldRef<PlayerAvatarVisuals, Transform> HeadSideTransformRef; private static readonly FieldRef<PlayerAvatarVisuals, Transform> BodyTopUpTransformRef; private static readonly FieldRef<PlayerAvatarVisuals, Transform> BodyTopSideTransformRef; private static readonly FieldRef<PlayerAvatarVisuals, Transform> LeanTransformRef; private static readonly FieldRef<PlayerAvatarVisuals, Transform> TiltTransformRef; private static readonly FieldRef<PlayerAvatarLeftArm, Transform> LeftArmTransformRef; private static readonly FieldRef<PlayerAvatarLeftArm, Vector3> LeftArmBasePoseRef; private static readonly FieldRef<PlayerAvatarRightArm, Transform> RightArmTransformRef; private static readonly FieldRef<PlayerAvatarRightArm, Vector3> RightArmBasePoseRef; private static readonly FieldRef<PlayerAvatarTalkAnimation, GameObject> TalkObjectRef; private static readonly FieldRef<PlayerAvatarTalkAnimation, float> TalkMaxAngleRef; private Animator[] _animators = Array.Empty<Animator>(); private Transform _headUp; private Transform _headSide; private Transform _bodyTopUp; private Transform _bodyTopSide; private Transform _lean; private Transform _tilt; private Transform _leftArm; private Transform _rightArm; private Transform _mouth; private Quaternion _headUpBase; private Quaternion _headSideBase; private Quaternion _bodyTopUpBase; private Quaternion _bodyTopSideBase; private Quaternion _leanBase; private Quaternion _tiltBase; private Quaternion _mouthBase; private Vector3 _leftArmBasePose; private Vector3 _rightArmBasePose; private Vector3 _lastPosition; private float _fallbackSpeed = 4.2f; private float _danceStart; private float _dancePhase; private float _slapStart; private float _mouthMaxAngle = 18f; private int _danceStyle; private bool _crouching; private bool _dancing; private bool _ragdolling; private bool _slapping; private bool _slapRight; private bool _dancePoseCaptured; private bool _waving; private float _waveStart; private bool _groundApplied; private float _groundSampleUntil; private float _speedSmoothed; private float _movingStopTime; private bool _movingState; internal void Init(float fallbackSpeed) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) _fallbackSpeed = Mathf.Max(0.1f, fallbackSpeed); _animators = ((Component)this).GetComponentsInChildren<Animator>(true); _lastPosition = ((Component)this).transform.position; _groundSampleUntil = Time.time + 0.9f; ResolveDanceRig(); for (int i = 0; i < _animators.Length; i++) { Animator val = _animators[i]; if (Object.op_Implicit((Object)(object)val)) { ((Behaviour)val).enabled = true; val.applyRootMotion = false; val.speed = 1f; val.cullingMode = (AnimatorCullingMode)0; } } } internal void SetCrouching(bool value) { _crouching = value; } internal void SetRagdolling(bool value) { _ragdolling = value; } internal void SetDancing(bool value, float startTime, float phase, int style) { if (!value) { _dancing = false; RestoreDancePose(); return; } CaptureDancePose(); _danceStart = startTime; _dancePhase = phase; _danceStyle = style; _dancing = true; } internal void SetSlapping(bool value, float startTime, bool right) { if (!value) { _slapping = false; RestoreDancePose(); return; } CaptureDancePose(); _slapStart = startTime; _slapRight = right; _slapping = true; } internal void SetWaving(bool value, float startTime) { if (!value) { _waving = false; RestoreDancePose(); } else { CaptureDancePose(); _waveStart = startTime; _waving = true; } } private void LateUpdate() { //IL_003d: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Invalid comparison between Unknown and I4 //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Invalid comparison between Unknown and I4 //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) if (!_groundApplied) { if (Time.time <= _groundSampleUntil) { ApplyGroundCorrection(); } else { _groundApplied = true; } } Vector3 val = ((Time.deltaTime > 0.0001f) ? ((((Component)this).transform.position - _lastPosition) / Time.deltaTime) : Vector3.zero); _lastPosition = ((Component)this).transform.position; Vector3 val2 = val; val2.y = 0f; float magnitude = ((Vector3)(ref val2)).magnitude; _speedSmoothed = Mathf.Lerp(_speedSmoothed, magnitude, 1f - Mathf.Exp(-9f * Time.deltaTime)); if (!_crouching && !_ragdolling && _speedSmoothed > (_movingState ? 0.06f : 0.22f)) { _movingState = true; _movingStopTime = 0f; } else if (_movingState) { _movingStopTime += Time.deltaTime; if (_movingStopTime > 0.18f) { _movingState = false; } } bool flag = _movingState && !_crouching && !_ragdolling; float num = Mathf.Max(0.6f, _fallbackSpeed); float num2 = Mathf.Clamp01(_speedSmoothed / num); Vector3 val3 = ((Component)this).transform.InverseTransformDirection(val2); for (int i = 0; i < _animators.Length; i++) { Animator val4 = _animators[i]; if (!Object.op_Implicit((Object)(object)val4)) { continue; } AnimatorControllerParameter[] parameters = val4.parameters; foreach (AnimatorControllerParameter val5 in parameters) { string text = val5.name.ToLowerInvariant(); AnimatorControllerParameterType type = val5.type; if ((int)type != 1) { if ((int)type == 4) { if (text.Contains("crouch")) { val4.SetBool(val5.nameHash, _crouching); } else if (text.Contains("tumbling")) { val4.SetBool(val5.nameHash, _ragdolling); } else if (text.Contains("fall")) { val4.SetBool(val5.nameHash, _ragdolling); } else if (text.Contains("sprint") || text.Contains("crawl") || text.Contains("slide") || text.Contains("jump")) { val4.SetBool(val5.nameHash, false); } else if (text.Contains("moving") || text.Contains("move") || text.Contains("walk") || text.Contains("run")) { val4.SetBool(val5.nameHash, flag); } else if (text.Contains("ground")) { val4.SetBool(val5.nameHash, !_ragdolling); } } } else if (text.Contains("horizontal") || text.Contains("strafe")) { val4.SetFloat(val5.nameHash, val3.x); } else if (text.Contains("vertical") || text.Contains("forward")) { val4.SetFloat(val5.nameHash, val3.z); } else if (text.Contains("speed") || text.Contains("move") || text.Contains("velocity")) { val4.SetFloat(val5.nameHash, num2); } } } if (_dancing) { ApplyDancePose(); } else if (_slapping) { ApplySlapPose(); } else if (_waving) { ApplyWavePose(); } } private void ApplyGroundCorrection() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_007e: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) Transform val = (Object.op_Implicit((Object)(object)((Component)this).transform.parent) ? ((Component)this).transform.parent : ((Component)this).transform); float num = float.MaxValue; Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(false); foreach (Renderer val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2) && val2.enabled) { Bounds bounds = val2.bounds; Vector3 size = ((Bounds)(ref bounds)).size; if (!(((Vector3)(ref size)).sqrMagnitude < 0.0001f) && !(Vector3.SqrMagnitude(((Bounds)(ref bounds)).center - val.position) > 25f)) { num = Mathf.Min(num, ((Bounds)(ref bounds)).min.y); } } } if (!(num > 1.7014117E+38f)) { float num2 = val.position.y + 0.02f - num; if (!(Mathf.Abs(num2) < 0.005f) && !(Mathf.Abs(num2) > 0.9f)) { Transform transform = ((Component)this).transform; transform.localPosition += new Vector3(0f, num2, 0f); } } } private void ApplyWavePose() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00f6: Unknown result type (might be due to invalid IL or missing references) float num = Time.time - _waveStart; if (num > 1.9f) { _waving = false; RestoreDancePose(); return; } float num2 = Mathf.Clamp01(num / 0.25f) * Mathf.Clamp01((1.9f - num) / 0.3f); float num3 = Mathf.Sin(num * 13f) * 26f * num2; if (Object.op_Implicit((Object)(object)_rightArm)) { _rightArm.localEulerAngles = _rightArmBasePose + new Vector3(-135f * num2, num3, -24f * num2); } if (Object.op_Implicit((Object)(object)_headSide)) { _headSide.localRotation = _headSideBase * Quaternion.Euler(0f, 10f * num2, 6f * num2); } if (Object.op_Implicit((Object)(object)_mouth)) { _mouth.localRotation = Quaternion.Euler((0f - _mouthMaxAngle) * 0.7f * num2, 0f, 0f); } } private void ResolveDanceRig() { //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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) PlayerAvatarVisuals componentInChildren = ((Component)this).GetComponentInChildren<PlayerAvatarVisuals>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { try { _headUp = HeadUpTransformRef.Invoke(componentInChildren); } catch { } try { _headSide = HeadSideTransformRef.Invoke(componentInChildren); } catch { } try { _bodyTopUp = BodyTopUpTransformRef.Invoke(componentInChildren); } catch { } try { _bodyTopSide = BodyTopSideTransformRef.Invoke(componentInChildren); } catch { } try { _lean = LeanTransformRef.Invoke(componentInChildren); } catch { } try { _tilt = TiltTransformRef.Invoke(componentInChildren); } catch { } } PlayerAvatarLeftArm componentInChildren2 = ((Component)this).GetComponentInChildren<PlayerAvatarLeftArm>(true); if (Object.op_Implicit((Object)(object)componentInChildren2)) { try { _leftArm = LeftArmTransformRef.Invoke(componentInChildren2); } catch { } try { _leftArmBasePose = LeftArmBasePoseRef.Invoke(componentInChildren2); } catch { } } PlayerAvatarRightArm componentInChildren3 = ((Component)this).GetComponentInChildren<PlayerAvatarRightArm>(true); if (Object.op_Implicit((Object)(object)componentInChildren3)) { try { _rightArm = RightArmTransformRef.Invoke(componentInChildren3); } catch { } try { _rightArmBasePose = RightArmBasePoseRef.Invoke(componentInChildren3); } catch { } } PlayerAvatarTalkAnimation componentInChildren4 = ((Component)this).GetComponentInChildren<PlayerAvatarTalkAnimation>(true); if (!Object.op_Implicit((Object)(object)componentInChildren4)) { return; } try { GameObject val = TalkObjectRef.Invoke(componentInChildren4); if (Object.op_Implicit((Object)(object)val)) { _mouth = val.transform; } } catch { } try { _mouthMaxAngle = Mathf.Max(1f, TalkMaxAngleRef.Invoke(componentInChildren4)); } catch { } } private void CaptureDancePose() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00c8: 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) if (Object.op_Implicit((Object)(object)_headUp)) { _headUpBase = _headUp.localRotation; } if (Object.op_Implicit((Object)(object)_headSide)) { _headSideBase = _headSide.localRotation; } if (Object.op_Implicit((Object)(object)_bodyTopUp)) { _bodyTopUpBase = _bodyTopUp.localRotation; } if (Object.op_Implicit((Object)(object)_bodyTopSide)) { _bodyTopSideBase = _bodyTopSide.localRotation; } if (Object.op_Implicit((Object)(object)_lean)) { _leanBase = _lean.localRotation; } if (Object.op_Implicit((Object)(object)_tilt)) { _tiltBase = _tilt.localRotation; } if (Object.op_Implicit((Object)(object)_mouth)) { _mouthBase = _mouth.localRotation; } _dancePoseCaptured = true; } private void ApplyDancePose() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0f, Time.time - _danceStart) * 3.8f + _dancePhase; float num2 = Mathf.Sin(num); float num3 = Mathf.Sin(num + MathF.PI); float num4 = Mathf.Sin(num * 2f); float num5 = ((_danceStyle == 1) ? 58f : ((_danceStyle == 2) ? 42f : 32f)); float num6 = ((_danceStyle == 2) ? (Mathf.Sin(num * 0.5f) * 38f) : (num2 * num5)); if (Object.op_Implicit((Object)(object)_leftArm)) { _leftArm.localEulerAngles = _leftArmBasePose + new Vector3(num6, num2 * 14f, 18f + num3 * 24f); } if (Object.op_Implicit((Object)(object)_rightArm)) { _rightArm.localEulerAngles = _rightArmBasePose + new Vector3((_danceStyle == 1) ? (0f - num6) : num6, num3 * 14f, -18f + num2 * 24f); } if (Object.op_Implicit((Object)(object)_headUp)) { _headUp.localRotation = _headUpBase * Quaternion.Euler(num4 * 9f, 0f, 0f); } if (Object.op_Implicit((Object)(object)_headSide)) { _headSide.localRotation = _headSideBase * Quaternion.Euler(0f, num2 * 11f, num3 * 8f); } if (Object.op_Implicit((Object)(object)_bodyTopUp)) { _bodyTopUp.localRotation = _bodyTopUpBase * Quaternion.Euler(num4 * 6f, 0f, 0f); } if (Object.op_Implicit((Object)(object)_bodyTopSide)) { _bodyTopSide.localRotation = _bodyTopSideBase * Quaternion.Euler(0f, num2 * 13f, num2 * 7f); } if (Object.op_Implicit((Object)(object)_lean)) { _lean.localRotation = _leanBase * Quaternion.Euler(0f, 0f, num3 * 7f); } if (Object.op_Implicit((Object)(object)_tilt)) { _tilt.localRotation = _tiltBase * Quaternion.Euler(0f, 0f, num2 * 9f); } if (Object.op_Implicit((Object)(object)_mouth)) { float num7 = Mathf.Pow(Mathf.Clamp01(num4 * 0.5f + 0.5f), 0.45f); _mouth.localRotation = Quaternion.Euler((0f - _mouthMaxAngle) * num7, 0f, 0f); } } private void ApplySlapPose() { //IL_0099: 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_00ae: 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_00d6: 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_00eb: 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_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01((Time.time - _slapStart) / 0.9f); float num2 = ((num < 0.42f) ? Mathf.Lerp(0f, -72f, num / 0.42f) : ((!(num < 0.72f)) ? Mathf.Lerp(92f, 0f, (num - 0.72f) / 0.28f) : Mathf.Lerp(-72f, 92f, (num - 0.42f) / 0.3f))); if (_slapRight && Object.op_Implicit((Object)(object)_rightArm)) { _rightArm.localEulerAngles = _rightArmBasePose + new Vector3(num2, -52f, -38f); } else if (!_slapRight && Object.op_Implicit((Object)(object)_leftArm)) { _leftArm.localEulerAngles = _leftArmBasePose + new Vector3(num2, 52f, 38f); } if (Object.op_Implicit((Object)(object)_headSide)) { _headSide.localRotation = _headSideBase * Quaternion.Euler(0f, _slapRight ? (-16f) : 16f, _slapRight ? (-9f) : 9f); } if (Object.op_Implicit((Object)(object)_bodyTopSide)) { _bodyTopSide.localRotation = _bodyTopSideBase * Quaternion.Euler(0f, _slapRight ? (-20f) : 20f, 0f); } if (Object.op_Implicit((Object)(object)_mouth)) { _mouth.localRotation = Quaternion.Euler(0f - _mouthMaxAngle, 0f, 0f); } } private void RestoreDancePose() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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) if (_dancePoseCaptured) { if (Object.op_Implicit((Object)(object)_headUp)) { _headUp.localRotation = _headUpBase; } if (Object.op_Implicit((Object)(object)_headSide)) { _headSide.localRotation = _headSideBase; } if (Object.op_Implicit((Object)(object)_bodyTopUp)) { _bodyTopUp.localRotation = _bodyTopUpBase; } if (Object.op_Implicit((Object)(object)_bodyTopSide)) { _bodyTopSide.localRotation = _bodyTopSideBase; } if (Object.op_Implicit((Object)(object)_lean)) { _lean.localRotation = _leanBase; } if (Object.op_Implicit((Object)(object)_tilt)) { _tilt.localRotation = _tiltBase; } if (Object.op_Implicit((Object)(object)_leftArm)) { _leftArm.localEulerAngles = _leftArmBasePose; } if (Object.op_Implicit((Object)(object)_rightArm)) { _rightArm.localEulerAngles = _rightArmBasePose; } if (Object.op_Implicit((Object)(object)_mouth)) { _mouth.localRotation = _mouthBase; } _dancePoseCaptured = false; } } internal static bool TryAttach(GameObject root, PlayerAvatar player, Color accent, float fallbackSpeed) { //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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)root) || !Object.op_Implicit((Object)(object)player)) { return false; } GameObject val = ResolveAvatarVisualRoot(player); if (!Object.op_Implicit((Object)(object)val)) { return false; } PlayerCosmetics sourceCosmetics = ResolvePlayerCosmetics(player, val); GameObject val2; try { val2 = Object.Instantiate<GameObject>(val, root.transform, false); } catch { return false; } ((Object)val2).name = "AvatarBody"; val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; PrepareClone(val2, val, sourceCosmetics); TintClone(val2, accent); val2.AddComponent<EmpressClubBotAvatar>().Init(fallbackSpeed); return CountVisibleRenderers(val2) > 0; } private static GameObject ResolveAvatarVisualRoot(PlayerAvatar player) { if (!Object.op_Implicit((Object)(object)player)) { return null; } try { if (Object.op_Implicit((Object)(object)player.playerAvatarVisuals)) { return ((Component)player.playerAvatarVisuals).gameObject; } } catch { } try { FieldInfo fieldInfo = AccessTools.Field(((object)player).GetType(), "playerAvatarVisuals"); if (fieldInfo != null) { object? value = fieldInfo.GetValue(player); Component val = (Component)((value is Component) ? value : null); if (Object.op_Implicit((Object)(object)val)) { return val.gameObject; } } } catch { } try { PropertyInfo propertyInfo = AccessTools.Property(((object)player).GetType(), "playerAvatarVisuals"); if (propertyInfo != null) { object? value2 = propertyInfo.GetValue(player, null); Component val2 = (Component)((value2 is Component) ? value2 : null); if (Object.op_Implicit((Object)(object)val2)) { return val2.gameObject; } } } catch { } try { PlayerAvatarVisuals componentInChildren = ((Component)player).GetComponentInChildren<PlayerAvatarVisuals>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { return ((Component)componentInChildren).gameObject; } } catch { } return null; } private static PlayerCosmetics ResolvePlayerCosmetics(PlayerAvatar player, GameObject visualRoot) { if (!Object.op_Implicit((Object)(object)player)) { return null; } try { PlayerCosmetics val = PlayerAvatarCosmeticsRef.Invoke(player); if (Object.op_Implicit((Object)(object)val)) { return val; } } catch { } try { PlayerAvatarVisuals component = visualRoot.GetComponent<PlayerAvatarVisuals>(); if (Object.op_Implicit((Object)(object)component)) { PlayerCosmetics val2 = VisualsPlayerCosmeticsRef.Invoke(component); if (Object.op_Implicit((Object)(object)val2)) { return val2; } } } catch { } try { PlayerCosmetics componentInChildren = ((Component)player).GetComponentInChildren<PlayerCosmetics>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { return componentInChildren; } } catch { } return null; } private static void PrepareClone(GameObject clone, GameObject sourceRoot, PlayerCosmetics sourceCosmetics) { //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) MonoBehaviour[] componentsInChildren = clone.GetComponentsInChildren<MonoBehaviour>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (Object.op_Implicit((Object)(object)componentsInChildren[i])) { componentsInChildren[i].StopAllCoroutines(); ((Behaviour)componentsInChildren[i]).enabled = false; } } clone.SetActive(true); int layer = ResolveVisibleLayer(); EnsureCloneCosmetics(clone, sourceRoot, sourceCosmetics); PreventVanillaCosmeticSetup(clone); StripEquippedCosmetics(clone); RestoreBaseAvatarMeshes(clone); RandomizeCloneCosmetics(clone); Transform[] componentsInChildren2 = clone.GetComponentsInChildren<Transform>(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if (Object.op_Implicit((Object)(object)componentsInChildren2[j])) { ((Component)componentsInChildren2[j]).gameObject.layer = layer; } } HideNamedVisuals(clone); DisableCloneLights(clone); Renderer[] componentsInChildren3 = clone.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren3) { if (!Object.op_Implicit((Object)(object)val)) { continue; } if (ShouldHide(((Object)((Component)val).gameObject).name)) { val.enabled = false; continue; } val.enabled = true; ((Component)val).gameObject.layer = layer; val.shadowCastingMode = (ShadowCastingMode)1; val.receiveShadows = true; SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); if (val2 != null) { val2.updateWhenOffscreen = true; } } Animator[] componentsInChildren4 = clone.GetComponentsInChildren<Animator>(true); foreach (Animator val3 in componentsInChildren4) { if (Object.op_Implicit((Object)(object)val3)) { ((Behaviour)val3).enabled = true; val3.applyRootMotion = false; val3.speed = 1f; val3.cullingMode = (AnimatorCullingMode)0; } } Collider[] componentsInChildren5 = clone.GetComponentsInChildren<Collider>(true); for (int m = 0; m < componentsInChildren5.Length; m++) { if (Object.op_Implicit((Object)(object)componentsInChildren5[m])) { componentsInChildren5[m].enabled = false; } } Rigidbody[] componentsInChildren6 = clone.GetComponentsInChildren<Rigidbody>(true); foreach (Rigidbody val4 in componentsInChildren6) { if (Object.op_Implicit((Object)(object)val4)) { val4.isKinematic = true; val4.detectCollisions = false; val4.useGravity = false; } } AudioSource[] componentsInChildren7 = clone.GetComponentsInChildren<AudioSource>(true); for (int num = 0; num < componentsInChildren7.Length; num++) { if (Object.op_Implicit((Object)(object)componentsInChildren7[num])) { ((Behaviour)componentsInChildren7[num]).enabled = false; } } ParticleSystem[] componentsInChildren8 = clone.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val5 in componentsInChildren8) { if (Object.op_Implicit((Object)(object)val5)) { EmissionModule emission = val5.emission; ((EmissionModule)(ref emission)).enabled = false; val5.Stop(true, (ParticleSystemStopBehavior)0); } } TextMesh[] componentsInChildren9 = clone.GetComponentsInChildren<TextMesh>(true); for (int num3 = 0; num3 < componentsInChildren9.Length; num3++) { if (Object.op_Implicit((Object)(object)componentsInChildren9[num3])) { ((Component)componentsInChildren9[num3]).gameObject.SetActive(false); } } } private static void RandomizeCloneCosmetics(GameObject clone) { //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)MetaManager.instance) || InstantiateCosmeticMethod == null) { return; } PlayerCosmetics val = ((IEnumerable<PlayerCosmetics>)clone.GetComponentsInChildren<PlayerCosmetics>(true)).FirstOrDefault((Func<PlayerCosmetics, bool>)((PlayerCosmetics component) => Object.op_Implicit((Object)(object)component))); if (!Object.op_Implicit((Object)(object)val)) { return; } HashSet<CosmeticType> supportedCosmeticTypes = GetSupportedCosmeticTypes(val); if (supportedCosmeticTypes.Count == 0) { return; } List<CosmeticAsset> list = null; try { list = CosmeticAssetsRef.Invoke(MetaManager.instance); } catch { } if (list == null || list.Count == 0) { return; } Dictionary<CosmeticType, List<CosmeticAsset>> dictionary = new Dictionary<CosmeticType, List<CosmeticAsset>>(); for (int num = 0; num < list.Count; num++) { CosmeticAsset val2 = list[num]; if (!Object.op_Implicit((Object)(object)val2)) { continue; } CosmeticType val3; try { val3 = CosmeticAssetTypeRef.Invoke(val2); } catch { continue; } PrefabRef val4; try { val4 = CosmeticAssetPrefabRef.Invoke(val2); } catch { continue; } if (supportedCosmeticTypes.Contains(val3) && RandomCosmeticTypes.Contains(val3) && val4 != null && val4.IsValid()) { if (!dictionary.TryGetValue(val3, out var value)) { value = (dictionary[val3] = new List<CosmeticAsset>()); } value.Add(val2); } } List<CosmeticType> list3 = dictionary.Keys.OrderBy((CosmeticType _) => Random.value).ToList(); int num2 = Mathf.Min(4, list3.Count); for (int num3 = 0; num3 < num2; num3++) { List<CosmeticAsset> list4 = dictionary[list3[num3]]; if (list4.Count == 0) { continue; } CosmeticAsset val5 = list4[Random.Range(0, list4.Count)]; try { object? obj4 = InstantiateCosmeticMethod.Invoke(val, new object[1] { val5 }); GameObject val6 = (GameObject)((obj4 is GameObject) ? obj4 : null); if (Object.op_Implicit((Object)(object)val6)) { val6.AddComponent<EmpressClubUntintedCosmetic>(); val6.SetActive(true); } } catch { } } } private static void EnsureCloneCosmetics(GameObject clone, GameObject sourceRoot, PlayerCosmetics sourceCosmetics) { //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)sourceCosmetics)) { return; } PlayerCosmetics val = clone.GetComponentInChildren<PlayerCosmetics>(true); if (!Object.op_Implicit((Object)(object)val)) { val = clone.AddComponent<PlayerCosmetics>(); } if (!Object.op_Implicit((Object)(object)val)) { return; } try { ((MonoBehaviour)val).StopAllCoroutines(); } catch { } try { ((Behaviour)val).enabled = false; } catch { } try { FirstSetupRef.Invoke(val) = false; } catch { } try { FirstSetupCoroutineRef.Invoke(val) = true; } catch { } PlayerAvatarVisuals component = clone.GetComponent<PlayerAvatarVisuals>(); if (Object.op_Implicit((Object)(object)component)) { try { PlayerCosmeticsVisualsRef.Invoke(val) = component; } catch { } try { VisualsPlayerCosmeticsRef.Invoke(component) = val; } catch { } } List<CosmeticParent> list = null; try { list = CosmeticParentsRef.Invoke(sourceCosmetics); } catch { } if (list == null || list.Count == 0) { return; } List<CosmeticParent> list2 = new List<CosmeticParent>(); for (int i = 0; i < list.Count; i++) { CosmeticParent val2 = list[i]; if (val2 == null) { continue; } Transform val3 = null; List<Transform> list3 = new List<Transform>(); List<Transform> list4 = new List<Transform>(); try { val3 = MapCloneTransform(CosmeticParentParentRef.Invoke(val2), sourceRoot.transform, clone.transform); } catch { } try { list3 = MapCloneTransforms(BaseMeshParentsRef.Invoke(val2), sourceRoot.transform, clone.transform); } catch { } try { list4 = MapCloneTransforms(BaseMeshesRef.Invoke(val2), sourceRoot.transform, clone.transform); } catch { } if (Object.op_Implicit((Object)(object)val3) && list3.Count != 0) { CosmeticParent val4 = new CosmeticParent(); try { CosmeticParentTypeRef.Invoke(val4) = CosmeticParentTypeRef.Invoke(val2); } catch { continue; } try { CosmeticParentSpringImpulseRef.Invoke(val4) = null; } catch { } try { CosmeticParentParentRef.Invoke(val4) = val3; } catch { } try { CosmeticParentResetTransformRef.Invoke(val4) = CosmeticParentResetTransformRef.Invoke(val2); } catch { } try { BaseMeshParentsRef.Invoke(val4) = list3; } catch { } try { BaseMeshesRef.Invoke(val4) = list4; } catch { } list2.Add(val4); } } if (list2.Count <= 0) { return; } try { CosmeticParentsRef.Invoke(val) = list2; } catch { } } private static HashSet<CosmeticType> GetSupportedCosmeticTypes(PlayerCosmetics playerCosmetics) { HashSet<CosmeticType> hashSet = new HashSet<CosmeticType>(); List<CosmeticParent> list = null; try { list = CosmeticParentsRef.Invoke(playerCosmetics); } catch { } if (list == null) { return hashSet; } for (int i = 0; i < list.Count; i++) { CosmeticParent val = list[i]; if (val == null) { continue; } Transform val2 = null; try { val2 = CosmeticParentParentRef.Invoke(val); } catch { } if (Object.op_Implicit((Object)(object)val2)) { try { hashSet.Add(CosmeticParentTypeRef.Invoke(val)); } catch { } } } return hashSet; } private static List<Transform> MapCloneTransforms(List<Transform> sourceTransforms, Transform sourceRoot, Transform cloneRoot) { List<Transform> list = new List<Transform>(); if (sourceTransforms == null) { return list; } for (int i = 0; i < sourceTransforms.Count; i++) { Transform val = MapCloneTransform(sourceTransforms[i], sourceRoot, cloneRoot); if (Object.op_Implicit((Object)(object)val)) { list.Add(val); } } return list; } private static Transform MapCloneTransform(Transform source, Transform sourceRoot, Transform cloneRoot) { if (!Object.op_Implicit((Object)(object)source)) { return null; } if ((Object)(object)source == (Object)(object)sourceRoot) { return cloneRoot; } if (!source.IsChildOf(sourceRoot)) { return null; } List<int> list = new List<int>(); Transform val = source; while (Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)sourceRoot) { list.Add(val.GetSiblingIndex()); val = val.parent; } Transform val2 = cloneRoot; for (int num = list.Count - 1; num >= 0; num--) { int num2 = list[num]; if (num2 < 0 || num2 >= val2.childCount) { return null; } val2 = val2.GetChild(num2); } return val2; } private static void PreventVanillaCosmeticSetup(GameObject clone) { PlayerCosmetics[] componentsInChildren = clone.GetComponentsInChildren<PlayerCosmetics>(true); foreach (PlayerCosmetics val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { try { ((MonoBehaviour)val).StopAllCoroutines(); } catch { } try { ((Behaviour)val).enabled = false; } catch { } try { FirstSetupRef.Invoke(val) = false; } catch { } try { FirstSetupCoroutineRef.Invoke(val) = true; } catch { } } } } private static void StripEquippedCosmetics(GameObject clone) { Cosmetic[] componentsInChildren = clone.GetComponentsInChildren<Cosmetic>(true); foreach (Cosmetic val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && !((Object)(object)((Component)val).gameObject == (Object)(object)clone)) { ((Component)val).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)val).gameObject); } } } private static void RestoreBaseAvatarMeshes(GameObject clone) { PlayerCosmetics[] componentsInChildren = clone.GetComponentsInChildren<PlayerCosmetics>(true); foreach (PlayerCosmetics val in componentsInChildren) { if (!Object.op_Implicit((Object)(object)val)) { continue; } List<CosmeticParent> list = null; try { list = CosmeticParentsRef.Invoke(val); } catch { } if (list == null) { continue; } for (int j = 0; j < list.Count; j++) { CosmeticParent val2 = list[j]; if (val2 != null) { List<Transform> transforms = null; List<Transform> transforms2 = null; try { transforms = BaseMeshParentsRef.Invoke(val2); } catch { } try { transforms2 = BaseMeshesRef.Invoke(val2); } catch { } SetBaseMeshesActive(transforms, active: true); SetBaseMeshesActive(transforms2, active: true); } } } } private static void SetBaseMeshesActive(List<Transform> transforms, bool active) { if (transforms == null) { return; } for (int i = 0; i < transforms.Count; i++) { Transform val = transforms[i]; if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.SetActive(active); } } } private static void DisableCloneLights(GameObject clone) { Light[] componentsInChildren = clone.GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (Object.op_Implicit((Object)(object)componentsInChildren[i])) { ((Behaviour)componentsInChildren[i]).enabled = false; } } } private static void HideNamedVisuals(GameObject clone) { Transform[] componentsInChildren = clone.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && ShouldHide(((Object)((Component)val).gameObject).name)) { ((Component)val).gameObject.SetActive(false); } } } private static bool ShouldHide(string name) { if (string.IsNullOrWhiteSpace(name)) { return false; } string text = name.ToLowerInvariant(); for (int i = 0; i < HiddenVisualNameParts.Length; i++) { if (text.Contains(HiddenVisualNameParts[i])) { return true; } } return false; } private static void TintClone(GameObject clone, Color accent) { //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_008f: 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_00ba: 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_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) Renderer[] componentsInChildren = clone.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (!Object.op_Implicit((Object)(object)val) || Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<Cosmetic>()) || Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<EmpressClubUntintedCosmetic>())) { continue; } Material[] materials; try { materials = val.materials; } catch { continue; } foreach (Material val2 in materials) { if (Object.op_Implicit((Object)(object)val2)) { if (val2.HasProperty("_Color")) { val2.SetColor("_Color", Color.Lerp(val2.GetColor("_Color"), accent, 0.48f)); } if (val2.HasProperty("_BaseColor")) { val2.SetColor("_BaseColor", Color.Lerp(val2.GetColor("_BaseColor"), accent, 0.48f)); } if (val2.HasProperty("_EmissionColor")) { val2.EnableKeyword("_EMISSION"); val2.SetColor("_EmissionColor", accent * 0.22f); } } } } } private static int CountVisibleRenderers(GameObject clone) { int num = 0; Renderer[] componentsInChildren = clone.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && val.enabled && ((Component)val).gameObject.activeInHierarchy) { num++; } } return num; } private static int ResolveVisibleLayer() { for (int i = 0; i < PreferredVisibleLayers.Length; i++) { int num = LayerMask.NameToLayer(PreferredVisibleLayers[i]); if (num >= 0) { return num; } } return 0; } static EmpressClubBotAvatar() { CosmeticType[] array = new CosmeticType[11]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); RandomCosmeticTypes = (CosmeticType[])(object)array; PlayerAvatarCosmeticsRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerCosmetics>("playerCosmetics"); VisualsPlayerCosmeticsRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, PlayerCosmetics>("playerCosmetics"); PlayerCosmeticsVisualsRef = AccessTools.FieldRefAccess<PlayerCosmetics, PlayerAvatarVisuals>("playerAvatarVisuals"); CosmeticParentsRef = AccessTools.FieldRefAccess<PlayerCosmetics, List<CosmeticParent>>("cosmeticParents"); CosmeticParentTypeRef = AccessTools.FieldRefAccess<CosmeticParent, CosmeticType>("cosmeticType"); CosmeticParentSpringImpulseRef = AccessTools.FieldRefAccess<CosmeticParent, PlayerSpringImpulse>("springImpulse"); CosmeticParentParentRef = AccessTools.FieldRefAccess<CosmeticParent, Transform>("parent"); CosmeticParentResetTransformRef = AccessTools.FieldRefAccess<CosmeticParent, bool>("resetTransform"); BaseMeshParentsRef = AccessTools.FieldRefAccess<CosmeticParent, List<Transform>>("baseMeshParents"); BaseMeshesRef = AccessTools.FieldRefAccess<CosmeticParent, List<Transform>>("baseMeshes"); FirstSetupRef = AccessTools.FieldRefAccess<PlayerCosmetics, bool>("firstSetup"); FirstSetupCoroutineRef = AccessTools.FieldRefAccess<PlayerCosmetics, bool>("firstSetupCoroutine"); CosmeticAssetsRef = AccessTools.FieldRefAccess<MetaManager, List<CosmeticAsset>>("cosmeticAssets"); CosmeticAssetTypeRef = AccessTools.FieldRefAccess<CosmeticAsset, CosmeticType>("type"); CosmeticAssetPrefabRef = AccessTools.FieldRefAccess<CosmeticAsset, PrefabRef>("prefab"); InstantiateCosmeticMethod = AccessTools.Method(typeof(PlayerCosmetics), "InstantiateCosmetic", new Type[1] { typeof(CosmeticAsset) }, (Type[])null); HeadUpTransformRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Transform>("headUpTransform"); HeadSideTransformRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Transform>("headSideTransform"); BodyTopUpTransformRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Transform>("bodyTopUpTransform"); BodyTopSideTransformRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Transform>("bodyTopSideTransform"); LeanTransformRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Transform>("leanTransform"); TiltTransformRef = AccessTools.FieldRefAccess<PlayerAvatarVisuals, Transform>("tiltTransform"); LeftArmTransformRef = AccessTools.FieldRefAccess<PlayerAvatarLeftArm, Transform>("leftArmTransform"); LeftArmBasePoseRef = AccessTools.FieldRefAccess<PlayerAvatarLeftArm, Vector3>("basePose"); RightArmTransformRef = AccessTools.FieldRefAccess<PlayerAvatarRightArm, Transform>("rightArmTransform"); RightArmBasePoseRef = AccessTools.FieldRefAccess<PlayerAvatarRightArm, Vector3>("basePose"); TalkObjectRef = AccessTools.FieldRefAccess<PlayerAvatarTalkAnimation, GameObject>("objectToRotate"); TalkMaxAngleRef = AccessTools.FieldRefAccess<PlayerAvatarTalkAnimation, float>("rotationMaxAngle"); } } internal sealed class EmpressClubUntintedCosmetic : MonoBehaviour { } public sealed class EmpressClubCrowd : MonoBehaviour { internal sealed class SeatSpot { internal Vector3 Position; internal Vector3 ApproachPosition; internal Quaternion Rotation; internal EmpressClubBot Occupant; } private readonly struct SpeechTurn { internal readonly EmpressClubBot Speaker; internal readonly EmpressClubBot Listener; internal readonly string Text; internal SpeechTurn(EmpressClubBot speaker, EmpressClubBot listener, string text) { Speaker = speaker; Listener = listener; Text = text; } } private const int BotCount = 10; private static readonly string[] BotNames = new string[16] { "Neon", "Bassline", "Disco", "Glowstick", "Velvet", "Static", "Laser", "Tempo", "Midnight", "Echo", "Strobe", "Vinyl", "Rave", "Chrome", "Pulse", "Rhythm" }; private readonly List<EmpressClubBot> _bots = new List<EmpressClubBot>(); private readonly List<SeatSpot> _seats = new List<SeatSpot>(); private readonly Queue<SpeechTurn> _turns = new Queue<SpeechTurn>(); private Transform _walkCenter; private Transform _dancer; private Bounds _walkBounds; private float _nextGreetingGlobal; private EmpressClubBot _waitingBot; private EmpressClubBot _speakingBot; private EmpressClubBot _crowdedFirst; private EmpressClubBot _crowdedSecond; private float _waitingSince; private float _speechEnd; private float _nextConversation; private float _nextGroupDance; private float _nextCrowdingCheck; private float _nextSlapAllowed; private float _crowdedSince; private bool _ready; private static readonly string[][] Dialogues = new string[36][] { new string[3] { "Is this {song}, or did the walls start singing?", "It is {song}. The walls are just emotionally involved.", "Good. I was about to apologize to the ceiling." }, new string[3] { "I have been dancing for six minutes and achieved nothing.", "You achieved confidence.", "Then why do my knees feel audited?" }, new string[3] { "Do you think the D J takes requests?", "Only if the request is more bass.", "My request is a chair and less gravity." }, new string[3] { "This glow makes me look expensive.", "You still owe me twelve dollars.", "Expensive and financially mysterious." }, new string[3] { "Rate my dance moves.", "Your arms have filed separate travel plans.", "That is advanced choreography." }, new string[3] { "The bass just rearranged my thoughts.", "Did it improve them?", "There are fewer now, so yes." }, new string[3] { "I think that couch is judging us.", "Sit on it. Establish dominance.", "Finally, a strategy with cushions." }, new string[3] { "Are these club clothes?", "Anything is club clothes if you walk in confidently.", "Even this hat?" }, new string[3] { "I lost the beat again.", "It is under your left foot.", "That explains the screaming." }, new string[3] { "This song has been stuck in my head.", "We have been here for thirty seconds.", "It works fast." }, new string[3] { "I am going to talk to the dancer.", "She is busy being professionally unbothered.", "I respect the craft." }, new string[3] { "Did the lights just blink at me?", "No. The bass did.", "Tell the bass I am taken." }, new string[3] { "I brought emergency glow sticks.", "Those are pencils.", "Every budget has limits." }, new string[3] { "Nobody told me there was a dress code.", "There is not.", "Perfect. I accidentally nailed it." }, new string[3] { "I can feel {song} in my spine.", "That might be the subwoofer.", "Then the subwoofer owes me rent." }, new string[3] { "Should we sit down?", "We just got here.", "My enthusiasm has a short battery." }, new string[3] { "I invented a new dance.", "What is it called?", "Avoiding eye contact near the speakers." }, new string[3] { "This place needs a fog machine.", "It has enough atmosphere already.", "I demand weather indoors." }, new string[3] { "I think I look cool right now.", "Do not move. You will ruin it.", "Holding cool position." }, new string[3] { "The music is loud.", "That is how you know it is working.", "My ears have submitted feedback." }, new string[3] { "Can you dance to {song}?", "I can move during it.", "Legally, that may count." }, new string[3] { "I saw you miss that beat.", "The beat moved first.", "Classic hostile rhythm." }, new string[3] { "Why is everyone so shiny?", "The club polish is working.", "I want two coats." }, new string[3] { "I need a dramatic entrance.", "You already walked into a table.", "Drama achieved." }, new string[3] { "Do I dance left or right?", "Pick one and commit.", "I choose confused." }, new string[3] { "The D J changed the color again.", "Every song gets its own mood.", "Mine is currently electric panic." }, new string[3] { "I think the couch saved my life.", "You sat down for twenty seconds.", "Exactly. Medical miracle." }, new string[3] { "Can the lights hear us?", "Only when the bass gives them permission.", "Very organized lighting." }, new string[3] { "I am requesting something classy.", "You requested laser noises last time.", "Classy laser noises." }, new string[3] { "This club has excellent acoustics.", "You shouted into a glass wall.", "And it answered beautifully." }, new string[3] { "I need water.", "You have been nodding your head.", "It was an athletic nod." }, new string[3] { "Is {song} your favorite?", "It is until the next song starts.", "A loyal fan with flexible standards." }, new string[3] { "I am saving this dance for special occasions.", "Please save it farther away.", "Art is always attacked first." }, new string[3] { "The floor is vibrating.", "That is the bass.", "Good. I thought the building was excited." }, new string[3] { "Want to start a dance circle?", "No one invited us.", "That has never stopped a circle." }, new string[3] { "I look mysterious in this lighting.", "You are standing under a spotlight.", "Mysterious with excellent timing." } }; private static readonly string[] SoloLines = new string[36] { "I came for one song. That was several songs ago.", "The bass and I have reached a professional understanding.", "This couch is now my V I P section.", "Nobody saw that dance move. Excellent.", "I am not lost. I am exploring the dance floor diagonally.", "This lighting is doing most of the work for me.", "I would like to thank {song} for carrying this entire evening.", "My rhythm is loading. Please wait.", "The D J cannot ignore my request if I never make one.", "I have achieved maximum casual standing.", "That bass hit reset my posture.", "I am dancing internally. It is safer there.", "This is my good side. All the other sides are on break.", "I came dressed as someone who knows the D J.", "The floor and I disagree about timing.", "I need a drink called better decisions.", "Somebody guard this seat. It knows too much.", "I am one glow stick away from authority.", "The next beat is definitely mine.", "I have no idea what move this is, but it is committed.", "Club rule number one. Pretend that was intentional.", "This room is brighter, and so is my confidence.", "I can hear {song} judging my footwork.", "I am pacing myself at a very dramatic speed.", "My outfit has more rhythm than I do.", "I am taking a tactical sitting break.", "The lights changed color. I assume that means I won.", "I requested more bass by standing near the speaker.", "This place has excellent chairs and aggressive music.", "I am here to dance and misunderstand social cues.", "The vibe is strong. My balance is not.", "I think the ceiling approves of {song}.", "I am saving energy for a move I have not invented yet.", "If confidence had a volume knob, mine is clipping.", "I have become part of the ambient lighting.", "Nobody panic. I found the beat again." }; internal Transform Dancer => _dancer; internal Vector3 WalkCenterPosition { get { //IL_001f: 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) if (!Object.op_Implicit((Object)(object)_walkCenter)) { return ((Component)this).transform.position; } return _walkCenter.position; } } private IEnumerator Start() { _walkCenter = ((IEnumerable<Transform>)((Component)this).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform node) => ((Object)node).name == "EmpressClubWalkCenter")) ?? ((Component)this).transform; _dancer = ((IEnumerable<Transform>)((Component)this).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform node) => ((Object)node).name == "EmpressClubDancer")); _walkBounds = ComputeWalkBounds(); CollectSeats(); float timeout = Time.realtimeSinceStartup + 30f; while (((Object)(object)PlayerAvatar.instance == (Object)null || (Object)(object)PlayerAvatar.instance.playerAvatarVisuals == (Object)null || (Object)(object)MetaManager.instance == (Object)null) && Time.realtimeSinceStartup < timeout) { yield return null; } if ((Object)(object)PlayerAvatar.instance == (Object)null || (Object)(object)PlayerAvatar.instance.playerAvatarVisuals == (Object)null) { EmpressClubPlugin.Log.LogWarning((object)"Empress Club could not create the BotFriends crowd because no player avatar was ready."); yield break; } string path = Path.GetDirectoryName(typeof(EmpressClubCrowd).Assembly.Location) ?? string.Empty; EmpressClubSpeech.Configure(Path.Combine(path, "say.exe"), "Paul", 22050, Path.Combine(path, "dtalk_us.dic")); for (int i = 0; i < 10; i++) { bool preferSolitude = i >= 7; if (!TryPickWanderTarget(_walkCenter.position, out var target, 2.5f, preferSolitude)) { target = _walkCenter.position + new Vector3(Mathf.Cos((float)i * MathF.PI * 2f / 10f), 0f, Mathf.Sin((float)i * MathF.PI * 2f / 10f)) * (4f + (float)i * 0.35f); if (TryGround(target, null, out var grounded)) { target = grounded; } } CreateBot(i, target); yield return null; } _nextConversation = Time.time + Random.Range(8f, 16f); _nextGroupDance = Time.time + Random.Range(24f, 38f); _nextSlapAllowed = Time.time + Random.Range(12f, 25f); _ready = true; EmpressClubPlugin.Log.LogInfo((object)("Empress Club added " + _bots.Count + " BotFriends and " + _seats.Count + " club seats.")); } private void Update() { if (_ready) { UpdateCrowding(); UpdateGroupDance(); UpdateSpeech(); } } private void CreateBot(int index, Vector3 position) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0039: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) string text = BotNames[index % BotNames.Length]; GameObject val = new GameObject("EmpressClubBot_" + text); val.transform.SetParent(((Component)this).transform, true); val.transform.position = position; val.transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); Color accent = Color.HSVToRGB(Mathf.Repeat((float)index * 0.381966f + Random.Range(0.02f, 0.14f), 1f), Random.Range(0.8f, 0.98f), 1f); if (!EmpressClubBotAvatar.TryAttach(val, PlayerAvatar.instance, accent, 1.2f)) { CreateFallbackBody(val.transform, accent); } EmpressClubBot empressClubBot = val.AddComponent<EmpressClubBot>(); empressClubBot.Initialize(this, index); _bots.Add(empressClubBot); } private static void CreateFallbackBody(Transform root, Color accent) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) GameObject obj = GameObject.CreatePrimitive((PrimitiveType)1); ((Object)obj).name = "EmpressClubFallbackBody"; obj.transform.SetParent(root, false); obj.transform.localPosition = new Vector3(0f, 0.9f, 0f); obj.transform.localScale = new Vector3(0.65f, 0.9f, 0.65f); Collider component = obj.GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } Renderer component2 = obj.GetComponent<Renderer>(); if (Object.op_Implicit((Object)(object)component2)) { component2.material.color = accent; } } internal bool TryPickWanderTarget(Vector3 origin, out Vector3 target, float minimumDistance = 6f, bool preferSolitude = false) { //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) Vector3 candidate = default(Vector3); for (int i = 0; i < 36; i++) { if (preferSolitude && ((Bounds)(ref _walkBounds)).size.x > 8f && ((Bounds)(ref _walkBounds)).size.z > 8f) { ((Vector3)(ref candidate))..ctor(Random.Range(((Bounds)(ref _walkBounds)).min.x + 1.5f, ((Bounds)(ref _walkBounds)).max.x - 1.5f), _walkCenter.position.y, Random.Range(((Bounds)(ref _walkBounds)).min.z + 1.5f, ((Bounds)(ref _walkBounds)).max.z - 1.5f)); } else { float num = Random.Range(0f, MathF.PI * 2f); float num2 = Random.Range(6.5f, 17.5f); candidate = _walkCenter.position + new Vector3(Mathf.Cos(num) * num2, 0f, Mathf.Sin(num) * num2); } if (!TryGround(candidate, out var grounded)) { continue; } Vector3 val = grounded - origin; val.y = 0f; if (((Vector3)(ref val)).magnitude < minimumDistance) { continue; } if (preferSolitude) { Vector3 val2 = grounded - _walkCenter.position; val2.y = 0f; if (((Vector3)(ref val2)).magnitude < 12f || _bots.Any((EmpressClubBot bot) => Object.op_Implicit((Object)(object)bot) && Vector3.SqrMagnitude(((Component)bot).transform.position - grounded) < 25f)) { continue; } } if (!_bots.Any((EmpressClubBot bot) => Object.op_Implicit((Object)(object)bot) && Vector3.SqrMagnitude(((Component)bot).transform.position - grounded) < 0.6f)) { target = grounded; return true; } } target = origin; return false; } internal bool TryGround(Vector3 candidate, out Vector3 grounded) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return TryGround(candidate, null, out grounded); } internal bool TryGround(Vector3 candidate, Transform ignore, out Vector3 grounded) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_005a: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) RaycastHit[] array = Physics.RaycastAll(candidate + Vector3.up * 3f, Vector3.down, 12f, -1, (QueryTriggerInteraction)1); float num = float.MaxValue; Vector3 val = Vector3.zero; bool flag = false; RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider) || Vector3.Dot(((RaycastHit)(ref val2)).normal, Vector3.up) < 0.68f) { continue; } Transform transform = ((RaycastHit)(ref val2)).transform; if ((!((Object)(object)ignore != (Object)null) || (!((Object)(object)transform == (Object)(object)ignore) && !transform.IsChildOf(ignore))) && !((Object)(object)((Component)transform).GetComponentInParent<EmpressClubBot>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<EmpressClubDancerPlacement>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<EmpressClubWalker>() != (Object)null)) { float num2 = Mathf.Abs(((RaycastHit)(ref val2)).point.y - _walkCenter.position.y); if (!(num2 > 1.6f) && !(num2 >= num)) { num = num2; val = ((RaycastHit)(ref val2)).point; flag = true; } } } grounded = (flag ? (val + Vector3.up * 0.01f) : candidate); return flag; } internal bool TryGroundNear(Vector3 candidate, float referenceY, Transform ignore, out Vector3 grounded) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_005a: 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_010e: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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) RaycastHit[] array = Physics.RaycastAll(candidate + Vector3.up * 2.5f, Vector3.down, 8f, -1, (QueryTriggerInteraction)1); float num = float.MaxValue; Vector3 val = Vector3.zero; bool flag = false; RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit val2 = array2[i]; if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref val2)).collider) || Vector3.Dot(((RaycastHit)(ref val2)).normal, Vector3.up) < 0.68f) { continue; } Transform transform = ((RaycastHit)(ref val2)).transform; if ((!((Object)(object)ignore != (Object)null) || (!((Object)(object)transform == (Object)(object)ignore) && !transform.IsChildOf(ignore))) && !((Object)(object)((Component)transform).GetComponentInParent<EmpressClubBot>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<EmpressClubDancerPlacement>() != (Object)null) && !((Object)(object)((Component)transform).GetComponentInParent<EmpressClubWalker>() != (Object)null)) { float num2 = Mathf.Abs(((RaycastHit)(ref val2)).point.y - referenceY); if (!(num2 > 1.1f) && !(num2 >= num)) { num = num2; val = ((RaycastHit)(ref val2)).point; flag = true; } } } grounded = (flag ? (val + Vector3.up * 0.01f) : candidate); return flag; } internal EmpressClubBot PickApproachTarget(EmpressClubBot seeker) { List<EmpressClubBot> list = _bots.Where((EmpressClubBot bot) => Object.op_Implicit((Object)(object)bot) && (Object)(object)bot != (Object)(object)seeker && !bot.PrefersSolitude && bot.IsAvailableForConflict).ToList(); if (list.Count == 0) { return null; } return list[Random.Range(0, list.Count)]; } internal bool TryQueueGreeting(EmpressClubBot bot) { if (!_ready || Time.time < _nextGreetingGlobal || Object.op_Implicit((Object)(object)_waitingBot) || Object.op_Implicit((Object)(object)_speakingBot) || _turns.Count > 0) { return false; } _nextGreetingGlobal = Time.time + Random.Range(16f, 26f); _turns.Enqueue(new SpeechTurn(bot, null, EmpressClubDialogue.PickGreeting())); return true; } internal bool TryReserveSeat(EmpressClubBot bot, out SeatSpot seat) { List<SeatSpot> list = (from item in _seats where (Object)(object)item.Occupant == (Object)null orderby Vector3.SqrMagnitude(item.ApproachPosition - ((Component)bot).transform.position) select item).Take(3).ToList(); if (list.Count == 0) { seat = null; return false; } seat = list[Random.Range(0, list.Count)]; seat.Occupant = bot; return true; } internal static void ReleaseSeat(EmpressClubBot bot, SeatSpot seat) { if (seat != null && (Object)(object)seat.Occupant == (Object)(object)bot) { seat.Occupant = null; } } private void UpdateGroupDance() { //IL_00aa: 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_00c4: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _nextGroupDance) { return; } List<EmpressClubBot> list = _bots.Where((EmpressClubBot bot) => Object.op_Implicit((Object)(object)bot) && bot.IsAvailableForDance && !bot.PrefersSolitude).ToList(); if (list.Count < 3) { _nextGroupDance = Time.time + 10f; return; } EmpressClubBot leader = list[Random.Range(0, list.Count)]; int count = Random.Range(3, Mathf.Min(5, list.Count) + 1); List<EmpressClubBot> list2 = list.OrderBy((EmpressClubBot bot) => Vector3.SqrMagnitude(((Component)bot).transform.position - ((Component)leader).transform.position)).Take(count).ToList(); Vector3 val = Vector3.zero; foreach (EmpressClubBot item in list2) { val += ((Component)item).transform.position; } val /= (float)list2.Count; if (TryGround(val, out var grounded)) { val = grounded; } float num = Time.time + 5f; float num2 = Random.Range(13f, 19f); int style = Random.Range(0, 3); float num3 = Random.Range(0f, 360f); for (int num4 = 0; num4 < list2.Count; num4++) { float num5 = num3 + (float)num4 * 360f / (float)list2.Count; Vector3 val2 = val + Quaternion.Euler(0f, num5, 0f) * Vector3.forward * 1.35f; if (TryGround(val2, out var grounded2)) { val2 = grounded2; } list2[num4].JoinGroupDance(val2, val, num, num2, style); } _nextGroupDance = num + num2 + Random.Range(32f, 50f); } private void UpdateCrowding() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (Time.time < _nextCrowdingCheck) { return; } _nextCrowdingCheck = Time.time + 0.25f; EmpressClubBot empressClubBot = null; EmpressClubBot empressClubBot2 = null; float num = 0.81f; for (int i = 0; i < _bots.Count; i++) { EmpressClubBot empressClubBot3 = _bots[i]; if (!Object.op_Implicit((Object)(object)empressClubBot3) || !empressClubBot3.IsAvailableForConflict) { continue; } for (int j = i + 1; j < _bots.Count; j++) { EmpressClubBot empressClubBot4 = _bots[j]; if (Object.op_Implicit((Object)(object)empressClubBot4) && empressClubBot4.IsAvailableForConflict && !(Mathf.Abs(((Component)empressClubBot3).transform.position.y - ((Component)empressClubBot4).transform.position.y) > 1.1f)) { Vector3 val = ((Component)empressClubBot3).transform.position - ((Component)empressClubBot4).transform.position; val.y = 0f; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; empressClubBot = empressClubBot3; empressClubBot2 = empressClubBot4; } } } } if (!Object.op_Implicit((Object)(object)empressClubBot) || !Object.op_Implicit((Object)(object)empressClubBot2)) { _crowdedFirst = null; _crowdedSecond = null; _crowdedSince = 0f; } else if ((Object)(object)empressClubBot != (Object)(object)_crowdedFirst || (Object)(object)empressClubBot2 != (Object)(object)_crowdedSecond) { _crowdedFirst = empressClubBot; _crowdedSecond = empressClubBot2; _crowdedSince = Time.time; } else if (!(Time.time < _nextSlapAllowed) && !(Time.time - _crowdedSince < 1.1f) && !(Random.value > 0.3f)) { EmpressClubBot empressClubBot5 = ((Random.value < 0.5f) ? empressClubBot : empressClubBot2); EmpressClubBot empressClubBot6 = (((Object)(object)empressClubBot5 == (Object)(object)empressClubBot) ? empressClubBot2 : empressClubBot); if (empressClubBot5.BeginSlap(empressClubBot6)) { string[] array = EmpressClubDialogue.PickSlapExchange(); _turns.Enqueue(new SpeechTurn(empressClubBot5, empressClubBot6, array[0])); _turns.Enqueue(new SpeechTurn(empressClubBot6, empressClubBot5, array[1])); _nextSlapAllowed = Time.time + Random.Range(22f, 45f); _crowdedFirst = null; _crowdedSecond = null; _crowdedSince = 0f; } } } private void CollectSeats() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_007e: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); RaycastHit val5 = default(RaycastHit); foreach (Transform val in componentsInChildren) { if (((Object)val).name != "SeatedPosition") { continue; } Vector3 position = val.position; if (!_seats.Any((SeatSpot existing) => Vector3.SqrMagnitude(existing.Position - position) < 0.12f)) { Vector3 val2 = val.forward; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.1f) { val2 = _walkCenter.position - position; } val2.y = 0f; Quaternion val3 = ((((Vector3)(ref val2)).sqrMagnitude > 0.1f) ? Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up) : Quaternion.identity); Vector3 val4 = position + val3 * Vector3.forward * 1.05f; if (Physics.Raycast(val4 + Vector3.up * 2.5f, Vector3.down, ref val5, 6f, -1, (QueryTriggerInteraction)1) && Vector3.Dot(((RaycastHit)(ref val5)).normal, Vector3.up) > 0.68f) { val4 = ((RaycastHit)(ref val5)).point + Vector3.up * 0.01f; } _seats.Add(new SeatSpot { Position = position, ApproachPosition = val4, Rotation = val3 }); } } } private Bounds ComputeWalkBounds() { //IL_005d: 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 ref