using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using SoftReferenceableAssets; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("DragonLord")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+e3d074d42bf1da2d7a447788e2b7b6ae529c0547")] [assembly: AssemblyProduct("DragonLord")] [assembly: AssemblyTitle("DragonLord")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace DragonLord { public class DragonLordGUI : MonoBehaviour { public static DragonLordGUI Instance; private Rect windowRect = new Rect(20f, 20f, 520f, 1000f); private Vector2 scrollPos; private static bool hasSavedValues = false; private static int savedVersion = 0; private const int CURRENT_SAVE_VERSION = 3; private static float savedSaddleX; private static float savedSaddleY; private static float savedSaddleZ; private static float savedMountX; private static float savedMountY; private static float savedMountZ; private static float savedSaddleVisualScale; private static float savedThrust; private static float savedSprint; private static float savedTurnRate; private static float savedPitchRate; private static float savedBankRate; private static float savedAccel; private static float savedDecel; private static float savedMaxPitch; private static float savedMaxBank; private static float savedAnimSmooth; private static float savedCamDist; private static float savedHoverAmp; private static float savedHoverFreq; private static float savedFollowSpeed; private static float savedHoverHeight; private static float savedFireDamage; private static float savedFireSpeed; private static float savedFireAOE; private static bool dragonFrozen; private static Color savedBodyTint = new Color(0.56f, 0f, 0f, 1f); private static float savedHue; private static float savedSat = -0.02f; private static float savedVal = -0.17f; private static Vector3 savedFlameOffset = new Vector3(0f, 0.1f, 0.5f); private static float savedFlameScale = 1f; private static float savedFlameEmberRate = 5f; private static float savedFlameAttackRate = 40f; private static int savedFlameMode = 1; private static readonly Vector3 DEF_SADDLE_POS = new Vector3(0.0004f, 0.0075f, -0.0038f); private static readonly Vector3 DEF_SADDLE_ROT = new Vector3(161.25f, 0f, 181.05f); private static readonly Vector3 DEF_SEAT_POS = new Vector3(0f, -0.0008f, 0.0007f); private static readonly Vector3 DEF_SEAT_ROT = new Vector3(231.53f, 0f, 177f); private const float DEF_SADDLE_VIS_SCALE = 0.002f; private static Vector3 saddleRot = new Vector3(161.25f, 0f, 181.05f); private static Vector3 seatRot = new Vector3(231.53f, 0f, 177f); private GUIStyle windowStyle; private GUIStyle headerStyle; private GUIStyle labelStyle; private GUIStyle valueStyle; private GUIStyle buttonStyle; private GUIStyle closeBtnStyle; private GUIStyle toggleStyle; private Texture2D bgTexture; private bool stylesReady; public static bool IsOpen { get; private set; } public static void SaveValues(DragonLordMount mount) { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_0204: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)mount == (Object)null) { return; } hasSavedValues = true; savedVersion = 3; savedThrust = mount.thrustSpeed; savedSprint = mount.sprintMultiplier; savedTurnRate = mount.turnRate; savedPitchRate = mount.pitchRate; savedBankRate = mount.bankRate; savedAccel = mount.accelTime; savedDecel = mount.decelTime; savedMaxPitch = mount.maxPitchAngle; savedMaxBank = mount.maxBankAngle; savedAnimSmooth = mount.animSmoothTime; savedCamDist = mount.mountCameraDistance; savedHoverAmp = mount.hoverAmplitude; savedHoverFreq = mount.hoverFrequency; savedFollowSpeed = mount.followSpeed; savedHoverHeight = mount.hoverHeight; savedFireDamage = mount.fireballDamage; savedFireSpeed = mount.fireballSpeed; savedFireAOE = mount.fireballAOE; savedBodyTint = mount.bodyTintColor; savedHue = mount.hueShift; savedSat = mount.saturationShift; savedVal = mount.valueShift; savedFlameOffset = mount.flameOffset; savedFlameScale = mount.flameScale; savedFlameEmberRate = mount.flameEmberRate; savedFlameAttackRate = mount.flameAttackRate; savedFlameMode = mount.flameMode; DragonLordSpawner instance = DragonLordSpawner.Instance; if ((Object)(object)instance != (Object)null) { Transform saddleGO = instance.GetSaddleGO(); Transform mountPoint = instance.GetMountPoint(); Transform saddleTransform = instance.GetSaddleTransform(); if ((Object)(object)saddleGO != (Object)null) { savedSaddleX = saddleGO.localPosition.x; savedSaddleY = saddleGO.localPosition.y; savedSaddleZ = saddleGO.localPosition.z; } if ((Object)(object)mountPoint != (Object)null) { savedMountX = mountPoint.localPosition.x; savedMountY = mountPoint.localPosition.y; savedMountZ = mountPoint.localPosition.z; } if ((Object)(object)saddleTransform != (Object)null) { savedSaddleVisualScale = saddleTransform.localScale.x; } } } public static void ApplySavedValues(DragonLordMount mount) { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)mount == (Object)null || !hasSavedValues) { return; } if (savedVersion != 3) { Debug.Log((object)"[DragonLord] Skipping stale saved values (old version)"); hasSavedValues = false; return; } mount.thrustSpeed = savedThrust; mount.sprintMultiplier = savedSprint; mount.turnRate = savedTurnRate; mount.pitchRate = savedPitchRate; mount.bankRate = savedBankRate; mount.accelTime = savedAccel; mount.decelTime = savedDecel; mount.maxPitchAngle = savedMaxPitch; mount.maxBankAngle = savedMaxBank; mount.animSmoothTime = savedAnimSmooth; mount.mountCameraDistance = savedCamDist; mount.hoverAmplitude = savedHoverAmp; mount.hoverFrequency = savedHoverFreq; mount.followSpeed = savedFollowSpeed; mount.hoverHeight = savedHoverHeight; mount.fireballDamage = savedFireDamage; mount.fireballSpeed = savedFireSpeed; mount.fireballAOE = savedFireAOE; mount.bodyTintColor = savedBodyTint; mount.hueShift = savedHue; mount.saturationShift = savedSat; mount.valueShift = savedVal; mount.flameOffset = savedFlameOffset; mount.flameScale = savedFlameScale; mount.flameEmberRate = savedFlameEmberRate; mount.flameAttackRate = savedFlameAttackRate; mount.flameMode = savedFlameMode; DragonLordSpawner instance = DragonLordSpawner.Instance; if ((Object)(object)instance != (Object)null) { Transform saddleGO = instance.GetSaddleGO(); Transform mountPoint = instance.GetMountPoint(); Transform saddleTransform = instance.GetSaddleTransform(); if ((Object)(object)saddleGO != (Object)null) { saddleGO.localPosition = new Vector3(savedSaddleX, savedSaddleY, savedSaddleZ); } if ((Object)(object)mountPoint != (Object)null) { mountPoint.localPosition = new Vector3(savedMountX, savedMountY, savedMountZ); } if ((Object)(object)saddleTransform != (Object)null && savedSaddleVisualScale > 0f) { saddleTransform.localScale = Vector3.one * savedSaddleVisualScale; } } Debug.Log((object)"[DragonLord] Applied saved GUI values from previous summon"); } private void Awake() { Instance = this; } private void OnDestroy() { if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } if ((Object)(object)bgTexture != (Object)null) { Object.Destroy((Object)(object)bgTexture); } } public void Toggle() { IsOpen = !IsOpen; if (IsOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void Update() { if (IsOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; if (Input.GetKeyDown((KeyCode)27)) { Toggle(); Input.ResetInputAxes(); } } } private void OnGUI() { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if (IsOpen) { InitStyles(); GUI.depth = 0; GUI.skin.label.fontSize = 14; GUI.skin.button.fontSize = 14; GUI.skin.horizontalSlider.fixedHeight = 16f; GUI.skin.horizontalSliderThumb.fixedHeight = 20f; GUI.skin.horizontalSliderThumb.fixedWidth = 14f; GUI.skin.toggle.fontSize = 14; windowRect = GUI.Window(94701, windowRect, new WindowFunction(DrawWindow), "", windowStyle); if (Event.current.isMouse && !((Rect)(ref windowRect)).Contains(Event.current.mousePosition)) { Event.current.Use(); } } } private void InitStyles() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0152: 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_0172: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) if (!stylesReady) { bgTexture = new Texture2D(1, 1); bgTexture.SetPixel(0, 0, new Color(0.05f, 0.05f, 0.08f, 0.92f)); bgTexture.Apply(); windowStyle = new GUIStyle(GUI.skin.window); windowStyle.normal.background = bgTexture; windowStyle.onNormal.background = bgTexture; windowStyle.padding = new RectOffset(12, 12, 8, 8); headerStyle = new GUIStyle(GUI.skin.label); headerStyle.fontStyle = (FontStyle)1; headerStyle.fontSize = 16; headerStyle.normal.textColor = new Color(1f, 0.85f, 0.3f); headerStyle.margin = new RectOffset(4, 4, 12, 4); labelStyle = new GUIStyle(GUI.skin.label); labelStyle.fontSize = 14; labelStyle.normal.textColor = new Color(0.9f, 0.9f, 0.9f); valueStyle = new GUIStyle(GUI.skin.label); valueStyle.alignment = (TextAnchor)4; valueStyle.fontStyle = (FontStyle)1; valueStyle.fontSize = 14; valueStyle.fixedWidth = 75f; valueStyle.normal.textColor = new Color(0.5f, 1f, 0.5f); buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.fontSize = 14; buttonStyle.fontStyle = (FontStyle)1; closeBtnStyle = new GUIStyle(GUI.skin.button); closeBtnStyle.fontStyle = (FontStyle)1; closeBtnStyle.fontSize = 16; closeBtnStyle.normal.textColor = Color.red; toggleStyle = new GUIStyle(GUI.skin.toggle); toggleStyle.fontSize = 14; toggleStyle.normal.textColor = new Color(0.9f, 0.9f, 0.9f); stylesReady = true; } } private void DrawWindow(int id) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f4: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0650: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_079a: Unknown result type (might be due to invalid IL or missing references) //IL_07a1: Unknown result type (might be due to invalid IL or missing references) //IL_0db3: Unknown result type (might be due to invalid IL or missing references) //IL_0814: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_0803: Unknown result type (might be due to invalid IL or missing references) //IL_0808: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Unknown result type (might be due to invalid IL or missing references) //IL_0846: Unknown result type (might be due to invalid IL or missing references) //IL_084b: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal(Array.Empty()); GUIStyle val = new GUIStyle(headerStyle); val.fontSize = 18; val.normal.textColor = new Color(1f, 0.7f, 0.1f); GUILayout.Label("DragonLord Adjustments", val, Array.Empty()); GUILayout.FlexibleSpace(); if (GUILayout.Button("X", closeBtnStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(36f), GUILayout.Height(28f) })) { Toggle(); } GUILayout.EndHorizontal(); GUILayout.Space(4f); DragonLordMount instance = DragonLordMount.Instance; if ((Object)(object)instance == (Object)null) { GUILayout.Space(20f); GUILayout.Label("No dragon summoned. Press G to summon first.", labelStyle, Array.Empty()); GUI.DragWindow(); return; } scrollPos = GUILayout.BeginScrollView(scrollPos, Array.Empty()); GUILayout.Label("Dragon", headerStyle, Array.Empty()); Transform val2 = (((Object)(object)DragonLordPlugin.currentMount != (Object)null) ? DragonLordPlugin.currentMount.transform.Find("Visual") : null); if ((Object)(object)val2 != (Object)null) { float x = val2.localScale.x; x = DrawRow("Scale", x, 0.3f, 5f, 0.05f); val2.localScale = Vector3.one * x; } bool flag = dragonFrozen; dragonFrozen = GUILayout.Toggle(dragonFrozen, " Freeze Dragon (for saddle placement)", toggleStyle, Array.Empty()); if (dragonFrozen != flag && (Object)(object)DragonLordPlugin.currentMount != (Object)null) { Animator componentInChildren = DragonLordPlugin.currentMount.GetComponentInChildren(); MonsterAI component = DragonLordPlugin.currentMount.GetComponent(); Rigidbody component2 = DragonLordPlugin.currentMount.GetComponent(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.speed = (dragonFrozen ? 0f : 1f); } if ((Object)(object)component != (Object)null) { if (dragonFrozen) { component.SetFollowTarget((GameObject)null); } else if ((Object)(object)Player.m_localPlayer != (Object)null) { component.SetFollowTarget(((Component)Player.m_localPlayer).gameObject); } } if ((Object)(object)component2 != (Object)null) { component2.isKinematic = dragonFrozen; } } GUILayout.Space(6f); GUILayout.Label("Dragon Color", headerStyle, Array.Empty()); Color bodyTintColor = instance.bodyTintColor; bodyTintColor.r = DrawRow("Tint Red", bodyTintColor.r, 0f, 1f, 0.01f); bodyTintColor.g = DrawRow("Tint Green", bodyTintColor.g, 0f, 1f, 0.01f); bodyTintColor.b = DrawRow("Tint Blue", bodyTintColor.b, 0f, 1f, 0.01f); instance.bodyTintColor = bodyTintColor; instance.hueShift = DrawRow("Hue Shift", instance.hueShift, -0.5f, 0.5f, 0.01f); instance.saturationShift = DrawRow("Saturation", instance.saturationShift, -1f, 1f, 0.05f); instance.valueShift = DrawRow("Brightness", instance.valueShift, -1f, 0.5f, 0.05f); if (GUILayout.Button("Apply Color", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { DragonLordSpawner.ApplyDragonColors(DragonLordPlugin.currentMount); } if (GUILayout.Button("Reset to White", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) })) { instance.bodyTintColor = Color.white; instance.hueShift = 0f; instance.saturationShift = 0f; instance.valueShift = 0f; DragonLordSpawner.ApplyDragonColors(DragonLordPlugin.currentMount); } GUILayout.Space(6f); GUILayout.Label("Saddle Position (bone-local)", headerStyle, Array.Empty()); DragonLordSpawner instance2 = DragonLordSpawner.Instance; if ((Object)(object)instance2 != (Object)null) { Transform saddleGO = instance2.GetSaddleGO(); Transform mountPoint = instance2.GetMountPoint(); Transform saddleTransform = instance2.GetSaddleTransform(); if ((Object)(object)saddleGO != (Object)null) { Vector3 localPosition = saddleGO.localPosition; localPosition.x = DrawRow("Saddle X", localPosition.x, -0.02f, 0.02f, 0.0005f, "F4"); localPosition.y = DrawRow("Saddle Y", localPosition.y, -0.02f, 0.02f, 0.0005f, "F4"); localPosition.z = DrawRow("Saddle Z", localPosition.z, -0.02f, 0.02f, 0.0005f, "F4"); saddleGO.localPosition = localPosition; saddleRot.x = DrawRow("Saddle Pitch", saddleRot.x, 0f, 360f, 5f); saddleRot.y = DrawRow("Saddle Yaw", saddleRot.y, 0f, 360f, 5f); saddleRot.z = DrawRow("Saddle Roll", saddleRot.z, 0f, 360f, 5f); saddleGO.localRotation = Quaternion.Euler(saddleRot); } if ((Object)(object)mountPoint != (Object)null) { Vector3 localPosition2 = mountPoint.localPosition; localPosition2.x = DrawRow("Seat X", localPosition2.x, -0.02f, 0.02f, 0.0005f, "F4"); localPosition2.y = DrawRow("Seat Y", localPosition2.y, -0.02f, 0.02f, 0.0005f, "F4"); localPosition2.z = DrawRow("Seat Z", localPosition2.z, -0.02f, 0.02f, 0.0005f, "F4"); mountPoint.localPosition = localPosition2; seatRot.x = DrawRow("Seat Pitch", seatRot.x, 0f, 360f, 5f); seatRot.y = DrawRow("Seat Yaw", seatRot.y, 0f, 360f, 5f); seatRot.z = DrawRow("Seat Roll", seatRot.z, 0f, 360f, 5f); mountPoint.localRotation = Quaternion.Euler(seatRot); } if ((Object)(object)saddleTransform != (Object)null) { float x2 = saddleTransform.localScale.x; x2 = DrawRow("Saddle Size", x2, 0.001f, 0.05f, 0.001f, "F3"); saddleTransform.localScale = Vector3.one * x2; } GUILayout.Space(4f); if (GUILayout.Button("Reset Saddle to Default", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { if ((Object)(object)saddleGO != (Object)null) { saddleGO.localPosition = DEF_SADDLE_POS; saddleGO.localRotation = Quaternion.Euler(DEF_SADDLE_ROT); } saddleRot = DEF_SADDLE_ROT; seatRot = DEF_SEAT_ROT; if ((Object)(object)mountPoint != (Object)null) { mountPoint.localPosition = DEF_SEAT_POS; mountPoint.localRotation = Quaternion.Euler(DEF_SEAT_ROT); } if ((Object)(object)saddleTransform != (Object)null) { saddleTransform.localScale = Vector3.one * 0.002f; } } } else { GUILayout.Label(" Saddle not found", labelStyle, Array.Empty()); } GUILayout.Space(6f); GUILayout.Label("Flight", headerStyle, Array.Empty()); instance.thrustSpeed = DrawRow("Flight Speed", instance.thrustSpeed, 10f, 80f, 1f); instance.sprintMultiplier = DrawRow("Sprint Multi", instance.sprintMultiplier, 1f, 3f, 0.1f); instance.turnRate = DrawRow("Turn Rate", instance.turnRate, 30f, 180f, 5f); instance.verticalForce = DrawRow("Vertical Force", instance.verticalForce, 5f, 30f, 1f); GUILayout.Space(6f); GUILayout.Label("Flight Feel", headerStyle, Array.Empty()); instance.accelTime = DrawRow("Accel Time", instance.accelTime, 0.1f, 2f, 0.1f); instance.decelTime = DrawRow("Decel Time", instance.decelTime, 0.5f, 5f, 0.1f); instance.brakeTime = DrawRow("Brake Time", instance.brakeTime, 0.1f, 1.5f, 0.05f); instance.maxPitchAngle = DrawRow("Max Pitch", instance.maxPitchAngle, 10f, 60f, 5f); instance.maxBankAngle = DrawRow("Max Bank", instance.maxBankAngle, 10f, 60f, 5f); instance.animSmoothForward = DrawRow("Anim Fwd", instance.animSmoothForward, 0.01f, 0.5f, 0.01f); instance.animSmoothBank = DrawRow("Anim Bank", instance.animSmoothBank, 0.01f, 0.5f, 0.01f); instance.animSmoothPitch = DrawRow("Anim Pitch", instance.animSmoothPitch, 0.01f, 0.5f, 0.01f); instance.mountCameraDistance = DrawRow("Camera Dist", instance.mountCameraDistance, 6f, 40f, 1f); if (DragonLordMount.IsMounted() && (Object)(object)GameCamera.instance != (Object)null) { GameCamera.instance.m_maxDistance = instance.mountCameraDistance; } GUILayout.Space(6f); GUILayout.Label("Hover", headerStyle, Array.Empty()); instance.hoverAmplitude = DrawRow("Bob Height", instance.hoverAmplitude, 0f, 2f, 0.05f); instance.hoverFrequency = DrawRow("Bob Speed", instance.hoverFrequency, 0.1f, 3f, 0.1f); GUILayout.Space(6f); GUILayout.Label("Follow Behavior", headerStyle, Array.Empty()); instance.followSpeed = DrawRow("Follow Speed", instance.followSpeed, 5f, 50f, 1f); instance.hoverHeight = DrawRow("Hover Height", instance.hoverHeight, 2f, 30f, 0.5f); GUILayout.Space(6f); GUILayout.Label("Fire Breath", headerStyle, Array.Empty()); instance.fireballDamage = DrawRow("Damage", instance.fireballDamage, 10f, 500f, 10f); instance.fireballSpeed = DrawRow("Speed", instance.fireballSpeed, 10f, 80f, 1f); instance.fireballAOE = DrawRow("AOE Radius", instance.fireballAOE, 1f, 10f, 0.5f); instance.fireballCooldown = DrawRow("Fire Rate", instance.fireballCooldown, 0.01f, 1f, 0.01f); GUILayout.Space(6f); GUILayout.Label(" LMB = Fireballs | RMB = Roar + Jaw Open", labelStyle, Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Diagnostics", headerStyle, Array.Empty()); instance.flightTelemetry = GUILayout.Toggle(instance.flightTelemetry, " Flight Telemetry (logs to BepInEx)", toggleStyle, Array.Empty()); GUILayout.Space(12f); if (GUILayout.Button("Log All Values to Console", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { LogAllValues(instance); } GUILayout.Space(6f); GUILayout.EndScrollView(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 30f)); } private float DrawRow(string label, float value, float min, float max, float step, string fmt = "F2") { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(label, labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); if (GUILayout.Button("--", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(32f), GUILayout.Height(24f) })) { value -= step * 5f; } if (GUILayout.Button("-", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(24f) })) { value -= step; } value = GUILayout.HorizontalSlider(value, min, max, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); if (GUILayout.Button("+", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(26f), GUILayout.Height(24f) })) { value += step; } if (GUILayout.Button("++", buttonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(32f), GUILayout.Height(24f) })) { value += step * 5f; } GUILayout.Label(value.ToString(fmt), valueStyle, Array.Empty()); GUILayout.EndHorizontal(); return Mathf.Clamp(value, min, max); } private void LogAllValues(DragonLordMount mount) { Debug.Log((object)"[DragonLord] ═══ CURRENT VALUES ═══"); Debug.Log((object)$"[DragonLord] Flight: thrust={mount.thrustSpeed:F0} sprint={mount.sprintMultiplier:F1}x turn={mount.turnRate:F0} pitch={mount.pitchRate:F0} bank={mount.bankRate:F0}"); Debug.Log((object)$"[DragonLord] Feel: accel={mount.accelTime:F1} decel={mount.decelTime:F1} maxPitch={mount.maxPitchAngle:F0} maxBank={mount.maxBankAngle:F0} animSmooth={mount.animSmoothTime:F2} camDist={mount.mountCameraDistance:F0}"); Debug.Log((object)$"[DragonLord] Hover: amplitude={mount.hoverAmplitude:F2} frequency={mount.hoverFrequency:F2}"); Debug.Log((object)$"[DragonLord] Follow: speed={mount.followSpeed:F0} height={mount.hoverHeight:F1}"); Debug.Log((object)"[DragonLord] ═══════════════════════"); if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, "Values logged to BepInEx console", 0, (Sprite)null); } } } public class DragonLordMount : MonoBehaviour { public enum MountState { Summoning, Grounded, Following, Staying, Mounted, Flying, Landing } [CompilerGenerated] private sealed class d__138 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public DragonLordMount <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__138(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.forceJawOpen = true; <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.forceJawOpen = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static DragonLordMount Instance; public MountState currentState = MountState.Summoning; public Animator animator; public float followSpeed = 15f; public float hoverHeight = 8f; private float followStopDist = 8f; private float rotSpeed = 3f; public float thrustSpeed = 10f; public float sprintMultiplier = 1f; public float turnRate = 48.89f; public float pitchRate = 60f; public float bankRate = 80f; public float hoverAmplitude = 0.44f; public float hoverFrequency = 1.8f; public float accelTime = 0.38f; public float decelTime = 0.82f; public float brakeTime = 0.22f; public float maxPitchAngle = 45f; public float maxBankAngle = 35f; public float animSmoothTime = 0.12f; public float animSmoothForward = 0.12f; public float animSmoothBank = 0.2f; public float animSmoothPitch = 0.09f; public float mountCameraDistance = 20f; public Transform neckBone; public Transform neck2Bone; public Transform neck3Bone; public Transform headBone; public Transform jawBone; private float aimBlendWeight = 0f; private float aimBlendRef = 0f; public bool isAiming = false; public float verticalForce = 6.95f; private Vector3 velocitySmoothRef; private float currentYaw; private float currentPitch; private float currentBank; private float pitchSmoothRef; private float bankSmoothRef; private float animForwardSpeed; private float animSideSpeed; private float animTurnSpeed; private float animForwardRef; private float animSideRef; private float animTurnRef; private Vector3 lastFlatVelDir = Vector3.forward; private float hoverPhase = 0f; private Vector3 flightDesiredDir; private bool inputW; private bool inputS; private bool inputA; private bool inputD; private bool inputSpace; private bool inputCtrl; private bool inputShift; private bool isLanding = false; private float landingTargetY; private bool landingKeepsRider = false; private float origDrag; private float origAngularDrag; private bool origUseGravity; private RigidbodyInterpolation origInterp; private CollisionDetectionMode origCollisionMode; private bool preFlightIsKinematic; public Color bodyTintColor = new Color(0.56f, 0f, 0f, 1f); public float hueShift = 0f; public float saturationShift = -0.02f; public float valueShift = -0.17f; public float fireballDamage = 132.46f; public float fireballSpeed = 15f; public float fireballAOE = 7.87f; public float fireballCooldown = 0.05f; private float fireballTimer = 0f; private float breathRoarTimer = 0f; public float breathRoarCooldown = 5.5f; private GameObject breathInSfxPrefab; private GameObject breathOutSfxPrefab; private GameObject breathSfxInstance; private bool wasBreathing = false; private float breathStartTimer = 0f; private GameObject[] breathRoarPrefabs; public Vector3 flameOffset = new Vector3(0f, 0.1f, 0.5f); public float flameScale = 2.88f; public float flameEmberRate = 5f; public float flameAttackRate = 40f; public int flameMode = 2; private GameObject mouthFlameGO; private ParticleSystem[] mouthPS; private Sadle cachedSadle; private MonsterAI cachedMonsterAI; private Character cachedCharacter; private Rigidbody cachedRigidbody; private FootStep[] cachedFootSteps; private CharacterAnimEvent[] cachedAnimEvents; private AudioSource[] cachedStompAudio; private bool[] cachedStompOrigMute; private float[] cachedStompOrigVol; private bool groundStompConfigured = false; private bool groundStompActive = false; public bool flightTelemetry = false; private float telemetryTimer; private float savedCameraDistance; private bool cameraWasModified = false; private Quaternion flightTargetRot; private bool hasFlightTargetRot = false; public float jawOpenAngle = 55f; private bool isBreathing = false; private bool forceJawOpen = false; private Vector3 flightVel; private void Awake() { //IL_0082: 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_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) Instance = this; cachedSadle = ((Component)this).GetComponentInChildren(); cachedMonsterAI = ((Component)this).GetComponent(); cachedCharacter = ((Component)this).GetComponent(); cachedRigidbody = ((Component)this).GetComponent(); if ((Object)(object)cachedRigidbody != (Object)null) { origDrag = cachedRigidbody.drag; origAngularDrag = cachedRigidbody.angularDrag; origUseGravity = cachedRigidbody.useGravity; origInterp = cachedRigidbody.interpolation; origCollisionMode = cachedRigidbody.collisionDetectionMode; } } private void OnDestroy() { if (cameraWasModified && (Object)(object)GameCamera.instance != (Object)null && savedCameraDistance > 0f) { GameCamera.instance.m_maxDistance = savedCameraDistance; cameraWasModified = false; } neckBone = null; neck2Bone = null; neck3Bone = null; headBone = null; jawBone = null; if ((Object)(object)breathSfxInstance != (Object)null) { Object.Destroy((Object)(object)breathSfxInstance); breathSfxInstance = null; } if ((Object)(object)mouthFlameGO != (Object)null) { Object.Destroy((Object)(object)mouthFlameGO); } mouthFlameGO = null; mouthPS = null; SetGroundStompActive(active: false); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } public void ConfigureGroundStomp(FootStep[] footSteps, CharacterAnimEvent[] animEvents, AudioSource[] stompAudio, bool[] origMute, float[] origVol) { cachedFootSteps = footSteps; cachedAnimEvents = animEvents; cachedStompAudio = stompAudio; cachedStompOrigMute = origMute; cachedStompOrigVol = origVol; groundStompConfigured = true; Debug.Log((object)$"[DragonLord] Ground stomp configured: {((footSteps != null) ? footSteps.Length : 0)} FootStep, {((animEvents != null) ? animEvents.Length : 0)} AnimEvent, {((stompAudio != null) ? stompAudio.Length : 0)} AudioSource"); } public void SetGroundStompActive(bool active) { if (!groundStompConfigured || groundStompActive == active) { return; } groundStompActive = active; if (cachedFootSteps != null) { for (int i = 0; i < cachedFootSteps.Length; i++) { if ((Object)(object)cachedFootSteps[i] != (Object)null) { ((Behaviour)cachedFootSteps[i]).enabled = active; } } } if (cachedAnimEvents != null) { for (int j = 0; j < cachedAnimEvents.Length; j++) { if ((Object)(object)cachedAnimEvents[j] != (Object)null) { ((Behaviour)cachedAnimEvents[j]).enabled = active; } } } if (cachedStompAudio == null || cachedStompOrigMute == null || cachedStompOrigVol == null) { return; } for (int k = 0; k < cachedStompAudio.Length; k++) { if (!((Object)(object)cachedStompAudio[k] == (Object)null)) { if (active) { cachedStompAudio[k].mute = cachedStompOrigMute[k]; cachedStompAudio[k].volume = cachedStompOrigVol[k]; } else { cachedStompAudio[k].mute = true; cachedStompAudio[k].volume = 0f; } } } } private void Update() { if (currentState != 0) { bool flag = IsNativelyMounted(); bool flag2 = currentState == MountState.Mounted || currentState == MountState.Flying || (currentState == MountState.Landing && landingKeepsRider); if (flag && !flag2) { OnMounted(); } else if (!flag && flag2) { OnDismounted(); } switch (currentState) { case MountState.Summoning: break; case MountState.Grounded: UpdateGrounded(); break; case MountState.Following: UpdateFollow(); break; case MountState.Staying: UpdateStay(); break; case MountState.Mounted: UpdateMountedGround(); break; case MountState.Flying: UpdateMountedFlying(); break; case MountState.Landing: break; } } } private void LateUpdate() { //IL_003b: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) bool flag = currentState == MountState.Mounted || currentState == MountState.Flying; if (flag) { if (currentState == MountState.Flying && hasFlightTargetRot) { ((Component)this).transform.rotation = flightTargetRot; } if (currentState == MountState.Flying) { UpdateFlightAnimator(flying: true, flightVel, flightDesiredDir); } } if ((forceJawOpen || ((isBreathing || Input.GetMouseButton(0)) && flag)) && (Object)(object)jawBone != (Object)null && !DragonLordPlugin.IsGuiOpen()) { Transform obj = jawBone; obj.localRotation *= Quaternion.Euler(jawOpenAngle, 0f, 0f); } if (flag) { if (aimBlendWeight > 0.001f && (Object)(object)neckBone != (Object)null && (Object)(object)headBone != (Object)null) { ApplyNeckAim(aimBlendWeight); } TryFireBreath(); TryFireBreathSpell(); } } private bool IsNativelyMounted() { if ((Object)(object)cachedSadle == (Object)null) { cachedSadle = ((Component)this).GetComponentInChildren(); } if ((Object)(object)cachedSadle == (Object)null) { return false; } return cachedSadle.HaveValidUser(); } private void OnMounted() { currentState = MountState.Mounted; if ((Object)(object)cachedMonsterAI != (Object)null) { cachedMonsterAI.SetFollowTarget((GameObject)null); } aimBlendWeight = 0f; aimBlendRef = 0f; if ((Object)(object)GameCamera.instance != (Object)null) { savedCameraDistance = GameCamera.instance.m_maxDistance; GameCamera.instance.m_maxDistance = mountCameraDistance; FieldInfo field = typeof(GameCamera).GetField("m_distance", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(GameCamera.instance, mountCameraDistance); } cameraWasModified = true; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { ((Character)localPlayer).Message((MessageType)2, "DragonLord: Riding\n[WASD] Walk [Space] Take Off [LMB] Fire", 0, (Sprite)null); } Debug.Log((object)"[DragonLord] Mounted — ground riding (Space to fly)"); } private void EnterFlight() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) currentState = MountState.Flying; if ((Object)(object)cachedRigidbody != (Object)null) { preFlightIsKinematic = cachedRigidbody.isKinematic; cachedRigidbody.isKinematic = false; cachedRigidbody.useGravity = false; cachedRigidbody.drag = 0.2f; cachedRigidbody.angularDrag = 0f; cachedRigidbody.interpolation = (RigidbodyInterpolation)1; cachedRigidbody.collisionDetectionMode = (CollisionDetectionMode)2; cachedRigidbody.linearVelocity = Vector3.zero; cachedRigidbody.angularVelocity = Vector3.zero; } if ((Object)(object)cachedCharacter != (Object)null) { cachedCharacter.m_flying = true; } flightVel = Vector3.zero; velocitySmoothRef = Vector3.zero; currentYaw = ((Component)this).transform.eulerAngles.y; currentPitch = 0f; currentBank = 0f; pitchSmoothRef = 0f; bankSmoothRef = 0f; hasFlightTargetRot = false; flightTargetRot = ((Component)this).transform.rotation; animForwardSpeed = 0f; animSideSpeed = 0f; animTurnSpeed = 0f; animForwardRef = 0f; animSideRef = 0f; animTurnRef = 0f; lastFlatVelDir = ((Component)this).transform.forward; if ((Object)(object)animator != (Object)null) { DragonLordSpawner.SetAnimatorSafe(animator, "flying", value: true); DragonLordSpawner.SetAnimatorSafe(animator, "fly_takeoff"); } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { ((Character)localPlayer).Message((MessageType)2, "DragonLord: Flying!\n[W] Fly toward camera [S] Brake [Space] Up [Ctrl] Down", 0, (Sprite)null); } Debug.Log((object)"[DragonLord] Entered flight mode"); } private void OnDismounted() { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) bool flag = currentState == MountState.Flying; StopBreath(); if (cameraWasModified && (Object)(object)GameCamera.instance != (Object)null && savedCameraDistance > 0f) { GameCamera.instance.m_maxDistance = savedCameraDistance; cameraWasModified = false; } aimBlendWeight = 0f; aimBlendRef = 0f; flightVel = Vector3.zero; velocitySmoothRef = Vector3.zero; isLanding = false; float num = 0f; if (flag && (Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(((Component)this).transform.position, ref num)) { float num2 = ((Component)this).transform.position.y - num; if (num2 > 0.5f && num2 < 8f) { isLanding = true; landingTargetY = num + 1f; if ((Object)(object)cachedRigidbody != (Object)null && !cachedRigidbody.isKinematic) { Vector3 linearVelocity = cachedRigidbody.linearVelocity; linearVelocity.y = Mathf.Min(linearVelocity.y, -3f); cachedRigidbody.linearVelocity = linearVelocity; } currentState = MountState.Landing; if ((Object)(object)animator != (Object)null) { DragonLordSpawner.SetAnimatorSafe(animator, "fly_land"); } Debug.Log((object)"[DragonLord] Dismounted -> Landing (smooth descent, flying=true)"); return; } } if ((Object)(object)cachedCharacter != (Object)null) { cachedCharacter.m_flying = false; } if (flag) { UpdateFlightAnimator(flying: false, Vector3.zero, ((Component)this).transform.forward); } RestoreRigidbody(); currentState = MountState.Grounded; Debug.Log((object)"[DragonLord] Dismounted -> Grounded"); } private void RestoreRigidbody() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) if (!((Object)(object)cachedRigidbody == (Object)null)) { cachedRigidbody.linearVelocity = Vector3.zero; cachedRigidbody.angularVelocity = Vector3.zero; cachedRigidbody.useGravity = origUseGravity; cachedRigidbody.drag = origDrag; cachedRigidbody.angularDrag = origAngularDrag; cachedRigidbody.interpolation = origInterp; cachedRigidbody.collisionDetectionMode = origCollisionMode; cachedRigidbody.isKinematic = preFlightIsKinematic; } } private void UpdateFlightAnimator(bool flying, Vector3 worldVelocity, Vector3 desiredWorldDir) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)animator == (Object)null) { return; } Quaternion val = Quaternion.Euler(0f, currentYaw, 0f); Vector3 val2 = Quaternion.Inverse(val) * worldVelocity; float num = Mathf.Max(thrustSpeed, 0.01f); float num2 = 0f; float num3 = 0f; float num4 = 0f; if (flying) { num2 = Mathf.Max(val2.z, 3f); Vector3 val3 = val * Vector3.forward; val3.y = 0f; Vector3 val4 = desiredWorldDir; val4.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude > 0.001f && ((Vector3)(ref val4)).sqrMagnitude > 0.001f) { ((Vector3)(ref val3)).Normalize(); ((Vector3)(ref val4)).Normalize(); float num5 = Vector3.SignedAngle(val3, val4, Vector3.up); num4 = Mathf.Clamp(num5 / 60f, -1f, 1f); float num6 = Mathf.Clamp(val2.x / (num * 0.6f), -1f, 1f); num3 = Mathf.Clamp(num6 + num4 * 0.35f, -1f, 1f); } } if (flying && inputShift && num2 > 2f) { num2 = Mathf.Max(num2, 25f); num3 *= 0.15f; num4 *= 0.15f; } animForwardSpeed = Mathf.SmoothDamp(animForwardSpeed, num2, ref animForwardRef, animSmoothForward); animSideSpeed = Mathf.SmoothDamp(animSideSpeed, num3, ref animSideRef, animSmoothBank); animTurnSpeed = Mathf.SmoothDamp(animTurnSpeed, num4, ref animTurnRef, animSmoothBank); DragonLordSpawner.SetAnimatorSafe(animator, "flying", flying); DragonLordSpawner.SetAnimatorSafe(animator, "forward_speed", animForwardSpeed); DragonLordSpawner.SetAnimatorSafe(animator, "sideway_speed", animSideSpeed); DragonLordSpawner.SetAnimatorSafe(animator, "turn_speed", animTurnSpeed); } private void ApplyNeckAim(float blendWeight) { //IL_001f: 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_003b: 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_008d: 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) if (!((Object)(object)GameCamera.instance == (Object)null)) { Vector3 forward = ((Component)GameCamera.instance).transform.forward; if ((Object)(object)neckBone != (Object)null) { ApplyAimToBone(neckBone, forward, 0.2f, 18f, blendWeight); } if ((Object)(object)neck2Bone != (Object)null) { ApplyAimToBone(neck2Bone, forward, 0.2f, 18f, blendWeight); } if ((Object)(object)neck3Bone != (Object)null) { ApplyAimToBone(neck3Bone, forward, 0.3f, 25f, blendWeight); } if ((Object)(object)headBone != (Object)null) { ApplyAimToBone(headBone, forward, 0.3f, 28f, blendWeight); } } } private static void ApplyAimToBone(Transform bone, Vector3 aimWorldDir, float boneContribution, float maxAngleDeg, float blendWeight) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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_0055: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) Quaternion localRotation = bone.localRotation; Vector3 val = Vector3.up; if (Mathf.Abs(Vector3.Dot(aimWorldDir, val)) > 0.99f) { val = Vector3.forward; } Quaternion val2 = Quaternion.LookRotation(aimWorldDir, val); Quaternion val3 = (((Object)(object)bone.parent != (Object)null) ? bone.parent.rotation : Quaternion.identity); Quaternion val4 = Quaternion.Inverse(val3) * val2; float num = Quaternion.Angle(localRotation, val4); if (num > maxAngleDeg) { val4 = Quaternion.Slerp(localRotation, val4, maxAngleDeg / num); } float num2 = blendWeight * boneContribution; bone.localRotation = Quaternion.Slerp(localRotation, val4, num2); } private void TryFireBreath() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) if (DragonLordPlugin.IsGuiOpen() || !Input.GetMouseButton(0)) { return; } fireballTimer -= Time.deltaTime; if (fireballTimer > 0f) { return; } fireballTimer = fireballCooldown; Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab("staff_fireball_projectile") : null); if ((Object)(object)val == (Object)null) { return; } Transform val2 = (((Object)(object)jawBone != (Object)null) ? jawBone : headBone); if ((Object)(object)val2 == (Object)null) { return; } Vector3 val3 = val2.position + val2.forward * 2f; Vector3 val4 = (((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).transform.forward : (((Object)(object)headBone != (Object)null) ? headBone.forward : ((Component)this).transform.forward)); try { GameObject val5 = Object.Instantiate(val, val3, Quaternion.LookRotation(val4)); Projectile component = val5.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_gravity = 0.3f; component.m_damage.m_fire = fireballDamage; component.m_damage.m_blunt = fireballDamage * 0.5f; component.m_damage.m_chop = 40f; component.m_damage.m_pickaxe = 40f; component.m_aoe = fireballAOE; component.Setup((Character)(object)localPlayer, val4 * fireballSpeed, -1f, (HitData)null, (ItemData)null, (ItemData)null); } Rigidbody component2 = val5.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.useGravity = false; } } catch (Exception ex) { Debug.LogWarning((object)$"[DragonLord] Fireball failed: {ex.Message}"); } } public void PreloadFireBreath() { Debug.Log((object)"[DragonLord] === PRE-LOADING FIRE BREATH SOUNDS ==="); if (!((Object)(object)ZNetScene.instance != (Object)null)) { return; } breathInSfxPrefab = ZNetScene.instance.GetPrefab("sfx_fader_firebreath_in"); breathOutSfxPrefab = ZNetScene.instance.GetPrefab("sfx_fader_firebreath_out"); Debug.Log((object)string.Format("[DragonLord] Breath sounds: in={0}, out={1}", ((Object)(object)breathInSfxPrefab != (Object)null) ? "found" : "MISSING", ((Object)(object)breathOutSfxPrefab != (Object)null) ? "found" : "MISSING")); List list = new List(); string[] array = new string[3] { "sfx_fader_charredsummon_roar", "sfx_fader_taunt", "sfx_fader_firebreath_in" }; for (int i = 0; i < array.Length; i++) { GameObject prefab = ZNetScene.instance.GetPrefab(array[i]); if ((Object)(object)prefab != (Object)null) { list.Add(prefab); } } breathRoarPrefabs = list.ToArray(); Debug.Log((object)$"[DragonLord] Breath roar pool: {breathRoarPrefabs.Length} sounds"); } private void TryFireBreathSpell() { //IL_0091: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) bool flag = (isBreathing = !DragonLordPlugin.IsGuiOpen() && Input.GetMouseButton(1)); if (flag && !wasBreathing) { if ((Object)(object)breathSfxInstance != (Object)null) { Object.Destroy((Object)(object)breathSfxInstance); breathSfxInstance = null; } Vector3 val = (((Object)(object)jawBone != (Object)null) ? jawBone.position : (((Object)(object)headBone != (Object)null) ? headBone.position : ((Component)this).transform.position)); if ((Object)(object)breathInSfxPrefab != (Object)null) { breathSfxInstance = Object.Instantiate(breathInSfxPrefab, val, Quaternion.identity); } if (breathRoarPrefabs != null && breathRoarPrefabs.Length != 0 && Random.value < 0.35f) { GameObject val2 = Object.Instantiate(breathRoarPrefabs[Random.Range(0, breathRoarPrefabs.Length)], val, Quaternion.identity); Object.Destroy((Object)(object)val2, 3f); } breathStartTimer = 0.3f; breathRoarTimer = Random.Range(4f, 7f); } if (!flag && wasBreathing && (Object)(object)breathSfxInstance != (Object)null) { Object.Destroy((Object)(object)breathSfxInstance); breathSfxInstance = null; } wasBreathing = flag; if (!flag) { return; } if (breathStartTimer > 0f) { breathStartTimer -= Time.deltaTime; if (breathStartTimer <= 0f && (Object)(object)breathOutSfxPrefab != (Object)null) { if ((Object)(object)breathSfxInstance != (Object)null) { Object.Destroy((Object)(object)breathSfxInstance); } Vector3 val3 = (((Object)(object)jawBone != (Object)null) ? jawBone.position : (((Object)(object)headBone != (Object)null) ? headBone.position : ((Component)this).transform.position)); breathSfxInstance = Object.Instantiate(breathOutSfxPrefab, val3, Quaternion.identity); } } if ((Object)(object)breathSfxInstance != (Object)null) { breathSfxInstance.transform.position = (((Object)(object)jawBone != (Object)null) ? jawBone.position : (((Object)(object)headBone != (Object)null) ? headBone.position : ((Component)this).transform.position)); } if (currentState != MountState.Flying) { return; } breathRoarTimer -= Time.deltaTime; if (breathRoarTimer <= 0f) { breathRoarTimer = Random.Range(4f, 7f); if (breathRoarPrefabs != null && breathRoarPrefabs.Length != 0 && Random.value < 0.25f) { Vector3 val4 = (((Object)(object)jawBone != (Object)null) ? jawBone.position : ((Component)this).transform.position); GameObject val5 = Object.Instantiate(breathRoarPrefabs[Random.Range(0, breathRoarPrefabs.Length)], val4, Quaternion.identity); Object.Destroy((Object)(object)val5, 3f); } } } private void StopBreath() { isBreathing = false; wasBreathing = false; if ((Object)(object)breathSfxInstance != (Object)null) { Object.Destroy((Object)(object)breathSfxInstance); breathSfxInstance = null; } } private void UpdateGrounded() { //IL_002b: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cachedRigidbody != (Object)null && !cachedRigidbody.isKinematic) { cachedRigidbody.linearVelocity = Vector3.zero; cachedRigidbody.angularVelocity = Vector3.zero; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } float num = Vector3.Distance(((Component)this).transform.position, ((Component)localPlayer).transform.position); if (num > 20f) { Vector3 val = ((Component)localPlayer).transform.position - ((Component)this).transform.position; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude > 0.01f) { Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val2, 3f * Time.deltaTime); } Vector3 position = ((Component)localPlayer).transform.position; position.y = ((Component)this).transform.position.y; ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, position, 6f * Time.deltaTime); float num2 = 0f; if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(((Component)this).transform.position, ref num2)) { Vector3 position2 = ((Component)this).transform.position; position2.y = num2 + 0.5f; ((Component)this).transform.position = position2; } } } private void UpdateFollow() { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0090: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Vector3 val = ((Component)localPlayer).transform.position + Vector3.up * hoverHeight; float num = Vector3.Distance(((Component)this).transform.position, val); if (num > followStopDist) { float num2 = followSpeed; if (num > followStopDist * 3f) { num2 *= 2f; } ((Component)this).transform.position = Vector3.MoveTowards(((Component)this).transform.position, val, num2 * Time.deltaTime); Vector3 val2 = val - ((Component)this).transform.position; val2.y *= 0.3f; if (((Vector3)(ref val2)).sqrMagnitude > 0.01f) { Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized); ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, rotSpeed * Time.deltaTime); } } } private void UpdateStay() { //IL_001f: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) float num = 0f; if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(((Component)this).transform.position, ref num)) { float num2 = num + 1f; if (((Component)this).transform.position.y > num2 + 0.5f) { Vector3 position = ((Component)this).transform.position; position.y = Mathf.MoveTowards(position.y, num2, followSpeed * Time.deltaTime); ((Component)this).transform.position = position; } } } private void FixedUpdate() { switch (currentState) { case MountState.Flying: UpdateFlightPhysics(); break; case MountState.Landing: UpdateLandingPhysics(); break; } } private void UpdateFlightPhysics() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01f3: 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_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: 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_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: 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_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0560: 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) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: 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_05c9: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)cachedRigidbody == (Object)null) && !((Object)(object)GameCamera.instance == (Object)null)) { float fixedDeltaTime = Time.fixedDeltaTime; Vector3 forward = ((Component)GameCamera.instance).transform.forward; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(forward.x, 0f, forward.z); if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { ((Vector3)(ref val))..ctor(((Component)this).transform.forward.x, 0f, ((Component)this).transform.forward.z); } ((Vector3)(ref val)).Normalize(); float num = thrustSpeed * (inputShift ? sprintMultiplier : 1f); float num2 = 0f; if (inputA && !inputD) { num2 = -1f; } else if (inputD && !inputA) { num2 = 1f; } float num3 = currentYaw; if (inputW && !inputS) { float num4 = Mathf.Atan2(val.x, val.z) * 57.29578f; currentYaw = Mathf.MoveTowardsAngle(currentYaw, num4, turnRate * fixedDeltaTime); } if (Mathf.Abs(num2) > 0.001f) { currentYaw += num2 * turnRate * fixedDeltaTime; } currentYaw = Mathf.Repeat(currentYaw + 360f, 360f); Vector3 val2 = Quaternion.Euler(0f, currentYaw, 0f) * Vector3.forward; Vector3 val3 = Vector3.zero; float num5 = decelTime; if (inputW && !inputS) { val3 += val2 * num; num5 = accelTime; } else if (inputS && !inputW) { num5 = brakeTime; } if (inputSpace) { val3.y += verticalForce; num5 = Mathf.Min(num5, accelTime); } if (inputCtrl) { val3.y -= verticalForce; num5 = Mathf.Min(num5, accelTime); } flightVel = Vector3.SmoothDamp(flightVel, val3, ref velocitySmoothRef, num5, float.PositiveInfinity, fixedDeltaTime); if (!cachedRigidbody.isKinematic) { cachedRigidbody.linearVelocity = flightVel; cachedRigidbody.angularVelocity = Vector3.zero; } hoverPhase += hoverFrequency * fixedDeltaTime * (float)Math.PI * 2f; if (hoverPhase > (float)Math.PI * 2f) { hoverPhase -= (float)Math.PI * 2f; } Vector3 val4 = new Vector3(flightVel.x, 0f, flightVel.z); float magnitude = ((Vector3)(ref val4)).magnitude; float num6 = Mathf.Clamp01(1f - magnitude / 5f); float num7 = Mathf.Sin(hoverPhase) * hoverAmplitude * num6; Vector3 val5 = cachedRigidbody.position + flightVel * fixedDeltaTime + new Vector3(0f, num7 * fixedDeltaTime, 0f); cachedRigidbody.MovePosition(val5); Vector3 val6 = default(Vector3); ((Vector3)(ref val6))..ctor(flightVel.x, 0f, flightVel.z); float magnitude2 = ((Vector3)(ref val6)).magnitude; float num8 = 0f; if (((Vector3)(ref flightVel)).sqrMagnitude > 0.01f) { num8 = Mathf.Clamp((0f - Mathf.Atan2(flightVel.y, Mathf.Max(magnitude2, 0.1f))) * 57.29578f, 0f - maxPitchAngle, maxPitchAngle); } currentPitch = Mathf.SmoothDamp(currentPitch, num8, ref pitchSmoothRef, animSmoothPitch); float num9 = Mathf.DeltaAngle(num3, currentYaw) / Mathf.Max(fixedDeltaTime, 0.0001f); float num10 = 0f; if (Mathf.Abs(num9) > 0.01f) { num10 = Mathf.Clamp((0f - num9 / Mathf.Max(turnRate, 0.01f)) * maxBankAngle, 0f - maxBankAngle, maxBankAngle); } currentBank = Mathf.SmoothDamp(currentBank, num10, ref bankSmoothRef, animSmoothBank); flightTargetRot = Quaternion.Euler(currentPitch, currentYaw, currentBank); cachedRigidbody.MoveRotation(flightTargetRot); hasFlightTargetRot = false; flightDesiredDir = val2; if (inputW && !inputS) { Quaternion val7 = Quaternion.Euler(0f, num2 * 30f, 0f); flightDesiredDir = val7 * val; } else if (Mathf.Abs(num2) > 0.001f) { flightDesiredDir = Quaternion.Euler(0f, num2 * 30f, 0f) * val2; } if (((Vector3)(ref val6)).sqrMagnitude > 0.01f) { lastFlatVelDir = ((Vector3)(ref val6)).normalized; } else { lastFlatVelDir = val2; } } } private void UpdateLandingPhysics() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00b9: 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_0113: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cachedRigidbody == (Object)null) { isLanding = false; RestoreRigidbody(); currentState = MountState.Grounded; return; } Vector3 position = cachedRigidbody.position; position.y = Mathf.MoveTowards(position.y, landingTargetY, 8f * Time.fixedDeltaTime); cachedRigidbody.MovePosition(position); if (!cachedRigidbody.isKinematic) { Vector3 linearVelocity = cachedRigidbody.linearVelocity; linearVelocity.x *= 0.95f; linearVelocity.z *= 0.95f; linearVelocity.y = 0f; cachedRigidbody.linearVelocity = linearVelocity; } if (Mathf.Abs(position.y - landingTargetY) < 0.3f) { isLanding = false; if ((Object)(object)cachedCharacter != (Object)null) { cachedCharacter.m_flying = false; } UpdateFlightAnimator(flying: false, Vector3.zero, ((Component)this).transform.forward); RestoreRigidbody(); currentState = MountState.Grounded; Debug.Log((object)"[DragonLord] Touchdown — landing complete -> Grounded"); } } private void UpdateMountedGround() { float num = ((Input.GetMouseButton(0) || Input.GetMouseButton(1)) ? 1f : 0f); aimBlendWeight = Mathf.SmoothDamp(aimBlendWeight, num, ref aimBlendRef, 0.15f); isAiming = aimBlendWeight > 0.1f; if (Input.GetKeyDown((KeyCode)32) && !DragonLordPlugin.IsGuiOpen()) { EnterFlight(); } } private void UpdateMountedFlying() { //IL_0150: 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_01b2: 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) inputW = Input.GetKey((KeyCode)119); inputS = Input.GetKey((KeyCode)115); inputA = Input.GetKey((KeyCode)97); inputD = Input.GetKey((KeyCode)100); inputSpace = Input.GetKey((KeyCode)32); inputCtrl = Input.GetKey((KeyCode)306); inputShift = Input.GetKey((KeyCode)304); if (DragonLordPlugin.IsGuiOpen()) { inputW = (inputS = (inputA = (inputD = (inputSpace = (inputCtrl = (inputShift = false)))))); } float num = ((Input.GetMouseButton(0) || Input.GetMouseButton(1)) ? 1f : 0f); aimBlendWeight = Mathf.SmoothDamp(aimBlendWeight, num, ref aimBlendRef, 0.15f); isAiming = aimBlendWeight > 0.1f; if (!flightTelemetry) { return; } telemetryTimer -= Time.deltaTime; if (telemetryTimer <= 0f) { telemetryTimer = 1f; float num2 = 0f; float y = ((Component)this).transform.position.y; float num3 = 0f; if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(((Component)this).transform.position, ref num2)) { num3 = y - num2; } float num4; if (!((Object)(object)cachedRigidbody != (Object)null)) { num4 = 0f; } else { Vector3 linearVelocity = cachedRigidbody.linearVelocity; num4 = ((Vector3)(ref linearVelocity)).magnitude; } float num5 = num4; Debug.Log((object)$"[DragonLord] FLY: alt={y:F1} agl={num3:F1} speed={num5:F1} pitch={currentPitch:F1} bank={currentBank:F1}"); } } public void TransitionToGrounded() { currentState = MountState.Grounded; Debug.Log((object)"[DragonLord] Transitioned to Grounded"); } public void PlayLandingRoar() { //IL_00df: 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_00f0: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (breathRoarPrefabs == null || breathRoarPrefabs.Length == 0) { return; } List list = new List(); for (int i = 0; i < breathRoarPrefabs.Length; i++) { if ((Object)(object)breathRoarPrefabs[i] != (Object)null && !((Object)breathRoarPrefabs[i]).name.Contains("firebreath_in")) { list.Add(breathRoarPrefabs[i]); } } GameObject[] array = ((list.Count > 0) ? list.ToArray() : breathRoarPrefabs); Vector3 val = (((Object)(object)jawBone != (Object)null) ? jawBone.position : (((Object)(object)headBone != (Object)null) ? headBone.position : ((Component)this).transform.position)); GameObject val2 = Object.Instantiate(array[Random.Range(0, array.Length)], val, Quaternion.identity); Object.Destroy((Object)(object)val2, 3f); ((MonoBehaviour)this).StartCoroutine(JawOpenCoroutine(3f)); Debug.Log((object)"[DragonLord] Landing roar played"); } [IteratorStateMachine(typeof(d__138))] private IEnumerator JawOpenCoroutine(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__138(0) { <>4__this = this, duration = duration }; } public void Dismount(bool force) { //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_004f: 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_005b: 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) if (cameraWasModified && (Object)(object)GameCamera.instance != (Object)null && savedCameraDistance > 0f) { GameCamera.instance.m_maxDistance = savedCameraDistance; cameraWasModified = false; } flightVel = Vector3.zero; velocitySmoothRef = Vector3.zero; UpdateFlightAnimator(flying: false, Vector3.zero, ((Component)this).transform.forward); currentState = MountState.Grounded; } public bool CanDismount() { //IL_001f: 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) float num = 0f; if ((Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(((Component)this).transform.position, ref num)) { float num2 = ((Component)this).transform.position.y - num; if (num2 > 4f) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { ((Character)localPlayer).Message((MessageType)2, "Too high to dismount!", 0, (Sprite)null); } return false; } } return true; } public static bool IsMounted() { if ((Object)(object)Instance == (Object)null) { return false; } return Instance.currentState == MountState.Mounted || Instance.currentState == MountState.Flying || (Instance.currentState == MountState.Landing && Instance.landingKeepsRider); } public static bool IsFlying() { if ((Object)(object)Instance == (Object)null) { return false; } return Instance.currentState == MountState.Flying; } public static bool IsLandingMounted() { if ((Object)(object)Instance == (Object)null) { return false; } return Instance.currentState == MountState.Landing && Instance.landingKeepsRider; } } public class DragonLordSpawner : MonoBehaviour { [CompilerGenerated] private sealed class d__10 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject mount; public Player player; public Tameable tameable; public Character character; public MonsterAI monsterAI; public ZNetView nview; public DragonLordSpawner <>4__this; private Transform 5__1; private Transform 5__2; private Transform 5__3; private GameObject 5__4; private SphereCollider 5__5; private GameObject 5__6; private Sadle 5__7; private FieldInfo 5__8; private FieldInfo 5__9; private FieldInfo 5__10; private FieldInfo 5__11; private DragonLordMount 5__12; private float 5__13; private Vector3 5__14; private MethodInfo 5__15; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__10(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__6 = null; 5__7 = null; 5__8 = null; 5__9 = null; 5__10 = null; 5__11 = null; 5__12 = null; 5__15 = null; <>1__state = -2; } private bool MoveNext() { //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Expected O, but got Unknown //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: 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_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Expected O, but got Unknown //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: 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) //IL_0812: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)mount == (Object)null) { <>4__this.isSpawning = false; return false; } 5__1 = mount.transform.Find("Visual"); if ((Object)(object)5__1 != (Object)null && !((Component)5__1).gameObject.activeSelf) { ((Component)5__1).gameObject.SetActive(true); } <>2__current = null; <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = null; <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = null; <>1__state = 4; return true; case 4: <>1__state = -1; if ((Object)(object)mount == (Object)null) { <>4__this.isSpawning = false; return false; } if ((Object)(object)player == (Object)null) { <>4__this.isSpawning = false; return false; } if ((Object)(object)monsterAI != (Object)null) { monsterAI.SetFollowTarget((GameObject)null); Debug.Log((object)"[DragonLord] MonsterAI enabled (no follow target) for Sadle movement"); } 5__2 = null; if ((Object)(object)5__1 != (Object)null) { 5__2 = 5__1.Find("Armature/Root/Hips/Spine/Spine1"); } if ((Object)(object)5__2 == (Object)null) { 5__2 = FindBoneRecursive(mount.transform, "Spine1"); } if ((Object)(object)5__2 == (Object)null) { 5__2 = FindBoneRecursive(mount.transform, "Spine"); } 5__3 = (((Object)(object)5__2 != (Object)null) ? 5__2 : mount.transform); Debug.Log((object)string.Format("[DragonLord] Saddle bone: {0}", ((Object)(object)5__2 != (Object)null) ? GetBonePath(5__2) : "FALLBACK to root")); 5__4 = new GameObject("DragonLordSaddle"); 5__4.transform.SetParent(5__3); <>4__this.saddleTransform = 5__4.transform; 5__4.transform.localPosition = new Vector3(0.0004f, 0.0075f, -0.0038f); 5__4.transform.localEulerAngles = new Vector3(161.25f, 0f, 181.05f); 5__4.transform.localScale = new Vector3(1.955f, 1.925f, 1.65f); 5__4.layer = mount.layer; 5__5 = 5__4.AddComponent(); 5__5.radius = 0.005f; ((Collider)5__5).isTrigger = true; 5__6 = new GameObject("MountPoint"); 5__6.transform.SetParent(5__4.transform); 5__6.transform.localPosition = new Vector3(0f, -0.0008f, 0.0007f); 5__6.transform.localEulerAngles = new Vector3(231.53f, 0f, 177f); <>4__this.mountPointTransform = 5__6.transform; 5__7 = 5__4.AddComponent(); 5__7.m_attachPoint = 5__6.transform; 5__7.m_maxUseRange = 15f; 5__7.m_hoverText = "Dragon"; 5__7.m_attachAnimation = "attach_asksvin"; 5__7.m_maxStamina = 9999f; 5__7.m_runStaminaDrain = 0f; 5__7.m_swimStaminaDrain = 0f; 5__7.m_staminaRegen = 100f; 5__7.m_staminaRegenHungry = 100f; 5__7.m_detachOffset = new Vector3(0f, 0.5f, -2f); 5__8 = AccessTools.Field(typeof(Sadle), "m_nview"); 5__9 = AccessTools.Field(typeof(Sadle), "m_character"); 5__10 = AccessTools.Field(typeof(Sadle), "m_tambable"); 5__11 = AccessTools.Field(typeof(Sadle), "m_monsterAI"); Debug.Log((object)$"[DragonLord] Sadle wiring: nview={5__8 != null && 5__8.GetValue(5__7) != null}, char={5__9 != null && 5__9.GetValue(5__7) != null}, tamb={5__10 != null && 5__10.GetValue(5__7) != null}, ai={5__11 != null && 5__11.GetValue(5__7) != null}"); if ((Object)(object)tameable != (Object)null) { tameable.m_saddle = 5__7; tameable.m_dropSaddleOnDeath = false; 5__15 = AccessTools.Method(typeof(Tameable), "SetSaddle", (Type[])null, (Type[])null); if (5__15 != null) { 5__15.Invoke(tameable, new object[1] { true }); } Debug.Log((object)"[DragonLord] Tameable.SetSaddle(true) called"); 5__15 = null; } <>4__this.saddleVisualTransform = <>4__this.CreateSaddleVisual(5__4.transform); 5__12 = mount.AddComponent(); 5__12.animator = mount.GetComponentInChildren(); FindAndAssignNeckBones(mount, 5__12); DragonLordGUI.ApplySavedValues(5__12); ApplyDragonColors(mount); if ((Object)(object)5__12 != (Object)null) { 5__12.PreloadFireBreath(); } if ((Object)(object)5__12 != (Object)null && <>4__this.stompFootSteps != null) { 5__12.ConfigureGroundStomp(<>4__this.stompFootSteps, <>4__this.stompAnimEvents, <>4__this.stompAudioSources, <>4__this.stompOrigMute, <>4__this.stompOrigVol); } 5__12.currentState = DragonLordMount.MountState.Summoning; <>4__this.isSpawning = false; if (DragonLordPlugin.DiagnosticsEnabled.Value) { <>4__this.LogDiagnostics(mount, 5__12.animator, 5__2); } 5__13 = (<>4__this.hasGround ? (<>4__this.groundY + 1f) : (((Component)player).transform.position.y + 1f)); 5__14 = new Vector3(<>4__this.spawnPos.x, 5__13, <>4__this.spawnPos.z); <>4__this.summonCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SummonCoroutine(mount, 5__14)); Debug.Log((object)"[DragonLord] V3 full creature dragon mount spawned!"); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__24 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject mount; public Vector3 groundPos; public DragonLordSpawner <>4__this; private Rigidbody 5__1; private MonsterAI 5__2; private Sadle 5__3; private bool 5__4; private bool 5__5; private Animator 5__6; private Vector3 5__7; private float 5__8; private float 5__9; private DragonLordMount 5__10; private float 5__11; private float 5__12; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__2 = null; 5__3 = null; 5__6 = null; 5__10 = null; <>1__state = -2; } private bool MoveNext() { //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Expected O, but got Unknown //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Expected O, but got Unknown //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = mount.GetComponent(); if ((Object)(object)5__1 != (Object)null) { 5__1.isKinematic = true; } 5__2 = mount.GetComponent(); 5__3 = mount.GetComponentInChildren(); 5__4 = (Object)(object)5__2 != (Object)null && ((Behaviour)5__2).enabled; 5__5 = (Object)(object)5__3 != (Object)null && ((Behaviour)5__3).enabled; if ((Object)(object)5__2 != (Object)null) { ((Behaviour)5__2).enabled = false; } if ((Object)(object)5__3 != (Object)null) { ((Behaviour)5__3).enabled = false; } 5__6 = mount.GetComponentInChildren(); Debug.Log((object)string.Format("[DragonLord] Summon start: kinematic={0}, AI={1}, Sadle={2}", ((Object)(object)5__1 != (Object)null) ? 5__1.isKinematic.ToString() : "null", ((Object)(object)5__2 != (Object)null) ? ((Behaviour)5__2).enabled.ToString() : "null", ((Object)(object)5__3 != (Object)null) ? ((Behaviour)5__3).enabled.ToString() : "null")); 5__7 = mount.transform.position; 5__8 = 4f; 5__9 = 0f; Debug.Log((object)$"[DragonLord] Summon: descending from ({5__7.x:F1},{5__7.y:F1},{5__7.z:F1}) to ({groundPos.x:F1},{groundPos.y:F1},{groundPos.z:F1})"); goto IL_0334; case 1: <>1__state = -1; goto IL_0334; case 2: <>1__state = -1; Debug.Log((object)string.Format("[DragonLord] Summon landed: kinematic={0}", ((Object)(object)5__1 != (Object)null) ? 5__1.isKinematic.ToString() : "null")); <>2__current = (object)new WaitForSeconds(1.5f); <>1__state = 3; return true; case 3: <>1__state = -1; if ((Object)(object)5__6 != (Object)null) { SetAnimatorSafe(5__6, "flying", value: false); SetAnimatorSafe(5__6, "forward_speed", 0f); } 5__10 = (((Object)(object)mount != (Object)null) ? mount.GetComponent() : null); if ((Object)(object)5__10 != (Object)null) { 5__10.TransitionToGrounded(); Debug.Log((object)"[DragonLord] Summon: descent complete, transitioning to Grounded"); 5__10.PlayLandingRoar(); } <>2__current = (object)new WaitForSeconds(3f); <>1__state = 4; return true; case 4: { <>1__state = -1; if ((Object)(object)5__2 != (Object)null) { ((Behaviour)5__2).enabled = 5__4; } if ((Object)(object)5__3 != (Object)null) { ((Behaviour)5__3).enabled = 5__5; } Debug.Log((object)"[DragonLord] Summon: AI/Sadle re-enabled after landing roar"); if ((Object)(object)Player.m_localPlayer != (Object)null) { ((Character)Player.m_localPlayer).Message((MessageType)2, "DragonLord has landed!", 0, (Sprite)null); } <>4__this.summonCoroutine = null; return false; } IL_0334: if (5__9 < 5__8) { if ((Object)(object)mount == (Object)null) { return false; } 5__9 += Time.deltaTime; 5__11 = Mathf.Clamp01(5__9 / 5__8); 5__12 = 5__11 * 5__11; mount.transform.position = Vector3.Lerp(5__7, groundPos, 5__12); if ((Object)(object)5__6 != (Object)null) { SetAnimatorSafe(5__6, "flying", value: true); SetAnimatorSafe(5__6, "forward_speed", 3f); } <>2__current = null; <>1__state = 1; return true; } if ((Object)(object)mount == (Object)null) { return false; } mount.transform.position = groundPos; if ((Object)(object)5__1 != (Object)null) { 5__1.isKinematic = false; } if ((Object)(object)5__6 != (Object)null) { SetAnimatorSafe(5__6, "fly_land"); } <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public static DragonLordSpawner Instance; private Transform mountPointTransform; private Transform saddleVisualTransform; private Transform saddleTransform; private bool isSpawning = false; private Coroutine summonCoroutine; private Coroutine setupCoroutine; public static bool spawningDragonLord = false; private bool hasGround; private float groundY; private Vector3 spawnPos; private FootStep[] stompFootSteps; private CharacterAnimEvent[] stompAnimEvents; private AudioSource[] stompAudioSources; private bool[] stompOrigMute; private float[] stompOrigVol; private float saddleCutoffY = -1.1f; private static Mesh cachedSaddleMesh; private static Material[] cachedSaddleMaterials; private static Dictionary animParamCache = new Dictionary(); private void Awake() { Instance = this; } public void SummonOrRecall() { //IL_00d1: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Expected O, but got Unknown //IL_03a9: 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) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } if ((Object)(object)DragonLordPlugin.currentMount != (Object)null) { if (summonCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(summonCoroutine); summonCoroutine = null; } if (setupCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(setupCoroutine); setupCoroutine = null; } DespawnDragon(); isSpawning = false; ((Character)localPlayer).Message((MessageType)2, "DragonLord dismissed", 0, (Sprite)null); } else { if (isSpawning) { return; } if ((Object)(object)ZNetScene.instance == (Object)null) { Debug.LogError((object)"[DragonLord] ZNetScene not ready!"); return; } spawnPos = ((Component)localPlayer).transform.position + ((Component)localPlayer).transform.forward * DragonLordPlugin.SpawnDistance.Value; groundY = 0f; hasGround = (Object)(object)ZoneSystem.instance != (Object)null && ZoneSystem.instance.GetGroundHeight(spawnPos, ref groundY); if (hasGround) { spawnPos.y = groundY + 60f; } else { spawnPos.y = ((Component)localPlayer).transform.position.y + 60f; } GameObject prefab = ZNetScene.instance.GetPrefab("Dragon"); if ((Object)(object)prefab == (Object)null) { Debug.LogError((object)"[DragonLord] Dragon prefab not found!"); ((Character)localPlayer).Message((MessageType)2, "Error: Dragon prefab not found", 0, (Sprite)null); return; } isSpawning = true; spawningDragonLord = true; GameObject val = Object.Instantiate(prefab, spawnPos, Quaternion.identity); spawningDragonLord = false; Vector3 val2 = ((Component)localPlayer).transform.position - spawnPos; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.01f) { val.transform.rotation = Quaternion.LookRotation(val2); } Rigidbody component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.interpolation = (RigidbodyInterpolation)1; } Character component2 = val.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.m_boss = false; component2.m_bossEvent = ""; component2.m_defeatSetGlobalKey = ""; component2.m_faction = (Faction)0; component2.SetMaxHealth(99999f); component2.SetHealth(99999f); component2.m_tolerateWater = true; component2.m_tolerateFire = true; component2.m_tolerateSmoke = true; component2.m_flyingContinuousEffect = new EffectList(); Debug.Log((object)"[DragonLord] Boss flags neutralized: m_boss=false, m_bossEvent cleared, flyingVFX nulled"); } ZNetView component3 = val.GetComponent(); if ((Object)(object)component3 != (Object)null && component3.IsValid()) { component3.m_persistent = false; component3.GetZDO().Set("tamed", true); component3.GetZDO().Set(StringExtensionMethods.GetStableHashCode("HaveSaddle"), true); component3.GetZDO().Set("TamedName", "Dragon"); component3.GetZDO().Set("DragonLord_OwnerUID", localPlayer.GetPlayerID()); Debug.Log((object)"[DragonLord] ZNetView configured: persistent, tamed, saddled"); } GatherStompAudioRefs(val); DisableBossVFX(val); float value = DragonLordPlugin.DragonScale.Value; Transform val3 = val.transform.Find("Visual"); if ((Object)(object)val3 != (Object)null && value != 1f) { val3.localScale = Vector3.one * value; } Tameable val4 = val.GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = val.AddComponent(); } val4.m_tamingTime = 0f; val4.m_commandable = true; val4.m_fedDuration = 999999f; MonsterAI component4 = val.GetComponent(); if ((Object)(object)component4 != (Object)null) { FieldInfo fieldInfo = AccessTools.Field(typeof(Tameable), "m_monsterAI"); if (fieldInfo != null) { fieldInfo.SetValue(val4, component4); } } FieldInfo fieldInfo2 = AccessTools.Field(typeof(Tameable), "m_character"); if (fieldInfo2 != null && (Object)(object)component2 != (Object)null) { fieldInfo2.SetValue(val4, component2); } FieldInfo fieldInfo3 = AccessTools.Field(typeof(Tameable), "m_nview"); if (fieldInfo3 != null && (Object)(object)component3 != (Object)null) { fieldInfo3.SetValue(val4, component3); } TryInvokeMethod(val4, "Tame"); if ((Object)(object)component3 != (Object)null && component3.IsValid()) { component3.GetZDO().Set(StringExtensionMethods.GetStableHashCode("TameLastFeeding"), ZNet.instance.GetTime().Ticks); } BaseAI component5 = val.GetComponent(); if ((Object)(object)component5 != (Object)null) { FieldInfo fieldInfo4 = AccessTools.Field(typeof(BaseAI), "m_tamable"); if (fieldInfo4 != null) { fieldInfo4.SetValue(component5, val4); } Debug.Log((object)"[DragonLord] BaseAI.m_tamable cache updated"); } Debug.Log((object)"[DragonLord] Tameable added and tamed"); if ((Object)(object)component4 != (Object)null) { ((BaseAI)component4).m_viewRange = 0f; ((BaseAI)component4).m_hearRange = 0f; ((BaseAI)component4).m_aggravatable = false; ((BaseAI)component4).m_avoidFire = false; ((BaseAI)component4).m_afraidOfFire = false; ((BaseAI)component4).m_avoidWater = false; component4.m_fleeIfNotAlerted = false; component4.m_fleeIfLowHealth = 0f; ((BaseAI)component4).m_randomFly = false; if ((Object)(object)component2 != (Object)null) { component2.m_flying = false; } Debug.Log((object)"[DragonLord] MonsterAI configured: viewRange=0, randomFly=false, passive (will disable after Start)"); } DisableExpensiveComponents(val); DragonLordPlugin.currentMount = val; setupCoroutine = ((MonoBehaviour)this).StartCoroutine(SetupDragonDeferred(val, localPlayer, val4, component2, component4, component3)); } } [IteratorStateMachine(typeof(d__10))] private IEnumerator SetupDragonDeferred(GameObject mount, Player player, Tameable tameable, Character character, MonsterAI monsterAI, ZNetView nview) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__10(0) { <>4__this = this, mount = mount, player = player, tameable = tameable, character = character, monsterAI = monsterAI, nview = nview }; } private void GatherStompAudioRefs(GameObject mount) { stompFootSteps = mount.GetComponentsInChildren(true); stompAnimEvents = mount.GetComponentsInChildren(true); HashSet hashSet = new HashSet(); for (int i = 0; i < stompFootSteps.Length; i++) { if (!((Object)(object)stompFootSteps[i] == (Object)null)) { CollectNearbyAudio(((Component)stompFootSteps[i]).transform, hashSet); } } for (int j = 0; j < stompAnimEvents.Length; j++) { if (!((Object)(object)stompAnimEvents[j] == (Object)null)) { CollectNearbyAudio(((Component)stompAnimEvents[j]).transform, hashSet); } } stompAudioSources = (AudioSource[])(object)new AudioSource[hashSet.Count]; stompOrigMute = new bool[hashSet.Count]; stompOrigVol = new float[hashSet.Count]; int num = 0; foreach (AudioSource item in hashSet) { stompAudioSources[num] = item; stompOrigMute[num] = item.mute; stompOrigVol[num] = item.volume; num++; } Debug.Log((object)$"[DragonLord] Stomp audio gathered: {stompFootSteps.Length} FootStep, {stompAnimEvents.Length} AnimEvent, {stompAudioSources.Length} AudioSource"); } private static void CollectNearbyAudio(Transform t, HashSet set) { AudioSource[] components = ((Component)t).GetComponents(); foreach (AudioSource item in components) { set.Add(item); } if ((Object)(object)t.parent != (Object)null) { AudioSource[] components2 = ((Component)t.parent).GetComponents(); foreach (AudioSource item2 in components2) { set.Add(item2); } } for (int k = 0; k < t.childCount; k++) { AudioSource[] components3 = ((Component)t.GetChild(k)).GetComponents(); foreach (AudioSource item3 in components3) { set.Add(item3); } } } private static void DisableBossVFX(GameObject mount) { //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) ParticleSystem[] componentsInChildren = mount.GetComponentsInChildren(true); foreach (ParticleSystem val in componentsInChildren) { val.Stop(true, (ParticleSystemStopBehavior)0); EmissionModule emission = val.emission; ((EmissionModule)(ref emission)).enabled = false; } Light[] componentsInChildren2 = mount.GetComponentsInChildren(true); foreach (Light val2 in componentsInChildren2) { ((Behaviour)val2).enabled = false; } AudioSource[] componentsInChildren3 = mount.GetComponentsInChildren(true); foreach (AudioSource val3 in componentsInChildren3) { val3.mute = true; val3.volume = 0f; } LineRenderer[] componentsInChildren4 = mount.GetComponentsInChildren(true); foreach (LineRenderer val4 in componentsInChildren4) { ((Renderer)val4).enabled = false; } TrailRenderer[] componentsInChildren5 = mount.GetComponentsInChildren(true); foreach (TrailRenderer val5 in componentsInChildren5) { ((Renderer)val5).enabled = false; } } private static void DisableExpensiveComponents(GameObject mount) { int num = 0; CharacterAnimEvent[] componentsInChildren = mount.GetComponentsInChildren(true); foreach (CharacterAnimEvent val in componentsInChildren) { ((Behaviour)val).enabled = false; num++; } FootStep[] componentsInChildren2 = mount.GetComponentsInChildren(true); foreach (FootStep val2 in componentsInChildren2) { ((Behaviour)val2).enabled = false; num++; } RandomAnimation[] componentsInChildren3 = mount.GetComponentsInChildren(true); foreach (RandomAnimation val3 in componentsInChildren3) { ((Behaviour)val3).enabled = false; num++; } LODGroup[] componentsInChildren4 = mount.GetComponentsInChildren(true); foreach (LODGroup val4 in componentsInChildren4) { val4.enabled = false; num++; } NavMeshAgent[] componentsInChildren5 = mount.GetComponentsInChildren(true); foreach (NavMeshAgent val5 in componentsInChildren5) { ((Behaviour)val5).enabled = false; num++; } Debug.Log((object)$"[DragonLord] Disabled {num} expensive components"); } private static void FindAndAssignNeckBones(GameObject mount, DragonLordMount mountScript) { Transform val = FindBoneRecursive(mount.transform, "Neck"); if ((Object)(object)val != (Object)null) { mountScript.neckBone = val; Transform val2 = FindBoneRecursive(val, "Neck2"); if ((Object)(object)val2 != (Object)null) { mountScript.neck2Bone = val2; Transform val3 = FindBoneRecursive(val2, "Neck3"); if ((Object)(object)val3 != (Object)null) { mountScript.neck3Bone = val3; Transform val4 = FindBoneRecursive(val3, "Head"); if ((Object)(object)val4 != (Object)null) { mountScript.headBone = val4; Transform jawBone = FindBoneRecursive(val4, "Jaw"); mountScript.jawBone = jawBone; } } } Debug.Log((object)$"[DragonLord] Neck chain: Neck={(Object)(object)mountScript.neckBone != (Object)null} Neck2={(Object)(object)mountScript.neck2Bone != (Object)null} Neck3={(Object)(object)mountScript.neck3Bone != (Object)null} Head={(Object)(object)mountScript.headBone != (Object)null} Jaw={(Object)(object)mountScript.jawBone != (Object)null}"); } else { Debug.LogWarning((object)"[DragonLord] No Neck bone found — head aiming disabled"); } } [IteratorStateMachine(typeof(d__24))] private IEnumerator SummonCoroutine(GameObject mount, Vector3 groundPos) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__24(0) { <>4__this = this, mount = mount, groundPos = groundPos }; } private Transform CreateSaddleVisual(Transform parent) { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown try { if ((Object)(object)cachedSaddleMesh == (Object)null) { GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab("Asksvin") : null); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = Object.Instantiate(val, new Vector3(0f, -500f, 0f), Quaternion.identity); Sadle componentInChildren = val2.GetComponentInChildren(true); SkinnedMeshRenderer val3 = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).GetComponentInChildren(true) : null); if ((Object)(object)val3 != (Object)null) { Mesh val4 = new Mesh(); val3.BakeMesh(val4); cachedSaddleMesh = SplitMeshFiltered(val4, saddleCutoffY, 0.45f); cachedSaddleMaterials = ((Renderer)val3).sharedMaterials; } ZNetView component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.Destroy(); } else { Object.Destroy((Object)(object)val2); } } if ((Object)(object)cachedSaddleMesh == (Object)null) { return null; } GameObject val5 = new GameObject("DragonSaddleVisual"); val5.transform.SetParent(parent); val5.transform.localPosition = Vector3.zero; val5.transform.localRotation = Quaternion.identity; val5.transform.localScale = Vector3.one * 0.002f; val5.AddComponent().sharedMesh = cachedSaddleMesh; ((Renderer)val5.AddComponent()).sharedMaterials = cachedSaddleMaterials; return val5.transform; } catch (Exception ex) { Debug.LogWarning((object)$"[DragonLord] Saddle visual failed: {ex.Message}"); return null; } } private static Mesh SplitMeshFiltered(Mesh source, float cutoffY, float maxX) { //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown //IL_0158: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) Vector3[] vertices = source.vertices; Vector3[] normals = source.normals; Vector2[] uv = source.uv; Color[] colors = source.colors; Dictionary dictionary = new Dictionary(); List list = new List(); List list2 = new List(); List list3 = new List(); List list4 = new List(); int subMeshCount = source.subMeshCount; List> list5 = new List>(); for (int i = 0; i < subMeshCount; i++) { int[] triangles = source.GetTriangles(i); List list6 = new List(); for (int j = 0; j < triangles.Length; j += 3) { int num = triangles[j]; int num2 = triangles[j + 1]; int num3 = triangles[j + 2]; if (!(vertices[num].y > cutoffY) || !(vertices[num2].y > cutoffY) || !(vertices[num3].y > cutoffY) || !(Mathf.Abs(vertices[num].x) < maxX) || !(Mathf.Abs(vertices[num2].x) < maxX) || !(Mathf.Abs(vertices[num3].x) < maxX)) { continue; } int[] array = new int[3] { num, num2, num3 }; foreach (int num4 in array) { if (!dictionary.ContainsKey(num4)) { dictionary[num4] = list.Count; list.Add(vertices[num4]); if (normals.Length > num4) { list2.Add(normals[num4]); } if (uv.Length > num4) { list3.Add(uv[num4]); } if (colors.Length > num4) { list4.Add(colors[num4]); } } list6.Add(dictionary[num4]); } } list5.Add(list6); } Mesh val = new Mesh(); val.vertices = list.ToArray(); if (list2.Count == list.Count) { val.normals = list2.ToArray(); } if (list3.Count == list.Count) { val.uv = list3.ToArray(); } if (list4.Count == list.Count) { val.colors = list4.ToArray(); } val.subMeshCount = subMeshCount; for (int l = 0; l < subMeshCount; l++) { val.SetTriangles(list5[l].ToArray(), l); } val.RecalculateBounds(); return val; } private static AnimatorControllerParameter[] GetCachedParams(Animator anim) { int instanceID = ((Object)anim).GetInstanceID(); if (animParamCache.TryGetValue(instanceID, out var value)) { return value; } value = anim.parameters; animParamCache[instanceID] = value; return value; } public static void ApplyDragonColors(GameObject mount) { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)mount == (Object)null || (Object)(object)DragonLordMount.Instance == (Object)null) { return; } Transform val = mount.transform.Find("Visual"); if ((Object)(object)val == (Object)null) { return; } DragonLordMount instance = DragonLordMount.Instance; SkinnedMeshRenderer[] componentsInChildren = ((Component)val).GetComponentsInChildren(); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { string text = ((Object)((Component)val2).gameObject).name.ToLower(); if (text.Contains("eye") || text.Contains("glow") || text.Contains("emissive")) { Debug.Log((object)$"[DragonLord] Skipping eye/glow renderer: {((Object)((Component)val2).gameObject).name}"); continue; } Material material = ((Renderer)val2).material; if (material.HasProperty("_Color")) { material.SetColor("_Color", instance.bodyTintColor); } if (material.HasProperty("_Hue")) { material.SetFloat("_Hue", instance.hueShift); } if (material.HasProperty("_Saturation")) { material.SetFloat("_Saturation", instance.saturationShift); } if (material.HasProperty("_Value")) { material.SetFloat("_Value", instance.valueShift); } } Debug.Log((object)"[DragonLord] Dragon colors applied"); } public static void SetAnimatorSafe(Animator anim, string param, bool value) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 AnimatorControllerParameter[] cachedParams = GetCachedParams(anim); foreach (AnimatorControllerParameter val in cachedParams) { if (val.name == param && (int)val.type == 4) { anim.SetBool(param, value); break; } } } public static void SetAnimatorSafe(Animator anim, string param, float value) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 AnimatorControllerParameter[] cachedParams = GetCachedParams(anim); foreach (AnimatorControllerParameter val in cachedParams) { if (val.name == param && (int)val.type == 1) { anim.SetFloat(param, value); break; } } } public static void SetAnimatorSafe(Animator anim, string param) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 AnimatorControllerParameter[] cachedParams = GetCachedParams(anim); foreach (AnimatorControllerParameter val in cachedParams) { if (val.name == param && (int)val.type == 9) { anim.SetTrigger(param); break; } } } public static void SetAnimatorSafe(Animator anim, int hash, bool value) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 AnimatorControllerParameter[] cachedParams = GetCachedParams(anim); foreach (AnimatorControllerParameter val in cachedParams) { if (val.nameHash == hash && (int)val.type == 4) { anim.SetBool(hash, value); break; } } } public static void SetAnimatorSafe(Animator anim, int hash, float value) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 AnimatorControllerParameter[] cachedParams = GetCachedParams(anim); foreach (AnimatorControllerParameter val in cachedParams) { if (val.nameHash == hash && (int)val.type == 1) { anim.SetFloat(hash, value); break; } } } private static Transform FindBoneRecursive(Transform parent, string nameContains) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown foreach (Transform item in parent) { Transform val = item; if (((Object)val).name.Contains(nameContains)) { return val; } Transform val2 = FindBoneRecursive(val, nameContains); if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } private static string GetBonePath(Transform bone) { string text = ((Object)bone).name; Transform parent = bone.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private static void TryInvokeMethod(object target, string methodName) { MethodInfo methodInfo = AccessTools.Method(target.GetType(), methodName, (Type[])null, (Type[])null); if (methodInfo != null) { methodInfo.Invoke(target, null); } else { Debug.LogWarning((object)$"[DragonLord] Method {methodName} not found on {target.GetType().Name}"); } } public static void LogBoneHierarchy(Transform root, int depth) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown string arg = new string(' ', depth * 2); Debug.Log((object)$"[DragonLord] {arg}{((Object)root).name}"); foreach (Transform item in root) { Transform root2 = item; LogBoneHierarchy(root2, depth + 1); } } public static void LogAnimatorParams(Animator anim) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_006a: 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_0083: Expected I4, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 Debug.Log((object)"[DragonLord] === ANIMATOR PARAMS ==="); if ((Object)(object)anim == (Object)null) { Debug.Log((object)"[DragonLord] (no animator)"); return; } Debug.Log((object)$"[DragonLord] Parameter count: {anim.parameterCount}"); AnimatorControllerParameter[] cachedParams = GetCachedParams(anim); foreach (AnimatorControllerParameter val in cachedParams) { string arg = ""; AnimatorControllerParameterType type = val.type; AnimatorControllerParameterType val2 = type; switch (val2 - 1) { default: if ((int)val2 == 9) { arg = "(trigger)"; } break; case 3: arg = anim.GetBool(val.name).ToString(); break; case 0: arg = anim.GetFloat(val.name).ToString("F2"); break; case 2: arg = anim.GetInteger(val.name).ToString(); break; case 1: break; } Debug.Log((object)$"[DragonLord] {val.name} ({val.type}) = {arg}"); } } public void LogDiagnostics(GameObject mount, Animator anim, Transform saddleBone) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) Debug.Log((object)"[DragonLord] ============ V3 SPAWN DIAGNOSTICS ============"); Debug.Log((object)"[DragonLord] === COMPONENTS ==="); Component[] components = mount.GetComponents(); foreach (Component val in components) { if ((Object)(object)val != (Object)null) { Debug.Log((object)$"[DragonLord] {((object)val).GetType().Name}"); } } Transform val2 = mount.transform.Find("Visual"); if ((Object)(object)val2 != (Object)null) { Debug.Log((object)"[DragonLord] === BONE HIERARCHY ==="); LogBoneHierarchy(val2, 0); } LogAnimatorParams(anim); if ((Object)(object)saddleBone != (Object)null) { Debug.Log((object)$"[DragonLord] Saddle bone: {GetBonePath(saddleBone)}"); Debug.Log((object)$"[DragonLord] Saddle world pos: ({saddleBone.position.x:F1}, {saddleBone.position.y:F1}, {saddleBone.position.z:F1})"); } Character component = mount.GetComponent(); if ((Object)(object)component != (Object)null) { Debug.Log((object)$"[DragonLord] Character: boss={component.m_boss}, bossEvent='{component.m_bossEvent}', faction={component.m_faction}, tamed={component.IsTamed()}"); } Debug.Log((object)"[DragonLord] ============ END DIAGNOSTICS ============"); } public void DespawnDragon() { if ((Object)(object)DragonLordMount.Instance != (Object)null) { DragonLordGUI.SaveValues(DragonLordMount.Instance); } if ((Object)(object)DragonLordMount.Instance != (Object)null && DragonLordMount.IsMounted()) { DragonLordMount.Instance.Dismount(force: true); } if ((Object)(object)DragonLordPlugin.currentMount != (Object)null) { ZNetView component = DragonLordPlugin.currentMount.GetComponent(); if ((Object)(object)component != (Object)null) { component.ClaimOwnership(); component.Destroy(); } else { Object.Destroy((Object)(object)DragonLordPlugin.currentMount); } } DragonLordPlugin.currentMount = null; mountPointTransform = null; saddleVisualTransform = null; saddleTransform = null; } public Transform GetMountPoint() { return mountPointTransform; } public Transform GetSaddleTransform() { return saddleVisualTransform; } public Transform GetSaddleGO() { return saddleTransform; } } [HarmonyPatch(typeof(Character), "Awake")] internal static class Character_Awake_BossNeutralize { private static void Prefix(Character __instance) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (DragonLordSpawner.spawningDragonLord) { __instance.m_boss = false; __instance.m_bossEvent = ""; __instance.m_defeatSetGlobalKey = ""; __instance.m_faction = (Faction)0; Debug.Log((object)"[DragonLord] Character.Awake PREFIX: boss neutralized before Awake runs"); } } } [HarmonyPatch(typeof(Player), "SetControls")] internal static class Player_SetControls_Patch { private static void Prefix(Player __instance, ref Vector3 movedir, ref bool jump, ref bool attack, ref bool attackHold, ref bool secondaryAttack, ref bool block, ref bool blockHold) { //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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { if (DragonLordGUI.IsOpen) { movedir = Vector3.zero; jump = false; attack = false; attackHold = false; secondaryAttack = false; block = false; blockHold = false; } else if (DragonLordMount.IsFlying() || DragonLordMount.IsLandingMounted()) { movedir = Vector3.zero; jump = false; attack = false; attackHold = false; secondaryAttack = false; block = false; blockHold = false; } else if (DragonLordMount.IsMounted()) { jump = false; attack = false; attackHold = false; secondaryAttack = false; block = false; blockHold = false; } } } } [HarmonyPatch(typeof(Player), "StopDoodadControl")] internal static class Player_StopDoodadControl_Patch { private static bool Prefix(Player __instance) { if ((Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } FieldInfo fieldInfo = AccessTools.Field(typeof(Player), "m_doodadController"); if (fieldInfo == null) { return true; } object? value = fieldInfo.GetValue(__instance); MonoBehaviour val = (MonoBehaviour)((value is MonoBehaviour) ? value : null); if ((Object)(object)val == (Object)null) { return true; } DragonLordMount componentInParent = ((Component)val).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { return true; } if ((Object)(object)DragonLordPlugin.currentMount == (Object)null) { return true; } if ((Object)(object)((Component)componentInParent).gameObject != (Object)(object)DragonLordPlugin.currentMount) { return true; } if (!componentInParent.CanDismount()) { return false; } return true; } } [HarmonyPatch(typeof(GameCamera), "LateUpdate")] internal static class GameCamera_LateUpdate_Patch { private static bool Prefix() { if (DragonLordGUI.IsOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; return false; } return true; } } [HarmonyPatch(typeof(MonsterAI), "UpdateAI")] internal static class MonsterAI_UpdateAI_Patch { private static bool Prefix(MonsterAI __instance, ref bool __result) { if ((Object)(object)DragonLordPlugin.currentMount != (Object)null && (Object)(object)((Component)__instance).gameObject == (Object)(object)DragonLordPlugin.currentMount && (DragonLordMount.IsFlying() || DragonLordMount.IsLandingMounted())) { __result = true; return false; } return true; } } [HarmonyPatch(typeof(Character), "UpdateFlying")] internal static class Character_UpdateFlying_Patch { private static bool Prefix(Character __instance) { if ((Object)(object)DragonLordPlugin.currentMount != (Object)null && (Object)(object)((Component)__instance).gameObject == (Object)(object)DragonLordPlugin.currentMount && (DragonLordMount.IsFlying() || DragonLordMount.IsLandingMounted())) { return false; } return true; } } [HarmonyPatch(typeof(MonsterAI), "SetTarget")] internal static class MonsterAI_SetTarget_Patch { private static bool Prefix(MonsterAI __instance, Character attacker) { if ((Object)(object)DragonLordPlugin.currentMount != (Object)null && (Object)(object)((Component)__instance).gameObject == (Object)(object)DragonLordPlugin.currentMount) { return false; } return true; } } [HarmonyPatch(typeof(BaseAI), "IsAlerted")] internal static class BaseAI_IsAlerted_Patch { private static bool Prefix(BaseAI __instance, ref bool __result) { if ((Object)(object)DragonLordPlugin.currentMount != (Object)null && (Object)(object)((Component)__instance).gameObject == (Object)(object)DragonLordPlugin.currentMount) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Character), "Damage")] internal static class Character_Damage_Patch { private static bool Prefix(Character __instance) { if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer && DragonLordMount.IsMounted()) { return false; } if ((Object)(object)DragonLordPlugin.currentMount != (Object)null && (Object)(object)((Component)__instance).gameObject == (Object)(object)DragonLordPlugin.currentMount) { return false; } return true; } } [HarmonyPatch(typeof(Game), "OnDestroy")] internal static class Game_OnDestroy_Patch { private static void Prefix() { DragonLordSpawner.Instance?.DespawnDragon(); DragonLordPlugin.currentMount = null; } } [HarmonyPatch(typeof(Player), "OnSpawned")] internal static class Player_OnSpawned_Patch { [CompilerGenerated] private sealed class d__2 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private Player 5__1; private int 5__2; private List 5__3; private List.Enumerator <>s__4; private Character 5__5; private string 5__6; private ZNetView 5__7; private long 5__8; private ZNetView 5__9; private Exception 5__10; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; 5__3 = null; <>s__4 = default(List.Enumerator); 5__5 = null; 5__6 = null; 5__7 = null; 5__9 = null; 5__10 = null; <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(3f); <>1__state = 1; return true; case 1: <>1__state = -1; 5__1 = Player.m_localPlayer; if ((Object)(object)5__1 == (Object)null) { return false; } 5__2 = 0; 5__3 = new List(Character.GetAllCharacters()); <>s__4 = 5__3.GetEnumerator(); try { while (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; if ((Object)(object)5__5 == (Object)null) { continue; } 5__6 = ((Object)((Component)5__5).gameObject).name.Replace("(Clone)", "").Trim(); if (5__6 != "Dragon" || ((Object)(object)DragonLordPlugin.currentMount != (Object)null && (Object)(object)((Component)5__5).gameObject == (Object)(object)DragonLordPlugin.currentMount)) { continue; } 5__7 = ((Component)5__5).GetComponent(); if ((Object)(object)5__7 == (Object)null || !5__7.IsValid()) { continue; } 5__8 = 5__7.GetZDO().GetLong("DragonLord_OwnerUID", 0L); if (5__8 == 0) { continue; } Debug.Log((object)("[DragonLord] Cleaning leftover DragonLord mount: " + ((Object)((Component)5__5).gameObject).name)); try { 5__9 = ((Component)5__5).GetComponent(); if ((Object)(object)5__9 != (Object)null && 5__9.IsValid()) { 5__9.ClaimOwnership(); 5__9.Destroy(); } else { Object.Destroy((Object)(object)((Component)5__5).gameObject); } 5__2++; 5__9 = null; } catch (Exception ex) { 5__10 = ex; Debug.LogWarning((object)("[DragonLord] Cleanup error: " + 5__10.Message)); } 5__6 = null; 5__7 = null; 5__5 = null; } } finally { ((IDisposable)<>s__4).Dispose(); } <>s__4 = default(List.Enumerator); if (5__2 > 0) { Debug.Log((object)$"[DragonLord] Cleaned {5__2} V1 leftover(s)."); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static bool hasCleanedUp; private static void Postfix() { Debug.Log((object)"[DragonLord] Player.OnSpawned fired"); if ((Object)(object)DragonLordMount.Instance != (Object)null && DragonLordMount.IsMounted()) { DragonLordMount.Instance.Dismount(force: true); } if ((Object)(object)DragonLordPlugin.currentMount != (Object)null) { ZNetView component = DragonLordPlugin.currentMount.GetComponent(); if ((Object)(object)component != (Object)null) { component.ClaimOwnership(); component.Destroy(); } else { Object.Destroy((Object)(object)DragonLordPlugin.currentMount); } } DragonLordPlugin.currentMount = null; if (!hasCleanedUp) { hasCleanedUp = true; if ((Object)(object)DragonLordPlugin.Instance != (Object)null) { ((MonoBehaviour)DragonLordPlugin.Instance).StartCoroutine(CleanupOldVersionDragons()); } } } [IteratorStateMachine(typeof(d__2))] private static IEnumerator CleanupOldVersionDragons() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__2(0); } } [BepInPlugin("com.mitch.dragonlord", "DragonLord", "1.5.0")] public class DragonLordPlugin : BaseUnityPlugin { public const string PluginGUID = "com.mitch.dragonlord"; public const string PluginName = "DragonLord"; public const string PluginVersion = "1.5.0"; public static DragonLordPlugin Instance; public static ConfigEntry SummonKey; public static ConfigEntry DragonHealth; public static ConfigEntry DragonScale; public static ConfigEntry SpawnDistance; public static ConfigEntry DiagnosticsEnabled; private Harmony harmony; public static GameObject currentMount; private void Awake() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown Instance = this; try { Runtime.MakeAllAssetsLoadable(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"SoftReferenceableAssets: all assets now loadable"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("SoftReferenceableAssets not available: " + ex.Message)); } SummonKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "SummonKey", (KeyCode)103, "Key to summon or recall the dragon"); DragonHealth = ((BaseUnityPlugin)this).Config.Bind("Stats", "DragonHealth", 5000f, "Health of the summoned dragon"); DragonScale = ((BaseUnityPlugin)this).Config.Bind("Stats", "DragonScale", 1f, new ConfigDescription("Visual scale of the dragon", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 3f), Array.Empty())); SpawnDistance = ((BaseUnityPlugin)this).Config.Bind("General", "SpawnDistance", 25f, "Distance ahead of player where dragon spawns"); DiagnosticsEnabled = ((BaseUnityPlugin)this).Config.Bind("General", "DiagnosticsEnabled", false, "Enable verbose diagnostic logging on dragon spawn"); harmony = new Harmony("com.mitch.dragonlord"); harmony.PatchAll(); GameObject val = new GameObject("DragonLordSpawner"); val.AddComponent(); val.AddComponent(); Object.DontDestroyOnLoad((Object)(object)val); ((BaseUnityPlugin)this).Logger.LogInfo((object)"DragonLord v1.5.0 loaded!"); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } private void Update() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Player.m_localPlayer == (Object)null) && Input.GetKeyDown(SummonKey.Value)) { bool flag = Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303); bool flag2 = Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305); if (flag && flag2) { DragonLordGUI.Instance?.Toggle(); } else if (!IsGuiOpen()) { DragonLordSpawner.Instance?.SummonOrRecall(); } } } public static bool IsGuiOpen() { return DragonLordGUI.IsOpen || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) || Console.IsVisible() || InventoryGui.IsVisible() || StoreGui.IsVisible() || Menu.IsVisible() || Minimap.IsOpen() || TextInput.IsVisible(); } } }