using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ImGogole")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.7.0")] [assembly: AssemblyInformationalVersion("1.0.7")] [assembly: AssemblyProduct("SomeEmotesREPO")] [assembly: AssemblyTitle("SomeEmotesREPO")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.7.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [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; } } } [Serializable] public class Preferences { public List farovites = new List(); public KeyCode panelKey = (KeyCode)112; } namespace SomeEmotesREPO { [HarmonyPatch(typeof(PlayerAvatar))] internal class AddEmoteSystemPatch { [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerAvatar __instance) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (GameManager.Multiplayer()) { if (Object.op_Implicit((Object)(object)GameManager.instance) && GameManager.instance.connectRandom) { SomeEmotesREPO.Logger.LogWarning((object)"CAUTION ! You are using a mod in a public lobby, people who doesn't have the mod and yourself can have some errors due to compatibility."); } EmoteSystem emoteSystem = ((Component)__instance).GetComponent(); if (!Object.op_Implicit((Object)(object)emoteSystem)) { emoteSystem = ((Component)__instance).gameObject.AddComponent(); } emoteSystem.SetPlayerAvatar(__instance); if (__instance.photonView.IsMine) { SomeEmotesREPO.Logger.LogInfo((object)$"EmoteSystem has been added to the player. Press [{EmoteLoader.PanelKey}] to see the Emote Panel."); } } else { SomeEmotesREPO.Logger.LogInfo((object)"Not in a multiplayer game : ignored."); } } } [HarmonyPatch(typeof(GameDirector))] internal class AddPatchGameDirector { [HarmonyPrefix] [HarmonyPatch("DeathStart")] private static void DeathStart_Prefix() { if (EmoteSystem.Ready && EmoteSystem.Instance.IsEmoting) { EmoteSystem.Instance.StopEmote(); } } } [HarmonyPatch(typeof(PlayerExpression))] internal class AddPatchPlayerExpression { [HarmonyPrefix] [HarmonyPatch("DoExpression")] private static bool DoExpression_Prefix() { return !BlockBecauseEmoteIsPlaying(); } [HarmonyPrefix] [HarmonyPatch("ToggleExpression")] private static bool ToggleExpression_Prefix() { return !BlockBecauseEmoteIsPlaying(); } private static bool BlockBecauseEmoteIsPlaying() { return EmoteSystem.Ready && EmoteSystem.Instance.IsEmoting; } } public static class EmoteBundleLoader { private static AssetBundle emoteBundle; public static AssetBundle Load(string path) { if ((Object)(object)emoteBundle == (Object)null) { emoteBundle = AssetBundle.LoadFromFile(path); if ((Object)(object)emoteBundle == (Object)null) { SomeEmotesREPO.Logger.LogError((object)"EmoteBundle is not found"); } } return emoteBundle; } public static void Unload() { if ((Object)(object)emoteBundle != (Object)null) { emoteBundle.Unload(true); emoteBundle = null; } } public static T LoadAsset(string name) where T : Object { if ((Object)(object)emoteBundle == (Object)null) { return default(T); } name = name.ToLower(); string[] allAssetNames = emoteBundle.GetAllAssetNames(); string[] array = allAssetNames; foreach (string text in array) { if (text.ToLower().EndsWith(name)) { return emoteBundle.LoadAsset(text); } } return default(T); } public static List GetAllAnimNames() { List list = new List(); string[] allAssetNames = emoteBundle.GetAllAssetNames(); foreach (string text in allAssetNames) { if (text.EndsWith(".anim")) { list.Add(text); } } return list; } } public class EmoteLauncher : MonoBehaviour { public Animator animator; public EmoteSystem emoteSystem; public List emoteNames = new List(); private Dictionary animationDict = new Dictionary(); private AnimatorOverrideController overrideController; private string overrideKeyName = "Placeholder"; private float initialRot; private Transform targetPlayer; private GameObject visuals; private GameObject spotlight; public SkinnedMeshRenderer leg_R; public SkinnedMeshRenderer leg_L; public SkinnedMeshRenderer body_bot; public SkinnedMeshRenderer body_top_sphere; public SkinnedMeshRenderer arm_L; public SkinnedMeshRenderer arm_R; public SkinnedMeshRenderer health_LED; public SkinnedMeshRenderer health_frame; public SkinnedMeshRenderer health_shadow; public SkinnedMeshRenderer head_bot_sphere; public SkinnedMeshRenderer head_bot_flat; public SkinnedMeshRenderer head_top; public SkinnedMeshRenderer eye_L; public SkinnedMeshRenderer iris_L; public SkinnedMeshRenderer eye_R; public SkinnedMeshRenderer iris_R; public List EmoteNames => emoteNames; public void AddEntry(string name, AnimationClip clip) { animationDict.Add(name, clip); } public void Init(Transform target) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown targetPlayer = target; visuals = ((Component)((Component)this).transform.GetChild(0)).gameObject; spotlight = ((Component)((Component)this).transform.GetChild(1)).gameObject; animator = ((Component)this).GetComponentInChildren(); overrideController = new AnimatorOverrideController(animator.runtimeAnimatorController); animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)overrideController; foreach (KeyValuePair item in animationDict) { emoteNames.Add(item.Key); } InitBones(); InitLight(); visuals.SetActive(false); spotlight.SetActive(false); } private void Update() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)targetPlayer)) { ((Component)this).transform.position = targetPlayer.position; } } private void LateUpdate() { //IL_002d: 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_004d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)emoteSystem) && emoteSystem.IsEmoting) { ((Component)this).transform.eulerAngles = new Vector3(((Component)this).transform.eulerAngles.x, initialRot, ((Component)this).transform.eulerAngles.z); } } public void SetFavorites(List favs) { if (favs != null && favs.Count != 0) { List list = favs.Where(emoteNames.Contains).Distinct().ToList(); if (list.Count != 0) { emoteNames.RemoveAll(list.Contains); emoteNames.InsertRange(0, list); EmoteLoader.Instance.emotesName = new List(emoteNames); int count = Math.Min(8, emoteNames.Count); List favorites = emoteNames.Take(count).ToList(); EmoteLoader.Instance.SetFavorites(favorites); } } } public void SetRotation(float _initialRot) { initialRot = _initialRot; } public bool Animate(string emoteName) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!animationDict.TryGetValue(emoteName, out AnimationClip value)) { return false; } ((Component)animator).transform.SetLocalPositionAndRotation(Vector3.zero, Quaternion.identity); visuals.SetActive(true); spotlight.SetActive(true); overrideController[overrideKeyName] = value; animator.ResetTrigger("StopEmote"); animator.SetTrigger("TriggerEmote"); return true; } public void StopEmote() { visuals.SetActive(false); spotlight.SetActive(false); animator.SetTrigger("StopEmote"); } private void InitLight() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) Light val = spotlight.AddComponent(); ((Component)val).transform.localPosition = Vector3.up * 2.5f; ((Component)val).transform.localEulerAngles = -Vector3.left * 90f; val.type = (LightType)0; val.innerSpotAngle = 35f; val.spotAngle = 40f; val.color = new Color(1f, 0.97f, 0.84f); val.intensity = 1.75f; val.bounceIntensity = 1f; val.range = 5f; val.shadows = (LightShadows)0; val.cullingMask = -1; } private void InitBones() { leg_R = ((Component)FindDeepChild(((Component)this).transform, "leg_R_0")).GetComponent(); leg_L = ((Component)FindDeepChild(((Component)this).transform, "leg_L_0")).GetComponent(); body_bot = ((Component)FindDeepChild(((Component)this).transform, "body_bot_0")).GetComponent(); body_top_sphere = ((Component)FindDeepChild(((Component)this).transform, "body_top_sphere_0")).GetComponent(); arm_L = ((Component)FindDeepChild(((Component)this).transform, "arm_L_0")).GetComponent(); arm_R = ((Component)FindDeepChild(((Component)this).transform, "arm_R_0")).GetComponent(); health_LED = ((Component)FindDeepChild(((Component)this).transform, "health_LED_0")).GetComponent(); health_frame = ((Component)FindDeepChild(((Component)this).transform, "health_frame_0")).GetComponent(); health_shadow = ((Component)FindDeepChild(((Component)this).transform, "health_shadow_0")).GetComponent(); head_bot_sphere = ((Component)FindDeepChild(((Component)this).transform, "head_bot_sphere_0")).GetComponent(); head_bot_flat = ((Component)FindDeepChild(((Component)this).transform, "head_bot_flat_0")).GetComponent(); head_top = ((Component)FindDeepChild(((Component)this).transform, "head_top_0")).GetComponent(); eye_L = ((Component)FindDeepChild(((Component)this).transform, "eye_L_0")).GetComponent(); iris_L = ((Component)FindDeepChild(((Component)this).transform, "iris_L_0")).GetComponent(); eye_R = ((Component)FindDeepChild(((Component)this).transform, "eye_R_0")).GetComponent(); iris_R = ((Component)FindDeepChild(((Component)this).transform, "iris_R_0")).GetComponent(); } public void InitTexturesFrom(GameObject initial) { TryCopyMaterials(leg_R, initial, "mesh_leg_r"); TryCopyMaterials(leg_L, initial, "mesh_leg_l"); TryCopyMaterials(body_bot, initial, "mesh_body_bot"); TryCopyMaterials(body_top_sphere, initial, "mesh_body_top_sphere"); TryCopyMaterials(arm_L, initial, "mesh_arm_l"); TryCopyMaterials(arm_R, initial, "mesh_arm_r"); TryCopyMaterials(health_LED, initial, "mesh_health"); TryCopyMaterials(health_frame, initial, "mesh_health frame"); TryCopyMaterials(health_shadow, initial, "mesh_health shadow"); TryCopyMaterials(head_bot_sphere, initial, "mesh_head_bot_sphere"); TryCopyMaterials(head_bot_flat, initial, "mesh_head_bot_flat"); TryCopyMaterials(head_top, initial, "mesh_head_top"); TryCopyMaterials(eye_L, initial, "mesh_eye_l"); TryCopyMaterials(iris_L, initial, "mesh_pupil_l"); TryCopyMaterials(eye_R, initial, "mesh_eye_r"); TryCopyMaterials(iris_R, initial, "mesh_pupil_r"); } private void TryCopyMaterials(SkinnedMeshRenderer target, GameObject source, string boneName) { if (!((Object)(object)target == (Object)null)) { Material[] materialsFromBone = GetMaterialsFromBone(source, boneName); if (materialsFromBone != null) { ((Renderer)target).materials = materialsFromBone; } } } private Material[] GetMaterialsFromBone(GameObject initial, string name) { Transform val = FindDeepChild(initial.transform, name); if ((Object)(object)val != (Object)null) { return ((Renderer)((Component)val).GetComponent()).materials; } return null; } private Transform FindDeepChild(Transform parent, string childName) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown foreach (Transform item in parent) { Transform val = item; if (((Object)val).name.ToLower() == childName.ToLower()) { return val; } Transform val2 = FindDeepChild(val, childName); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } } public class EmoteLoader : MonoBehaviour { private AssetBundle assetBundle; private static EmoteLoader instance; public List emotesName = new List(); private Preferences emotesPreferences; public static EmoteLoader Instance => instance; public static KeyCode PanelKey => (KeyCode)((!((Object)(object)instance != (Object)null) || instance.emotesPreferences == null) ? 112 : ((int)instance.emotesPreferences.panelKey)); public int TotalPages => Mathf.CeilToInt((float)(emotesName.Count / 8)); private void Awake() { instance = this; } private void Start() { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = Path.Combine(directoryName, "emotes.bundle"); assetBundle = EmoteBundleLoader.Load(path); if ((Object)(object)assetBundle == (Object)null) { path = Path.Combine(directoryName, "Emotes", "emotes.bundle"); assetBundle = EmoteBundleLoader.Load(path); } string path2 = Path.Combine(directoryName, "preferences.json"); try { string text = File.ReadAllText(path2); emotesPreferences = JsonUtility.FromJson(text); } catch { SomeEmotesREPO.Logger.LogInfo((object)"No preferences file found, creating one."); emotesPreferences = new Preferences(); SavePreferences(); } } public static Font GetFont() { return instance.assetBundle.LoadAllAssets().First((Font f) => ((Object)f).name.ToLower().Contains("teko-regular")); } public void SavePreferences() { string path = Path.Combine(Paths.PluginPath, "ImGogole-SomeEmotesREPO", "preferences.json"); string contents = JsonUtility.ToJson((object)emotesPreferences); File.WriteAllText(path, contents); } public void SetFavorites(List favs) { emotesPreferences.farovites = favs; SavePreferences(); } public EmoteLauncher LoadEmote(PlayerAvatar playerAvatar) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)assetBundle == (Object)null) { SomeEmotesREPO.Logger.LogError((object)"Unable to load emotes.bundle"); return null; } emotesName.Clear(); GameObject val = EmoteBundleLoader.LoadAsset("emote.prefab"); if ((Object)(object)val == (Object)null) { SomeEmotesREPO.Logger.LogError((object)"Prefab emote not found"); return null; } GameObject val2 = Object.Instantiate(val, Vector3.zero, Quaternion.identity); EmoteLauncher emoteLauncher = val2.AddComponent(); List allAnimNames = EmoteBundleLoader.GetAllAnimNames(); foreach (string item in allAnimNames) { string text = ExtractElement(item); if (!string.IsNullOrWhiteSpace(text)) { emoteLauncher.AddEntry(text, EmoteBundleLoader.LoadAsset(item)); emotesName.Add(text); } } emoteLauncher.Init(((Component)playerAvatar).transform); emoteLauncher.SetFavorites(emotesPreferences.farovites); emoteLauncher.InitTexturesFrom(((Component)((Component)playerAvatar).transform.parent).gameObject); return emoteLauncher; } public static string ExtractElement(string path) { if (string.IsNullOrWhiteSpace(path)) { return string.Empty; } string text = path.Trim(); int num = text.LastIndexOf('/'); if (num >= 0) { text = text.Substring(num + 1); } if (text.EndsWith(".anim", StringComparison.OrdinalIgnoreCase)) { text = text.Substring(0, text.Length - ".anim".Length); } return text; } } public class EmoteSelectionManager : MonoBehaviour { private static EmoteSelectionManager instance; private bool visible = false; private int currentPage = 0; private List lines = new List(); private List emotesToPlay = new List(); public const int emotePerPages = 8; public const int LineHeigth = 30; public const string delimiter = "-----------------------------"; public GUIStyle style; public List Lines => lines; public List EmotesToPlay => emotesToPlay; public bool Visible => visible; public static EmoteSelectionManager Instance => instance; private void Awake() { instance = this; SomeEmotesREPO.Logger.LogInfo((object)"EmoteSelectionManager ready."); } public void SetVisible(bool isVisible) { visible = isVisible; if (visible) { OpenPanel(0); } } public void OpenPanel(int page) { currentPage = page; UpdateLines(); } private void Update() { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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) if (ChatManager.instance.chatActive || !Visible) { return; } if (currentPage > 0 && Input.GetKeyDown((KeyCode)276)) { OpenPanel(currentPage - 1); } if (currentPage < EmoteLoader.Instance.TotalPages && Input.GetKeyDown((KeyCode)275)) { OpenPanel(currentPage + 1); } for (int i = 0; i < emotesToPlay.Count; i++) { KeyCode val = (KeyCode)(49 + i); KeyCode val2 = (KeyCode)(257 + i); bool flag = Input.GetKeyDown(val) || Input.GetKeyDown(val2); bool flag2 = Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307) || Input.GetKey((KeyCode)313); if (flag) { if (flag2) { EmoteSystem.Instance.SetFavorite(emotesToPlay[i]); UpdateLines(); } else { EmoteSystem.Instance.PlayEmote(emotesToPlay[i]); } } } } private void UpdateLines() { //IL_0225: Unknown result type (might be due to invalid IL or missing references) lines.Clear(); emotesToPlay.Clear(); List list = EmoteSystem.Instance.FetchEmotes(currentPage * 8, 8); if (currentPage == 0) { lines.Add("Favorite emotes"); lines.Add("-----------------------------"); if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { lines.Add($"[{i + 1}] {list[i]}"); emotesToPlay.Add(list[i]); } } else { lines.Add("No emote yet"); } lines.Add("-----------------------------"); lines.Add("Press [->] for next page"); } else { lines.Add($"Page {currentPage + 1}/{EmoteLoader.Instance.TotalPages + 1}"); lines.Add("-----------------------------"); for (int j = 0; j < list.Count; j++) { lines.Add($"[{j + 1}] {list[j]}"); emotesToPlay.Add(list[j]); } lines.Add("-----------------------------"); if (EmoteLoader.Instance.TotalPages > currentPage) { lines.Add("Press [->] for next page"); } lines.Add("Press [<-] for previous page"); } if (list.Count > 0) { lines.Add("Press [Num] to emote"); lines.Add("Press [Alt + Num] to add to favorite"); } lines.Add($"Press [{EmoteLoader.PanelKey}] to quit"); } private void OnGUI() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!EmoteSystem.Ready || !Visible || Lines.Count == 0) { return; } if (style == null) { style = GUI.skin.GetStyle("label"); style.fontSize = 22; style.font = EmoteLoader.GetFont(); style.richText = true; } float num = (float)Screen.height - 8f - (float)(Lines.Count * 30); foreach (string line in Lines) { GUI.Label(new Rect(8f, num, (float)Screen.width - 16f, 30f), line, style); num += 30f; } } } public class EmoteSystem : MonoBehaviourPun { private bool isEmoting = false; private int emoteId = -1; private float emoteTime = 0f; private float initialRot = 0f; private bool ready = false; private Transform camTransform; private PlayerAvatar playerAvatar; private PlayerAvatarVisuals playerVisuals; private static float initalCamOffset = 3.25f; private static float camOffset = initalCamOffset; private static EmoteSystem instance; private EmoteLauncher emoteLauncher; private Animator animator; public static bool Ready { get { if (!Object.op_Implicit((Object)(object)instance)) { return false; } return instance.ready; } } public bool IsEmoting { get { return isEmoting; } set { isEmoting = value; if (isEmoting) { emoteTime = 0f; } } } public static EmoteSystem Instance => instance; private PhotonView PV => playerVisuals.playerAvatar.photonView; private void Awake() { ready = false; if ((Object)(object)Camera.main != (Object)null) { camTransform = ((Component)Camera.main).transform; } } public List FetchEmotes(int startIndex, int count) { return emoteLauncher.EmoteNames.Skip(Math.Max(startIndex, 0)).Take(Math.Max(count, 0)).ToList(); } public void SetFavorite(string fav) { SetFavorites(new List { fav }); } public void SetFavorites(List favs) { emoteLauncher.SetFavorites(favs); } public void SetPlayerAvatar(PlayerAvatar pa) { playerAvatar = pa; ((MonoBehaviour)this).StartCoroutine(SetVisuals()); } private IEnumerator SetVisuals() { yield return (object)new WaitForSeconds(0.75f); if ((Object)(object)playerAvatar != (Object)null) { playerVisuals = playerAvatar.playerAvatarVisuals; if ((Object)(object)playerVisuals == (Object)null) { playerVisuals = ((Component)((Component)playerAvatar).transform.parent).GetComponentInChildren(); } if ((Object)(object)playerVisuals != (Object)null) { animator = ((Component)playerVisuals).GetComponentInChildren(); if ((Object)(object)animator == (Object)null) { SomeEmotesREPO.Logger.LogWarning((object)"Animator object not found on player visuals. Emote system visual features disabled."); } } } if (PV.IsMine) { instance = this; } if (GameManager.Multiplayer()) { emoteLauncher = EmoteLoader.Instance.LoadEmote(playerAvatar); emoteLauncher.emoteSystem = this; } ready = true; } public void PlayEmote(string emoteId) { if (PV.IsMine) { EmoteSelectionManager.Instance.SetVisible(isVisible: false); IsEmoting = true; ((MonoBehaviourPun)this).photonView.RPC("RPC_PlayEmote", (RpcTarget)0, new object[2] { emoteId, initialRot }); } } public void StopEmote() { if (PV.IsMine) { EmoteSelectionManager.Instance.SetVisible(isVisible: false); IsEmoting = false; ((MonoBehaviourPun)this).photonView.RPC("RPC_StopEmote", (RpcTarget)0, Array.Empty()); } } [PunRPC] private void RPC_PlayEmote(string emoteId, float _initialRot) { IsEmoting = true; if (!((Object)(object)emoteLauncher == (Object)null)) { emoteLauncher.SetRotation(_initialRot); emoteLauncher.Animate(emoteId); SomeEmotesREPO.Logger.LogInfo((object)("[" + ((MonoBehaviourPun)this).photonView.Owner.NickName + "] played emote " + emoteId + ".")); } } [PunRPC] private void RPC_StopEmote() { IsEmoting = false; if ((Object)(object)emoteLauncher != (Object)null) { emoteLauncher.StopEmote(); } } private void Update() { //IL_00a4: 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_00af: 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_01d5: Unknown result type (might be due to invalid IL or missing references) if (!ready) { return; } if (IsEmoting) { emoteTime += Time.deltaTime; if (IsPlayerTakeControlBack()) { IsEmoting = false; StopEmote(); } } if (PV.IsMine && Object.op_Implicit((Object)(object)camTransform)) { if (isEmoting) { camTransform.localPosition = new Vector3(0f, 0f, 0f - camOffset); } else { camTransform.localPosition = Vector3.zero; } float y = Input.mouseScrollDelta.y; if (y != 0f) { camOffset -= y * Time.deltaTime * 20f; camOffset = Mathf.Clamp(camOffset, 0.5f, 4f); } } if (!Object.op_Implicit((Object)(object)playerVisuals)) { return; } if (PV.IsMine && !playerAvatar.deadSet && Input.GetKeyDown(EmoteLoader.PanelKey) && !ChatManager.instance.chatActive) { EmoteSelectionManager.Instance.SetVisible(!EmoteSelectionManager.Instance.Visible); } if (!PV.IsMine) { if ((Object)(object)animator != (Object)null) { ((Behaviour)animator).enabled = !IsEmoting; } playerVisuals.meshParent.SetActive(!IsEmoting); } else { initialRot = ((Component)playerAvatar).transform.eulerAngles.y; } } public bool IsPlayerTakeControlBack() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!PV.IsMine) { return false; } Vector2 movement = InputManager.instance.GetMovement(); if (((Vector2)(ref movement)).sqrMagnitude > 0.01f) { return true; } if (InputManager.instance.KeyDown((InputKey)1) || InputManager.instance.KeyDown((InputKey)2) || InputManager.instance.KeyDown((InputKey)15) || InputManager.instance.KeyDown((InputKey)12) || InputManager.instance.KeyDown((InputKey)14)) { return true; } return false; } public void OnDestroy() { if ((Object)(object)emoteLauncher != (Object)null) { Object.Destroy((Object)(object)((Component)emoteLauncher).gameObject); } } } [HarmonyPatch(typeof(FlashlightController))] internal class FlashlightControllerPatch { [HarmonyPrefix] [HarmonyPatch("Update")] private static bool Update_Prefix(FlashlightController __instance) { EmoteSystem component = ((Component)__instance.PlayerAvatar).GetComponent(); if ((Object)(object)component == (Object)null) { return true; } if (component.IsEmoting) { ((Renderer)__instance.mesh).enabled = false; ((Behaviour)__instance.spotlight).enabled = false; __instance.halo.enabled = false; __instance.LightActive = false; return false; } return true; } } public static class HierarchyLogger { public static void LogFullHierarchy(GameObject go) { Transform val = go.transform; while ((Object)(object)val.parent != (Object)null) { val = val.parent; } StringBuilder stringBuilder = new StringBuilder(); BuildHierarchyString(val, 0, stringBuilder, go.transform); SomeEmotesREPO.Logger.LogInfo((object)stringBuilder.ToString()); } private static void BuildHierarchyString(Transform t, int indent, StringBuilder sb, Transform initial) { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown sb.Append(' ', indent * 2); string text = (((Object)(object)t == (Object)(object)initial) ? " [INITIAL GAME OBJECT]" : ""); Component[] components = ((Component)t).GetComponents(); string text2 = string.Join(", ", from c in components where !(c is Transform) select ((object)c).GetType().Name); if (!string.IsNullOrEmpty(text2)) { text2 = " [" + text2 + "]"; } sb.AppendLine("- " + ((Object)t).name + text + text2); foreach (Transform item in t) { Transform t2 = item; BuildHierarchyString(t2, indent + 1, sb, initial); } } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "Update")] internal static class PlayerAvatarVisualsUpdatePatch { private static bool Prefix(PlayerAvatarVisuals __instance) { if ((Object)(object)__instance.playerAvatar != (Object)null && __instance.playerAvatar.photonView.IsMine && (Object)(object)EmoteSystem.Instance != (Object)null && EmoteSystem.Instance.IsEmoting) { return false; } return true; } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "Revive")] internal static class PlayerAvatarVisualsRevivePatch { private static void Prefix(PlayerAvatarVisuals __instance) { if (EmoteSystem.Ready && !((Object)(object)EmoteSystem.Instance == (Object)null) && EmoteSystem.Instance.IsEmoting) { EmoteSystem.Instance.StopEmote(); } } } [HarmonyPatch(typeof(PlayerNameChecker))] internal class PlayerNameCheckerPatch { [HarmonyPrefix] [HarmonyPatch("Update")] public static void Update_Prefix(PlayerNameChecker __instance) { if (Object.op_Implicit((Object)(object)EmoteSystem.Instance) && EmoteSystem.Instance.IsEmoting) { __instance.checkTimer = 0.25f; } } } [BepInPlugin("ImGogole.SomeEmotesREPO", "SomeEmotesREPO", "1.0.7")] public class SomeEmotesREPO : BaseUnityPlugin { internal static SomeEmotesREPO Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent())) { ((Component)this).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent())) { ((Component)this).gameObject.AddComponent(); } Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } } namespace SomeEmotesREPO.Utils { public static class ChatReflection { private static readonly FieldRef _chatActiveGetter = AccessTools.FieldRefAccess("chatActive"); public static bool IsChatActive() { if ((Object)(object)ChatManager.instance == (Object)null) { return false; } return _chatActiveGetter.Invoke(ChatManager.instance); } } }