using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using DrogozSurvivor.Components; using DrogozSurvivor.Modules; using DrogozSurvivor.Modules.Characters; using DrogozSurvivor.Networking; using DrogozSurvivor.SkillStates; using DrogozSurvivor.Survivors.Drogoz; using EntityStates; using EntityStates.AI.Walker; using HG; using HG.BlendableTypes; using KinematicCharacterController; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using RoR2BepInExPack.GameAssetPathsBetter; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("DrogozSurvivor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+f6825da06efe7c533e2780ed4b201b8673a9e50e")] [assembly: AssemblyProduct("DrogozSurvivor")] [assembly: AssemblyTitle("DrogozSurvivor")] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace DrogozSurvivor { [BepInDependency(/*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.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Personal.DrogozSurvivor", "DrogozSurvivor", "0.1.40")] public class DrogozSurvivorPlugin : BaseUnityPlugin { public const string MODUID = "com.Personal.DrogozSurvivor"; public const string MODNAME = "DrogozSurvivor"; public const string MODVERSION = "0.1.40"; public const string DEVELOPER_PREFIX = "PERSONAL"; public static DrogozSurvivorPlugin instance; private void Awake() { instance = this; Log.Init(((BaseUnityPlugin)this).Logger); DrogozConfig.Init(); DrogozDamageTypes.Init(); DrogozCards.Init(); DrogozAfterburner.Init(); DrogozEasyTarget.Init(); DrogozSittingDuck.Init(); DrogozIronclad.Init(); DrogozMark.Init(); DrogozTalents.Init(); DrogozDragonPunchHooks.Init(); DrogozModelRestorer.Init(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); NetworkingAPI.RegisterMessageType(); Projectiles.Init(); Language.Init(); new DrogozSurvivor.Survivors.Drogoz.DrogozSurvivor().Initialize(); DrogozCardCatalog.InitIcons(); DrogozCards.RefreshBuffIcons(); DrogozCardLoadoutRows.Init(); new ContentPacks().Initialize(); } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { Debug("General", data); } internal static void Debug(string tag, object data) { if (_logSource != null && DrogozConfig.IsDebugTagEnabled(tag)) { _logSource.LogDebug((object)("[" + tag + "] " + 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); } } } namespace DrogozSurvivor.Networking { public class SyncDragonPunchDamage : INetMessage, ISerializableObject { private NetworkInstanceId attackerNetId; private NetworkInstanceId victimNetId; private float damage; private float proc; private Vector3 position; public SyncDragonPunchDamage() { } public SyncDragonPunchDamage(NetworkInstanceId attackerNetId, NetworkInstanceId victimNetId, float damage, float proc, Vector3 position) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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) this.attackerNetId = attackerNetId; this.victimNetId = victimNetId; this.damage = damage; this.proc = proc; this.position = position; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) writer.Write(attackerNetId); writer.Write(victimNetId); writer.Write(damage); writer.Write(proc); writer.Write(position.x); writer.Write(position.y); writer.Write(position.z); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_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) attackerNetId = reader.ReadNetworkId(); victimNetId = reader.ReadNetworkId(); damage = reader.ReadSingle(); proc = reader.ReadSingle(); position = new Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()); } public void OnReceived() { //IL_0009: 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_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) //IL_004f: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown if (NetworkServer.active) { GameObject val = Util.FindNetworkObject(attackerNetId); GameObject val2 = Util.FindNetworkObject(victimNetId); HealthComponent val3 = (Object.op_Implicit((Object)(object)val2) ? val2.GetComponent() : null); if (Object.op_Implicit((Object)(object)val3) && val3.alive) { DamageInfo val4 = new DamageInfo { attacker = val, inflictor = val, damage = damage, position = position, force = Vector3.zero, crit = false, damageColorIndex = (DamageColorIndex)0, procCoefficient = proc, damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)8) }; val3.TakeDamage(val4); GlobalEventManager.instance.OnHitEnemy(val4, val2); GlobalEventManager.instance.OnHitAll(val4, val2); } } } } public class SyncDrogozCards : INetMessage, ISerializableObject { private NetworkInstanceId bodyNetId; private byte[] cardIndices = new byte[5]; private byte[] ranks = new byte[5]; public SyncDrogozCards() { } public SyncDrogozCards(NetworkInstanceId bodyNetId, CardLoadout loadout) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) this.bodyNetId = bodyNetId; for (int i = 0; i < 5; i++) { CardSlot cardSlot = ((loadout != null && loadout.Slots != null) ? loadout.Slots[i] : null); int num = ((cardSlot != null) ? DrogozCardCatalog.IndexOf(cardSlot.CardId) : (-1)); cardIndices[i] = (byte)((num >= 0) ? ((uint)num) : 255u); ranks[i] = (byte)((cardSlot != null) ? ((uint)Mathf.Clamp(cardSlot.Rank, 0, 5)) : 0u); } } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(bodyNetId); for (int i = 0; i < 5; i++) { writer.Write(cardIndices[i]); writer.Write(ranks[i]); } } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) bodyNetId = reader.ReadNetworkId(); for (int i = 0; i < 5; i++) { cardIndices[i] = reader.ReadByte(); ranks[i] = reader.ReadByte(); } } public void OnReceived() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } GameObject val = Util.FindNetworkObject(bodyNetId); if (!Object.op_Implicit((Object)(object)val)) { return; } DrogozCardLoadoutComponent drogozCardLoadoutComponent = val.GetComponent(); if (!Object.op_Implicit((Object)(object)drogozCardLoadoutComponent)) { drogozCardLoadoutComponent = val.AddComponent(); } CardLoadout cardLoadout = new CardLoadout(); for (int i = 0; i < 5; i++) { int num = cardIndices[i]; if (num < DrogozCardCatalog.Cards.Length) { cardLoadout.SetSlot(i, DrogozCardCatalog.Cards[num].Id, ranks[i]); } } drogozCardLoadoutComponent.SetLoadout(cardLoadout); Log.Debug("Networking", $"Received card loadout for netId={bodyNetId} complete={cardLoadout.IsComplete()} points={cardLoadout.TotalPoints()}"); } } public class SyncFireSpitRefund : INetMessage, ISerializableObject { private NetworkInstanceId bodyNetId; private float seconds; public SyncFireSpitRefund() { } public SyncFireSpitRefund(NetworkInstanceId bodyNetId, float seconds) { //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) this.bodyNetId = bodyNetId; this.seconds = seconds; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(bodyNetId); writer.Write(seconds); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) bodyNetId = reader.ReadNetworkId(); seconds = reader.ReadSingle(); } public void OnReceived() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds)) { return; } GameObject val = Util.FindNetworkObject(bodyNetId); if (Object.op_Implicit((Object)(object)val)) { CharacterBody component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component) && ((NetworkBehaviour)component).hasAuthority) { FireSpit.ReduceCooldown(component, seconds); } } } } public class SyncSalvoRefund : INetMessage, ISerializableObject { private NetworkInstanceId bodyNetId; private float seconds; public SyncSalvoRefund() { } public SyncSalvoRefund(NetworkInstanceId bodyNetId, float seconds) { //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) this.bodyNetId = bodyNetId; this.seconds = seconds; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(bodyNetId); writer.Write(seconds); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) bodyNetId = reader.ReadNetworkId(); seconds = reader.ReadSingle(); } public void OnReceived() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds)) { return; } GameObject val = Util.FindNetworkObject(bodyNetId); if (Object.op_Implicit((Object)(object)val)) { CharacterBody component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component) && ((NetworkBehaviour)component).hasAuthority) { DrogozCards.ReduceSalvoCooldown(component, seconds); } } } } public class SyncThrustRefund : INetMessage, ISerializableObject { private NetworkInstanceId bodyNetId; private float seconds; public SyncThrustRefund() { } public SyncThrustRefund(NetworkInstanceId bodyNetId, float seconds) { //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) this.bodyNetId = bodyNetId; this.seconds = seconds; } public void Serialize(NetworkWriter writer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) writer.Write(bodyNetId); writer.Write(seconds); } public void Deserialize(NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) bodyNetId = reader.ReadNetworkId(); seconds = reader.ReadSingle(); } public void OnReceived() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds)) { return; } GameObject val = Util.FindNetworkObject(bodyNetId); if (Object.op_Implicit((Object)(object)val)) { CharacterBody component = val.GetComponent(); if (Object.op_Implicit((Object)(object)component) && ((NetworkBehaviour)component).hasAuthority) { Thrust.ReduceCooldown(component, seconds); } } } } } namespace DrogozSurvivor.Modules { internal static class Asset { internal static Dictionary loadedBundles = new Dictionary(); internal static AssetBundle LoadAssetBundle(string bundleName) { if (bundleName == "myassetbundle") { Log.Error("AssetBundle name hasn't been changed. not loading any assets to avoid conflicts.\nMake sure to rename your assetbundle filename and rename the AssetBundleName field in your character setup code "); return null; } if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } AssetBundle val = null; try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)DrogozSurvivorPlugin.instance).Info.Location); string text = Path.Combine(directoryName, "AssetBundles", bundleName); if (!File.Exists(text)) { text = Path.Combine(directoryName, bundleName); } val = AssetBundle.LoadFromFile(text); } catch (Exception arg) { Log.Error($"Error loading asset bundle, {bundleName}. Your asset bundle must be in a folder next to your mod dll called 'AssetBundles'. Follow the guide to build and install your mod correctly!\n{arg}"); } loadedBundles[bundleName] = val; return val; } internal static GameObject CloneTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } val.GetComponent().speed = 250f; val.GetComponent().length = 50f; Content.CreateAndAddEffectDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren(); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { ((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo(); } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial)) { ((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo(); } } } internal static GameObject LoadCrosshair(string crosshairName) { GameObject val = LegacyResourcesAPI.Load("Prefabs/Crosshair/" + crosshairName + "Crosshair"); if ((Object)(object)val == (Object)null) { Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard"); return LegacyResourcesAPI.Load("Prefabs/Crosshair/StandardCrosshair"); } return val; } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform) { return assetBundle.LoadEffect(resourceName, "", parentToTransform); } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name); return null; } val.AddComponent().duration = 12f; val.AddComponent(); val.AddComponent().vfxPriority = (VFXPriority)2; EffectComponent obj = val.AddComponent(); obj.applyScale = false; obj.effectIndex = (EffectIndex)(-1); obj.parentToReferencedTransform = parentToTransform; obj.positionAtReferencedTransform = true; obj.soundName = soundName; Content.CreateAndAddEffectDef(val); return val; } internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName) { GameObject val = assetBundle.LoadAsset(ghostName); if ((Object)(object)val == (Object)null) { Log.Error("Failed to load ghost prefab " + ghostName); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } if (!Object.op_Implicit((Object)(object)val.GetComponent())) { val.AddComponent(); } ConvertAllRenderersToHopooShader(val); return val; } internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/Projectiles/" + prefabName), newPrefabName); } internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName) { GameObject val = assetBundle.LoadAsset(newPrefabName); if ((Object)(object)val == (Object)null) { Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name); return null; } Content.AddProjectilePrefab(val); return val; } } public static class Config { public static ConfigFile MyConfig = ((BaseUnityPlugin)DrogozSurvivorPlugin.instance).Config; public static ConfigEntry 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 BindAndOptions(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired); } public static ConfigEntry BindAndOptions(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 result = MyConfig.Bind(section, name, defaultValue, description); Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); return result; } public static ConfigEntry 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(ConfigEntry entry, float min, float max, bool restartRequired) { } public static bool GetKeyPressed(KeyboardShortcut entry) { //IL_0010: 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) 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 CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //IL_0014: 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) SurvivorDef obj = ScriptableObject.CreateInstance(); obj.bodyPrefab = bodyPrefab; obj.displayPrefab = displayPrefab; obj.primaryColor = charColor; obj.cachedName = ((Object)bodyPrefab).name.Replace("Body", ""); obj.displayNameToken = tokenPrefix + "NAME"; obj.descriptionToken = tokenPrefix + "DESCRIPTION"; obj.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR"; obj.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE"; obj.desiredSortPosition = sortPosition; obj.unlockableDef = unlockableDef; AddSurvivorDef(obj); } internal static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, AssetReferenceT achievementIconRef) { UnlockableDef obj = ScriptableObject.CreateInstance(); obj.cachedName = identifier; obj.nameToken = nameToken; obj.achievementIconRef = achievementIconRef; AddUnlockableDef(obj); return obj; } 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) BuffDef obj = ScriptableObject.CreateInstance(); ((Object)obj).name = buffName; obj.buffColor = buffColor; obj.canStack = canStack; obj.isDebuff = isDebuff; obj.eliteDef = null; obj.iconSprite = buffIcon; AddBuffDef(obj); return obj; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab) { //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) //IL_000c: Expected O, but got Unknown //IL_000d: 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 obj = ScriptableObject.CreateInstance(); obj.akId = AkSoundEngine.GetIDFromString(eventName); obj.eventName = eventName; AddNetworkSoundEventDef(obj); return obj; } } internal class ContentPacks : IContentPackProvider { private static readonly FieldInfo IdentifierField = typeof(ContentPack).GetField("_identifier", BindingFlags.Instance | BindingFlags.NonPublic); internal ContentPack contentPack = new ContentPack(); public static List bodyPrefabs = new List(); public static List masterPrefabs = new List(); public static List projectilePrefabs = new List(); public static List survivorDefs = new List(); public static List unlockableDefs = new List(); public static List skillFamilies = new List(); public static List skillDefs = new List(); public static List entityStates = new List(); public static List buffDefs = new List(); public static List effectDefs = new List(); public static List networkSoundEventDefs = new List(); public string identifier => "com.Personal.DrogozSurvivor"; public void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) { if (IdentifierField == null) { throw new InvalidOperationException("ContentPack._identifier was not found."); } IdentifierField.SetValue(contentPack, 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; } } internal static class DrogozAfterburner { internal static BuffDef buffDef; private static bool hooked; internal static void Init() { //IL_0048: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)buffDef)) { BuffDef cloakSpeed = Buffs.CloakSpeed; string source; Sprite val = DrogozIcons.LoadBuffIcon(null, null, null, "afterburner.png", out source); buffDef = Content.CreateAndAddBuff("PERSONAL_DROGOZ_AFTERBURNER", val, (Color)(Object.op_Implicit((Object)(object)cloakSpeed) ? cloakSpeed.buffColor : new Color(0.35f, 0.85f, 1f)), canStack: false, isDebuff: false); buffDef.isCooldown = false; Log.Debug("Buffs", $"Afterburner icon loaded={(Object)(object)val != (Object)null} source={source}"); if (!hooked) { RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(HandleStatCoefficients); hooked = true; } } } internal static void Apply(CharacterBody body, float duration) { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)buffDef) && !(duration <= 0f)) { body.AddTimedBuff(buffDef, duration); Log.Debug("Buffs", $"Afterburner applied body={((Object)body).name} duration={duration:0.0}s hasIcon={(Object)(object)buffDef.iconSprite != (Object)null}"); } } private static void HandleStatCoefficients(CharacterBody sender, StatHookEventArgs args) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)sender) && Object.op_Implicit((Object)(object)buffDef) && sender.GetBuffCount(buffDef.buffIndex) > 0) { args.moveSpeedMultAdd += Mathf.Max(0f, DrogozConfig.ThrustMoveSpeedBonus.Value); } } } [Serializable] public class CardDefinition { public string Id; public string Name; public string Description; public string IconTexture; [NonSerialized] public Sprite Icon; } internal static class DrogozCardCatalog { internal const int SlotCount = 5; internal const int PointLimit = 15; internal const int MaxRank = 5; internal static readonly CardDefinition[] Cards = new CardDefinition[16] { new CardDefinition { Id = "rocket_radius", Name = "Wide Blast", Description = "Each rank adds 0.25m to the Rocket Launcher explosion radius.", IconTexture = "card_rocket_damage" }, new CardDefinition { Id = "rocket_jump", Name = "Rocket Jump", Description = "Each rank increases rocket self-knockback by 15%.", IconTexture = "card_last_rocket" }, new CardDefinition { Id = "hot_swap", Name = "Hot Swap", Description = "Each rank gives a 6% chance to refund one Primary rocket on a rocket hit. Failed attempts build toward a guaranteed refund. Salvo waits up to 4s for in-flight refunds and can add up to 6 extra rockets.", IconTexture = "card_salvo_recycling" }, new CardDefinition { Id = "fire_spit_sustain", Name = "Lung Capacity", Description = "Each rank heals 1% max health per unique Fire Spit detonation enemy hit. Healing is capped at 10% per detonation.", IconTexture = "card_fire_spit_sustain" }, new CardDefinition { Id = "scent_trail", Name = "Scent Trail", Description = "Each rank reduces Fire Spit cooldown by 0.25s per unique detonation enemy hit. Refund is capped at 5s per detonation (6 second cooldown).", IconTexture = "card_rocket_boss" }, new CardDefinition { Id = "fire_spit_reach", Name = "Expanded Blast", Description = "Each rank adds 0.7m to the Fire Spit detonation radius.", IconTexture = "card_rocket_radius" }, new CardDefinition { Id = "masterful", Name = "Lasting Brand", Description = "Each rank adds 0.5s to Draconic Brand duration when a direct Fire Spit hit lands.", IconTexture = "card_draconic_brand" }, new CardDefinition { Id = "thrust_plating", Name = "Survival", Description = "Each rank gives 5% damage reduction for 3 seconds after Thrust.", IconTexture = "card_thrust_plating" }, new CardDefinition { Id = "thrust_force", Name = "Propel", Description = "Each rank increases Thrust impulse and velocity by 10%.", IconTexture = "card_rocket_jump" }, new CardDefinition { Id = "emergency_flare", Name = "Emergency Flare", Description = "Each rank heals 2% max health immediately after Thrust.", IconTexture = "card_salvo_damage" }, new CardDefinition { Id = "salvo_recycling", Name = "Spitfire", Description = "Salvo: each rank reduces Salvo cooldown by 0.2s per unique enemy hit (cap 5s per barrage). Dragon Punch: after Dragon Punch ends, gain 10% movement speed per rank for 3s (cap 50%).", IconTexture = "card_fire_spit_reach" }, new CardDefinition { Id = "bask", Name = "Bask", Description = "Salvo: each rank heals 1% max health per unique Salvo enemy hit (cap 10% per barrage). Dragon Punch: each rank heals 2% max health per Dragon Punch kill (cap 10% per punch).", IconTexture = "card_emergency_flare" }, new CardDefinition { Id = "hyper_boost", Name = "Hyper Boost", Description = "Salvo: each rank restores 1% Booster fuel per unique Salvo enemy hit (cap 20% per barrage). Dragon Punch: each rank grants 10% damage reduction while channeling (cap 50%).", IconTexture = "card_overdrive" }, new CardDefinition { Id = "booster_control", Name = "Altitude", Description = "Each rank adds 5% Booster strafing and steering while flying.", IconTexture = "card_booster_reserve" }, new CardDefinition { Id = "booster_capacity", Name = "Adrenaline", Description = "When health drops below 30%, gain 10% movement speed per rank for 2 seconds (10 second cooldown).", IconTexture = "card_booster_control" }, new CardDefinition { Id = "overdrive", Name = "Concussive Round", Description = "Direct Rocket Launcher hits have an 8% chance per rank to stun the enemy hit for 0.5 seconds (5 second cooldown).", IconTexture = "card_fire_spit_brand_duration" } }; internal static void InitIcons() { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) DrogozSurvivor.Survivors.Drogoz.DrogozSurvivor instance = DrogozSurvivor.Survivors.Drogoz.DrogozSurvivor.instance; if (instance == null || !Object.op_Implicit((Object)(object)instance.assetBundle)) { return; } for (int i = 0; i < Cards.Length; i++) { CardDefinition cardDefinition = Cards[i]; Texture2D val = instance.assetBundle.LoadAsset(cardDefinition.IconTexture); if (Object.op_Implicit((Object)(object)val)) { cardDefinition.Icon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)cardDefinition.Icon).name = cardDefinition.Id; } } } internal static CardDefinition Find(string id) { if (string.IsNullOrEmpty(id)) { return null; } for (int i = 0; i < Cards.Length; i++) { if (Cards[i].Id == id) { return Cards[i]; } } return null; } internal static int IndexOf(string id) { if (string.IsNullOrEmpty(id)) { return -1; } for (int i = 0; i < Cards.Length; i++) { if (Cards[i].Id == id) { return i; } } return -1; } } [Serializable] public class CardSlot { public string CardId = ""; public int Rank; } [Serializable] public class CardLoadout { public CardSlot[] Slots = new CardSlot[5]; public CardLoadout() { for (int i = 0; i < Slots.Length; i++) { Slots[i] = new CardSlot(); } } public bool IsComplete() { if (Slots == null || Slots.Length != 5 || TotalPoints() != 15) { return false; } for (int i = 0; i < Slots.Length; i++) { CardSlot cardSlot = Slots[i]; if (cardSlot == null || string.IsNullOrEmpty(cardSlot.CardId) || cardSlot.Rank <= 0 || DrogozCardCatalog.Find(cardSlot.CardId) == null) { return false; } for (int j = i + 1; j < Slots.Length; j++) { if (Slots[j] != null && Slots[j].CardId == cardSlot.CardId) { return false; } } } return true; } public int TotalPoints() { if (Slots == null) { return 0; } int num = 0; for (int i = 0; i < Slots.Length; i++) { if (Slots[i] != null && !string.IsNullOrEmpty(Slots[i].CardId)) { num += Mathf.Clamp(Slots[i].Rank, 0, 5); } } return num; } public int GetRank(string cardId) { if (string.IsNullOrEmpty(cardId) || Slots == null) { return 0; } for (int i = 0; i < Slots.Length; i++) { if (Slots[i] != null && Slots[i].CardId == cardId) { return Mathf.Clamp(Slots[i].Rank, 0, 5); } } return 0; } public int FindSlot(string cardId) { if (string.IsNullOrEmpty(cardId) || Slots == null) { return -1; } for (int i = 0; i < Slots.Length; i++) { if (Slots[i] != null && Slots[i].CardId == cardId) { return i; } } return -1; } public bool CanSetRank(string cardId, int rank) { if (Slots == null || rank < 0 || rank > 5 || DrogozCardCatalog.Find(cardId) == null) { return false; } int rank2 = GetRank(cardId); return TotalPoints() - rank2 + rank <= 15; } public void SetSlot(int slotIndex, string cardId, int rank) { if (Slots == null || slotIndex < 0 || slotIndex >= Slots.Length) { return; } if (Slots[slotIndex] == null) { Slots[slotIndex] = new CardSlot(); } if (rank <= 0 || string.IsNullOrEmpty(cardId) || DrogozCardCatalog.Find(cardId) == null) { ClearSlot(slotIndex); return; } rank = Mathf.Clamp(rank, 1, 5); int num = TotalPoints(); if (!string.IsNullOrEmpty(Slots[slotIndex].CardId)) { num -= Mathf.Clamp(Slots[slotIndex].Rank, 0, 5); } for (int i = 0; i < Slots.Length; i++) { if (i != slotIndex && Slots[i] != null && Slots[i].CardId == cardId) { num -= Mathf.Clamp(Slots[i].Rank, 0, 5); } } if (num + rank > 15) { return; } for (int j = 0; j < Slots.Length; j++) { if (j != slotIndex && Slots[j] != null && Slots[j].CardId == cardId) { ClearSlot(j); } } Slots[slotIndex].CardId = cardId; Slots[slotIndex].Rank = rank; } public void ClearSlot(int slotIndex) { if (Slots != null && slotIndex >= 0 && slotIndex < Slots.Length) { if (Slots[slotIndex] == null) { Slots[slotIndex] = new CardSlot(); } Slots[slotIndex].CardId = ""; Slots[slotIndex].Rank = 0; } } public CardLoadout Clone() { CardLoadout cardLoadout = new CardLoadout(); if (Slots == null || Slots.Length != 5) { return cardLoadout; } for (int i = 0; i < Slots.Length; i++) { cardLoadout.Slots[i].CardId = ((Slots[i] != null) ? Slots[i].CardId : ""); cardLoadout.Slots[i].Rank = ((Slots[i] != null) ? Slots[i].Rank : 0); } return cardLoadout; } public void Save() { DrogozCardLoadoutStorage.Save(this); } } internal static class DrogozCardLoadoutStorage { private static readonly string FilePath = Path.Combine(Paths.ConfigPath, "com.Personal.DrogozSurvivor.cards.json"); private static CardLoadout current; internal static CardLoadout Current { get { if (current == null) { current = Load(); } return current; } set { current = Normalize(value); } } internal static event Action Changed; internal static CardLoadout Load() { if (!File.Exists(FilePath)) { Log.Debug("Loadouts", "No saved card loadout file. Using empty loadout."); return new CardLoadout(); } try { CardLoadout cardLoadout = Normalize(JsonUtility.FromJson(File.ReadAllText(FilePath))); Log.Debug("Loadouts", $"Loaded card loadout complete={cardLoadout.IsComplete()} points={cardLoadout.TotalPoints()}/{15}"); return cardLoadout; } catch (Exception ex) { Log.Warning("Could not load Drogoz cards: " + ex.Message); return new CardLoadout(); } } internal static void Save(CardLoadout loadout) { if (loadout == null || !loadout.IsComplete()) { Log.Debug("Loadouts", $"Refused to save invalid card loadout complete={loadout?.IsComplete() ?? false} points={loadout?.TotalPoints() ?? 0}/{15}"); return; } current = Normalize(loadout); Log.Debug("Loadouts", $"Saved valid card loadout points={current.TotalPoints()}/{15}"); try { Directory.CreateDirectory(Path.GetDirectoryName(FilePath)); File.WriteAllText(FilePath, JsonUtility.ToJson((object)current, true)); } catch (Exception ex) { Log.Warning("Could not save Drogoz cards: " + ex.Message); } DrogozCardLoadoutStorage.Changed?.Invoke(); } private static CardLoadout Normalize(CardLoadout loadout) { if (loadout == null || loadout.Slots == null || loadout.Slots.Length != 5) { return new CardLoadout(); } CardLoadout cardLoadout = loadout.Clone(); for (int i = 0; i < cardLoadout.Slots.Length; i++) { if (cardLoadout.Slots[i] == null) { cardLoadout.Slots[i] = new CardSlot(); } if (DrogozCardCatalog.Find(cardLoadout.Slots[i].CardId) == null) { cardLoadout.ClearSlot(i); } else { cardLoadout.Slots[i].Rank = Mathf.Clamp(cardLoadout.Slots[i].Rank, 0, 5); } if (cardLoadout.Slots[i].Rank <= 0) { cardLoadout.ClearSlot(i); } } for (int j = 0; j < cardLoadout.Slots.Length; j++) { for (int k = j + 1; k < cardLoadout.Slots.Length; k++) { if (!string.IsNullOrEmpty(cardLoadout.Slots[j].CardId) && cardLoadout.Slots[j].CardId == cardLoadout.Slots[k].CardId) { cardLoadout.ClearSlot(k); } } } while (cardLoadout.TotalPoints() > 15) { bool flag = false; for (int num = cardLoadout.Slots.Length - 1; num >= 0; num--) { if (cardLoadout.Slots[num].Rank > 0) { cardLoadout.Slots[num].Rank--; if (cardLoadout.Slots[num].Rank <= 0) { cardLoadout.ClearSlot(num); } flag = true; break; } } if (!flag) { break; } } return cardLoadout; } } internal static class DrogozCards { internal const float SalvoRefundCap = 5f; internal const float SalvoBaseRefundCap = 4.5f; internal const float SalvoBaseRefundPerHit = 0.225f; internal const float ScentTrailRefundCap = 5f; internal const float ScentTrailCooldown = 6f; internal const float ConcussiveCooldown = 5f; internal const float HotSwapChancePerRank = 0.06f; internal const int HotSwapSalvoExtraCap = 6; internal const float SpitfireSpeedDuration = 3f; internal const float SpitfireSpeedPerRank = 0.1f; internal static BuffDef thrustPlatingBuff; internal static BuffDef baskBuff; internal static BuffDef adrenalineBuff; internal static BuffDef wyrmJetsAirBuff; internal static BuffDef spitfireBuff; private static bool hooked; internal static void Init() { //IL_0048: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0180: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)thrustPlatingBuff)) { BuffDef armorBoost = Buffs.ArmorBoost; thrustPlatingBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_THRUST_PLATING", Object.op_Implicit((Object)(object)armorBoost) ? armorBoost.iconSprite : null, (Color)(Object.op_Implicit((Object)(object)armorBoost) ? armorBoost.buffColor : new Color(0.6f, 0.8f, 1f)), canStack: false, isDebuff: false); thrustPlatingBuff.isCooldown = false; thrustPlatingBuff.isHidden = false; baskBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_BASK", null, new Color(1f, 0.45f, 0.1f), canStack: false, isDebuff: false); baskBuff.isCooldown = false; baskBuff.isHidden = false; adrenalineBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_ADRENALINE", null, new Color(1f, 0.65f, 0.2f), canStack: false, isDebuff: false); adrenalineBuff.isCooldown = false; adrenalineBuff.isHidden = false; wyrmJetsAirBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_WYRM_JETS_AIR", DrogozIcons.LoadEmbeddedSprite("thermalshielding.png"), new Color(1f, 0.55f, 0.15f), canStack: false, isDebuff: false); wyrmJetsAirBuff.isCooldown = false; wyrmJetsAirBuff.isHidden = false; spitfireBuff = Content.CreateAndAddBuff("PERSONAL_DROGOZ_SPITFIRE_SPEED", null, new Color(1f, 0.6f, 0.2f), canStack: false, isDebuff: false); spitfireBuff.isCooldown = false; spitfireBuff.isHidden = false; if (!hooked) { HealthComponent.TakeDamage += new hook_TakeDamage(HandleTakeDamage); CharacterBody.onBodyAwakeGlobal += HandleBodyAwake; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(HandleStatCoefficients); hooked = true; } } } internal static void RefreshBuffIcons() { CardDefinition cardDefinition = DrogozCardCatalog.Find("thrust_plating"); CardDefinition cardDefinition2 = DrogozCardCatalog.Find("bask"); CardDefinition cardDefinition3 = DrogozCardCatalog.Find("booster_capacity"); CardDefinition cardDefinition4 = DrogozCardCatalog.Find("salvo_recycling"); if (cardDefinition != null && Object.op_Implicit((Object)(object)cardDefinition.Icon) && Object.op_Implicit((Object)(object)thrustPlatingBuff)) { thrustPlatingBuff.iconSprite = cardDefinition.Icon; } if (cardDefinition2 != null && Object.op_Implicit((Object)(object)cardDefinition2.Icon) && Object.op_Implicit((Object)(object)baskBuff)) { baskBuff.iconSprite = cardDefinition2.Icon; } if (cardDefinition3 != null && Object.op_Implicit((Object)(object)cardDefinition3.Icon) && Object.op_Implicit((Object)(object)adrenalineBuff)) { adrenalineBuff.iconSprite = cardDefinition3.Icon; } if (cardDefinition4 != null && Object.op_Implicit((Object)(object)cardDefinition4.Icon) && Object.op_Implicit((Object)(object)spitfireBuff)) { spitfireBuff.iconSprite = cardDefinition4.Icon; } Log.Debug("Buffs", $"Card buff icons: Survival={cardDefinition != null && (Object)(object)cardDefinition.Icon != (Object)null} Bask={cardDefinition2 != null && (Object)(object)cardDefinition2.Icon != (Object)null} Adrenaline={cardDefinition3 != null && (Object)(object)cardDefinition3.Icon != (Object)null}"); } internal static int GetRank(CharacterBody body, string cardId) { if (!DrogozConfig.LoadoutCardsEnabled.Value || !Object.op_Implicit((Object)(object)body) || string.IsNullOrEmpty(cardId)) { return 0; } DrogozCardLoadoutComponent component = ((Component)body).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return 0; } return component.GetRank(cardId); } private static void HandleStatCoefficients(CharacterBody body, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)body)) { return; } if (Object.op_Implicit((Object)(object)adrenalineBuff) && body.HasBuff(adrenalineBuff)) { int rank = GetRank(body, "booster_capacity"); if (rank > 0) { args.moveSpeedMultAdd += 0.1f * (float)rank; } } if (Object.op_Implicit((Object)(object)spitfireBuff) && body.HasBuff(spitfireBuff)) { int rank2 = GetRank(body, "salvo_recycling"); if (rank2 > 0) { args.moveSpeedMultAdd += 0.1f * (float)rank2; } } } private static void HandleBodyAwake(CharacterBody body) { InitializeBodyLoadout(body); } internal static bool InitializeBodyLoadout(CharacterBody body) { //IL_00f7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !body.isPlayerControlled || (NetworkClient.active && !body.hasEffectiveAuthority)) { return false; } DrogozCardLoadoutComponent drogozCardLoadoutComponent = ((Component)body).GetComponent(); if (!Object.op_Implicit((Object)(object)drogozCardLoadoutComponent)) { drogozCardLoadoutComponent = ((Component)body).gameObject.AddComponent(); } if (!DrogozConfig.LoadoutCardsEnabled.Value) { drogozCardLoadoutComponent.SetLoadout(new CardLoadout()); return true; } CardLoadout current = DrogozCardLoadoutStorage.Current; Log.Debug("Networking", $"Body loadout init {((Object)body).name} server={NetworkServer.active} client={NetworkClient.active} authority={body.hasEffectiveAuthority} localComplete={current.IsComplete()} points={current.TotalPoints()}"); if (NetworkServer.active && body.hasEffectiveAuthority) { drogozCardLoadoutComponent.SetLoadout(current); } if (NetworkClient.active && body.hasEffectiveAuthority) { NetworkIdentity component = ((Component)body).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { NetMessageExtensions.Send((INetMessage)(object)new SyncDrogozCards(component.netId, current), (NetworkDestination)2); } } return true; } internal static void ApplyThrustPlating(CharacterBody body) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) int rank = GetRank(body, "thrust_plating"); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)thrustPlatingBuff) && rank > 0) { body.AddTimedBuff(thrustPlatingBuff, 3f); Log.Debug("Buffs", $"Survival applied body={((Object)body).name} rank={rank} reduction={0.05f * (float)rank:0.00} duration=3s buffIndex={thrustPlatingBuff.buffIndex} hasIcon={(Object)(object)thrustPlatingBuff.iconSprite != (Object)null}"); } } internal static void HealEmergencyFlare(CharacterBody body) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) int rank = GetRank(body, "emergency_flare"); if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && rank > 0) { float num = body.maxHealth * 0.02f * (float)rank; body.healthComponent.Heal(num, default(ProcChainMask), true); Log.Debug("Abilities", $"Emergency Flare healed body={((Object)body).name} rank={rank} amount={num:0.0}"); } } internal static void HealFireSpitSustain(CharacterBody body, float healPercent) { //IL_0037: 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) if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && !(healPercent <= 0f)) { float num = body.maxHealth * healPercent; body.healthComponent.Heal(num, default(ProcChainMask), true); Log.Debug("Abilities", $"Lung Capacity healed body={((Object)body).name} percent={healPercent:0.00} amount={num:0.0}"); } } internal static float GetFireSpitRadius(CharacterBody body) { return Mathf.Max(0.5f, DrogozConfig.FireSpitDetonationRadius.Value + 0.7f * (float)GetRank(body, "fire_spit_reach")); } internal static float GetRocketRadius(CharacterBody body, float baseRadius) { int rank = GetRank(body, "rocket_radius"); float num = Mathf.Max(0.5f, baseRadius + 0.25f * (float)rank); if (rank > 0) { Log.Debug("Abilities", $"Wide Blast body={((Object)body).name} rank={rank} base={baseRadius:0.00} radius={num:0.00}"); } return num; } internal static float GetRocketSelfKnockbackMultiplier(CharacterBody body) { int rank = GetRank(body, "rocket_jump"); if (rank > 0) { Log.Debug("Abilities", $"Rocket Jump body={((Object)body).name} rank={rank} multiplier={1f + 0.15f * (float)rank:0.00}"); } return 1f + 0.15f * (float)rank; } internal static float GetThrustForceMultiplier(CharacterBody body) { int rank = GetRank(body, "thrust_force"); float num = Mathf.Max(0f, DrogozConfig.ThrustForceMultiplier.Value) * (1f + 0.1f * (float)rank); if (rank > 0) { Log.Debug("Abilities", $"Propel body={((Object)body).name} rank={rank} forceMultiplier={num:0.00}"); } return num; } internal static float GetBoosterControlMultiplier(CharacterBody body) { return 1f + 0.05f * (float)GetRank(body, "booster_control"); } internal static bool TryBeginScentTrailDetonation(CharacterBody owner) { int rank = GetRank(owner, "scent_trail"); DrogozCardLoadoutComponent drogozCardLoadoutComponent = (Object.op_Implicit((Object)(object)owner) ? ((Component)owner).GetComponent() : null); if (!NetworkServer.active || rank <= 0 || !Object.op_Implicit((Object)(object)drogozCardLoadoutComponent) || Time.time < drogozCardLoadoutComponent.NextScentTrailTime) { return false; } drogozCardLoadoutComponent.NextScentTrailTime = Time.time + 6f; Log.Debug("Abilities", $"Scent Trail detonation started body={((Object)owner).name} rank={rank} cooldown={6f:0.0}s cap={5f:0.0}s"); return true; } internal static void RefundFireSpit(CharacterBody owner, float seconds) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds)) { return; } if (owner.hasEffectiveAuthority) { bool flag = FireSpit.ReduceCooldown(owner, seconds); Log.Debug("Abilities", $"Fire Spit refund body={((Object)owner).name} seconds={seconds:0.00} changed={flag}"); return; } NetworkIdentity component = ((Component)owner).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.connectionToClient != null) { NetMessageExtensions.Send((INetMessage)(object)new SyncFireSpitRefund(component.netId, seconds), component.connectionToClient); } } internal static void OnRocketHit(CharacterBody owner, HealthComponent victim, GameObject rocket, bool salvo, bool directHit) { if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)victim) || !Object.op_Implicit((Object)(object)rocket)) { return; } DrogozSalvoCardTracker component = rocket.GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.TryReport(victim)) { if (!salvo && directHit) { TryConcussiveRound(owner, victim.body); } TryHotSwap(owner, salvo); if (salvo) { RefundBaseSalvo(owner); RefundSalvo(owner); HealFromSalvo(owner); RestoreSalvoFuel(owner); } } } internal static bool TryConcussiveRound(CharacterBody owner, CharacterBody victim, float? forcedRoll = null) { int rank = GetRank(owner, "overdrive"); DrogozCardLoadoutComponent component = ((Component)owner).GetComponent(); if (rank <= 0 || !Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)victim)) { return false; } if (!forcedRoll.HasValue && Time.time < component.NextConcussiveTime) { return false; } int num = component.ConcussiveFailures + 1; int num2 = Mathf.Max(8, 16 - rank); float num3 = forcedRoll ?? Random.value; float num4 = 0.08f * (float)rank; bool flag = num >= num2; bool flag2 = flag || num3 <= num4; component.RegisterConcussiveAttempt(flag2); Log.Debug("Loadouts", $"Concussive Round roll body={((Object)owner).name} target={((Object)victim).name} rank={rank} roll={num3:0.000} chance={num4:0.000} failures={num}/{num2} guaranteed={flag} success={flag2}"); if (!flag2) { return false; } component.NextConcussiveTime = Time.time + 5f; SetStateOnHurt.SetStunOnObject(((Component)victim).gameObject, 0.5f); Log.Debug("Abilities", $"Concussive Round stunned target={((Object)victim).name} duration=0.5s cooldown={5f:0.0}s"); return true; } internal static bool TryHotSwap(CharacterBody owner, bool salvo, float? forcedRoll = null) { int rank = GetRank(owner, "hot_swap"); DrogozCardLoadoutComponent component = ((Component)owner).GetComponent(); if (rank <= 0 || !Object.op_Implicit((Object)(object)component)) { return false; } DrogozSalvoModeComponent drogozSalvoModeComponent = (salvo ? ((Component)owner).GetComponent() : null); bool flag = Object.op_Implicit((Object)(object)drogozSalvoModeComponent) && drogozSalvoModeComponent.CardBarrageActive; if (flag && drogozSalvoModeComponent.CardAmmo >= 6) { return false; } if (!flag) { GenericSkill val = (Object.op_Implicit((Object)(object)owner.skillLocator) ? owner.skillLocator.primary : null); if (!Object.op_Implicit((Object)(object)val) || val.stock >= val.maxStock) { return false; } } int num = component.HotSwapFailures + 1; int num2 = Mathf.Max(10, 20 - 2 * rank); float num3 = forcedRoll ?? Random.value; float num4 = 0.06f * (float)rank; bool flag2 = num >= num2; bool flag3 = flag2 || num3 <= num4; component.RegisterHotSwapAttempt(flag3); Log.Debug("Loadouts", $"Hot Swap roll body={((Object)owner).name} salvo={flag} rank={rank} roll={num3:0.000} chance={num4:0.000} failures={num}/{num2} guaranteed={flag2} success={flag3}"); if (!flag3) { return false; } if (flag) { drogozSalvoModeComponent.AddCardAmmo(1); Log.Debug("Loadouts", $"Hot Swap refunded Salvo ammo body={((Object)owner).name} bonusAmmo={drogozSalvoModeComponent.CardAmmo}"); return true; } GenericSkill primary = owner.skillLocator.primary; primary.AddOneStock(); Log.Debug("Loadouts", $"Hot Swap refunded Primary ammo body={((Object)owner).name} stock={primary.stock}/{primary.maxStock}"); return true; } private static void RefundBaseSalvo(CharacterBody owner) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) DrogozSalvoModeComponent component = ((Component)owner).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !component.CardBarrageActive) { return; } float num = Mathf.Min(0.225f, Mathf.Max(0f, 4.5f - component.BaseRefundUsed)); if (num <= 0f) { return; } component.AddBaseRefund(num); Log.Debug("Abilities", $"Salvo base refund body={((Object)owner).name} amount={num:0.00} used={component.BaseRefundUsed:0.00}/{4.5f:0.00}"); if (owner.hasEffectiveAuthority) { ReduceSalvoCooldown(owner, num); return; } NetworkIdentity component2 = ((Component)owner).GetComponent(); if (Object.op_Implicit((Object)(object)component2) && component2.connectionToClient != null) { NetMessageExtensions.Send((INetMessage)(object)new SyncSalvoRefund(component2.netId, num), component2.connectionToClient); } } private static void RefundSalvo(CharacterBody owner) { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) int rank = GetRank(owner, "salvo_recycling"); if (rank <= 0) { return; } DrogozSalvoModeComponent component = ((Component)owner).GetComponent(); if (!Object.op_Implicit((Object)(object)component) || !component.CardBarrageActive) { return; } float num = Mathf.Min(0.2f * (float)rank, Mathf.Max(0f, 5f - component.CardRefundUsed)); if (num <= 0f) { return; } component.AddCardRefund(num); Log.Debug("Abilities", $"Spitfire Salvo refund body={((Object)owner).name} rank={rank} amount={num:0.00} used={component.CardRefundUsed:0.00}/{5f:0.00}"); if (owner.hasEffectiveAuthority) { ReduceSalvoCooldown(owner, num); return; } NetworkIdentity component2 = ((Component)owner).GetComponent(); if (Object.op_Implicit((Object)(object)component2) && component2.connectionToClient != null) { NetMessageExtensions.Send((INetMessage)(object)new SyncSalvoRefund(component2.netId, num), component2.connectionToClient); } } internal static bool ReduceSalvoCooldown(CharacterBody body, float seconds) { if (!Object.op_Implicit((Object)(object)body) || seconds <= 0f || float.IsNaN(seconds) || float.IsInfinity(seconds) || !Object.op_Implicit((Object)(object)body.skillLocator)) { return false; } GenericSkill special = body.skillLocator.special; if (!Object.op_Implicit((Object)(object)special) || !Object.op_Implicit((Object)(object)special.skillDef) || special.skillDef.skillName != "DrogozSalvo") { return false; } if (special.stock >= special.maxStock || special.rechargeStock <= 0 || special.cooldownRemaining <= 0f) { return false; } float cooldownRemaining = special.cooldownRemaining; float finalRechargeInterval = special.GetFinalRechargeInterval(); special.rechargeStopwatch = Mathf.Min(finalRechargeInterval, special.rechargeStopwatch + Mathf.Max(0f, seconds)); return special.cooldownRemaining < cooldownRemaining - 0.0001f; } internal static void ApplyDragonPunchKillCards(CharacterBody owner, ref float healPercentUsed) { if (!Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)owner.healthComponent) || !owner.healthComponent.alive) { return; } int rank = GetRank(owner, "bask"); if (rank <= 0) { return; } float num = Mathf.Min(0.02f * (float)rank, Mathf.Max(0f, 0.1f - healPercentUsed)); if (num > 0f) { healPercentUsed += num; if (Object.op_Implicit((Object)(object)baskBuff)) { owner.AddTimedBuff(baskBuff, 0.5f); } DrogozHealOverTime drogozHealOverTime = ((Component)owner).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)drogozHealOverTime)) { drogozHealOverTime = ((Component)owner).gameObject.AddComponent(); } drogozHealOverTime.AddHeal(owner.maxHealth * num, 0.5f); Log.Debug("Buffs", $"Bask Dragon Punch heal body={((Object)owner).name} rank={rank} percent={num:0.00} used={healPercentUsed:0.00}/0.10"); } } internal static void ApplyDragonPunchEndCards(CharacterBody owner) { if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)spitfireBuff)) { int rank = GetRank(owner, "salvo_recycling"); if (rank > 0 && (NetworkServer.active || owner.hasEffectiveAuthority)) { owner.AddTimedBuff(spitfireBuff, 3f); Log.Debug("Buffs", $"Spitfire Dragon Punch aftermath speed body={((Object)owner).name} rank={rank} bonus={0.1f * (float)rank:0.00} duration={3f:0.0}s"); } } } internal static void HealFromSalvo(CharacterBody owner) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) int rank = GetRank(owner, "bask"); DrogozSalvoModeComponent component = ((Component)owner).GetComponent(); if (rank <= 0 || !Object.op_Implicit((Object)(object)component)) { return; } float num = Mathf.Min(0.01f * (float)rank, Mathf.Max(0f, 0.1f - component.CardHealPercentUsed)); if (!(num <= 0f)) { component.AddCardHealPercent(num); if (Object.op_Implicit((Object)(object)baskBuff)) { owner.AddTimedBuff(baskBuff, 0.5f); } Log.Debug("Buffs", string.Format("Bask healing body={0} rank={1} percent={2:0.00} used={3:0.00}/0.10 buff={4}", ((Object)owner).name, rank, num, component.CardHealPercentUsed, Object.op_Implicit((Object)(object)baskBuff) ? ((object)baskBuff.buffIndex/*cast due to .constrained prefix*/).ToString() : "none")); DrogozHealOverTime drogozHealOverTime = ((Component)owner).gameObject.GetComponent(); if (!Object.op_Implicit((Object)(object)drogozHealOverTime)) { drogozHealOverTime = ((Component)owner).gameObject.AddComponent(); } drogozHealOverTime.AddHeal(owner.maxHealth * num, 0.5f); } } internal static void RestoreSalvoFuel(CharacterBody owner) { int rank = GetRank(owner, "hyper_boost"); DrogozSalvoModeComponent component = ((Component)owner).GetComponent(); if (rank <= 0 || !Object.op_Implicit((Object)(object)component)) { return; } float num = Mathf.Min(0.01f * (float)rank, Mathf.Max(0f, 0.2f - component.CardFuelPercentUsed)); if (!(num <= 0f)) { DrogozBooster component2 = ((Component)owner).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component.AddCardFuelPercent(num); component2.SetFuel(component2.Fuel + component2.FuelCapacity * num); Log.Debug("Abilities", $"Hyper Boost fuel body={((Object)owner).name} rank={rank} percent={num:0.00} used={component.CardFuelPercentUsed:0.00}/0.20 fuel={component2.Fuel:0.0}/{component2.FuelCapacity:0.0}"); } } } private static void HandleTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_0267: 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) if (NetworkServer.active && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)self.body.characterMotor) && !self.body.characterMotor.isGrounded) { DrogozMiscComponent component = ((Component)self.body).GetComponent(); if ((Object.op_Implicit((Object)(object)wyrmJetsAirBuff) && self.body.GetBuffCount(wyrmJetsAirBuff.buffIndex) > 0) || (Object.op_Implicit((Object)(object)component) && component.HasWyrmJets)) { float num = Mathf.Clamp01(DrogozConfig.WyrmJetsAirDamageReduction.Value); if (num > 0f) { float damage = damageInfo.damage; damageInfo.damage *= 1f - num; Log.Debug("Talents", $"Wyrm Jets reduced airborne damage body={((Object)self.body).name} reduction={num:0.00} before={damage:0.0} after={damageInfo.damage:0.0}"); } } } if (NetworkServer.active && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)self.body)) { DrogozDragonPunchComponent component2 = ((Component)self.body).GetComponent(); if (Object.op_Implicit((Object)(object)component2) && component2.IsActive && !component2.IsFlying) { int rank = GetRank(self.body, "hyper_boost"); if (rank > 0) { float num2 = Mathf.Min(0.5f, 0.1f * (float)rank); float damage2 = damageInfo.damage; damageInfo.damage *= 1f - num2; Log.Debug("Buffs", $"Hyper Boost channel damage reduction body={((Object)self.body).name} rank={rank} reduction={num2:0.00} before={damage2:0.0} after={damageInfo.damage:0.0}"); } } } int rank2 = GetRank(self.body, "thrust_plating"); if (NetworkServer.active && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)thrustPlatingBuff) && self.body.GetBuffCount(thrustPlatingBuff.buffIndex) > 0 && rank2 > 0) { float damage3 = damageInfo.damage; damageInfo.damage *= 1f - Mathf.Clamp01(0.05f * (float)rank2); Log.Debug("Buffs", $"Survival reduced damage body={((Object)self.body).name} rank={rank2} before={damage3:0.0} after={damageInfo.damage:0.0}"); } orig.Invoke(self, damageInfo); } } internal static class DrogozCardSelfTest { internal static void Run(CharacterBody body, Action log) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !Object.op_Implicit((Object)(object)body.skillLocator)) { log("Card self-test failed: Drogoz body is not ready."); return; } DrogozCardLoadoutComponent component = ((Component)body).GetComponent(); CardLoadout cardLoadout = (Object.op_Implicit((Object)(object)component) ? component.GetLoadout() : null); if (cardLoadout == null || !cardLoadout.IsComplete()) { log("Card self-test failed: save a complete five-slot loadout with 15 points first."); return; } HealthComponent healthComponent = body.healthComponent; DrogozBooster component2 = ((Component)body).GetComponent(); GenericSkill primary = body.skillLocator.primary; GenericSkill secondary = body.skillLocator.secondary; GenericSkill special = body.skillLocator.special; DrogozSalvoModeComponent component3 = ((Component)body).GetComponent(); float health = healthComponent.health; float fuel = (Object.op_Implicit((Object)(object)component2) ? component2.Fuel : 0f); int stock = (Object.op_Implicit((Object)(object)primary) ? primary.stock : 0); float rechargeStopwatch = (Object.op_Implicit((Object)(object)primary) ? primary.rechargeStopwatch : 0f); int stock2 = (Object.op_Implicit((Object)(object)secondary) ? secondary.stock : 0); float rechargeStopwatch2 = (Object.op_Implicit((Object)(object)secondary) ? secondary.rechargeStopwatch : 0f); int stock3 = (Object.op_Implicit((Object)(object)special) ? special.stock : 0); float rechargeStopwatch3 = (Object.op_Implicit((Object)(object)special) ? special.rechargeStopwatch : 0f); float nextConcussiveTime = (Object.op_Implicit((Object)(object)component) ? component.NextConcussiveTime : 0f); float nextScentTrailTime = (Object.op_Implicit((Object)(object)component) ? component.NextScentTrailTime : 0f); CharacterBody val = null; log("Card self-test: loadout valid, points=" + cardLoadout.TotalPoints() + "/" + 15); try { if ((cardLoadout.GetRank("bask") > 0 || cardLoadout.GetRank("hyper_boost") > 0) && Object.op_Implicit((Object)(object)component3)) { component3.DebugBeginCardBarrage(); } for (int i = 0; i < cardLoadout.Slots.Length; i++) { CardSlot cardSlot = cardLoadout.Slots[i]; if (cardSlot == null || string.IsNullOrEmpty(cardSlot.CardId) || cardSlot.Rank <= 0) { continue; } int rank = cardSlot.Rank; switch (cardSlot.CardId) { case "rocket_radius": log("PASS Wide Blast R" + rank + ": radius=" + DrogozCards.GetRocketRadius(body, 6f).ToString("0.00")); break; case "rocket_jump": log("PASS Rocket Jump R" + rank + ": knockback x" + DrogozCards.GetRocketSelfKnockbackMultiplier(body).ToString("0.00")); break; case "hot_swap": if (Object.op_Implicit((Object)(object)primary)) { primary.stock = Mathf.Max(0, primary.maxStock - 1); int stock4 = primary.stock; bool flag4 = DrogozCards.TryHotSwap(body, salvo: false, 0f); log(((flag4 && primary.stock > stock4) ? "PASS" : "FAIL") + " Hot Swap R" + rank + ": ammo " + stock4 + " -> " + primary.stock); } break; case "fire_spit_sustain": { healthComponent.health = body.maxHealth * 0.5f; float health3 = healthComponent.health; DrogozCards.HealFireSpitSustain(body, 0.01f * (float)rank); log(((healthComponent.health > health3) ? "PASS" : "FAIL") + " Lung Capacity R" + rank + ": heal " + (healthComponent.health - health3).ToString("0.0")); break; } case "scent_trail": if (Object.op_Implicit((Object)(object)secondary)) { secondary.stock = 0; secondary.rechargeStopwatch = 0f; component.NextScentTrailTime = 0f; bool num = DrogozCards.TryBeginScentTrailDetonation(body); float cooldownRemaining2 = secondary.cooldownRemaining; DrogozCards.RefundFireSpit(body, 0.25f * (float)rank); bool flag5 = num && secondary.cooldownRemaining < cooldownRemaining2 && component.NextScentTrailTime > Time.time; log((flag5 ? "PASS" : "FAIL") + " Scent Trail R" + rank + ": refund " + (cooldownRemaining2 - secondary.cooldownRemaining).ToString("0.00") + "s cooldown=6s"); } break; case "fire_spit_reach": log("PASS Expanded Blast R" + rank + ": radius=" + DrogozCards.GetFireSpitRadius(body).ToString("0.00")); break; case "masterful": val = FindEnemy(body); if (Object.op_Implicit((Object)(object)val)) { DrogozMark.Apply(val, ((Component)body).gameObject, 0.5f * (float)rank); log((val.HasBuff(DrogozMark.buffDef) ? "PASS" : "FAIL") + " Lasting Brand R" + rank + ": enemy buff applied hasIcon=" + ((Object)(object)DrogozMark.buffDef != (Object)null && (Object)(object)DrogozMark.buffDef.iconSprite != (Object)null)); } else { log("SKIP Lasting Brand R" + rank + ": no living enemy target"); } break; case "thrust_plating": DrogozCards.ApplyThrustPlating(body); log((body.HasBuff(DrogozCards.thrustPlatingBuff) ? "PASS" : "FAIL") + " Survival R" + rank + ": buff applied"); break; case "thrust_force": log("PASS Propel R" + rank + ": force x" + DrogozCards.GetThrustForceMultiplier(body).ToString("0.00")); break; case "emergency_flare": { healthComponent.health = body.maxHealth * 0.5f; float health4 = healthComponent.health; DrogozCards.HealEmergencyFlare(body); log(((healthComponent.health > health4) ? "PASS" : "FAIL") + " Emergency Flare R" + rank + ": heal " + (healthComponent.health - health4).ToString("0.0")); break; } case "salvo_recycling": if (Object.op_Implicit((Object)(object)special)) { special.stock = 0; special.rechargeStopwatch = 0f; float cooldownRemaining = special.cooldownRemaining; bool flag3 = DrogozCards.ReduceSalvoCooldown(body, 0.2f * (float)rank); log((flag3 ? "PASS" : "FAIL") + " Spitfire R" + rank + ": refund " + (cooldownRemaining - special.cooldownRemaining).ToString("0.00") + "s"); } break; case "bask": { healthComponent.health = body.maxHealth * 0.5f; float health2 = healthComponent.health; DrogozCards.HealFromSalvo(body); log(((healthComponent.health > health2) ? "PASS" : "FAIL") + " Bask R" + rank + ": heal over time started"); break; } case "hyper_boost": if (Object.op_Implicit((Object)(object)component2)) { component2.SetFuel(component2.FuelCapacity * 0.5f); float fuel2 = component2.Fuel; DrogozCards.RestoreSalvoFuel(body); log(((component2.Fuel > fuel2) ? "PASS" : "FAIL") + " Hyper Boost R" + rank + ": fuel +" + (component2.Fuel - fuel2).ToString("0.0")); } break; case "booster_control": log("PASS Altitude R" + rank + ": control x" + DrogozCards.GetBoosterControlMultiplier(body).ToString("0.00")); break; case "booster_capacity": body.AddTimedBuff(DrogozCards.adrenalineBuff, 2f); log((body.HasBuff(DrogozCards.adrenalineBuff) ? "PASS" : "FAIL") + " Adrenaline R" + rank + ": speed buff applied"); break; case "overdrive": { CharacterBody val2 = FindEnemy(body); if (Object.op_Implicit((Object)(object)val2)) { bool flag = DrogozCards.TryConcussiveRound(body, val2, 0f); bool flag2 = component.NextConcussiveTime > Time.time; log(((flag && flag2) ? "PASS" : "FAIL") + " Concussive Round R" + rank + ": direct-hit stun executed cooldown=5s"); } else { log("SKIP Concussive Round R" + rank + ": no living enemy target"); } break; } default: log("UNKNOWN card id: " + cardSlot.CardId); break; } } } catch (Exception ex) { log("Card self-test error: " + ex.Message); } finally { healthComponent.health = health; if (Object.op_Implicit((Object)(object)component2)) { component2.SetFuel(fuel); } if (Object.op_Implicit((Object)(object)primary)) { primary.stock = stock; primary.rechargeStopwatch = rechargeStopwatch; } if (Object.op_Implicit((Object)(object)secondary)) { secondary.stock = stock2; secondary.rechargeStopwatch = rechargeStopwatch2; } if (Object.op_Implicit((Object)(object)special)) { special.stock = stock3; special.rechargeStopwatch = rechargeStopwatch3; } if (Object.op_Implicit((Object)(object)component3)) { component3.DebugEndCardBarrage(); } if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)DrogozMark.buffDef)) { val.RemoveBuff(DrogozMark.buffDef); } if (body.HasBuff(DrogozCards.thrustPlatingBuff)) { body.RemoveBuff(DrogozCards.thrustPlatingBuff); } if (body.HasBuff(DrogozCards.adrenalineBuff)) { body.RemoveBuff(DrogozCards.adrenalineBuff); } if (Object.op_Implicit((Object)(object)component)) { component.NextConcussiveTime = nextConcussiveTime; component.NextScentTrailTime = nextScentTrailTime; } body.RecalculateStats(); log("Card self-test complete. Health, fuel, ammo, and cooldowns restored."); } } private static CharacterBody FindEnemy(CharacterBody owner) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) List instancesList = InstanceTracker.GetInstancesList(); for (int i = 0; i < instancesList.Count; i++) { BaseAI val = instancesList[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.body) && Object.op_Implicit((Object)(object)val.body.healthComponent) && val.body.healthComponent.alive && !((Object)(object)val.body == (Object)(object)owner) && Object.op_Implicit((Object)(object)owner.teamComponent) && Object.op_Implicit((Object)(object)val.body.teamComponent) && val.body.teamComponent.teamIndex != owner.teamComponent.teamIndex) { return val.body; } } return null; } } internal static class DrogozConfig { internal static ConfigEntry UseRoR2Facing; internal static ConfigEntry AimFacingYawOffset; internal static ConfigEntry DebugEnabled; internal static ConfigEntry DebugGeneral; internal static ConfigEntry DebugAbilities; internal static ConfigEntry DebugBuffs; internal static ConfigEntry DebugLoadouts; internal static ConfigEntry DebugNetworking; internal static ConfigEntry DebugAnimation; internal static ConfigEntry DebugTalents; internal static ConfigEntry DebugBooster; internal static ConfigEntry DebugAudio; internal static ConfigEntry DebugVfx; internal static ConfigEntry AllowTwoTalents; internal static ConfigEntry LoadoutCardsEnabled; internal static ConfigEntry AudioVolumeScale; internal static ConfigEntry RocketDirectProc; internal static ConfigEntry RocketSplashProc; internal static ConfigEntry SalvoDirectProc; internal static ConfigEntry SalvoSplashProc; internal static ConfigEntry FireSpitDirectProc; internal static ConfigEntry FireSpitDetonationProc; internal static ConfigEntry RocketDamage; internal static ConfigEntry RocketRadius; internal static ConfigEntry RocketSpeed; internal static ConfigEntry RocketForce; internal static ConfigEntry RocketFireInterval; internal static ConfigEntry RocketReloadDuration; internal static ConfigEntry RocketAutoReloadDelay; internal static ConfigEntry RocketMaxStock; internal static ConfigEntry RocketSelfKnockback; internal static ConfigEntry RocketSelfKnockbackHorizontal; internal static ConfigEntry RocketSelfDamage; internal static ConfigEntry RocketSelfDamageMultiplier; internal static ConfigEntry RocketUseFalloff; internal static ConfigEntry ThrustCooldown; internal static ConfigEntry ThrustRefundPerEnemy; internal static ConfigEntry ThrustUpwardVelocity; internal static ConfigEntry ThrustForwardVelocity; internal static ConfigEntry ThrustForceMultiplier; internal static ConfigEntry ThrustMomentumOverride; internal static ConfigEntry ThrustRedirectMaxTurnAngle; internal static ConfigEntry ThrustBoosterRefillPercent; internal static ConfigEntry ThrustDuration; internal static ConfigEntry ThrustMoveSpeedBonus; internal static ConfigEntry ThrustFuelEfficiencyReduction; internal static ConfigEntry ThrustFuelEfficiencyDuration; internal static ConfigEntry FireSpitCooldown; internal static ConfigEntry FireSpitDirectDamage; internal static ConfigEntry FireSpitDetonationDamage; internal static ConfigEntry FireSpitDetonationRadius; internal static ConfigEntry FireSpitRocketDetonationRadius; internal static ConfigEntry FireSpitUseFalloff; internal static ConfigEntry FireSpitSpeed; internal static ConfigEntry FireSpitGravityScale; internal static ConfigEntry FireSpitHitboxScale; internal static ConfigEntry FireSpitVisualScale; internal static ConfigEntry FireSpitExplosionScale; internal static ConfigEntry FireSpitTerrormorphParticles; internal static ConfigEntry FireSpitLifetime; internal static ConfigEntry FireSpitForce; internal static ConfigEntry FireSpitCastDuration; internal static ConfigEntry MarkDamageBonus; internal static ConfigEntry MarkDuration; internal static ConfigEntry SalvoCooldown; internal static ConfigEntry SalvoDamage; internal static ConfigEntry SalvoRadius; internal static ConfigEntry SalvoShotInterval; internal static ConfigEntry SalvoReloadDelay; internal static ConfigEntry SalvoShieldBonus; internal static ConfigEntry CombustibleBurnStacks; internal static ConfigEntry CombustibleBurnDuration; internal static ConfigEntry CombustibleBurnDamageMultiplier; internal static ConfigEntry CombustibleKnockbackForce; internal static ConfigEntry CombustibleAirKnockbackForce; internal static ConfigEntry WyrmJetsVerticalSpeedMultiplier; internal static ConfigEntry WyrmJetsVerticalAccelerationMultiplier; internal static ConfigEntry WyrmJetsHorizontalSpeedMultiplier; internal static ConfigEntry WyrmJetsSteeringMultiplier; internal static ConfigEntry WyrmJetsAirDamageReduction; internal static ConfigEntry ReignOfTerrorAmmo; internal static ConfigEntry ReignOfTerrorCooldownReduction; internal static ConfigEntry DragonPunchCooldown; internal static ConfigEntry DragonPunchDamage; internal static ConfigEntry DragonPunchProc; internal static ConfigEntry DragonPunchChannel; internal static ConfigEntry DragonPunchFlightTime; internal static ConfigEntry DragonPunchSpeed; internal static ConfigEntry DragonPunchRadius; internal static ConfigEntry DragonPunchExecuteThreshold; internal static ConfigEntry DragonPunchRefund; internal static ConfigEntry DragonPunchCancelLockout; internal static ConfigEntry DragonPunchKillRadius; internal static ConfigEntry DragonPunchKillDamage; internal static ConfigEntry SittingDuckRadius; internal static ConfigEntry SittingDuckCheckInterval; internal static ConfigEntry SittingDuckAttention; internal static ConfigEntry SittingDuckAffectsUntargeted; internal static ConfigEntry DragonPunchReignDamage; internal static ConfigEntry DragonPunchReignConeAngle; internal static ConfigEntry DragonPunchReignConeRadius; internal static ConfigEntry DragonPunchReignProc; internal static ConfigEntry DragonPunchReignCooldownReductionPerKill; internal static ConfigEntry DragonPunchReignFlightTime; internal static ConfigEntry DragonPunchReignHitCooldown; internal static ConfigEntry DragonPunchReignDamageGrowthPerHit; internal static ConfigEntry DragonPunchReignMaxDamageMultiplier; internal static ConfigEntry DragonPunchReignKillDurationBonus; internal static ConfigEntry DragonPunchReignKillDurationFalloff; internal static ConfigEntry DragonPunchReignHitStop; internal static ConfigEntry DragonPunchReignStartSpeedFactor; internal static ConfigEntry DragonPunchReignMaxSpeedFactor; internal static ConfigEntry DragonPunchReignMaxRadiusFactor; internal static ConfigEntry BoosterFuelPerExtraJump; internal static ConfigEntry BoosterAimPitchOffset; internal static ConfigEntry BoosterFuelCapacity; internal static ConfigEntry BoosterFuelDrainRate; internal static ConfigEntry BoosterFuelRefillDelay; internal static ConfigEntry BoosterFuelRefillRate; internal static ConfigEntry BoosterOverspeedDrag; internal static ConfigEntry BoosterOverspeedDragMax; internal static ConfigEntry BoosterOverspeedDragFullSpeed; internal static ConfigEntry BoosterReactivationPercent; internal static ConfigEntry BoosterGroundRefillMultiplier; internal static ConfigEntry BoosterAirRefillMultiplier; internal static ConfigEntry BoosterLiftAcceleration; internal static ConfigEntry BoosterMaxLiftSpeed; internal static ConfigEntry BoosterHorizontalAcceleration; internal static ConfigEntry BoosterSteeringSpeed; internal static ConfigEntry BoosterMaxHorizontalSpeed; internal static ConfigEntry BoosterMoveSpeedBonusEffectiveness; internal static ConfigEntry BoosterAirControlMultiplier; internal static ConfigEntry NormalAirControlMultiplier; internal static ConfigEntry BoosterShowFuelHud; internal static ConfigEntry AirAggroEnabled; internal static ConfigEntry AirAggroChance; internal static ConfigEntry AirAggroRadius; internal static ConfigEntry AirAggroMaxDistanceRatio; internal static ConfigEntry AirAggroAttentionDuration; internal static ConfigEntry AirAggroCheckInterval; internal static bool IsDebugTagEnabled(string tag) { if (!DebugEnabled.Value) { return false; } return tag switch { "Abilities" => DebugAbilities.Value, "Buffs" => DebugBuffs.Value, "Loadouts" => DebugLoadouts.Value, "Networking" => DebugNetworking.Value, "Animation" => DebugAnimation.Value, "Talents" => DebugTalents.Value, "Booster" => DebugBooster.Value, "Audio" => DebugAudio.Value, "Vfx" => DebugVfx.Value, _ => DebugGeneral.Value, }; } internal static void Init() { UseRoR2Facing = Config.BindAndOptions("General", "UseRoR2Facing", defaultValue: false, "Use normal Risk of Rain 2 movement-facing instead of forcing the model to face the crosshair."); AimFacingYawOffset = Config.BindAndOptions("General", "AimFacingYawOffset", -20f, "Model facing offset in degrees while crosshair-facing is active. Negative values turn the model left. The crosshair and projectiles do not change."); DebugEnabled = Config.BindAndOptions("Debug", "Enabled", defaultValue: false, "Master switch for all Drogoz debug logs."); DebugGeneral = Config.BindAndOptions("Debug", "General", defaultValue: false, "General setup and content debug logs."); DebugAbilities = Config.BindAndOptions("Debug", "Abilities", defaultValue: false, "Ability activation, cooldowns, healing, and damage-effect logs."); DebugBuffs = Config.BindAndOptions("Debug", "Buffs", defaultValue: false, "Buff creation, icons, application, Easy Target, and damage-reduction logs."); DebugLoadouts = Config.BindAndOptions("Debug", "Loadouts", defaultValue: false, "Loadout-card rank, save, and validation logs."); DebugNetworking = Config.BindAndOptions("Debug", "Networking", defaultValue: false, "Card loadout network sync logs."); DebugAnimation = Config.BindAndOptions("Debug", "Animation", defaultValue: false, "Animation state and reload logs."); DebugTalents = Config.BindAndOptions("Debug", "Talents", defaultValue: false, "Talent selection and talent-effect logs."); DebugBooster = Config.BindAndOptions("Debug", "Booster", defaultValue: false, "Booster speed, fuel, and movement logs."); DebugAudio = Config.BindAndOptions("Debug", "Audio", defaultValue: false, "Wwise and Unity audio debug logs."); DebugVfx = Config.BindAndOptions("Debug", "Vfx", defaultValue: false, "Explosion and effect debug logs."); AllowTwoTalents = Config.BindAndOptions("General", "AllowTwoTalents", defaultValue: false, "Allow two talent rows so one talent from each pair can be active. Restart required.", restartRequired: true); LoadoutCardsEnabled = Config.BindAndOptions("General", "LoadoutCardsEnabled", defaultValue: false, "Show the loadout-card screen and apply card effects. Restart required.", restartRequired: true); AudioVolumeScale = Config.BindAndOptions("Audio", "VolumeScale", 1f, "Multiplier for all Drogoz custom audio. 1.0 uses the authored level."); RocketDirectProc = Config.BindAndOptions("ProcCoefficients", "RocketDirect", 1f, "Proc coefficient for a direct Rocket Launcher hit."); RocketSplashProc = Config.BindAndOptions("ProcCoefficients", "RocketSplash", 0.5f, "Proc coefficient for Rocket Launcher splash hits."); SalvoDirectProc = Config.BindAndOptions("ProcCoefficients", "SalvoDirect", 0.65f, "Proc coefficient for direct Salvo rocket hits."); SalvoSplashProc = Config.BindAndOptions("ProcCoefficients", "SalvoSplash", 0.5f, "Proc coefficient for Salvo rocket splash hits."); FireSpitDirectProc = Config.BindAndOptions("ProcCoefficients", "FireSpitDirect", 1f, "Proc coefficient for a direct Fire Spit hit."); FireSpitDetonationProc = Config.BindAndOptions("ProcCoefficients", "FireSpitDetonation", 0.5f, "Proc coefficient for Fire Spit detonation splash."); RocketDamage = Config.BindAndOptions("RocketLauncher", "Damage", 4.8f, "Rocket damage coefficient. 4.8 is 480%."); RocketRadius = Config.BindAndOptions("RocketLauncher", "Radius", 6f, "Rocket explosion radius in meters. The explosion VFX uses the same scale."); RocketSpeed = Config.BindAndOptions("RocketLauncher", "Speed", 75f, "Rocket forward speed in meters per second."); RocketForce = Config.BindAndOptions("RocketLauncher", "Force", 600f, "Rocket knockback force against enemies."); RocketFireInterval = Config.BindAndOptions("RocketLauncher", "FireInterval", 0.85f, "Seconds between rockets before attack speed."); RocketReloadDuration = Config.BindAndOptions("RocketLauncher", "ReloadDuration", 2.5f, "Seconds for a full reload before attack speed."); RocketAutoReloadDelay = Config.BindAndOptions("RocketLauncher", "AutoReloadDelay", 1.5f, "Seconds after not shooting before a partial magazine auto reloads. Auto reload can be interrupted by Primary, Fire Spit, Salvo, and Salvo barrage."); RocketMaxStock = Config.BindAndOptions("RocketLauncher", "MaxStock", 6, "Maximum Rocket Launcher stocks."); RocketSelfKnockback = Config.BindAndOptions("RocketLauncher", "SelfKnockback", 720f, "Rocket jump force applied to Drogoz."); RocketSelfKnockbackHorizontal = Config.BindAndOptions("RocketLauncher", "SelfKnockbackHorizontal", 1.15f, "Horizontal multiplier for Drogoz rocket jumps."); RocketSelfDamage = Config.BindAndOptions("RocketLauncher", "SelfDamage", defaultValue: true, "Allow rockets to damage Drogoz."); RocketSelfDamageMultiplier = Config.BindAndOptions("RocketLauncher", "SelfDamageMultiplier", 0.15f, "Fraction of rocket damage dealt to Drogoz. 0.15 is 15%."); RocketUseFalloff = Config.BindAndOptions("RocketLauncher", "UseFalloff", defaultValue: true, "Use gradual HalfLinear damage falloff for rocket splash."); ThrustCooldown = Config.BindAndOptions("Thrust", "Cooldown", 11f, "Seconds for Thrust cooldown."); ThrustRefundPerEnemy = Config.BindAndOptions("Thrust", "RefundPerEnemy", 1.5f, "Seconds removed from Thrust cooldown for each enemy hit by a Fire Spit detonation."); ThrustUpwardVelocity = Config.BindAndOptions("Thrust", "UpwardVelocity", 22f, "Minimum upward speed in meters per second."); ThrustForwardVelocity = Config.BindAndOptions("Thrust", "ForwardVelocity", 6f, "Forward speed in meters per second."); ThrustForceMultiplier = Config.BindAndOptions("Thrust", "ForceMultiplier", 1.3f, "Multiplier for all Thrust impulse and velocity. 1.3 is 30% stronger."); ThrustMomentumOverride = Config.BindAndOptions("Thrust", "MomentumOverride", 0.55f, "Legacy additive-mode momentum removal. Thrust now redirects horizontal momentum and no longer uses this value."); ThrustRedirectMaxTurnAngle = Config.BindAndOptions("Thrust", "RedirectMaxTurnAngle", 75f, "Maximum degrees Thrust can turn existing horizontal momentum toward the crosshair in one activation."); ThrustBoosterRefillPercent = Config.BindAndOptions("Thrust", "BoosterRefillPercent", 0.25f, "Fraction of maximum booster fuel restored on each Thrust activation. 0.25 is 25%."); ThrustDuration = Config.BindAndOptions("Thrust", "Duration", 0.25f, "Seconds before Thrust returns to the main state."); ThrustMoveSpeedBonus = Config.BindAndOptions("Thrust", "MoveSpeedBonus", 0.2f, "Extra movement speed from Afterburner. 0.2 is 20% faster movement."); ThrustFuelEfficiencyReduction = Config.BindAndOptions("Thrust", "FuelEfficiencyReduction", 0.2f, "Fraction of Booster fuel drain removed by Afterburner. 0.2 is 20% less fuel use."); ThrustFuelEfficiencyDuration = Config.BindAndOptions("Thrust", "FuelEfficiencyDuration", 5f, "Seconds of Afterburner movement speed and reduced Booster fuel drain."); FireSpitCooldown = Config.BindAndOptions("FireSpit", "Cooldown", 8f, "Seconds for Fire Spit cooldown."); FireSpitDirectDamage = Config.BindAndOptions("FireSpit", "DirectDamage", 1.2f, "Direct-hit damage coefficient. 1.2 is 120%."); FireSpitDetonationDamage = Config.BindAndOptions("FireSpit", "DetonationDamage", 15f, "Detonation damage coefficient. 15 is 1500%."); FireSpitDetonationRadius = Config.BindAndOptions("FireSpit", "DetonationRadius", 15f, "Fire Spit detonation radius in meters."); FireSpitRocketDetonationRadius = Config.BindAndOptions("FireSpit", "RocketDetonationRadius", 15f, "Radius around a rocket explosion that detonates Fire Spit. This can be larger than the damage radius."); FireSpitUseFalloff = Config.BindAndOptions("FireSpit", "UseFalloff", defaultValue: true, "Use gradual HalfLinear damage falloff for Fire Spit detonation."); FireSpitSpeed = Config.BindAndOptions("FireSpit", "Speed", 20f, "Fire Spit projectile speed in meters per second."); FireSpitGravityScale = Config.BindAndOptions("FireSpit", "GravityScale", 0f, "Fire Spit gravity scale. Default 0 keeps it straight. Paladins stores 0.7."); FireSpitHitboxScale = Config.BindAndOptions("FireSpit", "HitboxScale", 1f, "Fire Spit collider size multiplier. 1 keeps the collider smaller than the visible blob."); FireSpitVisualScale = Config.BindAndOptions("FireSpit", "VisualScale", 1.75f, "Fire Spit model size multiplier."); FireSpitExplosionScale = Config.BindAndOptions("FireSpit", "ExplosionScale", 2f, "Fire Spit explosion effect size multiplier. 2 is 100% bigger."); FireSpitTerrormorphParticles = Config.BindAndOptions("FireSpit", "TerrormorphParticles", defaultValue: true, "Show the green particle layer for Terrormorph explosions. Disable it to keep only the green flash."); FireSpitLifetime = Config.BindAndOptions("FireSpit", "Lifetime", 5f, "Seconds before an untouched Fire Spit expires without detonating."); FireSpitForce = Config.BindAndOptions("FireSpit", "Force", 600f, "Fire Spit detonation force."); FireSpitCastDuration = Config.BindAndOptions("FireSpit", "CastDuration", 0.35f, "Fire Spit cast time in seconds before attack speed."); MarkDamageBonus = Config.BindAndOptions("FireSpit", "MarkDamageBonus", 0.3f, "Extra damage from all sources while Draconic Brand is active. 0.3 is 30%."); MarkDuration = Config.BindAndOptions("FireSpit", "MarkDuration", 4f, "Mark duration in seconds."); SalvoCooldown = Config.BindAndOptions("Salvo", "Cooldown", 20f, "Seconds for Salvo cooldown."); SalvoDamage = Config.BindAndOptions("Salvo", "Damage", 3.5f, "Damage coefficient per Salvo rocket. 3.5 is 350%."); SalvoRadius = Config.BindAndOptions("Salvo", "Radius", 9.5f, "Salvo rocket explosion radius in meters. Slightly larger than Rocket Launcher."); SalvoShotInterval = Config.BindAndOptions("Salvo", "ShotInterval", 0.08f, "Seconds between Salvo rockets."); SalvoReloadDelay = Config.BindAndOptions("Salvo", "ReloadDelay", 0.5f, "Seconds after the last Salvo rocket before reload starts."); SalvoShieldBonus = Config.BindAndOptions("Salvo", "ShieldBonus", 1f, "Extra Salvo damage against shielded targets. 1 is 100% extra. Set 0 to disable."); CombustibleBurnStacks = Config.BindAndOptions("Combustible", "BurnStacks", 8, "Number of vanilla Burn stacks applied per Fire Spit hit."); CombustibleBurnDuration = Config.BindAndOptions("Combustible", "BurnDuration", 4f, "Duration of each vanilla Burn stack in seconds."); CombustibleBurnDamageMultiplier = Config.BindAndOptions("Combustible", "BurnDamageMultiplier", 0.25f, "Vanilla Burn damage multiplier per stack."); CombustibleKnockbackForce = Config.BindAndOptions("Combustible", "KnockbackForce", 1800f, "Extra upward Fire Spit detonation knockback force for grounded targets."); CombustibleAirKnockbackForce = Config.BindAndOptions("Combustible", "AirKnockbackForce", 1200f, "Extra upward Fire Spit detonation knockback force for airborne targets."); WyrmJetsVerticalSpeedMultiplier = Config.BindAndOptions("WyrmJets", "VerticalSpeedMultiplier", 2f, "Booster maximum vertical speed multiplier per Wyrm Jets stack."); WyrmJetsVerticalAccelerationMultiplier = Config.BindAndOptions("WyrmJets", "VerticalAccelerationMultiplier", 1.57f, "Booster vertical acceleration multiplier per Wyrm Jets stack."); WyrmJetsHorizontalSpeedMultiplier = Config.BindAndOptions("WyrmJets", "HorizontalSpeedMultiplier", 2f, "Booster maximum horizontal speed multiplier with Wyrm Jets."); WyrmJetsSteeringMultiplier = Config.BindAndOptions("WyrmJets", "SteeringMultiplier", 1.3f, "Booster steering speed multiplier with Wyrm Jets."); WyrmJetsAirDamageReduction = Config.BindAndOptions("WyrmJets", "AirDamageReduction", 0.15f, "Fraction of incoming damage reduced while airborne with Wyrm Jets."); ReignOfTerrorAmmo = Config.BindAndOptions("ReignOfTerror", "Ammo", 6, "Primary ammo granted when Reign of Terror starts Salvo mode."); ReignOfTerrorCooldownReduction = Config.BindAndOptions("ReignOfTerror", "CooldownReduction", 5f, "Seconds removed from Salvo cooldown per Reign of Terror stack."); DragonPunchCooldown = Config.BindAndOptions("DragonPunch", "DragonPunchCooldown", 30f, "Seconds for Dragon Punch cooldown."); DragonPunchDamage = Config.BindAndOptions("DragonPunch", "DragonPunchDamage", 80f, "Damage multiplier on base damage. 80 is 8000%."); DragonPunchProc = Config.BindAndOptions("DragonPunch", "DragonPunchProc", 3f, "Proc coefficient for Dragon Punch."); DragonPunchChannel = Config.BindAndOptions("DragonPunch", "DragonPunchChannel", 2f, "Seconds Drogoz channels before the punch flight."); DragonPunchFlightTime = Config.BindAndOptions("DragonPunch", "DragonPunchFlightTime", 4f, "Maximum seconds the punch can fly."); DragonPunchSpeed = Config.BindAndOptions("DragonPunch", "DragonPunchSpeed", 35f, "Flight speed in meters per second."); DragonPunchRadius = Config.BindAndOptions("DragonPunch", "DragonPunchRadius", 1.6f, "Sphere radius for enemy hit detection."); DragonPunchExecuteThreshold = Config.BindAndOptions("DragonPunch", "DragonPunchExecuteThreshold", 0.35f, "Health fraction below which Dragon Punch executes."); DragonPunchRefund = Config.BindAndOptions("DragonPunch", "DragonPunchRefund", 0.3f, "Cooldown refund fraction on timeout or cancel."); DragonPunchCancelLockout = Config.BindAndOptions("DragonPunch", "DragonPunchCancelLockout", 0.5f, "Seconds after channeling before Dragon Punch can be canceled. Cancel is not allowed during channel."); DragonPunchKillRadius = Config.BindAndOptions("DragonPunch", "DragonPunchKillRadius", 6f, "Radius of the on-hit bonus payload."); DragonPunchKillDamage = Config.BindAndOptions("DragonPunch", "DragonPunchKillDamage", 4f, "Damage multiplier on base damage for the on-hit bonus payload. 4 is 400%."); SittingDuckRadius = Config.BindAndOptions("DragonPunch", "SittingDuckRadius", 80f, "Retarget radius while Dragon Punch is active."); SittingDuckCheckInterval = Config.BindAndOptions("DragonPunch", "SittingDuckCheckInterval", 0.15f, "Seconds between Sitting Duck retarget sweeps."); SittingDuckAttention = Config.BindAndOptions("DragonPunch", "SittingDuckAttention", 10f, "Seconds an enemy keeps Drogoz as its target after Sitting Duck retargeting."); SittingDuckAffectsUntargeted = Config.BindAndOptions("DragonPunch", "SittingDuckAffectsUntargeted", defaultValue: true, "Allow Sitting Duck to retarget enemies with no current target."); DragonPunchReignDamage = Config.BindAndOptions("DragonPunch", "DragonPunchReignDamage", 22f, "Reign of Terror ram damage multiplier on base damage. 22 is 2200%."); DragonPunchReignConeAngle = Config.BindAndOptions("DragonPunch", "DragonPunchReignConeAngle", 80f, "Full cone angle in degrees for Reign of Terror Dragon Punch."); DragonPunchReignConeRadius = Config.BindAndOptions("DragonPunch", "DragonPunchReignConeRadius", 12f, "Cone length in meters for Reign of Terror Dragon Punch."); DragonPunchReignProc = Config.BindAndOptions("DragonPunch", "DragonPunchReignProc", 1f, "Proc coefficient for each Reign of Terror Dragon Punch cone hit."); DragonPunchReignCooldownReductionPerKill = Config.BindAndOptions("DragonPunch", "DragonPunchReignCooldownReductionPerKill", 3f, "Seconds removed from Dragon Punch cooldown for each enemy killed by the Reign of Terror ram."); DragonPunchReignFlightTime = Config.BindAndOptions("DragonPunch", "DragonPunchReignFlightTime", 6f, "Base maximum seconds the Reign of Terror Dragon Punch ram can fly."); DragonPunchReignHitCooldown = Config.BindAndOptions("DragonPunch", "DragonPunchReignHitCooldown", 0.5f, "Seconds before the same enemy can be hit again by the Reign of Terror ram."); DragonPunchReignDamageGrowthPerHit = Config.BindAndOptions("DragonPunch", "DragonPunchReignDamageGrowthPerHit", 1.15f, "Damage multiplier growth per Reign of Terror ram hit."); DragonPunchReignMaxDamageMultiplier = Config.BindAndOptions("DragonPunch", "DragonPunchReignMaxDamageMultiplier", 3f, "Maximum damage multiplier for the Reign of Terror ram."); DragonPunchReignKillDurationBonus = Config.BindAndOptions("DragonPunch", "DragonPunchReignKillDurationBonus", 1f, "Seconds added to the Reign of Terror ram duration for the first kill."); DragonPunchReignKillDurationFalloff = Config.BindAndOptions("DragonPunch", "DragonPunchReignKillDurationFalloff", 0.5f, "Multiplier applied to the duration bonus for each kill after the first."); DragonPunchReignHitStop = Config.BindAndOptions("DragonPunch", "DragonPunchReignHitStop", 0.05f, "Seconds the Reign of Terror ram stops on each hit."); DragonPunchReignStartSpeedFactor = Config.BindAndOptions("DragonPunch", "DragonPunchReignStartSpeedFactor", 0.75f, "Reign of Terror ram starting speed as a fraction of Dragon Punch speed."); DragonPunchReignMaxSpeedFactor = Config.BindAndOptions("DragonPunch", "DragonPunchReignMaxSpeedFactor", 1.5f, "Maximum Reign of Terror ram speed as a fraction of Dragon Punch speed."); DragonPunchReignMaxRadiusFactor = Config.BindAndOptions("DragonPunch", "DragonPunchReignMaxRadiusFactor", 2.5f, "Maximum Reign of Terror ram hit radius multiplier."); BoosterFuelPerExtraJump = Config.BindAndOptions("Booster", "FuelPerExtraJump", 25f, "Fuel added for each extra jump granted by Feather or Earthbound Vessel."); BoosterAimPitchOffset = Config.BindAndOptions("Booster", "AimPitchOffset", 3f / 28f, "Vertical aim blend added while Booster is active. The default is about 7.5 degrees, 10 degrees less than the old 17.5-degree offset. Positive values aim higher."); BoosterFuelCapacity = Config.BindAndOptions("Booster", "FuelCapacity", 100f, "Maximum Booster fuel."); BoosterFuelDrainRate = Config.BindAndOptions("Booster", "FuelDrainRate", 31.25f, "Fuel used per second while flying. 100 fuel lasts 3.2 seconds."); BoosterFuelRefillDelay = Config.BindAndOptions("Booster", "FuelRefillDelay", 0f, "Seconds after the last fuel use before fuel refills. Default 0 starts refill immediately on the ground."); BoosterFuelRefillRate = Config.BindAndOptions("Booster", "FuelRefillRate", 34.2f, "Base fuel restored per second after the refill delay. With the 1.5 ground multiplier, max fuel takes 2.7 seconds including delay."); BoosterOverspeedDrag = Config.BindAndOptions("Booster", "OverspeedDrag", 0.75f, "Minimum speed reduction per second just above MaxHorizontalSpeed."); BoosterOverspeedDragMax = Config.BindAndOptions("Booster", "OverspeedDragMax", 15f, "Maximum speed reduction per second at OverspeedDragFullSpeed."); BoosterOverspeedDragFullSpeed = Config.BindAndOptions("Booster", "OverspeedDragFullSpeed", 45f, "Total horizontal speed where overspeed drag reaches its maximum."); BoosterGroundRefillMultiplier = Config.BindAndOptions("Booster", "GroundRefillMultiplier", 1f, "Fuel refill speed multiplier while grounded."); BoosterAirRefillMultiplier = Config.BindAndOptions("Booster", "AirRefillMultiplier", 1f, "Fuel refill speed multiplier while in the air."); BoosterReactivationPercent = Config.BindAndOptions("Booster", "ReactivationPercent", 0.15f, "Fuel percentage required to restart Booster after the tank reaches zero. 0.15 is 15%."); BoosterLiftAcceleration = Config.BindAndOptions("Booster", "LiftAcceleration", 40f, "Upward acceleration in meters per second squared."); BoosterMaxLiftSpeed = Config.BindAndOptions("Booster", "MaxLiftSpeed", 7f, "Maximum upward speed added by Booster."); BoosterHorizontalAcceleration = Config.BindAndOptions("Booster", "HorizontalAcceleration", 11.9f, "Horizontal acceleration while Booster is active. At or above MaxHorizontalSpeed, it adds speed-neutral strafing instead of more speed."); BoosterSteeringSpeed = Config.BindAndOptions("Booster", "SteeringSpeed", 30f, "Degrees per second Booster can turn horizontal velocity while at or above MaxHorizontalSpeed. This turn assist does not add speed."); BoosterMaxHorizontalSpeed = Config.BindAndOptions("Booster", "MaxHorizontalSpeed", 20f, "Base maximum total horizontal speed Booster can accelerate toward. Body movement-speed bonuses use MoveSpeedBonusEffectiveness. Wyrm Jets keeps its full effect. Existing momentum above the cap is kept and reduced by drag."); BoosterMoveSpeedBonusEffectiveness = Config.BindAndOptions("Booster", "MoveSpeedBonusEffectiveness", 0.25f, "Fraction of body movement-speed bonuses applied to the Booster cap. 0.25 uses one quarter of each bonus."); BoosterAirControlMultiplier = Config.BindAndOptions("Booster", "AirControlMultiplier", 0.054f, "Air control used while Booster is active. Lower this to reduce vanilla speed dampening. Movement-speed bonuses reduce this dampening further. The original value is restored on landing."); NormalAirControlMultiplier = Config.BindAndOptions("Booster", "NormalAirControlMultiplier", 0.036f, "Air control used while airborne without Booster. Lower this to reduce vanilla speed dampening. Movement-speed bonuses reduce this dampening further. The original value is restored on landing."); BoosterShowFuelHud = Config.BindAndOptions("Booster", "ShowFuelHud", defaultValue: true, "Show the local player Booster fuel meter."); AirAggroEnabled = Config.BindAndOptions("AirAggro", "Enabled", defaultValue: true, "Give airborne Drogoz a small chance to be targeted by nearby enemies."); AirAggroChance = Config.BindAndOptions("AirAggro", "Chance", 0.15f, "Chance per nearby enemy check to target airborne Drogoz. 0.15 is 15%."); AirAggroRadius = Config.BindAndOptions("AirAggro", "Radius", 25f, "Maximum distance in meters for the airborne target bias."); AirAggroMaxDistanceRatio = Config.BindAndOptions("AirAggro", "MaxDistanceRatio", 1.5f, "Maximum Drogoz distance compared with the current target. A closer teammate keeps priority beyond this ratio."); AirAggroAttentionDuration = Config.BindAndOptions("AirAggro", "AttentionDuration", 2f, "Seconds an enemy keeps Drogoz as its attack target after a successful bias."); AirAggroCheckInterval = Config.BindAndOptions("AirAggro", "CheckInterval", 0.5f, "Seconds between airborne target checks."); } } internal static class DrogozDamageTypes { internal static ModdedDamageType RocketSplash; internal static ModdedDamageType SalvoRocket; internal static ModdedDamageType SalvoLastRocket; internal static bool initialized; internal static void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) if (!initialized) { RocketSplash = DamageAPI.ReserveDamageType(); SalvoRocket = DamageAPI.ReserveDamageType(); SalvoLastRocket = DamageAPI.ReserveDamageType(); initialized = true; } } } internal static class DrogozDebugCommands { [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCRefundThrust(ConCommandArgs args) { CharacterBody val = ((ConCommandArgs)(ref args)).TryGetSenderBody(); if (!IsDrogoz(val)) { ((ConCommandArgs)(ref args)).Log((object)"The sender must be Drogoz."); return; } float seconds = DrogozConfig.ThrustRefundPerEnemy.Value; float? num = ((ConCommandArgs)(ref args)).TryGetArgFloat(0); if (num.HasValue) { seconds = Mathf.Max(0f, num.Value); } float num2 = (Object.op_Implicit((Object)(object)val.skillLocator.utility) ? val.skillLocator.utility.cooldownRemaining : 0f); bool flag = Thrust.ReduceCooldown(val, seconds); float num3 = (Object.op_Implicit((Object)(object)val.skillLocator.utility) ? val.skillLocator.utility.cooldownRemaining : 0f); ((ConCommandArgs)(ref args)).Log((object)(flag ? ("Thrust cooldown: " + num2.ToString("0.00") + "s -> " + num3.ToString("0.00") + "s") : "Thrust has no active cooldown to reduce.")); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCSetBoosterFuel(ConCommandArgs args) { CharacterBody val = ((ConCommandArgs)(ref args)).TryGetSenderBody(); if (!IsDrogoz(val)) { ((ConCommandArgs)(ref args)).Log((object)"The sender must be Drogoz."); return; } DrogozBooster component = ((Component)val).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { ((ConCommandArgs)(ref args)).Log((object)"Drogoz has no Booster component."); return; } float num = 100f; float? num2 = ((ConCommandArgs)(ref args)).TryGetArgFloat(0); if (num2.HasValue) { num = Mathf.Clamp(num2.Value, 0f, 100f); } component.SetFuel(component.FuelCapacity * num * 0.01f); ((ConCommandArgs)(ref args)).Log((object)("Booster fuel: " + Mathf.RoundToInt(component.FuelPercent * 100f) + "%")); } [ConCommand(/*Could not decode attribute arguments.*/)] private static void CCTestCards(ConCommandArgs args) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = ((ConCommandArgs)(ref args)).TryGetSenderBody(); if (!IsDrogoz(body)) { ((ConCommandArgs)(ref args)).Log((object)"The sender must be Drogoz."); } else { DrogozCardSelfTest.Run(body, (Action)((ConCommandArgs)(object)args).Log); } } private static bool IsDrogoz(CharacterBody body) { if (Object.op_Implicit((Object)(object)body)) { return ((Object)((Component)body).gameObject).name == "DrogozBody"; } return false; } } internal static class DrogozDragonPunchHooks { private static bool hooked; internal static void Init() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (!hooked) { SetStateOnHurt.SetStun += new hook_SetStun(OnSetStun); SetStateOnHurt.SetFrozen += new hook_SetFrozen(OnSetFrozen); SetStateOnHurt.SetShock += new hook_SetShock(OnSetShock); HealthComponent.TakeDamage += new hook_TakeDamage(OnTakeDamage); hooked = true; } } private static bool ShouldIgnoreCrowdControl(SetStateOnHurt self) { if (!Object.op_Implicit((Object)(object)self)) { return false; } CharacterBody val = (Object.op_Implicit((Object)(object)self.targetStateMachine) ? ((Component)self.targetStateMachine).GetComponent() : ((Component)self).GetComponent()); if (!Object.op_Implicit((Object)(object)val)) { return false; } if (Object.op_Implicit((Object)(object)DrogozSittingDuck.buffDef) && val.HasBuff(DrogozSittingDuck.buffDef)) { return true; } DrogozDragonPunchComponent component = ((Component)val).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { return component.IsFlying; } return false; } private static bool IsPunching(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return false; } if (Object.op_Implicit((Object)(object)DrogozSittingDuck.buffDef) && body.HasBuff(DrogozSittingDuck.buffDef)) { return true; } DrogozDragonPunchComponent component = ((Component)body).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { return component.IsFlying; } return false; } private static void OnSetStun(orig_SetStun orig, SetStateOnHurt self, float duration) { if (!ShouldIgnoreCrowdControl(self)) { orig.Invoke(self, duration); } } private static void OnSetFrozen(orig_SetFrozen orig, SetStateOnHurt self, float duration) { if (!ShouldIgnoreCrowdControl(self)) { orig.Invoke(self, duration); } } private static void OnSetShock(orig_SetShock orig, SetStateOnHurt self, float duration) { if (!ShouldIgnoreCrowdControl(self)) { orig.Invoke(self, duration); } } private static void OnTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && damageInfo != null && IsPunching(self.body)) { ref DamageType damageType = ref damageInfo.damageType.damageType; damageType = (DamageType)((uint)damageType & 0xFFFFFEFFu); } orig.Invoke(self, damageInfo); } } internal static class DrogozEasyTarget { internal static BuffDef buffDef; internal static void Init() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)buffDef)) { Sprite val = DrogozIcons.LoadEmbeddedSprite("easytargetdebuff.png"); string arg = (Object.op_Implicit((Object)(object)val) ? "embedded:easytargetdebuff.png" : "none"); buffDef = Content.CreateAndAddBuff("PERSONAL_DROGOZ_EASY_TARGET", val, Color.white, canStack: false, isDebuff: true); Log.Debug("Buffs", $"Easy Target icon loaded={(Object)(object)val != (Object)null} source={arg}"); buffDef.isCooldown = false; buffDef.isHidden = false; } } internal static void Apply(CharacterBody body) { //IL_002a: 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_0092: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && (NetworkServer.active || body.hasEffectiveAuthority) && Object.op_Implicit((Object)(object)buffDef)) { int buffCount = body.GetBuffCount(buffDef.buffIndex); if (buffCount != 1) { body.SetBuffCount(buffDef.buffIndex, 1); Log.Debug("Buffs", $"Easy Target applied body={((Object)body).name} server={NetworkServer.active} authority={body.hasEffectiveAuthority} old={buffCount} new={body.GetBuffCount(buffDef.buffIndex)} hasIcon={(Object)(object)buffDef.iconSprite != (Object)null}"); } } } internal static void Remove(CharacterBody body) { //IL_0029: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body) && (NetworkServer.active || body.hasEffectiveAuthority) && Object.op_Implicit((Object)(object)buffDef) && body.GetBuffCount(buffDef.buffIndex) > 0) { int buffCount = body.GetBuffCount(buffDef.buffIndex); body.SetBuffCount(buffDef.buffIndex, 0); Log.Debug("Buffs", $"Easy Target removed body={((Object)body).name} server={NetworkServer.active} authority={body.hasEffectiveAuthority} old={buffCount} new={body.GetBuffCount(buffDef.buffIndex)}"); } } } internal static class DrogozIcons { internal static Sprite LoadBuffIcon(BuffDef vanillaIcon, string addressablePath, string bundleTextureName, string embeddedFileName, out string source) { //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) source = "none"; if (Object.op_Implicit((Object)(object)vanillaIcon) && Object.op_Implicit((Object)(object)vanillaIcon.iconSprite)) { source = "BuffDef.iconSprite"; return vanillaIcon.iconSprite; } if (Object.op_Implicit((Object)(object)vanillaIcon) && !string.IsNullOrEmpty(vanillaIcon.iconPath)) { Sprite val = LegacyResourcesAPI.Load(vanillaIcon.iconPath); if (Object.op_Implicit((Object)(object)val)) { source = vanillaIcon.iconPath; return val; } } if (!string.IsNullOrEmpty(addressablePath)) { string[] pathVariants = GetPathVariants(addressablePath); for (int i = 0; i < pathVariants.Length; i++) { Sprite val2 = null; try { val2 = Addressables.LoadAssetAsync((object)pathVariants[i]).WaitForCompletion(); } catch { val2 = null; } if (!Object.op_Implicit((Object)(object)val2)) { val2 = LegacyResourcesAPI.Load(pathVariants[i]); } if (Object.op_Implicit((Object)(object)val2)) { source = pathVariants[i]; return val2; } } } if (!string.IsNullOrEmpty(bundleTextureName)) { AssetBundle val3 = Asset.LoadAssetBundle("drogozassetbundle"); Texture2D val4 = (Object.op_Implicit((Object)(object)val3) ? val3.LoadAsset(bundleTextureName) : null); if (Object.op_Implicit((Object)(object)val4)) { Sprite result = CreateSprite(val4, bundleTextureName); source = "drogozassetbundle:" + bundleTextureName; return result; } } if (!string.IsNullOrEmpty(embeddedFileName)) { Sprite val5 = LoadEmbeddedSprite(embeddedFileName); if (Object.op_Implicit((Object)(object)val5)) { source = "embedded:" + embeddedFileName; return val5; } } return null; } private static string[] GetPathVariants(string path) { int num = path.LastIndexOf('.'); string text = ((num > 0 && num < path.Length - 1) ? path.Substring(0, num) : path); return new string[4] { path, text, "Assets/" + path, "Assets/" + text }; } private static Sprite CreateSprite(Texture2D texture, string name) { //IL_0019: 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) Sprite obj = Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f), 100f); ((Object)obj).name = name; return obj; } internal static Sprite LoadEmbeddedSprite(string fileName) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown Assembly assembly = typeof(DrogozIcons).Assembly; string[] manifestResourceNames = assembly.GetManifestResourceNames(); for (int i = 0; i < manifestResourceNames.Length; i++) { if (!manifestResourceNames[i].EndsWith(fileName, StringComparison.OrdinalIgnoreCase)) { continue; } using Stream stream = assembly.GetManifestResourceStream(manifestResourceNames[i]); if (stream == null) { continue; } byte[] array = new byte[stream.Length]; int num; for (int j = 0; j < array.Length; j += num) { num = stream.Read(array, j, array.Length - j); if (num <= 0) { break; } } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, array)) { continue; } return CreateSprite(val, fileName); } return null; } } internal static class DrogozIronclad { internal static BuffDef buffDef; internal static void Init() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)buffDef)) { Sprite buffIcon = DrogozIcons.LoadEmbeddedSprite("ccimmune.png"); buffDef = Content.CreateAndAddBuff("PERSONAL_DROGOZ_IRONCLAD", buffIcon, new Color(1f, 0.8f, 0.2f), canStack: false, isDebuff: false); buffDef.isCooldown = false; buffDef.isHidden = false; } } internal static void Apply(CharacterBody body) { //IL_002a: 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) if (Object.op_Implicit((Object)(object)body) && (NetworkServer.active || body.hasEffectiveAuthority) && Object.op_Implicit((Object)(object)buffDef) && body.GetBuffCount(buffDef.buffIndex) != 1) { body.SetBuffCount(buffDef.buffIndex, 1); } } internal static void Remove(CharacterBody body) { //IL_002a: 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) if (Object.op_Implicit((Object)(object)body) && (NetworkServer.active || body.hasEffectiveAuthority) && Object.op_Implicit((Object)(object)buffDef) && body.GetBuffCount(buffDef.buffIndex) > 0) { body.SetBuffCount(buffDef.buffIndex, 0); } } } internal static class DrogozMark { internal static BuffDef buffDef; private static bool hooked; internal static void Init() { //IL_0048: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)buffDef)) { BuffDef malignantAttraction = Buffs.MalignantAttraction; string source; Sprite buffIcon = DrogozIcons.LoadBuffIcon(null, null, null, "draconicbrand.png", out source); buffDef = Content.CreateAndAddBuff("PERSONAL_DROGOZ_DRACONIC_BRAND", buffIcon, (Color)(Object.op_Implicit((Object)(object)malignantAttraction) ? malignantAttraction.buffColor : new Color(1f, 0.35f, 0.1f)), canStack: false, isDebuff: true); Log.Debug("Buffs", $"Draconic Brand custom buff hasIcon={(Object)(object)buffDef != (Object)null && (Object)(object)buffDef.iconSprite != (Object)null} source={source}"); if (!hooked) { HealthComponent.TakeDamage += new hook_TakeDamage(HandleTakeDamage); hooked = true; } } } internal static void Apply(CharacterBody victim, GameObject source, float bonusDuration = 0f) { if (NetworkServer.active && Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)source)) { DrogozMarkComponent drogozMarkComponent = ((Component)victim).GetComponent(); if (!Object.op_Implicit((Object)(object)drogozMarkComponent)) { drogozMarkComponent = ((Component)victim).gameObject.AddComponent(); } float num = Mathf.Max(0.1f, DrogozConfig.MarkDuration.Value + Mathf.Max(0f, bonusDuration)); drogozMarkComponent.AddSource(source, Time.time + num); Log.Debug("Abilities", $"Draconic Brand applied target={((Object)victim).name} duration={num:0.00}s bonus={bonusDuration:0.00}s hasIcon={(Object)(object)buffDef != (Object)null && (Object)(object)buffDef.iconSprite != (Object)null}"); victim.AddTimedBuff(buffDef, num); } } private static void HandleTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)self.body) && self.body.GetBuffCount(buffDef.buffIndex) > 0) { damageInfo.damage *= 1f + Mathf.Max(0f, DrogozConfig.MarkDamageBonus.Value); } orig.Invoke(self, damageInfo); } } internal static class DrogozProjectileAim { private sealed class AimBones { public Transform Model; public Transform Muzzle; public Transform Fallback; public Transform Head; } private const string MuzzleBone = "muzzleflash_bn"; private const string FallbackBone = "r_wep_root_bn"; private const string HeadBone = "head"; private const float MaxDistance = 1000f; private static readonly ConditionalWeakTable boneCache = new ConditionalWeakTable(); public static Transform FindBone(CharacterBody body, string boneName) { AimBones bones = GetBones(body); if (bones == null) { return null; } return (Transform)(boneName switch { "muzzleflash_bn" => bones.Muzzle, "r_wep_root_bn" => bones.Fallback, "head" => bones.Head, _ => FindTransform(bones.Model, boneName), }); } private static AimBones GetBones(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.modelLocator) || !Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) { return null; } Transform modelTransform = body.modelLocator.modelTransform; if (boneCache.TryGetValue(body, out var value) && (Object)(object)value.Model == (Object)(object)modelTransform) { return value; } value = new AimBones { Model = modelTransform, Muzzle = FindTransform(modelTransform, "muzzleflash_bn"), Fallback = FindTransform(modelTransform, "r_wep_root_bn"), Head = FindTransform(modelTransform, "head") }; if (boneCache.TryGetValue(body, out var _)) { boneCache.Remove(body); } boneCache.Add(body, value); return value; } public static bool GetMuzzleAim(GameObject owner, Ray aim, out Vector3 origin, out Vector3 direction) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) AimBones bones = GetBones(Object.op_Implicit((Object)(object)owner) ? owner.GetComponent() : null); Transform val = bones?.Muzzle; if (!Object.op_Implicit((Object)(object)val) && bones != null) { val = bones.Fallback; } Vector3 start = (Object.op_Implicit((Object)(object)val) ? val.position : ((Ray)(ref aim)).origin); return ResolveAim(owner, aim, start, (Object)(object)val != (Object)null, out origin, out direction); } public static bool GetHeadAim(GameObject owner, Ray aim, out Vector3 origin, out Vector3 direction) { //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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)owner) ? owner.GetComponent() : null); Transform val2 = GetBones(val)?.Head; Vector3 start = (Object.op_Implicit((Object)(object)val2) ? val2.position : (Object.op_Implicit((Object)(object)val) ? (val.corePosition + Vector3.up * 0.75f) : ((Ray)(ref aim)).origin)); return ResolveAim(owner, aim, start, (Object)(object)val2 != (Object)null, out origin, out direction); } private static Transform FindTransform(Transform root, string name) { if (!Object.op_Implicit((Object)(object)root)) { return null; } if (((Object)root).name == name) { return root; } for (int i = 0; i < root.childCount; i++) { Transform val = FindTransform(root.GetChild(i), name); if (Object.op_Implicit((Object)(object)val)) { return val; } } return null; } private static bool ResolveAim(GameObject owner, Ray aim, Vector3 start, bool boneFound, out Vector3 origin, out Vector3 direction) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) origin = start; direction = ((Ray)(ref aim)).direction; RaycastHit val = default(RaycastHit); if (Physics.Linecast(((Ray)(ref aim)).origin, origin, ref val, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { origin = ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * 0.1f; } Vector3 point = ((Ray)(ref aim)).GetPoint(1000f); RaycastHit val2 = default(RaycastHit); if (Util.CharacterRaycast(owner, aim, ref val2, 1000f, LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.entityPrecise)).mask)), (QueryTriggerInteraction)1)) { point = ((RaycastHit)(ref val2)).point; } Vector3 val3 = point - origin; if (((Vector3)(ref val3)).sqrMagnitude > 0.0001f) { direction = ((Vector3)(ref val3)).normalized; } if (Vector3.Dot(direction, ((Ray)(ref aim)).direction) < -0.1f) { direction = ((Ray)(ref aim)).direction; } return boneFound; } } internal static class DrogozSittingDuck { internal static BuffDef buffDef; internal static void Init() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)buffDef)) { Sprite buffIcon = DrogozIcons.LoadEmbeddedSprite("sittingduckdebuff.png"); buffDef = Content.CreateAndAddBuff("PERSONAL_DROGOZ_SITTING_DUCK", buffIcon, Color.white, canStack: false, isDebuff: true); buffDef.isCooldown = false; buffDef.isHidden = false; } } internal static void Apply(CharacterBody body) { //IL_002a: 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) if (Object.op_Implicit((Object)(object)body) && (NetworkServer.active || body.hasEffectiveAuthority) && Object.op_Implicit((Object)(object)buffDef) && body.GetBuffCount(buffDef.buffIndex) != 1) { body.SetBuffCount(buffDef.buffIndex, 1); } } internal static void Remove(CharacterBody body) { //IL_002a: 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) if (Object.op_Implicit((Object)(object)body) && (NetworkServer.active || body.hasEffectiveAuthority) && Object.op_Implicit((Object)(object)buffDef) && body.GetBuffCount(buffDef.buffIndex) > 0) { body.SetBuffCount(buffDef.buffIndex, 0); } } } internal static class DrogozSounds { internal static bool UseWwise; internal static AudioClip[] RocketShoot; internal static AudioClip[] RocketImpact; internal static AudioClip[] RocketExplosion; internal static AudioClip[] Thrust; internal static AudioClip[] SalvoArm; internal static AudioClip[] FireSpitShoot; internal static AudioClip[] FireSpitExplosion; internal static AudioClip[] FireSpitImpact; internal static AudioClip[] Walk; internal static AudioClip[] BoosterLoop; internal static AudioClip[] DragonPunchLaunch; internal static AudioClip[] DragonPunchLoop; internal static AudioClip[] DragonPunchImpact; internal static AudioClip[] DragonPunchShutdown; internal static string[] RocketShootEvents; internal static string[] RocketImpactEvents; internal static string[] RocketExplosionEvents; internal static string[] ThrustEvents; internal static string[] SalvoArmEvents; internal static string[] FireSpitShootEvents; internal static string[] FireSpitExplosionEvents; internal static string[] FireSpitImpactEvents; internal static string[] WalkEvents; internal static string[] BoosterLoopEvents; internal static string[] DragonPunchLaunchEvents; internal static string[] DragonPunchLoopEvents; internal static string[] DragonPunchImpactEvents; internal static string[] DragonPunchShutdownEvents; private const float WwiseOneShotMaxVolume = 0.5f; private const float WwiseCloseMinVolume = 0.12f; internal static void Init(AssetBundle bundle) { UseWwise = LoadSoundBank(); if (Object.op_Implicit((Object)(object)bundle)) { AudioClip[] all = bundle.LoadAllAssets(); RocketShoot = Find(all, "drogoz_rocket_shoot_3p_"); RocketImpact = Find(all, "drogoz_rocket_impact_"); RocketExplosion = Find(all, "drogoz_rocket_explosion_"); Thrust = Find(all, "drogoz_thrust", "drogoz_thrust_loop"); SalvoArm = Find(all, "drogoz_salvo_arm", "drogoz_salvo_arm_steam"); FireSpitShoot = Find(all, "drogoz_firespit_shoot", "drogoz_firespit_shoot_"); FireSpitExplosion = Find(all, "drogoz_firespit_explosion_"); FireSpitImpact = Find(all, "drogoz_firespit_impact"); Walk = Find(all, "drogoz_walk_", "drogoz_walk_1p_"); BoosterLoop = Find(all, "drogoz_booster_loop_3p"); DragonPunchLaunch = Find(all, "drogoz_dragonpunch_launch"); DragonPunchLoop = Find(all, "drogoz_dragonpunch_loop"); DragonPunchImpact = Find(all, "drogoz_dragonpunch_impact"); DragonPunchShutdown = Find(all, "drogoz_dragonpunch_shutdown"); RocketShootEvents = EventNames(RocketShoot); RocketImpactEvents = EventNames(RocketImpact); RocketExplosionEvents = EventNames(RocketExplosion); ThrustEvents = EventNames(Thrust); SalvoArmEvents = EventNames(SalvoArm); FireSpitShootEvents = EventNames(FireSpitShoot); FireSpitExplosionEvents = EventNames(FireSpitExplosion); FireSpitImpactEvents = EventNames(FireSpitImpact); WalkEvents = EventNames(Walk); BoosterLoopEvents = EventNames(BoosterLoop); DragonPunchLaunchEvents = EventNames(DragonPunchLaunch); DragonPunchLoopEvents = EventNames(DragonPunchLoop); DragonPunchImpactEvents = EventNames(DragonPunchImpact); DragonPunchShutdownEvents = EventNames(DragonPunchShutdown); Log.Message("Drogoz audio mode: " + (UseWwise ? "Wwise" : "Unity fallback") + ". " + $"shoot={Count(RocketShoot)}, impact={Count(RocketImpact)}, " + $"explosion={Count(RocketExplosion)}, thrust={Count(Thrust)}, salvo={Count(SalvoArm)}, " + $"spitShoot={Count(FireSpitShoot)}, spitBoom={Count(FireSpitExplosion)}, " + $"spitHit={Count(FireSpitImpact)}, walk={Count(Walk)}, booster={Count(BoosterLoop)}."); Log.Message($"Drogoz Dragon Punch audio: launch={Count(DragonPunchLaunch)}, " + $"loop={Count(DragonPunchLoop)}, impact={Count(DragonPunchImpact)}, " + $"shutdown={Count(DragonPunchShutdown)}."); } } private static bool LoadSoundBank() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)DrogozSurvivorPlugin.instance).Info.Location); string text = Path.Combine(directoryName, "SoundBanks", "DrogozSoundbank.bnk"); if (!File.Exists(text)) { text = Path.Combine(directoryName, "DrogozSoundbank.bnk"); } if (!File.Exists(text)) { Log.Warning("Drogoz Wwise soundbank is missing. Using Unity audio fallback."); return false; } byte[] array = File.ReadAllBytes(text); if (array.Length < 12 || array[0] != 66 || array[1] != 75 || array[2] != 72 || array[3] != 68) { Log.Warning("Drogoz Wwise soundbank header is invalid. Using Unity audio fallback."); return false; } uint num = BitConverter.ToUInt32(array, 8); if (num != 150) { Log.Warning($"Drogoz Wwise bank version {num} does not match the game's version 150. Using Unity audio fallback."); return false; } SoundBanks.Add(array); Log.Message("Drogoz Wwise soundbank queued: " + text); return true; } private static AudioClip[] Find(AudioClip[] all, string prefix, string exclude = null) { List list = new List(); foreach (AudioClip val in all) { if (Object.op_Implicit((Object)(object)val) && ((Object)val).name.StartsWith(prefix, StringComparison.OrdinalIgnoreCase) && (string.IsNullOrEmpty(exclude) || !((Object)val).name.StartsWith(exclude, StringComparison.OrdinalIgnoreCase))) { list.Add(val); } } list.Sort((AudioClip a, AudioClip b) => string.CompareOrdinal(((Object)a).name, ((Object)b).name)); return list.ToArray(); } private static string[] EventNames(AudioClip[] clips) { if (clips == null) { return Array.Empty(); } string[] array = new string[clips.Length]; for (int i = 0; i < clips.Length; i++) { array[i] = "Play_" + ((Object)clips[i]).name; } return array; } private static int Count(AudioClip[] clips) { if (clips != null) { return clips.Length; } return 0; } internal static float GetVolumeScale() { return Mathf.Clamp01(Mathf.Clamp01(DrogozConfig.AudioVolumeScale.Value) * GetVolumePercent("volume_master") * GetVolumePercent("volume_sfx")); } private static float GetVolumePercent(string commandName) { BaseConVar val = (Object.op_Implicit((Object)(object)Console.instance) ? Console.instance.FindConVar(commandName) : null); if (val == null) { return 1f; } if (!float.TryParse(val.GetString(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 1f; } return Mathf.Clamp01(result / 100f); } private static void Play(AudioClip[] clips, string[] events, Vector3 position, float volume, float maxDistance, float closeRangeDistance = 0f) { //IL_00c5: 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_003f: Expected O, but got Unknown //IL_0045: 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 (clips == null || clips.Length == 0 || events == null || events.Length != clips.Length) { return; } int num = Random.Range(0, clips.Length); AudioClip val = clips[num]; if (!Object.op_Implicit((Object)(object)val)) { return; } if (UseWwise) { GameObject val2 = new GameObject("DrogozOneShotSound"); val2.transform.position = position; val2.AddComponent(); float num2 = ApplyWwiseCloseRangeScale(val2, position, closeRangeDistance); uint num3 = Util.PlaySound(events[num], val2); if (num3 != 0) { Log.Debug("Audio", $"Drogoz Wwise sound started: {events[num]}, id={num3}, volumeScale={num2:0.00}."); Object.Destroy((Object)(object)val2, val.length + 0.1f); return; } Object.Destroy((Object)(object)val2); Log.Debug("Audio", "Drogoz Wwise event missing, falling back to Unity: " + events[num] + "."); } PlayUnity(val, position, volume, maxDistance); } private static float ApplyWwiseCloseRangeScale(GameObject sourceObject, Vector3 position, float distance) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(DrogozConfig.AudioVolumeScale.Value); AkAudioListener val = null; List listenerList = ((BaseListenerList)AkAudioListener.DefaultListeners).ListenerList; for (int i = 0; i < listenerList.Count; i++) { if (Object.op_Implicit((Object)(object)listenerList[i])) { val = listenerList[i]; break; } } if (!Object.op_Implicit((Object)(object)val)) { return num; } float num2 = num; if (distance > 0f) { float num3 = Mathf.Clamp01(Vector3.Distance(position, ((Component)val).transform.position) / distance); num2 *= Mathf.Lerp(0.12f, 0.5f, num3); } AkSoundEngine.SetGameObjectOutputBusVolume(sourceObject, ((Component)val).gameObject, num2); return num2; } internal static void ApplyWwiseDefaultVolume(GameObject sourceObject) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ApplyWwiseCloseRangeScale(sourceObject, sourceObject.transform.position, 0f); } private static void PlayUnity(AudioClip clip, Vector3 position, float volume, float maxDistance) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_00ad: Expected O, but got Unknown GameObject val = new GameObject("DrogozOneShotSound"); val.transform.position = position; AudioSource obj = val.AddComponent(); obj.clip = clip; obj.volume = Mathf.Max(0f, volume) * GetVolumeScale(); obj.spatialBlend = 1f; obj.minDistance = 2f; obj.maxDistance = Mathf.Max(3f, maxDistance); obj.rolloffMode = (AudioRolloffMode)1; obj.dopplerLevel = 0f; obj.Play(); Log.Debug("Audio", $"Drogoz Unity sound started: {((Object)clip).name}, global={GetVolumeScale():0.00}."); Object.Destroy((Object)val, clip.length + 0.1f); } internal static void PlayRocketShoot(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(RocketShoot, RocketShootEvents, position, 0.22f, 45f); } internal static void PlayRocketImpact(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(RocketImpact, RocketImpactEvents, position, 0.28f, 40f, 6f); } internal static void PlayRocketExplosion(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(RocketExplosion, RocketExplosionEvents, position, 0.45f, 55f, 8f); } internal static void PlayThrust(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(Thrust, ThrustEvents, position, 0.3f, 40f); } internal static void PlaySalvoArm(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(SalvoArm, SalvoArmEvents, position, 0.3f, 35f); } internal static void PlayFireSpitShoot(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(FireSpitShoot, FireSpitShootEvents, position, 0.28f, 40f); } internal static void PlayFireSpitExplosion(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(FireSpitExplosion, FireSpitExplosionEvents, position, 0.45f, 55f, 8f); } internal static void PlayFireSpitImpact(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(FireSpitImpact, FireSpitImpactEvents, position, 0.3f, 35f, 6f); } internal static void PlayWalk(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(Walk, WalkEvents, position, 0.15f, 18f); } internal static void PlayDragonPunchLaunch(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(DragonPunchLaunch, DragonPunchLaunchEvents, position, 0.45f, 60f); } internal static void PlayDragonPunchImpact(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(DragonPunchImpact, DragonPunchImpactEvents, position, 0.65f, 80f, 8f); } internal static void PlayDragonPunchShutdown(Vector3 position) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) Play(DragonPunchShutdown, DragonPunchShutdownEvents, position, 0.3f, 40f); } internal static GameObject StartDragonPunchLoop(GameObject owner) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)owner) || DragonPunchLoop == null || DragonPunchLoop.Length == 0) { return null; } GameObject val = new GameObject("DrogozDragonPunchLoop"); val.transform.SetParent(owner.transform, false); val.transform.localPosition = Vector3.zero; if (UseWwise && DragonPunchLoopEvents != null && DragonPunchLoopEvents.Length == DragonPunchLoop.Length) { val.AddComponent(); ApplyWwiseDefaultVolume(val); int num = Random.Range(0, DragonPunchLoopEvents.Length); if (Util.PlaySound(DragonPunchLoopEvents[num], val) != 0) { Log.Debug("Audio", "Drogoz dragon punch loop started: " + DragonPunchLoopEvents[num]); return val; } AkSoundEngine.StopAll(val); Object.Destroy((Object)(object)val.GetComponent()); Log.Debug("Audio", "Drogoz Wwise loop event missing, falling back to Unity: " + DragonPunchLoopEvents[num] + "."); } AudioSource val2 = val.AddComponent(); val2.clip = DragonPunchLoop[Random.Range(0, DragonPunchLoop.Length)]; val2.loop = true; val2.volume = 0.5f * GetVolumeScale(); val2.spatialBlend = 1f; val2.minDistance = 2f; val2.maxDistance = 60f; val2.rolloffMode = (AudioRolloffMode)1; val2.dopplerLevel = 0f; val2.Play(); Log.Debug("Audio", "Drogoz dragon punch loop started: " + ((Object)val2.clip).name); return val; } internal static void StopDragonPunchLoop(GameObject loopObject) { if (Object.op_Implicit((Object)(object)loopObject)) { if (UseWwise) { AkSoundEngine.StopAll(loopObject); } Object.Destroy((Object)(object)loopObject); Log.Debug("Audio", "Drogoz dragon punch loop stopped."); } } } internal enum DrogozSpecialKind { None, Salvo, DragonPunch, Other } internal static class DrogozSpecial { internal static DrogozSpecialKind GetSpecial(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.skillLocator) || !Object.op_Implicit((Object)(object)body.skillLocator.special)) { return DrogozSpecialKind.None; } SkillDef skillDef = body.skillLocator.special.skillDef; if (!Object.op_Implicit((Object)(object)skillDef)) { return DrogozSpecialKind.None; } if (skillDef.skillName == "DrogozSalvo") { return DrogozSpecialKind.Salvo; } if (skillDef.skillName == "DrogozDragonPunch") { return DrogozSpecialKind.DragonPunch; } return DrogozSpecialKind.Other; } } internal static class DrogozTalents { private static bool hooked; internal static void Init() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!hooked) { HealthComponent.TakeDamage += new hook_TakeDamage(HandleTakeDamage); hooked = true; } } private static void HandleTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && damageInfo.damage > 0f && Object.op_Implicit((Object)(object)damageInfo.attacker) && Object.op_Implicit((Object)(object)damageInfo.inflictor) && Object.op_Implicit((Object)(object)self.body) && (damageInfo.damageType.damageType & 0x4000000) == 0) { CharacterBody component = damageInfo.attacker.GetComponent(); DrogozRocketComponent component2 = damageInfo.inflictor.GetComponent(); if (Object.op_Implicit((Object)(object)component) && (Object)(object)component != (Object)(object)self.body && Object.op_Implicit((Object)(object)component2)) { DrogozMiscComponent component3 = ((Component)component).GetComponent(); bool flag = !DamageAPI.HasModdedDamageType(damageInfo, DrogozDamageTypes.RocketSplash); if (flag && Object.op_Implicit((Object)(object)component3) && component3.HasFusillade) { damageInfo.crit = true; } if (DamageAPI.HasModdedDamageType(damageInfo, DrogozDamageTypes.SalvoRocket) && (self.shield > 0f || self.barrier > 0f)) { damageInfo.damage *= 1f + Mathf.Max(0f, DrogozConfig.SalvoShieldBonus.Value); } DrogozCards.OnRocketHit(component, self, damageInfo.inflictor, DamageAPI.HasModdedDamageType(damageInfo, DrogozDamageTypes.SalvoRocket), flag); } } orig.Invoke(self, damageInfo); } } internal static class ItemDisplayCheck { public static List allDisplayedItems; public static void PrintUnused(ItemDisplayRuleSet itemDisplayRuleSet, string bodyName = "") { PrintUnused((IEnumerable)itemDisplayRuleSet.keyAssetRuleGroups.ToList(), bodyName); } public static void PrintUnused(IEnumerable ruleSet = null, string bodyName = "") { //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_003d: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) string text = "generating item displays for " + bodyName; if (allDisplayedItems == null) { LazyGatherAllItems(); } List list = new List(allDisplayedItems); string text2 = ""; if (ruleSet != null) { foreach (KeyAssetRuleGroup item in ruleSet) { if (item.displayRuleGroup.rules.Length != 0) { list.Remove(item.keyAsset); if (string.IsNullOrEmpty(text2)) { text2 = item.displayRuleGroup.rules[0].childName; } } } } if (string.IsNullOrEmpty(text2)) { text2 = "Chest"; } foreach (Object item2 in list) { string text3 = ""; if (ItemDisplays.KeyAssetDisplayPrefabs.ContainsKey(item2)) { text3 += SpitOutNewRule(item2, text2, ItemDisplays.KeyAssetDisplayPrefabs[item2]); } else { Log.Error($"COULD NOT FIND DISPLAY PREFABS FOR KEYASSET {item2}"); } text += text3; } Log.Message(text); } private static void LazyGatherAllItems() { allDisplayedItems = new List(ItemDisplays.KeyAssetDisplayPrefabs.Keys); allDisplayedItems.Sort(delegate(Object item1, Object item2) { if (item1 is ItemDef && item2 is ItemDef) { return item1.name.CompareTo(item2.name); } if (item1 is EquipmentDef && item2 is EquipmentDef) { return item1.name.CompareTo(item2.name); } if (item1 is ItemDef && item2 is EquipmentDef) { return -1; } return (item1 is EquipmentDef && item2 is ItemDef) ? 1 : 0; }); } private static string SpitOutNewRule(Object asset, string firstCompatibleChild, ItemDisplayRule[] displayRules) { //IL_0031: 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) if (displayRules.Length == 0) { return $"\n[NO DISPLAY RULES FOUND FOR THE KEYASSET {asset}"; } string text = "\n itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets[\"" + asset.name + "\"]"; for (int i = 0; i < displayRules.Length; i++) { text = (((int)displayRules[i].limbMask != 0) ? (text + ",\n" + $" ItemDisplays.CreateLimbMaskDisplayRule(LimbFlags.{displayRules[i].limbMask})") : (text + ",\n ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay(\"" + ((Object)displayRules[i].followerPrefab).name + "\"),\n \"" + firstCompatibleChild + "\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)\n )")); } return text + "\n ));"; } } internal static class ItemDisplays { private static Dictionary itemDisplayPrefabs = new Dictionary(); public static Dictionary KeyAssetDisplayPrefabs = new Dictionary(); public static Dictionary KeyAssets = new Dictionary(); 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; itemDisplayPrefabs = null; KeyAssetDisplayPrefabs = null; KeyAssets = null; } } internal static void PopulateDisplays() { PopulateFromBody("LoaderBody"); } private static void PopulateFromBody(string bodyName) { KeyAssetRuleGroup[] keyAssetRuleGroups = ((Component)LegacyResourcesAPI.Load("Prefabs/CharacterBodies/" + bodyName).GetComponent().modelTransform).GetComponent().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; for (int j = 0; j < rules.Length; j++) { GameObject followerPrefab = rules[j].followerPrefab; if (Object.op_Implicit((Object)(object)followerPrefab)) { string key = ((Object)followerPrefab).name?.ToLowerInvariant(); if (!itemDisplayPrefabs.ContainsKey(key)) { itemDisplayPrefabs[key] = followerPrefab; } } } } } private static void PopulateCustomLightningArm() { GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false); LimbMatcher component = val.GetComponent(); component.limbPairs[0].targetChildLimb = "LightningArm1"; component.limbPairs[1].targetChildLimb = "LightningArm2"; component.limbPairs[2].targetChildLimb = "LightningArmEnd"; itemDisplayPrefabs["displaylightningarmcustom"] = val; } public static GameObject LoadDisplay(string name) { if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()])) { return itemDisplayPrefabs[name.ToLowerInvariant()]; } Log.Error("item display " + name + " returned null"); return null; } 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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) 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 prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //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_000b: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRule(LoadDisplay(prefabName), childName, position, rotation, scale); } public static ItemDisplayRule CreateDisplayRule(GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0002: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = childName, followerPrefab = itemPrefab, limbMask = (LimbFlags)0, localPos = position, localAngles = rotation, localScale = scale }; } public static ItemDisplayRule CreateLimbMaskDisplayRule(LimbFlags limb) { //IL_0002: 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_0012: 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_002c: 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("ItemDefs/" + itemName); if (val == (Object)null) { val = (Object)(object)LegacyResourcesAPI.Load("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 obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)DrogozSurvivorPlugin.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)) { File.WriteAllText(Path.Combine(Directory.GetParent(((BaseUnityPlugin)DrogozSurvivorPlugin.instance).Info.Location).FullName, "Language", "en", fileName), text); } TokensOutput = ""; } } } internal static class Materials { private static List cachedMaterials = new List(); internal static Shader hotpoo = LegacyResourcesAPI.Load("Shaders/Deferred/HGStandard"); public static Material LoadMaterial(this AssetBundle assetBundle, string materialName) { return assetBundle.CreateHopooMaterialFromBundle(materialName); } public static Material CreateHopooMaterialFromBundle(this AssetBundle assetBundle, string materialName) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown materialName = materialName.Replace(" (Instance)", ""); Material val = cachedMaterials.Find((Material mat) => ((Object)mat).name.Replace(" (Instance)", "") == materialName); if (Object.op_Implicit((Object)(object)val)) { Log.Debug(((Object)val).name + " has already been loaded. returning cached"); return val; } val = assetBundle.LoadAsset(materialName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(materialName, ((Object)assetBundle).name); return new Material(hotpoo); } return val.ConvertDefaultShaderToHopoo(); } public static Material SetHopooMaterial(this Material tempMat) { return tempMat.ConvertDefaultShaderToHopoo(); } public static Material ConvertDefaultShaderToHopoo(this Material tempMat) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (cachedMaterials.Contains(tempMat)) { Log.Debug(((Object)tempMat).name + " has already been converted. returning cached"); return tempMat; } string text = ((Object)tempMat.shader).name.ToLowerInvariant(); if (!text.StartsWith("standard") && !text.StartsWith("autodesk")) { Log.Debug(((Object)tempMat).name + " is not unity standard shader. aborting material conversion"); return tempMat; } float? num = null; Color? val = null; if (tempMat.IsKeywordEnabled("_NORMALMAP")) { num = tempMat.GetFloat("_BumpScale"); } if (tempMat.IsKeywordEnabled("_EMISSION")) { val = tempMat.GetColor("_EmissionColor"); } tempMat.shader = hotpoo; tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); tempMat.EnableKeyword("DITHER"); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); tempMat.SetTexture("_NormalTex", tempMat.GetTexture("_BumpMap")); } if (val.HasValue) { tempMat.SetColor("_EmColor", val.Value); tempMat.SetFloat("_EmPower", 1f); } if (tempMat.IsKeywordEnabled("NOCULL")) { tempMat.SetInt("_Cull", 0); } if (tempMat.IsKeywordEnabled("LIMBREMOVAL")) { tempMat.SetInt("_LimbRemovalOn", 1); } cachedMaterials.Add(tempMat); return tempMat; } public static Material MakeUnique(this Material material) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown if (cachedMaterials.Contains(material)) { return new Material(material); } return material; } public static Material SetColor(this Material material, Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) material.SetColor("_Color", color); return material; } public static Material SetNormal(this Material material, float normalStrength = 1f) { material.SetFloat("_NormalStrength", normalStrength); return material; } public static Material SetEmission(this Material material) { return material.SetEmission(1f); } public static Material SetEmission(this Material material, float emission) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return material.SetEmission(emission, Color.white); } public static Material SetEmission(this Material material, float emission, Color emissionColor) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) material.SetFloat("_EmPower", emission); material.SetColor("_EmColor", emissionColor); return material; } public static Material SetCull(this Material material, bool cull = false) { material.SetInt("_Cull", cull ? 1 : 0); return material; } public static Material SetSpecular(this Material material, float strength) { material.SetFloat("_SpecularStrength", strength); return material; } public static Material SetSpecular(this Material material, float strength, float exponent) { material.SetFloat("_SpecularStrength", strength); material.SetFloat("SpecularExponent", exponent); return material; } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; private static readonly FieldInfo NetworkStateMachinesField = typeof(NetworkStateMachine).GetField("stateMachines", BindingFlags.Instance | BindingFlags.NonPublic); public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject prefab) { GameObject val = assetBundle.LoadAsset(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(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent(); } val2.baseRendererInfos = prefab.GetComponentInChildren().baseRendererInfos; Asset.ConvertAllRenderersToHopooShader(val); return val; } public static GameObject LoadCharacterModel(AssetBundle assetBundle, string modelName) { GameObject val = assetBundle.LoadAsset(modelName); if ((Object)(object)val == (Object)null) { Log.Error("could not load model 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(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; } return val; } public static GameObject CloneCharacterBody(BodyInfo bodyInfo) { GameObject val = LegacyResourcesAPI.Load("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body"); if (!Object.op_Implicit((Object)(object)val)) { Log.Error(bodyInfo.bodyNameToClone + " Body to clone is not a valid body, character creation failed"); return null; } GameObject val2 = PrefabAPI.InstantiateClone(val, bodyInfo.bodyName); for (int num = val2.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val2.transform.GetChild(num)).gameObject); } return val2; } public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string modelPrefabName, BodyInfo bodyInfo) { return CreateBodyPrefab(LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo); } public static GameObject CreateBodyPrefab(GameObject model, BodyInfo bodyInfo) { return CreateBodyPrefab(CloneCharacterBody(bodyInfo), model, bodyInfo); } public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, AssetBundle assetBundle, string modelName, BodyInfo bodyInfo) { return CreateBodyPrefab(newBodyPrefab, LoadCharacterModel(assetBundle, modelName), bodyInfo); } public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string bodyPrefabName, string modelPrefabName, BodyInfo bodyInfo) { return CreateBodyPrefab(LoadCharacterBody(assetBundle, bodyPrefabName), LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo); } public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, GameObject model, BodyInfo bodyInfo) { if ((Object)(object)model == (Object)null || (Object)(object)newBodyPrefab == (Object)null) { Log.Error($"Character creation failed. Model: {model}, Body: {newBodyPrefab}"); return null; } SetupCharacterBody(newBodyPrefab, bodyInfo); Transform modelBaseTransform = AddCharacterModelToSurvivorBody(newBodyPrefab, model.transform, bodyInfo); SetupModelLocator(newBodyPrefab, modelBaseTransform, model.transform); SetupCharacterDirection(newBodyPrefab, modelBaseTransform, model.transform); SetupCameraTargetParams(newBodyPrefab, bodyInfo); SetupCapsuleCollider(newBodyPrefab); Content.AddCharacterBodyPrefab(newBodyPrefab); return newBodyPrefab; } private static void SetupCharacterBody(GameObject newBodyPrefab, BodyInfo bodyInfo) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = newBodyPrefab.GetComponent(); component.baseNameToken = bodyInfo.bodyNameToken; component.subtitleNameToken = bodyInfo.subtitleNameToken; component.portraitIcon = bodyInfo.characterPortrait; component.bodyColor = bodyInfo.bodyColor; component.defaultCrosshairPrefab = bodyInfo.crosshair; component.hideCrosshair = false; component.preferredPodPrefab = bodyInfo.podPrefab; component.baseMaxHealth = bodyInfo.maxHealth; component.baseRegen = bodyInfo.healthRegen; component.baseArmor = bodyInfo.armor; component.baseMaxShield = bodyInfo.shield; component.baseDamage = bodyInfo.damage; component.baseAttackSpeed = bodyInfo.attackSpeed; component.baseCrit = bodyInfo.crit; component.baseMoveSpeed = bodyInfo.moveSpeed; component.baseJumpPower = bodyInfo.jumpPower; component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats; if (bodyInfo.autoCalculateLevelStats) { component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f); component.levelMaxShield = Mathf.Round(component.baseMaxShield * 0.3f); component.levelRegen = component.baseRegen * 0.2f; component.levelMoveSpeed = 0f; component.levelJumpPower = 0f; component.levelDamage = component.baseDamage * 0.2f; component.levelAttackSpeed = 0f; component.levelCrit = 0f; component.levelArmor = 0f; } else { component.levelMaxHealth = bodyInfo.healthGrowth; component.levelMaxShield = bodyInfo.shieldGrowth; component.levelRegen = bodyInfo.regenGrowth; component.levelMoveSpeed = bodyInfo.moveSpeedGrowth; component.levelJumpPower = bodyInfo.jumpPowerGrowth; component.levelDamage = bodyInfo.damageGrowth; component.levelAttackSpeed = bodyInfo.attackSpeedGrowth; component.levelCrit = bodyInfo.critGrowth; component.levelArmor = bodyInfo.armorGrowth; } component.baseAcceleration = bodyInfo.acceleration; component.baseJumpCount = bodyInfo.jumpCount; component.sprintingSpeedMultiplier = 1.45f; component.bodyFlags = (BodyFlags)16; component.rootMotionInMainState = false; component.hullClassification = (HullClassification)0; component.isChampion = false; } private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_00a4: 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_00d7: 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_00fb: Unknown result type (might be due to invalid IL or missing references) Transform val = bodyPrefab.transform.Find("ModelBase"); if ((Object)(object)val == (Object)null) { val = new GameObject("ModelBase").transform; val.parent = bodyPrefab.transform; val.localPosition = bodyInfo.modelBasePosition; val.localRotation = Quaternion.identity; } modelTransform.parent = ((Component)val).transform; modelTransform.localPosition = Vector3.zero; modelTransform.localRotation = Quaternion.identity; if ((Object)(object)bodyPrefab.transform.Find("CameraPivot") == (Object)null) { Transform transform = new GameObject("CameraPivot").transform; transform.parent = bodyPrefab.transform; transform.localPosition = bodyInfo.cameraPivotPosition; transform.localRotation = Quaternion.identity; } Transform val2 = bodyPrefab.transform.Find("AimOrigin"); if ((Object)(object)val2 == (Object)null) { val2 = new GameObject("AimOrigin").transform; val2.parent = bodyPrefab.transform; val2.localPosition = bodyInfo.aimOriginPosition; val2.localRotation = Quaternion.identity; } bodyPrefab.GetComponent().aimOriginTransform = val2; return ((Component)val).transform; } private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { if (Object.op_Implicit((Object)(object)prefab.GetComponent())) { CharacterDirection component = prefab.GetComponent(); component.targetTransform = modelBaseTransform; component.overrideAnimatorForwardTransform = null; component.rootMotionAccumulator = null; component.modelAnimator = ((Component)modelTransform).GetComponent(); component.driveFromRootRotation = false; component.turnSpeed = 720f; } } private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo) { CameraTargetParams component = prefab.GetComponent(); component.cameraParams = bodyInfo.cameraParams; component.cameraPivotTransform = prefab.transform.Find("CameraPivot"); } private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { ModelLocator component = prefab.GetComponent(); component.modelTransform = modelTransform; component.modelBaseTransform = modelBaseTransform; } private static void SetupCapsuleCollider(GameObject prefab) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) CapsuleCollider component = prefab.GetComponent(); component.center = new Vector3(0f, 0f, 0f); component.radius = 0.5f; component.height = 1.82f; component.direction = 1; } public static CharacterModel SetupCharacterModel(GameObject bodyPrefab, CustomRendererInfo[] customInfos = null) { CharacterModel val = ((Component)bodyPrefab.GetComponent().modelTransform).gameObject.GetComponent(); bool num = (Object)(object)val != (Object)null; if (!num) { val = ((Component)bodyPrefab.GetComponent().modelTransform).gameObject.AddComponent(); } val.body = bodyPrefab.GetComponent(); val.autoPopulateLightInfos = true; val.baseLightInfos = Array.Empty(); val.invisibilityCount = 0; val.temporaryOverlays = new List(); if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { ((Component)val).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { ((Component)val).gameObject.AddComponent(); } if (!Object.op_Implicit((Object)(object)((Component)val).GetComponent())) { ((Component)val).gameObject.AddComponent(); } if (!num) { SetupCustomRendererInfos(val, customInfos); } else { SetupPreAttachedRendererInfos(val); } SetupHurtboxGroup(bodyPrefab, ((Component)val).gameObject); SetupFootstepController(((Component)val).gameObject); SetupRagdoll(((Component)val).gameObject); return val; } public static void SetupPreAttachedRendererInfos(CharacterModel characterModel) { for (int i = 0; i < characterModel.baseRendererInfos.Length; i++) { if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial; } if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { Log.Error($"no material for rendererinfo of this renderer: {characterModel.baseRendererInfos[i].renderer}"); } characterModel.baseRendererInfos[i].defaultMaterial.ConvertDefaultShaderToHopoo(); } } public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = ((Component)characterModel).GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model"); return; } List list = new List(); for (int i = 0; i < customInfos.Length; i++) { if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName))) { Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName); continue; } Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { Material val = customInfos[i].material; if ((Object)(object)val == (Object)null) { val = ((!customInfos[i].dontHotpoo) ? component2.sharedMaterial.ConvertDefaultShaderToHopoo() : component2.sharedMaterial); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } private static void SetupHurtboxGroup(GameObject bodyPrefab, GameObject model) { SetupMainHurtboxesFromChildLocator(bodyPrefab, model); SetHurtboxesHealthComponents(bodyPrefab); } private static void SetupMainHurtboxesFromChildLocator(GameObject bodyPrefab, GameObject model) { //IL_012c: 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) if ((Object)(object)bodyPrefab.GetComponent() != (Object)null) { Log.Debug("Hitboxgroup already exists on model prefab. aborting code setup"); return; } ChildLocator component = model.GetComponent(); GameObject val = (Object.op_Implicit((Object)(object)component) ? component.FindChildGameObject("MainHurtbox") : null); if (!Object.op_Implicit((Object)(object)val)) { ChildLocator component2 = bodyPrefab.GetComponent(); val = (Object.op_Implicit((Object)(object)component2) ? component2.FindChildGameObject("MainHurtbox") : null); } if (!Object.op_Implicit((Object)(object)val)) { Log.Error("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator called 'MainHurtbox'"); return; } HurtBoxGroup val2 = model.AddComponent(); HurtBox val3 = null; GameObject val4 = component.FindChildGameObject("HeadHurtbox"); if (Object.op_Implicit((Object)(object)val4)) { Log.Debug("HeadHurtboxFound. Setting up"); val3 = val4.AddComponent(); ((Component)val3).gameObject.layer = LayerIndex.entityPrecise.intVal; val3.healthComponent = bodyPrefab.GetComponent(); val3.isBullseye = false; val3.isSniperTarget = true; val3.damageModifier = (DamageModifier)0; val3.hurtBoxGroup = val2; val3.indexInGroup = 1; } HurtBox val5 = val.AddComponent(); ((Component)val5).gameObject.layer = LayerIndex.entityPrecise.intVal; val5.healthComponent = bodyPrefab.GetComponent(); val5.isBullseye = true; val5.isSniperTarget = (Object)(object)val3 == (Object)null; val5.damageModifier = (DamageModifier)0; val5.hurtBoxGroup = val2; val5.indexInGroup = 0; if (Object.op_Implicit((Object)(object)val3)) { val2.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val5, val3 }; } else { val2.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val5 }; } val2.mainHurtBox = val5; val2.bullseyeCount = 1; } public static void SetHurtboxesHealthComponents(GameObject bodyPrefab) { HealthComponent component = bodyPrefab.GetComponent(); HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren(); foreach (HurtBoxGroup val in componentsInChildren) { val.mainHurtBox.healthComponent = component; for (int j = 0; j < val.hurtBoxes.Length; j++) { val.hurtBoxes[j].healthComponent = component; } } } private static void SetupFootstepController(GameObject model) { FootstepHandler obj = model.AddComponent(); obj.baseFootstepString = "Play_player_footstep"; obj.sprintFootstepOverrideString = ""; obj.enableFootstepDust = true; obj.footstepDustPrefab = LegacyResourcesAPI.Load("Prefabs/GenericFootstepDust"); } private static void SetupRagdoll(GameObject model) { RagdollController component = model.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ragdollMaterial = ((Component)LegacyResourcesAPI.Load("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren().bones[1]).GetComponent().material; } 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(); 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."); } } } } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { CloneDopplegangerMaster(bodyPrefab, masterName, masterToCopy); } public static GameObject CloneDopplegangerMaster(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject obj = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); obj.GetComponent().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(obj); return obj; } public static GameObject CreateBlankMasterPrefab(GameObject bodyPrefab, string masterName) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load("Prefabs/CharacterMasters/CommandoMonsterMaster"), masterName, true); ContentPacks.masterPrefabs.Add(val); val.GetComponent().bodyPrefab = bodyPrefab; AISkillDriver[] components = val.GetComponents(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } return val; } public static GameObject LoadMaster(this AssetBundle assetBundle, GameObject bodyPrefab, string assetName) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset(assetName); BaseAI val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent(); val2.aimVectorDampTime = 0.1f; val2.aimVectorMaxSpeed = 360f; } val2.scanState = new SerializableEntityStateType(typeof(Wander)); EntityStateMachine component = val.GetComponent(); if ((Object)(object)component == (Object)null) { AddEntityStateMachine(val, "AI", typeof(Wander), typeof(Wander)); } val2.stateMachine = component; CharacterMaster val3 = val.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = val.AddComponent(); } val3.bodyPrefab = bodyPrefab; val3.teamIndex = (TeamIndex)2; Content.AddMasterPrefab(val); return val; } public static void ClearEntityStateMachines(GameObject bodyPrefab) { EntityStateMachine[] components = bodyPrefab.GetComponents(); for (int num = components.Length - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)components[num]); } SetNetworkStateMachines(bodyPrefab.GetComponent(), Array.Empty()); CharacterDeathBehavior component = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.idleStateMachine = Array.Empty(); } SetStateOnHurt component2 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.idleStateMachine = Array.Empty(); } CharacterBody component3 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.vehicleIdleStateMachine = Array.Empty(); } } private static EntityStateMachine[] GetNetworkStateMachines(NetworkStateMachine networkMachine) { if (!Object.op_Implicit((Object)(object)networkMachine)) { return Array.Empty(); } if (NetworkStateMachinesField == null) { throw new InvalidOperationException("NetworkStateMachine.stateMachines was not found."); } return ((EntityStateMachine[])NetworkStateMachinesField.GetValue(networkMachine)) ?? Array.Empty(); } private static void SetNetworkStateMachines(NetworkStateMachine networkMachine, EntityStateMachine[] machines) { if (Object.op_Implicit((Object)(object)networkMachine)) { if (NetworkStateMachinesField == null) { throw new InvalidOperationException("NetworkStateMachine.stateMachines was not found."); } NetworkStateMachinesField.SetValue(networkMachine, machines); } } public static EntityStateMachine AddEntityStateMachine(GameObject prefab, string machineName, Type mainStateType = null, Type initalStateType = null, bool addToHurt = true, bool addToDeath = true) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(prefab, machineName); if ((Object)(object)val == (Object)null) { val = prefab.AddComponent(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(Idle); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(Idle); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { EntityStateMachine[] networkStateMachines = GetNetworkStateMachines(component); SetNetworkStateMachines(component, networkStateMachines.Append(val).ToArray()); } CharacterDeathBehavior component2 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2) && addToDeath) { component2.idleStateMachine = component2.idleStateMachine.Append(val).ToArray(); } SetStateOnHurt component3 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3) && addToHurt) { component3.idleStateMachine = component3.idleStateMachine.Append(val).ToArray(); } CharacterBody component4 = prefab.GetComponent(); if (Object.op_Implicit((Object)(object)component4)) { component4.vehicleIdleStateMachine = component4.vehicleIdleStateMachine.Append(val).ToArray(); } return val; } public static EntityStateMachine AddMainEntityStateMachine(GameObject bodyPrefab, string machineName = "Body", Type mainStateType = null, Type initalStateType = null) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(bodyPrefab, machineName); if ((Object)(object)val == (Object)null) { val = bodyPrefab.AddComponent(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(GenericCharacterMain); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(SpawnTeleporterState); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { EntityStateMachine[] networkStateMachines = GetNetworkStateMachines(component); SetNetworkStateMachines(component, networkStateMachines.Append(val).ToArray()); } CharacterDeathBehavior component2 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.deathStateMachine = val; } SetStateOnHurt component3 = bodyPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component3)) { component3.targetStateMachine = val; } return val; } public static void SetupHitBoxGroup(GameObject modelPrefab, string hitBoxGroupName, params string[] hitboxChildNames) { ChildLocator component = modelPrefab.GetComponent(); Transform[] array = (Transform[])(object)new Transform[hitboxChildNames.Length]; for (int i = 0; i < hitboxChildNames.Length; i++) { array[i] = component.FindChild(hitboxChildNames[i]); if ((Object)(object)array[i] == (Object)null) { Log.Error("missing hitbox for " + hitboxChildNames[i]); } } SetupHitBoxGroup(modelPrefab, hitBoxGroupName, array); } public static void SetupHitBoxGroup(GameObject prefab, string hitBoxGroupName, params Transform[] hitBoxTransforms) { List list = new List(); foreach (Transform val in hitBoxTransforms) { if ((Object)(object)val == (Object)null) { Log.Error("Error setting up hitboxGroup for " + hitBoxGroupName + ": hitbox transform was null"); continue; } HitBox item = ((Component)val).gameObject.AddComponent(); ((Component)val).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } if (list.Count == 0) { Log.Error("No hitboxes were set up. aborting setting up hitboxGroup for " + hitBoxGroupName); return; } HitBoxGroup obj = prefab.AddComponent(); obj.hitBoxes = list.ToArray(); obj.groupName = hitBoxGroupName; } } public class CustomRendererInfo { public string childName; public Material material; public bool dontHotpoo; public bool ignoreOverlays; } internal static class Projectiles { internal static GameObject RocketPrefab; internal static GameObject SalvoRocketPrefab; internal static GameObject FireSpitPrefab; internal static GameObject FireSpitPrefabDefault; internal static void Init() { //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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)RocketPrefab)) { return; } GameObject val = Addressables.LoadAssetAsync((object)"RoR2/Base/Toolbot/ToolbotGrenadeLauncherProjectile.prefab").WaitForCompletion(); if (!Object.op_Implicit((Object)(object)val)) { Log.Error("Could not load the Toolbot rocket projectile."); return; } RocketPrefab = PrefabAPI.InstantiateClone(val, "DrogozRocketProjectile", true); ProjectileController component = RocketPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.startSound = string.Empty; } ProjectileDamage component2 = RocketPrefab.GetComponent(); component2.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)1); component2.force = Mathf.Max(0f, DrogozConfig.RocketForce.Value); ProjectileSimple component3 = RocketPrefab.GetComponent(); component3.desiredForwardSpeed = Mathf.Max(1f, DrogozConfig.RocketSpeed.Value); component3.lifetime = 20f; component3.updateAfterFiring = false; ProjectileImpactExplosion component4 = RocketPrefab.GetComponent(); ((ProjectileExplosion)component4).blastDamageCoefficient = 1f; ((ProjectileExplosion)component4).blastProcCoefficient = 1f; ((ProjectileExplosion)component4).blastRadius = Mathf.Max(0.5f, DrogozConfig.RocketRadius.Value); ((ProjectileExplosion)component4).bonusBlastForce = Vector3.zero; ((ProjectileExplosion)component4).childrenCount = 0; ((ProjectileExplosion)component4).childrenDamageCoefficient = 0f; ((ProjectileExplosion)component4).childrenProjectilePrefab = null; ((ProjectileExplosion)component4).fireChildren = false; ((ProjectileExplosion)component4).applyDot = false; component4.destroyOnEnemy = true; component4.detonateOnEnemy = false; component4.destroyOnWorld = true; component4.impactOnWorld = true; component4.lifetime = 12f; component4.lifetimeRandomOffset = 0f; component4.lifetimeAfterImpact = 0f; component4.timerAfterImpact = false; component4.lifetimeExpiredSound = null; GameObject explosionEffect = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/VFX/OmniExplosionVFXQuick.prefab").WaitForCompletion(); component4.impactEffect = null; ((ProjectileExplosion)component4).explosionEffect = null; ((ProjectileExplosion)component4).blastAttackerFiltering = (AttackerFiltering)2; ((ProjectileExplosion)component4).falloffModel = (FalloffModel)(DrogozConfig.RocketUseFalloff.Value ? 3 : 0); DrogozRocketComponent drogozRocketComponent = RocketPrefab.AddComponent(); drogozRocketComponent.selfKnockbackForce = Mathf.Max(0f, DrogozConfig.RocketSelfKnockback.Value); drogozRocketComponent.selfKnockbackHorizontal = Mathf.Max(0f, DrogozConfig.RocketSelfKnockbackHorizontal.Value); drogozRocketComponent.selfKnockbackRadius = ((ProjectileExplosion)component4).blastRadius; drogozRocketComponent.allowSelfDamage = DrogozConfig.RocketSelfDamage.Value; drogozRocketComponent.selfDamageMultiplier = Mathf.Max(0f, DrogozConfig.RocketSelfDamageMultiplier.Value); drogozRocketComponent.explosionEffect = explosionEffect; if (!Object.op_Implicit((Object)(object)RocketPrefab.GetComponent())) { RocketPrefab.AddComponent(); } Content.AddProjectilePrefab(RocketPrefab); Log.Message("Created the Drogoz rocket projectile."); SalvoRocketPrefab = PrefabAPI.InstantiateClone(RocketPrefab, "DrogozSalvoRocketProjectile", true); ProjectileImpactExplosion component5 = SalvoRocketPrefab.GetComponent(); ((ProjectileExplosion)component5).blastRadius = Mathf.Max(0.5f, DrogozConfig.SalvoRadius.Value); ((ProjectileExplosion)component5).falloffModel = (FalloffModel)4; DrogozRocketComponent component6 = SalvoRocketPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component6)) { component6.selfKnockbackRadius = ((ProjectileExplosion)component5).blastRadius; component6.salvo = true; } if (!Object.op_Implicit((Object)(object)SalvoRocketPrefab.GetComponent())) { SalvoRocketPrefab.AddComponent(); } Content.AddProjectilePrefab(SalvoRocketPrefab); Log.Message("Created the Drogoz Salvo rocket projectile."); CreateFireSpitPrefab(val); DrogozSounds.Init(Asset.LoadAssetBundle("drogozassetbundle")); } private static void CreateFireSpitPrefab(GameObject source) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: Unknown result type (might be due to invalid IL or missing references) FireSpitPrefab = PrefabAPI.InstantiateClone(source, "DrogozFireSpitProjectile", true); AssetBundle val = Asset.LoadAssetBundle("drogozassetbundle"); GameObject val2 = (Object.op_Implicit((Object)(object)val) ? val.LoadAsset("mdlDrogozFireSpit") : null); if (Object.op_Implicit((Object)(object)val2)) { Renderer[] componentsInChildren = FireSpitPrefab.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } GameObject obj = Object.Instantiate(val2, FireSpitPrefab.transform, false); ((Object)obj).name = "DrogozFireSpitBlob"; ConfigureFireSpitVisual(obj); } else { Log.Warning("Drogoz Fire Spit blob model was not found in the asset bundle."); } MonoBehaviour[] components = FireSpitPrefab.GetComponents(); for (int j = 0; j < components.Length; j++) { if (components[j] is ProjectileExplosion || components[j] is ProjectileSingleTargetImpact) { Object.DestroyImmediate((Object)(object)components[j]); } } ProjectileDamage component = FireSpitPrefab.GetComponent(); component.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, (DamageSource)2); component.force = Mathf.Max(0f, DrogozConfig.FireSpitForce.Value); Rigidbody component2 = FireSpitPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component2)) { component2.useGravity = false; } float num = Mathf.Max(1f, DrogozConfig.FireSpitHitboxScale.Value); Collider[] componentsInChildren2 = FireSpitPrefab.GetComponentsInChildren(true); foreach (Collider val3 in componentsInChildren2) { SphereCollider val4 = (SphereCollider)(object)((val3 is SphereCollider) ? val3 : null); if (val4 != null) { val4.radius *= num; continue; } CapsuleCollider val5 = (CapsuleCollider)(object)((val3 is CapsuleCollider) ? val3 : null); if (val5 != null) { val5.radius *= num; val5.height *= num; continue; } BoxCollider val6 = (BoxCollider)(object)((val3 is BoxCollider) ? val3 : null); if (val6 != null) { val6.size *= num; } } if (componentsInChildren2.Length == 0) { SphereCollider obj2 = FireSpitPrefab.AddComponent(); obj2.radius = 0.4f * num; ((Collider)obj2).isTrigger = true; } ProjectileSimple component3 = FireSpitPrefab.GetComponent(); component3.desiredForwardSpeed = Mathf.Max(1f, DrogozConfig.FireSpitSpeed.Value); component3.lifetime = 20f; component3.updateAfterFiring = false; DrogozFireSpitComponent drogozFireSpitComponent = FireSpitPrefab.AddComponent(); drogozFireSpitComponent.explosionEffect = (drogozFireSpitComponent.vanillaExplosionEffect = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/VFX/OmniExplosionVFXQuick.prefab").WaitForCompletion()); GameObject val7 = (Object.op_Implicit((Object)(object)val) ? val.LoadAsset("fxDrogozFireSpitExplosion") : null); if (Object.op_Implicit((Object)(object)val7)) { if (!Object.op_Implicit((Object)(object)val7.GetComponent())) { val7.AddComponent().duration = 1.5f; } EffectComponent val8 = val7.GetComponent(); if (!Object.op_Implicit((Object)(object)val8)) { val8 = val7.AddComponent(); } val8.applyScale = true; if (!Object.op_Implicit((Object)(object)val7.GetComponent())) { val7.AddComponent(); } if (!Object.op_Implicit((Object)(object)val7.GetComponent())) { val7.AddComponent().vfxPriority = (VFXPriority)2; } bool value = DrogozConfig.FireSpitTerrormorphParticles.Value; ParticleSystem[] componentsInChildren3 = val7.GetComponentsInChildren(true); for (int l = 0; l < componentsInChildren3.Length; l++) { MainModule main = componentsInChildren3[l].main; ((MainModule)(ref main)).playOnAwake = value; if (value) { ((MainModule)(ref main)).startSize = ScaleMinMaxCurve(((MainModule)(ref main)).startSize, 0.35f); ((MainModule)(ref main)).startSpeed = ScaleMinMaxCurve(((MainModule)(ref main)).startSpeed, 0.25f); ShapeModule shape = componentsInChildren3[l].shape; ((ShapeModule)(ref shape)).radius = ((ShapeModule)(ref shape)).radius * 0.2f; } else { componentsInChildren3[l].Clear(); } } ParticleSystemRenderer[] componentsInChildren4 = val7.GetComponentsInChildren(true); for (int m = 0; m < componentsInChildren4.Length; m++) { ((Renderer)componentsInChildren4[m]).enabled = value; } Transform val9 = val7.transform.Find("Flash"); if (Object.op_Implicit((Object)(object)val9)) { DrogozExplosionFlash drogozExplosionFlash = ((Component)val9).GetComponent(); if (!Object.op_Implicit((Object)(object)drogozExplosionFlash)) { drogozExplosionFlash = ((Component)val9).gameObject.AddComponent(); } drogozExplosionFlash.duration = 0.15f; } Content.CreateAndAddEffectDef(val7); drogozFireSpitComponent.terrormorphExplosionEffect = val7; DrogozRocketComponent component4 = RocketPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component4)) { component4.terrormorphExplosionEffect = val7; } DrogozRocketComponent component5 = SalvoRocketPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component5)) { component5.terrormorphExplosionEffect = val7; } } GameObject val10 = (Object.op_Implicit((Object)(object)val) ? val.LoadAsset("fxDrogozFireSpitOrangeExplosion") : null); if (Object.op_Implicit((Object)(object)val10)) { if (!Object.op_Implicit((Object)(object)val10.GetComponent())) { val10.AddComponent().duration = 0.6f; } EffectComponent val11 = val10.GetComponent(); if (!Object.op_Implicit((Object)(object)val11)) { val11 = val10.AddComponent(); } val11.applyScale = true; if (!Object.op_Implicit((Object)(object)val10.GetComponent())) { val10.AddComponent(); } if (!Object.op_Implicit((Object)(object)val10.GetComponent())) { val10.AddComponent().vfxPriority = (VFXPriority)2; } ParticleSystem[] componentsInChildren5 = val10.GetComponentsInChildren(true); for (int n = 0; n < componentsInChildren5.Length; n++) { MainModule main2 = componentsInChildren5[n].main; ((MainModule)(ref main2)).playOnAwake = false; componentsInChildren5[n].Clear(); } ParticleSystemRenderer[] componentsInChildren6 = val10.GetComponentsInChildren(true); for (int num2 = 0; num2 < componentsInChildren6.Length; num2++) { ((Renderer)componentsInChildren6[num2]).enabled = false; } Transform val12 = val10.transform.Find("Flash"); if (Object.op_Implicit((Object)(object)val12)) { DrogozExplosionFlash drogozExplosionFlash2 = ((Component)val12).GetComponent(); if (!Object.op_Implicit((Object)(object)drogozExplosionFlash2)) { drogozExplosionFlash2 = ((Component)val12).gameObject.AddComponent(); } drogozExplosionFlash2.duration = 0.15f; } Content.CreateAndAddEffectDef(val10); drogozFireSpitComponent.defaultExplosionEffect = val10; DrogozRocketComponent component6 = RocketPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component6)) { component6.defaultExplosionEffect = val10; } DrogozRocketComponent component7 = SalvoRocketPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component7)) { component7.defaultExplosionEffect = val10; } } GameObject val13 = (Object.op_Implicit((Object)(object)val) ? val.LoadAsset("fxDrogozFireSpitImpact") : null); if (Object.op_Implicit((Object)(object)val13)) { if (!Object.op_Implicit((Object)(object)val13.GetComponent())) { val13.AddComponent().duration = 0.6f; } if (!Object.op_Implicit((Object)(object)val13.GetComponent())) { val13.AddComponent(); } if (!Object.op_Implicit((Object)(object)val13.GetComponent())) { val13.AddComponent(); } Content.CreateAndAddEffectDef(val13); drogozFireSpitComponent.impactEffect = val13; } ProjectileController component8 = FireSpitPrefab.GetComponent(); if (Object.op_Implicit((Object)(object)component8)) { component8.allowPrediction = false; component8.startSound = string.Empty; GameObject val14 = (Object.op_Implicit((Object)(object)val2) ? PrefabAPI.InstantiateClone(val2, "DrogozFireSpitGhost", true) : null); if (Object.op_Implicit((Object)(object)val14)) { if (!Object.op_Implicit((Object)(object)val14.GetComponent())) { val14.AddComponent(); } if (!Object.op_Implicit((Object)(object)val14.GetComponent())) { val14.AddComponent(); } ConfigureFireSpitVisual(val14); component8.ghostPrefabAddress = new AssetReferenceT(""); component8.ghostPrefab = val14; } } Material val15 = (Object.op_Implicit((Object)(object)val) ? val.LoadAsset("matDrogozFireSpitDefault") : null); if (Object.op_Implicit((Object)(object)val15)) { FireSpitPrefabDefault = PrefabAPI.InstantiateClone(FireSpitPrefab, "DrogozFireSpitDefaultProjectile", true); Renderer[] componentsInChildren7 = FireSpitPrefabDefault.GetComponentsInChildren(true); for (int num3 = 0; num3 < componentsInChildren7.Length; num3++) { if (componentsInChildren7[num3].enabled) { componentsInChildren7[num3].sharedMaterial = val15; } } ProjectileController component9 = FireSpitPrefabDefault.GetComponent(); if (Object.op_Implicit((Object)(object)component9) && Object.op_Implicit((Object)(object)component8) && Object.op_Implicit((Object)(object)component8.ghostPrefab)) { GameObject val16 = PrefabAPI.InstantiateClone(component8.ghostPrefab, "DrogozFireSpitDefaultGhost", true); Renderer[] componentsInChildren8 = val16.GetComponentsInChildren(true); for (int num4 = 0; num4 < componentsInChildren8.Length; num4++) { componentsInChildren8[num4].sharedMaterial = val15; } component9.ghostPrefabAddress = new AssetReferenceT(""); component9.ghostPrefab = val16; } Content.AddProjectilePrefab(FireSpitPrefabDefault); } Content.AddProjectilePrefab(FireSpitPrefab); Log.Message("Created the Drogoz Fire Spit projectiles."); } private static MinMaxCurve ScaleMinMaxCurve(MinMaxCurve source, float scale) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected I4, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) ParticleSystemCurveMode mode = ((MinMaxCurve)(ref source)).mode; return (MinMaxCurve)((int)mode switch { 0 => new MinMaxCurve(((MinMaxCurve)(ref source)).constant * scale), 3 => new MinMaxCurve(((MinMaxCurve)(ref source)).constantMin * scale, ((MinMaxCurve)(ref source)).constantMax * scale), 1 => new MinMaxCurve(scale, ((MinMaxCurve)(ref source)).curve), 2 => new MinMaxCurve(scale, ((MinMaxCurve)(ref source)).curveMin, ((MinMaxCurve)(ref source)).curveMax), _ => source, }); } private static void ConfigureFireSpitVisual(GameObject visual) { //IL_0006: 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_0026: 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) visual.transform.localPosition = Vector3.zero; visual.transform.localRotation = Quaternion.identity; visual.transform.localScale = Vector3.one * Mathf.Max(0.1f, DrogozConfig.FireSpitVisualScale.Value); MeshRenderer[] componentsInChildren = visual.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Renderer)componentsInChildren[i]).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)componentsInChildren[i]).receiveShadows = false; } if (!Object.op_Implicit((Object)(object)visual.GetComponent())) { visual.AddComponent(); } } } internal static class Skills { private static readonly FieldInfo SkillFamilyField = typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.NonPublic); public static void CreateSkillFamilies(GameObject targetPrefab) { SkillSlot[] array = new SkillSlot[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); CreateSkillFamilies(targetPrefab, (SkillSlot[])(object)array); } public static void CreateSkillFamilies(GameObject targetPrefab, params SkillSlot[] slots) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent(); foreach (SkillSlot val in slots) { switch (val - -1) { case 1: component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); break; case 2: component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); break; case 3: component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); break; case 4: component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); break; } } } public static void ClearGenericSkills(GameObject targetPrefab) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, SkillSlot skillSlot, bool hidden = false) { //IL_0007: 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_0023: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent(); switch (skillSlot - -1) { case 1: return component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary", hidden); case 2: return component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary", hidden); case 3: return component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility", hidden); case 4: return component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special", hidden); case 0: Log.Error("Failed to create GenericSkill with skillslot None. If making a GenericSkill outside of the main 4, specify a familyName, and optionally a genericSkillName"); return null; default: return null; } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { return CreateGenericSkillWithSkillFamily(targetPrefab, familyName, familyName, hidden); } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string genericSkillName, string familyName, bool hidden = false) { GenericSkill val = targetPrefab.AddComponent(); val.skillName = genericSkillName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance(); ((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family"; val2.variants = (Variant[])(object)new Variant[0]; if (SkillFamilyField == null) { throw new InvalidOperationException("GenericSkill._skillFamily was not found."); } SkillFamilyField.SetValue(val, val2); Content.AddSkillFamily(val2); return val; } public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val = new Variant { skillDef = skillDef, unlockableDef = unlockableDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); variants[num] = val; } public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs) { foreach (SkillDef skillDef in skillDefs) { AddSkillToFamily(skillFamily, skillDef); } } public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent().special.skillFamily, skillDefs); } public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < unlockableDefs.Length; i++) { Variant val = skillFamily.variants[i]; val.unlockableDef = unlockableDefs[i]; skillFamily.variants[i] = val; } } public static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo) { return Skills.CreateSkillDef(skillDefInfo); } public static T CreateSkillDef(SkillDefInfo skillDefInfo) where T : SkillDef { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) T val = ScriptableObject.CreateInstance(); ((SkillDef)val).skillName = skillDefInfo.skillName; ((Object)(object)val).name = skillDefInfo.skillName; ((SkillDef)val).skillNameToken = skillDefInfo.skillNameToken; ((SkillDef)val).skillDescriptionToken = skillDefInfo.skillDescriptionToken; ((SkillDef)val).icon = skillDefInfo.skillIcon; ((SkillDef)val).activationState = skillDefInfo.activationState; ((SkillDef)val).activationStateMachineName = skillDefInfo.activationStateMachineName; ((SkillDef)val).interruptPriority = skillDefInfo.interruptPriority; ((SkillDef)val).baseMaxStock = skillDefInfo.baseMaxStock; ((SkillDef)val).baseRechargeInterval = skillDefInfo.baseRechargeInterval; ((SkillDef)val).rechargeStock = skillDefInfo.rechargeStock; ((SkillDef)val).requiredStock = skillDefInfo.requiredStock; ((SkillDef)val).stockToConsume = skillDefInfo.stockToConsume; ((SkillDef)val).dontAllowPastMaxStocks = skillDefInfo.dontAllowPastMaxStocks; ((SkillDef)val).beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd; ((SkillDef)val).canceledFromSprinting = skillDefInfo.canceledFromSprinting; ((SkillDef)val).forceSprintDuringState = skillDefInfo.forceSprintDuringState; ((SkillDef)val).fullRestockOnAssign = skillDefInfo.fullRestockOnAssign; ((SkillDef)val).resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse; ((SkillDef)val).isCombatSkill = skillDefInfo.isCombatSkill; ((SkillDef)val).mustKeyPress = skillDefInfo.mustKeyPress; ((SkillDef)val).cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation; ((SkillDef)val).keywordTokens = skillDefInfo.keywordTokens; Content.AddSkillDef((SkillDef)(object)val); return val; } } internal class SkillDefInfo { public string skillName; public string skillNameToken; public string skillDescriptionToken; public string[] keywordTokens = Array.Empty(); public Sprite skillIcon; public SerializableEntityStateType activationState; public string activationStateMachineName; public InterruptPriority interruptPriority; public float baseRechargeInterval; public int baseMaxStock = 1; public int rechargeStock = 1; public int requiredStock = 1; public int stockToConsume = 1; public bool resetCooldownTimerOnUse; public bool fullRestockOnAssign = true; public bool dontAllowPastMaxStocks; public bool beginSkillCooldownOnSkillEnd; public bool mustKeyPress; public bool isCombatSkill = true; public bool canceledFromSprinting; public bool cancelSprintingOnActivation = true; public bool forceSprintDuringState; public SkillDefInfo() { } public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) this.skillName = skillName; this.skillNameToken = skillNameToken; this.skillDescriptionToken = skillDescriptionToken; this.skillIcon = skillIcon; this.activationState = activationState; this.activationStateMachineName = activationStateMachineName; cancelSprintingOnActivation = !agile; if (agile) { keywordTokens = new string[1] { "KEYWORD_AGILE" }; } interruptPriority = (InterruptPriority)0; isCombatSkill = true; baseRechargeInterval = 0f; requiredStock = 0; stockToConsume = 0; } } internal static class Skins { internal static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown SkinDef.Awake += new hook_Awake(DoNothing); SkinDef obj = ScriptableObject.CreateInstance(); obj.baseSkins = Array.Empty(); obj.icon = skinIcon; obj.unlockableDef = unlockableDef; obj.rootObject = root; obj.nameToken = skinName; ((Object)obj).name = skinName; SkinDefParams val = ScriptableObject.CreateInstance(); val.rendererInfos = (RendererInfo[])defaultRendererInfos.Clone(); val.gameObjectActivations = Array.Empty(); val.meshReplacements = Array.Empty(); val.projectileGhostReplacements = Array.Empty(); val.minionSkinReplacements = Array.Empty(); obj.skinDefParams = val; SkinDef.Awake -= new hook_Awake(DoNothing); return obj; } internal static Sprite CreatePaletteIcon(Color primary, Color secondary, Color tertiary, Color accent) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00ac: 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) Texture2D val = new Texture2D(256, 256, (TextureFormat)4, false); ((Object)val).name = "DrogozDefaultPalette"; for (int i = 0; i < 256; i++) { float num = ((float)i + 0.5f) / 256f; for (int j = 0; j < 256; j++) { float num2 = ((float)j + 0.5f) / 256f; float num3 = Mathf.Abs(num2 - 0.5f); float num4 = Mathf.Abs(num - 0.5f); Color val2 = ((num >= 0.5f && num3 <= num - 0.5f) ? primary : ((num <= 0.5f && num3 <= 0.5f - num) ? tertiary : ((!(num2 <= 0.5f) || !(num4 <= 0.5f - num2)) ? accent : secondary))); val.SetPixel(j, i, val2); } } val.Apply(); return Sprite.Create(val, new Rect(0f, 0f, 256f, 256f), new Vector2(0.5f, 0.5f), 100f); } private static void DoNothing(orig_Awake orig, SkinDef self) { } } internal static class Tokens { public const string agilePrefix = "Agile."; public static string DamageText(string text) { return "" + text + ""; } public static string DamageValueText(float value) { return $"{value * 100f}% damage"; } public static string UtilityText(string text) { return "" + text + ""; } public static string RedText(string text) { return HealthText(text); } public static string HealthText(string text) { return "" + text + ""; } public static string KeywordText(string keyword, string sub) { return "" + keyword + "" + sub + ""; } public static string ScepterDescription(string desc) { return "\nSCEPTER: " + desc + ""; } public static string GetAchievementNameToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_NAME"; } public static string GetAchievementDescriptionToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_DESCRIPTION"; } } } namespace DrogozSurvivor.Modules.Characters { public abstract class CharacterBase where T : CharacterBase, new() { public abstract string assetBundleName { get; } public abstract string bodyName { get; } public abstract string modelPrefabName { get; } public abstract BodyInfo bodyInfo { get; } public virtual CustomRendererInfo[] customRendererInfos { get; } public virtual ItemDisplaysBase itemDisplays { get; } public static T instance { get; private set; } public abstract AssetBundle assetBundle { get; protected set; } public abstract GameObject bodyPrefab { get; protected set; } public abstract CharacterBody prefabCharacterBody { get; protected set; } public abstract GameObject characterModelObject { get; protected set; } public abstract CharacterModel prefabCharacterModel { get; protected set; } public virtual void Initialize() { instance = this as T; assetBundle = Asset.LoadAssetBundle(assetBundleName); InitializeCharacter(); } public virtual void InitializeCharacter() { InitializeCharacterBodyPrefab(); InitializeItemDisplays(); } protected virtual void InitializeCharacterBodyPrefab() { characterModelObject = Prefabs.LoadCharacterModel(assetBundle, modelPrefabName); bodyPrefab = Prefabs.CreateBodyPrefab(characterModelObject, bodyInfo); prefabCharacterBody = bodyPrefab.GetComponent(); prefabCharacterModel = Prefabs.SetupCharacterModel(bodyPrefab, customRendererInfos); } public virtual void InitializeItemDisplays() { ItemDisplayRuleSet val = ScriptableObject.CreateInstance(); ((Object)val).name = "idrs" + bodyName; prefabCharacterModel.itemDisplayRuleSet = val; if (itemDisplays != null) { ItemDisplays.queuedDisplays++; ContentManager.onContentPacksAssigned += SetItemDisplays; } } public void SetItemDisplays(ReadOnlyArray obj) { itemDisplays.SetItemDisplays(prefabCharacterModel.itemDisplayRuleSet); } public abstract void InitializeEntityStateMachines(); public abstract void InitializeSkills(); public abstract void InitializeSkins(); public abstract void InitializeCharacterMaster(); } public class BodyInfo { public string bodyName = ""; public string bodyNameToken = ""; public string subtitleNameToken = ""; public string bodyNameToClone = "Commando"; public Color bodyColor = Color.white; public Texture characterPortrait; public float sortPosition = 100f; public GameObject crosshair; public GameObject podPrefab; public float maxHealth = 100f; public float healthRegen = 1f; public float armor; public float shield; public int jumpCount = 1; public float damage = 12f; public float attackSpeed = 1f; public float crit = 1f; public float moveSpeed = 7f; public float acceleration = 80f; public float jumpPower = 15f; public bool autoCalculateLevelStats = true; public float healthGrowth = 30.000002f; public float regenGrowth = 0.2f; public float armorGrowth; public float shieldGrowth; public float damageGrowth = 2.4f; public float attackSpeedGrowth; public float critGrowth; public float moveSpeedGrowth; public float jumpPowerGrowth; public Vector3 aimOriginPosition = new Vector3(0f, 1.6f, 0f); public Vector3 modelBasePosition = new Vector3(0f, -0.92f, 0f); public Vector3 cameraPivotPosition = new Vector3(0f, 0.8f, 0f); public float cameraParamsVerticalOffset = 1.37f; public float cameraParamsDepth = -10f; private CharacterCameraParams _cameraParams; public CharacterCameraParams cameraParams { get { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cameraParams == (Object)null) { _cameraParams = ScriptableObject.CreateInstance(); _cameraParams.data.minPitch = BlendableFloat.op_Implicit(-70f); _cameraParams.data.maxPitch = BlendableFloat.op_Implicit(70f); _cameraParams.data.wallCushion = BlendableFloat.op_Implicit(0.1f); _cameraParams.data.pivotVerticalOffset = BlendableFloat.op_Implicit(cameraParamsVerticalOffset); _cameraParams.data.idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0f, cameraParamsDepth)); } return _cameraParams; } set { _cameraParams = value; } } } public abstract class ItemDisplaysBase { public void SetItemDisplays(ItemDisplayRuleSet itemDisplayRuleSet) { List list = new List(); ItemDisplays.LazyInit(); SetItemDisplayRules(list); itemDisplayRuleSet.keyAssetRuleGroups = list.ToArray(); ItemDisplays.DisposeWhenDone(); } protected abstract void SetItemDisplayRules(List itemDisplayRules); } public abstract class SurvivorBase : CharacterBase where T : SurvivorBase, new() { public abstract string masterName { get; } public abstract string displayPrefabName { get; } public abstract string survivorTokenPrefix { get; } public abstract UnlockableDef characterUnlockableDef { get; } public abstract GameObject displayPrefab { get; protected set; } public override void InitializeCharacter() { base.InitializeCharacter(); InitializeDisplayPrefab(); InitializeSurvivor(); } protected virtual void InitializeDisplayPrefab() { displayPrefab = Prefabs.CreateDisplayPrefab(assetBundle, displayPrefabName, bodyPrefab); } protected virtual void InitializeSurvivor() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Content.CreateSurvivor(bodyPrefab, displayPrefab, bodyInfo.bodyColor, survivorTokenPrefix, characterUnlockableDef, bodyInfo.sortPosition); } protected virtual void AddCssPreviewSkill(int indexFromEditor, SkillFamily skillFamily, SkillDef skillDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent(); 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(); 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_005a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)displayPrefab)) { return; } CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent(); if (!Object.op_Implicit((Object)(object)component)) { return; } component.bodyPrefab = bodyPrefab; List list = new List(); 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 DrogozSurvivor.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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) ((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_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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!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)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_0062: 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) ((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_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator); inHitPause = false; ((EntityState)this).characterMotor.velocity = storedVelocity; } public override InterruptPriority GetMinimumInterruptPriority() { if (!(stopwatch >= duration * earlyExitPercentTime)) { return (InterruptPriority)1; } return (InterruptPriority)0; } 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 DrogozSurvivor.Modules.Achievements { public abstract class BaseMasteryAchievement : BaseAchievement { public abstract string RequiredCharacterBody { get; } public abstract float RequiredDifficultyCoefficient { get; } public override BodyIndex LookUpRequiredBodyIndex() { //IL_0006: 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_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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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 num = difficultyDef.countsAsHardMode && difficultyDef.scalingValue >= RequiredDifficultyCoefficient; bool flag = difficultyDef.nameToken == "INFERNO_NAME"; bool flag2 = (int)val >= 3 && (int)val <= 10; if (num || flag || flag2) { ((BaseAchievement)this).Grant(); } } } } } namespace DrogozSurvivor.Components { public class DrogozAirAggroComponent : MonoBehaviour { private CharacterBody body; private float nextCheck; private bool lastEasyTarget; private float nextStateLog; private void Awake() { body = ((Component)this).GetComponent(); } private void FixedUpdate() { //IL_01ac: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || (!NetworkServer.active && !body.hasEffectiveAuthority)) { return; } DrogozSittingDuckComponent component = ((Component)body).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.IsActive) { DrogozEasyTarget.Remove(body); return; } bool flag = DrogozConfig.AirAggroEnabled.Value && body.isPlayerControlled && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive && Object.op_Implicit((Object)(object)body.characterMotor) && !body.characterMotor.isGrounded; if (flag != lastEasyTarget || Time.time >= nextStateLog) { Log.Debug("Buffs", $"Easy Target state body={((Object)body).name} airborne={flag} server={NetworkServer.active} authority={body.hasEffectiveAuthority} player={body.isPlayerControlled} alive={Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive} grounded={Object.op_Implicit((Object)(object)body.characterMotor) && body.characterMotor.isGrounded} enabled={DrogozConfig.AirAggroEnabled.Value} buffCount={(Object.op_Implicit((Object)(object)DrogozEasyTarget.buffDef) ? body.GetBuffCount(DrogozEasyTarget.buffDef.buffIndex) : (-1))}"); lastEasyTarget = flag; nextStateLog = Time.time + 2f; } if (!flag) { DrogozEasyTarget.Remove(body); return; } DrogozEasyTarget.Apply(body); if (NetworkServer.active && !(Time.time < nextCheck)) { nextCheck = Time.time + Mathf.Max(0.1f, DrogozConfig.AirAggroCheckInterval.Value); FocusEnemy(); } } private void FocusEnemy() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(1f, DrogozConfig.AirAggroRadius.Value); float num2 = num * num; float num3 = Mathf.Clamp01(DrogozConfig.AirAggroChance.Value); float num4 = Mathf.Max(1f, DrogozConfig.AirAggroMaxDistanceRatio.Value); float num5 = Mathf.Max(0.1f, DrogozConfig.AirAggroAttentionDuration.Value); TeamIndex val = (TeamIndex)(Object.op_Implicit((Object)(object)body.teamComponent) ? ((int)body.teamComponent.teamIndex) : 0); List instancesList = InstanceTracker.GetInstancesList(); for (int i = 0; i < instancesList.Count; i++) { BaseAI val2 = instancesList[i]; if (!Object.op_Implicit((Object)(object)val2) || !Object.op_Implicit((Object)(object)val2.body) || !Object.op_Implicit((Object)(object)val2.body.healthComponent) || !val2.body.healthComponent.alive || !Object.op_Implicit((Object)(object)val2.currentEnemy.gameObject) || (Object)(object)val2.currentEnemy.gameObject == (Object)(object)((Component)body).gameObject) { continue; } GameObject gameObject = val2.currentEnemy.gameObject; TeamComponent teamComponent = val2.body.teamComponent; if (!Object.op_Implicit((Object)(object)teamComponent) || teamComponent.teamIndex == val || (int)teamComponent.teamIndex == 0) { continue; } float num6 = Vector3.Distance(val2.body.corePosition, body.corePosition); if (num6 * num6 > num2 || !HasLineOfSight(val2.body.corePosition, body.corePosition)) { continue; } CharacterBody component = gameObject.GetComponent(); Vector3 val3 = (Object.op_Implicit((Object)(object)component) ? component.corePosition : gameObject.transform.position); float num7 = Vector3.Distance(val2.body.corePosition, val3); float num8 = ((num7 > 0.01f) ? (num6 / num7) : 1f); if (!(num8 > num4)) { float num9 = num3 * (1f - Mathf.InverseLerp(1f, num4, Mathf.Clamp(num8, 1f, num4))); if (!(Random.value > num9)) { val2.currentEnemy.gameObject = ((Component)body).gameObject; val2.enemyAttention = Mathf.Max(val2.enemyAttention, num5); Log.Debug("Buffs", $"Easy Target retarget enemy={((Object)val2.body).name} drogozDistance={num6:0.0} targetDistance={num7:0.0} ratio={num8:0.00} chance={num9:0.000}"); break; } } } } private void OnDisable() { DrogozEasyTarget.Remove(body); } private static bool HasLineOfSight(Vector3 origin, Vector3 target) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.01f) { return true; } RaycastHit val2 = default(RaycastHit); return !Physics.Raycast(origin, val / magnitude, ref val2, magnitude - 0.25f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)); } } public class DrogozAnimationLayerController : MonoBehaviour { private static readonly int BufferEmptyHash = Animator.StringToHash("BufferEmpty"); private Animator animator; private int fullBodyLayer = -1; private int gestureLayer = -1; private void Awake() { animator = ((Component)this).GetComponentInChildren(true); if (Object.op_Implicit((Object)(object)animator)) { fullBodyLayer = animator.GetLayerIndex("FullBody, Override"); gestureLayer = animator.GetLayerIndex("Gesture, Override"); } } private void LateUpdate() { if (Object.op_Implicit((Object)(object)animator) && ((Behaviour)animator).enabled) { UpdateOverrideLayer(fullBodyLayer); UpdateOverrideLayer(gestureLayer); } } private void UpdateOverrideLayer(int layerIndex) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (layerIndex < 0) { return; } float num = 1f; if (!animator.IsInTransition(layerIndex)) { AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(layerIndex); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == BufferEmptyHash) { num = 0f; } } if (!Mathf.Approximately(animator.GetLayerWeight(layerIndex), num)) { float layerWeight = animator.GetLayerWeight(layerIndex); float num2 = ((num == 0f) ? 5.5f : 20f); float num3 = Mathf.MoveTowards(layerWeight, num, Time.deltaTime * num2); animator.SetLayerWeight(layerIndex, num3); } } } [DefaultExecutionOrder(200)] public class DrogozAnimationLogger : MonoBehaviour { private static readonly string[] StateNames = new string[30] { "Idle", "Run", "TurnLeft", "TurnRight", "JumpPre", "Jump", "Fall", "Land", "BoosterFlight", "GroundAim", "FlightAim", "AscendDescend", "BonusJump", "BufferEmpty", "Thrust", "SalvoArm", "SalvoFull", "Death", "Intro", "Stunned", "Fire", "Shoot", "BoosterShoot", "Reload", "EnterReload", "FireSpit", "Salvo", "SalvoAlt", "SalvoLast", "Melee" }; private static readonly string[] AttackStateNames = new string[16] { "Thrust", "SalvoArm", "SalvoFull", "Death", "Intro", "Stunned", "Fire", "Shoot", "BoosterShoot", "Reload", "EnterReload", "FireSpit", "Salvo", "SalvoAlt", "SalvoLast", "Melee" }; private readonly Dictionary stateNames = new Dictionary(); private readonly HashSet attackStates = new HashSet(); private Animator animator; private CharacterBody body; private InputBankTest input; private CharacterDirection direction; private Transform rootBone; private Transform pelvisBone; private int[] lastStateHashes; private string lastBaseClips; private float nextAttackReport; private float nextFacingReport; private void Awake() { string[] array = StateNames; foreach (string text in array) { stateNames[Animator.StringToHash(text)] = text; } array = AttackStateNames; foreach (string text2 in array) { attackStates.Add(Animator.StringToHash(text2)); } animator = ((Component)this).GetComponentInChildren(true); body = ((Component)this).GetComponentInParent(true); input = (Object.op_Implicit((Object)(object)body) ? body.inputBank : null); direction = (Object.op_Implicit((Object)(object)body) ? ((Component)body).GetComponent() : null); rootBone = (Object.op_Implicit((Object)(object)animator) ? FindTransform(((Component)animator).transform, "root") : null); pelvisBone = (Object.op_Implicit((Object)(object)animator) ? FindTransform(((Component)animator).transform, "pelvis") : null); if (Object.op_Implicit((Object)(object)animator)) { lastStateHashes = new int[animator.layerCount]; } } private unsafe void LateUpdate() { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0358: 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_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //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_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0497: Unknown result type (might be due to invalid IL or missing references) //IL_049c: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05af: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)animator) || !((Behaviour)animator).enabled || lastStateHashes == null || !DrogozConfig.IsDebugTagEnabled("Animation") || !Object.op_Implicit((Object)(object)body) || !body.isPlayerControlled || !body.hasEffectiveAuthority || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive) { return; } if (!Object.op_Implicit((Object)(object)input) && Object.op_Implicit((Object)(object)body)) { input = body.inputBank; } bool flag = false; bool flag2 = false; for (int i = 0; i < animator.layerCount; i++) { AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(i); if (lastStateHashes[i] != ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash) { lastStateHashes[i] = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash; flag = true; } flag2 |= attackStates.Contains(((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash); } bool flag3 = Time.unscaledTime >= nextFacingReport; bool flag4 = flag2 && Time.unscaledTime >= nextAttackReport; if (!flag && !flag3 && !flag4) { return; } string text = "Drogoz animation:"; for (int j = 0; j < animator.layerCount; j++) { AnimatorStateInfo currentAnimatorStateInfo2 = animator.GetCurrentAnimatorStateInfo(j); string layerName = animator.GetLayerName(j); string stateName = GetStateName(((AnimatorStateInfo)(ref currentAnimatorStateInfo2)).shortNameHash); text = text + " [" + layerName + ":" + stateName + "(" + ((AnimatorStateInfo)(ref currentAnimatorStateInfo2)).fullPathHash + ") t=" + ((AnimatorStateInfo)(ref currentAnimatorStateInfo2)).normalizedTime.ToString("0.00") + " w=" + animator.GetLayerWeight(j).ToString("0.00") + "]"; } string baseClipLog = GetBaseClipLog(); if (lastBaseClips != baseClipLog) { lastBaseClips = baseClipLog; flag = true; } text = text + " BaseClips=" + baseClipLog; Vector3 val5; if (Object.op_Implicit((Object)(object)input)) { Transform val = ((Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelBaseTransform)) ? body.modelLocator.modelBaseTransform : ((Component)body).gameObject.transform); Transform val2 = (Object.op_Implicit((Object)(object)body.modelLocator) ? body.modelLocator.modelTransform : null); Vector3 val3 = val.InverseTransformDirection(input.moveVector); Vector3 val4 = val.InverseTransformDirection(input.aimDirection); Vector3 aimDirection = input.aimDirection; aimDirection.y = 0f; float num = Mathf.Atan2(aimDirection.x, aimDirection.z) * 57.29578f; string[] obj = new string[15] { text, " move=", null, null, null, null, null, null, null, null, null, null, null, null, null }; val5 = input.moveVector; obj[2] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj[3] = " localMove="; val5 = val3; obj[4] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj[5] = " look="; val5 = input.aimDirection; obj[6] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj[7] = " localLook="; val5 = val4; obj[8] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj[9] = " aimYaw="; obj[10] = num.ToString("0.0"); obj[11] = " facingYaw="; val5 = val.eulerAngles; obj[12] = val5.y.ToString("0.0"); obj[13] = " modelYaw="; object obj2; if (!Object.op_Implicit((Object)(object)val2)) { obj2 = "none"; } else { val5 = val2.eulerAngles; obj2 = val5.y.ToString("0.0"); } obj[14] = (string)obj2; text = string.Concat(obj); if (Object.op_Implicit((Object)(object)direction)) { string[] obj3 = new string[7] { text, " directionYaw=", direction.yaw.ToString("0.0"), " dirMove=", null, null, null }; val5 = direction.moveVector; obj3[4] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj3[5] = " dirTarget="; obj3[6] = (Object.op_Implicit((Object)(object)direction.targetTransform) ? ((Object)direction.targetTransform).name : "none"); text = string.Concat(obj3); } if (Object.op_Implicit((Object)(object)rootBone)) { Quaternion val6 = (Object.op_Implicit((Object)(object)val2) ? (Quaternion.Inverse(val2.rotation) * rootBone.rotation) : rootBone.localRotation); string[] obj4 = new string[5] { text, " rootYaw=", null, null, null }; val5 = rootBone.eulerAngles; obj4[2] = val5.y.ToString("0.0"); obj4[3] = " rootLocal="; val5 = ((Quaternion)(ref val6)).eulerAngles; obj4[4] = ((Vector3)(ref val5)).ToString("0.0"); text = string.Concat(obj4); } if (Object.op_Implicit((Object)(object)pelvisBone)) { Vector3 forward = pelvisBone.forward; forward.y = 0f; float num2 = Mathf.Atan2(forward.x, forward.z) * 57.29578f; string[] obj5 = new string[5] { text, " pelvisYaw=", num2.ToString("0.0"), " pelvisLocal=", null }; Quaternion localRotation = pelvisBone.localRotation; val5 = ((Quaternion)(ref localRotation)).eulerAngles; obj5[4] = ((Vector3)(ref val5)).ToString("0.0"); text = string.Concat(obj5); } text = text + " sprinting=" + body.isSprinting; } if (Object.op_Implicit((Object)(object)body.characterMotor)) { string[] obj6 = new string[5] { text, " velocity=", null, null, null }; val5 = body.characterMotor.velocity; obj6[2] = ((object)(*(Vector3*)(&val5))/*cast due to .constrained prefix*/).ToString(); obj6[3] = " grounded="; obj6[4] = body.characterMotor.isGrounded.ToString(); text = string.Concat(obj6); } text = text + " MoveX=" + animator.GetFloat("MoveX") + " MoveY=" + animator.GetFloat("MoveY") + " AimX=" + animator.GetFloat("AimX") + " AimY=" + animator.GetFloat("AimY") + " Boosting=" + animator.GetBool("Boosting"); Log.Debug("Animation", text); if (flag3) { nextFacingReport = Time.unscaledTime + 0.25f; } if (flag4) { nextAttackReport = Time.unscaledTime + 1f; } } private string GetBaseClipLog() { AnimatorClipInfo[] currentAnimatorClipInfo = animator.GetCurrentAnimatorClipInfo(0); string text = ""; for (int i = 0; i < currentAnimatorClipInfo.Length; i++) { AnimationClip clip = ((AnimatorClipInfo)(ref currentAnimatorClipInfo[i])).clip; if (Object.op_Implicit((Object)(object)clip)) { if (text.Length > 0) { text += ","; } text = text + ((Object)clip).name + "(" + ((AnimatorClipInfo)(ref currentAnimatorClipInfo[i])).weight.ToString("0.00") + ")"; } } if (text.Length <= 0) { return "none"; } return text; } private string GetStateName(int hash) { if (!stateNames.TryGetValue(hash, out var value)) { return hash.ToString(); } return value; } private static Transform FindTransform(Transform root, string name) { if (((Object)root).name == name) { return root; } for (int i = 0; i < root.childCount; i++) { Transform val = FindTransform(root.GetChild(i), name); if (Object.op_Implicit((Object)(object)val)) { return val; } } return null; } } public class DrogozBooster : MonoBehaviour { private const float GroundJumpBoosterDelay = 0.2f; private CharacterBody body; private CharacterMotor motor; private Animator animator; private float lastFuelUseTime = float.NegativeInfinity; private bool jumpReleaseRequired; private bool fuelLockout; private float originalAirControl; private bool momentumMode; private bool forceFlightAnimation; private bool forceFlightAnimationAirborne; private bool wasGrounded; private float boosterDelayUntil; private float baseFuelCapacity; private int lastExtraJumps = -1; private float nextSpeedReport; private float thrustActiveUntil; private float fuelEfficiencyUntil; private float fuelEfficiencyReduction; public float Fuel { get; private set; } public float FuelCapacity { get; private set; } public float FuelPercent { get { if (!(FuelCapacity > 0f)) { return 0f; } return Mathf.Clamp01(Fuel / FuelCapacity); } } public bool IsBoosting { get; private set; } public bool IsThrustActive => Time.time < thrustActiveUntil; private void Awake() { body = ((Component)this).GetComponent(); baseFuelCapacity = Mathf.Max(1f, DrogozConfig.BoosterFuelCapacity.Value); FuelCapacity = baseFuelCapacity; Fuel = FuelCapacity; wasGrounded = true; boosterDelayUntil = 0f; } private void Start() { if (Object.op_Implicit((Object)(object)body)) { motor = body.characterMotor; animator = ((!Object.op_Implicit((Object)(object)body.modelLocator)) ? null : (Object.op_Implicit((Object)(object)body.modelLocator.modelTransform) ? ((Component)body.modelLocator.modelTransform).GetComponentInChildren() : null)); } } private void FixedUpdate() { //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: 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_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)motor)) { return; } float fixedDeltaTime = Time.fixedDeltaTime; UpdateFuelFromJumpItems(); float num = Mathf.Clamp01(DrogozConfig.BoosterReactivationPercent.Value); if (fuelLockout && Fuel >= FuelCapacity * num) { fuelLockout = false; jumpReleaseRequired = false; } bool isGrounded = motor.isGrounded; int num2; int num3; if (Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive && body.isPlayerControlled && body.hasEffectiveAuthority) { num2 = (Object.op_Implicit((Object)(object)body.inputBank) ? 1 : 0); if (num2 != 0) { num3 = (body.inputBank.jump.down ? 1 : 0); goto IL_00d8; } } else { num2 = 0; } num3 = 0; goto IL_00d8; IL_00d8: bool flag = (byte)num3 != 0; if (isGrounded) { wasGrounded = true; boosterDelayUntil = 0f; if (forceFlightAnimationAirborne) { forceFlightAnimation = false; forceFlightAnimationAirborne = false; } } else { if (wasGrounded && flag) { boosterDelayUntil = Time.time + 0.2f; } wasGrounded = false; if (forceFlightAnimation) { forceFlightAnimationAirborne = true; } } if (!flag) { jumpReleaseRequired = false; boosterDelayUntil = 0f; } bool flag2 = ((uint)num2 & (flag ? 1u : 0u)) != 0 && !jumpReleaseRequired && !fuelLockout && !isGrounded && Fuel > 0.001f && Time.time >= boosterDelayUntil; SetMomentumMode(!isGrounded, flag2); int num5; float num6; if (flag2) { IsBoosting = true; float num4 = ((Time.time < fuelEfficiencyUntil) ? (1f - Mathf.Clamp01(fuelEfficiencyReduction)) : 1f); Fuel = Mathf.Max(0f, Fuel - Mathf.Max(0f, DrogozConfig.BoosterFuelDrainRate.Value) * num4 * fixedDeltaTime); lastFuelUseTime = Time.time; DrogozMiscComponent component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { num5 = (component.HasWyrmJets ? 1 : 0); if (num5 != 0) { num6 = Mathf.Max(1f, DrogozConfig.WyrmJetsVerticalSpeedMultiplier.Value); goto IL_023a; } } else { num5 = 0; } num6 = 1f; goto IL_023a; } IsBoosting = false; goto IL_05d8; IL_023a: float num7 = num6; float num8 = ((num5 != 0) ? Mathf.Max(1f, DrogozConfig.WyrmJetsVerticalAccelerationMultiplier.Value) : 1f); float num9 = ((num5 != 0) ? Mathf.Max(1f, DrogozConfig.WyrmJetsSteeringMultiplier.Value) : 1f) * DrogozCards.GetBoosterControlMultiplier(body); float num10 = Mathf.Max(0f, DrogozConfig.BoosterMaxLiftSpeed.Value * num7); float y = motor.velocity.y; if (y < num10) { float num11 = Mathf.Min(Mathf.Max(0f, DrogozConfig.BoosterLiftAcceleration.Value * num8) * fixedDeltaTime, num10 - y); motor.ApplyForce(Vector3.up * num11 * Mathf.Max(0.01f, motor.mass), true, false); Vector3 velocity = motor.velocity; if (y <= num10 && velocity.y > num10) { velocity.y = num10; motor.velocity = velocity; } } Vector3 moveVector = body.inputBank.moveVector; moveVector.y = 0f; float maxHorizontalSpeed = GetMaxHorizontalSpeed(); if (((Vector3)(ref moveVector)).sqrMagnitude > 0.0001f) { ((Vector3)(ref moveVector)).Normalize(); Vector3 velocity2 = motor.velocity; velocity2.y = 0f; float magnitude = ((Vector3)(ref velocity2)).magnitude; if (magnitude < maxHorizontalSpeed) { float num12 = Mathf.Min(Mathf.Max(0f, DrogozConfig.BoosterHorizontalAcceleration.Value) * fixedDeltaTime, maxHorizontalSpeed - magnitude); motor.ApplyForce(moveVector * num12 * Mathf.Max(0.01f, motor.mass), true, false); } else if (magnitude > 0.0001f) { float num13 = Mathf.Max(0f, DrogozConfig.BoosterHorizontalAcceleration.Value) * num9 * fixedDeltaTime; Vector3 val = velocity2 + moveVector * num13; float num14 = Mathf.Max(maxHorizontalSpeed, magnitude); if (((Vector3)(ref val)).magnitude > num14) { val = ((Vector3)(ref val)).normalized * num14; } float num15 = Mathf.Max(0f, DrogozConfig.BoosterSteeringSpeed.Value) * num9 * (MathF.PI / 180f) * fixedDeltaTime; Vector3 val2 = Vector3.RotateTowards(val, moveVector * magnitude, num15, 0f); motor.velocity = new Vector3(val2.x, motor.velocity.y, val2.z); } } Vector3 val3 = motor.velocity; val3.y = 0f; float magnitude2 = ((Vector3)(ref val3)).magnitude; if (magnitude2 > maxHorizontalSpeed) { float num16 = Mathf.Max(maxHorizontalSpeed + 0.01f, DrogozConfig.BoosterOverspeedDragFullSpeed.Value); float num17 = Mathf.Clamp01((magnitude2 - maxHorizontalSpeed) / (num16 - maxHorizontalSpeed)); float num18 = Mathf.Max(0f, DrogozConfig.BoosterOverspeedDrag.Value); float num19 = Mathf.Max(num18, DrogozConfig.BoosterOverspeedDragMax.Value); float num20 = Mathf.Lerp(num18, num19, num17 * num17) * fixedDeltaTime; float num21 = Mathf.MoveTowards(magnitude2, maxHorizontalSpeed, num20); val3 = ((Vector3)(ref val3)).normalized * num21; motor.velocity = new Vector3(val3.x, motor.velocity.y, val3.z); } if (Fuel <= 0.001f) { Fuel = 0f; IsBoosting = false; jumpReleaseRequired = true; fuelLockout = true; } goto IL_05d8; IL_05d8: float num22 = Mathf.Max(0f, DrogozConfig.BoosterFuelRefillDelay.Value); if (!IsBoosting && Time.time - lastFuelUseTime >= num22) { float num23 = (isGrounded ? Mathf.Max(0f, DrogozConfig.BoosterGroundRefillMultiplier.Value) : Mathf.Max(0f, DrogozConfig.BoosterAirRefillMultiplier.Value)); float num24 = Mathf.Max(0f, DrogozConfig.BoosterFuelRefillRate.Value) * num23; Fuel = Mathf.Min(FuelCapacity, Fuel + num24 * fixedDeltaTime); } UpdateAnimation(); ReportSpeed(); } private void ReportSpeed() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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) if (DrogozConfig.IsDebugTagEnabled("Booster") && Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)motor) && body.hasEffectiveAuthority && !(Time.unscaledTime < nextSpeedReport)) { nextSpeedReport = Time.unscaledTime + 0.5f; Vector3 velocity = motor.velocity; velocity.y = 0f; Vector3 val = (Object.op_Implicit((Object)(object)body.inputBank) ? body.inputBank.moveVector : Vector3.zero); val.y = 0f; float num = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? Vector3.Dot(velocity, ((Vector3)(ref val)).normalized) : 0f); float maxHorizontalSpeed = GetMaxHorizontalSpeed(); Log.Debug("Booster", "Drogoz booster: speed=" + ((Vector3)(ref velocity)).magnitude.ToString("0.0") + " directional=" + num.ToString("0.0") + " max=" + maxHorizontalSpeed.ToString("0.0") + string.Format(" velocity={0} boosting={1} fuel={2}", motor.velocity, IsBoosting, Fuel.ToString("0.0")) + string.Format(" grounded={0} moveSpeed={1}", motor.isGrounded, body.moveSpeed.ToString("0.0")) + " baseMoveSpeed=" + body.baseMoveSpeed.ToString("0.0") + " airControl=" + motor.airControl.ToString("0.00") + " control=" + DrogozCards.GetBoosterControlMultiplier(body).ToString("0.00")); } } private float GetMaxHorizontalSpeed() { float num = Mathf.Max(0f, DrogozConfig.BoosterMaxHorizontalSpeed.Value); if (body.baseMoveSpeed > 0.0001f) { float num2 = Mathf.Max(1f, body.moveSpeed / body.baseMoveSpeed); float num3 = Mathf.Clamp01(DrogozConfig.BoosterMoveSpeedBonusEffectiveness.Value); num *= 1f + (num2 - 1f) * num3; } DrogozMiscComponent component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component) && component.HasWyrmJets) { num *= Mathf.Max(1f, DrogozConfig.WyrmJetsHorizontalSpeedMultiplier.Value); } return num; } private void UpdateFuelFromJumpItems() { if (!Object.op_Implicit((Object)(object)body)) { return; } body.baseJumpCount = 1; int num = 0; if (Object.op_Implicit((Object)(object)body.inventory)) { num += body.inventory.GetItemCountEffective(Items.Feather); int num2 = (Object.op_Implicit((Object)(object)Items.RechargeableJump) ? body.inventory.GetItemCountEffective(Items.RechargeableJump) : 0); if (num2 > 0) { num += 1 + 2 * num2; } } if (num != lastExtraJumps) { lastExtraJumps = num; float fuelCapacity = FuelCapacity; FuelCapacity = baseFuelCapacity + (float)num * Mathf.Max(0f, DrogozConfig.BoosterFuelPerExtraJump.Value); if (FuelCapacity > fuelCapacity) { Fuel = Mathf.Min(FuelCapacity, Fuel + FuelCapacity - fuelCapacity); } else { Fuel = Mathf.Min(Fuel, FuelCapacity); } } } private void SetMomentumMode(bool active, bool boosting) { if (!Object.op_Implicit((Object)(object)motor)) { return; } if (active) { if (!momentumMode) { originalAirControl = motor.airControl; momentumMode = true; } float num = (boosting ? DrogozConfig.BoosterAirControlMultiplier.Value : DrogozConfig.NormalAirControlMultiplier.Value); motor.airControl = Mathf.Clamp01(num * GetSpeedBonusDampeningScale()); } else if (momentumMode) { motor.airControl = originalAirControl; momentumMode = false; } } private float GetSpeedBonusDampeningScale() { if (!Object.op_Implicit((Object)(object)body) || body.baseMoveSpeed <= 0.0001f) { return 1f; } float num = Mathf.Max(1f, body.moveSpeed / body.baseMoveSpeed); return 1f / num; } private void OnDisable() { if (Object.op_Implicit((Object)(object)motor) && momentumMode) { motor.airControl = originalAirControl; momentumMode = false; } } private void UpdateAnimation() { if (Object.op_Implicit((Object)(object)animator)) { animator.SetBool("Boosting", IsBoosting || forceFlightAnimation); } } public void ForceFlightAnimation() { forceFlightAnimation = true; forceFlightAnimationAirborne = false; } public void StopForDeath() { IsBoosting = false; forceFlightAnimation = false; forceFlightAnimationAirborne = false; if (Object.op_Implicit((Object)(object)animator)) { animator.SetBool("Boosting", false); } if (Object.op_Implicit((Object)(object)motor) && momentumMode) { motor.airControl = originalAirControl; momentumMode = false; } } public void PulseThrustVFX(float duration) { thrustActiveUntil = Time.time + Mathf.Max(0f, duration); } public void PulseFuelEfficiency(float duration, float reduction) { fuelEfficiencyUntil = Time.time + Mathf.Max(0f, duration); fuelEfficiencyReduction = Mathf.Clamp01(reduction); } public void SetFuel(float fuel) { Fuel = Mathf.Clamp(fuel, 0f, FuelCapacity); if (Fuel <= 0.001f) { jumpReleaseRequired = true; } } public void RefillFuel() { SetFuel(FuelCapacity); jumpReleaseRequired = false; } private void OnGUI() { //IL_007f: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) if (DrogozConfig.BoosterShowFuelHud.Value && Object.op_Implicit((Object)(object)body) && body.isPlayerControlled && body.hasEffectiveAuthority && !PauseManager.isPaused && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive) { float num = ((float)Screen.width - 260f) * 0.5f; float num2 = (float)Screen.height - 92f; Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.7f); GUI.DrawTexture(new Rect(num - 2f, num2 - 2f, 264f, 16f), (Texture)(object)Texture2D.whiteTexture); GUI.color = new Color(1f, 1f, 1f, 1f); GUI.DrawTexture(new Rect(num, num2, 260f * FuelPercent, 12f), (Texture)(object)Texture2D.whiteTexture); GUI.color = color; } } } public class DrogozBoosterAudio : MonoBehaviour { public string[] clips; public AudioClip[] unityClips; public float volume = 0.09f; private CharacterBody body; private CharacterMotor motor; private DrogozBooster booster; private AudioSource source; private uint playingId; private bool playing; private float cachedVolumeScale = 1f; private float nextVolumeUpdate; private void Start() { body = ((Component)this).GetComponent(); motor = (Object.op_Implicit((Object)(object)body) ? body.characterMotor : null); booster = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)((Component)this).GetComponent())) { ((Component)this).gameObject.AddComponent(); } source = ((Component)this).GetComponent(); if (!Object.op_Implicit((Object)(object)source)) { source = ((Component)this).gameObject.AddComponent(); } source.playOnAwake = false; source.loop = true; source.spatialBlend = 1f; source.minDistance = 2f; source.maxDistance = 22f; source.dopplerLevel = 0f; source.rolloffMode = (AudioRolloffMode)1; } private void Update() { if (Time.unscaledTime >= nextVolumeUpdate) { cachedVolumeScale = DrogozSounds.GetVolumeScale(); nextVolumeUpdate = Time.unscaledTime + 0.25f; } if (Object.op_Implicit((Object)(object)source)) { source.volume = Mathf.Max(0f, volume) * cachedVolumeScale; } bool flag = Object.op_Implicit((Object)(object)body) && body.isPlayerControlled && Object.op_Implicit((Object)(object)body.inputBank) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive && Object.op_Implicit((Object)(object)motor) && Object.op_Implicit((Object)(object)booster) && body.inputBank.jump.down && !motor.isGrounded && booster.Fuel > 0.001f; if (flag == playing) { return; } playing = flag; if (playing) { if (DrogozSounds.UseWwise && clips != null && clips.Length != 0) { string text = clips[Random.Range(0, clips.Length)]; DrogozSounds.ApplyWwiseDefaultVolume(((Component)this).gameObject); playingId = Util.PlaySound(text, ((Component)this).gameObject); Log.Debug("Audio", "Drogoz booster loop started: " + text); } else if (unityClips != null && unityClips.Length != 0) { source.clip = unityClips[Random.Range(0, unityClips.Length)]; source.Play(); Log.Debug("Audio", "Drogoz booster loop started: " + ((Object)source.clip).name); } } else { Stop(); } } private void Stop() { if (playingId != 0) { AkSoundEngine.StopPlayingID(playingId); playingId = 0u; } if (Object.op_Implicit((Object)(object)source)) { source.Stop(); } Log.Debug("Audio", "Drogoz booster loop stopped."); } public void StopForDeath() { Stop(); playing = false; } private void OnDisable() { Stop(); playing = false; } } [DefaultExecutionOrder(100)] public class DrogozCameraFacing : MonoBehaviour { private static readonly int IdleHash = Animator.StringToHash("Idle"); private static readonly int RunHash = Animator.StringToHash("Run"); private static readonly int JumpPreHash = Animator.StringToHash("JumpPre"); private static readonly int JumpHash = Animator.StringToHash("Jump"); private static readonly int FallHash = Animator.StringToHash("Fall"); private static readonly int LandHash = Animator.StringToHash("Land"); private static readonly int BoosterFlightHash = Animator.StringToHash("BoosterFlight"); private static readonly int AscendDescendHash = Animator.StringToHash("AscendDescend"); private static readonly int BonusJumpHash = Animator.StringToHash("BonusJump"); private CharacterBody body; private ModelLocator locator; private Animator animator; private Transform pelvis; private Quaternion pelvisRestRelative; private bool hasPelvisRestPose; private bool originalAlwaysAim; private bool forcedAim; private float pelvisCorrectionWeight; private void Awake() { body = ((Component)this).GetComponent(); locator = ((Component)this).GetComponent(); originalAlwaysAim = Object.op_Implicit((Object)(object)body) && body.alwaysAim; if (Object.op_Implicit((Object)(object)locator) && Object.op_Implicit((Object)(object)locator.modelTransform)) { animator = ((Component)locator.modelTransform).GetComponentInChildren(true); pelvis = (Object.op_Implicit((Object)(object)animator) ? FindTransform(((Component)animator).transform, "pelvis") : null); CachePelvisRestPose(); } } private void Update() { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive) { if (forcedAim) { body.alwaysAim = originalAlwaysAim; forcedAim = false; } } else if (!DrogozConfig.UseRoR2Facing.Value && Util.HasEffectiveAuthority(((Component)body).gameObject)) { body.alwaysAim = true; forcedAim = true; } else if (forcedAim) { body.alwaysAim = originalAlwaysAim; forcedAim = false; } } private void LateUpdate() { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive && Object.op_Implicit((Object)(object)locator) && Object.op_Implicit((Object)(object)locator.modelTransform) && !DrogozConfig.UseRoR2Facing.Value && Util.HasEffectiveAuthority(((Component)body).gameObject)) { CorrectLocomotionPelvisYaw(); } } private void OnDisable() { if (Object.op_Implicit((Object)(object)body) && forcedAim) { body.alwaysAim = originalAlwaysAim; } forcedAim = false; } private void CachePelvisRestPose() { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)pelvis) || !Object.op_Implicit((Object)(object)locator) || !Object.op_Implicit((Object)(object)locator.modelTransform)) { return; } SkinnedMeshRenderer[] componentsInChildren = ((Component)locator.modelTransform).GetComponentsInChildren(true); foreach (SkinnedMeshRenderer val in componentsInChildren) { Mesh sharedMesh = val.sharedMesh; if (!Object.op_Implicit((Object)(object)sharedMesh) || val.bones == null || sharedMesh.bindposes == null || val.bones.Length != sharedMesh.bindposes.Length) { continue; } for (int j = 0; j < val.bones.Length; j++) { if (!((Object)(object)val.bones[j] != (Object)(object)pelvis)) { Matrix4x4 val2 = ((Component)val).transform.localToWorldMatrix * ((Matrix4x4)(ref sharedMesh.bindposes[j])).inverse; pelvisRestRelative = Quaternion.Inverse(locator.modelTransform.rotation) * ((Matrix4x4)(ref val2)).rotation; hasPelvisRestPose = true; return; } } } pelvisRestRelative = Quaternion.Inverse(locator.modelTransform.rotation) * pelvis.rotation; hasPelvisRestPose = true; } private void CorrectLocomotionPelvisYaw() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)animator) || !((Behaviour)animator).enabled || !Object.op_Implicit((Object)(object)pelvis) || !hasPelvisRestPose) { return; } AnimatorStateInfo currentAnimatorStateInfo = animator.GetCurrentAnimatorStateInfo(0); float num = ((((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == IdleHash || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == RunHash || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == JumpPreHash || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == JumpHash || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == FallHash || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == LandHash || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == BoosterFlightHash || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == AscendDescendHash || ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash == BonusJumpHash) ? 1f : 0f); pelvisCorrectionWeight = Mathf.MoveTowards(pelvisCorrectionWeight, num, Time.deltaTime * 8f); if (pelvisCorrectionWeight <= 0f) { return; } Vector3 val = locator.modelTransform.rotation * pelvisRestRelative * Vector3.forward; val.y = 0f; Vector3 forward = pelvis.forward; forward.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f) && !(((Vector3)(ref forward)).sqrMagnitude < 0.0001f)) { float num2 = Mathf.Atan2(val.x, val.z) * 57.29578f; float num3 = Mathf.DeltaAngle(Mathf.Atan2(forward.x, forward.z) * 57.29578f, num2) * pelvisCorrectionWeight; if (!(Mathf.Abs(num3) < 0.001f)) { pelvis.rotation = Quaternion.AngleAxis(num3, Vector3.up) * pelvis.rotation; } } } private static Transform FindTransform(Transform root, string name) { if (((Object)root).name == name) { return root; } for (int i = 0; i < root.childCount; i++) { Transform val = FindTransform(root.GetChild(i), name); if (Object.op_Implicit((Object)(object)val)) { return val; } } return null; } } public class DrogozCardLoadoutComponent : MonoBehaviour { private CardLoadout loadout = new CardLoadout(); private CharacterBody body; private bool initialized; private int hotSwapFailures; private int concussiveFailures; private float lastHealthPercent = -1f; private float nextAdrenalineTime; internal float NextConcussiveTime; internal float NextScentTrailTime; public int HotSwapFailures => hotSwapFailures; public int ConcussiveFailures => concussiveFailures; private void Awake() { body = ((Component)this).GetComponent(); } private void FixedUpdate() { if (!initialized && DrogozCards.InitializeBodyLoadout(body)) { initialized = true; } if (!initialized || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || body.maxHealth <= 0f) { return; } float num = Mathf.Clamp01(body.healthComponent.health / body.maxHealth); if (lastHealthPercent > 0.3f && num <= 0.3f && Time.time >= nextAdrenalineTime) { int rank = DrogozCards.GetRank(body, "booster_capacity"); if (rank > 0 && Object.op_Implicit((Object)(object)DrogozCards.adrenalineBuff)) { body.AddTimedBuff(DrogozCards.adrenalineBuff, 2f); nextAdrenalineTime = Time.time + 10f; Log.Debug("Buffs", $"Adrenaline applied body={((Object)body).name} rank={rank} speedBonus={0.1f * (float)rank:0.00} duration=2s"); } } lastHealthPercent = num; } public void SetLoadout(CardLoadout value) { bool flag = value?.IsComplete() ?? false; loadout = (flag ? value.Clone() : new CardLoadout()); initialized = true; Log.Debug("Loadouts", $"{((Object)this).name} loadout accepted={flag} requestedPoints={value?.TotalPoints() ?? 0}/{15} requested={Describe(value)} active={Describe(loadout)}"); } private static string Describe(CardLoadout value) { if (value == null || value.Slots == null) { return "none"; } string text = ""; for (int i = 0; i < value.Slots.Length; i++) { CardSlot cardSlot = value.Slots[i]; text = text + ((i > 0) ? ", " : "") + ((cardSlot != null && !string.IsNullOrEmpty(cardSlot.CardId)) ? (cardSlot.CardId + ":R" + cardSlot.Rank) : "empty"); } return text; } public CardLoadout GetLoadout() { return loadout.Clone(); } public int GetRank(string cardId) { if (loadout == null) { return 0; } return loadout.GetRank(cardId); } public void RegisterHotSwapAttempt(bool success) { hotSwapFailures = ((!success) ? (hotSwapFailures + 1) : 0); } public void RegisterConcussiveAttempt(bool success) { concussiveFailures = ((!success) ? (concussiveFailures + 1) : 0); } } public sealed class DrogozCardLoadoutRow : MonoBehaviour { private LoadoutPanelController panel; private Color bodyColor; private HGTextMeshProUGUI rowLabel; private HGTextMeshProUGUI[] rankLabels; private HGButton[] slotButtons; private Sprite editIcon; public void Build(LoadoutPanelController panel, CharacterBody body, GameObject buttonPrefab) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_01ac: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown this.panel = panel; bodyColor = body.bodyColor; Transform transform = ((Component)this).transform; PlaceUnderTalent(panel, transform); Transform val = transform.Find("SlotLabel"); rowLabel = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent() : null); if (Object.op_Implicit((Object)(object)rowLabel)) { MakePlainText(rowLabel); ((Graphic)rowLabel).color = bodyColor; } AddRim(transform); Transform val2 = transform.Find("ButtonSelectionHighlight, Checkbox"); if (Object.op_Implicit((Object)(object)val2)) { ((Component)val2).gameObject.SetActive(false); } Transform val3 = transform.Find("ButtonContainer"); if (!Object.op_Implicit((Object)(object)val3)) { return; } for (int num = val3.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)val3.GetChild(num)).gameObject); } HorizontalLayoutGroup component = ((Component)val3).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { ((HorizontalOrVerticalLayoutGroup)component).spacing = 8f; AlignWithVanillaRows(panel, transform, component); } slotButtons = (HGButton[])(object)new HGButton[5]; rankLabels = (HGTextMeshProUGUI[])(object)new HGTextMeshProUGUI[5]; for (int i = 0; i < slotButtons.Length; i++) { int slot = i; GameObject val4 = Object.Instantiate(buttonPrefab, val3); ((Object)val4).name = "Card Slot " + (slot + 1); HGButton val5 = val4.GetComponent(); if (!Object.op_Implicit((Object)(object)val5)) { val5 = val4.AddComponent(); } ((Button)val5).onClick = new ButtonClickedEvent(); ((UnityEvent)((Button)val5).onClick).AddListener((UnityAction)delegate { //IL_0021: Unknown result type (might be due to invalid IL or missing references) DrogozCardPicker.Open(panel, this, bodyColor, slot); }); val5.updateTextOnHover = true; val5.hoverLanguageTextMeshController = panel.hoverTextDescription; ((MPButton)val5).requiredTopLayer = panel.requiredUILayerKey; ((MPButton)val5).disableGamepadClick = false; ((MPButton)val5).disablePointerClick = false; ((Selectable)val5).interactable = true; LayoutElement val6 = val4.GetComponent(); if (!Object.op_Implicit((Object)(object)val6)) { val6 = val4.AddComponent(); } val6.preferredWidth = 104f; val6.preferredHeight = 104f; rankLabels[slot] = CreateRankLabel(val4.transform, slot); slotButtons[slot] = val5; } WireSlotNavigation(); LoadEditIcon(); Refresh(); } private void AddRim(Transform root) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) Transform val = root.Find("ButtonSelectionHighlight, Checkbox/Highlight"); Image val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent() : null); if (Object.op_Implicit((Object)(object)val2)) { GameObject val3 = new GameObject("Rim", new Type[1] { typeof(RectTransform) }); val3.transform.SetParent(root, false); val3.transform.SetAsLastSibling(); RectTransform val4 = (RectTransform)val3.transform; val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = new Vector2(-4f, -4f); val4.offsetMax = new Vector2(4f, 4f); Image obj = val3.AddComponent(); obj.sprite = val2.sprite; obj.type = val2.type; ((Graphic)obj).material = ((Graphic)val2).material; obj.pixelsPerUnitMultiplier = val2.pixelsPerUnitMultiplier; ((Graphic)obj).color = bodyColor; ((Graphic)obj).raycastTarget = false; } } private static void PlaceUnderTalent(LoadoutPanelController panel, Transform row) { int num = -1; for (int i = 0; i < ((Component)panel).transform.childCount; i++) { Transform val = ((Component)panel).transform.GetChild(i).Find("SlotLabel"); LanguageTextMeshController val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent() : null); if (Object.op_Implicit((Object)(object)val2) && !string.IsNullOrEmpty(val2.token) && val2.token.Contains("TALENT")) { num = i; } } row.SetSiblingIndex((num >= 0) ? (num + 1) : Mathf.Max(0, ((Component)panel).transform.childCount - 2)); } private static void AlignWithVanillaRows(LoadoutPanelController panel, Transform row, HorizontalLayoutGroup layout) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown for (int i = 0; i < ((Component)panel).transform.childCount; i++) { Transform child = ((Component)panel).transform.GetChild(i); if (!((Object)(object)child == (Object)(object)row) && !Object.op_Implicit((Object)(object)child.Find("RowScrollPanel"))) { ((LayoutGroup)layout).padding = new RectOffset(136, ((LayoutGroup)layout).padding.right, ((LayoutGroup)layout).padding.top, ((LayoutGroup)layout).padding.bottom); break; } } } private HGTextMeshProUGUI CreateRankLabel(Transform parent, int slot) { //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) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)rowLabel)) { return null; } GameObject val = Object.Instantiate(((Component)rowLabel).gameObject, parent, false); ((Object)val).name = "Rank " + (slot + 1); RectTransform val2 = (RectTransform)val.transform; val2.anchorMin = new Vector2(0f, 0f); val2.anchorMax = new Vector2(1f, 0f); val2.pivot = new Vector2(0.5f, 0f); val2.anchoredPosition = new Vector2(0f, 2f); val2.sizeDelta = new Vector2(-8f, 22f); HGTextMeshProUGUI component = val.GetComponent(); ((TMP_Text)component).fontSize = 20f; ((TMP_Text)component).alignment = (TextAlignmentOptions)1026; ((Graphic)component).color = bodyColor; ((TMP_Text)component).margin = Vector4.zero; ((Graphic)component).raycastTarget = false; val.SetActive(false); return component; } private void WireSlotNavigation() { //IL_000c: 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) //IL_005f: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < slotButtons.Length; i++) { Navigation navigation = ((Selectable)slotButtons[i]).navigation; ((Navigation)(ref navigation)).mode = (Mode)3; ((Navigation)(ref navigation)).selectOnLeft = (Selectable)(object)slotButtons[(i + slotButtons.Length - 1) % slotButtons.Length]; ((Navigation)(ref navigation)).selectOnRight = (Selectable)(object)slotButtons[(i + 1) % slotButtons.Length]; ((Selectable)slotButtons[i]).navigation = navigation; } } private void LoadEditIcon() { if (!Object.op_Implicit((Object)(object)editIcon)) { editIcon = LegacyResourcesAPI.Load("Textures/MiscIcons/texEditIcon"); } } private void OnEnable() { DrogozCardLoadoutStorage.Changed += OnStorageChanged; Refresh(); } private void OnDisable() { DrogozCardLoadoutStorage.Changed -= OnStorageChanged; } private void OnStorageChanged() { Refresh(); } public void Refresh() { Refresh(DrogozCardLoadoutStorage.Current); } internal void Refresh(CardLoadout loadout) { //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) if (slotButtons == null || rankLabels == null) { return; } if (Object.op_Implicit((Object)(object)rowLabel)) { ((TMP_Text)rowLabel).text = "Loadout Cards"; } for (int i = 0; i < slotButtons.Length; i++) { string text = string.Empty; int num = 0; if (loadout != null && loadout.Slots != null && i < loadout.Slots.Length) { CardSlot obj = loadout.Slots[i]; text = obj.CardId; num = obj.Rank; } bool flag = !string.IsNullOrEmpty(text) && num > 0; CardDefinition cardDefinition = (flag ? FindCard(text) : null); HGButton val = slotButtons[i]; if (Object.op_Implicit((Object)(object)val)) { string text2; string text3; if (flag) { text2 = ((cardDefinition != null) ? cardDefinition.Name : text); text3 = ((cardDefinition != null) ? cardDefinition.Description : string.Empty); text3 = text3 + "\nRank " + Mathf.Clamp(num, 1, 5) + " of " + 5 + "."; } else { text2 = "Edit Loadout Cards"; text3 = "Choose a card for slot " + (i + 1) + "."; } SetTooltip(val, (flag && cardDefinition != null && (Object)(object)cardDefinition.Icon != (Object)null) ? cardDefinition.Icon : editIcon, text2, text3, bodyColor); Color val2 = bodyColor; val2.a = 0.2f; val.hoverToken = Language.GetStringFormatted("LOGBOOK_HOVER_DESCRIPTION_FORMAT", new object[3] { text2, text3, ColorUtility.ToHtmlStringRGBA(val2) }); if (Object.op_Implicit((Object)(object)rankLabels[i])) { ((TMP_Text)rankLabels[i]).text = "R" + Mathf.Clamp(num, 1, 5); ((Component)rankLabels[i]).gameObject.SetActive(flag); } } } } private static CardDefinition FindCard(string cardId) { if (string.IsNullOrEmpty(cardId) || DrogozCardCatalog.Cards == null) { return null; } for (int i = 0; i < DrogozCardCatalog.Cards.Length; i++) { CardDefinition cardDefinition = DrogozCardCatalog.Cards[i]; if (cardDefinition != null && cardDefinition.Id == cardId) { return cardDefinition; } } return null; } private static void SetTooltip(HGButton button, Sprite icon, string title, string description, Color color) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) TooltipProvider val = ((Component)button).GetComponent(); if (!Object.op_Implicit((Object)(object)val)) { val = ((Component)button).gameObject.AddComponent(); } val.titleColor = color; val.overrideTitleText = title; val.overrideBodyText = description; Graphic targetGraphic = ((Selectable)button).targetGraphic; Image val2 = (Image)(object)((targetGraphic is Image) ? targetGraphic : null); if (Object.op_Implicit((Object)(object)val2)) { val2.sprite = icon; val2.preserveAspect = true; } } private static void MakePlainText(HGTextMeshProUGUI label) { LanguageTextMeshController[] componentsInChildren = ((Component)label).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Behaviour)componentsInChildren[i]).enabled = false; Object.Destroy((Object)(object)componentsInChildren[i]); } } } public static class DrogozCardLoadoutRows { private static bool hooked; private static GameObject rowPrefab; private static GameObject buttonPrefab; public static void Init() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!hooked) { LoadoutPanelController.Rebuild += new hook_Rebuild(OnRebuild); hooked = true; } } private static void OnRebuild(orig_Rebuild orig, LoadoutPanelController self) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) DrogozCardLoadoutRow[] componentsInChildren = ((Component)self).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (Object.op_Implicit((Object)(object)componentsInChildren[i])) { ((Component)componentsInChildren[i]).gameObject.SetActive(false); Object.Destroy((Object)(object)((Component)componentsInChildren[i]).gameObject); } } orig.Invoke(self); if (!Object.op_Implicit((Object)(object)self) || !DrogozConfig.LoadoutCardsEnabled.Value) { return; } MPEventSystemLocator component = ((Component)self).GetComponent(); LocalUser val = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.eventSystem)) ? component.eventSystem.localUser : null); NetworkUser val2 = ((val != null) ? val.currentNetworkUser : null); if ((Object)(object)val2 == (Object)null) { return; } CharacterBody bodyPrefabBodyComponent = BodyCatalog.GetBodyPrefabBodyComponent(val2.bodyIndexPreference); if (Object.op_Implicit((Object)(object)bodyPrefabBodyComponent) && Object.op_Implicit((Object)(object)((Component)bodyPrefabBodyComponent).GetComponent())) { LoadPrefabs(); if (Object.op_Implicit((Object)(object)rowPrefab) && Object.op_Implicit((Object)(object)buttonPrefab)) { GameObject obj = Object.Instantiate(rowPrefab, ((Component)self).transform); ((Object)obj).name = "DrogozCardLoadoutRow"; obj.AddComponent().Build(self, bodyPrefabBodyComponent, buttonPrefab); } } } private static void LoadPrefabs() { if (!Object.op_Implicit((Object)(object)rowPrefab)) { rowPrefab = LegacyResourcesAPI.Load("Prefabs/UI/Loadout/Row"); } if (!Object.op_Implicit((Object)(object)buttonPrefab)) { buttonPrefab = LegacyResourcesAPI.Load("Prefabs/UI/Loadout/LoadoutButton"); } } } public sealed class DrogozCardPicker : MonoBehaviour { private class Entry { public CardDefinition Card; public HGButton Button; } private const int CatalogColumns = 8; private const float CatalogHeight = 264f; private static UILayer layer; private static GameObject rowPrefab; private static GameObject loadoutButtonPrefab; private static GameObject menuButtonPrefab; private static Sprite editIcon; private static Sprite plateSprite; private static DrogozCardPicker open; private LoadoutPanelController panel; private DrogozCardLoadoutRow row; private CardLoadout loadout; private Color bodyColor; private UILayerKey key; private MPEventSystemLocator locator; private int active; private bool closing; private HGButton[] slotButtons; private HGTextMeshProUGUI[] slotRankLabels; private HGTextMeshProUGUI pointsLabel; private HGTextMeshProUGUI validationLabel; private HGTextMeshProUGUI activeLabel; private HGTextMeshProUGUI rankLabel; private MPButton minusButton; private MPButton plusButton; private MPButton clearButton; private MPButton closeButton; private readonly List entries = new List(); private readonly List> catalogRows = new List>(); public static bool IsOpen => (Object)(object)open != (Object)null; public static void Open(LoadoutPanelController panel, DrogozCardLoadoutRow row, Color bodyColor, int slot) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)open)) { open.row = row; open.Show(slot); } else { if (!DrogozConfig.LoadoutCardsEnabled.Value || !Object.op_Implicit((Object)(object)panel) || DrogozCardLoadoutStorage.Current == null) { return; } LoadPrefabs(); if (!Object.op_Implicit((Object)(object)rowPrefab) || !Object.op_Implicit((Object)(object)loadoutButtonPrefab)) { return; } CardLoadout cardLoadout = DrogozCardLoadoutStorage.Current.Clone(); if (cardLoadout != null) { Canvas componentInParent = ((Component)panel).GetComponentInParent(); if (Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)componentInParent.rootCanvas)) { GameObject val = NewRect("DrogozCardPicker", ((Component)componentInParent.rootCanvas).transform); val.transform.SetAsLastSibling(); Stretch((RectTransform)val.transform, Vector2.zero); val.SetActive(false); DrogozCardPicker drogozCardPicker = val.AddComponent(); drogozCardPicker.panel = panel; drogozCardPicker.row = row; drogozCardPicker.loadout = cardLoadout; drogozCardPicker.bodyColor = bodyColor; drogozCardPicker.locator = val.AddComponent(); drogozCardPicker.key = val.AddComponent(); drogozCardPicker.key.layer = layer; drogozCardPicker.key.onBeginRepresentTopLayer = new UnityEvent(); drogozCardPicker.key.onEndRepresentTopLayer = new UnityEvent(); drogozCardPicker.Build(); open = drogozCardPicker; val.SetActive(true); drogozCardPicker.Show(slot); } } } } private static void LoadPrefabs() { //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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)layer)) { layer = ScriptableObject.CreateInstance(); layer.priority = 1000; } if (!Object.op_Implicit((Object)(object)rowPrefab)) { rowPrefab = LegacyResourcesAPI.Load("Prefabs/UI/Loadout/Row"); } if (!Object.op_Implicit((Object)(object)loadoutButtonPrefab)) { loadoutButtonPrefab = LegacyResourcesAPI.Load("Prefabs/UI/Loadout/LoadoutButton"); } if (!Object.op_Implicit((Object)(object)editIcon)) { editIcon = LegacyResourcesAPI.Load("Textures/MiscIcons/texEditIcon"); } if (!Object.op_Implicit((Object)(object)menuButtonPrefab)) { menuButtonPrefab = Addressables.LoadAssetAsync((object)RoR2_Base_UI.NakedButton_prefab).WaitForCompletion(); } if (!Object.op_Implicit((Object)(object)plateSprite)) { plateSprite = Addressables.LoadAssetAsync((object)RoR2_Base_UI.texUIPopupRect_png_texUIPopupRect_).WaitForCompletion(); } } private void Build() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_00a2: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0169: 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_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Expected O, but got Unknown //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Expected O, but got Unknown //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Expected O, but got Unknown //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_046d: Expected O, but got Unknown //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04af: Expected O, but got Unknown Image val = ((Component)this).gameObject.AddComponent(); ((Graphic)val).color = new Color(0f, 0f, 0f, 0.5f); Button obj = ((Component)this).gameObject.AddComponent