using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BootlegBestiary.Shared; using BootlegBestiary.Shared.Assets; using BootlegBestiary.SkyDracon.Components; using BootlegBestiary.SkyDracon.EntityStates; using EntityStates; using Grumpy; using JetBrains.Annotations; using KinematicCharacterController; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.CharacterAI; using RoR2.Navigation; using RoR2.Networking; using RoR2.Skills; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BootlegBestiary")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BootlegBestiary")] [assembly: AssemblyTitle("BootlegBestiary")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BootlegBestiary { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Skeletogne.BootlegBestiary", "BootlegBestiary", "1.0.0")] public class BootlegBestiary : BaseUnityPlugin { public class ModuleInfoAttribute : Attribute { public string ModuleName { get; } public string Description { get; } public string Section { get; } public bool RequiresRestart { get; } public ModuleInfoAttribute(string moduleName, string description, string section, bool requiresRestart) { ModuleName = moduleName; Description = description; Section = section; RequiresRestart = requiresRestart; } } public const string PluginGUID = "Skeletogne.BootlegBestiary"; public const string PluginAuthor = "Skeletogne"; public const string PluginName = "BootlegBestiary"; public const string PluginVersion = "1.0.0"; public Dictionary> mainModuleConfigEntries = new Dictionary>(); internal static bool RooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); public static BootlegBestiary Instance { get; private set; } internal string DirectoryName => Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); public void Awake() { Instance = this; Log.Init(((BaseUnityPlugin)this).Logger); PluginConfig.Init(((BaseUnityPlugin)this).Config); VanillaAssets.Init(); CustomAssets.Init(); ClonedAssets.Init(); foreach (KeyValuePair> mainModuleConfigEntry in mainModuleConfigEntries) { Type key = mainModuleConfigEntry.Key; ((Component)Instance).gameObject.AddComponent(key); } } } public static class EnemiesPlusUtils { public static void ReorderSkillDrivers(this GameObject master, AISkillDriver targetSkill, int targetIdx) { AISkillDriver[] components = master.GetComponents(); master.ReorderSkillDrivers(components, Array.IndexOf(components, targetSkill), targetIdx); } public static void ReorderSkillDrivers(this GameObject master, AISkillDriver[] skills, int currentIdx, int targetIdx) { if (currentIdx < 0 || currentIdx >= skills.Length) { Log.Error($"{currentIdx} index not found or out of range. Must be less than {skills.Length}"); return; } string targetName = skills[currentIdx].customName; if (targetIdx < 0 || targetIdx >= skills.Length) { Log.Error($"Unable to reorder skilldriver {targetName} into position {targetIdx}. target must be less than {skills.Length}"); } else { if (targetIdx == currentIdx) { return; } Dictionary dictionary = skills.Where((AISkillDriver s) => (Object)(object)s.nextHighPriorityOverride != (Object)null).ToDictionary((AISkillDriver s) => s.customName, (AISkillDriver s) => s.nextHighPriorityOverride.customName); if (targetIdx > currentIdx) { master.AddComponentCopy(skills[currentIdx]); Object.DestroyImmediate((Object)(object)skills[currentIdx]); } for (int i = targetIdx; i < skills.Length; i++) { if (i != currentIdx) { master.AddComponentCopy(skills[i]); Object.DestroyImmediate((Object)(object)skills[i]); } } skills = master.GetComponents(); AISkillDriver val = ((IEnumerable)skills).FirstOrDefault((Func)((AISkillDriver s) => s.customName == targetName)); if (!dictionary.Any()) { return; } foreach (AISkillDriver val2 in skills) { if (Object.op_Implicit((Object)(object)val2) && dictionary.TryGetValue(val2.customName, out var target)) { AISkillDriver val3 = ((IEnumerable)skills).FirstOrDefault((Func)((AISkillDriver s) => s.customName == target)); if (!((Object)(object)val3 == (Object)null)) { val2.nextHighPriorityOverride = val3; } } } } } public static T GetCopyOf(this Component comp, T other) where T : Component { Type type = ((object)comp).GetType(); if (type != ((object)other).GetType()) { return default(T); } BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); PropertyInfo[] array = properties; foreach (PropertyInfo propertyInfo in array) { if (propertyInfo.CanWrite) { try { propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null); } catch { } } } FieldInfo[] fields = type.GetFields(bindingAttr); FieldInfo[] array2 = fields; foreach (FieldInfo fieldInfo in array2) { fieldInfo.SetValue(comp, fieldInfo.GetValue(other)); } return (T)(object)((comp is T) ? comp : null); } public static T AddComponentCopy(this GameObject go, T toAdd) where T : Component { return ((Component)(object)go.AddComponent()).GetCopyOf(toAdd); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public static class PluginConfig { public enum FormatType { None, Percentage, Time, Distance, Speed, Multiplier } public static void Init(ConfigFile cfg) { if (BootlegBestiary.RooInstalled) { InitRoO(); } Assembly executingAssembly = Assembly.GetExecutingAssembly(); Type[] array = (from type in executingAssembly.GetTypes() where type.IsClass && !type.IsAbstract && type.IsSubclassOf(typeof(SetupModule)) select type).ToArray(); Type[] array2 = array; foreach (Type type2 in array2) { BootlegBestiary.ModuleInfoAttribute customAttribute = type2.GetCustomAttribute(); if (customAttribute != null) { ConfigEntry value = cfg.BindOption(customAttribute.Section ?? "", customAttribute.ModuleName ?? "", defaultValue: true, customAttribute.Description ?? "", customAttribute.RequiresRestart); BootlegBestiary.Instance.mainModuleConfigEntries.Add(type2, value); } else { Log.Error("ModuleInfo for " + type2.FullName + " does not exist! No PluginConfig entry has been created."); } } } public static void InitRoO() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) try { ModSettingsManager.SetModDescription("BootlegBestiary", "Skeletogne.BootlegBestiary", "BootlegBestiary"); byte[] array = File.ReadAllBytes(Path.Combine(BootlegBestiary.Instance.DirectoryName, "icon.png")); Texture2D val = new Texture2D(256, 256); ImageConversion.LoadImage(val, array); Sprite modIcon = Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f)); ModSettingsManager.SetModIcon(modIcon); } catch (Exception ex) { Log.Debug(ex.ToString()); } } public static ConfigEntry BindOption(this ConfigFile myConfig, string section, string name, T defaultValue, string description = "", bool restartRequired = false) { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown bool flag = ((defaultValue is int || defaultValue is float) ? true : false); if (flag && !typeof(T).IsEnum) { Log.Warning("Config entry " + name + " in section " + section + " is a numeric " + typeof(T).Name + " type, but has been registered without using BindOptionSlider. Lower and upper bounds will be set to the defaults [0, 20]. Was this intentional?"); return myConfig.BindOptionSlider(section, name, defaultValue, description, 0f, 20f, restartRequired); } if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } AcceptableValueBase val = null; if (typeof(T).IsEnum) { val = (AcceptableValueBase)(object)new AcceptableValueList(Enum.GetNames(typeof(T))); } ConfigEntry val2 = myConfig.Bind(section, name, defaultValue, new ConfigDescription(description, val, Array.Empty())); if (BootlegBestiary.RooInstalled) { TryRegisterOption(val2, restartRequired); } return val2; } public static ConfigEntry BindOptionSlider(this ConfigFile myConfig, string section, string name, T defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = false) { //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown bool flag = ((defaultValue is int || defaultValue is float) ? true : false); if (!flag || typeof(T).IsEnum) { Log.Warning("Config entry " + name + " in section " + section + " is a not a numeric " + typeof(T).Name + " type, but has been registered as a slider option using BindOptionSlider. Was this intentional?"); return myConfig.BindOption(section, name, defaultValue, description, restartRequired); } if (string.IsNullOrEmpty(description)) { description = name; } string text = description; T val = defaultValue; description = text + " (Default: " + val?.ToString() + ")"; if (restartRequired) { description += " (restart required)"; } AcceptableValueBase val2 = (AcceptableValueBase)((typeof(T) == typeof(int)) ? ((object)new AcceptableValueRange((int)min, (int)max)) : ((object)new AcceptableValueRange(min, max))); ConfigEntry val3 = myConfig.Bind(section, name, defaultValue, new ConfigDescription(description, val2, Array.Empty())); if (BootlegBestiary.RooInstalled) { TryRegisterOptionSlider(val3, min, max, restartRequired); } return val3; } public static ConfigEntry BindOptionSteppedSlider(this ConfigFile myConfig, string section, string name, T defaultValue, float increment = 1f, string description = "", float min = 0f, float max = 20f, bool restartRequired = false, FormatType formatType = FormatType.None) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown if (string.IsNullOrEmpty(description)) { description = name; } string text = description; T val = defaultValue; description = text + " (Default: " + val?.ToString() + ")"; if (restartRequired) { description += " (restart required)"; } ConfigEntry val2 = myConfig.Bind(section, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)(object)new AcceptableValueRange(min, max), Array.Empty())); if (BootlegBestiary.RooInstalled) { TryRegisterOptionSteppedSlider(val2, increment, min, max, restartRequired, formatType); } return val2; } public static void TryRegisterOption(ConfigEntry entry, bool restartRequired) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown if (entry is ConfigEntry val) { ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(val, new InputFieldConfig { submitOn = (SubmitEnum)6, restartRequired = restartRequired })); return; } if (entry is ConfigEntry val2) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val2, restartRequired)); return; } if (entry is ConfigEntry val3) { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(val3, restartRequired)); return; } if (typeof(T).IsEnum) { ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)entry, restartRequired)); return; } Log.Warning("Config entry " + ((ConfigEntryBase)entry).Definition.Key + " in section " + ((ConfigEntryBase)entry).Definition.Section + " with type " + typeof(T).Name + " could not be registered in Risk Of Options using TryRegisterOption."); } public static void TryRegisterOptionSlider(ConfigEntry entry, float min, float max, bool restartRequired) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_005b: 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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown if (entry is ConfigEntry val) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(val, new IntSliderConfig { min = (int)min, max = (int)max, formatString = "{0:0}", restartRequired = restartRequired })); } else if (entry is ConfigEntry val2) { ModSettingsManager.AddOption((BaseOption)new SliderOption(val2, new SliderConfig { min = min, max = max, FormatString = "{0:0.000}", restartRequired = restartRequired })); } else { Log.Warning("Config entry " + ((ConfigEntryBase)entry).Definition.Key + " in section " + ((ConfigEntryBase)entry).Definition.Section + " with type " + typeof(T).Name + " could not be registered in Risk Of Options using TryRegisterOptionSlider."); } } public static void TryRegisterOptionSteppedSlider(ConfigEntry entry, float increment, float min, float max, bool restartRequired, FormatType formatType) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_004d: Expected O, but got Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown if (entry is ConfigEntry val) { ModSettingsManager.AddOption((BaseOption)new StepSliderOption(val, new StepSliderConfig { increment = increment, min = min, max = max, FormatString = GetStepSizePrecision((decimal)increment, formatType), restartRequired = restartRequired })); } else { Log.Warning("Config entry " + ((ConfigEntryBase)entry).Definition.Key + " in section " + ((ConfigEntryBase)entry).Definition.Section + " with type " + typeof(T).Name + " could not be registered in Risk Of Options using TryRegisterOptionSteppedSlider."); } } private static string GetStepSizePrecision(decimal n, FormatType formatType) { n = Math.Abs(n); n -= (decimal)(int)n; int num = 0; string text = "{0:"; while (n > 0m) { num++; n *= 10m; n -= (decimal)(int)n; } if (num == 0) { return text + "0}" + AppendSuffix(formatType); } if (num > 0) { text += "0."; for (int i = 0; i < num; i++) { text += "0"; } text += "}"; return text + AppendSuffix(formatType); } Log.Error("Could not determine string format!"); return "{0:000}"; } private static string AppendSuffix(FormatType formatType) { return formatType switch { FormatType.Percentage => "%", FormatType.Time => "s", FormatType.Distance => "m", FormatType.Speed => "m/s", FormatType.Multiplier => "x", _ => "", }; } } } namespace BootlegBestiary.SkyDracon { [BootlegBestiary.ModuleInfo("Enable Enemy", "Adds Marrowings to the game.", "Marrowing", true)] public class SkyDraconSetup : SetupModule { public class DraconFlamebreathAndDiveSkillDef : SkillDef { private class InstanceData : BaseSkillInstanceData { public SkyDraconBehaviourController controller; } public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData { controller = ((Component)skillSlot.characterBody).gameObject.GetComponent() }; } public override bool IsReady([NotNull] GenericSkill skillSlot) { InstanceData instanceData = skillSlot.skillInstanceData as InstanceData; if ((Object)(object)instanceData?.controller == (Object)null) { return false; } return ((instanceData != null && instanceData.controller.draconState == SkyDraconBehaviourController.DraconState.Grounded) || instanceData.controller.canUseSkills) && ((SkillDef)this).IsReady(skillSlot); } } public class DraconEmergeSkillDef : SkillDef { private class InstanceData : BaseSkillInstanceData { public SkyDraconBehaviourController controller; } public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData { controller = ((Component)skillSlot.characterBody).gameObject.GetComponent() }; } public override bool IsReady([NotNull] GenericSkill skillSlot) { InstanceData instanceData = skillSlot.skillInstanceData as InstanceData; if ((Object)(object)instanceData?.controller == (Object)null) { return false; } return instanceData != null && instanceData.controller.draconState == SkyDraconBehaviourController.DraconState.Grounded && ((SkillDef)this).IsReady(skillSlot); } } private CharacterBody draconBody; public override void RegisterConfig() { base.RegisterConfig(); BindStats(CustomAssets.SkyDraconBodyPrefab, new List(1) { CustomAssets.SkyDraconSpawnCard }); } public override void Initialise() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0242: 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_02d4: Expected O, but got Unknown //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: 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_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0386: 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_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0546: 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_0575: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: 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_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Unknown result type (might be due to invalid IL or missing references) //IL_072f: Unknown result type (might be due to invalid IL or missing references) //IL_0734: Unknown result type (might be due to invalid IL or missing references) //IL_0749: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Unknown result type (might be due to invalid IL or missing references) //IL_07a9: Unknown result type (might be due to invalid IL or missing references) //IL_07be: 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_07ff: Unknown result type (might be due to invalid IL or missing references) //IL_0804: 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_0833: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_0860: Unknown result type (might be due to invalid IL or missing references) //IL_0865: Unknown result type (might be due to invalid IL or missing references) //IL_087a: Unknown result type (might be due to invalid IL or missing references) //IL_087f: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_0899: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_08c6: Unknown result type (might be due to invalid IL or missing references) //IL_08db: Unknown result type (might be due to invalid IL or missing references) //IL_08e0: Unknown result type (might be due to invalid IL or missing references) //IL_08f5: Unknown result type (might be due to invalid IL or missing references) //IL_08fa: Unknown result type (might be due to invalid IL or missing references) base.Initialise(); GameObject skyDraconFlamebreathEffect = ClonedAssets.SkyDraconFlamebreathEffect; GameObject skyDraconBodyPrefab = CustomAssets.SkyDraconBodyPrefab; GameObject skyDraconMasterPrefab = CustomAssets.SkyDraconMasterPrefab; CharacterSpawnCard skyDraconSpawnCard = CustomAssets.SkyDraconSpawnCard; PrefabAPI.RegisterNetworkPrefab(skyDraconBodyPrefab); PrefabAPI.RegisterNetworkPrefab(skyDraconMasterPrefab); skyDraconBodyPrefab.AddComponent(); draconBody = skyDraconBodyPrefab.GetComponent(); HurtBoxLayersToEntityPrecise(skyDraconBodyPrefab); string text = "Marrowing"; AddNameToken(skyDraconBodyPrefab, text); AddLoreToken(skyDraconBodyPrefab, CreateLoreToken()); SetDeathState(skyDraconBodyPrefab, typeof(Death)); ConfigureESM(skyDraconBodyPrefab, "Body", typeof(SkyDraconCharacterMain), registerMainStateType: true, typeof(Spawn)); ConfigureESM(skyDraconBodyPrefab, "ControlFlight", typeof(Flight), registerMainStateType: true, typeof(Flight), registerInitialStateType: false); ContentAddition.AddBody(skyDraconBodyPrefab); ContentAddition.AddMaster(skyDraconMasterPrefab); AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsRoost, (MonsterCategory)3, 2, (MonsterSpawnDistance)0, 5); AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsAqueduct, (MonsterCategory)3, 2, (MonsterSpawnDistance)0); AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsAlluvium, (MonsterCategory)3, 2, (MonsterSpawnDistance)0); AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsAbyssal, (MonsterCategory)3, 2, (MonsterSpawnDistance)0); AddCardToDCCS(skyDraconSpawnCard, VanillaAssets.DccsHelminth, (MonsterCategory)3, 2, (MonsterSpawnDistance)0); bool flag = default(bool); SkillDefData data = new SkillDefData { objectName = "SkyDraconBodyFlamebreath", skillName = "SkyDraconFlamebreath", esmName = "Body", activationState = ContentAddition.AddEntityState(ref flag), cooldown = 4f, cdOnEnd = true, intPrio = (InterruptPriority)0, combatSkill = true }; DraconFlamebreathAndDiveSkillDef skillDef = CreateSkillDef(data); CreateGenericSkill(skyDraconBodyPrefab, (SkillDef)(object)skillDef, "SkyDraconPrimaryFamily", (SkillSlot)0); SkillDefData data2 = new SkillDefData { objectName = "SkyDraconBodyDiveBomb", skillName = "SkyDraconDiveBomb", esmName = "Body", activationState = ContentAddition.AddEntityState(ref flag), cooldown = 15f, combatSkill = true, intPrio = (InterruptPriority)0 }; DraconFlamebreathAndDiveSkillDef skillDef2 = CreateSkillDef(data2); CreateGenericSkill(skyDraconBodyPrefab, (SkillDef)(object)skillDef2, "SkyDraconSecondaryFamily", (SkillSlot)1); SkillDefData data3 = new SkillDefData { objectName = "SkyDraconBodyEmerge", skillName = "SkyDraconEmerge", esmName = "Body", activationState = ContentAddition.AddEntityState(ref flag), cooldown = 6f, combatSkill = true, intPrio = (InterruptPriority)0 }; DraconEmergeSkillDef skillDef3 = CreateSkillDef(data3); CreateGenericSkill(skyDraconBodyPrefab, (SkillDef)(object)skillDef3, "SkyDraconUtilityFamily", (SkillSlot)2); RegisterLooseEntityStates(new List(4) { typeof(Squirm), typeof(BurrowRelocate), typeof(Stun), typeof(FlyingStun) }); SetupFlamebreathPrefab(); EntityStateMachine.SetInterruptState += new hook_SetInterruptState(SetDraconStunState); SetupLogbookEntry(skyDraconBodyPrefab, "UnlockableSkyDraconLog", "SKELETOGNE_UNLOCKABLE_LOG_SKYDRACON", text); ItemDisplayRuleSet skyDraconItemDisplayRuleset = CustomAssets.SkyDraconItemDisplayRuleset; SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteFire, new HornDisplayInfo[2] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixFire, localPos = new Vector3(0.6f, 1.26f, -1.14f), localAngles = new Vector3(0f, 0f, 315f), localScale = new Vector3(1.2f, 1.2f, 1.2f) }, new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixFire, localPos = new Vector3(-0.6f, 1.26f, -1.14f), localAngles = new Vector3(0f, 0f, 45f), localScale = new Vector3(-1.2f, 1.2f, 1.2f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteLightning, new HornDisplayInfo[2] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixLightning, localPos = new Vector3(0f, 0.83514f, -2.05429f), localAngles = new Vector3(41.17938f, 180f, 180f), localScale = new Vector3(3f, 3f, 3f) }, new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixLightning, localPos = new Vector3(0f, 1.7556f, -1.87802f), localAngles = new Vector3(359.0717f, 180f, 180f), localScale = new Vector3(2f, 2f, 2f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteIce, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixIce, localPos = new Vector3(0f, -0.11602f, -3.22486f), localAngles = new Vector3(342.0648f, 0f, 180f), localScale = new Vector3(0.3f, 0.3f, 0.3f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteEarth, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixEarth, localPos = new Vector3(-0.08931f, 1.62895f, -1.40961f), localAngles = new Vector3(270f, 0f, 0f), localScale = new Vector3(7f, 7f, 7f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteAurelionite, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixAurelionite, localPos = new Vector3(0f, 1.29796f, -1.89872f), localAngles = new Vector3(300.7701f, 180f, 180f), localScale = new Vector3(5f, 5f, 5f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteVoid, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixVoid, localPos = new Vector3(0f, 2.18085f, -0.24028f), localAngles = new Vector3(290.697f, 0f, -2E-05f), localScale = new Vector3(2.5f, 2.5f, 2.5f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDElitePoison, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixPoison, localPos = new Vector3(0f, 0.64402f, -1.16346f), localAngles = new Vector3(38.47652f, 180f, 180f), localScale = new Vector3(0.6f, 0.6f, 1f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteHaunted, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixHaunted, localPos = new Vector3(0f, -0.08929f, -2.40165f), localAngles = new Vector3(338.0297f, 0f, 180f), localScale = new Vector3(0.6f, 0.6f, 0.6f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteBead, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixBead, localPos = new Vector3(-0.00036f, 0.54291f, -1.55782f), localAngles = new Vector3(291.9088f, 169.829f, 173.293f), localScale = new Vector3(0.25f, 0.25f, 0.25f) } }); SetUpEliteAffix(skyDraconItemDisplayRuleset, (Object)(object)VanillaAssets.EDEliteCollective, new HornDisplayInfo[3] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixCollective, localPos = new Vector3(0.65f, -0.25f, -2.14f), localAngles = new Vector3(20.40761f, 322f, 20f), localScale = new Vector3(2.8f, 2.8f, 2.8f) }, new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixCollective, localPos = new Vector3(-0.65f, -0.25f, -2.14f), localAngles = new Vector3(340f, 222f, 20.00001f), localScale = new Vector3(2.8f, 2.8f, -2.8f) }, new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixCollectiveRing, localPos = new Vector3(0f, 0.03604f, -0.00557f), localAngles = new Vector3(270f, -3E-05f, 0f), localScale = new Vector3(5f, 5f, 5f) } }); } public string CreateLoreToken() { return "The water lasted two days after my exile.\n\nI had a lot of time to contemplate. On how the dunepeople weren't afraid. Not of the shrieks, not of the flames, not of my warnings.\n\nSoundly, they slept through nights where I tossed and turned, kept awake by those otherworldly calls.\n\nWhen I encountered one of the hell-beasts in the wild, when it erupted from the sand below, adrenaline overtook me.\n\nI saw a demon-skull and blood-red scales. I didn't hesitate. It wasn't the first beast I'd had to put down on this miserable planet. I told myself it wouldn't be the last.\n\n\"They're coming!\" I yelled. \"There's dozens of them out there!\" I warned. But none listened. The dunefolk stopped talking to me. Wouldn't meet my eyeline. Not long after, the chief painted a tar-black mark on my forehead. Cursed. Exiled. The guards escorted me to the walls, weapons drawn.\n\nHow was I supposed to know that killing one of those horrid things was some ridiculous cultural taboo?\n\n----------------------------------------\n\nThe mark burns. My skin burns. Everything burns. I dream of cold water and wake to a dry mouth and a screaming sky.\n\nI can hear their shrieks. Above and Below. Following. Patient. Circling.\n\n----------------------------------------\n\nI... don't think the curse is superstition."; } public void SetupFlamebreathPrefab() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = ClonedAssets.SkyDraconFlamebreathEffect.GetComponentsInChildren(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ((Component)val).transform.localScale = new Vector3(1.8f, 1.8f, 4.5f); ((Component)val).transform.localPosition = new Vector3(0f, 0f, 16f); } } private bool SetDraconStunState(orig_SetInterruptState orig, EntityStateMachine self, EntityState newNextState, InterruptPriority interruptPriority) { //IL_0004: 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_0040: Unknown result type (might be due to invalid IL or missing references) bool flag = orig.Invoke(self, newNextState, interruptPriority); if (flag && (Object)(object)self.commonComponents.characterBody != (Object)null) { CharacterBody characterBody = self.commonComponents.characterBody; if (characterBody.bodyIndex == draconBody.bodyIndex && newNextState is StunState) { self.SetNextState((EntityState)(object)new Stun()); } } return flag; } } } namespace BootlegBestiary.SkyDracon.EntityStates { public class BurrowEmerge : BaseSkillState { private enum UnburrowState { Start, Burrowing, Telegraphing, Emerging } private static float startDuration = 1.5f; private static float burrowDuration = 1.25f; private static float telegraphDuration = 1f; private static float emergeDuration = 1f; private SkyDraconBehaviourController controller; private static GameObject indicatorPrefab = VanillaAssets.GroundOnlyTargetIndicator; private GameObject indicatorInstance; private Vector3 startPosition; private Vector3 targetPosition; private float effectTimer; private static float effectInterval = 0.15f; private static GameObject burrowEffect = VanillaAssets.MiniMushrumPlantEffect; private static GameObject emergeEffect = VanillaAssets.BeetleGuardSlamEffect; private Vector3 differenceBetweenPositionAndFootPosition; private UnburrowState unburrowState = UnburrowState.Start; public override void OnEnter() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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) ((BaseState)this).OnEnter(); controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent(); controller.RemoveCollision(); ((EntityState)this).PlayCrossfade("Base", "GroundedBurrow", 0.1f); startPosition = ((EntityState)this).characterBody.transform.position; differenceBetweenPositionAndFootPosition = ((EntityState)this).characterBody.transform.position - ((EntityState)this).characterBody.footPosition; } public override void OnExit() { ((EntityState)this).OnExit(); EntityState.Destroy((Object)(object)indicatorInstance); if ((Object)(object)((EntityState)this).skillLocator != (Object)null && (Object)(object)((EntityState)this).skillLocator.secondary != (Object)null) { ((EntityState)this).skillLocator.secondary.RemoveAllStocks(); } } public override void FixedUpdate() { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0176: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: 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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Expected O, but got Unknown //IL_0072: 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_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d8: 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_0356: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Expected O, but got Unknown //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Expected O, but got Unknown //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: 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_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge > startDuration && unburrowState == UnburrowState.Start) { unburrowState = UnburrowState.Burrowing; controller.BeginBurrowedState(); if ((Object)(object)((EntityState)this).characterBody != (Object)null && (Object)(object)((EntityState)this).characterBody.master != (Object)null) { targetPosition = ((EntityState)this).characterBody.transform.position; BaseAI component = ((Component)((EntityState)this).characterBody.master).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.currentEnemy.characterBody != (Object)null) { Vector3 corePosition = component.currentEnemy.characterBody.corePosition; Vector3 position = ((EntityState)this).characterBody.transform.position; RaycastHit val = default(RaycastHit); if (Vector3.Distance(corePosition, targetPosition) < 50f && Physics.Raycast(corePosition, Vector3.down, ref val, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { targetPosition = ((RaycastHit)(ref val)).point; } } } } if (unburrowState == UnburrowState.Burrowing) { float num = Mathf.Clamp01((((EntityState)this).fixedAge - startDuration) / burrowDuration); Vector3 val2 = Vector3.Lerp(startPosition, targetPosition, num); TeleportHelper.TeleportBody(((EntityState)this).characterBody, val2, true); effectTimer -= Time.fixedDeltaTime; if (effectTimer < 0f) { effectTimer += effectInterval; Vector3 position2 = ((EntityState)this).characterBody.transform.position; Vector3 position3 = ((EntityState)this).characterBody.transform.position; position3.y = Mathf.Max(startPosition.y, targetPosition.y); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(position3 + new Vector3(0f, 10f, 0f), Vector3.down, ref val3, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { position2 = ((RaycastHit)(ref val3)).point; EffectManager.SpawnEffect(burrowEffect, new EffectData { origin = position2, scale = 1f }, true); } } } if (((EntityState)this).fixedAge > startDuration + burrowDuration && unburrowState == UnburrowState.Burrowing) { unburrowState = UnburrowState.Telegraphing; indicatorInstance = Object.Instantiate(indicatorPrefab, targetPosition, Util.QuaternionSafeLookRotation(Vector3.up)); TeamAreaIndicator component2 = indicatorInstance.GetComponent(); component2.teamComponent = ((EntityState)this).characterBody.teamComponent; ((Component)component2).transform.localScale = Vector3.one * 6f; } if (((EntityState)this).fixedAge > startDuration + burrowDuration + telegraphDuration && unburrowState == UnburrowState.Telegraphing) { unburrowState = UnburrowState.Emerging; controller.RestoreCollision(); controller.ExitBurrowIntoAirborneState(); TeleportHelper.TeleportBody(((EntityState)this).characterBody, targetPosition + new Vector3(0f, 2f, 0f), true); ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); ((EntityState)this).characterMotor.velocity = new Vector3(0f, 25f, 0f); ((EntityState)this).PlayAnimation("Base", "GroundedToAir"); EffectManager.SpawnEffect(emergeEffect, new EffectData { origin = targetPosition, scale = 1f }, true); Util.PlaySound("Play_skyDracon_unburrow", ((Component)((EntityState)this).characterBody).gameObject); BlastAttack val4 = new BlastAttack(); val4.attacker = ((Component)((EntityState)this).characterBody).gameObject; val4.inflictor = ((Component)((EntityState)this).characterBody).gameObject; val4.position = targetPosition; val4.radius = 6f; val4.crit = ((BaseState)this).RollCrit(); val4.procCoefficient = 1f; val4.damageColorIndex = (DamageColorIndex)0; val4.baseDamage = 2f * ((BaseState)this).damageStat; val4.attackerFiltering = (AttackerFiltering)2; val4.baseForce = 2000f; val4.bonusForce = new Vector3(0f, 2000f, 0f); val4.damageType = new DamageTypeCombo { damageType = (DamageType)0, damageSource = (DamageSource)2 }; val4.procChainMask = default(ProcChainMask); val4.Fire(); } if (((EntityState)this).fixedAge > startDuration + burrowDuration + telegraphDuration + emergeDuration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (unburrowState == UnburrowState.Start || unburrowState == UnburrowState.Emerging) { return (InterruptPriority)2; } return (InterruptPriority)9; } } public class BurrowRelocate : BaseSkillState { private static float burrowDuration = 1.25f; private static float emergeDuration = 1f; private static float unburrowDelay = 0.5f; private float effectTimer; private static float effectInterval = 0.2f; private static GameObject burrowEffect = VanillaAssets.MiniMushrumPlantEffect; private Vector3 startPosition; private Vector3 targetPosition; private bool completedMovement; private SkyDraconBehaviourController controller; public override void OnEnter() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017c: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); Animator modelAnimator = ((EntityState)this).GetModelAnimator(); if ((Object)(object)modelAnimator != (Object)null) { modelAnimator.SetFloat("diveBombAngleCycle", 0.5f); } if ((Object)(object)((EntityState)this).skillLocator != (Object)null && (Object)(object)((EntityState)this).skillLocator.utility != (Object)null) { ((EntityState)this).skillLocator.utility.RemoveAllStocks(); } controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent(); startPosition = ((EntityState)this).characterBody.transform.position; targetPosition = startPosition; Vector3 nodeSearchPosition = ((EntityState)this).characterBody.transform.position; if ((Object)(object)((EntityState)this).characterBody != (Object)null && (Object)(object)((EntityState)this).characterBody.master != (Object)null) { BaseAI component = ((Component)((EntityState)this).characterBody.master).gameObject.GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.currentEnemy.characterBody != (Object)null) { Vector3 position = component.currentEnemy.characterBody.transform.position; Vector3 position2 = ((EntityState)this).characterBody.transform.position; float num = Vector3.Distance(position, position2); if (num < 40f) { nodeSearchPosition = position; } } } NodeGraph groundNodes = SceneInfo.instance.groundNodes; NodeIndex favoredNodeIndex = GetFavoredNodeIndex(nodeSearchPosition, groundNodes); Vector3 val = default(Vector3); if (!groundNodes.GetNodePosition(favoredNodeIndex, ref val)) { return; } int i = 0; bool flag = false; RaycastHit val2 = default(RaycastHit); for (; i < 6; i++) { if (flag) { break; } float num2 = Random.Range(-2f, 2f); float num3 = Random.Range(-2f, 2f); val.x += num2; val.z += num3; val.y += 5f; if (Physics.Raycast(val, Vector3.down, ref val2, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { targetPosition = ((RaycastHit)(ref val2)).point; flag = true; } } } public NodeIndex GetFavoredNodeIndex(Vector3 nodeSearchPosition, NodeGraph nodeGraph) { //IL_0002: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) List list = nodeGraph.FindNodesInRange(nodeSearchPosition, 10f, 30f, (HullMask)1); if (list.Count == 0) { return nodeGraph.FindClosestNode(nodeSearchPosition, (HullClassification)0, float.PositiveInfinity); } return list[Random.RandomRangeInt(0, list.Count)]; } public override void OnExit() { ((EntityState)this).OnExit(); } public override void FixedUpdate() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00e1: 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_00ee: 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_0107: Expected O, but got Unknown ((EntityState)this).FixedUpdate(); float num = Mathf.Clamp01(((EntityState)this).fixedAge / burrowDuration); Vector3 position = Vector3.Lerp(startPosition, targetPosition, num); ((EntityState)this).characterBody.transform.position = position; effectTimer -= Time.fixedDeltaTime; if (effectTimer < 0f) { effectTimer += effectInterval; Vector3 position2 = ((EntityState)this).characterBody.transform.position; position2.y = Mathf.Max(targetPosition.y, startPosition.y) + 1f; RaycastHit val = default(RaycastHit); if (Physics.Raycast(position2, Vector3.down, ref val, 25f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { Vector3 point = ((RaycastHit)(ref val)).point; EffectManager.SpawnEffect(burrowEffect, new EffectData { origin = point, scale = 1f }, true); } } if (((EntityState)this).fixedAge > burrowDuration + unburrowDelay && !completedMovement) { completedMovement = true; controller.ExitBurrowIntoGroundedState(); ((EntityState)this).PlayAnimation("Base", "Unearth"); } if (((EntityState)this).fixedAge > burrowDuration + unburrowDelay + emergeDuration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)9; } } public class Death : GenericCharacterDeath { private enum FallingDeathAnimState { Start, Falling, End } private static float startDuration = 1f; private Animator animator; protected ICharacterGravityParameterProvider gravityProvider; protected ICharacterFlightParameterProvider flightProvider; private static GameObject dirtEffect = VanillaAssets.BellPartsImpactEffect; private float effectTimer; private static float effectInterval = 0.1f; private bool playedFlap; private SkyDraconBehaviourController controller; private SkyDraconBehaviourController.DraconState draconStateAtDeath; private FallingDeathAnimState fallingDeathAnimState; public override void OnEnter() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown draconStateAtDeath = SkyDraconBehaviourController.DraconState.Flying; controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent(); if ((Object)(object)controller != (Object)null) { draconStateAtDeath = controller.draconState; } ((GenericCharacterDeath)this).OnEnter(); Util.PlaySound("Play_skyDracon_death_new", ((EntityState)this).gameObject); GenericCharacterDeath.maxFallDuration = 8f; animator = ((EntityState)this).GetModelAnimator(); animator.SetFloat("diveBombAngleCycle", 0.5f); if (draconStateAtDeath == SkyDraconBehaviourController.DraconState.Flying && (Object)(object)((EntityState)this).characterMotor != (Object)null) { if (((EntityState)this).characterMotor.isGrounded) { HitGround(); } else { ((EntityState)this).characterMotor.onHitGroundAuthority += new HitGroundDelegate(CharacterMotor_onHitGround); } } flightProvider = ((EntityState)this).gameObject.GetComponent(); gravityProvider = ((EntityState)this).gameObject.gameObject.GetComponent(); } private void CharacterMotor_onHitGround(ref HitGroundInfo hitGroundInfo) { HitGround(); } private void HitGround() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if (fallingDeathAnimState != FallingDeathAnimState.End) { fallingDeathAnimState = FallingDeathAnimState.End; ((EntityState)this).PlayCrossfade("Base", "DeathEnd", 0.1f); Util.PlaySound("Play_skyDracon_unburrow", ((EntityState)this).gameObject); ((EntityState)this).characterMotor.onHitGroundAuthority -= new HitGroundDelegate(CharacterMotor_onHitGround); if (gravityProvider != null) { CharacterGravityParameters gravityParameters = gravityProvider.gravityParameters; gravityParameters.channeledAntiGravityGranterCount--; gravityProvider.gravityParameters = gravityParameters; } if (flightProvider != null) { CharacterFlightParameters flightParameters = flightProvider.flightParameters; flightParameters.channeledFlightGranterCount--; flightProvider.flightParameters = flightParameters; } } } public override void PlayDeathAnimation(float crossfadeDuration = 0.1f) { if (draconStateAtDeath == SkyDraconBehaviourController.DraconState.Flying) { ((EntityState)this).PlayCrossfade("Base", "DeathStart", crossfadeDuration); } if (draconStateAtDeath == SkyDraconBehaviourController.DraconState.Squirming) { ((EntityState)this).PlayCrossfade("Base", "SquirmDeath", 0.1f); } if (draconStateAtDeath == SkyDraconBehaviourController.DraconState.Grounded) { ((EntityState)this).PlayCrossfade("Base", "GroundedDeath", 0.1f); } } public override void FixedUpdate() { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: 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_0211: Expected O, but got Unknown ((GenericCharacterDeath)this).FixedUpdate(); if ((Object)(object)((EntityState)this).characterMotor != (Object)null && ((EntityState)this).characterMotor.isGrounded && fallingDeathAnimState != FallingDeathAnimState.End && draconStateAtDeath == SkyDraconBehaviourController.DraconState.Flying) { HitGround(); } if (draconStateAtDeath != 0) { return; } if (((EntityState)this).fixedAge > startDuration && fallingDeathAnimState == FallingDeathAnimState.Start) { fallingDeathAnimState = FallingDeathAnimState.Falling; ((EntityState)this).PlayCrossfade("Base", "DeathLoop", 0.1f); } if ((Object)(object)animator != (Object)null && animator.GetFloat("deathFlapTrigger") > 0.6f && !playedFlap) { playedFlap = true; Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject); } if (fallingDeathAnimState != FallingDeathAnimState.End && (Object)(object)((EntityState)this).characterMotor != (Object)null) { Vector3 val = 1.5f * ((EntityState)this).characterDirection.forward + Vector3.down; Vector3 normalized = ((Vector3)(ref val)).normalized; CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.velocity += normalized * 50f * Time.fixedDeltaTime; } if (fallingDeathAnimState == FallingDeathAnimState.End && (Object)(object)((EntityState)this).characterMotor != (Object)null && ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).magnitude > 3f && ((EntityState)this).characterMotor.isGrounded) { effectTimer -= Time.fixedDeltaTime; if (effectTimer < 0f) { effectTimer += effectInterval; EffectManager.SpawnEffect(dirtEffect, new EffectData { origin = ((EntityState)this).characterBody.transform.position, scale = 10f }, true); } } } } public class DiveBomb : BaseSkillState { private static float windupDuration = 1.25f; private static float attackDuration = 2f; private static float attackDurationLeniency = 0.25f; private Vector3 startPosition; private Vector3 targetPosition; private Vector3 initialVelocity; private Vector3 moveDirection; private bool hitGround = false; private bool startedDive = false; private Animator animator; private float desiredPitchValue; private bool failedToBurrow; private float flapTimer; private static float flapInterval = 0.2f; private int flapCount; private static int maxFramesTouchingGround = 2; private int framesTouchingGround; public override void OnEnter() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //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_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0226: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); flapTimer = flapInterval; animator = ((EntityState)this).GetModelAnimator(); hitGround = false; ((EntityState)this).characterMotor.onHitGroundAuthority += new HitGroundDelegate(OnHitGround); startPosition = ((EntityState)this).characterBody.transform.position; if (!((Object)(object)((EntityState)this).characterBody != (Object)null) || !((Object)(object)((EntityState)this).characterBody.master != (Object)null)) { return; } BaseAI component = ((Component)((EntityState)this).characterBody.master).gameObject.GetComponent(); if (!((Object)(object)component != (Object)null) || !((Object)(object)component.currentEnemy.characterBody != (Object)null)) { return; } CharacterBody characterBody = component.currentEnemy.characterBody; NodeGraph groundNodes = SceneInfo.instance.groundNodes; RaycastHit val = default(RaycastHit); if (Physics.Raycast(characterBody.transform.position, Vector3.down, ref val, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { targetPosition = ((RaycastHit)(ref val)).point; } else if ((Object)(object)characterBody != (Object)null && (Object)(object)groundNodes != (Object)null) { NodeIndex val2 = groundNodes.FindClosestNode(characterBody.transform.position, (HullClassification)0, float.PositiveInfinity); if (!groundNodes.GetNodePosition(val2, ref targetPosition) || targetPosition.y > startPosition.y) { ((EntityState)this).outer.SetNextStateToMain(); return; } } initialVelocity = Trajectory.CalculateInitialVelocityFromTime(startPosition, targetPosition, attackDuration - attackDurationLeniency, Physics.gravity.y * 1.5f, 0f, float.PositiveInfinity); moveDirection = targetPosition - startPosition; moveDirection.y = 0f; ((Vector3)(ref moveDirection)).Normalize(); ((EntityState)this).PlayCrossfade("Base", "DiveBombStart", 0.1f); Vector3 normalized = ((Vector3)(ref initialVelocity)).normalized; float num = Mathf.Asin(Mathf.Clamp(normalized.y, -1f, 1f)) * 57.29578f; desiredPitchValue = Mathf.Clamp((num + 90f) / 180f, 0f, 0.999f); } private void StartDiveBomb() { ((EntityState)this).PlayCrossfade("Base", "DiveBomb", 0.1f); } private void OnHitGround(ref HitGroundInfo hitGroundInfo) { //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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_00ac: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_0112: 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_011d: 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_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01cb: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) Vector3 position = hitGroundInfo.position; RaycastHit val = default(RaycastHit); if (!Physics.Raycast(((EntityState)this).characterBody.transform.position, Vector3.down, ref val, 5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return; } if (Physics.Raycast(((EntityState)this).characterBody.transform.position - new Vector3(0f, 10f, 0f), Vector3.up, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; return; } position = ((RaycastHit)(ref val)).point; if (!startedDive) { ((EntityState)this).outer.SetNextStateToMain(); } else if (!hitGround) { hitGround = true; ((EntityState)this).characterMotor.velocity = Vector3.zero; ((EntityState)this).outer.SetNextState((EntityState)(object)new Squirm { direction = moveDirection, groundHitPoint = position }); BlastAttack val2 = new BlastAttack(); val2.attacker = ((Component)((EntityState)this).characterBody).gameObject; val2.inflictor = ((Component)((EntityState)this).characterBody).gameObject; val2.position = position; val2.radius = 6f; val2.crit = ((BaseState)this).RollCrit(); val2.procCoefficient = 1f; val2.damageColorIndex = (DamageColorIndex)0; val2.baseDamage = 1f * ((BaseState)this).damageStat; val2.attackerFiltering = (AttackerFiltering)2; val2.baseForce = 2000f; val2.bonusForce = new Vector3(0f, 2000f, 0f); val2.damageType = new DamageTypeCombo { damageType = (DamageType)0, damageSource = (DamageSource)2 }; val2.procChainMask = default(ProcChainMask); val2.Fire(); } } public override void OnExit() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown ((EntityState)this).OnExit(); ((EntityState)this).characterMotor.onHitGroundAuthority -= new HitGroundDelegate(OnHitGround); } public override void FixedUpdate() { //IL_0136: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (!hitGround && (Object)(object)((EntityState)this).characterMotor != (Object)null && ((EntityState)this).characterMotor.isGrounded) { framesTouchingGround++; } else if (framesTouchingGround != 0) { framesTouchingGround = 0; } if (framesTouchingGround > maxFramesTouchingGround && !hitGround) { ((EntityState)this).outer.SetNextStateToMain(); return; } flapTimer -= Time.fixedDeltaTime; if (flapTimer < 0f && flapCount < 3) { flapTimer += flapInterval; flapCount++; Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject); } if (hitGround) { return; } if (((EntityState)this).fixedAge > windupDuration && !startedDive) { startedDive = true; StartDiveBomb(); } ((EntityState)this).inputBank.moveVector = moveDirection; ((EntityState)this).inputBank.aimDirection = moveDirection; ((EntityState)this).characterDirection.moveVector = moveDirection; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { Vector3 val = initialVelocity + Physics.gravity * 1.5f * (((EntityState)this).fixedAge - windupDuration); if (val.y < 0f) { val.y *= 2f; } if (((EntityState)this).fixedAge - windupDuration < 0f) { val = initialVelocity * Mathf.Pow(Mathf.Clamp01(((EntityState)this).fixedAge / windupDuration), 3f); } ((EntityState)this).characterMotor.velocity = val; } if (((EntityState)this).fixedAge > attackDuration + windupDuration) { failedToBurrow = true; animator.SetFloat("diveBombAngleCycle", 0.5f); ((EntityState)this).outer.SetNextStateToMain(); } } public override void Update() { //IL_00cd: 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_00d4: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).Update(); if (failedToBurrow) { animator.SetFloat("diveBombAngleCycle", 0.5f); } else if (!startedDive) { if ((Object)(object)animator != (Object)null) { float num = Mathf.Clamp01(((EntityState)this).age / windupDuration); float num2 = Mathf.Lerp(0.5f, desiredPitchValue, num); animator.SetFloat("diveBombAngleCycle", num2); } } else if ((Object)(object)animator != (Object)null && ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).sqrMagnitude > 0.01f) { Vector3 normalized = ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).normalized; float num3 = Mathf.Asin(Mathf.Clamp(normalized.y, -1f, 1f)) * 57.29578f; float num4 = Mathf.Clamp((num3 + 90f) / 180f, 0f, 0.999f); animator.SetFloat("diveBombAngleCycle", num4); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } public class Flamebreath : BaseSkillState { private enum FlamebreathState { Windup, Attack, Exit } private static float windupDuration = 1.25f; private float attackDuration = 1.5f; private static float exitDuration = 1.75f; private Vector3 moveDirection; private Vector3 attackDirection; private static float flightSpeed = 30f; private Transform flamebreathInstance; private EffectManagerHelper _emh_flamebreathEffectInstance; private static GameObject impactEffect = VanillaAssets.OmniExplosionEffect; private float tickInterval = 0.25f; private float tickTimer; private bool playedEndFlap; private static GameObject chargeVfxPrefab = VanillaAssets.LemBruiserFlamebreathChargeEffect; private GameObject chargeVfxInstance; private EffectManagerHelper _emh_chargeVfx; private SkyDraconBehaviourController controller; private bool groundedAttack; private float perTickDamageCoefficient = 1f; private FlamebreathState attackState; private float totalDuration; private static string muzzleString = "Muzzle"; private Transform muzzleTransform; private Animator modelAnimator; private CharacterBody targetBody; public override void OnEnter() { //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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_01cb: 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) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent(); if ((Object)(object)controller != (Object)null) { groundedAttack = controller.draconState == SkyDraconBehaviourController.DraconState.Grounded; } if (!groundedAttack) { Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject); } attackDuration = (groundedAttack ? 2.5f : 1.5f); perTickDamageCoefficient = (groundedAttack ? 0.5f : 0.75f); Util.PlaySound("Play_skyDracon_flameWindup", ((EntityState)this).gameObject); modelAnimator = ((EntityState)this).GetComponent(); totalDuration = windupDuration + attackDuration + exitDuration; ((BaseState)this).StartAimMode(totalDuration, false); attackState = FlamebreathState.Windup; ((EntityState)this).PlayCrossfade("Body", groundedAttack ? "GroundedFlamebreathWindup" : "FlamebreathWindup", 0.2f); BaseAI component = ((Component)((EntityState)this).characterBody.master).gameObject.GetComponent(); ChildLocator modelChildLocator = ((EntityState)this).GetModelChildLocator(); if ((Object)(object)modelChildLocator != (Object)null) { muzzleTransform = modelChildLocator.FindChild(muzzleString); } if ((Object)(object)component != (Object)null && (Object)(object)component.currentEnemy.characterBody != (Object)null) { targetBody = component.currentEnemy.characterBody; Vector3 val = targetBody.corePosition - ((EntityState)this).characterBody.corePosition; if (!groundedAttack) { val.y = 0f; ((Vector3)(ref val)).Normalize(); moveDirection = val; Vector3 val2 = val + 2f * Vector3.down; attackDirection = ((Vector3)(ref val2)).normalized; } else { moveDirection = ((Vector3)(ref val)).normalized; attackDirection = ((Vector3)(ref val)).normalized; } } else { moveDirection = ((EntityState)this).inputBank.aimDirection; moveDirection.y = 0f; attackDirection = ((EntityState)this).inputBank.aimDirection; } if ((Object)(object)muzzleTransform != (Object)null) { if (!EffectManager.ShouldUsePooledEffect(chargeVfxPrefab)) { chargeVfxInstance = Object.Instantiate(chargeVfxPrefab, muzzleTransform.position, muzzleTransform.rotation); } else { _emh_chargeVfx = EffectManager.GetAndActivatePooledEffect(chargeVfxPrefab, muzzleTransform.position, muzzleTransform.rotation); chargeVfxInstance = ((Component)_emh_chargeVfx).gameObject; } chargeVfxInstance.transform.parent = muzzleTransform; } } public override void FixedUpdate() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0066: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_004e: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); ((EntityState)this).inputBank.moveVector = moveDirection; Vector3 val; if (!groundedAttack || (Object)(object)targetBody == (Object)null) { InputBankTest inputBank = ((EntityState)this).inputBank; val = moveDirection + Vector3.down; inputBank.aimDirection = ((Vector3)(ref val)).normalized; } ((EntityState)this).characterDirection.moveVector = moveDirection; if (groundedAttack && (Object)(object)targetBody != (Object)null) { Vector3 corePosition = targetBody.corePosition; Ray aimRay = ((BaseState)this).GetAimRay(); val = corePosition - ((Ray)(ref aimRay)).origin; Vector3 normalized = ((Vector3)(ref val)).normalized; attackDirection = Vector3.RotateTowards(attackDirection, normalized, 0.005f, 0f); ((EntityState)this).inputBank.aimDirection = attackDirection; } if (!groundedAttack) { ApplyVelocity(); if ((Object)(object)modelAnimator != (Object)null && modelAnimator.GetFloat("flameEndFlapTrigger") > 0.6f && !playedEndFlap) { Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject); playedEndFlap = true; } } if (((EntityState)this).fixedAge > windupDuration && attackState == FlamebreathState.Windup) { attackState = FlamebreathState.Attack; ((EntityState)this).PlayCrossfade("Body", groundedAttack ? "GroundedFlamebreathLoop" : "Flamebreath", 0.1f); if (!EffectManager.ShouldUsePooledEffect(ClonedAssets.SkyDraconFlamebreathEffect)) { flamebreathInstance = Object.Instantiate(ClonedAssets.SkyDraconFlamebreathEffect, muzzleTransform).transform; } else { _emh_flamebreathEffectInstance = EffectManager.GetAndActivatePooledEffect(ClonedAssets.SkyDraconFlamebreathEffect, muzzleTransform, true); flamebreathInstance = ((Component)_emh_flamebreathEffectInstance).gameObject.transform; } flamebreathInstance.localScale = Vector3.one; ((Component)flamebreathInstance).GetComponent().newDuration = attackDuration; Util.PlaySound("Play_lemurianBruiser_m2_loop", ((Component)((EntityState)this).characterBody).gameObject); DestroyChargeEffect(); } if (((EntityState)this).fixedAge > windupDuration + attackDuration && attackState == FlamebreathState.Attack) { ((EntityState)this).PlayCrossfade("Body", groundedAttack ? "GroundedFlamebreathEnd" : "FlamebreathEnd", 0.1f); if (!groundedAttack) { Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject); } attackState = FlamebreathState.Exit; DestroyFlamebreathEffect(); Util.PlaySound("Stop_lemurianBruiser_m2_loop", ((Component)((EntityState)this).characterBody).gameObject); } if (attackState == FlamebreathState.Attack) { tickTimer -= Time.fixedDeltaTime; if (tickTimer < 0f) { tickTimer += tickInterval; FireAttack(); } } if ((Object)(object)flamebreathInstance != (Object)null) { ((Component)flamebreathInstance).transform.forward = attackDirection; } if (((EntityState)this).fixedAge > totalDuration) { ((EntityState)this).outer.SetNextStateToMain(); } } private void FireAttack() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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) BulletAttack val = new BulletAttack(); val.owner = ((EntityState)this).gameObject; val.weapon = ((EntityState)this).gameObject; val.origin = muzzleTransform.position; val.aimVector = attackDirection; val.minSpread = 0f; val.maxSpread = 0f; val.damage = perTickDamageCoefficient * ((BaseState)this).damageStat; val.force = 0f; val.isCrit = ((BaseState)this).RollCrit(); val.hitEffectPrefab = impactEffect; val.falloffModel = (FalloffModel)0; val.stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask; val.procCoefficient = 0.5f; val.maxDistance = 35f; val.smartCollision = true; val.damageType = new DamageTypeCombo { damageType = (DamageType)128, damageSource = (DamageSource)1 }; val.radius = 2.5f; val.Fire(); } private void ApplyVelocity() { //IL_004a: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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) if (!((Object)(object)((EntityState)this).characterMotor == (Object)null)) { if (attackState == FlamebreathState.Windup) { float num = Mathf.Clamp01(((EntityState)this).fixedAge / windupDuration); float num2 = Mathf.Pow(num, 2f); ((EntityState)this).characterMotor.velocity = moveDirection * flightSpeed * num2; } if (attackState == FlamebreathState.Attack) { ((EntityState)this).characterMotor.velocity = moveDirection * flightSpeed; } if (attackState == FlamebreathState.Exit) { float num3 = 1f - Mathf.Clamp01((((EntityState)this).fixedAge - windupDuration - attackDuration) / exitDuration); float num4 = Mathf.Pow(num3, 2f); ((EntityState)this).characterMotor.velocity = moveDirection * flightSpeed * num4; } } } private void DestroyFlamebreathEffect() { if ((Object)(object)flamebreathInstance != (Object)null) { if ((Object)(object)_emh_flamebreathEffectInstance != (Object)null && _emh_flamebreathEffectInstance.OwningPool != null) { ((GenericPool)(object)_emh_flamebreathEffectInstance.OwningPool).ReturnObject(_emh_flamebreathEffectInstance); } else { EntityState.Destroy((Object)(object)((Component)flamebreathInstance).gameObject); } flamebreathInstance = null; _emh_flamebreathEffectInstance = null; } } private void DestroyChargeEffect() { if ((Object)(object)chargeVfxInstance != (Object)null) { if ((Object)(object)_emh_chargeVfx != (Object)null && _emh_chargeVfx.OwningPool != null) { ((GenericPool)(object)_emh_chargeVfx.OwningPool).ReturnObject(_emh_chargeVfx); } else { EntityState.Destroy((Object)(object)chargeVfxInstance); } chargeVfxInstance = null; _emh_chargeVfx = null; } } public override void OnExit() { ((EntityState)this).OnExit(); DestroyFlamebreathEffect(); DestroyChargeEffect(); Util.PlaySound("Stop_lemurianBruiser_m2_loop", ((Component)((EntityState)this).characterBody).gameObject); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } public class Flight : BaseState { protected ICharacterGravityParameterProvider characterGravityParameterProvider; protected ICharacterFlightParameterProvider characterFlightParameterProvider; public override void OnEnter() { //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_0056: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); characterGravityParameterProvider = ((EntityState)this).gameObject.GetComponent(); characterFlightParameterProvider = ((EntityState)this).gameObject.GetComponent(); if (characterGravityParameterProvider != null) { CharacterGravityParameters gravityParameters = characterGravityParameterProvider.gravityParameters; gravityParameters.channeledAntiGravityGranterCount++; characterGravityParameterProvider.gravityParameters = gravityParameters; } if (characterFlightParameterProvider != null) { CharacterFlightParameters flightParameters = characterFlightParameterProvider.flightParameters; flightParameters.channeledFlightGranterCount++; characterFlightParameterProvider.flightParameters = flightParameters; } } public override void OnExit() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_004e: 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) if (characterFlightParameterProvider != null) { CharacterFlightParameters flightParameters = characterFlightParameterProvider.flightParameters; flightParameters.channeledFlightGranterCount--; characterFlightParameterProvider.flightParameters = flightParameters; } if (characterGravityParameterProvider != null) { CharacterGravityParameters gravityParameters = characterGravityParameterProvider.gravityParameters; gravityParameters.channeledAntiGravityGranterCount--; characterGravityParameterProvider.gravityParameters = gravityParameters; } ((EntityState)this).OnExit(); } } public class FlyingStun : BaseState { private Animator modelAnimator; private bool unsubscribedToEvent; public float stunDurationToCarryOver; private static GameObject impactEffect = VanillaAssets.BeetleGuardSlamEffect; private SkyDraconBehaviourController controller; private static float timeoutDuration = 5f; private static int maxGroundedFrames = 2; private int groundedFrames; public override void OnEnter() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown ((BaseState)this).OnEnter(); ((EntityState)this).PlayCrossfade("Base", "StunAirStart", 0.1f); modelAnimator = ((EntityState)this).GetModelAnimator(); controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent(); if ((Object)(object)((EntityState)this).characterMotor != (Object)null) { ((EntityState)this).characterMotor.onHitGroundAuthority += new HitGroundDelegate(OnHitGround); } } private void OnHitGround(ref HitGroundInfo hitGroundInfo) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_012b: Expected O, but got Unknown //IL_0137: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00ad: Unknown result type (might be due to invalid IL or missing references) Vector3 position = hitGroundInfo.position; if (!unsubscribedToEvent) { if (!Physics.Raycast(((EntityState)this).characterBody.transform.position, Vector3.down, 5f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { return; } if (Physics.Raycast(((EntityState)this).characterBody.transform.position - new Vector3(0f, 10f, 0f), Vector3.up, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; return; } position = hitGroundInfo.position; } if ((Object)(object)((EntityState)this).characterMotor != (Object)null) { ((EntityState)this).characterMotor.onHitGroundAuthority -= new HitGroundDelegate(OnHitGround); unsubscribedToEvent = true; Util.PlaySound("Play_skyDracon_unburrow", ((Component)((EntityState)this).characterBody).gameObject); EffectManager.SpawnEffect(impactEffect, new EffectData { origin = position }, true); ((EntityState)this).characterBody.transform.position = position; controller.EnterSquirmState(); modelAnimator.SetFloat("diveBombAngleCycle", 0f); ((EntityState)this).outer.SetNextState((EntityState)(object)new Stun { stunDuration = stunDurationToCarryOver }); } } public override void OnExit() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown ((EntityState)this).OnExit(); if ((Object)(object)((EntityState)this).characterMotor != (Object)null && !unsubscribedToEvent) { ((EntityState)this).characterMotor.onHitGroundAuthority -= new HitGroundDelegate(OnHitGround); unsubscribedToEvent = true; } } public override void FixedUpdate() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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) ((EntityState)this).FixedUpdate(); if ((Object)(object)((EntityState)this).characterMotor != (Object)null && !unsubscribedToEvent) { if (((EntityState)this).characterMotor.isGrounded) { groundedFrames++; } else if (groundedFrames > 0) { groundedFrames = 0; } if (groundedFrames > maxGroundedFrames) { ((EntityState)this).outer.SetNextStateToMain(); return; } CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.velocity += new Vector3(0f, -1f, 0f); Vector3 normalized = ((Vector3)(ref ((EntityState)this).characterMotor.velocity)).normalized; float num = Mathf.Asin(Mathf.Clamp(normalized.y, -1f, 1f)) * 57.29578f; float num2 = Mathf.Clamp((num + 90f) / 180f, 0f, 0.999f); modelAnimator.SetFloat("diveBombAngleCycle", num2); } if (((EntityState)this).fixedAge > timeoutDuration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)9; } } public class SkyDraconCharacterMain : GenericCharacterMain { private EntityStateMachine weaponEsm; private bool attacking; private float groundCheckTimer; private float groundCheckInterval = 1f; private bool playedFlapThisLoop; private SkyDraconBehaviourController controller; private Animator animator; public override void OnEnter() { ((GenericCharacterMain)this).OnEnter(); animator = ((EntityState)this).GetModelAnimator(); controller = ((EntityState)this).GetComponent(); if ((Object)(object)controller != (Object)null) { if (controller.draconState == SkyDraconBehaviourController.DraconState.Flying) { ((EntityState)this).PlayCrossfade("Base", "Move", 0.1f); animator.SetFloat("diveBombAngleCycle", 0.5f); } if (controller.draconState == SkyDraconBehaviourController.DraconState.Grounded) { ((EntityState)this).PlayCrossfade("Base", "GroundedIdle", 0.1f); animator.SetFloat("diveBombAngleCycle", 0.5f); } } weaponEsm = (from esm in ((Component)((EntityState)this).characterBody).GetComponents() where esm.customName == "Weapon" select esm).FirstOrDefault(); groundCheckTimer = groundCheckInterval; } public override void OnExit() { ((GenericCharacterMain)this).OnExit(); if ((Object)(object)base.aimAnimator != (Object)null) { ((Behaviour)base.aimAnimator).enabled = true; } } public override void FixedUpdate() { //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) ((GenericCharacterMain)this).FixedUpdate(); bool flag = weaponEsm.state is Idle; if (flag) { if (!playedFlapThisLoop && (Object)(object)((BaseCharacterMain)this).modelAnimator != (Object)null && ((BaseCharacterMain)this).modelAnimator.GetFloat("moveFlapTrigger") > 0.4f) { playedFlapThisLoop = true; Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject); } if (playedFlapThisLoop && (Object)(object)((BaseCharacterMain)this).modelAnimator != (Object)null && ((BaseCharacterMain)this).modelAnimator.GetFloat("moveFlapTrigger") < 0.4f) { playedFlapThisLoop = false; } } if (flag && attacking) { attacking = false; if (controller.draconState == SkyDraconBehaviourController.DraconState.Flying) { ((EntityState)this).PlayCrossfade("Base", "Move", 0.2f); } if (controller.draconState == SkyDraconBehaviourController.DraconState.Grounded) { ((EntityState)this).PlayCrossfade("Base", "GroundedIdle", 0.2f); } } if (!flag && !attacking) { attacking = true; } if (!flag) { return; } groundCheckTimer -= Time.fixedDeltaTime; if (groundCheckTimer < 0f) { groundCheckTimer += groundCheckInterval; if (Physics.Raycast(((EntityState)this).characterBody.transform.position, Vector3.down, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && !Physics.Raycast(((EntityState)this).characterBody.transform.position, Vector3.up, 20f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.velocity += new Vector3(0f, 10f, 0f); } } } } public class Spawn : BaseState { private static string spawnStateString = "Spawn"; private static float duration = 2f; private static GameObject spawnEffect = VanillaAssets.BeetleGuardSlamEffect; private static float screechDelay = 1f; private bool playedScreech = false; private bool playedFlap = false; private Animator modelAnimator; public override void OnEnter() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown ((BaseState)this).OnEnter(); modelAnimator = ((EntityState)this).GetModelAnimator(); ((EntityState)this).PlayAnimation("Base", spawnStateString); ((EntityState)this).PlayAnimation("DiveBombAngle", "DiveBombAngleControl"); modelAnimator.SetFloat("diveBombAngleCycle", 0.5f); Util.PlaySound("Play_skyDracon_unburrow", ((Component)((EntityState)this).characterBody).gameObject); EffectManager.SpawnEffect(spawnEffect, new EffectData { origin = ((EntityState)this).characterBody.transform.position, scale = 1f }, true); if ((Object)(object)((EntityState)this).characterMotor != (Object)null && (Object)(object)((BaseCharacterController)((EntityState)this).characterMotor).Motor != (Object)null) { ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); } } public override void OnExit() { ((EntityState)this).OnExit(); if ((Object)(object)((EntityState)this).characterBody.skillLocator != (Object)null && (Object)(object)((EntityState)this).characterBody.skillLocator.secondary != (Object)null) { ((EntityState)this).skillLocator.secondary.RemoveAllStocks(); } } public override void FixedUpdate() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); float num = 1f - Mathf.Clamp01(((EntityState)this).fixedAge / 0.75f); if (num > 0f) { ((EntityState)this).characterMotor.velocity = Vector3.up * 30f * num; } if (((EntityState)this).fixedAge > screechDelay && !playedScreech) { playedScreech = true; Util.PlaySound("Play_skyDracon_screech", ((Component)((EntityState)this).characterBody).gameObject); } if ((Object)(object)modelAnimator != (Object)null && modelAnimator.GetFloat("spawnFlapTrigger") > 0.6f && !playedFlap) { playedFlap = true; Util.PlaySound("Play_skyDracon_Flap", ((Component)((EntityState)this).characterBody).gameObject); } if (((EntityState)this).fixedAge > duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)9; } } public class Squirm : BaseState { private static float baseDuration = 2.95f; public Vector3 direction; private static GameObject impactEffect = VanillaAssets.BeetleGuardSlamEffect; private static GameObject burrowEffect = VanillaAssets.MiniMushrumPlantEffect; private float effectTimer; private static float effectInterval = 0.2f; public Vector3 groundHitPoint; private Animator animator; private SkyDraconBehaviourController controller; public override void OnEnter() { //IL_0098: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown ((BaseState)this).OnEnter(); animator = ((EntityState)this).GetModelAnimator(); ((EntityState)this).PlayCrossfade("Base", "DiveBombEnd", 0.1f); controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent(); if ((Object)(object)controller != (Object)null && controller.draconState != SkyDraconBehaviourController.DraconState.Squirming) { animator.SetFloat("diveBombAngleCycle", 0f); Util.PlaySound("Play_skyDracon_unburrow", ((Component)((EntityState)this).characterBody).gameObject); EffectManager.SpawnEffect(impactEffect, new EffectData { origin = groundHitPoint, scale = 1f }, true); controller.EnterSquirmState(); } } public override void OnExit() { ((EntityState)this).OnExit(); if (((EntityState)this).outer.nextState is SkyDraconCharacterMain) { ((EntityState)this).outer.SetNextState((EntityState)(object)new BurrowRelocate()); } } public override void FixedUpdate() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_004e: 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_0093: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown ((EntityState)this).FixedUpdate(); ((EntityState)this).characterBody.transform.position = groundHitPoint; ((EntityState)this).inputBank.moveVector = direction; ((EntityState)this).inputBank.aimDirection = direction; ((EntityState)this).characterDirection.moveVector = direction; effectTimer -= Time.fixedDeltaTime; if (effectTimer < 0f) { effectTimer += effectInterval; EffectManager.SpawnEffect(burrowEffect, new EffectData { origin = groundHitPoint, scale = 1f }, true); } if (((EntityState)this).fixedAge > baseDuration) { controller.BeginBurrowedState(); ((EntityState)this).outer.SetNextState((EntityState)(object)new BurrowRelocate()); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)2; } } public class Stun : StunState { private SkyDraconBehaviourController controller; private Animator modelAnimator; public override void OnEnter() { ((StunState)this).OnEnter(); modelAnimator = ((EntityState)this).GetModelAnimator(); controller = ((Component)((EntityState)this).characterBody).gameObject.GetComponent(); if ((Object)(object)controller != (Object)null) { if (controller.draconState == SkyDraconBehaviourController.DraconState.Flying) { ((EntityState)this).outer.SetNextState((EntityState)(object)new FlyingStun { stunDurationToCarryOver = base.stunDuration }); } if (controller.draconState == SkyDraconBehaviourController.DraconState.Squirming) { ((EntityState)this).PlayCrossfade("Base", "Squirm", 0.1f); } if (controller.draconState == SkyDraconBehaviourController.DraconState.Grounded) { modelAnimator.SetFloat("diveBombAngleCycle", 0.5f); ((EntityState)this).PlayCrossfade("Base", "GroundedStun", 0.1f); } } } public override void OnExit() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0091: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) ((StunState)this).OnExit(); if (!((Object)(object)((EntityState)this).characterBody == (Object)null) && !((Object)(object)((EntityState)this).characterBody.healthComponent == (Object)null) && ((EntityState)this).characterBody.healthComponent.alive && controller.draconState == SkyDraconBehaviourController.DraconState.Squirming) { Vector3 groundHitPoint = ((EntityState)this).characterBody.transform.position; RaycastHit val = default(RaycastHit); if (Physics.Raycast(((EntityState)this).characterBody.transform.position, Vector3.down, ref val, 10f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { groundHitPoint = ((RaycastHit)(ref val)).point; } EntityStateMachine outer = ((EntityState)this).outer; Squirm obj = new Squirm { groundHitPoint = groundHitPoint }; Quaternion rotation = ((EntityState)this).characterBody.transform.rotation; obj.direction = ((Quaternion)(ref rotation)).eulerAngles; outer.SetNextState((EntityState)(object)obj); } } } } namespace BootlegBestiary.SkyDracon.Components { public class DebugComponent : MonoBehaviour { private BaseAI baseAI; private CharacterBody body; private CharacterMaster master; private AISkillDriver lastDriver; public void Start() { body = ((Component)this).GetComponent(); if ((Object)(object)body != (Object)null) { master = body.master; if ((Object)(object)master != (Object)null) { baseAI = ((Component)master).gameObject.GetComponent(); } } } public void FixedUpdate() { if ((Object)(object)baseAI != (Object)null) { AISkillDriver dominantSkillDriver = baseAI.skillDriverEvaluation.dominantSkillDriver; if ((Object)(object)dominantSkillDriver != (Object)(object)lastDriver) { lastDriver = dominantSkillDriver; } } } } public class SkyDraconBehaviourController : MonoBehaviour { public enum DraconState { Flying, Squirming, Burrowed, Grounded } private BaseAI baseAI; private CharacterBody body; public bool canUseSkills; private float abilityCheckTimer; private static float abilityCheckInterval = 0.25f; public EntityStateMachine flightMachine; private int originalLayer; private GameObject model; private Animator animator; private CharacterMotor motor; private List groundedBehaviourDrivers = new List(); private bool groundedDriversEnabled; private EntityStateMachine bodyMachine; private bool collisionRemoved; private ChildLocator modelChildLocator; private Transform neckTransform; private Transform armLTransform; private Transform armRTransform; private Transform tailTransform; private uint soundID; private bool stoppedSoundOnDeath; private int stuckFrames; private static int maxStuckFrames = 2; public DraconState draconState; public void Start() { draconState = DraconState.Flying; body = ((Component)this).GetComponent(); if ((Object)(object)body != (Object)null) { motor = body.characterMotor; if ((Object)(object)body.modelLocator != (Object)null && (Object)(object)body.modelLocator.modelTransform != (Object)null) { model = ((Component)body.modelLocator.modelTransform).gameObject; if ((Object)(object)model != (Object)null) { animator = model.GetComponent(); modelChildLocator = model.GetComponent(); if ((Object)(object)modelChildLocator != (Object)null) { Log.Debug("modelChildLocator is not null!"); armLTransform = modelChildLocator.FindChild("ArmL"); armRTransform = modelChildLocator.FindChild("ArmR"); neckTransform = modelChildLocator.FindChild("Neck"); tailTransform = modelChildLocator.FindChild("TailCutoff"); if ((Object)(object)armLTransform != (Object)null) { Log.Debug("armLTransform found"); } if ((Object)(object)armRTransform != (Object)null) { Log.Debug("armRTransform found"); } if ((Object)(object)neckTransform != (Object)null) { Log.Debug("neckTransform found"); } if ((Object)(object)tailTransform != (Object)null) { Log.Debug("tailTransform found!"); } } } } if ((Object)(object)body.master != (Object)null) { baseAI = ((Component)body.master).gameObject.GetComponent(); groundedBehaviourDrivers = (from driver in ((Component)body.master).gameObject.GetComponents() where driver.customName.Contains("Grounded") select driver).ToList(); foreach (AISkillDriver groundedBehaviourDriver in groundedBehaviourDrivers) { ((Behaviour)groundedBehaviourDriver).enabled = false; } } flightMachine = (from esm in ((Component)body).GetComponents() where esm.customName == "ControlFlight" select esm).FirstOrDefault(); bodyMachine = (from esm in ((Component)body).GetComponents() where esm.customName == "Body" select esm).FirstOrDefault(); } abilityCheckTimer = abilityCheckInterval; } public void FixedUpdate() { if (bodyMachine.state is SkyDraconCharacterMain && draconState == DraconState.Squirming) { stuckFrames++; if (stuckFrames > maxStuckFrames) { BeginBurrowedState(); bodyMachine.SetNextState((EntityState)(object)new BurrowRelocate()); stuckFrames = 0; return; } } else if (stuckFrames > 0) { stuckFrames = 0; } abilityCheckTimer -= Time.fixedDeltaTime; if (abilityCheckTimer < 0f) { abilityCheckTimer += abilityCheckInterval; canUseSkills = CanUsePrimaryOrSecondary(); } if (draconState == DraconState.Burrowed || draconState == DraconState.Grounded) { if (!groundedDriversEnabled) { groundedDriversEnabled = true; foreach (AISkillDriver groundedBehaviourDriver in groundedBehaviourDrivers) { ((Behaviour)groundedBehaviourDriver).enabled = true; } } } else if (groundedDriversEnabled) { groundedDriversEnabled = false; foreach (AISkillDriver groundedBehaviourDriver2 in groundedBehaviourDrivers) { ((Behaviour)groundedBehaviourDriver2).enabled = false; } } if (!stoppedSoundOnDeath) { if ((Object)(object)body == (Object)null || (Object)(object)body.healthComponent == (Object)null) { stoppedSoundOnDeath = true; AkSoundEngine.StopPlayingID(soundID); } else if ((Object)(object)body != (Object)null && (Object)(object)body.healthComponent != (Object)null && !body.healthComponent.alive) { stoppedSoundOnDeath = true; AkSoundEngine.StopPlayingID(soundID); } } } private bool CanUsePrimaryOrSecondary() { //IL_0076: 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) canUseSkills = false; if (draconState != 0) { return false; } if ((Object)(object)body != (Object)null && (Object)(object)baseAI != (Object)null && baseAI.currentEnemy.hasLoS) { CharacterBody characterBody = baseAI.currentEnemy.characterBody; if ((Object)(object)characterBody != (Object)null) { float y = characterBody.transform.position.y; float y2 = body.transform.position.y; if (y2 > y && y2 < y + 35f) { return true; } } } return false; } public void RemoveCollision() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)motor != (Object)null && !collisionRemoved) { originalLayer = ((Component)body).gameObject.layer; ((Component)body).gameObject.layer = LayerIndex.GetAppropriateFakeLayerForTeam(body.teamComponent.teamIndex).intVal; ((BaseCharacterController)motor).Motor.RebuildCollidableLayers(); collisionRemoved = true; } } public void RestoreCollision() { if ((Object)(object)motor != (Object)null && collisionRemoved) { collisionRemoved = false; ((Component)body).gameObject.layer = originalLayer; ((BaseCharacterController)motor).Motor.RebuildCollidableLayers(); } } public void EnterSquirmState() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (!((Object)(object)flightMachine == (Object)null)) { flightMachine.SetNextState((EntityState)new Idle()); RemoveCollision(); draconState = DraconState.Squirming; ((Behaviour)motor).enabled = false; ToggleUpperBodyVisibility(active: false); } } public void BeginBurrowedState() { draconState = DraconState.Burrowed; soundID = Util.PlaySound("Play_skyDracon_dig", ((Component)this).gameObject); if ((Object)(object)model != (Object)null) { model.SetActive(false); } if ((Object)(object)animator != (Object)null) { animator.SetFloat("diveBombAngleCycle", 0.5f); } } public void ExitBurrowIntoGroundedState() { if ((Object)(object)model != (Object)null) { model.SetActive(true); } RestoreCollision(); draconState = DraconState.Grounded; ToggleUpperBodyVisibility(active: true); Util.PlaySound("Stop_skyDracon_dig", ((Component)body).gameObject); Util.PlaySound("Play_miniMushroom_unborrow", ((Component)this).gameObject); } public void ExitBurrowIntoAirborneState() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)model != (Object)null) { model.SetActive(true); } RestoreCollision(); ((Behaviour)motor).enabled = true; motor.velocity = Vector3.zero; draconState = DraconState.Flying; flightMachine.SetNextState((EntityState)(object)new Flight()); ToggleUpperBodyVisibility(active: true); Util.PlaySound("Stop_skyDracon_dig", ((Component)body).gameObject); } public void ToggleUpperBodyVisibility(bool active) { if ((Object)(object)neckTransform != (Object)null) { ((Component)neckTransform).gameObject.SetActive(active); } if ((Object)(object)armLTransform != (Object)null) { ((Component)armLTransform).gameObject.SetActive(active); } if ((Object)(object)armRTransform != (Object)null) { ((Component)armRTransform).gameObject.SetActive(active); } } public void ToggleTailVisibility(bool active) { } } } namespace BootlegBestiary.Shared { public class EnemyPrefabValidator { public static void ValidateAssets(GameObject bodyPrefab, GameObject masterPrefab, CharacterSpawnCard characterSpawnCard) { ValidateBodyPrefab(bodyPrefab); ValidateMasterPrefab(masterPrefab, bodyPrefab); ValidateCharacterSpawnCard(characterSpawnCard, masterPrefab, bodyPrefab); } public static void ValidateBodyPrefab(GameObject bodyPrefab) { //IL_046e: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Invalid comparison between Unknown and I4 if ((Object)(object)bodyPrefab == (Object)null) { Log.Error("Cannot validate body prefab as prefab is null."); return; } Log.Debug("Validating body prefab: " + ((Object)bodyPrefab).name); if ((Object)(object)bodyPrefab.GetComponent() == (Object)null) { Log.Error("Prefab has no NetworkIdentity."); } if ((Object)(object)bodyPrefab.GetComponent() == (Object)null) { Log.Error("Prefab has no InputBankTest."); } if ((Object)(object)bodyPrefab.GetComponent() == (Object)null) { Log.Error("Prefab has no TeamComponent."); } if ((Object)(object)bodyPrefab.GetComponent() == (Object)null) { Log.Error("Prefab has no SkillLocator."); } if ((Object)(object)bodyPrefab.GetComponent() == (Object)null) { Log.Error("Prefab has no CharacterNetworkTransform."); } EntityStateMachine[] components = bodyPrefab.GetComponents(); bool flag = components.Any((EntityStateMachine esm) => (Object)(object)esm != (Object)null && esm.customName != "Body"); CharacterBody component = bodyPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("Prefab has no CharacterBody."); } else { Log.Debug("Checking CharacterBody fields..."); if (string.IsNullOrWhiteSpace(component.baseNameToken)) { Log.Error("CharacterBody.baseNameToken is unset."); } if (component.baseMaxHealth <= 0f) { Log.Error($"CharacterBody.baseMaxHealth is zero or negative ({component.baseMaxHealth})."); } if (component.baseRegen < 0f) { Log.Warning($"CharacterBody.baseRegen is negative ({component.baseRegen})."); } if (component.baseMoveSpeed < 0f) { Log.Error($"CharacterBody.baseMoveSpeed is negative ({component.baseMoveSpeed})."); } else if (component.baseMoveSpeed == 0f) { Log.Warning("CharacterBody.baseMoveSpeed is zero."); } if (component.baseAcceleration < 0f) { Log.Error($"CharacterBody.baseAcceleration is negative ({component.baseAcceleration})."); } else if (component.baseAcceleration == 0f && component.baseMoveSpeed > 0f) { Log.Warning("CharacterBody.baseAcceleration is zero while baseMoveSpeed is positive."); } if (component.baseJumpPower < 0f) { Log.Error($"CharacterBody.baseJumpPower is negative ({component.baseJumpPower})."); } else if (component.baseJumpPower == 0f && component.baseJumpCount > 0) { Log.Warning($"CharacterBody.baseJumpPower is zero but baseJumpCount is {component.baseJumpCount}."); } if (component.baseJumpCount < 0) { Log.Error($"CharacterBody.baseJumpCount is negative ({component.baseJumpCount})."); } if (component.baseDamage < 0f) { Log.Error($"CharacterBody.baseDamage is negative ({component.baseDamage})."); } else if (component.baseDamage == 0f) { Log.Warning("CharacterBody.baseDamage is zero."); } if (component.baseAttackSpeed < 0f) { Log.Error($"CharacterBody.baseAttackSpeed is negative ({component.baseAttackSpeed})."); } else if (component.baseAttackSpeed == 0f) { Log.Warning("CharacterBody.baseAttackSpeed is zero."); } if (component.baseCrit < 0f) { Log.Error($"CharacterBody.baseCrit is negative ({component.baseCrit})."); } if (component.baseArmor < 0f) { Log.Warning($"CharacterBody.baseArmor is negative ({component.baseArmor})."); } if (component.sprintingSpeedMultiplier < 0f) { Log.Error($"CharacterBody.sprintingSpeedMultiplier is negative ({component.sprintingSpeedMultiplier})."); } if (!component.autoCalculateLevelStats) { Log.Warning("CharacterBody.autoCalculateLevelStats is false. Verify level stats are set manually."); } if ((Object)(object)component.aimOriginTransform == (Object)null) { Log.Warning("CharacterBody.aimOriginTransform is unset. AimOrigin will fall back to the body transform position."); } if ((int)component.hullClassification == 3) { Log.Error("CharacterBody.hullClassification is invalid."); } if ((Object)(object)component.portraitIcon == (Object)null) { Log.Warning("CharacterBody.portraitIcon is unset."); } EntityStateMachine[] vehicleIdleStateMachine = component.vehicleIdleStateMachine; if (vehicleIdleStateMachine == null || vehicleIdleStateMachine.Length == 0) { if (flag) { Log.Error("CharacterBody.vehicleIdleStateMachine is empty but prefab has non-Body EntityStateMachines."); } } else if (vehicleIdleStateMachine.Any((EntityStateMachine esm) => (Object)(object)esm != (Object)null && esm.customName == "Body")) { Log.Error("CharacterBody.vehicleIdleStateMachine contains the Body EntityStateMachine."); } } CameraTargetParams component2 = bodyPrefab.GetComponent(); if ((Object)(object)component2 == (Object)null) { Log.Warning("Prefab has no CameraTargetParams. Optional, but useful for DebugToolkit's spawn_as command."); } else { Log.Debug("Checking CameraTargetParams fields..."); if ((Object)(object)component2.cameraPivotTransform == (Object)null) { Log.Message("CameraTargetParams.cameraPivotTransform is unset - falls back to CharacterBody.aimOriginTransform."); } } ModelLocator component3 = bodyPrefab.GetComponent(); if ((Object)(object)component3 == (Object)null) { Log.Error("Prefab has no ModelLocator."); } else { Log.Debug("Checking ModelLocator fields..."); if ((Object)(object)component3.modelTransform == (Object)null) { Log.Error("ModelLocator.modelTransform is unset."); } else if ((Object)(object)((Component)component3.modelTransform).gameObject.GetComponent() == (Object)null) { Log.Error("ModelLocator.modelTransform points to a GameObject without a CharacterModel."); } if ((Object)(object)component3.modelBaseTransform == (Object)null) { Log.Error("ModelLocator.modelBaseTransform is unset."); } } if (components.Length == 0) { Log.Error("Prefab has no EntityStateMachines."); } else { if (!components.Any((EntityStateMachine esm) => (Object)(object)esm != (Object)null && esm.customName == "Body")) { Log.Error("Prefab has no EntityStateMachine with customName 'Body'."); } EntityStateMachine[] array = components; foreach (EntityStateMachine val in array) { if ((Object)(object)val == (Object)null) { continue; } if (string.IsNullOrWhiteSpace(val.customName)) { Log.Error("Prefab has an unnamed EntityStateMachine."); continue; } if (string.IsNullOrWhiteSpace(((SerializableEntityStateType)(ref val.mainStateType)).typeName)) { Log.Warning("EntityStateMachine '" + val.customName + "' has no mainStateType. Set in code."); } if (string.IsNullOrWhiteSpace(((SerializableEntityStateType)(ref val.initialStateType)).typeName)) { Log.Warning("EntityStateMachine '" + val.customName + "' has no initialStateType. Set in code."); } } } NetworkStateMachine component4 = bodyPrefab.GetComponent(); if ((Object)(object)component4 == (Object)null) { Log.Error("Prefab has no NetworkStateMachine."); } else if (component4.stateMachines == null || component4.stateMachines.Length == 0) { Log.Error("NetworkStateMachine.stateMachines is empty."); } else { EntityStateMachine[] array2 = components; foreach (EntityStateMachine val2 in array2) { if (!((Object)(object)val2 == (Object)null) && !component4.stateMachines.Contains(val2)) { Log.Error("NetworkStateMachine.stateMachines does not contain '" + val2.customName + "'. This ESM will not be networked."); } } } HealthComponent component5 = bodyPrefab.GetComponent(); if ((Object)(object)component5 == (Object)null) { Log.Error("Prefab has no HealthComponent."); } else if ((Object)(object)component5.body == (Object)null) { Log.Message("HealthComponent.body is unset. Auto-resolved in HealthComponent.Awake()."); } Interactor component6 = bodyPrefab.GetComponent(); InteractionDriver component7 = bodyPrefab.GetComponent(); if ((Object)(object)component6 != (Object)null && (Object)(object)component7 == (Object)null) { Log.Error("Prefab has an Interactor but no InteractionDriver."); } else if ((Object)(object)component6 == (Object)null && (Object)(object)component7 != (Object)null) { Log.Error("Prefab has an InteractionDriver but no Interactor."); } else if ((Object)(object)component6 == (Object)null && (Object)(object)component7 == (Object)null) { Log.Message("Prefab has no Interactor or InteractionDriver. Optional."); } CharacterDeathBehavior component8 = bodyPrefab.GetComponent(); if ((Object)(object)component8 == (Object)null) { Log.Error("Prefab has no CharacterDeathBehavior."); } else { Log.Debug("Checking CharacterDeathBehavior fields..."); if ((Object)(object)component8.deathStateMachine == (Object)null) { Log.Error("CharacterDeathBehavior.deathStateMachine is unset."); } else if (component8.deathStateMachine.customName != "Body") { Log.Error("CharacterDeathBehavior.deathStateMachine is not the Body EntityStateMachine."); } if (string.IsNullOrWhiteSpace(((SerializableEntityStateType)(ref component8.deathState)).typeName)) { Log.Warning("CharacterDeathBehavior.deathState is unset. Set in code."); } EntityStateMachine[] idleStateMachine = component8.idleStateMachine; if (idleStateMachine == null || idleStateMachine.Length == 0) { if (flag) { Log.Warning("CharacterDeathBehavior.idleStateMachine is empty. Non-Body EntityStateMachines will keep operating after death."); } } else { EntityStateMachine[] array3 = idleStateMachine; foreach (EntityStateMachine val3 in array3) { if ((Object)(object)val3 == (Object)null) { Log.Error("CharacterDeathBehavior.idleStateMachine contains a null entry."); } else if (val3.customName == "Body") { Log.Error("CharacterDeathBehavior.idleStateMachine contains the Body EntityStateMachine."); } } } } SetStateOnHurt component9 = bodyPrefab.GetComponent(); if ((Object)(object)component9 == (Object)null) { Log.Warning("Prefab has no SetStateOnHurt. Required if this enemy needs to be stunned or frozen."); } else { Log.Debug("Checking SetStateOnHurt fields..."); if ((Object)(object)component9.targetStateMachine == (Object)null) { Log.Error("SetStateOnHurt.targetStateMachine is unset."); } else if (component9.targetStateMachine.customName != "Body") { Log.Error("SetStateOnHurt.targetStateMachine is not the Body EntityStateMachine."); } if (string.IsNullOrWhiteSpace(((SerializableEntityStateType)(ref component9.hurtState)).typeName)) { Log.Warning("SetStateOnHurt.hurtState is unset. Set in code."); } EntityStateMachine[] idleStateMachine2 = component9.idleStateMachine; if (idleStateMachine2 == null || idleStateMachine2.Length == 0) { if (flag) { Log.Warning("SetStateOnHurt.idleStateMachine is empty. Non-Body EntityStateMachines will not be set to idle when stunned."); } } else { EntityStateMachine[] array4 = components; foreach (EntityStateMachine val4 in array4) { if (!((Object)(object)val4 == (Object)null) && !(val4.customName == "Body") && !idleStateMachine2.Contains(val4)) { Log.Warning("SetStateOnHurt.idleStateMachine does not contain '" + val4.customName + "'."); } } } } DeathRewards component10 = bodyPrefab.GetComponent(); if ((Object)(object)component10 == (Object)null) { Log.Warning("Prefab has no DeathRewards. Enemy will yield no gold or XP on death."); } else { Log.Debug("Checking DeathRewards fields..."); if ((Object)(object)component10.logUnlockableDef == (Object)null) { Log.Warning("DeathRewards.logUnlockableDef is unset. Enemy will not drop a logbook."); } if ((Object)(object)component != (Object)null && component.isChampion && (Object)(object)component10.bossDropTable == (Object)null) { Log.Warning("CharacterBody.isChampion is true but DeathRewards.bossDropTable is unset. Enemy will not drop a boss item."); } } CharacterMotor component11 = bodyPrefab.GetComponent(); CharacterDirection component12 = bodyPrefab.GetComponent(); KinematicCharacterMotor component13 = bodyPrefab.GetComponent(); Rigidbody component14 = bodyPrefab.GetComponent(); PseudoCharacterMotor component15 = bodyPrefab.GetComponent(); RigidbodyMotor component16 = bodyPrefab.GetComponent(); RigidbodyDirection component17 = bodyPrefab.GetComponent(); if ((Object)(object)component11 != (Object)null && (Object)(object)component12 == (Object)null) { Log.Error("Prefab has a CharacterMotor but no CharacterDirection."); } else if ((Object)(object)component11 == (Object)null && (Object)(object)component12 != (Object)null) { Log.Error("Prefab has a CharacterDirection but no CharacterMotor."); } if ((Object)(object)component11 != (Object)null) { Log.Debug("Checking CharacterMotor fields..."); if ((Object)(object)component11.characterDirection == (Object)null) { Log.Message("CharacterMotor.characterDirection is unset. Not used by the base game, but may be referenced by mods."); } if (component11.mass < 0f) { Log.Error($"CharacterMotor.mass is negative ({component11.mass})."); } if (component11.airControl < 0f) { Log.Error($"CharacterMotor.airControl is negative ({component11.airControl})."); } } if ((Object)(object)component12 != (Object)null) { Log.Debug("Checking CharacterDirection fields..."); if ((Object)(object)component12.targetTransform == (Object)null) { Log.Error("CharacterDirection.targetTransform is unset."); } if (component12.turnSpeed < 0f) { Log.Error($"CharacterDirection.turnSpeed is negative ({component12.turnSpeed})."); } else if (component12.turnSpeed == 0f) { Log.Warning("CharacterDirection.turnSpeed is zero."); } if ((Object)(object)component12.modelAnimator == (Object)null) { Log.Message("CharacterDirection.modelAnimator is unset. Auto-resolved in CharacterDirection.Start()."); } } if ((Object)(object)component13 != (Object)null) { if ((Object)(object)component14 == (Object)null) { Log.Error("Prefab has a KinematicCharacterMotor but no Rigidbody."); } if ((Object)(object)component13.Capsule == (Object)null) { Log.Error("KinematicCharacterMotor.Capsule is unset."); } } if ((Object)(object)component14 != (Object)null) { Log.Debug("Checking Rigidbody fields..."); if (component14.mass < 0f) { Log.Error($"Rigidbody.mass is negative ({component14.mass})."); } if (component14.drag < 0f) { Log.Error($"Rigidbody.drag is negative ({component14.drag})."); } if (component14.angularDrag < 0f) { Log.Error($"Rigidbody.angularDrag is negative ({component14.angularDrag})."); } if (component14.isKinematic && (Object)(object)component13 == (Object)null) { Log.Error("Rigidbody.isKinematic is true but prefab has no KinematicCharacterMotor."); } if (!component14.isKinematic && (Object)(object)component13 != (Object)null) { Log.Error("Rigidbody.isKinematic is false but prefab has a KinematicCharacterMotor."); } } if ((Object)(object)component17 != (Object)null) { Log.Debug("Checking RigidbodyDirection fields..."); if ((Object)(object)component14 == (Object)null) { Log.Error("Prefab has a RigidbodyDirection but no Rigidbody."); } if ((Object)(object)component17.rigid == (Object)null) { Log.Error("RigidbodyDirection.rigid is unset."); } if ((Object)(object)component17.angularVelocityPID == (Object)null) { Log.Error("RigidbodyDirection.angularVelocityPID is unset."); } if ((Object)(object)component17.torquePID == (Object)null) { Log.Error("RigidbodyDirection.torquePID is unset."); } } if ((Object)(object)component16 != (Object)null) { Log.Debug("Checking RigidbodyMotor fields..."); if ((Object)(object)component16.rigid == (Object)null) { Log.Error("RigidbodyMotor.rigid is unset."); } if ((Object)(object)component16.forcePID == (Object)null) { Log.Error("RigidbodyMotor.forcePID is unset."); } } QuaternionPID[] components2 = bodyPrefab.GetComponents(); VectorPID[] components3 = bodyPrefab.GetComponents(); if ((Object)(object)component17 != (Object)null) { if (components2.Length == 0) { Log.Error("Prefab has a RigidbodyDirection but no QuaternionPID."); } else if (components2.Length > 1) { Log.Warning($"Prefab has {components2.Length} QuaternionPIDs. Only one is required (named 'Angular Velocity PID')."); } else if (components2[0].customName != "Angular Velocity PID") { Log.Warning("QuaternionPID.customName is not 'Angular Velocity PID'. Rename for consistency."); } } else if (components2.Length != 0) { Log.Warning("Prefab has QuaternionPIDs but no RigidbodyDirection to use them."); } if ((Object)(object)component16 != (Object)null) { if (components3.Length == 0) { Log.Error("Prefab has a RigidbodyMotor but no VectorPIDs."); } else if (components3.Length != 2) { Log.Error($"RigidbodyMotor expects 2 VectorPIDs (Force PID + torquePID), found {components3.Length}."); } else { VectorPID val5 = ((IEnumerable)components3).FirstOrDefault((Func)((VectorPID pid) => pid.customName == "Force PID")); if ((Object)(object)val5 == (Object)null) { Log.Warning("Could not find a VectorPID with customName 'Force PID'."); } else if (val5.isAngle) { Log.Warning("Force PID has isAngle set. This may result in unexpected behaviour."); } VectorPID val6 = ((IEnumerable)components3).FirstOrDefault((Func)((VectorPID pid) => pid.customName == "torquePID")); if ((Object)(object)val6 == (Object)null) { Log.Warning("Could not find a VectorPID with customName 'torquePID'."); } else if (!val6.isAngle) { Log.Warning("Torque PID has isAngle unset. This may result in unexpected behaviour."); } } } else if (components3.Length != 0) { Log.Warning("Prefab has VectorPIDs but no RigidbodyMotor to use them."); } int num = (((Object)(object)component11 != (Object)null) ? 1 : 0) + (((Object)(object)component16 != (Object)null) ? 1 : 0) + (((Object)(object)component15 != (Object)null) ? 1 : 0); if (num == 0) { Log.Error("Prefab has no motor (CharacterMotor, RigidbodyMotor, or PseudoCharacterMotor)."); } else if (num > 1) { Log.Error("Prefab has more than one motor - these will conflict with each other."); } if ((Object)(object)bodyPrefab.GetComponent() == (Object)null && (Object)(object)bodyPrefab.GetComponent() == (Object)null && (Object)(object)bodyPrefab.GetComponent() == (Object)null) { Log.Warning("Prefab has no collider - enemy will not have body collision."); } if ((Object)(object)component3 != (Object)null && (Object)(object)component3.modelTransform != (Object)null) { ValidateModel(((Component)component3.modelTransform).gameObject); } } private static void ValidateModel(GameObject model) { //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_014d: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) Log.Debug("Validating model: " + ((Object)model).name); Animator component = model.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("Model has no Animator."); } else { Log.Debug("Checking Animator fields..."); if ((Object)(object)component.runtimeAnimatorController == (Object)null) { Log.Warning("Animator.runtimeAnimatorController is unset. Only valid if a ModelSkinController provides one via address."); } if ((Object)(object)component.avatar == (Object)null) { Log.Warning("Animator.avatar is unset. Only valid if a ModelSkinController provides one via address."); } if (component.applyRootMotion) { Log.Warning("Animator.applyRootMotion is enabled. Ensure this is intentional."); } } ChildLocator component2 = model.GetComponent(); if ((Object)(object)component2 == (Object)null) { Log.Warning("Model has no ChildLocator. Finding bones at runtime will be more of a pain in the ass"); } else { Log.Debug("Checking ChildLocator fields..."); if (component2.transformPairs == null || component2.transformPairs.Length == 0) { Log.Error("ChildLocator.transformPairs is empty."); } else { NameTransformPair[] transformPairs = component2.transformPairs; foreach (NameTransformPair val in transformPairs) { if (string.IsNullOrWhiteSpace(val.name)) { Log.Error("ChildLocator entry has an unset name."); } if ((Object)(object)val.transform == (Object)null) { Log.Error("ChildLocator entry '" + val.name + "' has a null transform."); } } } } CharacterModel component3 = model.GetComponent(); if ((Object)(object)component3 == (Object)null) { Log.Error("Model has no CharacterModel."); } else { Log.Debug("Checking CharacterModel fields..."); if ((Object)(object)component3.body == (Object)null) { Log.Error("CharacterModel.body is unset."); } if ((Object)(object)component3.itemDisplayRuleSet == (Object)null) { Log.Warning("CharacterModel.itemDisplayRuleSet is unset. All items (including elite horns) will not display."); } if (component3.baseRendererInfos == null || component3.baseRendererInfos.Length == 0) { Log.Warning("CharacterModel.baseRendererInfos is empty. Only valid if a ModelSkinController provides renderers via SkinDefs."); } else { for (int j = 0; j < component3.baseRendererInfos.Length; j++) { RendererInfo val2 = component3.baseRendererInfos[j]; if ((Object)(object)val2.renderer == (Object)null) { Log.Error($"CharacterModel.baseRendererInfos[{j}].renderer is unset."); } if ((Object)(object)val2.defaultMaterial == (Object)null) { Log.Error($"CharacterModel.baseRendererInfos[{j}].defaultMaterial is unset."); } } } } AimAnimator component4 = model.GetComponent(); if ((Object)(object)component4 == (Object)null) { Log.Warning("Model has no AimAnimator. Aim animations will not trigger."); } else { Log.Debug("Checking AimAnimator fields..."); if ((Object)(object)component4.inputBank == (Object)null) { Log.Error("AimAnimator.inputBank is unset."); } if ((Object)(object)component4.directionComponent == (Object)null) { Log.Warning("AimAnimator.directionComponent is unset. Direction will fall back to base.transform.eulerAngles."); } } HurtBoxGroup component5 = model.GetComponent(); if ((Object)(object)component5 == (Object)null) { Log.Error("Model has no HurtBoxGroup."); } else { Log.Debug("Checking HurtBoxGroup fields..."); if ((Object)(object)component5.mainHurtBox == (Object)null) { Log.Error("HurtBoxGroup.mainHurtBox is unset."); } if (component5.hurtBoxes == null || component5.hurtBoxes.Length == 0) { Log.Error("HurtBoxGroup.hurtBoxes is empty."); } } HurtBox[] componentsInChildren = model.GetComponentsInChildren(); if (componentsInChildren == null || componentsInChildren.Length == 0) { Log.Error("Model has no HurtBoxes."); return; } bool flag = false; bool flag2 = false; bool flag3 = (Object)(object)component5 != (Object)null && component5.hurtBoxes != null && component5.hurtBoxes.Length != 0; HurtBox[] array = componentsInChildren; foreach (HurtBox val3 in array) { if (!((Object)(object)val3 == (Object)null)) { string name = ((Object)val3).name; if ((Object)(object)((Component)val3).GetComponent() == (Object)null && (Object)(object)((Component)val3).GetComponent() == (Object)null && (Object)(object)((Component)val3).GetComponent() == (Object)null) { Log.Error("HurtBox '" + name + "' has no Capsule, Box, or Sphere collider."); } if ((Object)(object)val3.healthComponent == (Object)null) { Log.Error("HurtBox '" + name + "' has no HealthComponent."); } if (((Component)val3).gameObject.layer != LayerIndex.entityPrecise.intVal) { Log.Warning("HurtBox '" + name + "' is not on the entityPrecise layer."); } if (flag3 && !component5.hurtBoxes.Contains(val3)) { Log.Warning("HurtBox '" + name + "' is not in the HurtBoxGroup."); } if (val3.isBullseye) { flag = true; } if (val3.isSniperTarget) { flag2 = true; } } } if (!flag) { Log.Warning("No HurtBox has isBullseye set. Characters that rely on this like Huntress and Operator will struggle to target this enemy."); } if (!flag2) { Log.Warning("No HurtBox has isSniperTarget set. Characters that rely on this like Railgunner will not be able to hit weak spots on this enemy."); } } public static void ValidateMasterPrefab(GameObject masterPrefab, GameObject bodyPrefab) { if ((Object)(object)masterPrefab == (Object)null) { Log.Error("Cannot validate master prefab: prefab is null."); return; } Log.Debug("Validating master prefab: " + ((Object)masterPrefab).name); if ((Object)(object)masterPrefab.GetComponent() == (Object)null) { Log.Error("Master prefab has no NetworkIdentity."); } if ((Object)(object)masterPrefab.GetComponent() == (Object)null) { Log.Error("Master prefab has no Inventory."); } if ((Object)(object)masterPrefab.GetComponent() == (Object)null) { Log.Error("Master prefab has no MinionOwnership."); } CharacterMaster component = masterPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("Master prefab has no CharacterMaster."); } else if ((Object)(object)component.bodyPrefab != (Object)(object)bodyPrefab) { Log.Error("CharacterMaster.bodyPrefab does not match the provided body prefab."); } BaseAI component2 = masterPrefab.GetComponent(); if ((Object)(object)component2 == (Object)null) { Log.Error("Master prefab has no BaseAI."); } else { Log.Debug("Checking BaseAI fields..."); if ((Object)(object)component2.stateMachine == (Object)null) { Log.Error("BaseAI.stateMachine is unset."); } if (string.IsNullOrWhiteSpace(((SerializableEntityStateType)(ref component2.scanState)).typeName)) { Log.Warning("BaseAI.scanState is unset. Set in code."); } } EntityStateMachine[] components = masterPrefab.GetComponents(); if (components.Length == 0) { Log.Error("Master prefab has no EntityStateMachines."); } else if (components.Length > 1) { Log.Error($"Master prefab has {components.Length} EntityStateMachines. Only one is required (named 'AI')."); } else { EntityStateMachine val = ((IEnumerable)components).FirstOrDefault((Func)((EntityStateMachine esm) => (Object)(object)esm != (Object)null && esm.customName == "AI")); if ((Object)(object)val == (Object)null) { Log.Error("Master prefab has no EntityStateMachine with customName 'AI'."); } else { if (string.IsNullOrWhiteSpace(((SerializableEntityStateType)(ref val.initialStateType)).typeName)) { Log.Warning("AI EntityStateMachine has no initialStateType. Set in code."); } if (string.IsNullOrWhiteSpace(((SerializableEntityStateType)(ref val.mainStateType)).typeName)) { Log.Warning("AI EntityStateMachine has no mainStateType. Set in code."); } } } AISkillDriver[] components2 = masterPrefab.GetComponents(); if (components2.Length == 0) { Log.Warning("Master prefab has no AISkillDrivers. Verify these are added in code."); } } public static void ValidateCharacterSpawnCard(CharacterSpawnCard csc, GameObject masterPrefab, GameObject bodyPrefab) { //IL_0110: 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_00b6: 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_00dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)csc == (Object)null) { Log.Error("Cannot validate CharacterSpawnCard as card is null!"); return; } Log.Debug("Validating CharacterSpawnCard: " + ((Object)csc).name); if ((Object)(object)((SpawnCard)csc).prefab == (Object)null) { Log.Error("CharacterSpawnCard.prefab is unset."); } else if ((Object)(object)((SpawnCard)csc).prefab == (Object)(object)bodyPrefab) { Log.Error("CharacterSpawnCard.prefab points at the body prefab. Should point instead at the master prefab."); } else if ((Object)(object)((SpawnCard)csc).prefab != (Object)(object)masterPrefab) { Log.Error("CharacterSpawnCard.prefab does not match the provided master prefab."); } if ((Object)(object)bodyPrefab != (Object)null) { CharacterBody component = bodyPrefab.GetComponent(); if ((Object)(object)component != (Object)null && component.hullClassification != ((SpawnCard)csc).hullSize) { Log.Warning($"Hull mismatch: body is {component.hullClassification}, spawn card is {((SpawnCard)csc).hullSize}."); } } if (!((SpawnCard)csc).sendOverNetwork) { Log.Error("CharacterSpawnCard.sendOverNetwork is false. Must be true for multiplayer."); } if (!((Enum)((SpawnCard)csc).forbiddenFlags).HasFlag((Enum)(object)(NodeFlags)4)) { Log.Warning("CharacterSpawnCard.forbiddenFlags does not include NoCharacterSpawn. Enemy may spawn in unintended locations."); } if (((SpawnCard)csc).directorCreditCost < 0) { Log.Error($"CharacterSpawnCard.directorCreditCost is negative ({((SpawnCard)csc).directorCreditCost})."); } else if (((SpawnCard)csc).directorCreditCost == 0) { Log.Warning("CharacterSpawnCard.directorCreditCost is zero. This will spawn stupid numbers of this enemy if put into a Combat Director."); } } } public class SetupModule : MonoBehaviour { protected class SkillDefData { public string objectName; public string skillName; public string esmName; public SerializableEntityStateType activationState; public float cooldown; public int baseMaxStock = 1; public int rechargeStock = 1; public int requiredStock = 1; public int stockToConsume = 1; public InterruptPriority intPrio = (InterruptPriority)0; public bool resetCdOnUse = false; public bool cdOnEnd = false; public bool cdBlocked = false; public bool combatSkill = true; } protected class AISkillDriverData { public GameObject masterPrefab; public string customName; public SkillSlot skillSlot; public float minDistance = 0f; public float maxDistance = float.PositiveInfinity; public int desiredIndex = 0; public float moveInputScale = 1f; public MovementType movementType; public AimType aimType; public TargetType targetType; public bool ignoreNodeGraph = false; public float maxHealthFraction = float.PositiveInfinity; public float minHealthFraction = float.NegativeInfinity; public float maxTargetHealthFraction = float.PositiveInfinity; public float minTargetHealthFraction = float.NegativeInfinity; public bool requireReady = false; public SkillDef requiredSkillDef = null; public bool activationRequiresAimTargetLoS = false; public bool activationRequiresAimConfirmation = false; public bool activationRequiresTargetLoS = false; public bool selectionRequiresAimTarget = false; public bool selectionRequiresOnGround = false; public bool selectionRequiresTargetLoS = false; public bool selectionRequiresTargetNonFlier = false; public int maxTimesSelected = -1; public float driverUpdateTimerOverride = -1f; public bool noRepeat = false; public AISkillDriver nextHighPriorityOverride = null; public bool shouldSprint = false; public float aimVectorMaxSpeedOverride = -1f; public ButtonPressType buttonPressType = (ButtonPressType)0; } protected class HornDisplayInfo { public GameObject followerPrefab; public Vector3 localPos = Vector3.zero; public Vector3 localAngles = Vector3.zero; public Vector3 localScale = Vector3.one; } private string _section; internal ConfigEntry baseMaxHealthCfg; internal ConfigEntry baseDamageCfg; internal ConfigEntry baseMoveSpeedCfg; internal ConfigEntry baseAccelerationCfg; internal ConfigEntry baseArmorCfg; internal ConfigEntry costCfg; protected GameObject cachedBodyPrefab; protected List cachedSpawnCards; protected ConfigFile config => ((BaseUnityPlugin)BootlegBestiary.Instance).Config; protected string Section { get { if (_section == null) { _section = ((object)this).GetType().GetCustomAttribute()?.Section ?? ((object)this).GetType().Name; } return _section; } } protected void BindStats(GameObject prefab, List spawnCards = null) { cachedBodyPrefab = prefab; cachedSpawnCards = spawnCards; CharacterBody component = prefab.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("BodyPrefab has no CharacterBody!"); return; } string @string = Language.GetString(component.baseNameToken); baseMaxHealthCfg = BindFloat("Base Max Health", component.baseMaxHealth, $"Base Max Health of this enemy.\nDefault is {component.baseMaxHealth}", component.baseMaxHealth / 5f, component.baseMaxHealth * 5f, 1f); baseDamageCfg = BindFloat("Base Damage", component.baseDamage, $"Base Damage of this enemy.\nDefault is {component.baseDamage}.", component.baseDamage / 5f, component.baseDamage * 5f); if (component.baseMoveSpeed > 0f) { baseMoveSpeedCfg = BindFloat("Base Move Speed", component.baseMoveSpeed, $"Base Move Speed of this enemy.\nDefault is {component.baseMoveSpeed}.a", component.baseMoveSpeed / 5f, component.baseMoveSpeed * 5f); } if (component.baseAcceleration > 0f) { baseAccelerationCfg = BindFloat("Base Acceleration", component.baseAcceleration, $"Base Acceleration of this enemy.\nDefault is {component.baseAcceleration}.", component.baseAcceleration / 5f, component.baseAcceleration * 5f); } baseArmorCfg = BindFloat("Base Armor", component.baseArmor, $"Base Armor of this enemy.\nDefault is {component.baseArmor}.", 0f, Mathf.Max(100f, component.baseArmor), 1f); if (spawnCards != null) { costCfg = BindFloat("Director Cost", ((SpawnCard)spawnCards[0]).directorCreditCost, $"The amount of credits required for the director to spawn this enemy.\nDefault is {((SpawnCard)spawnCards[0]).directorCreditCost}.", (float)((SpawnCard)spawnCards[0]).directorCreditCost / 5f, (float)((SpawnCard)spawnCards[0]).directorCreditCost * 5f, 1f); } } protected void ApplyStats() { if ((Object)(object)cachedBodyPrefab == (Object)null) { Log.Error("CachedBodyPrefab is null! BindStats has to have been run already before ApplyStats is called!!!"); return; } CharacterBody component = cachedBodyPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { return; } string @string = Language.GetString(component.baseNameToken); component.baseMaxHealth = baseMaxHealthCfg.Value; component.levelMaxHealth = baseMaxHealthCfg.Value * 0.3f; component.baseDamage = baseDamageCfg.Value; component.levelDamage = baseDamageCfg.Value * 0.2f; if (baseMoveSpeedCfg != null) { component.baseMoveSpeed = baseMoveSpeedCfg.Value; } if (baseAccelerationCfg != null) { component.baseAcceleration = baseAccelerationCfg.Value; } if (baseArmorCfg != null) { component.baseArmor = baseArmorCfg.Value; } if (cachedSpawnCards != null && costCfg != null) { for (int i = 0; i < cachedSpawnCards.Count; i++) { CharacterSpawnCard val = cachedSpawnCards[i]; ((SpawnCard)val).directorCreditCost = (int)costCfg.Value; } } } public virtual void Awake() { RegisterConfig(); if (IsModuleEnabled()) { Initialise(); } } private bool IsModuleEnabled() { if (BootlegBestiary.Instance.mainModuleConfigEntries.TryGetValue(((object)this).GetType(), out var value)) { return value.Value; } return false; } protected ConfigEntry BindFloat(string name, float defaultValue, string desc, float min, float max, float step = 0.1f, PluginConfig.FormatType format = PluginConfig.FormatType.None) { return config.BindOptionSteppedSlider(Section, name, defaultValue, step, desc, min, max, restartRequired: true, format); } protected ConfigEntry BindBool(string name, bool defaultValue, string desc) { return config.BindOption(Section, name, defaultValue, desc, restartRequired: true); } public virtual void RegisterConfig() { } public virtual void Initialise() { ApplyStats(); } protected T CreateSkillDef(SkillDefData data) where T : SkillDef { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) T val = ScriptableObject.CreateInstance(); ((Object)(object)val).name = data.objectName; ((SkillDef)val).skillName = data.skillName; ((SkillDef)val).activationStateMachineName = data.esmName; ((SkillDef)val).activationState = data.activationState; ((SkillDef)val).baseRechargeInterval = data.cooldown; ((SkillDef)val).baseMaxStock = data.baseMaxStock; ((SkillDef)val).rechargeStock = data.rechargeStock; ((SkillDef)val).requiredStock = data.requiredStock; ((SkillDef)val).stockToConsume = data.stockToConsume; ((SkillDef)val).interruptPriority = data.intPrio; ((SkillDef)val).resetCooldownTimerOnUse = data.resetCdOnUse; ((SkillDef)val).beginSkillCooldownOnSkillEnd = data.cdOnEnd; ((SkillDef)val).isCooldownBlockedUntilManuallyReset = data.cdBlocked; ((SkillDef)val).isCombatSkill = data.combatSkill; ContentAddition.AddSkillDef((SkillDef)(object)val); return val; } protected GenericSkill CreateGenericSkill(GameObject bodyPrefab, SkillDef skillDef, string familyName, SkillSlot slot) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0059: 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_005d: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected I4, but got Unknown SkillFamily val = ScriptableObject.CreateInstance(); ((Object)val).name = familyName; val.variants = (Variant[])(object)new Variant[1] { new Variant { skillDef = skillDef } }; string skillName = skillDef.skillName; GenericSkill val2 = bodyPrefab.AddComponent(); val2.skillName = skillName; val2._skillFamily = val; SkillLocator component = bodyPrefab.GetComponent(); switch (slot - -1) { case 0: Log.Error("SkillSlot.None detected in AddGenericSkill!"); break; case 1: component.primary = val2; break; case 2: component.secondary = val2; break; case 3: component.utility = val2; break; case 4: component.special = val2; break; } ContentAddition.AddSkillFamily(val); return val2; } protected EntityStateMachine CreateEntityStateMachine(GameObject bodyPrefab, string name, Type initialState = null, Type mainState = null) { //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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = bodyPrefab.AddComponent(); val.customName = name; val.initialStateType = new SerializableEntityStateType(initialState ?? typeof(Idle)); val.mainStateType = new SerializableEntityStateType(mainState ?? typeof(Idle)); return val; } protected AISkillDriver CreateAISkillDriver(AISkillDriverData data) { //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_0074: 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_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) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) if (data == null || (Object)(object)data.masterPrefab == (Object)null) { Log.Error("Could not create AISkillDriver"); return null; } AISkillDriver val = data.masterPrefab.AddComponent(); val.customName = data.customName; val.skillSlot = data.skillSlot; val.minDistance = data.minDistance; val.maxDistance = data.maxDistance; val.moveInputScale = data.moveInputScale; val.movementType = data.movementType; val.aimType = data.aimType; val.moveTargetType = data.targetType; val.ignoreNodeGraph = data.ignoreNodeGraph; val.maxUserHealthFraction = data.maxHealthFraction; val.minUserHealthFraction = data.minHealthFraction; val.maxTargetHealthFraction = data.maxTargetHealthFraction; val.minTargetHealthFraction = data.minTargetHealthFraction; val.requireSkillReady = data.requireReady; val.requiredSkill = data.requiredSkillDef; val.activationRequiresAimConfirmation = data.activationRequiresAimConfirmation; val.activationRequiresAimTargetLoS = data.activationRequiresAimTargetLoS; val.activationRequiresTargetLoS = data.activationRequiresTargetLoS; val.selectionRequiresAimTarget = data.selectionRequiresAimTarget; val.selectionRequiresOnGround = data.selectionRequiresOnGround; val.selectionRequiresTargetLoS = data.selectionRequiresTargetLoS; val.selectionRequiresTargetNonFlier = data.selectionRequiresTargetNonFlier; val.maxTimesSelected = data.maxTimesSelected; val.driverUpdateTimerOverride = data.driverUpdateTimerOverride; val.noRepeat = data.noRepeat; val.nextHighPriorityOverride = data.nextHighPriorityOverride; val.shouldSprint = data.shouldSprint; val.aimVectorMaxSpeedOverride = data.aimVectorMaxSpeedOverride; val.buttonPressType = data.buttonPressType; data.masterPrefab.ReorderSkillDrivers(val, data.desiredIndex); return val; } protected void RegisterLooseEntityStates(List entityStateTypes) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); foreach (Type entityStateType in entityStateTypes) { ContentAddition.AddEntityState(entityStateType, ref flag); if (!flag) { Log.Error("Failed to add EntityState " + entityStateType.Name + "!"); } } } protected void AddNameToken(GameObject bodyPrefab, string name) { if ((Object)(object)bodyPrefab == (Object)null) { return; } CharacterBody component = bodyPrefab.GetComponent(); if (!((Object)(object)component == (Object)null)) { string baseNameToken = component.baseNameToken; if (Language.GetString(baseNameToken) == baseNameToken) { LanguageAPI.Add(baseNameToken, name); } else { Log.Error("Could not add token " + baseNameToken + " as it is already present."); } } } protected void AddLoreToken(GameObject bodyPrefab, string lore) { if ((Object)(object)bodyPrefab == (Object)null) { return; } CharacterBody component = bodyPrefab.GetComponent(); if (!((Object)(object)component == (Object)null)) { string baseNameToken = component.baseNameToken; string text = component.baseNameToken.Replace("_NAME", "_LORE"); if (!text.EndsWith("_LORE")) { Log.Error("NameToken does not end with _NAME, unable to create matching Lore Token!"); } else { LanguageAPI.Add(text, lore); } } } protected void HurtBoxLayersToEntityPrecise(GameObject bodyPrefab) { if ((Object)(object)bodyPrefab == (Object)null) { return; } HurtBox[] componentsInChildren = bodyPrefab.GetComponentsInChildren(); if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } HurtBox[] array = componentsInChildren; foreach (HurtBox val in array) { if (!((Object)(object)val == (Object)null)) { ((Component)val).gameObject.layer = LayerIndex.entityPrecise.intVal; } } } protected void ConfigureESM(GameObject bodyPrefab, string esmName, Type mainStateType = null, bool registerMainStateType = true, Type initialStateType = null, bool registerInitialStateType = true) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bodyPrefab == (Object)null) { return; } EntityStateMachine val = (from esm in bodyPrefab.GetComponents() where esm.customName == esmName select esm).FirstOrDefault(); if (!((Object)(object)val == (Object)null)) { bool flag = default(bool); if (mainStateType != null) { val.mainStateType = (SerializableEntityStateType)(registerMainStateType ? ContentAddition.AddEntityState(mainStateType, ref flag) : new SerializableEntityStateType(mainStateType)); } if (initialStateType != null) { val.initialStateType = (SerializableEntityStateType)(registerInitialStateType ? ContentAddition.AddEntityState(initialStateType, ref flag) : new SerializableEntityStateType(initialStateType)); } } } protected void SetDeathState(GameObject bodyPrefab, Type deathStateType, bool register = true) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) if (!((Object)(object)bodyPrefab == (Object)null) && !(deathStateType == null)) { CharacterDeathBehavior component = bodyPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error($"{bodyPrefab} does not have DeathBehaviour!"); } else { bool flag = default(bool); component.deathState = (SerializableEntityStateType)(register ? ContentAddition.AddEntityState(deathStateType, ref flag) : new SerializableEntityStateType(deathStateType)); } } } protected void AddCardToDCCS(CharacterSpawnCard csc, DirectorCardCategorySelection dccs, MonsterCategory monsterCategory, int weight = 1, MonsterSpawnDistance spawnDistance = 0, int minStageCompletions = 0) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0030: 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_0040: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown if (!((Object)(object)csc == (Object)null) && !((Object)(object)dccs == (Object)null)) { DirectorCard card = new DirectorCard { spawnCard = (SpawnCard)(object)csc, selectionWeight = weight, spawnDistance = spawnDistance, minimumStageCompletions = minStageCompletions }; DirectorCardHolder val = new DirectorCardHolder { Card = card, MonsterCategory = monsterCategory, MonsterCategorySelectionWeight = 1f }; DirectorAPI.AddCard(dccs, val); } } protected void SetupLogbookEntry(GameObject bodyPrefab, string cachedName, string unlockableNameToken, string enemyName) { if ((Object)(object)bodyPrefab == (Object)null) { Log.Error("SetupLogbookEntry failed! BodyPrefab is null!"); return; } if (Language.GetString(unlockableNameToken) != unlockableNameToken) { Log.Error("SetupLogbookEntry failed! UnlockableNameToken is already in use!"); return; } CharacterBody component = bodyPrefab.GetComponent(); if ((Object)(object)component == (Object)null) { Log.Error("SetupLogbookEntry failed! Provided BodyPrefab has no CharacterBody!"); return; } DeathRewards component2 = bodyPrefab.GetComponent(); if ((Object)(object)component2 == (Object)null) { Log.Error("SetupLogbookEntry failed! Provided BodyPrefab has no DeathRewards!"); return; } UnlockableDef val = ScriptableObject.CreateInstance(); val.cachedName = cachedName; val.displayModelPrefab = bodyPrefab; val.nameToken = unlockableNameToken; ContentAddition.AddUnlockableDef(val); LanguageAPI.Add(unlockableNameToken, "Monster Log: " + enemyName); component2.logUnlockableDef = val; Log.Debug("unlockableDef set up...?"); } protected void SetUpAllEliteAffixes(ItemDisplayRuleSet idrs) { SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteFire, new HornDisplayInfo[2] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixFire }, new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixFire } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteLightning, new HornDisplayInfo[2] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixLightning }, new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixLightning } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteIce, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixIce } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteEarth, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixEarth } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteAurelionite, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixAurelionite } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteVoid, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixVoid } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDElitePoison, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixPoison } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteHaunted, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixHaunted } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteBead, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixBead } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteCollective, new HornDisplayInfo[3] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixCollective }, new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixCollective }, new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixCollectiveRing } }); SetUpEliteAffix(idrs, (Object)(object)VanillaAssets.EDEliteLunar, new HornDisplayInfo[1] { new HornDisplayInfo { followerPrefab = VanillaAssets.DisplayAffixLunar } }); } protected void SetUpEliteAffix(ItemDisplayRuleSet idrs, Object keyAsset, HornDisplayInfo[] displayInfos) { //IL_0035: 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_0060: 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_0089: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)idrs == (Object)null || keyAsset == (Object)null || displayInfos == null || displayInfos.Length == 0) { Log.Error("SetupMultiHorn failed!"); return; } DisplayRuleGroup val = default(DisplayRuleGroup); foreach (HornDisplayInfo hornDisplayInfo in displayInfos) { if (!((Object)(object)hornDisplayInfo.followerPrefab == (Object)null)) { ItemDisplayRule val2 = default(ItemDisplayRule); val2.childName = "Head"; val2.followerPrefab = hornDisplayInfo.followerPrefab; val2.localPos = hornDisplayInfo.localPos; val2.localAngles = hornDisplayInfo.localAngles; val2.localScale = hornDisplayInfo.localScale; ItemDisplayRule val3 = val2; ((DisplayRuleGroup)(ref val)).AddDisplayRule(val3); } } idrs.SetDisplayRuleGroup(keyAsset, val); } } } namespace BootlegBestiary.Shared.Assets { internal static class CustomAssets { private static AssetBundle assetBundle; public static GameObject SkyDraconBodyPrefab { get; private set; } public static GameObject SkyDraconMasterPrefab { get; private set; } public static CharacterSpawnCard SkyDraconSpawnCard { get; private set; } public static ItemDisplayRuleSet SkyDraconItemDisplayRuleset { get; private set; } public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Shader shader = Addressables.LoadAssetAsync((object)RoR2_Base_Shaders.HGStandard_shader).WaitForCompletion(); assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)BootlegBestiary.Instance).Info.Location), "bootlegbestiary")); if ((Object)(object)assetBundle == (Object)null) { Log.Error("Failed to load AssetBundle!"); return; } Material[] array = assetBundle.LoadAllAssets(); foreach (Material val in array) { val.shader = shader; } SkyDraconBodyPrefab = Load("SkyDraconBody"); SkyDraconMasterPrefab = Load("SkyDraconMaster"); SkyDraconSpawnCard = Load("cscSkyDracon"); SkyDraconItemDisplayRuleset = Load("idrsSkyDracon"); } private static T Load(string path) where T : Object { T val = assetBundle.LoadAsset(path); if ((Object)(object)val == (Object)null) { Log.Error("Asset under path " + path + " could not be found!"); } return val; } } internal static class VanillaAssets { public static GameObject BeetleGuardSlamEffect { get; private set; } public static GameObject MiniMushrumPlantEffect { get; private set; } public static GameObject BellPartsImpactEffect { get; private set; } public static GameObject OmniExplosionEffect { get; private set; } public static GameObject LemBruiserFlamebreathChargeEffect { get; private set; } public static GameObject GroundOnlyTargetIndicator { get; private set; } public static GameObject LemBruiserFlamebreathEffect { get; private set; } public static DirectorCardCategorySelection DccsRoost { get; private set; } public static DirectorCardCategorySelection DccsAphelian { get; private set; } public static DirectorCardCategorySelection DccsAqueduct { get; private set; } public static DirectorCardCategorySelection DccsAcres { get; private set; } public static DirectorCardCategorySelection DccsAlluvium { get; private set; } public static DirectorCardCategorySelection DccsAbyssal { get; private set; } public static DirectorCardCategorySelection DccsCrater { get; private set; } public static DirectorCardCategorySelection DccsHelminth { get; private set; } public static EquipmentDef EDEliteFire { get; private set; } public static EquipmentDef EDEliteLightning { get; private set; } public static EquipmentDef EDEliteIce { get; private set; } public static EquipmentDef EDElitePoison { get; private set; } public static EquipmentDef EDEliteHaunted { get; private set; } public static EquipmentDef EDEliteEarth { get; private set; } public static EquipmentDef EDEliteVoid { get; private set; } public static EquipmentDef EDEliteAurelionite { get; private set; } public static EquipmentDef EDEliteBead { get; private set; } public static EquipmentDef EDEliteCollective { get; private set; } public static EquipmentDef EDEliteLunar { get; private set; } public static GameObject DisplayAffixFire { get; private set; } public static GameObject DisplayAffixLightning { get; private set; } public static GameObject DisplayAffixIce { get; private set; } public static GameObject DisplayAffixPoison { get; private set; } public static GameObject DisplayAffixHaunted { get; private set; } public static GameObject DisplayAffixEarth { get; private set; } public static GameObject DisplayAffixVoid { get; private set; } public static GameObject DisplayAffixAurelionite { get; private set; } public static GameObject DisplayAffixBead { get; private set; } public static GameObject DisplayAffixCollective { get; private set; } public static GameObject DisplayAffixCollectiveRing { get; private set; } public static GameObject DisplayAffixLunar { get; private set; } public static GameObject DisplayAffixLunarFire { get; private set; } public static void Init() { BeetleGuardSlamEffect = Load(RoR2_Base_BeetleGuard.BeetleGuardGroundSlam_prefab); MiniMushrumPlantEffect = Load(RoR2_Base_MiniMushroom.MiniMushroomPlantEffect_prefab); BellPartsImpactEffect = Load(RoR2_Base_Bell.BellBodyPartsImpact_prefab); OmniExplosionEffect = Load(RoR2_Base_Common_VFX.OmniExplosionVFX_prefab); LemBruiserFlamebreathChargeEffect = Load(RoR2_Base_Lemurian.LemurianChargeFire_prefab); GroundOnlyTargetIndicator = Load(RoR2_Base_Common.TeamAreaIndicator__GroundOnly_prefab); LemBruiserFlamebreathEffect = Load(RoR2_Base_Lemurian.FlamebreathEffect_prefab); DccsRoost = Load(RoR2_Base_blackbeach.dccsBlackBeachMonsters_asset); DccsAphelian = Load(RoR2_DLC1_ancientloft.dccsAncientLoftMonstersDLC1_asset); DccsAqueduct = Load(RoR2_Base_goolake.dccsGooLakeMonsters_asset); DccsAcres = Load(RoR2_Base_wispgraveyard.dccsWispGraveyardMonsters_asset); DccsAlluvium = Load(RoR2_DLC3_ironalluvium.dccsIronalluviumMonsters_asset); DccsAbyssal = Load(RoR2_Base_dampcave.dccsDampCaveMonsters_asset); DccsCrater = Load(RoR2_DLC3_repurposedcrater.dccsRepurposedcraterMonsters_asset); DccsHelminth = Load(RoR2_DLC2_helminthroost.dccsHelminthRoostMonsters_asset); EDEliteFire = Load(RoR2_Base_EliteFire.EliteFireEquipment_asset); EDEliteLightning = Load(RoR2_Base_EliteLightning.EliteLightningEquipment_asset); EDEliteIce = Load(RoR2_Base_EliteIce.EliteIceEquipment_asset); EDElitePoison = Load(RoR2_Base_ElitePoison.ElitePoisonEquipment_asset); EDEliteHaunted = Load(RoR2_Base_EliteHaunted.EliteHauntedEquipment_asset); EDEliteEarth = Load(RoR2_DLC1_EliteEarth.EliteEarthEquipment_asset); EDEliteVoid = Load(RoR2_DLC1_EliteVoid.EliteVoidEquipment_asset); EDEliteAurelionite = Load(RoR2_DLC2_Elites_EliteAurelionite.EliteAurelioniteEquipment_asset); EDEliteBead = Load(RoR2_DLC2_Elites_EliteBead.EliteBeadEquipment_asset); EDEliteCollective = Load(RoR2_DLC3_Collective.EliteCollectiveEquipment_asset); DisplayAffixFire = Load(RoR2_Base_EliteFire.DisplayEliteHorn_prefab); DisplayAffixLightning = Load(RoR2_Base_EliteLightning.DisplayEliteRhinoHorn_prefab); DisplayAffixIce = Load(RoR2_Base_EliteIce.DisplayEliteIceCrown_prefab); DisplayAffixPoison = Load(RoR2_Base_ElitePoison.DisplayEliteUrchinCrown_prefab); DisplayAffixHaunted = Load(RoR2_Base_EliteHaunted.DisplayEliteStealthCrown_prefab); DisplayAffixEarth = Load(RoR2_DLC1_EliteEarth.DisplayEliteMendingAntlers_prefab); DisplayAffixVoid = Load(RoR2_DLC1_EliteVoid.DisplayAffixVoid_prefab); DisplayAffixAurelionite = Load(RoR2_DLC2_Elites_EliteAurelionite.DisplayEliteAurelioniteEquipment_prefab); DisplayAffixBead = Load(RoR2_DLC2_Elites_EliteBead.DisplayEliteBeadSpike_prefab); DisplayAffixCollective = Load(RoR2_DLC3_Collective.DisplayEliteCollectiveHorn_prefab); DisplayAffixCollectiveRing = Load(RoR2_DLC3_Collective.DisplayEliteCollectiveRing_prefab); DisplayAffixLunar = Load(RoR2_Base_EliteLunar.DisplayEliteLunar_Eye_prefab); DisplayAffixLunarFire = Load(RoR2_Base_EliteLunar.DisplayEliteLunar__Fire_prefab); } private static T Load(string path) where T : Object { //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) T val = Addressables.LoadAssetAsync((object)path).WaitForCompletion(); if ((Object)(object)val == (Object)null) { Log.Error("Asset under path " + path + " could not be found!"); } return val; } } internal static class ClonedAssets { public static GameObject SkyDraconFlamebreathEffect { get; private set; } public static void Init() { SkyDraconFlamebreathEffect = PrefabAPI.InstantiateClone(VanillaAssets.LemBruiserFlamebreathEffect, "SkyDraconFlamebreathEffect"); } } }