Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Play As Beans v1.0.1
PlayAsBeans.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PlayAsBeans")] [assembly: AssemblyTitle("PlayAsBeans")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PlayAsBeans { [BepInPlugin("Omniscye.PlayAsBeans", "PlayAsBeans", "1.0")] public class PlayAsBeans : BaseUnityPlugin { internal static PlayAsBeans Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } } namespace Empress.REPO.PlayAsBeans { [BepInPlugin("empress.repo.playasbeans", "PlayAsBeans", "1.4.3")] public class PlayAsBeansPlugin : BaseUnityPlugin { public static class MoreHeadCompatHook { public static void DecoParentsPostfix(Transform rootTransform, ref Dictionary<string, Transform> __result) { try { if ((Object)(object)rootTransform == (Object)null || __result == null) { return; } Transform val = rootTransform.Find("EmpressCapsuleRig") ?? EnsureAnchorsAtRoot(rootTransform); if (!((Object)(object)val == (Object)null)) { Transform val2 = val.Find("CapHead"); Transform val3 = val.Find("CapNeck"); Transform val4 = val.Find("CapBody"); Transform val5 = val.Find("CapHip"); if ((Object)(object)val2 != (Object)null) { __result["head"] = val2; } if ((Object)(object)val3 != (Object)null) { __result["neck"] = val3; } if ((Object)(object)val4 != (Object)null) { __result["body"] = val4; } if ((Object)(object)val5 != (Object)null) { __result["hip"] = val5; } } } catch (Exception ex) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)("MoreHeadCompatHook failed: " + ex.Message)); } } } } private static class Patches { [HarmonyPatch(typeof(PlayerAvatarVisuals), "Start")] internal static class PlayerAvatarVisuals_Start { [HarmonyPostfix] private static void Postfix(PlayerAvatarVisuals __instance) { TryApplyCapsule(__instance); } } [HarmonyPatch(typeof(PlayerDeathHead), "Start")] internal static class PlayerDeathHead_Start { [HarmonyPostfix] private static void Postfix(PlayerDeathHead __instance) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) try { Transform val = ((Component)__instance).transform.Find("EmpressDeathCapsule"); if ((Object)(object)val != (Object)null) { return; } GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)1); ((Object)val2).name = "EmpressDeathCapsule"; val2.transform.SetParent(((Component)__instance).transform, false); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = new Vector3(0.3f, 0.3f, 0.3f); Collider component = val2.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer component2 = val2.GetComponent<Renderer>(); if ((Object)(object)__instance.headRenderer != (Object)null && (Object)(object)component2 != (Object)null) { try { component2.sharedMaterial = ((Renderer)__instance.headRenderer).sharedMaterial; } catch { } val2.layer = ((Component)__instance.headRenderer).gameObject.layer; ((Renderer)__instance.headRenderer).enabled = false; } else { val2.layer = ((Component)__instance).gameObject.layer; } if (__instance.eyeRenderers == null) { return; } MeshRenderer[] eyeRenderers = __instance.eyeRenderers; foreach (MeshRenderer val3 in eyeRenderers) { if ((Object)(object)val3 != (Object)null) { ((Renderer)val3).enabled = false; } } } catch (Exception ex) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)("DeathHead capsule apply failed: " + ex.Message)); } } } } } public const string PluginGuid = "empress.repo.playasbeans"; public const string PluginName = "PlayAsBeans"; public const string PluginVersion = "1.4.3"; internal static ManualLogSource Log; private Harmony _harmony; private ConfigEntry<float> _offsetYCfg; private ConfigEntry<float> _scaleYCfg; private ConfigEntry<float> _headTopPadCfg; private ConfigEntry<float> _offsetXCfg; private ConfigEntry<float> _offsetZCfg; private ConfigEntry<float> _scaleXCfg; private ConfigEntry<float> _scaleZCfg; internal static float CfgOffsetY = 1.1f; internal static float CfgScaleY = 0.69f; internal static float CfgHeadPad = -0.05f; internal static float CfgOffsetX = -0.01f; internal static float CfgOffsetZ = 0.019f; internal static float CfgScaleX = 0.8f; internal static float CfgScaleZ = 0.8f; private const string MH_HEAD_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_________...__________________________________/ANIM HEAD TOP/code_head_top"; private const string MH_NECK_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_________...____________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side"; private const string MH_BODY_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_________...DY TOP/code_body_top_up/code_body_top_side/ANIM BODY TOP SCALE"; private const string MH_HIP_PATH = "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT"; private bool _mhPatched = false; private int _mhTries = 0; private const int _mhMaxTries = 5; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("empress.repo.playasbeans"); _offsetYCfg = ((BaseUnityPlugin)this).Config.Bind<float>("Capsule", "OffsetY", 1.1f, "Vertical offset of the capsule root relative to the avatar root (meters). Positive raises it."); _scaleYCfg = ((BaseUnityPlugin)this).Config.Bind<float>("Capsule", "ScaleY", 1f, "Capsule vertical scale multiplier (1.0 => Unity capsule height ~2m)."); _headTopPadCfg = ((BaseUnityPlugin)this).Config.Bind<float>("Capsule", "HeadTopPadY", -0.05f, "Adjustment from capsule TOP used for head anchor (negative lowers the hat)."); CfgOffsetY = _offsetYCfg.Value; CfgScaleY = _scaleYCfg.Value; CfgHeadPad = _headTopPadCfg.Value; _offsetYCfg.SettingChanged += delegate { CfgOffsetY = _offsetYCfg.Value; UpdateAllCapsules(); }; _scaleYCfg.SettingChanged += delegate { CfgScaleY = _scaleYCfg.Value; UpdateAllCapsules(); }; _headTopPadCfg.SettingChanged += delegate { CfgHeadPad = _headTopPadCfg.Value; UpdateAllCapsules(); }; try { _harmony.PatchAll(typeof(PlayAsBeansPlugin).Assembly); } catch (Exception arg) { Log.LogError((object)$"Harmony patch failed: {arg}"); } ((MonoBehaviour)this).Invoke("InitialSweep", 1f); Log.LogInfo((object)"PlayAsBeans 1.4.3 loaded (MoreHead-compatible). Attempting limited MoreHead hook..."); ((MonoBehaviour)this).InvokeRepeating("TryPatchMoreHead", 0.25f, 2f); } private void OnDestroy() { try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch (Exception arg) { ManualLogSource log = Log; if (log != null) { log.LogError((object)$"Unpatch error: {arg}"); } } } private void InitialSweep() { try { PlayerAvatarVisuals[] array = Object.FindObjectsOfType<PlayerAvatarVisuals>(true); PlayerAvatarVisuals[] array2 = array; foreach (PlayerAvatarVisuals pav in array2) { TryApplyCapsule(pav); } Log.LogDebug((object)$"Initial sweep processed {array.Length} PlayerAvatarVisuals instances."); } catch (Exception ex) { Log.LogWarning((object)("Initial sweep failed: " + ex.Message)); } } internal static void TryApplyCapsule(PlayerAvatarVisuals pav) { //IL_003e: 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_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)pav == (Object)null) { return; } Transform val = ((Component)pav).transform.Find("EmpressCapsule"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(CfgOffsetX, CfgOffsetY, CfgOffsetZ); val.localScale = new Vector3(CfgScaleX, CfgScaleY, CfgScaleZ); EnsureAnchorsAtRoot(((Component)pav).transform); ApplyLocalFirstPersonHiding(pav); return; } try { if ((Object)(object)pav.meshParent != (Object)null) { int num = 0; Renderer[] componentsInChildren = pav.meshParent.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { if (!(((Object)((Component)val2).transform).name == "HeadDecorations") && !(((Object)((Component)val2).transform).name == "WorldDecorationFollower")) { Transform componentInParent = ((Component)((Component)val2).transform).GetComponentInParent<Transform>(); if (!(((componentInParent != null) ? ((Object)componentInParent).name : null) == "HeadDecorations")) { val2.enabled = false; num++; } } } ManualLogSource log = Log; if (log != null) { log.LogDebug((object)$"Disabled {num} renderers under meshParent to preserve rig bones."); } } else { int num2 = 0; Renderer[] componentsInChildren2 = ((Component)pav).GetComponentsInChildren<Renderer>(true); foreach (Renderer val3 in componentsInChildren2) { if (!(((Object)((Component)val3).transform).name == "HeadDecorations") && !(((Object)((Component)val3).transform).name == "WorldDecorationFollower")) { Transform componentInParent2 = ((Component)((Component)val3).transform).GetComponentInParent<Transform>(); if (!(((componentInParent2 != null) ? ((Object)componentInParent2).name : null) == "HeadDecorations")) { val3.enabled = false; num2++; } } } ManualLogSource log2 = Log; if (log2 != null) { log2.LogDebug((object)$"Disabled {num2} renderers under avatar root to preserve rig bones."); } } GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)1); ((Object)val4).name = "EmpressCapsule"; val4.transform.SetParent(((Component)pav).transform, false); val4.transform.localPosition = new Vector3(CfgOffsetX, CfgOffsetY, CfgOffsetZ); val4.transform.localRotation = Quaternion.identity; val4.transform.localScale = new Vector3(CfgScaleX, CfgScaleY, CfgScaleZ); Collider component = val4.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Renderer val5 = (((Object)(object)pav.meshParent != (Object)null) ? pav.meshParent.GetComponentsInChildren<Renderer>(true).FirstOrDefault() : ((Component)pav).GetComponentsInChildren<Renderer>(true).FirstOrDefault()); Renderer component2 = val4.GetComponent<Renderer>(); if ((Object)(object)val5 != (Object)null && (Object)(object)component2 != (Object)null) { try { component2.sharedMaterial = val5.sharedMaterial; } catch { } val4.layer = ((Component)val5).gameObject.layer; } else { val4.layer = ((Component)pav).gameObject.layer; } EnsureAnchorsAtRoot(((Component)pav).transform); ApplyLocalFirstPersonHiding(pav); ManualLogSource log3 = Log; if (log3 != null) { log3.LogDebug((object)("Capsule applied to avatar: " + ((Object)((Component)pav).gameObject).name)); } } catch (Exception ex) { ManualLogSource log4 = Log; if (log4 != null) { log4.LogWarning((object)("Failed to apply capsule to " + ((Object)((Component)pav).gameObject).name + ": " + ex.Message)); } } } private static Transform EnsureMoreHeadCompatAnchors(PlayerAvatarVisuals pav, Transform capsule) { //IL_0034: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)((Component)pav).transform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_________...__________________________________/ANIM HEAD TOP/code_head_top") != (Object)null) { return null; } CreatePathIfMissing(((Component)pav).transform, "[RIG]/code_lean/code_tilt/ANIM BOT/_____________________________________/ANIM BODY BOT", new Vector3(0f, capsule.localPosition.y - 0.2f, 0f)); CreatePathIfMissing(((Component)pav).transform, "[RIG]/code_lean/code_tilt/ANIM BOT/_________...DY TOP/code_body_top_up/code_body_top_side/ANIM BODY TOP SCALE", new Vector3(0f, capsule.localPosition.y + 0.2f, 0f)); CreatePathIfMissing(((Component)pav).transform, "[RIG]/code_lean/code_tilt/ANIM BOT/_________...____________/ANIM HEAD BOT/code_head_bot_up/code_head_bot_side", new Vector3(0f, capsule.localPosition.y + 0.7f, 0f)); CreatePathIfMissing(((Component)pav).transform, "[RIG]/code_lean/code_tilt/ANIM BOT/_________...__________________________________/ANIM HEAD TOP/code_head_top", new Vector3(0f, capsule.localPosition.y + 0.9f, 0f)); ManualLogSource log = Log; if (log != null) { log.LogDebug((object)"Injected MoreHead proxy anchors (head/neck/body/hip)."); } return ((Component)pav).transform.Find("[RIG]/code_lean/code_tilt/ANIM BOT/_________...__________________________________/ANIM HEAD TOP/code_head_top"); } catch (Exception ex) { ManualLogSource log2 = Log; if (log2 != null) { log2.LogWarning((object)("EnsureMoreHeadCompatAnchors failed: " + ex.Message)); } return null; } } private static Transform CreatePathIfMissing(Transform root, string path, Vector3 localPosition) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown string[] array = path.Split('/'); Transform val = root; string[] array2 = array; foreach (string text in array2) { string text2 = text.Trim(); if (!string.IsNullOrEmpty(text2)) { Transform val2 = val.Find(text2); if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject(text2); val2 = val3.transform; val2.SetParent(val, false); } val = val2; } } val.localPosition = localPosition; val.localRotation = Quaternion.identity; val.localScale = Vector3.one; return val; } private static Transform EnsureCapsuleAnchors(Transform capsule) { //IL_00d3: 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_003f: Expected O, but got Unknown //IL_0051: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)capsule == (Object)null) { return null; } Transform val = capsule.Find("EmpressCapsuleRig"); if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("EmpressCapsuleRig"); val = val2.transform; val.SetParent(capsule, false); val.localPosition = Vector3.zero; val.localRotation = Quaternion.identity; val.localScale = Vector3.one; string[] array = new string[4] { "CapHip", "CapBody", "CapNeck", "CapHead" }; foreach (string text in array) { Transform transform = new GameObject(text).transform; transform.SetParent(val, false); } } float num = Mathf.Abs(capsule.localScale.y); float num2 = -0.2f * num; float num3 = 0.2f * num; float num4 = 0.7f * num; float num5 = 1f * num + CfgHeadPad; Transform val3 = val.Find("CapHip"); Transform val4 = val.Find("CapBody"); Transform val5 = val.Find("CapNeck"); Transform val6 = val.Find("CapHead"); if ((Object)(object)val3 != (Object)null) { val3.localPosition = new Vector3(0f, num2, 0f); val3.localRotation = Quaternion.identity; val3.localScale = Vector3.one; } if ((Object)(object)val4 != (Object)null) { val4.localPosition = new Vector3(0f, num3, 0f); val4.localRotation = Quaternion.identity; val4.localScale = Vector3.one; } if ((Object)(object)val5 != (Object)null) { val5.localPosition = new Vector3(0f, num4, 0f); val5.localRotation = Quaternion.identity; val5.localScale = Vector3.one; } if ((Object)(object)val6 != (Object)null) { val6.localPosition = new Vector3(0f, num5, 0f); val6.localRotation = Quaternion.identity; val6.localScale = Vector3.one; } return val; } private static Transform EnsureAnchorsAtRoot(Transform root) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0051: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012d: 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_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: 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) //IL_01f6: 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) if ((Object)(object)root == (Object)null) { return null; } Transform val = root.Find("EmpressCapsuleRig"); if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("EmpressCapsuleRig"); val = val2.transform; val.SetParent(root, false); val.localPosition = Vector3.zero; val.localRotation = Quaternion.identity; val.localScale = Vector3.one; string[] array = new string[4] { "CapHip", "CapBody", "CapNeck", "CapHead" }; foreach (string text in array) { Transform transform = new GameObject(text).transform; transform.SetParent(val, false); } } Transform val3 = val.Find("CapHip"); Transform val4 = val.Find("CapBody"); Transform val5 = val.Find("CapNeck"); Transform val6 = val.Find("CapHead"); if ((Object)(object)val3 != (Object)null) { val3.localPosition = new Vector3(0f, -0.2f, 0f); val3.localRotation = Quaternion.identity; val3.localScale = Vector3.one; } if ((Object)(object)val4 != (Object)null) { val4.localPosition = new Vector3(0f, 0.2f, 0f); val4.localRotation = Quaternion.identity; val4.localScale = Vector3.one; } if ((Object)(object)val5 != (Object)null) { val5.localPosition = new Vector3(0f, 0.7f, 0f); val5.localRotation = Quaternion.identity; val5.localScale = Vector3.one; } if ((Object)(object)val6 != (Object)null) { val6.localPosition = new Vector3(0f, 1f, 0f); val6.localRotation = Quaternion.identity; val6.localScale = Vector3.one; } return val; } private static void ApplyLocalFirstPersonHiding(PlayerAvatarVisuals pav) { try { if ((Object)(object)pav == (Object)null || pav.isMenuAvatar) { return; } PlayerAvatar playerAvatar = pav.playerAvatar; if (GameManager.Multiplayer() && (!((Object)(object)playerAvatar != (Object)null) || !((Object)(object)playerAvatar.photonView != (Object)null) || !playerAvatar.photonView.IsMine)) { return; } Transform val = ((Component)pav).transform.Find("EmpressCapsuleRig"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } Transform val2 = ((Component)pav).transform.Find("EmpressCapsule"); if ((Object)(object)val2 != (Object)null) { Renderer component = ((Component)val2).GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { component.enabled = false; } } } catch (Exception ex) { ManualLogSource log = Log; if (log != null) { log.LogWarning((object)("ApplyLocalFirstPersonHiding failed: " + ex.Message)); } } } private void UpdateAllCapsules() { //IL_0048: 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) try { PlayerAvatarVisuals[] array = Object.FindObjectsOfType<PlayerAvatarVisuals>(true); PlayerAvatarVisuals[] array2 = array; foreach (PlayerAvatarVisuals val in array2) { Transform val2 = ((Component)val).transform.Find("EmpressCapsule"); if (!((Object)(object)val2 == (Object)null)) { val2.localPosition = new Vector3(CfgOffsetX, CfgOffsetY, CfgOffsetZ); val2.localScale = new Vector3(CfgScaleX, CfgScaleY, CfgScaleZ); EnsureAnchorsAtRoot(((Component)val).transform); ApplyLocalFirstPersonHiding(val); } } ManualLogSource log = Log; if (log != null) { log.LogInfo((object)$"Applied config to {array.Length} avatars."); } } catch (Exception ex) { ManualLogSource log2 = Log; if (log2 != null) { log2.LogWarning((object)("UpdateAllCapsules failed: " + ex.Message)); } } } private void TryPatchMoreHead() { //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown if (_mhPatched) { ((MonoBehaviour)this).CancelInvoke("TryPatchMoreHead"); return; } if (_mhTries >= 5) { ((MonoBehaviour)this).CancelInvoke("TryPatchMoreHead"); Log.LogInfo((object)"MoreHead not detected after 5 checks; integration disabled."); return; } _mhTries++; try { Type type = AccessTools.TypeByName("MoreHead.DecorationUtils"); if (!(type == null)) { MethodInfo methodInfo = AccessTools.Method(type, "GetDecorationParentNodes", new Type[1] { typeof(Transform) }, (Type[])null); if (methodInfo == null) { ((MonoBehaviour)this).CancelInvoke("TryPatchMoreHead"); return; } HarmonyMethod val = new HarmonyMethod(typeof(MoreHeadCompatHook).GetMethod("DecoParentsPostfix", BindingFlags.Static | BindingFlags.Public)); _harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _mhPatched = true; ((MonoBehaviour)this).CancelInvoke("TryPatchMoreHead"); Log.LogInfo((object)"Patched MoreHead.DecorationUtils.GetDecorationParentNodes for capsule anchors."); } } catch (Exception ex) { ((MonoBehaviour)this).CancelInvoke("TryPatchMoreHead"); Log.LogWarning((object)("Failed to patch MoreHead: " + ex.Message)); } } } }