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<GUILayoutOption>());
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<GUILayoutOption>());
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<GUILayoutOption>());
GUI.DragWindow();
return;
}
scrollPos = GUILayout.BeginScrollView(scrollPos, Array.Empty<GUILayoutOption>());
GUILayout.Label("Dragon", headerStyle, Array.Empty<GUILayoutOption>());
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<GUILayoutOption>());
if (dragonFrozen != flag && (Object)(object)DragonLordPlugin.currentMount != (Object)null)
{
Animator componentInChildren = DragonLordPlugin.currentMount.GetComponentInChildren<Animator>();
MonsterAI component = DragonLordPlugin.currentMount.GetComponent<MonsterAI>();
Rigidbody component2 = DragonLordPlugin.currentMount.GetComponent<Rigidbody>();
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<GUILayoutOption>());
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<GUILayoutOption>());
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<GUILayoutOption>());
}
GUILayout.Space(6f);
GUILayout.Label("Flight", headerStyle, Array.Empty<GUILayoutOption>());
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<GUILayoutOption>());
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<GUILayoutOption>());
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<GUILayoutOption>());
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<GUILayoutOption>());
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<GUILayoutOption>());
GUILayout.Space(6f);
GUILayout.Label("Diagnostics", headerStyle, Array.Empty<GUILayoutOption>());
instance.flightTelemetry = GUILayout.Toggle(instance.flightTelemetry, " Flight Telemetry (logs to BepInEx)", toggleStyle, Array.Empty<GUILayoutOption>());
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<GUILayoutOption>());
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<GUILayoutOption>());
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 <JawOpenCoroutine>d__138 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public float duration;
public DragonLordMount <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <JawOpenCoroutine>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<Sadle>();
cachedMonsterAI = ((Component)this).GetComponent<MonsterAI>();
cachedCharacter = ((Component)this).GetComponent<Character>();
cachedRigidbody = ((Component)this).GetComponent<Rigidbody>();
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<Sadle>();
}
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<GameObject>(val, val3, Quaternion.LookRotation(val4));
Projectile component = val5.GetComponent<Projectile>();
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<Rigidbody>();
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<GameObject> list = new List<GameObject>();
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<GameObject>(breathInSfxPrefab, val, Quaternion.identity);
}
if (breathRoarPrefabs != null && breathRoarPrefabs.Length != 0 && Random.value < 0.35f)
{
GameObject val2 = Object.Instantiate<GameObject>(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<GameObject>(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<GameObject>(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<GameObject> list = new List<GameObject>();
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<GameObject>(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(<JawOpenCoroutine>d__138))]
private IEnumerator JawOpenCoroutine(float duration)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <JawOpenCoroutine>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 <SetupDragonDeferred>d__10 : IEnumerator<object>, 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 <visual>5__1;
private Transform <spineBone>5__2;
private Transform <saddleParent>5__3;
private GameObject <saddleGO>5__4;
private SphereCollider <col>5__5;
private GameObject <mountPointGO>5__6;
private Sadle <sadle>5__7;
private FieldInfo <nviewF>5__8;
private FieldInfo <charF>5__9;
private FieldInfo <tambF>5__10;
private FieldInfo <aiF>5__11;
private DragonLordMount <mountScript>5__12;
private float <landingY>5__13;
private Vector3 <groundPos>5__14;
private MethodInfo <setSaddle>5__15;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetupDragonDeferred>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<visual>5__1 = null;
<spineBone>5__2 = null;
<saddleParent>5__3 = null;
<saddleGO>5__4 = null;
<col>5__5 = null;
<mountPointGO>5__6 = null;
<sadle>5__7 = null;
<nviewF>5__8 = null;
<charF>5__9 = null;
<tambF>5__10 = null;
<aiF>5__11 = null;
<mountScript>5__12 = null;
<setSaddle>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;
}
<visual>5__1 = mount.transform.Find("Visual");
if ((Object)(object)<visual>5__1 != (Object)null && !((Component)<visual>5__1).gameObject.activeSelf)
{
((Component)<visual>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");
}
<spineBone>5__2 = null;
if ((Object)(object)<visual>5__1 != (Object)null)
{
<spineBone>5__2 = <visual>5__1.Find("Armature/Root/Hips/Spine/Spine1");
}
if ((Object)(object)<spineBone>5__2 == (Object)null)
{
<spineBone>5__2 = FindBoneRecursive(mount.transform, "Spine1");
}
if ((Object)(object)<spineBone>5__2 == (Object)null)
{
<spineBone>5__2 = FindBoneRecursive(mount.transform, "Spine");
}
<saddleParent>5__3 = (((Object)(object)<spineBone>5__2 != (Object)null) ? <spineBone>5__2 : mount.transform);
Debug.Log((object)string.Format("[DragonLord] Saddle bone: {0}", ((Object)(object)<spineBone>5__2 != (Object)null) ? GetBonePath(<spineBone>5__2) : "FALLBACK to root"));
<saddleGO>5__4 = new GameObject("DragonLordSaddle");
<saddleGO>5__4.transform.SetParent(<saddleParent>5__3);
<>4__this.saddleTransform = <saddleGO>5__4.transform;
<saddleGO>5__4.transform.localPosition = new Vector3(0.0004f, 0.0075f, -0.0038f);
<saddleGO>5__4.transform.localEulerAngles = new Vector3(161.25f, 0f, 181.05f);
<saddleGO>5__4.transform.localScale = new Vector3(1.955f, 1.925f, 1.65f);
<saddleGO>5__4.layer = mount.layer;
<col>5__5 = <saddleGO>5__4.AddComponent<SphereCollider>();
<col>5__5.radius = 0.005f;
((Collider)<col>5__5).isTrigger = true;
<mountPointGO>5__6 = new GameObject("MountPoint");
<mountPointGO>5__6.transform.SetParent(<saddleGO>5__4.transform);
<mountPointGO>5__6.transform.localPosition = new Vector3(0f, -0.0008f, 0.0007f);
<mountPointGO>5__6.transform.localEulerAngles = new Vector3(231.53f, 0f, 177f);
<>4__this.mountPointTransform = <mountPointGO>5__6.transform;
<sadle>5__7 = <saddleGO>5__4.AddComponent<Sadle>();
<sadle>5__7.m_attachPoint = <mountPointGO>5__6.transform;
<sadle>5__7.m_maxUseRange = 15f;
<sadle>5__7.m_hoverText = "Dragon";
<sadle>5__7.m_attachAnimation = "attach_asksvin";
<sadle>5__7.m_maxStamina = 9999f;
<sadle>5__7.m_runStaminaDrain = 0f;
<sadle>5__7.m_swimStaminaDrain = 0f;
<sadle>5__7.m_staminaRegen = 100f;
<sadle>5__7.m_staminaRegenHungry = 100f;
<sadle>5__7.m_detachOffset = new Vector3(0f, 0.5f, -2f);
<nviewF>5__8 = AccessTools.Field(typeof(Sadle), "m_nview");
<charF>5__9 = AccessTools.Field(typeof(Sadle), "m_character");
<tambF>5__10 = AccessTools.Field(typeof(Sadle), "m_tambable");
<aiF>5__11 = AccessTools.Field(typeof(Sadle), "m_monsterAI");
Debug.Log((object)$"[DragonLord] Sadle wiring: nview={<nviewF>5__8 != null && <nviewF>5__8.GetValue(<sadle>5__7) != null}, char={<charF>5__9 != null && <charF>5__9.GetValue(<sadle>5__7) != null}, tamb={<tambF>5__10 != null && <tambF>5__10.GetValue(<sadle>5__7) != null}, ai={<aiF>5__11 != null && <aiF>5__11.GetValue(<sadle>5__7) != null}");
if ((Object)(object)tameable != (Object)null)
{
tameable.m_saddle = <sadle>5__7;
tameable.m_dropSaddleOnDeath = false;
<setSaddle>5__15 = AccessTools.Method(typeof(Tameable), "SetSaddle", (Type[])null, (Type[])null);
if (<setSaddle>5__15 != null)
{
<setSaddle>5__15.Invoke(tameable, new object[1] { true });
}
Debug.Log((object)"[DragonLord] Tameable.SetSaddle(true) called");
<setSaddle>5__15 = null;
}
<>4__this.saddleVisualTransform = <>4__this.CreateSaddleVisual(<saddleGO>5__4.transform);
<mountScript>5__12 = mount.AddComponent<DragonLordMount>();
<mountScript>5__12.animator = mount.GetComponentInChildren<Animator>();
FindAndAssignNeckBones(mount, <mountScript>5__12);
DragonLordGUI.ApplySavedValues(<mountScript>5__12);
ApplyDragonColors(mount);
if ((Object)(object)<mountScript>5__12 != (Object)null)
{
<mountScript>5__12.PreloadFireBreath();
}
if ((Object)(object)<mountScript>5__12 != (Object)null && <>4__this.stompFootSteps != null)
{
<mountScript>5__12.ConfigureGroundStomp(<>4__this.stompFootSteps, <>4__this.stompAnimEvents, <>4__this.stompAudioSources, <>4__this.stompOrigMute, <>4__this.stompOrigVol);
}
<mountScript>5__12.currentState = DragonLordMount.MountState.Summoning;
<>4__this.isSpawning = false;
if (DragonLordPlugin.DiagnosticsEnabled.Value)
{
<>4__this.LogDiagnostics(mount, <mountScript>5__12.animator, <spineBone>5__2);
}
<landingY>5__13 = (<>4__this.hasGround ? (<>4__this.groundY + 1f) : (((Component)player).transform.position.y + 1f));
<groundPos>5__14 = new Vector3(<>4__this.spawnPos.x, <landingY>5__13, <>4__this.spawnPos.z);
<>4__this.summonCoroutine = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.SummonCoroutine(mount, <groundPos>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 <SummonCoroutine>d__24 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public GameObject mount;
public Vector3 groundPos;
public DragonLordSpawner <>4__this;
private Rigidbody <rb>5__1;
private MonsterAI <ai>5__2;
private Sadle <sadle>5__3;
private bool <aiWasEnabled>5__4;
private bool <sadleWasEnabled>5__5;
private Animator <anim>5__6;
private Vector3 <startPos>5__7;
private float <duration>5__8;
private float <elapsed>5__9;
private DragonLordMount <mountScript>5__10;
private float <t>5__11;
private float <ease>5__12;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SummonCoroutine>d__24(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<rb>5__1 = null;
<ai>5__2 = null;
<sadle>5__3 = null;
<anim>5__6 = null