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.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using AdvancedCompany.Game; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BetterEmote.AssetScripts; using BetterEmote.Patches; using BetterEmote.Utils; using EmotesAPI; using GameNetcodeStuff; using HarmonyLib; using JetBrains.Annotations; using LethalCompanyInputUtils.Api; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalEmotesAPI; using LethalEmotesAPI.Core; using LethalEmotesAPI.Data; using LethalEmotesAPI.ImportV2; using LethalEmotesAPI.NetcodePatcher; using LethalEmotesAPI.Patches; using LethalEmotesAPI.Patches.ModCompat; using LethalEmotesAPI.Utils; using LethalEmotesApi.Ui; using LethalEmotesApi.Ui.Data; using LethalEmotesApi.Ui.Db; using LethalEmotesApi.Ui.Dmca; using LethalVRM; using Microsoft.CodeAnalysis; using ModelReplacement; using MonoMod.RuntimeDetour; using MoreCompany.Cosmetics; using Newtonsoft.Json; using TMPro; using TooManyEmotes; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.InputSystem.Utilities; using UnityEngine.Rendering; using UnityEngine.UI; [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: IgnoresAccessChecksTo("BetterEmotes")] [assembly: IgnoresAccessChecksTo("LethalVRM")] [assembly: IgnoresAccessChecksTo("MToon")] [assembly: IgnoresAccessChecksTo("UniGLTF")] [assembly: IgnoresAccessChecksTo("UniGLTF.Utils")] [assembly: IgnoresAccessChecksTo("UniHumanoid")] [assembly: IgnoresAccessChecksTo("VRM10")] [assembly: IgnoresAccessChecksTo("VrmLib")] [assembly: IgnoresAccessChecksTo("VRMShaders.GLTF.IO.Runtime")] [assembly: IgnoresAccessChecksTo("VRMShaders.VRM.IO.Runtime")] [assembly: IgnoresAccessChecksTo("VRMShaders.VRM10.Format.Runtime")] [assembly: IgnoresAccessChecksTo("VRMShaders.VRM10.MToon10.Runtime")] [assembly: AssemblyCompany("LethalEmotesAPI")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+55a1e71f9c35eedd9ce7791eeb50354e32e3daff")] [assembly: AssemblyProduct("LethalEmotesAPI")] [assembly: AssemblyTitle("LethalEmotesAPI")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class { static () { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } internal static class AnimationReplacements { internal static GameObject g; internal static bool setup; internal static void RunAll() { ChangeAnims(); } internal static BoneMapper Import(GameObject prefab, string skeleton, int[] pos, bool hidemesh = true) { GameObject val = Object.Instantiate(Assets.Load("@CustomEmotesAPI_customemotespackage:assets/animationreplacements/commando.prefab")); GameObject val2 = Object.Instantiate(Assets.Load(skeleton)); val2.GetComponent().runtimeAnimatorController = val.GetComponent().runtimeAnimatorController; BoneMapper result = ApplyAnimationStuff(prefab, val2, pos, hidemesh, jank: false, revertBonePositions: true); val.transform.SetParent(val2.transform); return result; } public static void DebugBones(GameObject fab) { SkinnedMeshRenderer[] componentsInChildren = fab.GetComponentsInChildren(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"rendererererer: {componentsInChildren[0]}\n"); stringBuilder.Append($"bone count: {componentsInChildren[0].bones.Length}\n"); stringBuilder.Append($"mesh count: {componentsInChildren.Length}\n"); stringBuilder.Append("root bone: " + ((Object)componentsInChildren[0].rootBone).name + "\n"); stringBuilder.Append(((object)fab).ToString() + ":\n"); SkinnedMeshRenderer[] array = componentsInChildren; foreach (SkinnedMeshRenderer val in array) { if (val.bones.Length == 0) { stringBuilder.Append("No bones"); } else { stringBuilder.Append("["); Transform[] bones = val.bones; foreach (Transform val2 in bones) { stringBuilder.Append("'" + ((Object)val2).name + "', "); } stringBuilder.Remove(stringBuilder.Length - 2, 2); stringBuilder.Append("]"); } stringBuilder.Append("\n\n"); DebugClass.Log(stringBuilder.ToString()); } } internal static void ChangeAnims() { } internal static void ApplyAnimationStuff(GameObject bodyPrefab, string resource, int[] pos) { GameObject animcontroller = Assets.Load(resource); ApplyAnimationStuff(bodyPrefab, animcontroller, pos); } internal static BoneMapper ApplyAnimationStuff(GameObject bodyPrefab, GameObject animcontroller, int[] pos, bool hidemeshes = true, bool jank = false, bool revertBonePositions = false) { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) try { if (!animcontroller.GetComponentInChildren().avatar.isHuman) { DebugClass.Log($"{animcontroller}'s avatar isn't humanoid, please fix it in unity!"); return null; } } catch (Exception arg) { DebugClass.Log($"Had issue checking if avatar was humanoid: {arg}"); throw; } try { if (hidemeshes) { SkinnedMeshRenderer[] componentsInChildren = animcontroller.GetComponentsInChildren(); foreach (SkinnedMeshRenderer val in componentsInChildren) { val.sharedMesh = null; } MeshFilter[] componentsInChildren2 = animcontroller.GetComponentsInChildren(); foreach (MeshFilter val2 in componentsInChildren2) { val2.sharedMesh = null; } } } catch (Exception arg2) { DebugClass.Log($"Had trouble while hiding meshes: {arg2}"); throw; } Transform transform = ((Component)bodyPrefab.GetComponentInChildren()).transform; try { animcontroller.transform.parent = transform; animcontroller.transform.localPosition = Vector3.zero; animcontroller.transform.eulerAngles = bodyPrefab.transform.eulerAngles; animcontroller.transform.localScale = Vector3.one; } catch (Exception arg3) { DebugClass.Log($"Had trouble setting emote skeletons parent: {arg3}"); throw; } SkinnedMeshRenderer[] array = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[pos.Length]; SkinnedMeshRenderer emoteSkeletonSMR; try { emoteSkeletonSMR = animcontroller.GetComponentsInChildren()[0]; } catch (Exception arg4) { DebugClass.Log($"Had trouble setting emote skeletons SkinnedMeshRenderer: {arg4}"); throw; } try { for (int k = 0; k < pos.Length; k++) { array[k] = bodyPrefab.GetComponentsInChildren()[pos[k]]; } } catch (Exception arg5) { DebugClass.Log($"Had trouble setting the original skeleton's skinned mesh renderer: {arg5}"); throw; } BoneMapper boneMapper = animcontroller.AddComponent(); try { boneMapper.jank = jank; boneMapper.emoteSkeletonSMR = emoteSkeletonSMR; boneMapper.basePlayerModelSMR = array; boneMapper.bodyPrefab = bodyPrefab; boneMapper.basePlayerModelAnimator = ((Component)transform).GetComponentInChildren(); boneMapper.emoteSkeletonAnimator = animcontroller.GetComponentInChildren(); } catch (Exception arg6) { DebugClass.Log($"Had issue when setting up BoneMapper settings 1: {arg6}"); throw; } try { GameObject val3 = Assets.Load("assets/customstuff/scavEmoteSkeleton.prefab"); val3.transform.localScale = new Vector3(1.1216f, 1.1216f, 1.1216f); float num = Vector3.Distance(val3.GetComponentInChildren().GetBoneTransform((HumanBodyBones)10).position, val3.GetComponentInChildren().GetBoneTransform((HumanBodyBones)5).position); float num2 = Vector3.Distance(animcontroller.GetComponentInChildren().GetBoneTransform((HumanBodyBones)10).position, animcontroller.GetComponentInChildren().GetBoneTransform((HumanBodyBones)5).position); boneMapper.scale = num2 / num; boneMapper.model = ((Component)transform).gameObject; } catch (Exception arg7) { DebugClass.Log($"Had issue when setting up BoneMapper settings 2: {arg7}"); throw; } boneMapper.revertTransform = revertBonePositions; return boneMapper; } } public struct WorldProp { internal GameObject prop; internal JoinSpot[] joinSpots; public WorldProp(GameObject _prop, JoinSpot[] _joinSpots) { prop = _prop; joinSpots = _joinSpots; } } public enum TempThirdPerson { none, on, off } public class BoneMapper : MonoBehaviour { public static List primaryAudioClips = new List(); public static List secondaryAudioClips = new List(); public static List primaryDMCAFreeAudioClips = new List(); public static List secondaryDMCAFreeAudioClips = new List(); public GameObject audioObject; public SkinnedMeshRenderer emoteSkeletonSMR; public SkinnedMeshRenderer[] basePlayerModelSMR; public Animator basePlayerModelAnimator; public Animator emoteSkeletonAnimator; public int h; public List pairs = new List(); public float timer = 0f; public GameObject model; private bool twopart = false; public static Dictionary animClips = new Dictionary(); public CustomAnimationClip currentClip = null; public string currentClipName = "none"; public string prevClipName = "none"; public CustomAnimationClip prevClip = null; internal static float Current_MSX = 69f; internal static List allMappers = new List(); internal static List allWorldProps = new List(); public bool local = false; internal static bool moving = false; internal static bool attacking = false; public bool jank = false; public List props = new List(); public float scale = 1f; internal int desiredEvent = 0; public int currEvent = 0; public float autoWalkSpeed = 0f; public bool overrideMoveSpeed = false; public bool autoWalk = false; public GameObject currentEmoteSpot = null; public GameObject reservedEmoteSpot = null; public bool worldProp = false; public bool ragdolling = false; public GameObject bodyPrefab; public int uniqueSpot = -1; public bool preserveProps = false; public bool preserveParent = false; internal bool useSafePositionReset = false; public List emoteLocations = new List(); private List dontAnimateUs = new List(); public bool enableAnimatorOnDeath = true; public bool revertTransform = false; public bool oneFrameAnimatorLeeWay = false; public GameObject mapperBody; public PlayerControllerB playerController; public EnemyAI enemyController; public Transform mapperBodyTransform; public static bool firstMapperSpawn = true; public static List> listOfCurrentEmoteAudio = new List>(); public List cameraConstraints = new List(); public List itemHolderConstraints = new List(); public Transform itemHolderPosition; public List additionalConstraints = new List(); public EmoteConstraint thirdPersonConstraint; public static Dictionary customNamePairs = new Dictionary(); public Vector3 positionBeforeRootMotion = new Vector3(69f, 69f, 69f); public Quaternion rotationBeforeRootMotion = Quaternion.identity; public float currentAudioLevel = 0f; public TempThirdPerson temporarilyThirdPerson = TempThirdPerson.none; internal int originalCullingMask; internal bool needToTurnOffRenderingThing = false; public BoneMapper currentlyLockedBoneMapper; public static Dictionary playersToMappers = new Dictionary(); public AudioSource personalAudioSource; public InteractTrigger personalTrigger; public string currentJoinButton; public bool isServer = false; public int networkId; public bool joined = false; public bool canThirdPerson = true; internal bool canEmote = false; public bool isValidPlayer = false; internal bool canStop = true; internal List cosmeticConstraints = new List(); internal GameObject originalCosmeticPosition; public GameObject parentGameObject; public bool positionLock; public bool rotationLock; public bool scaleLock; private Vector3 ogScale = new Vector3(-69f, -69f, -69f); private Vector3 scaleDiff = Vector3.one; public GameObject rotationPoint; public GameObject desiredCameraPos; public GameObject realCameraPos; private bool ranSinceLastAnim = false; public Vector3 deltaPos = new Vector3(0f, 0f, 0f); public Quaternion deltaRot = Quaternion.identity; public Vector3 prevPosition = Vector3.zero; public Quaternion prevRotation = Quaternion.identity; public Vector3 prevMapperPos = new Vector3(69f, 69f, 69f); public Vector3 prevMapperRot = default(Vector3); public bool justSwitched = false; public bool isEnemy = false; public bool isInThirdPerson = false; public int originalLayer = -1; internal bool needToTurnOffShadows = true; internal bool needToTurnOffCosmetics = true; public static string GetRealAnimationName(string animationName) { if (customNamePairs.ContainsKey(animationName)) { return customNamePairs[animationName]; } return animationName; } private IEnumerator lockBonesAfterAFrame() { yield return (object)new WaitForEndOfFrame(); LockBones(); } public void PlayAnim(string s, int pos, int eventNum) { desiredEvent = eventNum; s = GetRealAnimationName(s); PlayAnim(s, pos); } public void PlayAnim(string s, int pos) { //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Expected O, but got Unknown ranSinceLastAnim = false; s = GetRealAnimationName(s); prevClipName = currentClipName; if (s != "none") { if (!animClips.ContainsKey(s)) { DebugClass.Log("No emote bound to the name [" + s + "]"); return; } if (animClips[s] == null || !animClips[s].animates) { CustomEmotesAPI.Changed(s, this); return; } } ((Behaviour)emoteSkeletonAnimator).enabled = true; dontAnimateUs.Clear(); try { ((object)currentClip.clip[0]).ToString(); try { if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio) { CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--; } audioObject.GetComponent().Stop(); } catch (Exception arg) { DebugClass.Log($"had issue turning off audio before new audio played step 1: {arg}"); } try { if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null && currentClip.syncronizeAudio) { try { listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent()); } catch (Exception arg2) { DebugClass.Log($"had issue turning off audio before new audio played step 2: {arg2}"); try { DebugClass.Log($"{prevClip.syncPos}"); DebugClass.Log($"{currentClip.syncPos}"); DebugClass.Log(listOfCurrentEmoteAudio[currentClip.syncPos]); } catch (Exception) { } try { DebugClass.Log("going to try a brute force method to avoid audio desync issues"); foreach (List item in listOfCurrentEmoteAudio) { if (item.Contains(audioObject.GetComponent())) { item.Remove(audioObject.GetComponent()); } } } catch (Exception arg3) { DebugClass.Log($"wow {arg3}"); } } } } catch (Exception ex2) { DebugClass.Log($"had issue turning off audio before new audio played step 3: {primaryAudioClips[currentClip.syncPos]} {currentClip.syncPos} {currEvent} {ex2}"); } try { if (uniqueSpot != -1 && CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot]) { CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = false; uniqueSpot = -1; } } catch (Exception arg4) { DebugClass.Log($"had issue turning off audio before new audio played step 4: {arg4}"); } } catch (Exception) { } currEvent = 0; currentClipName = s; if (s == "none") { emoteSkeletonAnimator.Play("none", -1, 0f); twopart = false; prevClip = currentClip; currentClip = null; NewAnimation(null); CustomEmotesAPI.Changed(s, this); } else { if (BlacklistSettings.emotesDisabled.Contains(s)) { return; } if (s != "none") { prevClip = currentClip; currentClip = animClips[s]; try { ((object)currentClip.clip[0]).ToString(); } catch (Exception) { return; } if (pos == -2) { pos = ((CustomAnimationClip.syncPlayerCount[animClips[s].syncPos] != 0) ? animClips[s].joinPref : animClips[s].startPref); } if (pos == -2) { for (int i = 0; i < CustomAnimationClip.uniqueAnimations[currentClip.syncPos].Count; i++) { if (!CustomAnimationClip.uniqueAnimations[currentClip.syncPos][i]) { pos = i; uniqueSpot = pos; CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = true; break; } } if (uniqueSpot == -1) { pos = -1; } } if (pos == -1) { pos = Random.Range(0, currentClip.clip.Length); } ((MonoBehaviour)this).StartCoroutine(lockBonesAfterAFrame()); } AnimatorOverrideController animController = new AnimatorOverrideController(emoteSkeletonAnimator.runtimeAnimatorController); if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio) { CustomAnimationClip.syncPlayerCount[currentClip.syncPos]++; if (CustomAnimationClip.syncPlayerCount[currentClip.syncPos] == 1) { CustomAnimationClip.syncTimer[currentClip.syncPos] = 0f; } } if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null) { if (CustomAnimationClip.syncPlayerCount[currentClip.syncPos] == 1 && currentClip.syncronizeAudio) { if (desiredEvent != -1) { currEvent = desiredEvent; } else { currEvent = Random.Range(0, primaryAudioClips[currentClip.syncPos].Length); } foreach (BoneMapper allMapper in allMappers) { allMapper.currEvent = currEvent; } if (currentClip.customPostEventCodeSync != null) { currentClip.customPostEventCodeSync(this); } } else if (!currentClip.syncronizeAudio) { currEvent = Random.Range(0, primaryAudioClips[currentClip.syncPos].Length); if (currentClip.customPostEventCodeNoSync != null) { currentClip.customPostEventCodeNoSync(this); } } currentAudioLevel = currentClip.audioLevel; audioObject.GetComponent().Play(currentClip.syncPos, currEvent, currentClip.looping, currentClip.syncronizeAudio, currentClip.willGetClaimed); if (currentClip.syncronizeAudio && (Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null) { listOfCurrentEmoteAudio[currentClip.syncPos].Add(audioObject.GetComponent()); } } SetAnimationSpeed(1f); StartAnimations(animController, pos, emoteSkeletonAnimator); if (local && CustomEmotesAPI.hudObject != null) { if (currentClip.displayName != "") { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClip.displayName; } else if (currentClip.customInternalName != "") { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClip.customInternalName; } else if (!currentClip.visibility) { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = ""; } else { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClipName; } } twopart = false; NewAnimation(currentClip.joinSpots); if (currentClip.usesNewImportSystem) { CustomEmotesAPI.Changed(currentClip.customInternalName, this); } else { CustomEmotesAPI.Changed(s, this); } } } public void StartAnimations(AnimatorOverrideController animController, int pos, Animator animator) { if (currentClip.secondaryClip != null && currentClip.secondaryClip.Length != 0) { bool flag = true; if (CustomAnimationClip.syncTimer[currentClip.syncPos] > currentClip.clip[pos].length) { animController["Floss"] = currentClip.secondaryClip[pos]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController; animator.Play("Loop", -1, (CustomAnimationClip.syncTimer[currentClip.syncPos] - currentClip.clip[pos].length) % currentClip.secondaryClip[pos].length / currentClip.secondaryClip[pos].length); } else { animController["Dab"] = currentClip.clip[pos]; animController["nobones"] = currentClip.secondaryClip[pos]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController; animator.Play("PoopToLoop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length); } } else if (((Motion)currentClip.clip[0]).isLooping) { animController["Floss"] = currentClip.clip[pos]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController; if (currentClip.clip[pos].length != 0f) { animator.Play("Loop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length); } else { animator.Play("Loop", -1, 0f); } } else { animController["Default Dance"] = currentClip.clip[pos]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController; animator.Play("Poop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length); } } public static void PreviewAnimations(Animator animator, string animation) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown AnimatorOverrideController val = new AnimatorOverrideController(animator.runtimeAnimatorController); animation = GetRealAnimationName(animation); if (!animClips.ContainsKey(animation)) { return; } CustomAnimationClip customAnimationClip = animClips[animation]; if (customAnimationClip != null && customAnimationClip.clip != null && customAnimationClip.clip[0] != null) { int num = 0; if (customAnimationClip.secondaryClip != null && customAnimationClip.secondaryClip.Length != 0) { val["Dab"] = customAnimationClip.clip[num]; val["nobones"] = customAnimationClip.secondaryClip[num]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val; animator.Play("PoopToLoop", -1, 0f); } else if (((Motion)customAnimationClip.clip[0]).isLooping) { val["Floss"] = customAnimationClip.clip[num]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val; animator.Play("Loop", -1, 0f); } else { val["Default Dance"] = customAnimationClip.clip[num]; animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val; animator.Play("Poop", -1, 0f); } } } public void SetAnimationSpeed(float speed) { emoteSkeletonAnimator.speed = speed; } internal void NewAnimation(JoinSpot[] locations) { //IL_00e4: 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_00ff: 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_0130: 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_0150: Unknown result type (might be due to invalid IL or missing references) try { try { if (local) { ((Component)itemHolderPosition).gameObject.GetComponent().DeactivateConstraints(); } } catch (Exception) { } try { emoteLocations.Clear(); autoWalkSpeed = 0f; autoWalk = false; overrideMoveSpeed = false; if (Object.op_Implicit((Object)(object)parentGameObject) && !preserveParent) { parentGameObject = null; } } catch (Exception) { } try { useSafePositionReset = currentClip.useSafePositionReset; } catch (Exception) { useSafePositionReset = true; } try { if (preserveParent) { preserveParent = false; } else { mapperBody.gameObject.transform.localEulerAngles = new Vector3(0f, mapperBody.gameObject.transform.localEulerAngles.y, 0f); if (ogScale != new Vector3(-69f, -69f, -69f)) { mapperBody.transform.localScale = ogScale; ogScale = new Vector3(-69f, -69f, -69f); } Collider[] componentsInChildren = mapperBody.GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { val.enabled = true; } if (Object.op_Implicit((Object)(object)mapperBody.GetComponent())) { ((Collider)mapperBody.GetComponent()).enabled = true; } } } catch (Exception) { } if (preserveProps) { preserveProps = false; } else { foreach (GameObject prop in props) { if (Object.op_Implicit((Object)(object)prop)) { Object.Destroy((Object)(object)prop); } } props.Clear(); } if (locations != null) { for (int j = 0; j < locations.Length; j++) { SpawnJoinSpot(locations[j]); } } } catch (Exception arg) { DebugClass.Log($"error during new animation: {arg}"); } } public void ScaleProps() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) foreach (GameObject prop in props) { if (Object.op_Implicit((Object)(object)prop)) { Transform parent = prop.transform.parent; prop.transform.SetParent((Transform)null); prop.transform.localScale = new Vector3(scale * 1.15f, scale * 1.15f, scale * 1.15f); prop.transform.SetParent(parent); } } } public void UpdateHoverTip(string emoteName) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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 (personalTrigger != null) { InputBinding val = EmotesInputSettings.Instance.JoinEmote.bindings[0]; currentJoinButton = InputControlPath.ToHumanReadableString(((InputBinding)(ref val)).effectivePath, (HumanReadableStringOptions)2, (InputControl)null); personalTrigger.hoverTip = "Press [" + currentJoinButton + "] to join " + emoteName; } } internal IEnumerator preventEmotesInSpawnAnimation() { yield return (object)new WaitForSeconds(3f); foreach (EmoteConstraint item in cosmeticConstraints) { item.ActivateConstraints(); } canEmote = true; } private void Start() { //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Expected O, but got Unknown //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) if (worldProp) { return; } if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform).GetComponentInParent())) { mapperBody = ((Component)((Component)((Component)this).transform).GetComponentInParent()).gameObject; networkId = (int)((NetworkBehaviour)mapperBody.GetComponent()).NetworkObjectId; } else if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform).GetComponentInParent())) { mapperBody = ((Component)((Component)((Component)this).transform).GetComponentInParent()).gameObject; networkId = -1; isEnemy = CustomEmotesAPI.localMapper.isServer; } else { networkId = -1; mapperBody = ((Component)this).gameObject; } playerController = mapperBody.GetComponent(); if (playerController == null) { enemyController = mapperBody.GetComponent(); } isValidPlayer = playerController != null; playersToMappers.Add(mapperBody, this); mapperBodyTransform = mapperBody.transform; allMappers.Add(this); if (!isEnemy) { GameObject gameObject = ((Component)mapperBody.gameObject.transform.Find("PlayerPhysicsBox")).gameObject; gameObject.tag = "InteractTrigger"; personalTrigger = gameObject.AddComponent(); personalTrigger.interactable = false; personalTrigger.hoverIcon = Object.Instantiate(Assets.Load("assets/fineilldoitmyself/nothing.png")); personalTrigger.disabledHoverIcon = Object.Instantiate(Assets.Load("assets/fineilldoitmyself/nothing.png")); personalTrigger.disabledHoverTip = ""; UpdateHoverTip("none"); } GameObject val = Object.Instantiate(Assets.Load("assets/source1.prefab")); ((Object)val).name = ((Object)this).name + "_AudioObject"; val.transform.SetParent(mapperBody.transform); val.transform.localPosition = Vector3.zero; val.AddComponent().radius = 0.01f; val.layer = 6; personalAudioSource = val.GetComponent(); val.AddComponent().Setup(personalAudioSource, this); personalAudioSource.playOnAwake = false; personalAudioSource.volume = Settings.EmotesVolume.Value / 100f; audioObject = val; int num = 0; if (true) { SkinnedMeshRenderer[] array = basePlayerModelSMR; foreach (SkinnedMeshRenderer val2 in array) { int num2 = 0; for (int j = 0; j < emoteSkeletonSMR.bones.Length; j++) { for (int k = num2; k < val2.bones.Length; k++) { if (((Object)emoteSkeletonSMR.bones[j]).name == ((Object)val2.bones[k]).name && !Object.op_Implicit((Object)(object)((Component)val2.bones[k]).gameObject.GetComponent())) { num2 = k; EmoteConstraint emoteConstraint = ((Component)val2.bones[k]).gameObject.AddComponent(); emoteConstraint.AddSource(ref val2.bones[k], ref emoteSkeletonSMR.bones[j]); emoteConstraint.revertTransform = revertTransform; break; } if (k == num2 - 1) { break; } if (num2 > 0 && k == val2.bones.Length - 1) { k = -1; } } } } } if (jank) { SkinnedMeshRenderer[] array2 = basePlayerModelSMR; foreach (SkinnedMeshRenderer val3 in array2) { for (int m = 0; m < val3.bones.Length; m++) { try { if (Object.op_Implicit((Object)(object)((Component)val3.bones[m]).gameObject.GetComponent())) { ((Component)val3.bones[m]).gameObject.GetComponent().ActivateConstraints(); } } catch (Exception arg) { DebugClass.Log($"{arg}"); } } } } ((Component)this).transform.localPosition = Vector3.zero; CustomEmotesAPI.MapperCreated(this); if (playerController != null) { ((MonoBehaviour)this).StartCoroutine(SetupHandConstraint()); } ((MonoBehaviour)this).StartCoroutine(preventEmotesInSpawnAnimation()); ((MonoBehaviour)this).StartCoroutine(GetLocal()); GameObject val4 = new GameObject(); ((Object)val4).name = "BoneMapperHolder"; val4.transform.SetParent(mapperBody.transform); val4.transform.localEulerAngles = ((Component)this).transform.localEulerAngles; val4.transform.position = ((Component)this).transform.position; ((Component)this).transform.SetParent(val4.transform); val4.transform.localPosition = Vector3.zero; } public IEnumerator SetupHandConstraint() { while (!Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper)) { yield return (object)new WaitForEndOfFrame(); } itemHolderPosition = ((Component)this).GetComponentInChildren().GetBoneTransform((HumanBodyBones)18).Find("ServerItemHolder"); itemHolderConstraints.Add(EmoteConstraint.AddConstraint(((Component)playerController.serverItemHolder).gameObject, this, itemHolderPosition, needToFix: true)); itemHolderConstraints.Add(EmoteConstraint.AddConstraint(((Component)playerController.localItemHolder).gameObject, this, itemHolderPosition, needToFix: true)); ((Component)itemHolderPosition).gameObject.AddComponent(); } public void AssignParentGameObject(GameObject youAreTheFather, bool lockPosition, bool lockRotation, bool lockScale, bool scaleAsScavenger = true, bool disableCollider = true) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) if (Object.op_Implicit((Object)(object)parentGameObject)) { NewAnimation(null); } ogScale = mapperBody.transform.localScale; if (scaleAsScavenger) { scaleDiff = ogScale / scale; } else { scaleDiff = ogScale; } parentGameObject = youAreTheFather; positionLock = lockPosition; rotationLock = lockRotation; scaleLock = lockScale; Collider[] componentsInChildren = mapperBody.GetComponentsInChildren(); foreach (Collider val in componentsInChildren) { val.enabled = !disableCollider; } if (Object.op_Implicit((Object)(object)mapperBody.GetComponent())) { ((Collider)mapperBody.GetComponent()).enabled = !disableCollider; } if (disableCollider && Object.op_Implicit((Object)(object)currentEmoteSpot)) { if (currentEmoteSpot.GetComponent().validPlayers != 0) { currentEmoteSpot.GetComponent().validPlayers--; } currentEmoteSpot.GetComponent().SetColor(); currentEmoteSpot = null; } } private void LocalFunctions() { if (!((Behaviour)emoteSkeletonAnimator).enabled) { return; } try { if (moving && currentClip.stopOnMove) { CustomEmotesAPI.PlayAnimation("none"); } } catch (Exception) { } } private IEnumerator GetLocal() { yield return (object)new WaitForEndOfFrame(); try { if (!Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper) && (Object)(object)playerController == (Object)(object)StartOfRound.Instance.localPlayerController) { CustomEmotesAPI.localMapper = this; local = true; originalCosmeticPosition = new GameObject(); originalCosmeticPosition.transform.parent = playerController.headCostumeContainerLocal.parent; originalCosmeticPosition.transform.position = playerController.headCostumeContainerLocal.position; originalCosmeticPosition.transform.localEulerAngles = playerController.headCostumeContainerLocal.localEulerAngles; EmoteConstraint e2 = ((Component)playerController.headCostumeContainerLocal).gameObject.AddComponent(); e2.AddSource(playerController.headCostumeContainerLocal, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10)); cosmeticConstraints.Add(e2); ((Component)this).gameObject.AddComponent().self = this; isServer = ((NetworkBehaviour)playerController).IsServer && ((NetworkBehaviour)playerController).IsOwner; HealthbarAnimator.Setup(this); FixLocalArms(); Camera c = playerController.gameplayCamera; if (c != null) { rotationPoint = new GameObject(); rotationPoint.transform.SetParent(((Component)c).transform.parent.parent.parent.parent); rotationPoint.transform.localPosition = new Vector3(0f, 0.8f, 0f); rotationPoint.transform.localEulerAngles = Vector3.zero; desiredCameraPos = new GameObject(); desiredCameraPos.transform.SetParent(rotationPoint.transform); desiredCameraPos.transform.localPosition = new Vector3(0.3f, 1f, -3f); desiredCameraPos.transform.localEulerAngles = Vector3.zero; realCameraPos = new GameObject(); realCameraPos.transform.SetParent(desiredCameraPos.transform); realCameraPos.transform.localPosition = Vector3.zero; realCameraPos.transform.localEulerAngles = Vector3.zero; thirdPersonConstraint = EmoteConstraint.AddConstraint(((Component)((Component)c).transform.parent).gameObject, this, realCameraPos.transform, needToFix: false); thirdPersonConstraint.debug = true; if (((Object)basePlayerModelSMR[0].bones[32]).name == "spine.004") { GameObject camHolder = new GameObject(); ((Object)camHolder).name = "EmotesAPICameraHolderThing"; camHolder.transform.parent = basePlayerModelSMR[0].bones[32]; camHolder.transform.localEulerAngles = Vector3.zero; camHolder.transform.position = ((Component)c).transform.parent.position; Transform transform = camHolder.transform; transform.localPosition += new Vector3(0f, 0.045f, 0f); cameraConstraints.Add(EmoteConstraint.AddConstraint(((Component)((Component)c).transform.parent).gameObject, this, camHolder.transform, needToFix: false)); } else { cameraConstraints.Add(EmoteConstraint.AddConstraint(((Component)((Component)c).transform.parent).gameObject, this, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10), needToFix: false)); } GameObject cameraRotationObjectLmao = new GameObject(); cameraRotationObjectLmao.transform.SetParent(((Component)c).transform); cameraRotationObjectLmao.transform.localPosition = new Vector3(0.01f, -0.048f, -0.053f); cameraRotationObjectLmao.transform.localEulerAngles = new Vector3(270f, 0f, 0f); cameraConstraints.Add(EmoteConstraint.AddConstraint(((Component)StartOfRound.Instance.localPlayerController.localVisor).gameObject, this, cameraRotationObjectLmao.transform, needToFix: false)); } } } catch (Exception e) { DebugClass.Log(e); } if (!Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper)) { ((MonoBehaviour)this).StartCoroutine(GetLocal()); } } internal void FixLocalArms() { int i = 0; for (int j = 0; j < basePlayerModelSMR[1].bones.Length; j++) { EmoteConstraint component = ((Component)basePlayerModelSMR[1].bones[j]).GetComponent(); if (component == null) { continue; } int num = i; for (; i < basePlayerModelSMR[0].bones.Length; i++) { if (((Object)basePlayerModelSMR[1].bones[j]).name == ((Object)basePlayerModelSMR[0].bones[i]).name) { component.AddSource(basePlayerModelSMR[1].bones[j], basePlayerModelSMR[0].bones[i]); component.forceGlobalTransforms = true; break; } if (i == num - 1) { break; } if (num > 0 && i == basePlayerModelSMR[0].bones.Length - 1) { i = -1; } } } } private void TwoPartThing() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (ranSinceLastAnim) { return; } AnimatorStateInfo currentAnimatorStateInfo = emoteSkeletonAnimator.GetCurrentAnimatorStateInfo(0); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("none")) { if (twopart) { ranSinceLastAnim = true; if (((Behaviour)emoteSkeletonAnimator).enabled && !jank) { UnlockBones(); } if (!ragdolling) { ((Behaviour)basePlayerModelAnimator).enabled = true; oneFrameAnimatorLeeWay = true; } ((Behaviour)emoteSkeletonAnimator).enabled = false; try { currentClip.clip.ToString(); CustomEmotesAPI.Changed("none", this); NewAnimation(null); if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio) { CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--; } if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null) { audioObject.GetComponent().Stop(); if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null && currentClip.syncronizeAudio) { listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent()); } } prevClip = currentClip; currentClip = null; return; } catch (Exception) { return; } } twopart = true; } else { twopart = false; } } private void Health() { if (!isValidPlayer || !playerController.isPlayerDead || !local || currentClip == null) { return; } UnlockBones(); CustomEmotesAPI.PlayAnimation("none"); foreach (GameObject prop in props) { if (Object.op_Implicit((Object)(object)prop)) { Object.Destroy((Object)(object)prop); } } props.Clear(); } private void WorldPropAndParent() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)parentGameObject)) { return; } if (positionLock) { mapperBody.gameObject.transform.position = parentGameObject.transform.position + new Vector3(0f, 1f, 0f); mapperBody.transform.position = parentGameObject.transform.position; PlayerControllerB obj = playerController; if (obj != null) { obj.ResetFallGravity(); } } if (rotationLock) { mapperBody.transform.rotation = parentGameObject.transform.rotation; } if (scaleLock) { mapperBody.transform.localScale = new Vector3(parentGameObject.transform.localScale.x * scaleDiff.x, parentGameObject.transform.localScale.y * scaleDiff.y, parentGameObject.transform.localScale.z * scaleDiff.z); } } private void Update() { if (!worldProp) { WorldPropAndParent(); if (local) { LocalFunctions(); } TwoPartThing(); Health(); SetDeltaPosition(); RootMotion(); CameraControls(); } } internal bool ThirdPersonCheck() { return !CustomEmotesAPI.LCThirdPersonPresent && currentClip != null && (((currentClip.thirdPerson || Settings.thirdPersonType.Value == ThirdPersonType.All) && Settings.thirdPersonType.Value != ThirdPersonType.None) || temporarilyThirdPerson == TempThirdPerson.on) && canThirdPerson && temporarilyThirdPerson != TempThirdPerson.off; } public void CameraControls() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_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_0110: Unknown result type (might be due to invalid IL or missing references) if (local && isInThirdPerson) { Vector3 val = mapperBodyTransform.position + new Vector3(0f, 1.75f * scale, 0f); Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(val, desiredCameraPos.transform.position - val); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, ref val3, 10f, 268437761, (QueryTriggerInteraction)1)) { realCameraPos.transform.position = ((Ray)(ref val2)).GetPoint(((RaycastHit)(ref val3)).distance - 0.25f); } else { realCameraPos.transform.position = ((Ray)(ref val2)).GetPoint(10f); } if (Vector3.Distance(realCameraPos.transform.position, val) > Vector3.Distance(desiredCameraPos.transform.position, val)) { realCameraPos.transform.position = desiredCameraPos.transform.position; } } } private void SetDeltaPosition() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) deltaPos = ((Component)this).transform.position - prevPosition; deltaRot = ((Component)this).transform.rotation * Quaternion.Inverse(prevRotation); prevPosition = ((Component)this).transform.position; prevRotation = ((Component)this).transform.rotation; } public void RootMotion() { //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00dc: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) try { if (!((Behaviour)emoteSkeletonAnimator).enabled) { return; } if (justSwitched) { justSwitched = false; } else { if (currentClip.lockType != AnimationClipParams.LockType.rootMotion) { return; } if (local || isEnemy) { if (Settings.rootMotionType.Value != RootMotionType.None || isEnemy) { Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; mapperBody.transform.position = new Vector3(emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)7).position.x, mapperBody.transform.position.y, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)7).position.z); if (isEnemy || !isInThirdPerson) { mapperBody.transform.eulerAngles = new Vector3(mapperBody.transform.eulerAngles.x, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).eulerAngles.y, mapperBody.transform.eulerAngles.z); } ((Component)this).transform.position = position; ((Component)this).transform.rotation = rotation; if (positionBeforeRootMotion != new Vector3(69f, 69f, 69f)) { mapperBody.transform.position = positionBeforeRootMotion; mapperBody.transform.rotation = rotationBeforeRootMotion; positionBeforeRootMotion = new Vector3(69f, 69f, 69f); } } if (deltaPos != Vector3.zero || deltaRot != Quaternion.identity) { if (isEnemy) { EmoteNetworker.instance.SyncBoneMapperPos(((NetworkBehaviour)enemyController).NetworkObjectId, ((Component)this).transform.position, ((Component)this).transform.eulerAngles); } else { EmoteNetworker.instance.SyncBoneMapperPos(((NetworkBehaviour)playerController).NetworkObjectId, ((Component)this).transform.position, ((Component)this).transform.eulerAngles); } } } else { ((Component)this).transform.position = prevMapperPos; ((Component)this).transform.eulerAngles = prevMapperRot; } } } catch (Exception) { } } public int SpawnJoinSpot(JoinSpot joinSpot) { props.Add(Object.Instantiate(Assets.Load("@CustomEmotesAPI_customemotespackage:assets/emotejoiner/JoinVisual.prefab"))); props[props.Count - 1].transform.SetParent(((Component)this).transform); ((Object)props[props.Count - 1]).name = joinSpot.name; EmoteLocation emoteLocation = props[props.Count - 1].AddComponent(); emoteLocation.joinSpot = joinSpot; emoteLocation.owner = this; emoteLocations.Add(emoteLocation); return props.Count - 1; } public void JoinEmoteSpot() { if (Object.op_Implicit((Object)(object)reservedEmoteSpot)) { if (Object.op_Implicit((Object)(object)currentEmoteSpot)) { if (currentEmoteSpot.GetComponent().validPlayers != 0) { currentEmoteSpot.GetComponent().validPlayers--; } currentEmoteSpot.GetComponent().SetColor(); } currentEmoteSpot = reservedEmoteSpot; reservedEmoteSpot = null; } int i; for (i = 0; i < ((Component)currentEmoteSpot.transform.parent).GetComponentsInChildren().Length && !((Object)(object)((Component)currentEmoteSpot.transform.parent).GetComponentsInChildren()[i] == (Object)(object)currentEmoteSpot.GetComponent()); i++) { } EmoteNetworker.instance.SyncJoinSpot(mapperBody.GetComponent().NetworkObjectId, currentEmoteSpot.GetComponentInParent().NetworkObjectId, currentEmoteSpot.GetComponent().owner.worldProp, i); } public void RemoveProp(int propPos) { Object.Destroy((Object)(object)props[propPos]); } public void SetAutoWalk(float speed, bool overrideBaseMovement, bool autoWalk) { autoWalkSpeed = speed; overrideMoveSpeed = overrideBaseMovement; this.autoWalk = autoWalk; } public void SetAutoWalk(float speed, bool overrideBaseMovement) { autoWalkSpeed = speed; overrideMoveSpeed = overrideBaseMovement; autoWalk = true; } internal IEnumerator waitForTwoFramesThenDisableA1() { yield return (object)new WaitForEndOfFrame(); } private void OnDestroy() { if (playerController == null) { return; } playersToMappers.Remove(((Component)playerController).gameObject); if (worldProp) { return; } playersToMappers.Remove(mapperBody); try { ((object)currentClip.clip[0]).ToString(); NewAnimation(null); if ((currentClip.syncronizeAnimation || currentClip.syncronizeAudio) && CustomAnimationClip.syncPlayerCount[currentClip.syncPos] > 0) { CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--; } if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null) { audioObject.GetComponent().Stop(); if (currentClip.syncronizeAudio) { listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent()); } } if (uniqueSpot != -1 && CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot]) { CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = false; uniqueSpot = -1; } allMappers.Remove(this); prevClip = currentClip; currentClip = null; } catch (Exception) { allMappers.Remove(this); } } public void UnlockBones(bool animatorEnabled = true) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localPosition = Vector3.zero; ((Component)this).transform.eulerAngles = bodyPrefab.transform.eulerAngles; SkinnedMeshRenderer[] array = basePlayerModelSMR; foreach (SkinnedMeshRenderer val in array) { for (int j = 0; j < val.bones.Length; j++) { try { if (Object.op_Implicit((Object)(object)((Component)val.bones[j]).gameObject.GetComponent())) { ((Component)val.bones[j]).gameObject.GetComponent().DeactivateConstraints(); } } catch (Exception) { break; } } } foreach (EmoteConstraint cameraConstraint in cameraConstraints) { cameraConstraint.DeactivateConstraints(); } foreach (EmoteConstraint itemHolderConstraint in itemHolderConstraints) { itemHolderConstraint.DeactivateConstraints(); } foreach (EmoteConstraint additionalConstraint in additionalConstraints) { additionalConstraint.DeactivateConstraints(); } if (thirdPersonConstraint != null) { thirdPersonConstraint.DeactivateConstraints(); } DeThirdPerson(); } public void LockBones() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) UnlockBones(); ((Component)this).transform.localPosition = Vector3.zero; if (currentClip != null) { foreach (HumanBodyBones soloIgnoredBone in currentClip.soloIgnoredBones) { if (Object.op_Implicit((Object)(object)emoteSkeletonAnimator.GetBoneTransform(soloIgnoredBone))) { dontAnimateUs.Add(((Object)emoteSkeletonAnimator.GetBoneTransform(soloIgnoredBone)).name); } } foreach (HumanBodyBones rootIgnoredBone in currentClip.rootIgnoredBones) { if (Object.op_Implicit((Object)(object)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone))) { dontAnimateUs.Add(((Object)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone)).name); } Transform[] componentsInChildren = ((Component)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone)).GetComponentsInChildren(); foreach (Transform val in componentsInChildren) { dontAnimateUs.Add(((Object)val).name); } } } if (!jank) { ((Renderer)emoteSkeletonSMR).enabled = true; SkinnedMeshRenderer[] array = basePlayerModelSMR; foreach (SkinnedMeshRenderer val2 in array) { for (int k = 0; k < val2.bones.Length; k++) { try { if (Object.op_Implicit((Object)(object)((Component)val2.bones[k]).gameObject.GetComponent()) && !dontAnimateUs.Contains(((Object)val2.bones[k]).name)) { EmoteConstraint component = ((Component)val2.bones[k]).gameObject.GetComponent(); component.ActivateConstraints(); if ((Object)(object)val2 == (Object)(object)basePlayerModelSMR.First() && currentClip != null) { component.SetLocalTransforms(currentClip.localTransforms); } } else if (dontAnimateUs.Contains(((Object)val2.bones[k]).name)) { ((Component)val2.bones[k]).gameObject.GetComponent().DeactivateConstraints(); } } catch (Exception arg) { DebugClass.Log($"{arg}"); } } } foreach (EmoteConstraint itemHolderConstraint in itemHolderConstraints) { itemHolderConstraint.ActivateConstraints(); } foreach (EmoteConstraint additionalConstraint in additionalConstraints) { additionalConstraint.ActivateConstraints(); } LockCameraStuff(local && ThirdPersonCheck()); } else { ((MonoBehaviour)this).StartCoroutine(waitForTwoFramesThenDisableA1()); } } public void LockCameraStuff(bool thirdPersonLock) { if (thirdPersonLock) { TurnOnThirdPerson(); } else { if (currentClip == null) { return; } if (Settings.rootMotionType.Value != RootMotionType.None && (currentClip.lockType == AnimationClipParams.LockType.rootMotion || Settings.rootMotionType.Value == RootMotionType.All || currentClip.lockType == AnimationClipParams.LockType.lockHead)) { foreach (EmoteConstraint cameraConstraint in cameraConstraints) { cameraConstraint.ActivateConstraints(); } return; } if (currentClip.lockType != AnimationClipParams.LockType.headBobbing || Settings.rootMotionType.Value == RootMotionType.None) { return; } foreach (EmoteConstraint cameraConstraint2 in cameraConstraints) { cameraConstraint2.ActivateConstraints(); if ((Object)(object)cameraConstraint2 != (Object)(object)cameraConstraints[cameraConstraints.Count - 1]) { cameraConstraint2.onlyY = true; } } } } public void UnlockCameraStuff() { foreach (EmoteConstraint cameraConstraint in cameraConstraints) { cameraConstraint.DeactivateConstraints(); } thirdPersonConstraint.DeactivateConstraints(); DeThirdPerson(); } public void TurnOnThirdPerson() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 ((Component)playerController.localVisor).gameObject.SetActive(false); if ((int)((Renderer)playerController.thisPlayerModel).shadowCastingMode == 1) { needToTurnOffShadows = false; } ((Renderer)playerController.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1; if (originalLayer == -1) { originalLayer = ((Component)playerController.thisPlayerModel).gameObject.layer; originalCullingMask = playerController.gameplayCamera.cullingMask; } ((Component)playerController.thisPlayerModel).gameObject.layer = 1; playerController.grabDistance = 5.65f; playerController.gameplayCamera.cullingMask = StartOfRound.Instance.spectateCamera.cullingMask; thirdPersonConstraint.ActivateConstraints(); isInThirdPerson = true; foreach (EmoteConstraint cosmeticConstraint in cosmeticConstraints) { cosmeticConstraint.emoteBone = playerController.playerGlobalHead; } if (CustomEmotesAPI.MoreCompanyPresent) { try { needToTurnOffCosmetics = true; MoreCompanyCompat.TurnOnCosmetics(this); } catch (Exception arg) { DebugClass.Log($"couldn't turn on cosmetics: {arg}"); } } if (CustomEmotesAPI.BetterEmotesPresent) { Transform val = ((Component)playerController).transform.Find("ScavengerModel/LEGS"); if (val != null) { ((Component)val).gameObject.layer = 31; } } } public void DeThirdPerson() { if (!isInThirdPerson) { return; } playerController.gameplayCamera.cullingMask = originalCullingMask; if (needToTurnOffShadows) { ((Renderer)playerController.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)3; } needToTurnOffShadows = true; ((Component)playerController.localVisor).gameObject.SetActive(true); ((Component)playerController.thisPlayerModel).gameObject.layer = originalLayer; playerController.grabDistance = 3f; isInThirdPerson = false; foreach (EmoteConstraint cosmeticConstraint in cosmeticConstraints) { cosmeticConstraint.emoteBone = originalCosmeticPosition.transform; } if (CustomEmotesAPI.MoreCompanyPresent && needToTurnOffCosmetics) { try { MoreCompanyCompat.TurnOffCosmetics(this); } catch (Exception arg) { DebugClass.Log($"couldn't clear cosmetics: {arg}"); } } if (CustomEmotesAPI.BetterEmotesPresent) { Transform val = ((Component)playerController).transform.Find("ScavengerModel/LEGS"); if (val != null) { ((Component)val).gameObject.layer = 0; } } } public void AttachItemHolderToTransform(Transform target) { ((Component)itemHolderPosition).gameObject.GetComponent().AddSource(itemHolderPosition, target); ((Component)itemHolderPosition).gameObject.GetComponent().ActivateConstraints(); } } public class CustomAnimationClip : MonoBehaviour { public AnimationClip[] clip; public AnimationClip[] secondaryClip; public bool looping; public string wwiseEvent; public bool syncronizeAudio; public List soloIgnoredBones; public List rootIgnoredBones; public bool dimAudioWhenClose; public bool stopOnAttack; public bool stopOnMove; public bool visibility; public int startPref; public int joinPref; public JoinSpot[] joinSpots; public bool useSafePositionReset; public string customInternalName; public Action customPostEventCodeSync; public Action customPostEventCodeNoSync; public bool syncronizeAnimation; public int syncPos; public static List syncTimer = new List(); public static List syncPlayerCount = new List(); public static List> uniqueAnimations = new List>(); public bool vulnerableEmote = false; public AnimationClipParams.LockType lockType = AnimationClipParams.LockType.none; public bool willGetClaimed = false; public float audioLevel = 0.5f; public bool thirdPerson = false; public string displayName = ""; public bool localTransforms = false; public BepInPlugin ownerPlugin; public bool usesNewImportSystem = false; public bool animates = true; public bool preventsMovement = false; public bool allowJoining = true; public string joinEmote = ""; internal CustomAnimationClip(AnimationClip[] _clip, bool _loop, AudioClip[] primaryAudioClips = null, AudioClip[] secondaryAudioClips = null, HumanBodyBones[] rootBonesToIgnore = null, HumanBodyBones[] soloBonesToIgnore = null, AnimationClip[] _secondaryClip = null, bool dimWhenClose = false, bool stopWhenMove = false, bool stopWhenAttack = false, bool visible = true, bool syncAnim = false, bool syncAudio = false, int startPreference = -1, int joinPreference = -1, JoinSpot[] _joinSpots = null, bool safePositionReset = false, string customName = "", Action _customPostEventCodeSync = null, Action _customPostEventCodeNoSync = null, AnimationClipParams.LockType lockType = AnimationClipParams.LockType.none, AudioClip[] primaryDMCAFreeAudioClips = null, AudioClip[] secondaryDMCAFreeAudioClips = null, bool willGetClaimed = false, float audioLevel = 0.5f, bool thirdPerson = false, string displayName = "", BepInPlugin ownerPlugin = null, bool localTransforms = false, bool usesNewImportSystem = false, bool animates = true, bool preventsMovement = false, bool allowJoining = true, string joinEmote = "") { if (rootBonesToIgnore == null) { rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0]; } if (soloBonesToIgnore == null) { soloBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0]; } clip = _clip; secondaryClip = _secondaryClip; looping = _loop; dimAudioWhenClose = dimWhenClose; stopOnAttack = stopWhenAttack; stopOnMove = stopWhenMove; visibility = visible; joinPref = joinPreference; startPref = startPreference; customPostEventCodeSync = _customPostEventCodeSync; customPostEventCodeNoSync = _customPostEventCodeNoSync; if (primaryAudioClips == null) { BoneMapper.primaryAudioClips.Add((AudioClip[])(object)new AudioClip[1]); } else { BoneMapper.primaryAudioClips.Add(primaryAudioClips); } if (secondaryAudioClips == null) { BoneMapper.secondaryAudioClips.Add((AudioClip[])(object)new AudioClip[1]); } else { BoneMapper.secondaryAudioClips.Add(secondaryAudioClips); } if (primaryDMCAFreeAudioClips == null) { BoneMapper.primaryDMCAFreeAudioClips.Add((AudioClip[])(object)new AudioClip[1]); } else { BoneMapper.primaryDMCAFreeAudioClips.Add(primaryDMCAFreeAudioClips); } if (secondaryDMCAFreeAudioClips == null) { BoneMapper.secondaryDMCAFreeAudioClips.Add((AudioClip[])(object)new AudioClip[1]); } else { BoneMapper.secondaryDMCAFreeAudioClips.Add(secondaryDMCAFreeAudioClips); } if (soloBonesToIgnore.Length != 0) { soloIgnoredBones = new List(soloBonesToIgnore); } else { soloIgnoredBones = new List(); } if (rootBonesToIgnore.Length != 0) { rootIgnoredBones = new List(rootBonesToIgnore); } else { rootIgnoredBones = new List(); } syncronizeAnimation = syncAnim; syncronizeAudio = syncAudio; syncPos = syncTimer.Count; syncTimer.Add(0f); syncPlayerCount.Add(0); if (_clip != null) { List list = new List(); for (int i = 0; i < _clip.Length; i++) { list.Add(item: false); } uniqueAnimations.Add(list); } if (_joinSpots == null) { _joinSpots = new JoinSpot[0]; } joinSpots = _joinSpots; useSafePositionReset = safePositionReset; customInternalName = customName; this.usesNewImportSystem = usesNewImportSystem; if (!usesNewImportSystem && customName != "") { BoneMapper.customNamePairs.Add(customName, ((Object)_clip[0]).name); } BoneMapper.listOfCurrentEmoteAudio.Add(new List()); this.lockType = lockType; this.willGetClaimed = willGetClaimed; this.audioLevel = audioLevel; this.thirdPerson = thirdPerson; this.displayName = displayName; if (displayName == "") { DebugClass.Log("display name wasn't set, using " + customInternalName); this.displayName = customInternalName; } this.ownerPlugin = ownerPlugin; this.localTransforms = localTransforms; this.animates = animates; this.preventsMovement = preventsMovement; this.allowJoining = allowJoining; if (string.IsNullOrEmpty(customInternalName)) { return; } Keybinds.DisableKeybinds(); if (usesNewImportSystem) { InputActionReference orCreateInputRef = Keybinds.GetOrCreateInputRef(customInternalName); orCreateInputRef.action.Enable(); orCreateInputRef.action.started += EmoteAction_started; if (Keybinds.keyBindOverrideStorage.TryGetValue(customInternalName, out var value)) { InputActionRebindingExtensions.ApplyBindingOverride(orCreateInputRef.action, value, (string)null, (string)null); } } else { InputActionReference orCreateInputRef2 = Keybinds.GetOrCreateInputRef(((Object)clip[0]).name); orCreateInputRef2.action.Enable(); orCreateInputRef2.action.started += EmoteAction_started; if (Keybinds.keyBindOverrideStorage.TryGetValue(((Object)clip[0]).name, out var value2)) { InputActionRebindingExtensions.ApplyBindingOverride(orCreateInputRef2.action, value2, (string)null, (string)null); } } Keybinds.EnableKeybinds(); if (joinEmote == "") { joinEmote = customInternalName; } this.joinEmote = joinEmote; if (EmoteDmcaVerificationStatusDb.IsNonDmcaCompliant(ownerPlugin.GUID)) { this.willGetClaimed = true; } } private static void EmoteAction_started(CallbackContext obj) { if (EmoteUiManager.CanOpenEmoteWheels() && CustomEmotesAPI.localMapper != null) { CustomEmotesAPI.PlayAnimation(((CallbackContext)(ref obj)).action.name); } } } [DefaultExecutionOrder(-2)] public class EmoteConstraint : MonoBehaviour { public Transform originalBone; public Transform emoteBone; private Vector3 originalPosition; private Quaternion originalRotation; public bool constraintActive = false; public bool revertTransform; private bool firstTime = true; private bool firstTime2 = true; private bool hasEverActivatedConstraints = false; public bool onlyY = false; public bool debug = false; public bool forceGlobalTransforms = false; internal bool needToFix = true; public bool localTransforms { get; private set; } = false; public bool SetLocalTransforms(bool input) { localTransforms = !forceGlobalTransforms && input; return localTransforms; } private void LateUpdate() { ActUponConstraints(); } public void ActUponConstraints() { //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_0090: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!constraintActive) { return; } if (localTransforms) { if (onlyY) { originalBone.localPosition = new Vector3(originalBone.localPosition.x, emoteBone.localPosition.y, originalBone.localPosition.z); return; } originalBone.localPosition = emoteBone.localPosition; originalBone.localRotation = emoteBone.localRotation; } else if (onlyY) { originalBone.position = new Vector3(originalBone.position.x, emoteBone.position.y, originalBone.position.z); } else { originalBone.position = emoteBone.position; originalBone.rotation = emoteBone.rotation; } } public void ActivateConstraints() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (!constraintActive && emoteBone != null) { if (firstTime2) { firstTime2 = false; ((Component)this).gameObject.GetComponent().StartCoroutine(FirstTimeActiveFix(this)); return; } originalPosition = originalBone.localPosition; originalRotation = originalBone.localRotation; hasEverActivatedConstraints = true; constraintActive = true; onlyY = false; } } internal IEnumerator FirstTimeActiveFix(EmoteConstraint e) { ((Behaviour)e).enabled = false; yield return (object)new WaitForEndOfFrame(); ((Behaviour)e).enabled = true; if (e.onlyY) { e.ActivateConstraints(); e.onlyY = true; } else { e.ActivateConstraints(); } } public void DeactivateConstraints() { //IL_003b: 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) constraintActive = false; if (firstTime || !revertTransform || !hasEverActivatedConstraints) { firstTime = false; return; } originalBone.localPosition = originalPosition; originalBone.localRotation = originalRotation; } internal void AddSource(ref Transform originalBone, ref Transform emoteBone) { this.originalBone = originalBone; this.emoteBone = emoteBone; if (((Component)emoteBone).GetComponent() != null) { ((Component)emoteBone).GetComponent().target = originalBone; } else { ((Component)emoteBone).gameObject.AddComponent().target = originalBone; } } internal void AddSource(Transform originalBone, Transform emoteBone) { this.originalBone = originalBone; this.emoteBone = emoteBone; if (((Component)emoteBone).GetComponent() != null) { ((Component)emoteBone).GetComponent().target = originalBone; } else { ((Component)emoteBone).gameObject.AddComponent().target = originalBone; } } internal static EmoteConstraint AddConstraint(GameObject gameObject, BoneMapper mapper, Transform target, bool needToFix) { EmoteConstraint emoteConstraint = gameObject.AddComponent(); emoteConstraint.AddSource(gameObject.transform, target); emoteConstraint.revertTransform = mapper.revertTransform; emoteConstraint.needToFix = needToFix; return emoteConstraint; } private void Start() { ((MonoBehaviour)this).StartCoroutine(FixConstraints()); } private IEnumerator FixConstraints() { yield return (object)new WaitForEndOfFrame(); if (needToFix) { ActivateConstraints(); yield return (object)new WaitForEndOfFrame(); DeactivateConstraints(); } } } public struct JoinSpot { public string name; public Vector3 position; public Vector3 rotation; public Vector3 scale; public JoinSpot(string _name, Vector3 _position, Vector3 _rotation, Vector3 _scale) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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) name = _name; position = _position; rotation = _rotation; scale = _scale; } public JoinSpot(string _name, Vector3 _position) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) name = _name; position = _position; rotation = Vector3.zero; scale = Vector3.one; } } public class EmoteLocation : MonoBehaviour { public static List emoteLocations = new List(); public static bool visibile = true; public int spot; public int validPlayers = 0; public BoneMapper owner; public BoneMapper emoter; public JoinSpot joinSpot; private InteractTrigger personalTrigger; public static void HideAllSpots() { visibile = false; foreach (EmoteLocation emoteLocation in emoteLocations) { try { Renderer[] componentsInChildren = ((Component)emoteLocation).GetComponentsInChildren(); foreach (Renderer val in componentsInChildren) { val.enabled = false; } ParticleSystemRenderer[] componentsInChildren2 = ((Component)emoteLocation).GetComponentsInChildren(); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = false; } } catch (Exception) { } } } public static void ShowAllSpots() { visibile = true; foreach (EmoteLocation emoteLocation in emoteLocations) { try { Renderer[] componentsInChildren = ((Component)emoteLocation).GetComponentsInChildren(); foreach (Renderer val in componentsInChildren) { val.enabled = true; } ParticleSystemRenderer[] componentsInChildren2 = ((Component)emoteLocation).GetComponentsInChildren(); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = true; } } catch (Exception) { } } } private void Start() { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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) SetColor(); emoteLocations.Add(this); ((MonoBehaviour)this).StartCoroutine(setScale()); if (!visibile) { Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(); foreach (Renderer val in componentsInChildren) { val.enabled = false; } ParticleSystemRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren(); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { ((Renderer)val2).enabled = false; } } personalTrigger = ((Component)this).gameObject.AddComponent(); ((Component)this).gameObject.tag = "InteractTrigger"; ((Component)this).gameObject.layer = LayerMask.NameToLayer("InteractableObject"); personalTrigger.interactable = true; personalTrigger.hoverIcon = Object.Instantiate(Assets.Load("assets/fineilldoitmyself/nothing.png")); personalTrigger.disabledHoverIcon = Object.Instantiate(Assets.Load("assets/fineilldoitmyself/nothing.png")); personalTrigger.disabledHoverTip = ""; InputBinding val3 = EmotesInputSettings.Instance.JoinEmote.bindings[0]; string text = InputControlPath.ToHumanReadableString(((InputBinding)(ref val3)).effectivePath, (HumanReadableStringOptions)2, (InputControl)null); personalTrigger.hoverTip = "Press [" + text + "] to join"; } private void OnDestroy() { emoteLocations.Remove(this); } public void SetEmoterAndHideLocation(BoneMapper boneMapper) { if (!Object.op_Implicit((Object)(object)emoter)) { emoter = boneMapper; SetVisible(visibility: false); } } public IEnumerator setScale() { yield return (object)new WaitForSeconds(0.1f); _ = Vector3.one; Vector3 scal = ((!Object.op_Implicit((Object)(object)owner.emoteSkeletonSMR)) ? ((Component)owner).transform.lossyScale : ((Component)owner).transform.parent.lossyScale); ((Component)this).transform.localPosition = new Vector3(joinSpot.position.x / scal.x, joinSpot.position.y / scal.y, joinSpot.position.z / scal.z); ((Component)this).transform.localEulerAngles = joinSpot.rotation; ((Component)this).transform.localScale = new Vector3(joinSpot.scale.x / scal.x, joinSpot.scale.y / scal.y, joinSpot.scale.z / scal.z); } internal void SetVisible(bool visibility) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (visibility) { Transform transform = ((Component)this).gameObject.transform; transform.localPosition += new Vector3(5000f, 5000f, 5000f); } else { Transform transform2 = ((Component)this).gameObject.transform; transform2.localPosition -= new Vector3(5000f, 5000f, 5000f); } } private void OnTriggerEnter(Collider other) { if (!Object.op_Implicit((Object)(object)((Component)other).GetComponentInChildren()) || !((Object)(object)((Component)other).GetComponentInChildren() != (Object)(object)owner)) { return; } BoneMapper componentInChildren = ((Component)other).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { validPlayers++; SetColor(); if (componentInChildren.local) { personalTrigger.interactable = true; } componentInChildren.currentEmoteSpot = ((Component)this).gameObject; CustomEmotesAPI.JoinSpotEntered(componentInChildren, owner); } } private void OnTriggerExit(Collider other) { if (!Object.op_Implicit((Object)(object)((Component)other).GetComponentInChildren()) || !((Object)(object)((Component)other).GetComponentInChildren() != (Object)(object)owner)) { return; } BoneMapper componentInChildren = ((Component)other).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren)) { if (validPlayers != 0) { validPlayers--; } if (componentInChildren.local) { personalTrigger.interactable = false; } SetColor(); if ((Object)(object)componentInChildren.currentEmoteSpot == (Object)(object)((Component)this).gameObject) { componentInChildren.currentEmoteSpot = null; } } } internal void SetColor() { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (validPlayers > 0) { ((Component)this).GetComponentsInChildren()[((Component)this).GetComponentsInChildren().Length - 1].material.color = Color.green; Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren(); foreach (Renderer val in componentsInChildren) { val.material.SetColor("_EmissionColor", Color.green); } ParticleSystemRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren(); foreach (ParticleSystemRenderer val2 in componentsInChildren2) { ((Renderer)val2).material.SetColor("_EmissionColor", Color.green); } ParticleSystem[] componentsInChildren3 = ((Component)this).GetComponentsInChildren(); foreach (ParticleSystem val3 in componentsInChildren3) { TrailModule trails = val3.trails; ((TrailModule)(ref trails)).colorOverTrail = MinMaxGradient.op_Implicit(Color.green); } } else { ((Component)this).GetComponentsInChildren()[((Component)this).GetComponentsInChildren().Length - 1].material.color = new Color(0.003921569f, 52f / 85f, 38f / 51f); Renderer[] componentsInChildren4 = ((Component)this).GetComponentsInChildren(); foreach (Renderer val4 in componentsInChildren4) { val4.material.SetColor("_EmissionColor", new Color(0.003921569f, 52f / 85f, 38f / 51f)); } ParticleSystemRenderer[] componentsInChildren5 = ((Component)this).GetComponentsInChildren(); foreach (ParticleSystemRenderer val5 in componentsInChildren5) { ((Renderer)val5).material.SetColor("_EmissionColor", new Color(0.003921569f, 52f / 85f, 38f / 51f)); } ParticleSystem[] componentsInChildren6 = ((Component)this).GetComponentsInChildren(); foreach (ParticleSystem val6 in componentsInChildren6) { TrailModule trails2 = val6.trails; ((TrailModule)(ref trails2)).colorOverTrail = MinMaxGradient.op_Implicit(new Color(0.003921569f, 52f / 85f, 38f / 51f)); } } } } public class AudioContainer : MonoBehaviour { internal List playingObjects = new List(); } public class AudioObject : MonoBehaviour { internal int spot; internal int playerCount; internal GameObject audioObject; internal int activeObjectsSpot; } public class BonePair { public Transform original; public Transform newiginal; public BonePair(Transform n, Transform o) { newiginal = n; original = o; } public void test() { } } public static class DebugClass { private static ManualLogSource Logger; public static void SetLogger(ManualLogSource logSource) { Logger = logSource; } public static void Log(object message) { Logger.Log((LogLevel)16, (object)$"{message}"); } } public class EmoteNetworker : NetworkBehaviour { public static EmoteNetworker instance; private void Awake() { ((Object)this).name = "Bigma Lalls"; instance = this; } public void SyncEmote(ulong playerId, string animation, int pos) { if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer) { SyncEmoteToClients(playerId, animation, pos); } else { SyncEmoteToServerRpc(playerId, animation, pos); } } public void SyncEmoteToClients(ulong playerId, string animation, int pos) { GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject; if (!Object.op_Implicit((Object)(object)gameObject)) { DebugClass.Log("Body is null!!!"); } int eventNum = -1; CustomAnimationClip customAnimationClip = BoneMapper.animClips[animation]; try { ((object)customAnimationClip.clip[0]).ToString(); eventNum = Random.Range(0, BoneMapper.primaryAudioClips[customAnimationClip.syncPos].Length); } catch (Exception) { } SyncEmoteToClientRpc(playerId, animation, pos, eventNum); } [ClientRpc] public void SyncEmoteToClientRpc(ulong playerId, string animation, int pos, int eventNum) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0095: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1218916340u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); bool flag = animation != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animation, false); } BytePacker.WriteValueBitPacked(val2, pos); BytePacker.WriteValueBitPacked(val2, eventNum); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1218916340u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject; if (!Object.op_Implicit((Object)(object)gameObject)) { DebugClass.Log("Body is null!!!"); } BoneMapper componentInChildren = gameObject.GetComponentInChildren(); if (componentInChildren.playerController != null && componentInChildren.playerController.performingEmote && !animation.Contains("BetterEmotes__") && !animation.Contains("TooManyEmotes__")) { componentInChildren.playerController.performingEmote = false; if (((NetworkBehaviour)componentInChildren.playerController).IsOwner) { componentInChildren.playerController.StopPerformingEmoteServerRpc(); } } DebugClass.Log($"Recieved message to play {animation} on client. Playing on {gameObject}"); componentInChildren.PlayAnim(animation, pos, eventNum); } [ServerRpc(RequireOwnership = false)] public void SyncEmoteToServerRpc(ulong playerId, string animation, int pos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_0095: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1304595851u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); bool flag = animation != null; ((FastBufferWriter)(ref val2)).WriteValueSafe(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(animation, false); } BytePacker.WriteValueBitPacked(val2, pos); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1304595851u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SyncEmoteToClients(playerId, animation, pos); } } public void SyncJoinSpot(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray) { if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer) { SyncJoinSpotToClientRpc(playerId, joinSpotId, worldProp, posInArray); } else { SyncJoinSpotToServerRpc(playerId, joinSpotId, worldProp, posInArray); } } [ClientRpc] public void SyncJoinSpotToClientRpc(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(770217386u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, joinSpotId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref worldProp, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, posInArray); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 770217386u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject; GameObject gameObject2 = ((Component)((NetworkBehaviour)this).GetNetworkObject(joinSpotId)).gameObject; if (!Object.op_Implicit((Object)(object)gameObject)) { DebugClass.Log("Body is null!!!"); } if (!Object.op_Implicit((Object)(object)gameObject2)) { DebugClass.Log("spotObject is null!!!"); } BoneMapper componentInChildren = gameObject.GetComponentInChildren(); componentInChildren.PlayAnim("none", 0, -1); componentInChildren.currentEmoteSpot = ((Component)gameObject2.GetComponentsInChildren()[posInArray]).gameObject; if (worldProp) { CustomEmotesAPI.JoinedProp(componentInChildren.currentEmoteSpot, componentInChildren, componentInChildren.currentEmoteSpot.GetComponent().owner); } else { CustomEmotesAPI.JoinedBody(componentInChildren.currentEmoteSpot, componentInChildren, componentInChildren.currentEmoteSpot.GetComponent().owner); } } } [ServerRpc(RequireOwnership = false)] public void SyncJoinSpotToServerRpc(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(711293682u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); BytePacker.WriteValueBitPacked(val2, joinSpotId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref worldProp, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, posInArray); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 711293682u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SyncJoinSpotToClientRpc(playerId, joinSpotId, worldProp, posInArray); } } } public void SyncBoneMapperPos(ulong playerId, Vector3 pos, Vector3 rot) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer) { SyncBoneMapperPosToClientRpc(playerId, pos, rot); } else { SyncBoneMapperPosToServerRpc(playerId, pos, rot); } } [ClientRpc] public void SyncBoneMapperPosToClientRpc(ulong playerId, Vector3 pos, Vector3 rot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_00a3: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1678486976u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1678486976u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject; if (!Object.op_Implicit((Object)(object)gameObject)) { DebugClass.Log("Body is null!!!"); } BoneMapper componentInChildren = gameObject.GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)(object)CustomEmotesAPI.localMapper)) { componentInChildren.prevMapperPos = pos; componentInChildren.prevMapperRot = rot; } } } [ServerRpc(RequireOwnership = false)] public void SyncBoneMapperPosToServerRpc(ulong playerId, Vector3 pos, Vector3 rot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Invalid comparison between Unknown and I4 //IL_005f: 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_006d: 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_00a3: 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_00e6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2977327148u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2977327148u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { SyncBoneMapperPosToClientRpc(playerId, pos, rot); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_EmoteNetworker() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1218916340u, new RpcReceiveHandler(__rpc_handler_1218916340)); NetworkManager.__rpc_func_table.Add(1304595851u, new RpcReceiveHandler(__rpc_handler_1304595851)); NetworkManager.__rpc_func_table.Add(770217386u, new RpcReceiveHandler(__rpc_handler_770217386)); NetworkManager.__rpc_func_table.Add(711293682u, new RpcReceiveHandler(__rpc_handler_711293682)); NetworkManager.__rpc_func_table.Add(1678486976u, new RpcReceiveHandler(__rpc_handler_1678486976)); NetworkManager.__rpc_func_table.Add(2977327148u, new RpcReceiveHandler(__rpc_handler_2977327148)); } private static void __rpc_handler_1218916340(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string animation = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animation, false); } int pos = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref pos); int eventNum = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref eventNum); target.__rpc_exec_stage = (__RpcExecStage)2; ((EmoteNetworker)(object)target).SyncEmoteToClientRpc(playerId, animation, pos, eventNum); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1304595851(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref flag, default(ForPrimitives)); string animation = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref animation, false); } int pos = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref pos); target.__rpc_exec_stage = (__RpcExecStage)1; ((EmoteNetworker)(object)target).SyncEmoteToServerRpc(playerId, animation, pos); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_770217386(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); ulong joinSpotId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref joinSpotId); bool worldProp = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref worldProp, default(ForPrimitives)); int posInArray = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref posInArray); target.__rpc_exec_stage = (__RpcExecStage)2; ((EmoteNetworker)(object)target).SyncJoinSpotToClientRpc(playerId, joinSpotId, worldProp, posInArray); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_711293682(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); ulong joinSpotId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref joinSpotId); bool worldProp = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref worldProp, default(ForPrimitives)); int posInArray = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref posInArray); target.__rpc_exec_stage = (__RpcExecStage)1; ((EmoteNetworker)(object)target).SyncJoinSpotToServerRpc(playerId, joinSpotId, worldProp, posInArray); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1678486976(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); Vector3 rot = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rot); target.__rpc_exec_stage = (__RpcExecStage)2; ((EmoteNetworker)(object)target).SyncBoneMapperPosToClientRpc(playerId, pos, rot); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2977327148(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ulong playerId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); Vector3 pos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref pos); Vector3 rot = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rot); target.__rpc_exec_stage = (__RpcExecStage)1; ((EmoteNetworker)(object)target).SyncBoneMapperPosToServerRpc(playerId, pos, rot); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "EmoteNetworker"; } } namespace LethalEmotesAPI { public class EmoteDb : IEmoteDb { private IReadOnlyCollection _emoteKeys; private IReadOnlyCollection _emoteModNames; private IReadOnlyCollection _emoteModGuids; private readonly Dictionary _emoteKeyModNameLut = new Dictionary(); public IReadOnlyCollection EmoteKeys { get { if (_emoteKeys == null) { _emoteKeys = (IReadOnlyCollection)(object)BoneMapper.animClips.Select((KeyValuePair kvp) => kvp.Key).ToArray(); } return _emoteKeys; } } public IReadOnlyCollection EmoteModNames { get { if (_emoteModNames == null) { _emoteModNames = (IReadOnlyCollection)(object)(from kvp in BoneMapper.animClips where kvp.Value != null select kvp.Value.ownerPlugin.Name into modName group modName by modName into kvp select kvp.First()).ToArray(); } return _emoteModNames; } } public IReadOnlyCollection EmoteModGuids { get { if (_emoteModGuids == null) { _emoteModGuids = (IReadOnlyCollection)(object)(from kvp in BoneMapper.animClips where kvp.Value != null select kvp.Value.ownerPlugin.GUID).Distinct().ToArray(); } return _emoteModGuids; } } public string GetEmoteName(string emoteKey) { if (!BoneMapper.animClips.ContainsKey(emoteKey)) { return emoteKey; } CustomAnimationClip customAnimationClip = BoneMapper.animClips[emoteKey]; if (customAnimationClip != null && customAnimationClip.usesNewImportSystem) { return string.IsNullOrEmpty(customAnimationClip.displayName) ? emoteKey : customAnimationClip.displayName; } return (customAnimationClip == null || string.IsNullOrEmpty(customAnimationClip.customInternalName)) ? emoteKey : customAnimationClip.customInternalName; } public void AssociateEmoteKeyWithMod(string emoteKey, string modName) { _emoteKeyModNameLut[emoteKey] = modName; } public string GetModName(string emoteKey) { if (BoneMapper.animClips.TryGetValue(emoteKey, out var value)) { if (value == null) { return CollectionExtensions.GetValueOrDefault(_emoteKeyModNameLut, emoteKey, "Unknown"); } BepInPlugin ownerPlugin = value.ownerPlugin; return (ownerPlugin == null) ? "Unknown" : ownerPlugin.Name; } return CollectionExtensions.GetValueOrDefault(_emoteKeyModNameLut, emoteKey, "Unknown"); } public string GetModNameFromModGuid(string modGuid) { if (!Chainloader.PluginInfos.TryGetValue(modGuid, out var value)) { return modGuid; } return value.Metadata.Name; } public bool GetEmoteVisibility(string emoteKey) { if (BoneMapper.animClips.TryGetValue(emoteKey, out var value)) { return value?.visibility ?? true; } return false; } } public class LethalEmotesUiState : IEmoteUiStateController { public static readonly LethalEmotesUiState Instance = new LethalEmotesUiState(); private EmoteDb _emoteDb; public IEmoteDb EmoteDb { get { if (_emoteDb == null) { _emoteDb = new EmoteDb(); } return (IEmoteDb)(object)_emoteDb; } } public IReadOnlyCollection RandomPoolBlacklist => BlacklistSettings.emotesExcludedFromRandom; public IReadOnlyCollection EmotePoolBlacklist => BlacklistSettings.emotesDisabled; public float EmoteVolume { get { return Settings.EmotesVolume.Value; } set { Settings.EmotesVolume.Value = value; } } public bool HideJoinSpots { get { return Settings.HideJoinSpots.Value; } set { Settings.HideJoinSpots.Value = value; } } public int RootMotionType { get { return (int)Settings.rootMotionType.Value; } set { Settings.rootMotionType.Value = (RootMotionType)value; } } public bool EmotesAlertEnemies { get { return Settings.EmotesAlertEnemies.Value; } set { Settings.EmotesAlertEnemies.Value = value; } } public int DmcaFree { get { return (int)Settings.DMCAFree.Value; } set { Settings.DMCAFree.Value = (DMCAType)value; } } public int ThirdPerson { get { return (int)Settings.thirdPersonType.Value; } set { Settings.thirdPersonType.Value = (ThirdPersonType)value; } } public bool UseGlobalSettings { get { return !Settings.modPackOverride.Value && Settings.useGlobalConfig.Value; } set { Settings.useGlobalConfig.Value = !Settings.modPackOverride.Value && value; } } public bool DontShowDmcaPrompt { get { return Settings.dontShowDmcaPrompt.Value; } set { Settings.dontShowDmcaPrompt.Value = value; } } private LethalEmotesUiState() { } public void PlayEmote(string emoteKey) { CustomEmotesAPI.PlayAnimation(emoteKey); } public void LockMouseInput() { GameNetworkManager.Instance.localPlayerController.disableLookInput = true; Cursor.lockState = (CursorLockMode)2; Cursor.visible = true; } public void UnlockMouseInput() { GameNetworkManager.Instance.localPlayerController.disableLookInput = false; Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } public void LockPlayerInput() { GameNetworkManager.Instance.localPlayerController.quickMenuManager.isMenuOpen = true; } public void UnlockPlayerInput() { GameNetworkManager.Instance.localPlayerController.quickMenuManager.isMenuOpen = false; } public bool CanOpenEmoteUi() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController == null) { return false; } return !localPlayerController.inTerminalMenu && !localPlayerController.isTypingChat && !localPlayerController.quickMenuManager.isMenuOpen; } public void RefreshTME() { if (CustomEmotesAPI.TMEPresent) { TooManyEmotesCompat.ReloadTooManyEmotesVisibility(); } } public void PlayAnimationOn(Animator animator, string emoteKey) { BoneMapper.PreviewAnimations(animator, emoteKey); } public void AddToRandomPoolBlacklist(string emoteKey) { BlacklistSettings.AddToExcludeList(emoteKey); } public void RemoveFromRandomPoolBlacklist(string emoteKey) { BlacklistSettings.RemoveFromExcludeList(emoteKey); } public void AddToEmoteBlacklist(string emoteKey) { BlacklistSettings.AddToDisabledList(emoteKey); } public void RemoveFromEmoteBlacklist(string emoteKey) { BlacklistSettings.RemoveFromDisabledList(emoteKey); } public void RefreshBothLists() { BlacklistSettings.RefreshBothLists(); } public InputActionReference GetEmoteKeybind(string emoteKey) { return Keybinds.GetOrCreateInputRef(emoteKey); } public void EnableKeybinds() { Keybinds.EnableKeybinds(); } public void DisableKeybinds() { Keybinds.DisableKeybinds(); } public string[] GetEmoteKeysForBindPath(string bindPath) { return Keybinds.GetEmoteKeysForBindPath(bindPath); } public T LoadAsset(string assetName) where T : Object { return Assets.Load(assetName); } public void EnqueueWorkOnUnityThread(Action action) { UnityThreadScheduler.EnqueueWorkOnUnityThread(action); } internal static void FixLegacyEmotes() { EmoteWheelSetData val = EmoteWheelSetDataConverter.EmoteWheelSetDataFromJson(Settings.EmoteWheelSetDataEntryString.Value); EmoteWheelData[] emoteWheels = val.EmoteWheels; foreach (EmoteWheelData val2 in emoteWheels) { for (int j = 0; j < val2.Emotes.Length; j++) { if (BoneMapper.animClips.ContainsKey(val2.Emotes[j])) { continue; } foreach (string key in BoneMapper.animClips.Keys) { if (key.Contains(val2.Emotes[j]) || (BoneMapper.animClips[key] != null && BoneMapper.animClips[key].animates && ((Object)BoneMapper.animClips[key].clip[0]).name == val2.Emotes[j])) { val2.Emotes[j] = key; break; } } } } Settings.EmoteWheelSetDataEntryString.Value = val.ToJson(); } public EmoteWheelSetData LoadEmoteWheelSetData() { return EmoteWheelSetDataConverter.EmoteWheelSetDataFromJson(Settings.EmoteWheelSetDataEntryString.Value); } public EmoteWheelSetDisplayData LoadEmoteWheelSetDisplayData() { return EmoteWheelSetDataConverter.EmoteWheelSetDisplayDataFromJson(Settings.EmoteWheelSetDisplayDataString.Value); } public void LoadKeybinds() { Keybinds.LoadKeybinds(); } public void SaveEmoteWheelSetData(EmoteWheelSetData dataToSave) { Settings.EmoteWheelSetDataEntryString.Value = dataToSave.ToJson(); } public void SaveEmoteWheelSetDisplayData(EmoteWheelSetDisplayData dataToSave) { Settings.EmoteWheelSetDisplayDataString.Value = dataToSave.ToJson(); } public void SaveKeybinds() { Keybinds.SaveKeybinds(); } } public class EmotesInputSettings : LcInputActions { public static readonly EmotesInputSettings Instance = new EmotesInputSettings(); [InputAction(/*Could not decode attribute arguments.*/)] public InputAction EmoteWheel { get; set; } [InputAction(/*Could not decode attribute arguments.*/)] public InputAction Left { get; set; } [InputAction(/*Could not decode attribute arguments.*/)] public InputAction Right { get; set; } [InputAction("/f", Name = "CustomEmotesAPI: Play Random Emote")] public InputAction RandomEmote { get; set; } [InputAction("/v", Name = "CustomEmotesAPI: Join Emote")] public InputAction JoinEmote { get; set; } [InputAction("", Name = "Stop emoting")] public InputAction StopEmoting { get; set; } [InputAction("/middleButton", Name = "CustomEmotesAPI: Third Person Toggle")] public InputAction ThirdPersonToggle { get; set; } [InputAction(/*Could not decode attribute arguments.*/)] public InputAction GamepadEmoteWheel { get; set; } } public class AudioManager : MonoBehaviour { public AudioSource audioSource; public bool needToContinueOnFinish = false; private int syncPos; private int currEvent; public BoneMapper mapper; private float audioTimer = 0f; private bool currentClipDMCA; internal void Setup(AudioSource source, BoneMapper mapper) { audioSource = source; this.mapper = mapper; } private void Start() { } private void Update() { //IL_017e: Unknown result type (might be due to invalid IL or missing references) if (!audioSource.isPlaying && needToContinueOnFinish) { if (currentClipDMCA && Settings.DMCAFree.Value == DMCAType.Mute) { needToContinueOnFinish = false; return; } audioSource.time = 0f; if (CheckDMCA(currentClipDMCA)) { audioSource.clip = BoneMapper.secondaryDMCAFreeAudioClips[syncPos][currEvent]; } else { audioSource.clip = BoneMapper.secondaryAudioClips[syncPos][currEvent]; } audioSource.Play(); needToContinueOnFinish = false; audioSource.loop = true; } if (!audioSource.isPlaying) { return; } audioTimer += Time.deltaTime; if (audioTimer > 0.75f) { audioSource.volume = Settings.EmotesVolume.Value / 100f; audioTimer -= 0.75f; if (Settings.EmotesAlertEnemies.Value && mapper.playerController != null) { RoundManager.Instance.PlayAudibleNoise(mapper.mapperBody.transform.position, 30f, mapper.currentAudioLevel, 0, mapper.playerController.isInHangarShipRoom && mapper.playerController.playersManager.hangarDoorsClosed, 5); } } } public void Play(int syncPos, int currEvent, bool looping, bool sync, bool willGetClaimed) { currentClipDMCA = willGetClaimed; if (currentClipDMCA && Settings.DMCAFree.Value == DMCAType.Mute) { return; } audioSource.time = 0f; this.syncPos = syncPos; this.currEvent = currEvent; if (BoneMapper.listOfCurrentEmoteAudio[syncPos].Count != 0 && sync) { this.currEvent = ((Component)((Component)BoneMapper.listOfCurrentEmoteAudio[syncPos][0]).gameObject.transform.parent).GetComponentInChildren().currEvent; currEvent = this.currEvent; } if (BoneMapper.secondaryAudioClips[syncPos].Length > currEvent && (Object)(object)BoneMapper.secondaryAudioClips[syncPos][currEvent] != (Object)null) { if (CustomAnimationClip.syncTimer[syncPos] > BoneMapper.primaryAudioClips[syncPos][currEvent].length) { if (CheckDMCA(willGetClaimed)) { SetAndPlayAudio(BoneMapper.secondaryDMCAFreeAudioClips[syncPos][currEvent]); } else { SetAndPlayAudio(BoneMapper.secondaryAudioClips[syncPos][currEvent]); } SampleCheck(); needToContinueOnFinish = false; audioSource.loop = true; } else { if (CheckDMCA(willGetClaimed)) { SetAndPlayAudio(BoneMapper.primaryDMCAFreeAudioClips[syncPos][currEvent]); } else { SetAndPlayAudio(BoneMapper.primaryAudioClips[syncPos][currEvent]); } SampleCheck(); needToContinueOnFinish = true; audioSource.loop = false; } } else if (looping) { if (CheckDMCA(willGetClaimed)) { SetAndPlayAudio(BoneMapper.primaryDMCAFreeAudioClips[syncPos][currEvent]); } else { SetAndPlayAudio(BoneMapper.primaryAudioClips[syncPos][currEvent]); } SampleCheck(); needToContinueOnFinish = false; audioSource.loop = true; } else { if (CheckDMCA(willGetClaimed)) { SetAndPlayAudio(BoneMapper.primaryDMCAFreeAudioClips[syncPos][currEvent]); } else { SetAndPlayAudio(BoneMapper.primaryAudioClips[syncPos][currEvent]); } SampleCheck(); needToContinueOnFinish = false; audioSource.loop = false; } } public void Stop() { needToContinueOnFinish = false; audioSource.Stop(); } public void SetAndPlayAudio(AudioClip a) { if (Object.op_Implicit((Object)(object)a)) { audioSource.clip = a; audioSource.volume = 0f; audioSource.Play(); } else { needToContinueOnFinish = false; } } public void SampleCheck() { if (BoneMapper.listOfCurrentEmoteAudio[syncPos].Count != 0) { audioSource.time = BoneMapper.listOfCurrentEmoteAudio[syncPos][0].time; BusStop busStop = ((Component)this).gameObject.AddComponent(); busStop.desiredSampler = BoneMapper.listOfCurrentEmoteAudio[syncPos][0]; busStop.receiverSampler = audioSource; } else { audioSource.volume = Settings.EmotesVolume.Value / 100f; audioSource.time = 0f; } } public bool CheckDMCA(bool willGetClaimed) { switch (Settings.DMCAFree.Value) { case DMCAType.Normal: return false; case DMCAType.Friendly: case DMCAType.Mute: return willGetClaimed; case DMCAType.AllOff: return true; default: return true; } } } public class BusStop : MonoBehaviour { public AudioSource desiredSampler; public AudioSource receiverSampler; private int success = 0; private void Update() { if (!Object.op_Implicit((Object)(object)desiredSampler)) { receiverSampler.volume = Settings.EmotesVolume.Value / 100f; Object.DestroyImmediate((Object)(object)this); } if (desiredSampler.time != receiverSampler.time) { receiverSampler.volume = 0f; receiverSampler.time = desiredSampler.time; success = 0; return; } success++; if (success == 3) { receiverSampler.volume = Settings.EmotesVolume.Value / 100f; Object.DestroyImmediate((Object)(object)this); } } } } namespace LethalEmotesAPI.Utils { internal static class AssemblyUtils { public static BepInPlugin GetBepInPlugin(this Assembly assembly) { foreach (Type validType in assembly.GetValidTypes()) { BepInPlugin customAttribute = ((MemberInfo)validType).GetCustomAttribute(); if (customAttribute != null) { return customAttribute; } } return null; } public static IEnumerable GetValidTypes(this Assembly assembly) { try { return assembly.GetTypes(); } catch (ReflectionTypeLoadException ex) { return ex.Types.Where((Type type) => (object)type != null); } } } public static class Assets { private static readonly List AssetBundles = new List(); private static readonly Dictionary AssetIndices = new Dictionary(); public static void AddBundle(string assetBundleLocation) { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LethalEmotesAPI." + assetBundleLocation); AssetBundle val = AssetBundle.LoadFromStream(stream); int count = AssetBundles.Count; AssetBundles.Add(val); string[] allAssetNames = val.GetAllAssetNames(); foreach (string text in allAssetNames) { string text2 = text.ToLowerInvariant(); if (text2.StartsWith("assets/")) { text2 = text2.Remove(0, "assets/".Length); } AssetIndices[text2] = count; } } public static T Load(string assetName) where T : Object { try { assetName = assetName.ToLowerInvariant(); if (assetName.Contains(":")) { string[] array = assetName.Split(':'); assetName = array[1].ToLowerInvariant(); } if (assetName.StartsWith("assets/")) { assetName = assetName.Remove(0, "assets/".Length); } int index = AssetIndices[assetName]; return AssetBundles[index].LoadAsset("assets/" + assetName); } catch (Exception arg) { DebugClass.Log($"Couldn't load asset [{assetName}] exception: {arg}"); return default(T); } } } public class BlacklistSettings { public static List emotesExcludedFromRandom = new List(); public static List emotesDisabled = new List(); public static void RefreshBothLists() { emotesExcludedFromRandom.Clear(); emotesDisabled.Clear(); foreach (string item in emotesExcludedFromRandom) { if (!CustomEmotesAPI.randomClipList.Contains(item)) { CustomEmotesAPI.randomClipList.Add(item); } } LoadExcludeListFromBepinSex(Settings.RandomEmoteBlacklist); LoadDisabledListFromBepinSex(Settings.DisabledEmotes); } public static void AddToExcludeList(string emoteName) { emoteName = BoneMapper.GetRealAnimationName(emoteName); CustomEmotesAPI.randomClipList.Remove(emoteName); if (!emotesExcludedFromRandom.Contains(emoteName)) { emotesExcludedFromRandom.Add(emoteName); SaveExcludeListToBepinSex(Settings.RandomEmoteBlacklist); } } public static void RemoveFromExcludeList(string emoteName) { RemoveFromDisabledList(emoteName); emoteName = BoneMapper.GetRealAnimationName(emoteName); emotesExcludedFromRandom.Remove(emoteName); if (!CustomEmotesAPI.randomClipList.Contains(emoteName)) { CustomEmotesAPI.randomClipList.Add(emoteName); SaveExcludeListToBepinSex(Settings.RandomEmoteBlacklist); } } public static void LoadExcludeListFromBepinSex(ConfigEntry list) { string value = list.Value; string[] array = value.Split('ඞ'); foreach (string emoteName in array) { AddToExcludeList(emoteName); } } public static void SaveExcludeListToBepinSex(ConfigEntry list) { StringBuilder stringBuilder = new StringBuilder(); foreach (string item in emotesExcludedFromRandom) { stringBuilder.Append(item + "ඞ"); } if (stringBuilder.ToString().EndsWith('ඞ')) { stringBuilder.Remove(stringBuilder.Length - 1, 1); } list.Value = stringBuilder.ToString(); } public static void LoadDisabledListFromBepinSex(ConfigEntry list) { string value = list.Value; string[] array = value.Split('ඞ'); foreach (string emoteName in array) { AddToDisabledList(emoteName); } } public static void AddToDisabledList(string emoteName) { emoteName = BoneMapper.GetRealAnimationName(emoteName); AddToExcludeList(emoteName); if (!emotesDisabled.Contains(emoteName)) { emotesDisabled.Add(emoteName); SaveDisabledListToBepinSex(Settings.DisabledEmotes); } } public static void RemoveFromDisabledList(string emoteName) { emoteName = BoneMapper.GetRealAnimationName(emoteName); emotesDisabled.Remove(emoteName); SaveDisabledListToBepinSex(Settings.DisabledEmotes); } public static void SaveDisabledListToBepinSex(ConfigEntry list) { StringBuilder stringBuilder = new StringBuilder(); foreach (string item in emotesDisabled) { stringBuilder.Append(item + "ඞ"); } if (stringBuilder.ToString().EndsWith('ඞ')) { stringBuilder.Remove(stringBuilder.Length - 1, 1); } list.Value = stringBuilder.ToString(); } } internal static class ContentCreatorDetector { private class LinuxProcessMonitor : ProcessMonitor { private readonly FileSystemWatcher _watcher; public LinuxProcessMonitor() { _watcher = new FileSystemWatcher("z:\\proc"); _watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite; _watcher.Created += delegate(object _, FileSystemEventArgs args) { string text = ReadLinuxProcessName(args.FullPath); if (!string.IsNullOrWhiteSpace(text)) { ProcessCreated(text); } }; _watcher.EnableRaisingEvents = true; string[] runningProcesses = GetRunningProcesses(); foreach (string processName in runningProcesses) { ProcessCreated(processName); } } protected sealed override string[] GetRunningProcesses() { int result; return (from name in (from proc in Directory.GetDirectories("z:\\proc\\", "*", SearchOption.TopDirectoryOnly) where int.TryParse(proc.Split('\\').Last(), out result) select proc).Select(ReadLinuxProcessName) where !string.IsNullOrWhiteSpace(name) select name).ToArray(); } public override void Dispose() { _watcher.EnableRaisingEvents = false; _watcher.Dispose(); } private static string ReadLinuxProcessName(string procPath) { string statusContents = ReadLinuxProcStatusContents(procPath); return GetLinuxProcNameFromStatusContents(statusContents); } private static string ReadLinuxProcStatusContents(string procPath) { try { string path = procPath + "\\status"; return File.ReadAllText(path); } catch { return ""; } } private static string GetLinuxProcNameFromStatusContents(string statusContents) { try { string[] array = statusContents.Split('\n'); string[] array2 = array; foreach (string text in array2) { if (text.StartsWith("Name:")) { return text.Split(':').Last().Trim(); } } } catch { } return ""; } } private class WindowsProcessMonitor : ProcessMonitor { private readonly CancellationTokenSource _cts = new CancellationTokenSource(); private string[] _lastProcesses = Array.Empty(); public WindowsProcessMonitor() { Thread thread = new Thread(Poll); thread.Start(_cts.Token); } private void Poll(object tokenObj) { CancellationToken cancellationToken = (CancellationToken)tokenObj; while (!cancellationToken.IsCancellationRequested) { string[] runningProcesses = GetRunningProcesses(); string[] array = runningProcesses; foreach (string text in array) { if (!_lastProcesses.Contains(text)) { ProcessCreated(text); } } _lastProcesses = runningProcesses; Thread.Sleep(TimeSpan.FromSeconds(0.25)); } } protected override string[] GetRunningProcesses() { return (from name in Process.GetProcesses().Where(delegate(Process proc) { try { bool hasExited = proc.HasExited; if (hasExited) { proc.Dispose(); } return !hasExited; } catch { return false; } }).Select(delegate(Process proc) { try { string processName = proc.ProcessName; proc.Dispose(); return processName; } catch { return ""; } }) where !string.IsNullOrEmpty(name) select name).ToArray(); } public override void Dispose() { if (!_cts.IsCancellationRequested) { _cts.Cancel(); Thread.Sleep(2500); } _cts.Dispose(); } } private abstract class ProcessMonitor : IDisposable { public delegate void ProcessCreatedDelegate(string processName); public event ProcessCreatedDelegate OnProcessCreated; protected abstract string[] GetRunningProcesses(); protected void ProcessCreated(string processName) { UnityThreadScheduler.EnqueueWorkOnUnityThread(delegate { this.OnProcessCreated?.Invoke(processName); }); } public virtual void Quit() { ThreadPool.QueueUserWorkItem(delegate { Dispose(); }); } public abstract void Dispose(); } [CanBeNull] private static ProcessMonitor _processMonitor; public static void Init() { if (!Settings.dontShowDmcaPrompt.Value) { if (OnWineOrProton()) { _processMonitor = new LinuxProcessMonitor(); } else { _processMonitor = new WindowsProcessMonitor(); } _processMonitor.OnProcessCreated += ProcessMonitorOnProcessCreated; } } private static void ProcessMonitorOnProcessCreated(string processName) { if ((processName.StartsWith("obs", StringComparison.InvariantCultureIgnoreCase) || processName.Contains("xsplit", StringComparison.InvariantCultureIgnoreCase)) && _processMonitor != null) { _processMonitor.OnProcessCreated -= ProcessMonitorOnProcessCreated; _processMonitor.Dispose(); EmoteUiManager.ShowDmcaPrompt(); } } private static bool OnWineOrProton() { IntPtr moduleHandle = GetModuleHandle("ntdll.dll"); if (moduleHandle == IntPtr.Zero) { DebugClass.Log("Failed to get handle to ntdll.dll!"); return false; } IntPtr procAddress = GetProcAddress(moduleHandle, "wine_get_version"); if (procAddress != IntPtr.Zero) { return true; } DebugClass.Log("Failed to get Proc Address to wine_get_version!"); return false; } [DllImport("kernel32", CharSet = CharSet.Unicode, SetLastError = true)] private static extern IntPtr GetModuleHandle(string moduleName); [DllImport("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)] private static extern IntPtr GetProcAddress(IntPtr hModule, string procName); } internal class DebugCommands { internal static EnemyType flowerman; internal static EnemyType crawler; internal static EnemyType hoardingbug; internal static EnemyType centipede; internal static EnemyType spider; internal static EnemyType puffer; internal static EnemyType jester; internal static EnemyType blob; internal static EnemyType child; internal static EnemyType spring; internal static EnemyType nutcracker; internal static EnemyType masked; internal static EnemyType dog; internal static EnemyType worm; internal static EnemyType giant; internal static EnemyType baboonhawk; internal static EnemyType manticoil; internal static EnemyType snake; private static Hook QuickMenuManagerStartHook; private static QuickMenuManager quickMenuManagerInstance; private static BoneMapper nearestMapper; private void QuickMenuManagerStart(Action orig, QuickMenuManager self) { quickMenuManagerInstance = self; orig(self); foreach (SpawnableEnemyWithRarity enemy in self.testAllEnemiesLevel.Enemies) { RegisterEnemyType(enemy.enemyType); } foreach (SpawnableEnemyWithRarity outsideEnemy in self.testAllEnemiesLevel.OutsideEnemies) { RegisterEnemyType(outsideEnemy.enemyType); } foreach (SpawnableEnemyWithRarity daytimeEnemy in self.testAllEnemiesLevel.DaytimeEnemies) { RegisterEnemyType(daytimeEnemy.enemyType); } } internal static void RegisterEnemyType(EnemyType type) { switch (type.enemyName) { case "Flowerman": flowerman = type; break; case "Crawler": crawler = type; break; case "Hoarding bug": hoardingbug = type; break; case "Centipede": centipede = type; break; case "Bunker Spider": spider = type; break; case "Puffer": puffer = type; break; case "Jester": jester = type; break; case "Blob": blob = type; break; case "Girl": child = type; break; case "Spring": spring = type; break; case "Nutcracker": nutcracker = type; break; case "Masked": masked = type; break; case "MouthDog": dog = type; break; case "Earth Leviathan": worm = type; break; case "ForestGiant": giant = type; break; case "Baboon hawk": baboonhawk = type; break; case "Manticoil": manticoil = type; break; case "Tulip Snake": snake = type; break; } } internal static void Debugcommands() { CustomEmotesAPI.instance.SetupHook(typeof(QuickMenuManager), typeof(DebugCommands), "Start", BindingFlags.NonPublic, "QuickMenuManagerStart", QuickMenuManagerStartHook, false); CustomEmotesAPI.AddNonAnimatingEmote("spawn_shrimp"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_spider"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_loot bug"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_brackussy"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_thumper"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_slime"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_girl"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_lizard"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_nutcracker"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_coil head"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_jester"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_masked"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_dog"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_giant"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_worm"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_baboon hawk thing"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_manticoil"); CustomEmotesAPI.AddNonAnimatingEmote("spawn_snake bird"); CustomEmotesAPI.AddNonAnimatingEmote("enemies test dance"); CustomEmotesAPI.AddNonAnimatingEmote("enemies random dance"); CustomEmotesAPI.AddNonAnimatingEmote("enemies join dance"); CustomEmotesAPI.animChanged += CustomEmotesAPI_animChanged; } private static void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper) { //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0542: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_058e: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_05c4: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07c3: Unknown result type (might be due to invalid IL or missing references) switch (newAnimation) { case "spawn_shrimp": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, centipede); break; case "spawn_spider": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, spider); break; case "spawn_loot bug": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, hoardingbug); break; case "spawn_brackussy": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, flowerman); break; case "spawn_thumper": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, crawler); break; case "spawn_slime": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, blob); break; case "spawn_girl": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, child); break; case "spawn_lizard": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, puffer); break; case "spawn_nutcracker": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, nutcracker); break; case "spawn_coil head": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, spring); break; case "spawn_jester": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, jester); break; case "spawn_masked": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, masked); break; case "spawn_dog": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, dog); break; case "spawn_giant": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, giant); break; case "spawn_worm": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, worm); break; case "spawn_baboon hawk thing": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, baboonhawk); break; case "spawn_manticoil": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, manticoil); break; case "spawn_snake bird": RoundManager.Instance.SpawnEnemyGameObject(((Component)mapper).transform.position, 0f, 1, snake); break; case "enemies test dance": { foreach (BoneMapper allMapper in BoneMapper.allMappers) { if (allMapper.isEnemy) { CustomEmotesAPI.PlayAnimation("com.weliveinasociety.badasscompany__Deep Dab", allMapper); } } break; } case "enemies random dance": { foreach (BoneMapper allMapper2 in BoneMapper.allMappers) { if (allMapper2.isEnemy) { int index = Random.Range(0, CustomEmotesAPI.randomClipList.Count); CustomEmotesAPI.PlayAnimation(CustomEmotesAPI.randomClipList[index], allMapper2); } } break; } case "enemies join dance": { foreach (BoneMapper allMapper3 in BoneMapper.allMappers) { if (!allMapper3.isEnemy) { continue; } try { if (Object.op_Implicit((Object)(object)allMapper3.currentEmoteSpot) || Object.op_Implicit((Object)(object)allMapper3.reservedEmoteSpot)) { allMapper3.JoinEmoteSpot(); continue; } foreach (BoneMapper allMapper4 in BoneMapper.allMappers) { try { if ((Object)(object)allMapper4 != (Object)(object)allMapper3) { if (!Object.op_Implicit((Object)(object)nearestMapper) && (allMapper4.currentClip.syncronizeAnimation || allMapper4.currentClip.syncronizeAudio)) { nearestMapper = allMapper4; } else if (Object.op_Implicit((Object)(object)nearestMapper) && (allMapper4.currentClip.syncronizeAnimation || allMapper4.currentClip.syncronizeAudio) && Vector3.Distance(((Component)allMapper3).transform.position, ((Component)allMapper4).transform.position) < Vector3.Distance(((Component)allMapper3).transform.position, ((Component)nearestMapper).transform.position)) { nearestMapper = allMapper4; } } } catch (Exception) { } } if (Object.op_Implicit((Object)(object)nearestMapper)) { string animationName = ((!nearestMapper.currentClip.usesNewImportSystem) ? ((Object)nearestMapper.currentClip.clip[0]).name : nearestMapper.currentClip.customInternalName); CustomEmotesAPI.PlayAnimation(animationName, allMapper3); } nearestMapper = null; } catch (Exception arg) { DebugClass.Log($"had issue while attempting to join an emote as a client: {arg}\nNotable info: [nearestMapper: {nearestMapper}] [localMapper: {allMapper3}]"); try { ((object)nearestMapper.currentClip).ToString(); DebugClass.Log($"[nearestMapper.currentClip: {((object)nearestMapper.currentClip).ToString()}] [nearestMapper.currentClip.clip[0]: {nearestMapper.currentClip.clip[0]}]"); } catch (Exception) { } } } break; } } } } [DefaultExecutionOrder(-1)] public class HealthbarAnimator : MonoBehaviour { internal static int activeRequests = 0; internal static List healthbarConstraints = new List(); internal static Transform targetPoint; internal static bool permaOn = false; internal static bool setupComplete = false; internal static GameObject healthBarCameraObject; internal static void Setup(BoneMapper mapper) { //IL_0094: 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_00dc: 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) if (CustomEmotesAPI.hudObject == null || !((Object)(object)CustomEmotesAPI.hudAnimator == (Object)null)) { return; } healthBarCameraObject = Object.Instantiate(Assets.Load("assets/lethalemotesapi-ui/hud-healthbarcamera.prefab")); healthBarCameraObject.AddComponent(); healthBarCameraObject.transform.SetParent(mapper.mapperBody.transform.parent); CustomEmotesAPI.hudAnimator = healthBarCameraObject.GetComponentInChildren(); CustomEmotesAPI.hudCamera = healthBarCameraObject.GetComponentInChildren(); ((Component)CustomEmotesAPI.hudAnimator).transform.localEulerAngles = new Vector3(0f, 180f, 180f); ((Component)CustomEmotesAPI.hudAnimator).transform.localPosition = new Vector3(-822.5184f, -235.6528f, 1100f); CustomEmotesAPI.hudObject.transform.localScale = new Vector3(1.175f, 1.175f, 1.175f); CustomEmotesAPI.hudObject.transform.localPosition = new Vector3(-425.0528f, 245.3589f, -0.0136f); GameObject val = Object.Instantiate(Assets.Load("@CustomEmotesAPI_customemotespackage:assets/animationreplacements/commando.prefab")); CustomEmotesAPI.hudAnimator.runtimeAnimatorController = val.GetComponent().runtimeAnimatorController; targetPoint = ((Component)CustomEmotesAPI.hudAnimator).transform.Find("ScavengerModel/spine"); SkinnedMeshRenderer componentInChildren = ((Component)CustomEmotesAPI.hudAnimator).GetComponentInChildren(); int num = 0; healthbarConstraints.Clear(); for (int i = 0; i < mapper.basePlayerModelSMR[0].bones.Length; i++) { for (int j = num; j < componentInChildren.bones.Length; j++) { if (((Object)mapper.basePlayerModelSMR[0].bones[i]).name == ((Object)componentInChildren.bones[j]).name && !Object.op_Implicit((Object)(object)((Component)componentInChildren.bones[j]).gameObject.GetComponent())) { num = j; EmoteConstraint emoteConstraint = ((Component)componentInChildren.bones[j]).gameObject.AddComponent(); emoteConstraint.AddSource(ref componentInChildren.bones[j], ref mapper.basePlayerModelSMR[0].bones[i]); emoteConstraint.revertTransform = mapper.revertTransform; emoteConstraint.SetLocalTransforms(input: true); healthbarConstraints.Add(emoteConstraint); break; } if (j == num - 1) { break; } if (num > 0 && j == componentInChildren.bones.Length - 1) { j = -1; } } } SetHealthbarPosition(); setupComplete = true; } public static void StartHealthbarAnimateRequest() { activeRequests++; SetHealthbarPosition(); } public static void FinishHealthbarAnimateRequest() { activeRequests--; if (activeRequests < 0) { activeRequests = 0; } SetHealthbarPosition(); } internal static void SetHealthbarPosition() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (activeRequests != 0 || permaOn) { if (CustomEmotesAPI.hudObject != null) { ((Component)CustomEmotesAPI.hudAnimator).transform.localPosition = new Vector3(-822.5184f, -235.6528f, 1074.747f); try { ((Graphic)CustomEmotesAPI.baseHUDObject.GetComponent()).color = new Color(0f, 0f, 0f, 0f); } catch (Exception) { CustomEmotesAPI.baseHUDObject.SetActive(false); } CustomEmotesAPI.selfRedHUDObject.SetActive(false); } } else if (CustomEmotesAPI.hudObject != null) { ((Component)CustomEmotesAPI.hudAnimator).transform.localPosition = new Vector3(-822f, -235f, 1100f); try { ((Graphic)CustomEmotesAPI.baseHUDObject.GetComponent()).color = new Color(1f, 1f, 1f, 1f); } catch (Exception) { CustomEmotesAPI.baseHUDObject.SetActive(true); } CustomEmotesAPI.selfRedHUDObject.SetActive(true); } } private void Start() { ((MonoBehaviour)this).StartCoroutine(FixPosition()); } private IEnumerator FixPosition() { yield return (object)new WaitForEndOfFrame(); CustomEmotesAPI.hudObject.transform.localPosition = CustomEmotesAPI.baseHUDObject.transform.localPosition; ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = ""; } private void LateUpdate() { if (!setupComplete || (activeRequests == 0 && !permaOn)) { return; } foreach (EmoteConstraint healthbarConstraint in healthbarConstraints) { try { healthbarConstraint.constraintActive = true; healthbarConstraint.ActUponConstraints(); healthbarConstraint.constraintActive = false; } catch (Exception) { } } } } internal class NearestEmoterChecker : MonoBehaviour { public BoneMapper self; private void Start() { ((MonoBehaviour)this).StartCoroutine(CheckOnInterval(1f)); } private IEnumerator CheckOnInterval(float interval) { yield return (object)new WaitForSeconds(interval); if ((Settings.joinEmoteTutorial.Value || Settings.NearestEmoteText.Value) && CustomEmotesAPI.currentEmoteText != null && self.currentClipName == "none") { float closestDistance = 30f; BoneMapper nearestMapper = null; foreach (BoneMapper mapper in BoneMapper.allMappers) { try { if ((Object)(object)mapper != (Object)(object)self) { float dist = Vector3.Distance(((Component)self).transform.position, ((Component)mapper).transform.position); if (mapper.currentClip != null && mapper.currentClip.allowJoining && dist < closestDistance) { nearestMapper = mapper; closestDistance = dist; } } } catch (Exception) { } } if (nearestMapper != null) { InputBinding val = EmotesInputSettings.Instance.JoinEmote.bindings[0]; string currentJoinButton = InputControlPath.ToHumanReadableString(((InputBinding)(ref val)).effectivePath, (HumanReadableStringOptions)2, (InputControl)null); ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentJoinButton + " to join " + nearestMapper.currentClip.displayName; } else { ((TMP_Text)CustomEmotesAPI.currentEmoteText).text = ""; } } ((MonoBehaviour)this).StartCoroutine(CheckOnInterval(interval)); } } internal static class PatchUtils { internal static CodeMatcher ReturnIfInEmoteUi(this CodeMatcher matcher, bool returnABool = false) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown matcher.Advance(1); Label label = default(Label); matcher.CreateLabel(ref label); matcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PatchUtils), "EmoteWheelsOpen", (Type[])null, (Type[])null)) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Brfalse_S, (object)label) }); if (returnABool) { matcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldc_I4_1, (object)null) }); } matcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ret, (object)null) }); return matcher; } internal static CodeMatcher CloseEmoteUi(this CodeMatcher matcher) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown matcher.Advance(1); matcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(PatchUtils), "EmoteWheelsOpen", (Type[])null, (Type[])null)) }); CodeInstructionExtensions.MoveLabelsTo(matcher.Instruction, matcher.InstructionAt(-1)); Label label = default(Label); matcher.CreateLabel(ref label); matcher.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Brfalse_S, (object)label) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(EmoteUiManager), "CloseUiGracefully", (Type[])null, (Type[])null)) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ret, (object)null) }); return matcher; } private static bool EmoteWheelsOpen() { return EmoteUiManager.IsEmoteUiOpen(); } internal static CodeMatcher WriteToLog(this CodeMatcher matcher) { int pos = matcher.Pos; foreach (CodeInstruction item in matcher.InstructionEnumeration()) { DebugClass.Log(((object)item).ToString()); } matcher.Start(); matcher.Advance(pos); return matcher; } } internal static class UnityThreadScheduler { private class LethalEmotesApiThreadWorker : MonoBehaviour { [CanBeNull] private IEnumerator _processWorkQueueCoroutine; private bool _working; private void Update() { if (!UnityWorkQueue.IsEmpty && !_working) { StartProcessWorkQueue(); } } private void StartProcessWorkQueue() { if (!_working) { _working = true; if (_processWorkQueueCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_processWorkQueueCoroutine); _processWorkQueueCoroutine = null; } _processWorkQueueCoroutine = ProcessWorkQueue(); ((MonoBehaviour)this).StartCoroutine(_processWorkQueueCoroutine); } } private IEnumerator ProcessWorkQueue() { Action action; while (UnityWorkQueue.TryDequeue(out action)) { action(); yield return null; } _working = false; } } private static GameObject _instance; private static readonly ConcurrentQueue UnityWorkQueue = new ConcurrentQueue(); public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown _instance = new GameObject("LethalEmotesAPI ThreadWorker"); Object.DontDestroyOnLoad((Object)(object)_instance); ((Object)_instance).hideFlags = (HideFlags)52; _instance.AddComponent(); } public static void EnqueueWorkOnUnityThread(Action action) { UnityWorkQueue.Enqueue(action); } } } namespace LethalEmotesAPI.Patches { internal class CentipedePatches { private static Hook ClingToPlayerHook; private static Hook StopClingingToPlayerHook; private void ClingToPlayer(Action orig, CentipedeAI self, PlayerControllerB player) { orig(self, player); BoneMapper boneMapper = BoneMapper.playersToMappers[((Component)self.clingingToPlayer).gameObject]; boneMapper.canThirdPerson = false; if (boneMapper.isInThirdPerson) { boneMapper.UnlockCameraStuff(); boneMapper.LockCameraStuff(thirdPersonLock: false); } } private void StopClingingToPlayer(Action orig, CentipedeAI self, bool dead) { try { BoneMapper boneMapper = BoneMapper.playersToMappers[((Component)self.clingingToPlayer).gameObject]; boneMapper.canThirdPerson = true; if (boneMapper.temporarilyThirdPerson == TempThirdPerson.on || (boneMapper.local && boneMapper.ThirdPersonCheck())) { boneMapper.UnlockCameraStuff(); boneMapper.LockCameraStuff(thirdPersonLock: true); } } catch (Exception arg) { DebugClass.Log($"couldn't find player when removing a snare flea: {arg}"); } orig(self, dead); } private static void PatchClingToPlayer() { CustomEmotesAPI.instance.SetupHook(typeof(CentipedeAI), typeof(CentipedePatches), "ClingToPlayer", BindingFlags.NonPublic, "ClingToPlayer", ClingToPlayerHook, false); } private static void PatchStopClingingToPlayer() { CustomEmotesAPI.instance.SetupHook(typeof(CentipedeAI), typeof(CentipedePatches), "StopClingingToPlayer", BindingFlags.NonPublic, "StopClingingToPlayer", StopClingingToPlayerHook, false); } internal static void PatchAll() { PatchClingToPlayer(); PatchStopClingingToPlayer(); } } public static class HUDManagerPatches { [HarmonyPatch(typeof(HUDManager), "PingScan_performed")] public static class PingScanPerformedPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return PatchUtils.ReturnIfInEmoteUi(new CodeMatcher(instructions, generator)).InstructionEnumeration(); } } [HarmonyPatch(typeof(HUDManager), "CanPlayerScan")] public static class CanPlayerScanPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return PatchUtils.ReturnIfInEmoteUi(new CodeMatcher(instructions, generator), returnABool: true).InstructionEnumeration(); } } } internal class ModelReplacementAPICompat { internal static Hook GetViewStateHook; public static void SetupViewStateHook() { CustomEmotesAPI.instance.SetupHook(typeof(ViewStateManager), typeof(ModelReplacementAPICompat), "GetViewState", BindingFlags.Public, "GetViewState", GetViewStateHook, false); } private ViewState GetViewState(Func orig, ViewStateManager self) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (CustomEmotesAPI.localMapper != null && CustomEmotesAPI.localMapper.isInThirdPerson) { return (ViewState)1; } return orig(self); } } internal class MoreCompanyCompat { internal static bool TurnOnCosmetics(BoneMapper mapper) { //IL_0127: 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) Transform transform = ((Component)mapper.basePlayerModelAnimator).transform; CosmeticApplication component = ((Component)transform).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.spawnedCosmetics.Count != 0) { foreach (CosmeticInstance spawnedCosmetic in component.spawnedCosmetics) { Transform[] componentsInChildren = ((Component)spawnedCosmetic).gameObject.GetComponentsInChildren(); foreach (Transform val in componentsInChildren) { ((Component)val).gameObject.SetActive(true); ((Component)val).gameObject.layer = 0; } } return true; } List locallySelectedCosmetics = CosmeticRegistry.locallySelectedCosmetics; component = ((Component)transform).gameObject.AddComponent(); foreach (string item in locallySelectedCosmetics) { component.ApplyCosmetic(item, true); } foreach (CosmeticInstance spawnedCosmetic2 in component.spawnedCosmetics) { Transform transform2 = ((Component)spawnedCosmetic2).transform; transform2.localScale *= 0.38f; } return true; } internal static void TurnOffCosmetics(BoneMapper mapper) { Transform transform = ((Component)mapper.basePlayerModelAnimator).transform; CosmeticApplication[] components = ((Component)transform).GetComponents(); CosmeticApplication[] array = components; foreach (CosmeticApplication val in array) { if (!Object.op_Implicit((Object)(object)val)) { continue; } foreach (CosmeticInstance spawnedCosmetic in val.spawnedCosmetics) { ((Component)spawnedCosmetic).gameObject.layer = 23; Transform[] componentsInChildren = ((Component)spawnedCosmetic).gameObject.GetComponentsInChildren(); foreach (Transform val2 in componentsInChildren) { ((Component)val2).gameObject.layer = 23; } } } } } public static class PlayerControllerPatches { [HarmonyPatch(typeof(PlayerControllerB), "Update")] public static class UpdatePatch { public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Expected O, but got Unknown //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Expected O, but got Unknown //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[17] { new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldarg_0), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Call), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldfld), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldstr), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldc_I4_0), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Stfld), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Call), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldfld), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldstr), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldc_I4_0), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Stloc_0), (string)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldarg_0, (object)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CustomEmotesAPI), "AutoWalking", new Type[1] { typeof(PlayerControllerB) }, (Type[])null)) }); return val.InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] public static class LateUpdatePatch { public static IEnumerable Transpiler(IEnumerable instructions) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Expected O, but got Unknown //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Expected O, but got Unknown //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Expected O, but got Unknown //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Expected O, but got Unknown //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Expected O, but got Unknown //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Expected O, but got Unknown //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Expected O, but got Unknown //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null); FieldInfo localVisorFieldInfo = AccessTools.Field(typeof(PlayerControllerB), "localVisor"); FieldInfo localVisorTargetPointFieldInfo = AccessTools.Field(typeof(PlayerControllerB), "localVisorTargetPoint"); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[6] { new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.LoadsField(code, localVisorFieldInfo, false)), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.LoadsField(code, localVisorTargetPointFieldInfo, false)), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null) }); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[16] { new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.LoadsField(code, localVisorFieldInfo, false)), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.LoadsField(code, localVisorFieldInfo, false)), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.LoadsField(code, localVisorTargetPointFieldInfo, false)), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldc_R4), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Call), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldc_R4), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldc_R4), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Call), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Mul), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Call), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Callvirt), (string)null) }); val.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldarg_0, (object)null) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Ldfld, (object)localVisorFieldInfo) }).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(CustomEmotesAPI), "LocalVisor", new Type[1] { typeof(Transform) }, (Type[])null)) }); return val.InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")] public static class InteractPerformedPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return PatchUtils.ReturnIfInEmoteUi(new CodeMatcher(instructions, generator)).InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerControllerB), "ItemSecondaryUse_performed")] public static class ItemSecondaryUsePerformedPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return PatchUtils.ReturnIfInEmoteUi(new CodeMatcher(instructions, generator)).InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerControllerB), "ItemTertiaryUse_performed")] public static class ItemTertiaryUsePerformedPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return PatchUtils.ReturnIfInEmoteUi(new CodeMatcher(instructions, generator)).InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerControllerB), "ActivateItem_performed")] public static class ActivateItemPerformedPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return PatchUtils.ReturnIfInEmoteUi(new CodeMatcher(instructions, generator)).InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")] public static class ScrollMousePerformedPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return PatchUtils.ReturnIfInEmoteUi(new CodeMatcher(instructions, generator)).InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerControllerB), "InspectItem_performed")] public static class InspectItemPerformedPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return PatchUtils.ReturnIfInEmoteUi(new CodeMatcher(instructions, generator)).InstructionEnumeration(); } } [HarmonyPatch(typeof(PlayerControllerB), "OpenMenu_performed")] public static class OpenMenuPerformedPatch { public static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Expected O, but got Unknown //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Expected O, but got Unknown //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown CodeMatcher val = new CodeMatcher(instructions, generator); val.MatchForward(true, (CodeMatch[])(object)new CodeMatch[16] { new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Call), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Brfalse), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldfld), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Brtrue), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldfld), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Brfalse), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Call), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Brfalse), (string)null), new CodeMatch((Func)((CodeInstruction code) => CodeInstructionExtensions.IsLdarg(code, (int?)0)), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ldfld), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Brtrue), (string)null), new CodeMatch((Func)((CodeInstruction code) => code.opcode == OpCodes.Ret), (string)null) }); return val.CloseEmoteUi().InstructionEnumeration(); } } } } namespace LethalEmotesAPI.Patches.ModCompat { internal class AdvancedCompanyCompat { internal static Hook OpenHook; public static void SetupUpdateVisibilityHook() { CustomEmotesAPI.instance.SetupHook(typeof(MobileTerminal), typeof(AdvancedCompanyCompat), "Open", BindingFlags.Public, "Open", OpenHook, false); } private void Open(Action orig, MobileTerminal self) { if (Object.op_Implicit((Object)(object)self.Player.Controller)) { BoneMapper.playersToMappers[((Component)self.Player.Controller).gameObject].UnlockBones(); CustomEmotesAPI.PlayAnimation("none", BoneMapper.playersToMappers[((Component)self.Player.Controller).gameObject]); } orig(self); } } public class BetterEmotesCompat { public static BepInPlugin BetterEmotesPlugin = Assembly.GetAssembly(typeof(SignUI)).GetBepInPlugin(); public static void RegisterAllTooManyEmotesEmotes() { SetupBetterEmote(3, "Middle Finger"); SetupBetterEmote(4, "Clap"); SetupBetterEmote(5, "Shy"); SetupBetterEmote(6, "The Griddy"); SetupBetterEmote(7, "Twerk"); SetupBetterEmote(8, "Salute"); SetupBetterEmote(9, "Prisyadka"); SetupBetterEmote(10, "Sign"); CustomEmotesAPI.animChanged += BetterEmotesHandler; } private static void BetterEmotesHandler(string newAnimation, BoneMapper mapper) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (newAnimation.Contains("BetterEmotes__")) { if (mapper.prevClipName.Contains("TooManyEmotes__")) { TooManyEmotesCompat.StopEmote(mapper); CustomEmotesAPI.PlayAnimation(newAnimation, mapper); } else if (mapper.local) { newAnimation = newAnimation.Split("BetterEmotes__").Last(); ((MonoBehaviour)mapper).StartCoroutine(PlayBetterEmote(default(CallbackContext), newAnimation, mapper)); } } } internal static IEnumerator PlayBetterEmote(CallbackContext context, string newAnimation, BoneMapper mapper) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) mapper.canStop = false; yield return (object)new WaitForEndOfFrame(); EmoteKeybindPatch.onEmoteKeyPerformed(context, (Emote)int.Parse(newAnimation)); yield return (object)new WaitForEndOfFrame(); mapper.canStop = true; } public static void SetupBetterEmote(int num, string displayName) { CustomEmoteParams customEmoteParams = new CustomEmoteParams(); customEmoteParams.displayName = displayName; customEmoteParams.internalName = $"BetterEmotes__{num}"; customEmoteParams.rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[1]; customEmoteParams.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load("@CustomEmotesAPI_fineilldoitmyself:assets/fineilldoitmyself/BindPose.anim") }; EmoteImporter.ImportEmote(customEmoteParams); BoneMapper.animClips.Last().Value.ownerPlugin = BetterEmotesPlugin; } } public class TooManyEmotesCompat { public static BepInPlugin TMEPlugin = Assembly.GetAssembly(typeof(EmotesManager)).GetBepInPlugin(); public static void RegisterAllTooManyEmotesEmotes() { foreach (KeyValuePair item in EmotesManager.allUnlockableEmotesDict) { CustomEmoteParams customEmoteParams = new CustomEmoteParams(); customEmoteParams.displayName = item.Value.displayName; customEmoteParams.internalName = "TooManyEmotes__" + item.Key; customEmoteParams.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { item.Value.animationClip }; if (!((Motion)item.Value.animationClip).isLooping) { customEmoteParams.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load("@CustomEmotesAPI_fineilldoitmyself:assets/fineilldoitmyself/BindPose.anim") }; } customEmoteParams.visible = false; customEmoteParams.rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[1]; EmoteImporter.ImportEmote(customEmoteParams); BoneMapper.animClips.Last().Value.ownerPlugin = TMEPlugin; } CustomEmotesAPI.animChanged += TooManyEmotesHandler; } private static void TooManyEmotesHandler(string newAnimation, BoneMapper mapper) { if (!newAnimation.Contains("TooManyEmotes__")) { return; } if (mapper.prevClipName.Contains("BetterEmotes__")) { CustomEmotesAPI.PlayAnimation(newAnimation, mapper); return; } newAnimation = newAnimation.Split("TooManyEmotes__").Last(); foreach (EmoteController value in EmoteController.allEmoteControllers.Values) { if (value.IsPerformingCustomEmote() && value.performingEmote == EmotesManager.allUnlockableEmotesDict[newAnimation] && (Object)(object)((Component)value).gameObject != (Object)(object)mapper.mapperBody) { mapper.mapperBody.GetComponent().TrySyncingEmoteWithEmoteController(value, -1); return; } } if (SessionManager.IsEmoteUnlocked(EmotesManager.allUnlockableEmotesDict[newAnimation].emoteName, "")) { mapper.mapperBody.GetComponent().PerformEmote(EmotesManager.allUnlockableEmotesDict[newAnimation], -1, false); } } internal static void StopEmote(BoneMapper mapper) { mapper.mapperBody.GetComponent().StopPerformingEmote(); } public static void ReloadTooManyEmotesVisibility() { foreach (KeyValuePair item in EmotesManager.allUnlockableEmotesDict) { if (item.Value.emoteSyncGroup == null || item.Value.emoteSyncGroup.First() == item.Value) { bool flag = SessionManager.IsEmoteUnlocked(item.Value.emoteName, ""); string text = "com.weliveinasociety.CustomEmotesAPI__TooManyEmotes__" + item.Key; CustomEmotesAPI.randomClipList.Remove(text); if (flag && !BlacklistSettings.emotesExcludedFromRandom.Contains(text)) { CustomEmotesAPI.randomClipList.Add(text); } BoneMapper.animClips[text].visibility = flag; } } } } internal class VRMCompat { internal static Hook UpdateVisibilityHook; public static void SetupUpdateVisibilityHook() { CustomEmotesAPI.instance.SetupHook(typeof(LethalVRMInstance), typeof(VRMCompat), "UpdateVisibility", BindingFlags.Public, "UpdateVisibility", UpdateVisibilityHook, false); } private void UpdateVisibility(Action orig, LethalVRMInstance self) { bool flag = false; if (CustomEmotesAPI.localMapper.isInThirdPerson && ((Behaviour)CustomEmotesAPI.localMapper.playerController.gameplayCamera).enabled) { flag = true; ((Behaviour)CustomEmotesAPI.localMapper.playerController.gameplayCamera).enabled = false; } orig(self); if (flag) { ((Behaviour)CustomEmotesAPI.localMapper.playerController.gameplayCamera).enabled = true; } } } } namespace LethalEmotesAPI.ImportV2 { public class CustomEmoteParams { public AnimationClip[] primaryAnimationClips; public AnimationClip[] secondaryAnimationClips = null; public bool audioLoops; public AudioClip[] primaryAudioClips = null; public AudioClip[] secondaryAudioClips = null; public AudioClip[] primaryDMCAFreeAudioClips = null; public AudioClip[] secondaryDMCAFreeAudioClips = null; public bool stopWhenMove = false; public bool preventMovement = false; public bool visible = true; public bool syncAnim = false; public bool syncAudio = false; public int startPref = -1; public int joinPref = -1; public JoinSpot[] joinSpots = null; public string internalName = ""; public string displayName = ""; public Action customPostEventCodeSync = null; public Action customPostEventCodeNoSync = null; public AnimationClipParams.LockType lockType = AnimationClipParams.LockType.none; public bool willGetClaimedByDMCA = true; public float audioLevel = 0.5f; public bool thirdPerson = false; public HumanBodyBones[] rootBonesToIgnore = null; public HumanBodyBones[] soloBonesToIgnore = null; public bool useLocalTransforms = false; public bool nonAnimatingEmote = false; public bool allowJoining = true; public string emoteToPlayOnJoin = ""; public BepInPlugin OwnerPlugin { get; } = Assembly.GetCallingAssembly().GetBepInPlugin(); } public class EmoteImporter { public static void ImportEmote(CustomEmoteParams animationClipParams) { if (animationClipParams.internalName == "") { animationClipParams.internalName = ((Object)animationClipParams.primaryAnimationClips[0]).name; } animationClipParams.internalName = animationClipParams.OwnerPlugin.GUID + "__" + animationClipParams.internalName; if (BoneMapper.animClips.ContainsKey(animationClipParams.internalName)) { Debug.Log((object)("EmotesError: [" + animationClipParams.internalName + "] is already defined as a custom emote but is trying to be added. Skipping")); return; } if (animationClipParams.primaryAnimationClips == null || animationClipParams.primaryAnimationClips.Length == 0) { animationClipParams.nonAnimatingEmote = true; } else if (!((Motion)animationClipParams.primaryAnimationClips[0]).isHumanMotion) { Debug.Log((object)("EmotesError: [" + animationClipParams.internalName + "] is not a humanoid animation!")); return; } if (animationClipParams.rootBonesToIgnore == null) { animationClipParams.rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0]; } if (animationClipParams.soloBonesToIgnore == null) { animationClipParams.soloBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0]; } if (animationClipParams.primaryAudioClips == null) { animationClipParams.primaryAudioClips = (AudioClip[])(object)new AudioClip[1]; } if (animationClipParams.secondaryAudioClips == null) { animationClipParams.secondaryAudioClips = (AudioClip[])(object)new AudioClip[1]; } if (animationClipParams.primaryDMCAFreeAudioClips == null) { animationClipParams.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1]; } if (animationClipParams.secondaryDMCAFreeAudioClips == null) { animationClipParams.secondaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1]; } List list = new List(animationClipParams.primaryDMCAFreeAudioClips); while (list.Count != animationClipParams.primaryAudioClips.Length) { list.Add(null); } animationClipParams.primaryDMCAFreeAudioClips = list.ToArray(); list = new List(animationClipParams.secondaryDMCAFreeAudioClips); while (list.Count != animationClipParams.secondaryAudioClips.Length) { list.Add(null); } animationClipParams.secondaryDMCAFreeAudioClips = list.ToArray(); if (animationClipParams.joinSpots == null) { animationClipParams.joinSpots = new JoinSpot[0]; } CustomAnimationClip value = new CustomAnimationClip(animationClipParams.primaryAnimationClips, animationClipParams.audioLoops, animationClipParams.primaryAudioClips, animationClipParams.secondaryAudioClips, animationClipParams.rootBonesToIgnore, animationClipParams.soloBonesToIgnore, animationClipParams.secondaryAnimationClips, dimWhenClose: false, animationClipParams.stopWhenMove, stopWhenAttack: false, animationClipParams.visible, animationClipParams.syncAnim, animationClipParams.syncAudio, animationClipParams.startPref, animationClipParams.joinPref, animationClipParams.joinSpots, safePositionReset: false, animationClipParams.internalName, animationClipParams.customPostEventCodeSync, animationClipParams.customPostEventCodeNoSync, animationClipParams.lockType, animationClipParams.primaryDMCAFreeAudioClips, animationClipParams.secondaryDMCAFreeAudioClips, animationClipParams.willGetClaimedByDMCA, animationClipParams.audioLevel, animationClipParams.thirdPerson, animationClipParams.displayName, animationClipParams.OwnerPlugin, animationClipParams.useLocalTransforms, usesNewImportSystem: true, !animationClipParams.nonAnimatingEmote, animationClipParams.preventMovement, animationClipParams.allowJoining, animationClipParams.emoteToPlayOnJoin); if (animationClipParams.visible && !BlacklistSettings.emotesExcludedFromRandom.Contains(animationClipParams.internalName)) { CustomEmotesAPI.randomClipList.Add(animationClipParams.internalName); } BoneMapper.animClips.Add(animationClipParams.internalName, value); } } } namespace LethalEmotesAPI.Data { public class EmotesAPIConfigEntries { public ConfigEntry EmotesVolume; public ConfigEntry HideJoinSpots; public ConfigEntry rootMotionType; public ConfigEntry EmotesAlertEnemies; public ConfigEntry DMCAFree; public ConfigEntry thirdPersonType; public ConfigEntry StopEmoteWhenLockedToStopsEmote; public ConfigEntry EmoteWheelSetDataEntryString; public ConfigEntry EmoteWheelSetDisplayDataString; public ConfigEntry RandomEmoteBlacklist; public ConfigEntry DisabledEmotes; public ConfigEntry PermanentEmotingHealthbar; public ConfigEntry EmoteKeyBinds; public ConfigEntry ImportTME; public ConfigEntry ImportBetterEmotes; public ConfigEntry NearestEmoteText; public ConfigEntry InteractionToolTip; private ConfigFile configFile; private string sectionPrefix; public EmotesAPIConfigEntries(ConfigFile file, string sectionPrefix) { //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Expected O, but got Unknown //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Expected O, but got Unknown //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Expected O, but got Unknown //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Expected O, but got Unknown //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown HideJoinSpots = file.Bind(sectionPrefix + "Misc", "Hide Join Spots When Animating", false, "Hides all join spots when you are performing an animation, this loses some visual clarity but offers a more C I N E M A T I C experience"); rootMotionType = file.Bind(sectionPrefix + "Controls", "Camera Lock Settings", RootMotionType.Normal, "Switch head locking between all emotes, no emotes, or let each emote decide."); EmotesAlertEnemies = file.Bind(sectionPrefix + "Misc", "Emotes Alert Enemies", true, "If turned on, emotes will alert enemies like other sound sources."); EmotesVolume = file.Bind(sectionPrefix + "Controls", "Emotes Volume", 50f, "Emotes \"Should\" be controlled by Volume SFX as well, but this is a separate slider if you want a different audio balance."); DMCAFree = file.Bind(sectionPrefix + "Misc", "DMCA Free Songs", DMCAType.Normal, "0: All songs will be normal. 1: All songs will use normal/DMCA friendly depending on the import settings. 2: All songs will be muted if DMCA is listed. 3: All songs will use DMCA friendly versions or none at all"); EmoteWheelSetDataEntryString = file.Bind(sectionPrefix + "No Touch", "Emote Wheel Set Data", EmoteWheelSetData.Default().ToJson(), "Json data of emote wheel"); EmoteWheelSetDisplayDataString = file.Bind(sectionPrefix + "No Touch", "Emote Wheel Set Display Data", EmoteWheelSetDataConverter.ToJson(new EmoteWheelSetDisplayData()), "Json data of emote wheel display"); RandomEmoteBlacklist = file.Bind(sectionPrefix + "No Touch", "Blacklisted emotes", "none", "Emotes which will not show up when pressing the random emote key, probably don't want to touch this here"); DisabledEmotes = file.Bind(sectionPrefix + "No Touch", "Disabled Emotes", "", "Emotes on this list will not actually play when called to play, probably don't want to touch this here"); thirdPersonType = file.Bind(sectionPrefix + "Controls", "Third Person Settings", ThirdPersonType.Normal, "Switch third person settings between emote decides, all on, or all off"); StopEmoteWhenLockedToStopsEmote = file.Bind(sectionPrefix + "Misc", "Stop Emote When Locked Player Stops Emote", true, "If you are locked to a player for an emote (determined by emote mods themselves), you will stop emoting and unlock yourself if the other person stops emoting"); PermanentEmotingHealthbar = file.Bind(sectionPrefix + "Misc", "Permanent Healthbar Animation", false, "Keeps the fun lil guy in the top left animating at all times"); EmoteKeyBinds = file.Bind(sectionPrefix + "No Touch", "Emote Keybinds", "{}", "Emote Keybinds, don't touch it here, change in the UI"); ImportTME = file.Bind(sectionPrefix + "Misc", "Import TooManyEmotes", true, "If turned on, emotes from TooManyEmotes will also be available in LethalEmotesAPI's menus"); ImportBetterEmotes = file.Bind(sectionPrefix + "Misc", "Import BetterEmotes", true, "If turned on, emotes from BetterEmotes will also be available in LethalEmotesAPI's menus"); NearestEmoteText = file.Bind(sectionPrefix + "Misc", "Nearest Emote Text", false, "If turned on, will display the nearest joinable emote in the top left corner while not emoting"); InteractionToolTip = file.Bind(sectionPrefix + "Misc", "Interaction Tooltip", false, "If turned on, will display an interaction tooltip when looking at joinable players"); HideJoinSpots.SettingChanged += Settings.HideJoinSpots_SettingChanged; PermanentEmotingHealthbar.SettingChanged += Settings.PermanentEmotingHealthbar_SettingChanged; configFile = file; this.sectionPrefix = sectionPrefix; LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem(rootMotionType, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(EmotesVolume, new FloatSliderOptions { Min = 0f, Max = 100f, RequiresRestart = false })); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem(DMCAFree, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem(thirdPersonType, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(EmotesAlertEnemies, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(HideJoinSpots, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(StopEmoteWhenLockedToStopsEmote, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(PermanentEmotingHealthbar, false)); } public void CopyFromConfig(EmotesAPIConfigEntries sourceConfig) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown foreach (ConfigDefinition key in sourceConfig.configFile.Keys) { ConfigDefinition val = new ConfigDefinition(sectionPrefix + key.Section, key.Key); if (configFile.ContainsKey(val)) { configFile[val].SetSerializedValue(sourceConfig.configFile[key].GetSerializedValue()); } } } } internal static class EmoteWheelSetDataConverter { internal static string ToJson(this EmoteWheelSetData data) { return JsonConvert.SerializeObject((object)data, (Formatting)0); } internal static EmoteWheelSetData EmoteWheelSetDataFromJson(string text) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown return (EmoteWheelSetData)JsonConvert.DeserializeObject(text, typeof(EmoteWheelSetData)); } internal static string ToJson(this EmoteWheelSetDisplayData data) { return JsonConvert.SerializeObject((object)data, (Formatting)0); } internal static EmoteWheelSetDisplayData EmoteWheelSetDisplayDataFromJson(string text) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown return (EmoteWheelSetDisplayData)JsonConvert.DeserializeObject(text, typeof(EmoteWheelSetDisplayData)); } } public static class Keybinds { private static InputActionAsset _inputActionAsset; private static readonly InputActionMap ActionMap = new InputActionMap("LethalEmotesAPI Emote Keybinds"); public static Dictionary keyBindOverrideStorage = new Dictionary(); private static readonly Dictionary InputRefs = new Dictionary(); public static void LoadKeybinds() { if (_inputActionAsset == null) { _inputActionAsset = ScriptableObject.CreateInstance(); InputActionSetupExtensions.AddActionMap(_inputActionAsset, ActionMap); } keyBindOverrideStorage = (Dictionary)JsonConvert.DeserializeObject(Settings.EmoteKeyBinds.Value, typeof(Dictionary)); if (keyBindOverrideStorage == null) { return; } foreach (var (key, text3) in keyBindOverrideStorage) { if (InputRefs.TryGetValue(key, out var value)) { InputActionRebindingExtensions.RemoveAllBindingOverrides(value.action); InputActionRebindingExtensions.ApplyBindingOverride(value.action, text3, (string)null, (string)null); } } } public static void SaveKeybinds() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair inputRef in InputRefs) { inputRef.Deconstruct(out var key, out var value); string key2 = key; InputActionReference val = value; Dictionary dictionary = keyBindOverrideStorage; InputBinding val2 = val.action.bindings[0]; dictionary[key2] = ((InputBinding)(ref val2)).effectivePath; } keyBindOverrideStorage = keyBindOverrideStorage.Where((KeyValuePair kvp) => !string.IsNullOrEmpty(kvp.Value)).ToDictionary((KeyValuePair kvp) => kvp.Key, (KeyValuePair kvp) => kvp.Value); Settings.EmoteKeyBinds.Value = JsonConvert.SerializeObject((object)keyBindOverrideStorage); } public static void FullReloadKeybinds() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) LoadKeybinds(); Enumerator enumerator = ActionMap.actions.GetEnumerator(); try { while (enumerator.MoveNext()) { InputAction current = enumerator.Current; InputActionRebindingExtensions.RemoveAllBindingOverrides(current); if (keyBindOverrideStorage.ContainsKey(current.name)) { InputActionRebindingExtensions.ApplyBindingOverride(current, keyBindOverrideStorage[current.name], (string)null, (string)null); } } } finally { ((IDisposable)enumerator).Dispose(); } } internal static InputActionReference GetOrCreateInputRef(string actionId) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (InputRefs.TryGetValue(actionId, out var value)) { return value; } InputAction val = InputActionSetupExtensions.AddAction(ActionMap, actionId, (InputActionType)0, (string)null, (string)null, (string)null, (string)null, (string)null); InputActionSetupExtensions.AddBinding(val, "", (string)null, (string)null, (string)null); value = InputActionReference.Create(val); InputRefs[actionId] = value; return value; } internal static void EnableKeybinds() { ActionMap.Enable(); } internal static void DisableKeybinds() { ActionMap.Disable(); } internal static string[] GetEmoteKeysForBindPath(string bindPath) { return (from kvp in keyBindOverrideStorage where string.Equals(kvp.Value, bindPath, StringComparison.InvariantCultureIgnoreCase) select kvp.Key).ToArray(); } } } namespace LethalEmotesAPI.Core { public class BoneRef : MonoBehaviour { public Transform target; } internal class EnemySkeletons { private static Hook MaskedPlayerEnemyStartHook; private static Hook EnemyAIStartHook; internal IEnumerator AttachCoilHeadSpring(Transform head, BoneMapper b) { yield return (object)new WaitForEndOfFrame(); yield return (object)new WaitForEndOfFrame(); yield return (object)new WaitForEndOfFrame(); yield return (object)new WaitForEndOfFrame(); Transform t = ((Component)b).GetComponentInChildren().GetBoneTransform((HumanBodyBones)10).Find("springBone.002") .Find("springBone.002_end"); GameObject g = new GameObject(); g.transform.SetParent(t); g.transform.localPosition = Vector3.zero; g.transform.localEulerAngles = new Vector3(-90f, 0f, 0f); b.additionalConstraints.Add(EmoteConstraint.AddConstraint(((Component)head).gameObject, b, g.transform, needToFix: true)); } internal IEnumerator SetupMaskedEmoteSkeletonAfterAFewFrames(MaskedPlayerEnemy self) { yield return (object)new WaitForEndOfFrame(); AnimationReplacements.Import(((Component)self).gameObject, "assets/customstuff/scavEmoteSkeleton.prefab", new int[1]); } internal IEnumerator SetupSkeletonAfterFrame(GameObject g, string prefab, int[] pos) { yield return (object)new WaitForEndOfFrame(); AnimationReplacements.Import(g, prefab, pos); } private void MaskedPlayerEnemyStart(Action orig, MaskedPlayerEnemy self) { ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupMaskedEmoteSkeletonAfterAFewFrames(self)); orig(self); } internal IEnumerator SetupSkeleton(EnemyAI self) { yield return (object)new WaitForEndOfFrame(); try { switch (self.enemyType.enemyName) { case "Bunker Spider": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/sandspider4.prefab", new int[1]).scale = 1.6f; break; case "Hoarding bug": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/hoarderbug.prefab", new int[1]).scale = 1.1f; break; case "Manticoil": break; case "Earth Leviathan": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/sandworm1.prefab", new int[1]); break; case "Crawler": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/crawler3.prefab", new int[1]); break; case "Blob": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/blob1.prefab", new int[1]); break; case "Centipede": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/centipede1.prefab", new int[1]); break; case "Nutcracker": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/nutcracker3.prefab", new int[1]); break; case "Baboon hawk": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/baboonhawk1.prefab", new int[1]); break; case "Puffer": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/pufferenemy.prefab", new int[1]); break; case "Spring": { AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/springman4.prefab", new int[1]); BoneMapper b = ((Component)self).GetComponentInChildren(); Transform head = ((Component)self).transform.Find("SpringManModel").Find("Head"); ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(AttachCoilHeadSpring(head, b)); break; } case "Jester": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/jester2.prefab", new int[3] { 0, 1, 2 }).scale = 1.3f; break; case "Flowerman": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/flowerman1.prefab", new int[1]).scale = 1.6f; break; case "Girl": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/dressgirl.prefab", new int[1]); break; case "MouthDog": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/mouthdog3.prefab", new int[1]); break; case "ForestGiant": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/giant5.prefab", new int[1]); break; case "Why Does The Masked Not Call The Base Start Function :(": break; case "Shy guy": AnimationReplacements.Import(((Component)self).gameObject, "assets/fineilldoitmyself/shyguy.prefab", new int[1]); break; case "SkibidiToilet": AnimationReplacements.Import(((Component)self).gameObject, "assets/fineilldoitmyself/skibidi.prefab", new int[1]); break; case "Demogorgon": AnimationReplacements.Import(((Component)self).gameObject, "assets/fineilldoitmyself/DemoGorgon13.prefab", new int[4] { 0, 1, 2, 3 }); break; case "Peeper": AnimationReplacements.Import(((Component)self).gameObject, "assets/fineilldoitmyself/Peeper2.prefab", new int[1]); break; case "RadMech": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/Mech1.prefab", new int[1]); break; case "Butler": AnimationReplacements.Import(((Component)self).gameObject, "assets/enemyskeletons/Butler.prefab", new int[1]); break; case "Tulip Snake": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/enemyskeletons/TulipSnake.prefab", new int[1] { 3 })); break; case "HarpGhost": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/Ghost1.prefab", new int[1])); break; case "EnforcerGhost": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/Ghost1.prefab", new int[1])); break; case "BagpipeGhost": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/Ghost1.prefab", new int[1])); break; case "SlendermanEnemy": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/Slender3.prefab", new int[1])); break; case "RedWoodGiant": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/XuGiant.prefab", new int[1] { 10 })); break; case "DriftWoodGiant": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/Driftwood.prefab", new int[1])); break; case "Foxy": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/Foxy4.prefab", new int[1])); break; case "The Fiend": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/Fiend1.prefab", new int[1])); break; case "Siren Head": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/SirenHead2.prefab", new int[1])); break; case "Football": ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeletonAfterFrame(((Component)self).gameObject, "assets/fineilldoitmyself/NewSet/Football.prefab", new int[1])); break; } } catch (Exception) { DebugClass.Log("couldn't setup an enemy?"); } } private void EnemyAIStart(Action orig, EnemyAI self) { if (CustomEmotesAPI.localMapper != null) { ((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(SetupSkeleton(self)); } orig(self); } internal static void SetupEnemyHooks() { CustomEmotesAPI.instance.SetupHook(typeof(EnemyAI), typeof(EnemySkeletons), "Start", BindingFlags.Public, "EnemyAIStart", EnemyAIStartHook, false); CustomEmotesAPI.instance.SetupHook(typeof(MaskedPlayerEnemy), typeof(EnemySkeletons), "Start", BindingFlags.Public, "MaskedPlayerEnemyStart", MaskedPlayerEnemyStartHook, false); } } } namespace EmotesAPI { public class AnimationClipParams { public enum LockType { none, headBobbing, lockHead, rootMotion } public AnimationClip[] animationClip; public AnimationClip[] secondaryAnimation = null; public bool looping; public AudioClip[] _primaryAudioClips = null; public AudioClip[] _secondaryAudioClips = null; public AudioClip[] _primaryDMCAFreeAudioClips = null; public AudioClip[] _secondaryDMCAFreeAudioClips = null; public HumanBodyBones[] rootBonesToIgnore = null; public HumanBodyBones[] soloBonesToIgnore = null; public bool dimWhenClose = false; public bool stopWhenMove = false; public bool stopWhenAttack = false; public bool visible = true; public bool syncAnim = false; public bool syncAudio = false; public int startPref = -1; public int joinPref = -1; public JoinSpot[] joinSpots = null; public bool useSafePositionReset = false; public string customName = ""; public Action customPostEventCodeSync = null; public Action customPostEventCodeNoSync = null; public LockType lockType = LockType.none; public bool willGetClaimedByDMCA = false; public float audioLevel = 0.5f; public bool thirdPerson = false; public string displayName = ""; public bool useLocalTransforms = false; public BepInPlugin OwnerPlugin { get; } = Assembly.GetCallingAssembly().GetBepInPlugin(); } [BepInPlugin("com.weliveinasociety.CustomEmotesAPI", "Custom Emotes API", "1.11.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class CustomEmotesAPI : BaseUnityPlugin { public struct NameTokenWithSprite { public string nameToken; public Sprite sprite; } public delegate void AnimationChanged(string newAnimation, BoneMapper mapper); public delegate void JoinedEmoteSpotBody(GameObject emoteSpot, BoneMapper joiner, BoneMapper host); public delegate void JoinedEmoteSpotProp(GameObject emoteSpot, BoneMapper joiner, BoneMapper host); public delegate void AnimationJoined(string joinedAnimation, BoneMapper joiner, BoneMapper host); public delegate void BoneMapperCreated(BoneMapper mapper); public delegate void BoneMapperEnteredJoinSpot(BoneMapper mover, BoneMapper joinSpotOwner); public delegate void EmoteWheelPulledUp(Sprite wheelSprite, BoneMapper localMapper); public const string PluginGUID = "com.weliveinasociety.CustomEmotesAPI"; public const string PluginName = "Custom Emotes API"; public const string VERSION = "1.11.4"; public static List nameTokenSpritePairs = new List(); public static List randomClipList = new List(); public static bool LCThirdPersonPresent; public static bool ModelReplacementAPIPresent; public static bool MoreCompanyPresent; public static bool VRMPresent; public static bool AdvancedCompanyPresent; public static bool TMEPresent; public static bool BetterEmotesPresent; internal static float Actual_MSX = 69f; public static CustomEmotesAPI instance; private static Hook playerControllerStartHook; public static List networkedObjects = new List(); private static Hook networkManagerStartHook; private static Hook startOfRoundUpdateHook; public static Animator hudAnimator; public static GameObject hudObject; public static GameObject baseHUDObject; public static GameObject selfRedHUDObject; public static TextMeshProUGUI currentEmoteText; public static Camera hudCamera; private static Hook hudManagerAwakeHook; private static Hook hudManagerUpdateHealthUIHook; private static Hook startOfRoundOnPlayerDCHook; private static Hook BeginUsingTerminalHook; private static Hook TeleportPlayerHook; private static Hook PlayerLookInputHook; private static Hook CalculateSmoothLookingInputHook; private static Hook CalculateNormalLookingInputHook; private static Hook SetHoverTipAndCurrentInteractTriggerHook; private static Hook GrabbableObjectLateUpdateHook; private static Hook StartPerformingEmoteClientRpcHook; private static Hook StopPerformingEmoteClientRpcHook; private static Hook Jump_performedHook; private static Hook ConnectClientToPlayerObjectHook; private static GameObject emoteNetworker; private bool lockingForMouseInput = false; private bool yote = true; public static BoneMapper localMapper = null; private static BoneMapper nearestMapper = null; private static int requestCounter = 0; public static event AnimationChanged animChanged; public static event JoinedEmoteSpotBody emoteSpotJoined_Body; public static event JoinedEmoteSpotProp emoteSpotJoined_Prop; public static event AnimationJoined animJoined; public static event BoneMapperCreated boneMapperCreated; public static event BoneMapperEnteredJoinSpot boneMapperEnteredJoinSpot; public static event EmoteWheelPulledUp emoteWheelPulledUp; public static bool CreateNameTokenSpritePair(string nameToken, Sprite sprite) { NameTokenWithSprite item = default(NameTokenWithSprite); item.nameToken = nameToken; item.sprite = sprite; if (nameTokenSpritePairs.Contains(item)) { return false; } nameTokenSpritePairs.Add(item); return true; } private void CreateBaseNameTokenPairs() { } internal static void LoadResource(string resource) { Assets.AddBundle(resource ?? ""); } [Obsolete("Does nothing, but not removing to not brick stuff")] public static void BlackListEmote(string name) { } internal static bool GetKey(ConfigEntry entry) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) KeyboardShortcut value = entry.Value; foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } value = entry.Value; return Input.GetKey(((KeyboardShortcut)(ref value)).MainKey); } internal static bool GetKeyPressed(ConfigEntry entry) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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) KeyboardShortcut value = entry.Value; foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } value = entry.Value; return Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey); } private void PlayerControllerStart(Action orig, PlayerControllerB self) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GameObject val = new GameObject(); ((MonoBehaviour)val.AddComponent()).StartCoroutine(ImportPlayerSkeleton(self)); orig(self); if (((NetworkBehaviour)self).IsServer && (Object)(object)EmoteNetworker.instance == (Object)null) { GameObject val2 = Object.Instantiate(emoteNetworker); val2.GetComponent().Spawn(true); } } private IEnumerator ImportPlayerSkeleton(PlayerControllerB player) { yield return (object)new WaitForEndOfFrame(); int SMR1 = 0; int SMR2 = 0; for (int i = 0; i < ((Component)player).gameObject.GetComponentsInChildren().Length; i++) { if ((Object)(object)((Component)player).gameObject.GetComponentsInChildren()[i] == (Object)(object)player.thisPlayerModelLOD1) { SMR1 = i; } else if ((Object)(object)((Component)player).gameObject.GetComponentsInChildren()[i] == (Object)(object)player.thisPlayerModelArms) { SMR2 = i; } } AnimationReplacements.Import(((Component)player).gameObject, "assets/customstuff/scavEmoteSkeleton.prefab", new int[2] { SMR1, SMR2 }); } private void NetworkManagerStart(Action orig, GameNetworkManager self) { try { Keybinds.SaveKeybinds(); emoteNetworker = Assets.Load("assets/customstuff/emoteNetworker.prefab"); emoteNetworker.AddComponent(); ((Component)GameNetworkManager.Instance).GetComponent().AddNetworkPrefab(emoteNetworker); foreach (GameObject networkedObject in networkedObjects) { ((Component)GameNetworkManager.Instance).GetComponent().AddNetworkPrefab(networkedObject); } } catch (Exception) { DebugClass.Log("Couldn't setup LethalEmotesAPI's networker"); } try { LethalEmotesUiState.FixLegacyEmotes(); } catch (Exception) { DebugClass.Log("Couldn't fix legacy emotes"); } orig(self); } private void StartOfRoundUpdate(Action orig, StartOfRound self) { orig(self); AudioFunctions(); } private void HUDManagerAwake(Action orig, HUDManager self) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) orig(self); Transform val = ((Component)self.PlayerInfo.canvasGroup).transform.Find("Self"); if (val != null) { hudObject = Object.Instantiate(Assets.Load("assets/lethalemotesapi-ui/hud-healthbarimage.prefab")); hudObject.transform.SetParent(((Component)self.PlayerInfo.canvasGroup).transform); baseHUDObject = ((Component)((Component)self.PlayerInfo.canvasGroup).transform.Find("Self")).gameObject; selfRedHUDObject = ((Component)((Component)self.PlayerInfo.canvasGroup).transform.Find("SelfRed")).gameObject; currentEmoteText = hudObject.GetComponentInChildren(); hudObject.transform.localPosition = baseHUDObject.transform.localPosition; } GameObject val2 = Object.Instantiate(Assets.Load("assets/emote ui.prefab"), ((Component)self.PlayerInfo.canvasGroup).transform.parent.parent); } private void HUDManagerUpdateHealthUI(Action orig, HUDManager self, int health, bool hurtPlayer = true) { orig(self, health, hurtPlayer); if (hudObject != null) { try { hudObject.GetComponent().GetMaterial(0).SetFloat("_HealthPercentage", (float)health / 100f); } catch (Exception) { } } } private void StartOfRoundOnPlayerDC(Action orig, StartOfRound self, int playerObjectNumber, ulong clientId) { PlayerControllerB component = self.allPlayerObjects[playerObjectNumber].GetComponent(); PlayAnimation("none", ((Component)component).GetComponentInChildren()); orig(self, playerObjectNumber, clientId); } private void BeginUsingTerminal(Action orig, Terminal self) { if (localMapper != null) { localMapper.UnlockBones(); } orig(self); InTerminal(); } private void TeleportPlayer(Action orig, PlayerControllerB self, Vector3 pos, bool withRotation = false, float rot = 0f, bool allowInteractTrigger = false, bool enableController = true) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) BoneMapper componentInChildren = ((Component)self).GetComponentInChildren(); if (Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren.parentGameObject) && componentInChildren.positionLock) { componentInChildren.preserveParent = false; PlayAnimation("none", componentInChildren); } orig(self, pos, withRotation, rot, allowInteractTrigger, enableController); } private void PlayerLookInput(Action orig, PlayerControllerB self) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00b4: 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) float y = self.thisPlayerBody.eulerAngles.y; orig(self); if (localMapper != null && (localMapper.isInThirdPerson || (localMapper.currentClip != null && localMapper.currentClip.preventsMovement))) { Transform transform = localMapper.rotationPoint.transform; transform.eulerAngles += new Vector3(0f, self.thisPlayerBody.eulerAngles.y - y, 0f); self.thisPlayerBody.eulerAngles = new Vector3(self.thisPlayerBody.eulerAngles.x, y, self.thisPlayerBody.eulerAngles.z); } } private void CalculateSmoothLookingInput(Action orig, PlayerControllerB self, Vector2 inputVector) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_0108: 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) orig(self, inputVector); if (localMapper != null && localMapper.isInThirdPerson) { ((Component)self.gameplayCamera).transform.localEulerAngles = new Vector3(Mathf.LerpAngle(((Component)self.gameplayCamera).transform.localEulerAngles.x, 0f, self.smoothLookMultiplier * Time.deltaTime), 0f, ((Component)self.gameplayCamera).transform.localEulerAngles.z); float x = localMapper.rotationPoint.transform.localEulerAngles.x; x -= inputVector.y; x = ((!(x > 200f)) ? Mathf.Clamp(x, x, 85f) : Mathf.Clamp(x, 275f, x)); localMapper.rotationPoint.transform.localEulerAngles = new Vector3(x, localMapper.rotationPoint.transform.localEulerAngles.y, localMapper.rotationPoint.transform.localEulerAngles.z); } } private void CalculateNormalLookingInput(Action orig, PlayerControllerB self, Vector2 inputVector) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00fd: Unknown result type (might be due to invalid IL or missing references) orig(self, inputVector); try { if (localMapper != null && localMapper.isInThirdPerson) { ((Component)self.gameplayCamera).transform.localEulerAngles = new Vector3(0f, ((Component)self.gameplayCamera).transform.localEulerAngles.y, ((Component)self.gameplayCamera).transform.localEulerAngles.z); float x = localMapper.rotationPoint.transform.localEulerAngles.x; x -= inputVector.y; x = ((!(x > 200f)) ? Mathf.Clamp(x, x, 85f) : Mathf.Clamp(x, 275f, x)); localMapper.rotationPoint.transform.localEulerAngles = new Vector3(x, localMapper.rotationPoint.transform.localEulerAngles.y, localMapper.rotationPoint.transform.localEulerAngles.z); } } catch (Exception) { } } private void SetHoverTipAndCurrentInteractTrigger(Action orig, PlayerControllerB self) { if (localMapper != null && localMapper.thirdPersonConstraint != null) { localMapper.thirdPersonConstraint.ActUponConstraints(); } orig(self); } private void GrabbableObjectLateUpdate(Action orig, GrabbableObject self) { try { if (self.playerHeldBy != null) { BoneMapper boneMapper = BoneMapper.playersToMappers[((Component)self.playerHeldBy).gameObject]; if (boneMapper.emoteSkeletonAnimator != null && ((Behaviour)boneMapper.emoteSkeletonAnimator).enabled) { foreach (EmoteConstraint itemHolderConstraint in boneMapper.itemHolderConstraints) { itemHolderConstraint.ActUponConstraints(); } } } } catch (Exception) { } orig(self); } private void StartPerformingEmoteClientRpc(Action orig, PlayerControllerB self) { orig(self); try { BoneMapper boneMapper = BoneMapper.playersToMappers[((Component)self).gameObject]; if (((Behaviour)boneMapper.emoteSkeletonAnimator).enabled && (boneMapper.currentClip == null || (!boneMapper.currentClip.rootIgnoredBones.Contains((HumanBodyBones)0) && boneMapper.currentClip.animates))) { boneMapper.PlayAnim("none", -1); } } catch (Exception arg) { DebugClass.Log($"couldn't find bonemapper? {arg}"); } } private void StopPerformingEmoteClientRpc(Action orig, PlayerControllerB self) { orig(self); try { BoneMapper boneMapper = BoneMapper.playersToMappers[((Component)self).gameObject]; if (((Behaviour)boneMapper.emoteSkeletonAnimator).enabled && boneMapper.canStop && (boneMapper.currentClipName.Contains("__BetterEmotes") || boneMapper.currentClipName.Contains("TooManyEmotes__"))) { boneMapper.PlayAnim("none", -1); } } catch (Exception arg) { DebugClass.Log($"couldn't find bonemapper? {arg}"); } } private void Jump_performed(Action orig, PlayerControllerB self, CallbackContext context) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) try { if (localMapper != null && (Object)(object)localMapper.playerController == (Object)(object)self && localMapper.currentClip != null && localMapper.currentClip.preventsMovement) { return; } } catch (Exception arg) { DebugClass.Log($"EmotesAPI: {arg}"); } orig(self, context); } private void ConnectClientToPlayerObject(Action orig, PlayerControllerB self) { orig(self); ((MonoBehaviour)self).StartCoroutine(ReloadTMEAfterFrame(self)); } private IEnumerator ReloadTMEAfterFrame(PlayerControllerB self) { yield return (object)new WaitForSeconds(1f); if (TMEPresent) { TooManyEmotesCompat.ReloadTooManyEmotesVisibility(); } } internal static void AutoWalking(PlayerControllerB player) { //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_0059: 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_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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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) if (!((Object)(object)player == (Object)(object)StartOfRound.Instance.localPlayerController) || player == null || localMapper == null) { return; } if (localMapper.currentClip != null && localMapper.currentClip.preventsMovement) { player.moveInputVector = Vector2.zeroVector; return; } bool flag = (BoneMapper.moving = player.moveInputVector != Vector2.zero); if (localMapper.autoWalkSpeed != 0f) { if (localMapper.overrideMoveSpeed) { player.moveInputVector *= localMapper.autoWalkSpeed; } else { player.moveInputVector = new Vector2(0f, localMapper.autoWalkSpeed); } } if (flag && localMapper.ThirdPersonCheck()) { player.thisPlayerBody.eulerAngles = new Vector3(player.thisPlayerBody.eulerAngles.x, localMapper.rotationPoint.transform.eulerAngles.y, player.thisPlayerBody.eulerAngles.z); localMapper.rotationPoint.transform.eulerAngles = new Vector3(localMapper.rotationPoint.transform.eulerAngles.x, player.thisPlayerBody.eulerAngles.y, 0f); } } internal static void LocalVisor(Transform transform) { if (localMapper == null || localMapper.currentClip == null) { return; } foreach (EmoteConstraint cameraConstraint in localMapper.cameraConstraints) { cameraConstraint.ActUponConstraints(); } } public void SetupHook(Type targetClass, Type destClass, string targetMethodName, BindingFlags publicOrNot, string destMethodName, Hook hook, bool isStatic = false, params Type[] paramTypes) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown MethodInfo methodInfo; MethodInfo method; if (isStatic) { methodInfo = targetClass.GetMethods(publicOrNot | BindingFlags.Static).FirstOrDefault((MethodInfo x) => x.Name.Equals(targetMethodName) && x.GetParameters().All((ParameterInfo p) => paramTypes.Contains(p.ParameterType))); method = destClass.GetMethod(destMethodName, BindingFlags.Static | BindingFlags.NonPublic); } else { methodInfo = targetClass.GetMethod(targetMethodName, publicOrNot | BindingFlags.Instance); method = destClass.GetMethod(destMethodName, BindingFlags.Instance | BindingFlags.NonPublic); } hook = new Hook((MethodBase)methodInfo, method, (object)this); } public void Awake() { //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Expected O, but got Unknown //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Expected O, but got Unknown //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Expected O, but got Unknown //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f9: Expected O, but got Unknown //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Expected O, but got Unknown instance = this; DebugClass.SetLogger(((BaseUnityPlugin)this).Logger); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.weliveinasociety.CustomEmotesAPI"); LoadResource("customemotespackage"); LoadResource("fineilldoitmyself"); LoadResource("enemyskeletons"); LoadResource("scavbody"); LoadResource("customemotes-ui"); LCThirdPersonPresent = Chainloader.PluginInfos.ContainsKey("LCThirdPerson"); ModelReplacementAPIPresent = Chainloader.PluginInfos.ContainsKey("meow.ModelReplacementAPI"); MoreCompanyPresent = Chainloader.PluginInfos.ContainsKey("me.swipez.melonloader.morecompany"); VRMPresent = Chainloader.PluginInfos.ContainsKey("Ooseykins.LethalVRM"); AdvancedCompanyPresent = Chainloader.PluginInfos.ContainsKey("com.potatoepet.AdvancedCompany"); TMEPresent = Chainloader.PluginInfos.ContainsKey("FlipMods.TooManyEmotes"); BetterEmotesPresent = Chainloader.PluginInfos.ContainsKey("BetterEmotes"); LoadResource("moisture_animationreplacements"); Settings.RunAll(); BlacklistSettings.LoadExcludeListFromBepinSex(Settings.RandomEmoteBlacklist); BlacklistSettings.LoadDisabledListFromBepinSex(Settings.DisabledEmotes); Keybinds.LoadKeybinds(); MethodInfo method = typeof(PlayerControllerB).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic); MethodInfo method2 = typeof(CustomEmotesAPI).GetMethod("PlayerControllerStart", BindingFlags.Instance | BindingFlags.NonPublic); playerControllerStartHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(GameNetworkManager).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic); method2 = typeof(CustomEmotesAPI).GetMethod("NetworkManagerStart", BindingFlags.Instance | BindingFlags.NonPublic); networkManagerStartHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(StartOfRound).GetMethod("Update", BindingFlags.Instance | BindingFlags.NonPublic); method2 = typeof(CustomEmotesAPI).GetMethod("StartOfRoundUpdate", BindingFlags.Instance | BindingFlags.NonPublic); startOfRoundUpdateHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(HUDManager).GetMethod("Awake", BindingFlags.Instance | BindingFlags.NonPublic); method2 = typeof(CustomEmotesAPI).GetMethod("HUDManagerAwake", BindingFlags.Instance | BindingFlags.NonPublic); hudManagerAwakeHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(HUDManager).GetMethod("UpdateHealthUI", BindingFlags.Instance | BindingFlags.Public); method2 = typeof(CustomEmotesAPI).GetMethod("HUDManagerUpdateHealthUI", BindingFlags.Instance | BindingFlags.NonPublic); hudManagerUpdateHealthUIHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(StartOfRound).GetMethod("OnPlayerDC", BindingFlags.Instance | BindingFlags.Public); method2 = typeof(CustomEmotesAPI).GetMethod("StartOfRoundOnPlayerDC", BindingFlags.Instance | BindingFlags.NonPublic); startOfRoundOnPlayerDCHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(Terminal).GetMethod("BeginUsingTerminal", BindingFlags.Instance | BindingFlags.Public); method2 = typeof(CustomEmotesAPI).GetMethod("BeginUsingTerminal", BindingFlags.Instance | BindingFlags.NonPublic); BeginUsingTerminalHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(PlayerControllerB).GetMethod("TeleportPlayer", BindingFlags.Instance | BindingFlags.Public); method2 = typeof(CustomEmotesAPI).GetMethod("TeleportPlayer", BindingFlags.Instance | BindingFlags.NonPublic); TeleportPlayerHook = new Hook((MethodBase)method, method2, (object)this); method = typeof(PlayerControllerB).GetMethod("PlayerLookInput", BindingFlags.Instance | BindingFlags.NonPublic); method2 = typeof(CustomEmotesAPI).GetMethod("PlayerLookInput", BindingFlags.Instance | BindingFlags.NonPublic); PlayerLookInputHook = new Hook((MethodBase)method, method2, (object)this); SetupHook(typeof(PlayerControllerB), typeof(CustomEmotesAPI), "CalculateSmoothLookingInput", BindingFlags.NonPublic, "CalculateSmoothLookingInput", CalculateSmoothLookingInputHook, false); SetupHook(typeof(PlayerControllerB), typeof(CustomEmotesAPI), "CalculateNormalLookingInput", BindingFlags.NonPublic, "CalculateNormalLookingInput", CalculateNormalLookingInputHook, false); SetupHook(typeof(PlayerControllerB), typeof(CustomEmotesAPI), "SetHoverTipAndCurrentInteractTrigger", BindingFlags.NonPublic, "SetHoverTipAndCurrentInteractTrigger", SetHoverTipAndCurrentInteractTriggerHook, false); if (ModelReplacementAPIPresent) { ModelReplacementAPICompat.SetupViewStateHook(); } SetupHook(typeof(GrabbableObject), typeof(CustomEmotesAPI), "LateUpdate", BindingFlags.Public, "GrabbableObjectLateUpdate", GrabbableObjectLateUpdateHook, false); SetupHook(typeof(PlayerControllerB), typeof(CustomEmotesAPI), "StartPerformingEmoteClientRpc", BindingFlags.Public, "StartPerformingEmoteClientRpc", StartPerformingEmoteClientRpcHook, false); SetupHook(typeof(PlayerControllerB), typeof(CustomEmotesAPI), "Jump_performed", BindingFlags.NonPublic, "Jump_performed", Jump_performedHook, false); SetupHook(typeof(PlayerControllerB), typeof(CustomEmotesAPI), "StopPerformingEmoteClientRpc", BindingFlags.Public, "StopPerformingEmoteClientRpc", StopPerformingEmoteClientRpcHook, false); SetupHook(typeof(PlayerControllerB), typeof(CustomEmotesAPI), "ConnectClientToPlayerObject", BindingFlags.Public, "ConnectClientToPlayerObject", ConnectClientToPlayerObjectHook, false); CentipedePatches.PatchAll(); if (VRMPresent) { VRMCompat.SetupUpdateVisibilityHook(); } if (AdvancedCompanyPresent) { AdvancedCompanyCompat.SetupUpdateVisibilityHook(); } EnemySkeletons.SetupEnemyHooks(); AnimationReplacements.RunAll(); CreateBaseNameTokenPairs(); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { try { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } catch (Exception) { } } EmoteUiManager.RegisterStateController((IEmoteUiStateController)(object)LethalEmotesUiState.Instance); AnimationClipParams animationClipParams = new AnimationClipParams(); animationClipParams.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load("@CustomEmotesAPI_fineilldoitmyself:assets/fineilldoitmyself/lmao.anim") }; animationClipParams.looping = false; animationClipParams.visible = false; AddCustomAnimation(animationClipParams); AddNonAnimatingEmote("none"); InputAction val = new InputAction("ScrollUP", (InputActionType)0, "/Scroll/Up", (string)null, (string)null, (string)null); InputAction val2 = new InputAction("ScrollDOWN", (InputActionType)0, "/Scroll/Down", (string)null, (string)null, (string)null); val.Enable(); val2.Enable(); Settings.SetHealthbarRequest(); if (TMEPresent && Settings.ImportTME.Value) { TooManyEmotesCompat.RegisterAllTooManyEmotesEmotes(); } if (BetterEmotesPresent && Settings.ImportBetterEmotes.Value) { BetterEmotesCompat.RegisterAllTooManyEmotesEmotes(); } EmotesInputSettings.Instance.RandomEmote.started += RandomEmote_performed; EmotesInputSettings.Instance.JoinEmote.started += JoinEmote_performed; EmotesInputSettings.Instance.EmoteWheel.performed += EmoteWheelInteracted; EmotesInputSettings.Instance.EmoteWheel.canceled += EmoteWheelInteracted; EmotesInputSettings.Instance.Left.started += delegate { EmoteUiManager.OnLeftWheel(); }; EmotesInputSettings.Instance.Right.started += delegate { EmoteUiManager.OnRightWheel(); }; val.started += delegate { EmoteUiManager.OnLeftWheel(); }; val2.started += delegate { EmoteUiManager.OnRightWheel(); }; EmotesInputSettings.Instance.StopEmoting.started += StopEmoting_performed; EmotesInputSettings.Instance.ThirdPersonToggle.started += ThirdPersonToggle_started; EmotesInputSettings.Instance.GamepadEmoteWheel.performed += GamepadEmoteWheel_performed; EmoteUiManager.RegisterStateController((IEmoteUiStateController)(object)LethalEmotesUiState.Instance); UnityThreadScheduler.Init(); ContentCreatorDetector.Init(); } private void GamepadEmoteWheel_performed(CallbackContext obj) { //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0054: Unknown result type (might be due to invalid IL or missing references) if (EmoteUiManager.IsEmoteWheelsOpen()) { Cursor.visible = false; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width / 2f, (float)Screen.height / 2f); Vector2 val2 = ((CallbackContext)(ref obj)).ReadValue() * 45f * EmoteUiManager.GetUIScale(); Mouse.current.WarpCursorPosition(val + val2); } } private void LigmaBalls_started(CallbackContext obj) { yote = !yote; if (yote) { localMapper.UnlockBones(); } else { localMapper.LockBones(); } } private void ThirdPersonToggle_started(CallbackContext obj) { ThirdPersonToggle(); } private static void ThirdPersonToggle() { if (localMapper != null && localMapper.currentClip != null && !LCThirdPersonPresent) { switch (localMapper.temporarilyThirdPerson) { case TempThirdPerson.none: localMapper.temporarilyThirdPerson = ((!localMapper.isInThirdPerson) ? TempThirdPerson.on : TempThirdPerson.off); localMapper.UnlockCameraStuff(); localMapper.LockCameraStuff(localMapper.temporarilyThirdPerson == TempThirdPerson.on); break; case TempThirdPerson.on: localMapper.temporarilyThirdPerson = TempThirdPerson.off; localMapper.UnlockCameraStuff(); localMapper.LockCameraStuff(thirdPersonLock: false); break; case TempThirdPerson.off: localMapper.temporarilyThirdPerson = TempThirdPerson.on; localMapper.UnlockCameraStuff(); localMapper.LockCameraStuff(thirdPersonLock: true); break; } } } private void EmoteWheelInteracted(CallbackContext ctx) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown ButtonControl val = (ButtonControl)((CallbackContext)(ref ctx)).control; if (val.wasPressedThisFrame) { EmoteUiManager.OpenEmoteWheels(); if (!((object)((CallbackContext)(ref ctx)).control).ToString().Contains("Keyboard") && !((object)((CallbackContext)(ref ctx)).control).ToString().Contains("Mouse")) { Cursor.visible = false; } } if (val.wasReleasedThisFrame) { EmoteUiManager.CloseEmoteWheels(); } } private void JoinEmote_performed(CallbackContext obj) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (!EmoteUiManager.CanOpenEmoteWheels()) { return; } try { if (!Object.op_Implicit((Object)(object)localMapper)) { return; } if (Object.op_Implicit((Object)(object)localMapper.currentEmoteSpot) || Object.op_Implicit((Object)(object)localMapper.reservedEmoteSpot)) { localMapper.JoinEmoteSpot(); return; } foreach (BoneMapper allMapper in BoneMapper.allMappers) { try { if ((Object)(object)allMapper != (Object)(object)localMapper) { if (!Object.op_Implicit((Object)(object)nearestMapper) && allMapper.currentClip.allowJoining) { nearestMapper = allMapper; } else if (Object.op_Implicit((Object)(object)nearestMapper) && allMapper.currentClip.allowJoining && Vector3.Distance(((Component)localMapper).transform.position, ((Component)allMapper).transform.position) < Vector3.Distance(((Component)localMapper).transform.position, ((Component)nearestMapper).transform.position)) { nearestMapper = allMapper; } } } catch (Exception) { } } if (Object.op_Implicit((Object)(object)nearestMapper)) { string text = ((!nearestMapper.currentClip.usesNewImportSystem) ? ((Object)nearestMapper.currentClip.clip[0]).name : nearestMapper.currentClip.joinEmote); PlayAnimation(text); Settings.joinEmoteTutorial.Value = false; Joined(text, localMapper, nearestMapper); } nearestMapper = null; } catch (Exception arg) { DebugClass.Log($"had issue while attempting to join an emote as a client: {arg}\nNotable info: [nearestMapper: {nearestMapper}] [localMapper: {localMapper}]"); try { ((object)nearestMapper.currentClip).ToString(); DebugClass.Log($"[nearestMapper.currentClip: {((object)nearestMapper.currentClip).ToString()}] [nearestMapper.currentClip.clip[0]: {nearestMapper.currentClip.clip[0]}]"); } catch (Exception) { } } } private void RandomEmote_performed(CallbackContext obj) { if (EmoteUiManager.CanOpenEmoteWheels()) { int index = Random.Range(0, randomClipList.Count); PlayAnimation(randomClipList[index]); } } private void StopEmoting_performed(CallbackContext obj) { PlayAnimation("none"); } public static int RegisterWorldProp(GameObject worldProp, JoinSpot[] joinSpots) { if (!Object.op_Implicit((Object)(object)worldProp.GetComponent())) { DebugClass.Log($"Adding a NetworkObject to {worldProp}, but you should really be doing this in Unity!"); worldProp.AddComponent(); } networkedObjects.Add(worldProp); worldProp.AddComponent().worldProp = true; WorldPropSpawnHandler worldPropSpawnHandler = worldProp.AddComponent(); worldPropSpawnHandler.propPos = BoneMapper.allWorldProps.Count; BoneMapper.allWorldProps.Add(new WorldProp(worldProp, joinSpots)); return BoneMapper.allWorldProps.Count - 1; } public static GameObject SpawnWorldProp(int propPos) { BoneMapper.allWorldProps[propPos].prop.GetComponent().propPos = propPos; return Object.Instantiate(BoneMapper.allWorldProps[propPos].prop); } public static void AddNonAnimatingEmote(string emoteName, bool visible = true) { BepInPlugin bepInPlugin = Assembly.GetCallingAssembly().GetBepInPlugin(); if (visible && !BlacklistSettings.emotesExcludedFromRandom.Contains(emoteName)) { randomClipList.Add(emoteName); } BoneMapper.animClips.Add(emoteName, null); if (bepInPlugin != null) { EmoteUiManager.GetStateController().EmoteDb.AssociateEmoteKeyWithMod(emoteName, bepInPlugin.Name); } } [Obsolete("Use EmoteImporter.ImportEmote instead")] public static void AddCustomAnimation(AnimationClipParams animationClipParams) { if (BoneMapper.animClips.ContainsKey(((Object)animationClipParams.animationClip[0]).name) || BoneMapper.animClips.ContainsKey(BoneMapper.GetRealAnimationName(animationClipParams.customName))) { if (animationClipParams.customName != "") { Debug.LogError((object)("EmotesError: [" + animationClipParams.customName + "] is already defined as a custom emote but is trying to be added. Skipping")); } else { Debug.LogError((object)("EmotesError: [" + ((Object)animationClipParams.animationClip[0]).name + "] is already defined as a custom emote but is trying to be added. Skipping")); } return; } if (!((Motion)animationClipParams.animationClip[0]).isHumanMotion) { Debug.LogError((object)("EmotesError: [" + ((Object)animationClipParams.animationClip[0]).name + "] is not a humanoid animation!")); return; } if (animationClipParams.rootBonesToIgnore == null) { animationClipParams.rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0]; } if (animationClipParams.soloBonesToIgnore == null) { animationClipParams.soloBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0]; } if (animationClipParams._primaryAudioClips == null) { animationClipParams._primaryAudioClips = (AudioClip[])(object)new AudioClip[1]; } if (animationClipParams._secondaryAudioClips == null) { animationClipParams._secondaryAudioClips = (AudioClip[])(object)new AudioClip[1]; } if (animationClipParams._primaryDMCAFreeAudioClips == null) { animationClipParams._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1]; } if (animationClipParams._secondaryDMCAFreeAudioClips == null) { animationClipParams._secondaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1]; } List list = new List(animationClipParams._primaryDMCAFreeAudioClips); while (list.Count != animationClipParams._primaryAudioClips.Length) { list.Add(null); } animationClipParams._primaryDMCAFreeAudioClips = list.ToArray(); list = new List(animationClipParams._secondaryDMCAFreeAudioClips); while (list.Count != animationClipParams._secondaryAudioClips.Length) { list.Add(null); } animationClipParams._secondaryDMCAFreeAudioClips = list.ToArray(); if (animationClipParams.joinSpots == null) { animationClipParams.joinSpots = new JoinSpot[0]; } CustomAnimationClip value = new CustomAnimationClip(animationClipParams.animationClip, animationClipParams.looping, animationClipParams._primaryAudioClips, animationClipParams._secondaryAudioClips, animationClipParams.rootBonesToIgnore, animationClipParams.soloBonesToIgnore, animationClipParams.secondaryAnimation, animationClipParams.dimWhenClose, animationClipParams.stopWhenMove, animationClipParams.stopWhenAttack, animationClipParams.visible, animationClipParams.syncAnim, animationClipParams.syncAudio, animationClipParams.startPref, animationClipParams.joinPref, animationClipParams.joinSpots, animationClipParams.useSafePositionReset, animationClipParams.customName, animationClipParams.customPostEventCodeSync, animationClipParams.customPostEventCodeNoSync, animationClipParams.lockType, animationClipParams._primaryDMCAFreeAudioClips, animationClipParams._secondaryDMCAFreeAudioClips, animationClipParams.willGetClaimedByDMCA, animationClipParams.audioLevel, animationClipParams.thirdPerson, animationClipParams.displayName, animationClipParams.OwnerPlugin, animationClipParams.useLocalTransforms); if (animationClipParams.visible && !BlacklistSettings.emotesExcludedFromRandom.Contains(((Object)animationClipParams.animationClip[0]).name)) { randomClipList.Add(((Object)animationClipParams.animationClip[0]).name); } BoneMapper.animClips.Add(((Object)animationClipParams.animationClip[0]).name, value); } public static BoneMapper ImportArmature(GameObject bodyPrefab, GameObject rigToAnimate, bool jank, int[] meshPos, bool hideMeshes = true) { GameObject val = Object.Instantiate(Assets.Load("@CustomEmotesAPI_customemotespackage:assets/animationreplacements/commando.prefab")); rigToAnimate.GetComponent().runtimeAnimatorController = val.GetComponent().runtimeAnimatorController; BoneMapper boneMapper = AnimationReplacements.ApplyAnimationStuff(bodyPrefab, rigToAnimate, meshPos, hideMeshes, jank); val.transform.SetParent(((Component)boneMapper).transform); return boneMapper; } public static BoneMapper ImportArmature(GameObject bodyPrefab, GameObject rigToAnimate, int[] meshPos, bool hideMeshes = true) { return ImportArmature(bodyPrefab, rigToAnimate, jank: false, meshPos, hideMeshes); } public static void PlayAnimation(string animationName, int pos = -2) { if (localMapper != null && localMapper.canEmote) { if (BoneMapper.customNamePairs.ContainsKey(animationName)) { animationName = BoneMapper.customNamePairs[animationName]; } string realAnimationName = BoneMapper.GetRealAnimationName(animationName); if (!BlacklistSettings.emotesDisabled.Contains(realAnimationName)) { EmoteNetworker.instance.SyncEmote(((Component)StartOfRound.Instance.localPlayerController).GetComponent().NetworkObjectId, animationName, pos); } } } public static void PlayAnimation(string animationName, BoneMapper mapper, int pos = -2) { if (mapper != null && mapper.canEmote) { if (BoneMapper.customNamePairs.ContainsKey(animationName)) { animationName = BoneMapper.customNamePairs[animationName]; } string realAnimationName = BoneMapper.GetRealAnimationName(animationName); if (!BlacklistSettings.emotesDisabled.Contains(realAnimationName)) { EmoteNetworker.instance.SyncEmote(mapper.mapperBody.GetComponent().NetworkObjectId, animationName, pos); } } } public static CustomAnimationClip GetLocalBodyCustomAnimationClip() { if (Object.op_Implicit((Object)(object)localMapper)) { return localMapper.currentClip; } return null; } public static BoneMapper[] GetAllBoneMappers() { return BoneMapper.allMappers.ToArray(); } public static void ChangeInteractionTriggers(bool active) { foreach (BoneMapper allMapper in BoneMapper.allMappers) { if (allMapper.personalTrigger != null) { allMapper.personalTrigger.interactable = active && allMapper.currentClip != null && allMapper.currentClip.allowJoining && Settings.InteractionToolTip.Value; } } } internal static void Changed(string newAnimation, BoneMapper mapper) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) if (mapper == null) { DebugClass.Log("AnimChanged called on null BoneMapper!"); return; } mapper.currentClipName = newAnimation; if (BoneMapper.animClips[newAnimation] != null) { mapper.UpdateHoverTip(BoneMapper.animClips[newAnimation].displayName); } if (mapper.personalTrigger != null) { mapper.personalTrigger.interactable = false; } if ((Object)(object)mapper == (Object)(object)localMapper) { if (requestCounter != 0 && hudObject != null) { requestCounter--; HealthbarAnimator.FinishHealthbarAnimateRequest(); } if (newAnimation == "none") { localMapper.temporarilyThirdPerson = TempThirdPerson.none; localMapper.rotationPoint.transform.eulerAngles = new Vector3(localMapper.rotationPoint.transform.eulerAngles.x, mapper.playerController.thisPlayerBody.eulerAngles.y, 0f); ChangeInteractionTriggers(active: true); } else { if (hudObject != null) { requestCounter++; HealthbarAnimator.StartHealthbarAnimateRequest(); } ChangeInteractionTriggers(active: false); if (newAnimation.Contains("TooManyEmotes__") && mapper.isInThirdPerson) { ThirdPersonToggle(); } } } else if ((Object)(object)localMapper.currentlyLockedBoneMapper == (Object)(object)mapper && Settings.StopEmoteWhenLockedToStopsEmote.Value) { PlayAnimation("none", localMapper); } foreach (EmoteLocation emoteLocation in EmoteLocation.emoteLocations) { if ((Object)(object)emoteLocation.emoter == (Object)(object)mapper) { try { emoteLocation.emoter = null; emoteLocation.SetVisible(visibility: true); } catch (Exception) { } } } if (CustomEmotesAPI.animChanged != null) { CustomEmotesAPI.animChanged(newAnimation, mapper); } if (newAnimation != "none") { if (localMapper.currentClip == null && mapper.personalTrigger != null) { mapper.personalTrigger.interactable = mapper.currentClip != null && mapper.currentClip.allowJoining && Settings.InteractionToolTip.Value; } if ((Object)(object)mapper == (Object)(object)localMapper && Settings.HideJoinSpots.Value) { EmoteLocation.HideAllSpots(); } if (mapper.currentClip != null && mapper.currentClip.lockType == AnimationClipParams.LockType.rootMotion) { mapper.prevMapperPos = ((Component)mapper).transform.position; mapper.prevMapperRot = ((Component)mapper).transform.eulerAngles; } mapper.positionBeforeRootMotion = mapper.mapperBody.transform.position; mapper.rotationBeforeRootMotion = mapper.mapperBody.transform.rotation; mapper.justSwitched = true; } else { mapper.currentlyLockedBoneMapper = null; if (mapper.local && hudObject != null) { ((TMP_Text)currentEmoteText).text = ""; } if ((Object)(object)mapper == (Object)(object)localMapper && Settings.HideJoinSpots.Value) { EmoteLocation.ShowAllSpots(); } ((Component)mapper).transform.localPosition = Vector3.zero; ((Component)mapper).transform.localEulerAngles = new Vector3(90f, 0f, 0f); } } internal static void JoinedBody(GameObject emoteSpot, BoneMapper joiner, BoneMapper host) { if (CustomEmotesAPI.emoteSpotJoined_Body != null) { CustomEmotesAPI.emoteSpotJoined_Body(emoteSpot, joiner, host); } } internal static void JoinedProp(GameObject emoteSpot, BoneMapper joiner, BoneMapper host) { if (CustomEmotesAPI.emoteSpotJoined_Prop != null) { CustomEmotesAPI.emoteSpotJoined_Prop(emoteSpot, joiner, host); } } public static void Joined(string joinedAnimation, BoneMapper joiner, BoneMapper host) { if (CustomEmotesAPI.animJoined != null) { CustomEmotesAPI.animJoined(joinedAnimation, joiner, host); } } internal static void MapperCreated(BoneMapper mapper) { if (CustomEmotesAPI.boneMapperCreated != null) { CustomEmotesAPI.boneMapperCreated(mapper); } } internal static void JoinSpotEntered(BoneMapper mover, BoneMapper joinSpotOwner) { if (CustomEmotesAPI.boneMapperEnteredJoinSpot != null) { CustomEmotesAPI.boneMapperEnteredJoinSpot(mover, joinSpotOwner); } } internal static void EmoteWheelOpened(Sprite wheel) { if (CustomEmotesAPI.emoteWheelPulledUp != null) { CustomEmotesAPI.emoteWheelPulledUp(wheel, localMapper); } } public static void ReserveJoinSpot(GameObject joinSpot, BoneMapper mapper) { mapper.reservedEmoteSpot = joinSpot; } public static void AudioFunctions() { for (int i = 0; i < CustomAnimationClip.syncPlayerCount.Count; i++) { if (CustomAnimationClip.syncPlayerCount[i] != 0) { CustomAnimationClip.syncTimer[i] += Time.deltaTime; } } } internal void wackActive(BoneMapper mapper) { ((MonoBehaviour)this).StartCoroutine(wackActive2(mapper)); } internal IEnumerator wackActive2(BoneMapper mapper) { DebugClass.Log(((Object)((Component)mapper.basePlayerModelAnimator).gameObject).name ?? ""); ((Component)mapper.basePlayerModelAnimator).gameObject.SetActive(false); yield return (object)new WaitForSeconds(5f); ((Behaviour)mapper.basePlayerModelAnimator).enabled = true; mapper.oneFrameAnimatorLeeWay = true; ((Component)mapper.basePlayerModelAnimator).gameObject.SetActive(true); } public static void InTerminal() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; PlayAnimation("none"); } } public enum DMCAType { Normal, Friendly, Mute, AllOff } public enum RootMotionType { Normal, All, None } public enum ThirdPersonType { Normal, All, None } public static class Settings { public static EmotesAPIConfigEntries localConfig; public static EmotesAPIConfigEntries globalConfig; public static ConfigEntry useGlobalConfig; public static ConfigEntry dontShowDmcaPrompt; public static ConfigEntry disallowedModPackOverrideLocations; public static ConfigEntry joinEmoteTutorial; public static ConfigEntry modPackOverride; internal static GameObject picker; internal static string profileName; public static ConfigEntry EmotesVolume => GetCurrentConfig().EmotesVolume; public static ConfigEntry HideJoinSpots => GetCurrentConfig().HideJoinSpots; public static ConfigEntry rootMotionType => GetCurrentConfig().rootMotionType; public static ConfigEntry EmotesAlertEnemies => GetCurrentConfig().EmotesAlertEnemies; public static ConfigEntry DMCAFree => GetCurrentConfig().DMCAFree; public static ConfigEntry thirdPersonType => GetCurrentConfig().thirdPersonType; public static ConfigEntry StopEmoteWhenLockedToStopsEmote => GetCurrentConfig().StopEmoteWhenLockedToStopsEmote; public static ConfigEntry EmoteWheelSetDataEntryString => GetCurrentConfig().EmoteWheelSetDataEntryString; public static ConfigEntry EmoteWheelSetDisplayDataString => GetCurrentConfig().EmoteWheelSetDisplayDataString; public static ConfigEntry RandomEmoteBlacklist => GetCurrentConfig().RandomEmoteBlacklist; public static ConfigEntry DisabledEmotes => GetCurrentConfig().DisabledEmotes; public static ConfigEntry PermanentEmotingHealthbar => GetCurrentConfig().PermanentEmotingHealthbar; public static ConfigEntry EmoteKeyBinds => GetCurrentConfig().EmoteKeyBinds; public static ConfigEntry ImportTME => GetCurrentConfig().ImportTME; public static ConfigEntry ImportBetterEmotes => GetCurrentConfig().ImportBetterEmotes; public static ConfigEntry NearestEmoteText => GetCurrentConfig().NearestEmoteText; public static ConfigEntry InteractionToolTip => GetCurrentConfig().InteractionToolTip; public static void RunAll() { SetProfileName(); GenerateConfigs(); LethalConfig(); } internal static void SetProfileName() { profileName = Directory.GetParent(GetBepinexFolder(((BaseUnityPlugin)CustomEmotesAPI.instance).Info.Location)).Name; } internal static string GetBepinexFolder(string directory) { string text = directory; bool flag = false; for (int i = 0; i < 20; i++) { DirectoryInfo parent = Directory.GetParent(directory); if (parent != null) { if (parent.Name.ToLowerInvariant() == "bepinex") { directory = parent.FullName; flag = true; break; } directory = parent.FullName; } } return flag ? directory : text; } internal static string GetGlobalSettingsDir() { string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); string path = Path.Combine(folderPath, "AppData", "LocalLow", "ZeekerssRBLX", "Lethal Company"); return Path.Combine(path, "LethalEmotesAPI"); } private static void GenerateConfigs() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown modPackOverride = ((BaseUnityPlugin)CustomEmotesAPI.instance).Config.Bind("Local Settings", "Modpack Override", false, "When true, will use local config even when \"Use Global Config\" is set to true. If \"Use Global Config\" is touched by the user, this will always be reset to false."); string text = Path.Combine(GetGlobalSettingsDir(), "global.cfg"); bool flag = !File.Exists(text); ConfigFile val = new ConfigFile(text, true, ((BaseUnityPlugin)CustomEmotesAPI.instance).Info.Metadata); BindGlobalEntries(val); globalConfig = new EmotesAPIConfigEntries(val, "Global "); localConfig = new EmotesAPIConfigEntries(((BaseUnityPlugin)CustomEmotesAPI.instance).Config, ""); if (disallowedModPackOverrideLocations.Value.Split('ඞ').ToList().Contains(profileName)) { modPackOverride.Value = false; } if (flag) { globalConfig.CopyFromConfig(localConfig); } } private static void BindGlobalEntries(ConfigFile global) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown useGlobalConfig = global.Bind("Global Settings", "Use Global Config", true, "When true, all EmotesAPI settings will be the same across profiles. When false, each profile will have its own settings."); disallowedModPackOverrideLocations = global.Bind("Global No Touch", "Modpack locations disallowing modPackOverride", "", "Locations where users have already opted out of using the modpack specific options"); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(useGlobalConfig, false)); useGlobalConfig.SettingChanged += PermanentEmotingHealthbar_SettingChanged; useGlobalConfig.SettingChanged += HideJoinSpots_SettingChanged; useGlobalConfig.SettingChanged += UseGlobalConfig_SettingChanged; dontShowDmcaPrompt = global.Bind("Global Flags", "Dont Show DMCA Prompt", false, "Disables the DMCA prompt from showing in-game. DMCA Prompt automatically shows when we detect OBS or XSplit open"); joinEmoteTutorial = global.Bind("Global Flags", "Join Emote Tutorial", true, "Guaruntees the join prompt will be in the top left corner"); } private static void UseGlobalConfig_SettingChanged(object sender, EventArgs e) { Debug.Log((object)"setting actually changed"); modPackOverride.Value = false; if (!disallowedModPackOverrideLocations.Value.Split('ඞ').ToList().Contains(profileName)) { ConfigEntry obj = disallowedModPackOverrideLocations; obj.Value = obj.Value + "ඞ" + profileName; } } public static EmotesAPIConfigEntries GetCurrentConfig() { return modPackOverride.Value ? localConfig : (useGlobalConfig.Value ? globalConfig : localConfig); } internal static void PermanentEmotingHealthbar_SettingChanged(object sender, EventArgs e) { SetHealthbarRequest(); } internal static void SetHealthbarRequest() { HealthbarAnimator.permaOn = PermanentEmotingHealthbar.Value; HealthbarAnimator.SetHealthbarPosition(); } internal static void HideJoinSpots_SettingChanged(object sender, EventArgs e) { if (!HideJoinSpots.Value) { EmoteLocation.ShowAllSpots(); } } internal static void PressButton() { picker.SetActive(false); picker.SetActive(true); ((Component)picker.transform.Find("emotepicker")).gameObject.SetActive(true); picker.transform.SetAsLastSibling(); picker.GetComponent().sortingOrder = 5; } internal static void DebugBones(GameObject fab, int spot = 0) { SkinnedMeshRenderer[] componentsInChildren = fab.GetComponentsInChildren(); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"rendererererer: {componentsInChildren[spot]}\n"); stringBuilder.Append($"bone count: {componentsInChildren[spot].bones.Length}\n"); stringBuilder.Append($"mesh count: {componentsInChildren.Length}\n"); stringBuilder.Append("root bone: " + ((Object)componentsInChildren[spot].rootBone).name + "\n"); stringBuilder.Append(((object)fab).ToString() + ":\n"); if (componentsInChildren[spot].bones.Length == 0) { stringBuilder.Append("No bones"); } else { stringBuilder.Append("["); Transform[] bones = componentsInChildren[spot].bones; foreach (Transform val in bones) { stringBuilder.Append("'" + ((Object)val).name + "', "); } stringBuilder.Remove(stringBuilder.Length - 2, 2); stringBuilder.Append("]"); } stringBuilder.Append("\n\n"); DebugClass.Log(stringBuilder.ToString()); } internal static void LethalConfig() { Sprite modIcon = Assets.Load("lethalconfigicon.png"); LethalConfigManager.SetModIcon(modIcon); LethalConfigManager.SetModDescription("API for importing animations to Lethal Company"); LethalConfigManager.SkipAutoGenFor("No Touch"); } } internal class WorldPropSpawnHandler : MonoBehaviour { public int propPos; private void Start() { BoneMapper component = ((Component)this).GetComponent(); JoinSpot[] joinSpots = BoneMapper.allWorldProps[propPos].joinSpots; foreach (JoinSpot joinSpot in joinSpots) { component.SpawnJoinSpot(joinSpot); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace LethalEmotesAPI.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }