Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LunarDragon v1.2.5
LunarDragonMod.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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 EntityStates; using Grumpy; using HG; using HG.Reflection; using IL.RoR2.CharacterSpeech; using JetBrains.Annotations; using KinematicCharacterController; using LunarDragonMod.Characters.LunarDragon; using LunarDragonMod.Characters.Survivors.LunarDragon.Components; using LunarDragonMod.Characters.Survivors.LunarMonster.Components; using LunarDragonMod.Modules; using LunarDragonMod.Modules.Achievements; using LunarDragonMod.Modules.Characters; using LunarDragonMod.Modules.DamageTypes; using LunarDragonMod.Survivors.LunarDragon; using LunarDragonMod.Survivors.LunarDragon.Components; using LunarDragonMod.Survivors.LunarDragon.NetMessages; using LunarDragonMod.Survivors.LunarDragon.SkillDefs; using LunarDragonMod.Survivors.LunarDragon.States; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterSpeech; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using RoR2BepInExPack.GameAssetPathsBetter; using ShaderSwapper; using TMPro; using ThreeEyedGames; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering.PostProcessing; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LunarDragonMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2f8397105d6d7d9fff617415942571419e1cf798")] [assembly: AssemblyProduct("LunarDragonMod")] [assembly: AssemblyTitle("LunarDragonMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace LunarDragonMod { internal static class Log { internal 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 ErrorAssetBundle(string assetName, string bundleName) { Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName); } 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); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.miyowi.LunarDragonMod", "LunarDragon", "1.2.5")] public class LunarDragonPlugin : BaseUnityPlugin { public const string MODUID = "com.miyowi.LunarDragonMod"; public const string MODNAME = "LunarDragon"; public const string MODVERSION = "1.2.5"; public const string DEVELOPER_PREFIX = "MIYOWI"; public static LunarDragonPlugin instance; public static ConfigFile config; private void Awake() { instance = this; Log.Init(((BaseUnityPlugin)this).Logger); config = ((BaseUnityPlugin)this).Config; Language.Init(); LunarDragonNetworking.Init(); LunarDragonDamageTypes.Init(); new LunarDragonSurvivor().Init(); Options.Init(); RoR2Application.onLoadFinished = (Action)Delegate.Combine(RoR2Application.onLoadFinished, new Action(OnLoadFinished)); new ContentPacks().Initialize(); } private void OnLoadFinished() { Hooks.AddHooks(); } } public class Options { private static bool? _rooEnabled; public static bool rooEnabled { get { if (!_rooEnabled.HasValue) { _rooEnabled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); } return _rooEnabled.Value; } } public static ConfigEntry<bool> displaySpecialControls { get; set; } public static void Init() { displaySpecialControls = LunarDragonPlugin.config.Bind<bool>("Special", "Show Controls UI", true, "Whether or not the keys for 'Confirm' and 'Cancel' are prominently displayed when aiming with Draco Ambush."); if (rooEnabled) { RoOInit(); } } private static void RoOInit() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(displaySpecialControls, new CheckBoxConfig())); ModSettingsManager.SetModDescription("Config options relating to the Lunar Dragon survivor mod."); ModSettingsManager.SetModIcon(LunarDragonAssets.assetBundle.LoadAsset<Sprite>("texLunarDragonIcon")); } } } namespace LunarDragonMod.Modules { internal static class Asset { internal static AssetBundle LoadAssetBundle(string bundleName) { AssetBundle val = null; try { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LunarDragonMod." + bundleName)) { if (stream != null) { val = AssetBundle.LoadFromStream(stream); } } if ((Object)(object)val == (Object)null) { Log.Error("Couldn't find asset bundle!"); } } catch (Exception arg) { Log.Error($"Error loading asset bundle '{bundleName}'.\n{arg}"); } return val; } } public static class Config { public static ConfigFile MyConfig = ((BaseUnityPlugin)LunarDragonPlugin.instance).Config; public static ConfigEntry<bool> CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true) { if (string.IsNullOrEmpty(description)) { description = "Set to false to disable this character and as much of its code and content as possible"; } return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description, restartRequired: true); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> result = MyConfig.Bind<T>(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { } return result; } public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired) { } public static bool GetKeyPressed(KeyboardShortcut entry) { //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_0043: Unknown result type (might be due to invalid IL or missing references) foreach (KeyCode modifier in ((KeyboardShortcut)(ref entry)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return Input.GetKeyDown(((KeyboardShortcut)(ref entry)).MainKey); } } internal class Content { internal static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } internal static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } internal static void AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); } internal static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } internal static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon) { UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>(); val.cachedName = identifier; val.nameToken = nameToken; val.achievementIcon = achievementIcon; AddUnlockableDef(val); return val; } internal static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } internal static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } internal static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } internal static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; AddBuffDef(val); return val; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown EffectDef val = new EffectDef(effectPrefab); AddEffectDef(val); return val; } internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; AddNetworkSoundEventDef(val); return val; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public static List<GameObject> bodyPrefabs = new List<GameObject>(); public static List<GameObject> masterPrefabs = new List<GameObject>(); public static List<GameObject> projectilePrefabs = new List<GameObject>(); public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>(); public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>(); public static List<SkillFamily> skillFamilies = new List<SkillFamily>(); public static List<SkillDef> skillDefs = new List<SkillDef>(); public static List<Type> entityStates = new List<Type>(); public static List<BuffDef> buffDefs = new List<BuffDef>(); public static List<EffectDef> effectDefs = new List<EffectDef>(); public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); public string identifier => "com.miyowi.LunarDragonMod"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray()); contentPack.survivorDefs.Add(survivorDefs.ToArray()); contentPack.unlockableDefs.Add(unlockableDefs.ToArray()); contentPack.skillDefs.Add(skillDefs.ToArray()); contentPack.skillFamilies.Add(skillFamilies.ToArray()); contentPack.entityStateTypes.Add(entityStates.ToArray()); contentPack.buffDefs.Add(buffDefs.ToArray()); contentPack.effectDefs.Add(effectDefs.ToArray()); contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public static class Hooks { public delegate void Handle_HealthComponentTakeDamageProcess(HealthComponent self, DamageInfo damageInfo); public static Handle_HealthComponentTakeDamageProcess Handle_HealthComponentTakeDamageProcess_Actions; public static void AddHooks() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown if (Handle_HealthComponentTakeDamageProcess_Actions != null) { HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcess); } BrotherSpeechDriver.DoInitialSightResponse += new Manipulator(AddSeeDragonDialogue); BrotherSpeechDriver.OnBodyKill += new Manipulator(AddKillDragonDialogue); } internal static void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { Handle_HealthComponentTakeDamageProcess_Actions(self, damageInfo); orig.Invoke(self, damageInfo); } private static void AddSeeDragonDialogue(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_014e: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); FieldReference fieldResponsePool = null; bool foundDragon = false; int bodyIndexLoc = 0; int displayClassLoc = 0; if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "bodyIndex") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref bodyIndexLoc) })) { val.Emit(OpCodes.Ldloc, bodyIndexLoc); val.EmitDelegate<Action<BodyIndex>>((Action<BodyIndex>)delegate(BodyIndex bodyIndex) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) foundDragon |= bodyIndex == LunarDragonSurvivor.bodyIndex; }); ILLabel val2 = default(ILLabel); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchBlt(x, ref val2) }) && val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref displayClassLoc) }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, ref fieldResponsePool) })) { val.Emit(OpCodes.Ldloca, displayClassLoc); val.Emit(OpCodes.Ldloc, displayClassLoc); val.Emit(OpCodes.Ldfld, fieldResponsePool); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<SpeechInfo[], BrotherSpeechDriver, SpeechInfo[]>>((Func<SpeechInfo[], BrotherSpeechDriver, SpeechInfo[]>)delegate(SpeechInfo[] responsePool, BrotherSpeechDriver speechDriver) { if (foundDragon && responsePool.Length == 0 && ((Object)((Component)speechDriver).gameObject).name != "BrotherHurtSpeechController(Clone)") { foundDragon = false; return LunarDragonAssets.seeDragonResponses; } return responsePool; }); val.Emit(OpCodes.Stfld, fieldResponsePool); } else { Log.Error("Part 2 of AddSeeDragonDialogue IL hook failed! Custom Mithrix entry dialogue will not work!"); } } else { Log.Error("Part 1 of AddSeeDragonDialogue IL hook failed! Custom Mithrix entry dialogue will not work!"); } } private static void AddKillDragonDialogue(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0061: 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_0085: 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_00a3: 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) ILCursor val = new ILCursor(il); FieldReference fieldResponsePool = null; int displayClassLoc = 0; if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref displayClassLoc) }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, ref fieldResponsePool) })) { val.Emit(OpCodes.Ldloca, displayClassLoc); val.Emit(OpCodes.Ldloc, displayClassLoc); val.Emit(OpCodes.Ldfld, fieldResponsePool); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<SpeechInfo[], BrotherSpeechDriver, DamageReport, SpeechInfo[]>>((Func<SpeechInfo[], BrotherSpeechDriver, DamageReport, SpeechInfo[]>)((SpeechInfo[] responsePool, BrotherSpeechDriver speechDriver, DamageReport damageReport) => (damageReport.victimBodyIndex == LunarDragonSurvivor.bodyIndex) ? ((((Object)((Component)speechDriver).gameObject).name == "BrotherHurtSpeechController(Clone)") ? LunarDragonAssets.killHurtDragonResponses : LunarDragonAssets.killDragonResponses) : responsePool)); val.Emit(OpCodes.Stfld, fieldResponsePool); } else { Log.Error("AddKillDragonDialogue IL hook failed! Custom Mithrix death dialogue will not work!"); } } } internal static class ItemDisplays { public static Dictionary<Object, ItemDisplayRule[]> KeyAssetDisplayPrefabs = new Dictionary<Object, ItemDisplayRule[]>(); public static Dictionary<string, Object> KeyAssets = new Dictionary<string, Object>(); public static int queuedDisplays; public static bool initialized = false; public static void LazyInit() { if (!initialized) { initialized = true; PopulateDisplays(); } } internal static void DisposeWhenDone() { queuedDisplays--; if (queuedDisplays <= 0 && initialized) { initialized = false; KeyAssetDisplayPrefabs = null; KeyAssets = null; } } internal static void PopulateDisplays() { PopulateFromBody(RoR2_Base_Loader.LoaderBody_prefab); } private static void PopulateFromBody(string bodyGUID) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRuleSet itemDisplayRuleSet = ((Component)Addressables.LoadAssetAsync<GameObject>((object)new AssetReferenceGameObject(bodyGUID)).WaitForCompletion().GetComponent<ModelLocator>() .modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet; KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; KeyAssetDisplayPrefabs[keyAssetRuleGroups[i].keyAsset] = rules; KeyAssets[keyAssetRuleGroups[i].keyAsset.name] = keyAssetRuleGroups[i].keyAsset; } } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(GetKeyAssetFromString(itemName), rules); } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules) { //IL_0019: 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_0039: 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) //IL_0040: 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) if (keyAsset_ == (Object)null) { Log.Error("could not find keyasset"); } return new KeyAssetRuleGroup { keyAsset = keyAsset_, displayRuleGroup = new DisplayRuleGroup { rules = rules } }; } public static ItemDisplayRule CreateDisplayRule(string assetGUID, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRule(new AssetReferenceGameObject(assetGUID), childName, position, rotation, scale); } public static ItemDisplayRule CreateDisplayRule(AssetReferenceGameObject itemDisplayAddress, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_002b: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_0042: 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_0046: Unknown result type (might be due to invalid IL or missing references) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = childName, followerPrefabAddress = itemDisplayAddress, limbMask = (LimbFlags)0, localPos = position, localAngles = rotation, localScale = scale }; } public static ItemDisplayRule CreateLimbMaskDisplayRule(LimbFlags limb) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)1, limbMask = limb, childName = "", followerPrefab = null }; } private static Object GetKeyAssetFromString(string itemName) { Object val = (Object)(object)LegacyResourcesAPI.Load<ItemDef>("ItemDefs/" + itemName); if (val == (Object)null) { val = (Object)(object)LegacyResourcesAPI.Load<EquipmentDef>("EquipmentDefs/" + itemName); } if (val == (Object)null) { Log.Error("Could not load keyasset for " + itemName); } return val; } } internal static class Language { public static string TokensOutput = ""; public static bool usingLanguageFolder = false; public static bool printingEnabled = false; public static void Init() { if (usingLanguageFolder) { Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } } private static void Language_collectLanguageRootFolders(List<string> obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)LunarDragonPlugin.instance).Info.Location), "Language"); if (Directory.Exists(text)) { obj.Add(text); } } public static void Add(string token, string text) { if (!usingLanguageFolder) { LanguageAPI.Add(token, text); } if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } public static void PrintOutput(string fileName = "") { if (printingEnabled) { string text = "{\n strings:\n {" + TokensOutput + "\n }\n}"; Log.Message(fileName + ": \n" + text); if (!string.IsNullOrEmpty(fileName)) { string path = Path.Combine(Directory.GetParent(((BaseUnityPlugin)LunarDragonPlugin.instance).Info.Location).FullName, "Language", "en", fileName); File.WriteAllText(path, text); } TokensOutput = ""; } } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject prefab) { GameObject val = assetBundle.LoadAsset<GameObject>(displayPrefabName); if ((Object)(object)val == (Object)null) { Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } CharacterModel val2 = val.GetComponent<CharacterModel>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent<CharacterModel>(); } val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos; return val; } public static GameObject LoadDisplayPrefab(AssetBundle assetBundle, string modelName) { GameObject val = assetBundle.LoadAsset<GameObject>(modelName); if ((Object)(object)val == (Object)null) { Log.Error("could not load display prefab " + modelName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } return val; } public static GameObject LoadCharacterBody(AssetBundle assetBundle, string bodyName) { GameObject val = assetBundle.LoadAsset<GameObject>(bodyName); if ((Object)(object)val == (Object)null) { Log.Error("could not load body prefab " + bodyName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } Content.AddCharacterBodyPrefab(val); return val; } public static void SetupRagdoll(GameObject model) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) RagdollController component = model.GetComponent<RagdollController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ragdollMaterial = Addressables.LoadAssetAsync<PhysicMaterial>((object)RoR2_Base_Common.physmatRagdoll_physicMaterial).WaitForCompletion(); } Transform[] bones = component.bones; foreach (Transform val in bones) { if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal; Collider component2 = ((Component)val).GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.sharedMaterial = ragdollMaterial; } else { Log.Error($"Ragdoll bone {((Component)val).gameObject} doesn't have a collider. Ragdoll will break."); } } } } } internal static class Tokens { public const string agilePrefix = "<style=cIsUtility>Agile.</style>"; public const string stunningPrefix = "<style=cIsDamage>Stunning.</style>"; public const string freezingPrefix = "<style=cIsUtility>Freezing.</style>"; public static string GetAchievementNameToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_NAME"; } public static string GetAchievementDescriptionToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_DESCRIPTION"; } } } namespace LunarDragonMod.Modules.DamageTypes { public static class Stun3s { public static ModdedDamageType damageType; public static void Init() { //IL_0001: 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) damageType = DamageAPI.ReserveDamageType(); Hooks.Handle_HealthComponentTakeDamageProcess_Actions = (Hooks.Handle_HealthComponentTakeDamageProcess)Delegate.Combine(Hooks.Handle_HealthComponentTakeDamageProcess_Actions, new Hooks.Handle_HealthComponentTakeDamageProcess(AddStun3sBuff)); } private static void AddStun3sBuff(HealthComponent self, DamageInfo damageInfo) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)self.body != (Object)null && DamageAPI.HasModdedDamageType(damageInfo, damageType)) { SetStateOnHurt component = ((Component)self).GetComponent<SetStateOnHurt>(); if ((Object)(object)component != (Object)null && component.canBeStunned) { component.SetStun(3f); } } } } } namespace LunarDragonMod.Modules.Characters { public abstract class CharacterBase<T> where T : CharacterBase<T>, new() { public abstract string assetBundleName { get; } public abstract string bodyName { get; } public virtual ItemDisplaysBase itemDisplays { get; } public static T instance { get; private set; } public virtual AssetBundle assetBundle { get; protected set; } public virtual GameObject bodyPrefab { get; protected set; } public virtual CharacterBody prefabCharacterBody { get; protected set; } public virtual GameObject characterModelObject { get; protected set; } public virtual CharacterModel prefabCharacterModel { get; protected set; } public virtual void Init() { instance = this as T; assetBundle = Asset.LoadAssetBundle(assetBundleName); InitCharacter(); } public virtual void InitCharacter() { InitCharacterBodyPrefab(); InitItemDisplays(); } protected virtual void InitCharacterBodyPrefab() { bodyPrefab = Prefabs.LoadCharacterBody(assetBundle, bodyName); prefabCharacterBody = bodyPrefab.GetComponent<CharacterBody>(); characterModelObject = ((Component)bodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject; prefabCharacterModel = characterModelObject.GetComponent<CharacterModel>(); } public virtual void InitItemDisplays() { ItemDisplayRuleSet val = ScriptableObject.CreateInstance<ItemDisplayRuleSet>(); ((Object)val).name = "idrs" + bodyName; prefabCharacterModel.itemDisplayRuleSet = val; if (itemDisplays != null) { ItemDisplays.queuedDisplays++; ContentManager.onContentPacksAssigned += SetItemDisplays; } } public void SetItemDisplays(ReadOnlyArray<ReadOnlyContentPack> obj) { itemDisplays.SetItemDisplays(prefabCharacterModel.itemDisplayRuleSet); } } public abstract class ItemDisplaysBase { public void SetItemDisplays(ItemDisplayRuleSet itemDisplayRuleSet) { List<KeyAssetRuleGroup> list = new List<KeyAssetRuleGroup>(); ItemDisplays.LazyInit(); SetItemDisplayRules(list); itemDisplayRuleSet.keyAssetRuleGroups = list.ToArray(); ItemDisplays.DisposeWhenDone(); } protected abstract void SetItemDisplayRules(List<KeyAssetRuleGroup> itemDisplayRules); } public abstract class SurvivorBase<T> : CharacterBase<T> where T : SurvivorBase<T>, new() { public abstract string masterName { get; } public abstract string displayPrefabName { get; } public abstract string survivorDefName { get; } public abstract string survivorTokenPrefix { get; } public virtual GameObject displayPrefab { get; protected set; } public virtual GameObject masterPrefab { get; protected set; } public virtual GameObject footstepDustPrefab => Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common_VFX.GenericLargeFootstepDust_prefab).WaitForCompletion(); public override void InitCharacter() { base.InitCharacter(); Prefabs.SetupRagdoll(characterModelObject); if (Object.op_Implicit((Object)(object)prefabCharacterBody)) { FootstepHandler val = default(FootstepHandler); if (Object.op_Implicit((Object)(object)characterModelObject) && characterModelObject.TryGetComponent<FootstepHandler>(ref val)) { val.footstepDustPrefab = footstepDustPrefab; } else { Log.Error("No valid FootstepHandler component found for " + ((Object)characterModelObject).name + "!"); } } else { Log.Error("No valid CharacterBody component found for " + ((Object)bodyPrefab).name + "!"); } InitDisplayPrefab(); InitSurvivor(); InitMaster(); } protected virtual void InitMaster() { masterPrefab = assetBundle.LoadAsset<GameObject>(masterName); if (Object.op_Implicit((Object)(object)masterPrefab)) { Content.AddMasterPrefab(masterPrefab); } else { Log.Error("Master prefab \"" + masterName + "\" not found!"); } } protected virtual void InitDisplayPrefab() { displayPrefab = Prefabs.LoadDisplayPrefab(assetBundle, displayPrefabName); } protected virtual void InitSurvivor() { SurvivorDef val = assetBundle.LoadAsset<SurvivorDef>(survivorDefName); if ((Object)(object)val != (Object)null) { Content.AddSurvivorDef(val); } else { Log.Error("SurvivorDef \"" + survivorDefName + "\" not found!"); } } protected virtual void AddCssPreviewSkill(int indexFromEditor, SkillFamily skillFamily, SkillDef skillDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent<CharacterSelectSurvivorPreviewDisplayController>(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("trying to add skillChangeResponse to null CharacterSelectSurvivorPreviewDisplayController.\nMake sure you created one on your Display prefab in editor"); return; } component.skillChangeResponses[indexFromEditor].triggerSkillFamily = skillFamily; component.skillChangeResponses[indexFromEditor].triggerSkill = skillDef; } protected virtual void AddCssPreviewSkin(int indexFromEditor, SkinDef skinDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent<CharacterSelectSurvivorPreviewDisplayController>(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("trying to add skinChangeResponse to null CharacterSelectSurvivorPreviewDisplayController.\nMake sure you created one on your Display prefab in editor"); } else { component.skinChangeResponses[indexFromEditor].triggerSkin = skinDef; } } protected virtual void FinalizeCSSPreviewDisplayController() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)displayPrefab)) { return; } CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent<CharacterSelectSurvivorPreviewDisplayController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } component.bodyPrefab = bodyPrefab; List<SkillChangeResponse> list = new List<SkillChangeResponse>(); for (int i = 0; i < component.skillChangeResponses.Length; i++) { if ((Object)(object)component.skillChangeResponses[i].triggerSkillFamily != (Object)null) { list.Add(component.skillChangeResponses[i]); } } component.skillChangeResponses = list.ToArray(); } } } namespace LunarDragonMod.Modules.BaseStates { public abstract class BaseMeleeAttack : BaseSkillState, IStepSetter { public int swingIndex; protected string hitboxGroupName = "SwordGroup"; protected DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)0); protected float damageCoefficient = 3.5f; protected float procCoefficient = 1f; protected float pushForce = 300f; protected Vector3 bonusForce = Vector3.zero; protected float baseDuration = 1f; protected float attackStartPercentTime = 0.2f; protected float attackEndPercentTime = 0.4f; protected float earlyExitPercentTime = 0.4f; protected float hitStopDuration = 0.012f; protected float attackRecoil = 0.75f; protected float hitHopVelocity = 4f; protected string swingSoundString = ""; protected string hitSoundString = ""; protected string muzzleString = "SwingCenter"; protected string playbackRateParam = "Slash.playbackRate"; protected GameObject swingEffectPrefab; protected GameObject hitEffectPrefab; protected NetworkSoundEventIndex impactSound = (NetworkSoundEventIndex)(-1); protected OverlapAttack attack; public float duration; private bool hasFired; private float hitPauseTimer; protected bool inHitPause; private bool hasHopped; protected float stopwatch; protected Animator animator; private HitStopCachedState hitStopCachedState; private Vector3 storedVelocity; public override void OnEnter() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_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) ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; animator = ((EntityState)this).GetModelAnimator(); ((BaseState)this).StartAimMode(0.5f + duration, false); PlayAttackAnimation(); attack = new OverlapAttack(); attack.damageType = damageType; attack.attacker = ((EntityState)this).gameObject; attack.inflictor = ((EntityState)this).gameObject; attack.teamIndex = ((BaseState)this).GetTeam(); attack.damage = damageCoefficient * ((BaseState)this).damageStat; attack.procCoefficient = procCoefficient; attack.hitEffectPrefab = hitEffectPrefab; attack.forceVector = bonusForce; attack.pushAwayForce = pushForce; attack.hitBoxGroup = ((BaseState)this).FindHitBoxGroup(hitboxGroupName); attack.isCrit = ((BaseState)this).RollCrit(); attack.impactSound = impactSound; ModifyOverlapAttack(attack); } protected virtual void ModifyOverlapAttack(OverlapAttack attack) { } protected virtual void PlayAttackAnimation() { ((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), playbackRateParam, duration, 0.05f); } public override void OnExit() { if (inHitPause) { RemoveHitstop(); } ((EntityState)this).OnExit(); } protected virtual void PlaySwingEffect() { EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, false); } protected virtual void OnHitEnemyAuthority() { Util.PlaySound(hitSoundString, ((EntityState)this).gameObject); if (!hasHopped) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f) { ((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity); } hasHopped = true; } ApplyHitstop(); } protected void ApplyHitstop() { //IL_0025: 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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (!inHitPause && hitStopDuration > 0f) { storedVelocity = ((EntityState)this).characterMotor.velocity; hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, playbackRateParam); hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat; inHitPause = true; } } private void FireAttack() { if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null)) { OnHitEnemyAuthority(); } } private void EnterAttack() { hasFired = true; Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); PlaySwingEffect(); if (((EntityState)this).isAuthority) { ((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil); } } public override void FixedUpdate() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); hitPauseTimer -= Time.deltaTime; if (hitPauseTimer <= 0f && inHitPause) { RemoveHitstop(); } if (!inHitPause) { stopwatch += Time.deltaTime; } else { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } if (Object.op_Implicit((Object)(object)animator)) { animator.SetFloat(playbackRateParam, 0f); } } bool flag = stopwatch >= duration * attackStartPercentTime; bool flag2 = stopwatch >= duration * attackEndPercentTime; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { if (!hasFired) { EnterAttack(); } FireAttack(); } if (stopwatch >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void RemoveHitstop() { //IL_0003: 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_002d: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator); inHitPause = false; ((EntityState)this).characterMotor.velocity = storedVelocity; } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0023: 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_0026: Unknown result type (might be due to invalid IL or missing references) if (stopwatch >= duration * earlyExitPercentTime) { return (InterruptPriority)0; } return (InterruptPriority)1; } public override void OnSerialize(NetworkWriter writer) { ((BaseSkillState)this).OnSerialize(writer); writer.Write(swingIndex); } public override void OnDeserialize(NetworkReader reader) { ((BaseSkillState)this).OnDeserialize(reader); swingIndex = reader.ReadInt32(); } public void SetStep(int i) { swingIndex = i; } } public abstract class BaseTimedSkillState : BaseSkillState { protected float duration; protected float castStartTime; protected float castEndTime; protected bool hasFired; protected bool isFiring; protected bool hasExited; public abstract float TimedBaseDuration { get; } public abstract float TimedBaseCastStartPercentTime { get; } public virtual float TimedBaseCastEndPercentTime => 1f; public override void OnEnter() { InitDurationValues(); ((BaseState)this).OnEnter(); } protected virtual void InitDurationValues() { duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat; castStartTime = TimedBaseCastStartPercentTime * duration; castEndTime = TimedBaseCastEndPercentTime * duration; } protected virtual void OnCastEnter() { } protected virtual void OnCastFixedUpdate() { } protected virtual void OnCastUpdate() { } protected virtual void OnCastExit() { } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); bool flag = ((EntityState)this).fixedAge >= castStartTime; bool flag2 = ((EntityState)this).fixedAge >= castEndTime; isFiring = false; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { isFiring = true; OnCastFixedUpdate(); if (!hasFired) { OnCastEnter(); hasFired = true; } } if (flag2 && !hasExited) { hasExited = true; OnCastExit(); } if (((EntityState)this).fixedAge > duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void Update() { ((EntityState)this).Update(); if (isFiring) { OnCastUpdate(); } } } public class ExampleTimedSkillState : BaseTimedSkillState { public override float TimedBaseDuration => 1.5f; public override float TimedBaseCastStartPercentTime => 0.2f; public override float TimedBaseCastEndPercentTime => 0.9f; protected override void OnCastEnter() { } protected override void OnCastFixedUpdate() { } protected override void OnCastExit() { } } public class ExampleDelayedSkillState : BaseTimedSkillState { public override float TimedBaseDuration => 1.5f; public override float TimedBaseCastStartPercentTime => 0.2f; protected override void OnCastEnter() { } } } namespace LunarDragonMod.Modules.Achievements { public abstract class BaseMasteryAchievement : BaseAchievement { public abstract string RequiredCharacterBody { get; } public abstract float RequiredDifficultyCoefficient { get; } public override BodyIndex LookUpRequiredBodyIndex() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return BodyCatalog.FindBodyIndex(RequiredCharacterBody); } public override void OnBodyRequirementMet() { ((BaseAchievement)this).OnBodyRequirementMet(); Run.onClientGameOverGlobal += OnClientGameOverGlobal; } public override void OnBodyRequirementBroken() { Run.onClientGameOverGlobal -= OnClientGameOverGlobal; ((BaseAchievement)this).OnBodyRequirementBroken(); } private void OnClientGameOverGlobal(Run run, RunReport runReport) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 if (!Object.op_Implicit((Object)(object)runReport.gameEnding) || !runReport.gameEnding.isWin) { return; } DifficultyIndex val = runReport.ruleBook.FindDifficulty(); DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(val); if (difficultyDef != null) { bool flag = difficultyDef.countsAsHardMode && difficultyDef.scalingValue >= RequiredDifficultyCoefficient; bool flag2 = difficultyDef.nameToken == "INFERNO_NAME"; bool flag3 = (int)val >= 3 && (int)val <= 10; if (flag || flag2 || flag3) { ((BaseAchievement)this).Grant(); } } } } } namespace LunarDragonMod.Characters.LunarDragon { public class MinigameController : MonoBehaviour { private const int ringCount = 6; private const float duration = 2f; private const float graceWindow = 0.18f; private const float exitAnimAt = 3.3f; public const float damageIncrease = 10f; public const float cooldownReduction = 5f; public const float radiusIncrease = 10f; public const float healIncrease = 1f / 24f; public const float missMult = 0.75f; [SerializeField] private GameObject bloodRingPrefab; [SerializeField] private GameObject designRingPrefab; [SerializeField] private GameObject massRingPrefab; [SerializeField] private GameObject soulRingPrefab; [SerializeField] private Transform activeParent; [SerializeField] private Transform effectParent; [SerializeField] private AnimateScale endingAnimation; [SerializeField] private SelectionRingController selectionRing; [HideInInspector] public CharacterBody characterBody; private float gameStopwatch; private Queue<ElementRingController> activeRings = new Queue<ElementRingController>(6); private List<float> ringTimings = new List<float>(6); private GameObject[] randomRingSelection; private int currentTiming; [HideInInspector] public float bonusDamage; [HideInInspector] public float bonusRadius; [HideInInspector] public float bonusHealing; [HideInInspector] public float bonusCDReduction; private float animStopwatch = 0f; private void Start() { PopulateRandomTimings(); PopulateRandomRings(); } private void PopulateRandomTimings() { float num = 1.8199999f; float num2 = num; for (int i = 0; i < 5; i++) { if (num2 <= 0f) { Log.Warning("Ran out of available time for minigame setup??"); break; } float num3 = Random.value * num2; foreach (float ringTiming in ringTimings) { if (num3 > ringTiming - 0.18f) { num3 += 0.36f; } } num2 = ((!(num3 - 0.18f > 0f)) ? (num2 - num3) : (num2 - 0.18f)); num2 = ((!(num3 + 0.18f <= num)) ? (num2 - (num - num3)) : (num2 - 0.18f)); ringTimings.Add(num3); ringTimings.Sort(); } ringTimings.Add(2f); } private void PopulateRandomRings() { randomRingSelection = (GameObject[])(object)new GameObject[3] { bloodRingPrefab, designRingPrefab, massRingPrefab }; } private void SpawnRandomRing() { SpawnRing(randomRingSelection[Random.RandomRangeInt(0, randomRingSelection.Length)]); } private void SpawnRing(GameObject ringPrefab) { GameObject val = Object.Instantiate<GameObject>(ringPrefab, activeParent); ElementRingController item = default(ElementRingController); if (val.TryGetComponent<ElementRingController>(ref item)) { activeRings.Enqueue(item); return; } Log.Error("Provided ring prefab does not have ElementRingController component!"); Object.Destroy((Object)(object)val); } private void Update() { animStopwatch += Time.deltaTime; if (animStopwatch > 3.3f && Object.op_Implicit((Object)(object)endingAnimation) && !((Behaviour)endingAnimation).enabled) { ((Behaviour)endingAnimation).enabled = true; } } private void FixedUpdate() { gameStopwatch += Time.deltaTime; HandleMinigameInputs(); if (currentTiming < ringTimings.Count && gameStopwatch >= ringTimings[currentTiming]) { if (currentTiming + 1 < 6) { SpawnRandomRing(); } else { SpawnRing(soulRingPrefab); } currentTiming++; } } private void HandleMinigameInputs() { if (!Object.op_Implicit((Object)(object)characterBody) || !Object.op_Implicit((Object)(object)characterBody.inputBank) || !((ButtonState)(ref characterBody.inputBank.skill1)).justPressed) { return; } bool flag = false; while (!flag) { if (activeRings.Count > 0 && activeRings.Peek().HasPassed(selectionRing.ringRadiusLower)) { activeRings.Dequeue(); } else { flag = true; } } if (activeRings.Count <= 0) { return; } ElementRingController elementRingController = activeRings.Peek(); if (elementRingController.TryHit(selectionRing.ringRadiusUpper, selectionRing.ringRadiusLower)) { activeRings.Dequeue(); ((Component)elementRingController).transform.SetParent(effectParent, true); ApplyRingEffect(elementRingController.element); if (elementRingController.element == ElementRingController.Element.Soul) { Util.PlaySound("Play_LunarDragonMinigameBigHit", ((Component)characterBody).gameObject); } else { Util.PlaySound("Play_LunarDragonMinigameSmallHit", ((Component)characterBody).gameObject); } selectionRing.FlashSuccess(); } else { ApplyMissPunishment(); Util.PlaySound("Play_LunarDragonMinigameMiss", ((Component)characterBody).gameObject); selectionRing.FlashFailure(); } } private void ApplyRingEffect(ElementRingController.Element element) { switch (element) { case ElementRingController.Element.Blood: ApplyHitReward(1f, 0.2f, 0.2f, 1f); break; case ElementRingController.Element.Mass: ApplyHitReward(0.2f, 1f, 0.2f, 1f); break; case ElementRingController.Element.Design: ApplyHitReward(0.2f, 0.2f, 1f, 1f); break; case ElementRingController.Element.Soul: ApplyHitReward(1f, 1f, 1f, 1f); ApplySoulHeal(); break; } } private void ApplyHitReward(float damageMult, float radiusMult, float cdMult, float healingMult) { bonusDamage += 10f * damageMult; bonusRadius += 10f * radiusMult; bonusCDReduction += 5f * cdMult; bonusHealing += 1f / 24f * healingMult; } private void ApplyMissPunishment() { bonusDamage *= 0.75f; bonusRadius *= 0.75f; bonusCDReduction *= 0.75f; bonusHealing *= 0.75f; } private void ApplySoulHeal() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)characterBody) && Object.op_Implicit((Object)(object)characterBody.healthComponent)) { NetMessageExtensions.Send((INetMessage)(object)new SyncSpecialHeal(characterBody.networkIdentity.netId, characterBody.healthComponent.fullHealth * bonusHealing), (NetworkDestination)2); } } } } namespace LunarDragonMod.Characters.Survivors.LunarDragon.Components { public class EnableOnTimer : MonoBehaviour { public float duration; public GameObject target; public bool disableOnEnable = true; public bool resetOnEnable = true; private float stopwatch; private void Update() { if (stopwatch < duration) { stopwatch += Time.deltaTime; if (stopwatch > duration && Object.op_Implicit((Object)(object)target)) { target.SetActive(true); } } } private void OnEnable() { target.SetActive(!disableOnEnable); if (resetOnEnable) { stopwatch = 0f; } } } public class PlaySoundOnDelay : MonoBehaviour { public float delay = 1f; public string soundString; public bool resetOnEnable = true; private float stopwatch; private bool activated; private void OnEnable() { if (resetOnEnable) { stopwatch = 0f; activated = false; } } public void Update() { if (!activated) { stopwatch += Time.deltaTime; if (stopwatch >= delay) { Util.PlaySound(soundString, ((Component)this).gameObject); activated = true; } } } } public class ScaleLineToTracer : MonoBehaviour { public LineRenderer lineRenderer; public Tracer targetTracer; private void Start() { UpdatePositions(); } private void Update() { UpdatePositions(); } private void UpdatePositions() { //IL_003b: 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) if (Object.op_Implicit((Object)(object)lineRenderer) && Object.op_Implicit((Object)(object)targetTracer) && ((Behaviour)targetTracer).isActiveAndEnabled) { lineRenderer.SetPosition(0, targetTracer.startPos); lineRenderer.SetPosition(1, targetTracer.endPos); } } } public class ScaleOverTime : MonoBehaviour { public bool separateAxes; public bool resetOnEnable = true; public AnimationCurve combinedCurve; public AnimationCurve xCurve = null; public AnimationCurve yCurve = null; public AnimationCurve zCurve = null; private float stopwatch; private void Update() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00a4: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) stopwatch += Time.deltaTime; if (!separateAxes && combinedCurve != null) { ((Component)this).transform.localScale = Vector3.one * combinedCurve.Evaluate(stopwatch); return; } if (xCurve.length > 0) { ((Component)this).transform.localScale = new Vector3(xCurve.Evaluate(stopwatch), ((Component)this).transform.localScale.y, ((Component)this).transform.localScale.z); } if (yCurve.length > 0) { ((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x, yCurve.Evaluate(stopwatch), ((Component)this).transform.localScale.z); } if (zCurve.length > 0) { ((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x, ((Component)this).transform.localScale.y, zCurve.Evaluate(stopwatch)); } } private void OnEnable() { if (resetOnEnable) { stopwatch = 0f; } } } } namespace LunarDragonMod.Characters.Survivors.LunarMonster.Components { public class DragonSpawnCameraController : MonoBehaviour, ICameraStateProvider { public Transform modelTransform; public CharacterBody characterBody; public CharacterDirection characterDirection; public void Start() { modelTransform = ((Component)this).GetComponent<ModelLocator>().modelTransform; characterBody = ((Component)this).GetComponent<CharacterBody>(); characterDirection = ((Component)this).GetComponent<CharacterDirection>(); UpdateCamera(); } public void Update() { UpdateCamera(); } void ICameraStateProvider.GetCameraState(CameraRigController cameraRigController, ref CameraState cameraState) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_0069: 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_0083: 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_008b: 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_008d: 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_009c: 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_00ae: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - characterDirection.forward * 20f + ((Component)this).transform.up * 5f; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(((Component)this).transform.position.x, modelTransform.position.y, ((Component)this).transform.position.z); cameraState = new CameraState { position = val, rotation = Quaternion.LookRotation(val2 - val, Vector3.up), fov = 60f }; } bool ICameraStateProvider.IsUserLookAllowed(CameraRigController cameraRigController) { return false; } bool ICameraStateProvider.IsUserControlAllowed(CameraRigController cameraRigController) { return false; } bool ICameraStateProvider.IsHudAllowed(CameraRigController cameraRigController) { return true; } private void UpdateCamera() { foreach (CameraRigController readOnlyInstances in CameraRigController.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)characterBody) && (Object)(object)readOnlyInstances.target == (Object)(object)((Component)characterBody).gameObject) { readOnlyInstances.SetOverrideCam((ICameraStateProvider)(object)this, 0f); } else if (readOnlyInstances.IsOverrideCam((ICameraStateProvider)(object)this)) { readOnlyInstances.SetOverrideCam((ICameraStateProvider)null, 0f); } } } } } namespace LunarDragonMod.Survivors.LunarDragon { public class AnimationCurveData : ScriptableObject { [SerializeField] public AnimationCurve xCurve; [SerializeField] public AnimationCurve yCurve; [SerializeField] public AnimationCurve zCurve; } public static class LunarDragonAnimationParameters { public static readonly int isHovering = Animator.StringToHash("isHovering"); public static readonly int forceIdle = Animator.StringToHash("forceIdle"); } public static class LunarDragonAssets { public static AssetBundle assetBundle; public static GameObject jetEffectPrefab; public static GameObject fireballPrefab; public static GameObject fireballGhostPrefab; public static GameObject fireballImpactPrefab; public static GameObject iceballPrefab; public static GameObject iceballImpactPrefab; public static GameObject iceballMuzzlePrefab; public static GameObject heavyFireballPrefab; public static GameObject heavyFireballMuzzlePrefab; public static GameObject heavyFireballImpactPrefab; public static GameObject heavyFireballPlumePrefab; public static GameObject heavyFireballPlumeLargePrefab; public static GameObject plumeShakeSFX; public static GameObject heavyIceballPrefab; public static GameObject heavyPlasmaballPrefab; public static GameObject laserTracerPrefab; public static GameObject laserMuzzlePrefab; public static GameObject laserHitEffectPrefab; public static GameObject utilitySmokeEffect; public static GameObject utilityDashLightEffect; public static GameObject utilityDashMediumEffect; public static GameObject utilityDashHeavyEffect; public static GameObject fireTrailPrefab; public static GameObject impactDecalBase; public static Material iceDecalMaterial; public static GameObject displayEffectPrefab; public static GameObject specialLiftoffSmokeEffect; public static GameObject specialLiftoffExplosionEffect; public static GameObject specialAscendingFireEffect; public static GameObject specialLandingExplosionEffect; public static AnimationCurveData specialAmbushRisingData; public static AnimationCurveData specialAmbushDescendingData; public static AnimationCurveData specialAmbushSpawnDescendingData; public static SpeechInfo[] seeDragonResponses; public static SpeechInfo[] killDragonResponses; public static SpeechInfo[] killHurtDragonResponses; public static GameObject specialMinigamePrefab; public static GameObject specialControlsUIPrefab; public static void Init(AssetBundle assetBundle) { LunarDragonAssets.assetBundle = assetBundle; ((MonoBehaviour)LunarDragonPlugin.instance).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(assetBundle)); TryBuildAsset("Impact Decal Base", CreateImpactDecalBase); TryBuildAsset("Jet Effect", CreateJetEffect); TryBuildAsset("Primary Fireball", CreateFireball); TryBuildAsset("Secondary Fireball", CreateHeavyFireball); TryBuildAsset("Primary Iceball", CreateIceball); TryBuildAsset("Secondary Iceball", CreateHeavyIceball); TryBuildAsset("Primary Laser", CreateLaser); TryBuildAsset("Secondary Plasmaball", CreateHeavyPlasmaball); TryBuildAsset("Utility Smoke", CreateDashSmoke); TryBuildAsset("Utility Dash Explosions", CreateDashExplosions); TryBuildAsset("Utility Fire Trail", CreateFireTrail); TryBuildAsset("Display Effect", CreateDisplayEffect); TryBuildAsset("Special Liftoff Effects", CreateAmbushLiftoffEffects); TryBuildAsset("Special Ascending Effects", CreateAmbushAscendingEffects); TryBuildAsset("Special Landing Effects", CreateAmbushLandingEffects); TryBuildAsset("Special Extra Data", GetAmbushExtraData); TryBuildAsset("Special UI Elements", CreateAmbushUIElements); TryBuildAsset("Mithrix Dialogue", CreateMithrixDialogue); } private static void TryBuildAsset(string assetName, Action buildAction) { try { buildAction(); } catch (Exception arg) { Log.Warning($"Failed to complete building asset {assetName}!\n\n{arg}"); } } private static void CreateImpactDecalBase() { impactDecalBase = PrefabAPI.CreateEmptyPrefab("ImpactDecal", false); TryBuildAsset("Impact Decal Components", delegate { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown MeshRenderer val = impactDecalBase.AddComponent<MeshRenderer>(); ((Renderer)val).sharedMaterials = (Material[])(object)new Material[0]; impactDecalBase.AddComponent<MeshFilter>().sharedMesh = Addressables.LoadAssetAsync<Mesh>((object)Decalicious.DecalCube_asset).WaitForCompletion(); impactDecalBase.AddComponent<SetRandomRotation>().setRandomYRotation = true; Decal val2 = impactDecalBase.AddComponent<Decal>(); val2.Fade = 1f; val2.Material = Addressables.LoadAssetAsync<Material>((object)RoR2_Base_SurvivorPod.matPodImpactDecal_mat).WaitForCompletion(); AnimateShaderAlpha val3 = impactDecalBase.AddComponent<AnimateShaderAlpha>(); val3.decal = val2; val3.alphaCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[2] { new Keyframe(0f, 1f, 0f, -5f), new Keyframe(3f, 0f, 0f, 0f) }); }); } private static void CreateJetEffect() { //IL_002a: 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) jetEffectPrefab = PrefabAPI.CreateEmptyPrefab("JetEffect", false); jetEffectPrefab.transform.localScale = new Vector3(0.1834f, 0.1834f, 1.572f); jetEffectPrefab.transform.eulerAngles = new Vector3(0f, 90f, 0f); TryBuildAsset("Jet Effect Components", delegate { //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) //IL_0048: 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) GameObject val = Object.Instantiate<GameObject>(((Component)((Component)Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Mage.MageBody_prefab).WaitForCompletion().GetComponent<ModelLocator>() .modelTransform).GetComponent<ChildLocator>().FindChild("JetOn")).gameObject, jetEffectPrefab.transform, false); val.transform.localPosition = Vector3.zero; ((Object)val.gameObject).name = "JetSFX"; val.SetActive(true); Object.Destroy((Object)(object)((Component)val.transform.Find("JetsL")).gameObject); ((Object)((Component)val.transform.Find("JetsR")).gameObject).name = "MainJet"; for (int num = val.transform.childCount - 1; num >= 0; num--) { Transform child = val.transform.GetChild(num); child.localPosition = Vector3.zero; child.SetParent(jetEffectPrefab.transform, false); } }); } private static void CreateFireball() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) fireballPrefab = assetBundle.LoadAsset<GameObject>("FireballProjectile"); fireballGhostPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Mage.MageLightningBombGhost_prefab).WaitForCompletion(), "DragonFireballGhost", false); TryBuildAsset("Primary Fireball Ghost", delegate { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0077: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0111: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) Object.Destroy((Object)(object)((Component)fireballGhostPrefab.transform.Find("Sparks, Trail")).gameObject); Object.Destroy((Object)(object)((Component)fireballGhostPrefab.transform.Find("Point light")).gameObject); GameObject gameObject = ((Component)fireballGhostPrefab.transform.Find("Base")).gameObject; ParticleSystemRenderer component = gameObject.GetComponent<ParticleSystemRenderer>(); Material val = new Material(((Renderer)component).sharedMaterial); val.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_Base_Common_ColorRamps.texRampMageFire_png).WaitForCompletion()); val.SetFloat("_AlphaBoost", 5.7f); ((Renderer)component).sharedMaterial = val; gameObject.transform.localScale = Vector3.one * 3f; GameObject gameObject2 = ((Component)fireballGhostPrefab.transform.Find("OrbCore")).gameObject; MeshRenderer component2 = gameObject2.GetComponent<MeshRenderer>(); Material val2 = new Material(Addressables.LoadAssetAsync<Material>((object)RoR2_DLC2_Child.matChildStarCore_mat).WaitForCompletion()); val2.SetColor("_TintColor", new Color(1f, 0.74f, 0f)); val2.renderQueue += 1; ((Renderer)component2).sharedMaterial = val2; gameObject2.transform.localScale = Vector3.one; GameObject val3 = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Lemurian.FireballGhost_prefab).WaitForCompletion(), fireballGhostPrefab.transform); Object.Destroy((Object)(object)val3.GetComponent<ProjectileGhostController>()); Object.Destroy((Object)(object)val3.GetComponent<DetachParticleOnDestroyAndEndEmission>()); Object.Destroy((Object)(object)val3.GetComponent<VFXAttributes>()); val3.transform.localScale = Vector3.one * 1.8f; ((Component)val3.transform.Find("Point light")).GetComponent<Light>().range = 8f; val3.transform.localPosition = Vector3.zero; }); fireballPrefab.GetComponent<ProjectileController>().ghostPrefab = fireballGhostPrefab; TryBuildAsset("Primary Fireball Impact Explosion", delegate { //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) //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005c: 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_008e: 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) fireballImpactPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_LemurianBruiser.OmniExplosionVFXLemurianBruiserFireballImpact_prefab).WaitForCompletion(), "DragonFireballImpact", false); GameObject val = Object.Instantiate<GameObject>(impactDecalBase, fireballImpactPrefab.transform, false); Material val2 = new Material(Addressables.LoadAssetAsync<Material>((object)RoR2_DLC2_Chef.matChefOilPoolFireDecal_mat).WaitForCompletion()); val2.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_Base_Common_ColorRamps.texRampDroneFire_png).WaitForCompletion()); val.GetComponent<Decal>().Material = val2; ((Object)val).name = "FireImpactDecal"; val.transform.localScale = Vector3.one * 0.8f; }); fireballPrefab.GetComponent<ProjectileImpactExplosion>().impactEffect = fireballImpactPrefab; Content.CreateAndAddEffectDef(fireballImpactPrefab); Content.AddProjectilePrefab(fireballPrefab); } private static void CreateIceball() { //IL_0021: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) iceballPrefab = assetBundle.LoadAsset<GameObject>("IceballProjectile"); GameObject dragonIceballGhost = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Mage.MageIceBombGhost_prefab).WaitForCompletion(), "DragonIceballGhost", false); TryBuildAsset("Primary Iceball Ghost", delegate { //IL_0022: 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_007e: 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) GameObject gameObject = ((Component)dragonIceballGhost.transform.Find("OrbCore")).gameObject; gameObject.transform.localScale = Vector3.one * 0.5f; ((Component)dragonIceballGhost.transform.Find("Beams")).gameObject.SetActive(true); ((Component)dragonIceballGhost.transform.Find("Base")).gameObject.SetActive(true); iceballMuzzlePrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Mage.MageIceExplosion_prefab).WaitForCompletion(), "IceCannonMuzzleVFX", false); iceballMuzzlePrefab.GetComponent<EffectComponent>().parentToReferencedTransform = false; Object.Destroy((Object)(object)((Component)iceballMuzzlePrefab.transform.Find("IceMesh")).gameObject); Object.Destroy((Object)(object)((Component)iceballMuzzlePrefab.transform.Find("RuneRings")).gameObject); }); Content.CreateAndAddEffectDef(iceballMuzzlePrefab); iceballPrefab.GetComponent<ProjectileController>().ghostPrefab = dragonIceballGhost; iceballImpactPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2_Chef.BoostedProjectileExplosionVFX_prefab).WaitForCompletion(), "IceBallExplosionVFX", false); TryBuildAsset("Primary Iceball Impact Explosion", delegate { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //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) //IL_0043: 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_0077: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) foreach (Transform item in iceballImpactPrefab.transform.Find("Dash, Bright")) { Transform val = item; ParticleSystem component = ((Component)val).GetComponent<ParticleSystem>(); MainModule main = component.main; val.localScale = Vector3.one * 0.5f; if (((Object)val).name == "Ring") { ((MainModule)(ref main)).startSizeX = new MinMaxCurve(6f); ((MainModule)(ref main)).startSizeY = new MinMaxCurve(6f); ((MainModule)(ref main)).startSizeZ = new MinMaxCurve(3f); ((Component)val).GetComponent<ParticleSystemRenderer>().alignment = (ParticleSystemRenderSpace)1; } else { ((MainModule)(ref main)).startSizeMultiplier = 0.5f; } } ShakeEmitter component2 = iceballImpactPrefab.GetComponent<ShakeEmitter>(); component2.wave.amplitude = 0.2f; component2.wave.frequency = 12f; component2.duration = 0.15f; component2.radius = 120f; GameObject val2 = Object.Instantiate<GameObject>(impactDecalBase, iceballImpactPrefab.transform, false); Decal component3 = val2.GetComponent<Decal>(); iceDecalMaterial = new Material(component3.Material); iceDecalMaterial.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_Base_Common_ColorRamps.texRampIce_png).WaitForCompletion()); iceDecalMaterial.SetColor("_Color", new Color(1f, 1f, 1f, 0.28f)); component3.Material = iceDecalMaterial; ((Object)val2).name = "IceImpactDecal"; val2.transform.localScale = Vector3.one * 10f; }); Content.CreateAndAddEffectDef(iceballImpactPrefab); iceballPrefab.GetComponent<ProjectileImpactExplosion>().impactEffect = iceballImpactPrefab; Content.AddProjectilePrefab(iceballPrefab); } private static void CreateHeavyFireball() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) heavyFireballPrefab = assetBundle.LoadAsset<GameObject>("HeavyFireballProjectile"); GameObject val = assetBundle.LoadAsset<GameObject>("FireballEruption"); GameObject heavyFireballGhost = PrefabAPI.InstantiateClone(fireballPrefab.GetComponent<ProjectileController>().ghostPrefab, "DragonFireballHeavyGhost", false); TryBuildAsset("Secondary Fireball Ghost", delegate { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_005d: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00d2: 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_0128: 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_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: 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_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_01f4: 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) heavyFireballGhost.transform.localScale = Vector3.one * 1.5f; MeshRenderer component = ((Component)heavyFireballGhost.transform.Find("OrbCore")).GetComponent<MeshRenderer>(); Material val2 = new Material(((Renderer)component).sharedMaterial); val2.SetColor("_TintColor", new Color(0f, 0.9f, 1f)); val2.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_DLC3_SolusAmalgamator.texRampSolusBlueFlame_png).WaitForCompletion()); val2.SetFloat("_AlphaBoost", 6f); ((Renderer)component).sharedMaterial = val2; ParticleSystemRenderer component2 = ((Component)heavyFireballGhost.transform.Find("Base")).GetComponent<ParticleSystemRenderer>(); Material val3 = new Material(((Renderer)component2).sharedMaterial); val3.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_DLC2_Items_SpeedBoostPickup.texElusiveAntlersRamp_png).WaitForCompletion()); val3.SetFloat("_AlphaBoost", 7f); ((Renderer)component2).sharedMaterial = val3; ((Component)heavyFireballGhost.transform.Find("FireballGhost(Clone)/Point light")).GetComponent<Light>().color = new Color(0f, 0.8f, 1f); Transform val4 = heavyFireballGhost.transform.Find("FireballGhost(Clone)/Flames"); val4.localScale = Vector3.one * 1.5f; ColorOverLifetimeModule colorOverLifetime = ((Component)val4).GetComponent<ParticleSystem>().colorOverLifetime; MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; Gradient gradient = ((MinMaxGradient)(ref color)).gradient; GradientColorKey[] colorKeys = gradient.colorKeys; colorKeys[0] = new GradientColorKey(new Color(0.02f, 0.7f, 1f), colorKeys[0].time); colorKeys[1] = new GradientColorKey(new Color(0.02f, 0.23f, 0.91f), colorKeys[1].time); gradient.colorKeys = colorKeys; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(gradient); Object.Destroy((Object)(object)((Component)heavyFireballGhost.transform.Find("Sparks, Trail")).gameObject); GameObject val5 = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)RoR2_DLC2_Chef.BoostedSearFireballGhost_prefab).WaitForCompletion()); val5.transform.Find("Particles/FireOutter").SetParent(heavyFireballGhost.transform, false); Object.Destroy((Object)(object)val5); }); heavyFireballPrefab.GetComponent<ProjectileController>().ghostPrefab = heavyFireballGhost; heavyFireballMuzzlePrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_Common_VFX.OmniExplosionVFXQuick_prefab).WaitForCompletion(), "FireballHeavyMuzzleVFX", false); TryBuildAsset("Secondary Fireball Muzzle VFX", delegate { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) heavyFireballMuzzlePrefab.transform.localScale = Vector3.one * 1.5f; ParticleSystemRenderer component = ((Component)heavyFireballMuzzlePrefab.transform.Find("ScaledHitsparks 1")).GetComponent<ParticleSystemRenderer>(); Material val2 = new Material(((Renderer)component).sharedMaterial); val2.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_DLC2_Items_SpeedBoostPickup.texSpeedBoostPickupThornRamp_png).WaitForCompletion()); ((Renderer)component).sharedMaterial = val2; component = ((Component)heavyFireballMuzzlePrefab.transform.Find("Unscaled Flames")).GetComponent<ParticleSystemRenderer>(); Material val3 = new Material(((Renderer)component).sharedMaterial); val3.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_DLC2_Items_SpeedBoostPickup.texSpeedBoostPickupThornRamp_png).WaitForCompletion()); ((Renderer)component).sharedMaterial = val3; ((Component)heavyFireballMuzzlePrefab.transform.Find("Point Light")).GetComponent<Light>().color = new Color(0f, 0.8f, 1f); }); Content.CreateAndAddEffectDef(heavyFireballMuzzlePrefab); heavyFireballImpactPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_LemurianBruiser.OmniExplosionVFXLemurianBruiserFireballImpact_prefab).WaitForCompletion(), "FireballHeavyImpactVFX", false); TryBuildAsset("Secondary Fireball Impact VFX", delegate { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: 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_0174: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_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_020d: 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_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: 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_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_035d: 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_0374: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Expected O, but got Unknown //IL_03f1: 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_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) Object.Destroy((Object)(object)((Component)heavyFireballImpactPrefab.transform.Find("ScaledHitsparks 1")).gameObject); ParticleSystemRenderer component = ((Component)heavyFireballImpactPrefab.transform.Find("UnscaledHitsparks 1")).GetComponent<ParticleSystemRenderer>(); Material val2 = new Material(((Renderer)component).sharedMaterial); val2.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_DLC2_Items_SpeedBoostPickup.texSpeedBoostPickupThornRamp_png).WaitForCompletion()); ((Renderer)component).sharedMaterial = val2; ColorOverLifetimeModule colorOverLifetime = ((Component)heavyFireballImpactPrefab.transform.Find("ScaledSmoke, Billboard")).GetComponent<ParticleSystem>().colorOverLifetime; MinMaxGradient color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; Gradient gradient = ((MinMaxGradient)(ref color)).gradient; GradientColorKey[] colorKeys = gradient.colorKeys; colorKeys[0] = new GradientColorKey(new Color(0.62f, 0.8f, 1f), colorKeys[0].time); colorKeys[1] = new GradientColorKey(new Color(0.38f, 0.44f, 0.64f), colorKeys[1].time); gradient.colorKeys = colorKeys; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(gradient); colorOverLifetime = ((Component)heavyFireballImpactPrefab.transform.Find("ScaledSmokeRing, Mesh")).GetComponent<ParticleSystem>().colorOverLifetime; color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; gradient = ((MinMaxGradient)(ref color)).gradient; colorKeys = gradient.colorKeys; colorKeys[0] = new GradientColorKey(new Color(0.62f, 0.8f, 1f), colorKeys[0].time); colorKeys[1] = new GradientColorKey(new Color(0.38f, 0.44f, 0.64f), colorKeys[1].time); gradient.colorKeys = colorKeys; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(gradient); colorOverLifetime = ((Component)heavyFireballImpactPrefab.transform.Find("Unscaled Smoke, Billboard")).GetComponent<ParticleSystem>().colorOverLifetime; color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; gradient = ((MinMaxGradient)(ref color)).gradient; colorKeys = gradient.colorKeys; colorKeys[0] = new GradientColorKey(new Color(0.62f, 0.8f, 1f), colorKeys[0].time); colorKeys[1] = new GradientColorKey(new Color(0.38f, 0.44f, 0.64f), colorKeys[1].time); gradient.colorKeys = colorKeys; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(gradient); component = ((Component)heavyFireballImpactPrefab.transform.Find("AreaIndicatorRing, Billboard")).GetComponent<ParticleSystemRenderer>(); Material val3 = new Material(((Renderer)component).sharedMaterial); val3.SetTexture("_RemapTex", Addressables.LoadAssetAsync<Texture>((object)RoR2_DLC2_Items_SpeedBoostPickup.texSpeedBoostPickupThornRamp_png).WaitForCompletion()); ((Renderer)component).sharedMaterial = val3; MainModule main = ((Component)heavyFireballImpactPrefab.transform.Find("Physics Sparks")).GetComponent<ParticleSystem>().main; ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0f, 0.41f, 0.72f), new Color(0.05f, 0.64f, 0.8f)); colorOverLifetime = ((Component)heavyFireballImpactPrefab.transform.Find("Flash, Soft Glow")).GetComponent<ParticleSystem>().colorOverLifetime; color = ((ColorOverLifetimeModule)(ref colorOverLifetime)).color; gradient = ((MinMaxGradient)(ref color)).gradient; colorKeys = gradient.colorKeys; colorKeys[0] = new GradientColorKey(new Color(0.62f, 0.8f, 1f), colorKeys[0].time); colorKeys[1] = new GradientColorKey(new Color(0.38f, 0.44f, 0.64f)