Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ArchaonSurvivor v1.0.0
plugins\ArchaonSurvivor\ArchaonSurvivor.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CAVfx; using EntityStates; using HG.BlendableTypes; using KinematicCharacterController; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using Rewired; using RoR2; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; [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("ArchaonSurvivor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ArchaonSurvivor")] [assembly: AssemblyTitle("ArchaonSurvivor")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ArchaonSurvivor { [BepInPlugin("com.abyssano78.archaonsurvivor", "ArchaonSurvivor", "1.0.0")] [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.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "com.abyssano78.archaonsurvivor"; public const string Name = "ArchaonSurvivor"; public const string Version = "1.0.0"; private AssetBundle assets; private AssetBundle vfx; private void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); ArchaonConfig.Init(((BaseUnityPlugin)this).Config); string text = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? ""; try { assets = Load(text, "archaonassets"); Log.Info("CA VFX runtime " + typeof(CAVfxLibrary).Assembly.GetName().Version); vfx = Load(text, "archaonvfx"); if ((Object)(object)assets == (Object)null || (Object)(object)vfx == (Object)null) { return; } GameObject val = assets.LoadAsset<GameObject>("ArchaonVisual"); if ((Object)(object)val == (Object)null) { Log.Error("ArchaonVisual missing from the bundle"); return; } Icons.Init(assets); Icons.LoadPng(text, "Magic"); ArchaonSpiritLeech.HandPrefab = assets.LoadAsset<GameObject>("CAModel_SoulLeechHand"); BurningHead.SkullPrefab = assets.LoadAsset<GameObject>("CAModel_BurningSkull"); FlamingSwordOfRhuin.SwordPrefab = assets.LoadAsset<GameObject>("CAModel_RhuinSword"); ArchaonMount.HorsePrefab = assets.LoadAsset<GameObject>("CAModel_Dorghar"); Log.Info("Dorghar: " + ((Object)(object)ArchaonMount.HorsePrefab != (Object)null)); Log.Info("Spirit Leech hand: " + ((Object)(object)ArchaonSpiritLeech.HandPrefab != (Object)null)); ArchaonVfx.Init(vfx, assets); ArchaonBuffs.Init(); ArchaonPassive.Hooks(); ArchaonVoice.Init(text); ArchaonNet.Init(); ArchaonSfx.Init(text); if (ArchaonBody.Initialize(val) && ArchaonSkills.Initialize(ArchaonBody.BodyPrefab) && Survivor()) { Content.Register(); Log.Info("Archaon, the Everchosen, is ready."); } else { Log.Error("Archaon setup did not complete."); } } catch (Exception ex) { Log.Error("Archaon initialization failed: " + ex); } } private static AssetBundle Load(string dir, string name) { string text = Path.Combine(dir, name); if (!File.Exists(text)) { Log.Error("AssetBundle " + name + " not found beside the plugin"); return null; } AssetBundle obj = AssetBundle.LoadFromFile(text); if ((Object)(object)obj == (Object)null) { Log.Error("AssetBundle " + name + " failed to load"); } return obj; } private static bool Survivor() { //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) LanguageAPI.Add("ARCHAON_NAME", "Archaon"); LanguageAPI.Add("ARCHAON_SUBTITLE", "Lord of the End Times"); LanguageAPI.Add("ARCHAON_DESCRIPTION", "Archaon the Everchosen fights with Slayer of Kings and the three lores of magic he has mastered.\n\n< ! > Slayer of Kings builds Ruin: keep attacking to grow faster.\n\n< ! > Switch the magic stance (D-pad left) to choose your Secondary and Special: Fire, Metal or Death.\n\n< ! > A perfect Shield Parry doubles your next primary hit.\n\n< ! > When the U'zhul meter fills, the daemon in the sword is unleashed."); LanguageAPI.Add("ARCHAON_OUTRO", "..and so the Everchosen went on, to end yet another world."); LanguageAPI.Add("ARCHAON_OUTRO_FAILURE", "..and so the End Times were delayed."); SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>(); val.cachedName = "Archaon"; val.bodyPrefab = ArchaonBody.BodyPrefab; val.displayPrefab = ArchaonBody.DisplayPrefab; val.primaryColor = new Color(0.55f, 0.08f, 0.08f); val.displayNameToken = "ARCHAON_NAME"; val.descriptionToken = "ARCHAON_DESCRIPTION"; val.outroFlavorToken = "ARCHAON_OUTRO"; val.mainEndingEscapeFailureFlavorToken = "ARCHAON_OUTRO_FAILURE"; val.desiredSortPosition = 101f; Content.Survivors.Add(val); return true; } private void OnDestroy() { if ((Object)(object)assets != (Object)null) { assets.Unload(false); } if ((Object)(object)vfx != (Object)null) { vfx.Unload(false); } } } internal static class ArchaonBody { internal static GameObject BodyPrefab; internal static GameObject DisplayPrefab; internal const string VisualName = "ArchaonVisual"; internal static bool Initialize(GameObject visualPrefab) { //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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: 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_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/CommandoBody.prefab").WaitForCompletion(); if ((Object)(object)val == (Object)null) { Log.Error("CommandoBody missing"); return false; } BodyPrefab = PrefabAPI.InstantiateClone(val, "ArchaonBody", true); CharacterBody component = BodyPrefab.GetComponent<CharacterBody>(); ModelLocator component2 = BodyPrefab.GetComponent<ModelLocator>(); CharacterDirection component3 = BodyPrefab.GetComponent<CharacterDirection>(); Transform modelTransform = component2.modelTransform; if ((Object)(object)modelTransform != (Object)null) { Renderer[] componentsInChildren = ((Component)modelTransform).GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } ((Component)modelTransform).gameObject.SetActive(false); } GameObject val2 = new GameObject("ArchaonModelRoot"); Transform transform = val2.transform; transform.SetParent(component2.modelBaseTransform, false); GameObject obj = Object.Instantiate<GameObject>(visualPrefab, transform); ((Object)obj).name = "ArchaonVisual"; obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one * ArchaonConfig.ModelScale.Value; component2.modelTransform = transform; Animator componentInChildren = obj.GetComponentInChildren<Animator>(true); componentInChildren.applyRootMotion = false; componentInChildren.cullingMode = (AnimatorCullingMode)0; if ((Object)(object)component3 != (Object)null) { component3.targetTransform = component2.modelBaseTransform; component3.overrideAnimatorForwardTransform = null; component3.rootMotionAccumulator = null; component3.modelAnimator = componentInChildren; component3.driveFromRootRotation = false; component3.turnSpeed = 540f; } CapsuleCollider component4 = BodyPrefab.GetComponent<CapsuleCollider>(); if ((Object)(object)component4 != (Object)null) { float value = ArchaonConfig.ModelScale.Value; float num = component4.center.y - component4.height * 0.5f; component4.radius = Mathf.Clamp(0.45f * value, component4.radius, 0.85f); component4.height = Mathf.Clamp(1.65f * value, component4.height, 3.2f); component4.center = new Vector3(0f, num + component4.height * 0.5f, 0f); KinematicCharacterMotor component5 = BodyPrefab.GetComponent<KinematicCharacterMotor>(); if ((Object)(object)component5 != (Object)null) { component5.SetCapsuleDimensions(component4.radius, component4.height, component4.center.y); } } HurtBox(transform, modelTransform, component); CameraAndAim(component); CharacterModel(val2, component); BodyPrefab.AddComponent<ArchaonAnimationDriver>(); BodyPrefab.AddComponent<ArchaonPersistentVfx>(); BodyPrefab.AddComponent<ArchaonPassive>(); BodyPrefab.AddComponent<ArchaonHud>(); BodyPrefab.AddComponent<ArchaonVoiceSpeaker>(); BodyPrefab.AddComponent<ArchaonMount>(); EntityStateMachine[] components = BodyPrefab.GetComponents<EntityStateMachine>(); foreach (EntityStateMachine val3 in components) { if (val3.customName == "Body") { val3.initialStateType = new SerializableEntityStateType(typeof(GenericCharacterMain)); } } CharacterDeathBehavior component6 = BodyPrefab.GetComponent<CharacterDeathBehavior>(); if ((Object)(object)component6 != (Object)null) { component6.deathState = new SerializableEntityStateType(typeof(ArchaonDeathState)); Content.States.Add(typeof(ArchaonDeathState)); } component.baseNameToken = "ARCHAON_NAME"; component.subtitleNameToken = "ARCHAON_SUBTITLE"; component.bodyColor = new Color(0.55f, 0.08f, 0.08f); component.baseMaxHealth = 300f; component.levelMaxHealth = 100f; component.baseRegen = 1.5f; component.levelRegen = 0.3f; component.baseDamage = 14f; component.levelDamage = 2.8f; component.baseMoveSpeed = 6.3f; component.baseAcceleration = 55f; component.baseJumpPower = 15f; component.baseArmor = 60f; component.baseCrit = 5f; component.sprintingSpeedMultiplier = 1.4f; Sprite val4 = Icons.Get("Portrait"); if ((Object)(object)val4 != (Object)null) { component.portraitIcon = (Texture)(object)val4.texture; } if (!Display(visualPrefab)) { return false; } Transform obj2 = DisplayPrefab.transform.Find("ArchaonDisplayRoot"); Skins(val2, (obj2 != null) ? ((Component)obj2).gameObject : null); Content.Bodies.Add(BodyPrefab); return true; } private static void HurtBox(Transform root, Transform vanilla, CharacterBody body) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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) if ((Object)(object)vanilla != (Object)null) { HurtBox[] componentsInChildren = ((Component)vanilla).GetComponentsInChildren<HurtBox>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.SetActive(false); } HurtBoxGroup[] componentsInChildren2 = ((Component)vanilla).GetComponentsInChildren<HurtBoxGroup>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } } GameObject val = new GameObject("ArchaonHurtBox") { layer = LayerIndex.entityPrecise.intVal }; val.transform.SetParent(root, false); float value = ArchaonConfig.ModelScale.Value; val.transform.localPosition = new Vector3(0f, 1.15f * value, 0f); CapsuleCollider obj = val.AddComponent<CapsuleCollider>(); obj.direction = 1; obj.radius = 0.75f * value; obj.height = 2.4f * value; HurtBox val2 = val.AddComponent<HurtBox>(); val2.healthComponent = ((Component)body).GetComponent<HealthComponent>(); val2.isBullseye = true; val2.isSniperTarget = true; HurtBoxGroup val3 = ((Component)root).gameObject.AddComponent<HurtBoxGroup>(); val3.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val2 }; val3.mainHurtBox = val2; val3.bullseyeCount = 1; val2.hurtBoxGroup = val3; val2.indexInGroup = 0; } private static void CameraAndAim(CharacterBody body) { //IL_003b: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: 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) //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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) float value = ArchaonConfig.ModelScale.Value; Transform val = ArchaonVfx.FindDeep(BodyPrefab.transform, "CameraPivot"); if ((Object)(object)val != (Object)null) { val.localPosition = new Vector3(0f, 1.7f * value, 0f); } Transform val2 = ArchaonVfx.FindDeep(BodyPrefab.transform, "AimOrigin"); if ((Object)(object)val2 == (Object)null) { val2 = new GameObject("AimOrigin").transform; val2.SetParent(BodyPrefab.transform, false); } val2.localPosition = new Vector3(0f, 1.6f * value, 0f); body.aimOriginTransform = val2; CameraTargetParams component = BodyPrefab.GetComponent<CameraTargetParams>(); if ((Object)(object)component != (Object)null) { CharacterCameraParams val3 = ScriptableObject.CreateInstance<CharacterCameraParams>(); ((Object)val3).name = "ccpArchaon"; val3.data.minPitch = BlendableFloat.op_Implicit(-70f); val3.data.maxPitch = BlendableFloat.op_Implicit(70f); val3.data.wallCushion = BlendableFloat.op_Implicit(0.1f); val3.data.pivotVerticalOffset = BlendableFloat.op_Implicit(0f); val3.data.idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0.8f, -14f)); component.cameraParams = val3; } } private static RendererInfo[] Renderers(GameObject root, out SkinnedMeshRenderer main) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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) main = null; Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = new RendererInfo { renderer = componentsInChildren[i], defaultMaterial = componentsInChildren[i].sharedMaterial, defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; if ((Object)(object)main == (Object)null) { Renderer obj = componentsInChildren[i]; SkinnedMeshRenderer val = (SkinnedMeshRenderer)(object)((obj is SkinnedMeshRenderer) ? obj : null); if (val != null) { main = val; } } } return array; } private static void CharacterModel(GameObject root, CharacterBody body) { CharacterModel obj = root.GetComponent<CharacterModel>() ?? root.AddComponent<CharacterModel>(); obj.body = body; obj.baseRendererInfos = Renderers(root, out var main); obj.mainSkinnedMeshRenderer = main; } private static bool Display(GameObject visualPrefab) { //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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0091: 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_00c8: 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) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Commando/CommandoDisplay.prefab").WaitForCompletion(); if ((Object)(object)val == (Object)null) { Log.Error("CommandoDisplay missing"); return false; } DisplayPrefab = PrefabAPI.InstantiateClone(val, "ArchaonDisplay", false); CharacterModel componentInChildren = DisplayPrefab.GetComponentInChildren<CharacterModel>(true); if ((Object)(object)componentInChildren != (Object)null) { ((Component)componentInChildren).gameObject.SetActive(false); } GameObject val2 = new GameObject("ArchaonDisplayRoot"); val2.transform.SetParent(DisplayPrefab.transform, false); val2.transform.localPosition = new Vector3(0f, -0.1f, 0f); GameObject obj = Object.Instantiate<GameObject>(visualPrefab, val2.transform); ((Object)obj).name = "ArchaonVisual"; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one * ArchaonConfig.LobbyScale.Value; Animator componentInChildren2 = obj.GetComponentInChildren<Animator>(true); if ((Object)(object)componentInChildren2 != (Object)null) { componentInChildren2.applyRootMotion = false; componentInChildren2.cullingMode = (AnimatorCullingMode)0; } obj.AddComponent<ArchaonDisplayAnim>(); CharacterModel obj2 = val2.AddComponent<CharacterModel>(); obj2.baseRendererInfos = Renderers(val2, out var main); obj2.mainSkinnedMeshRenderer = main; return true; } private static void Skins(GameObject bodyRoot, GameObject displayRoot) { CharacterModel component = bodyRoot.GetComponent<CharacterModel>(); SkinDefParams val = ScriptableObject.CreateInstance<SkinDefParams>(); ((Object)val).name = "ArchaonDefaultSkinParams"; val.rendererInfos = (RendererInfo[])component.baseRendererInfos.Clone(); SkinDef val2 = ScriptableObject.CreateInstance<SkinDef>(); ((Object)val2).name = "ArchaonDefaultSkin"; val2.nameToken = "ARCHAON_SKIN_DEFAULT"; val2.icon = Icons.Get("Portrait"); val2.rootObject = bodyRoot; val2.skinDefParams = val; LanguageAPI.Add("ARCHAON_SKIN_DEFAULT", "The Everchosen"); bodyRoot.AddComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[1] { val2 }; if ((Object)(object)displayRoot != (Object)null) { displayRoot.AddComponent<ModelSkinController>().skins = (SkinDef[])(object)new SkinDef[1] { val2 }; } } } internal sealed class ArchaonDisplayAnim : MonoBehaviour { private void OnEnable() { Animator componentInChildren = ((Component)this).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.Play("hu1c_sws_archaon_affirmative_01", 0, 0f); } ((MonoBehaviour)this).Invoke("Idle", 3.8f); ((Component)this).gameObject.AddComponent<ArchaonPersistentVfx>().model = ((Component)this).transform; ArchaonVoice.Post(Voice.Select, ((Component)this).gameObject); } private void Idle() { Animator componentInChildren = ((Component)this).GetComponentInChildren<Animator>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.CrossFade("hu1c_sws_archaon_combat_idle_01", 0.3f); } } } internal sealed class ArchaonAnimationDriver : MonoBehaviour { internal const string Idle = "hu1c_sws_archaon_combat_idle_01"; internal const string Walk = "hu1c_sws_archaon_walk_01"; internal const string Run = "hu1c_sws_archaon_run_01"; internal const string RiderIdle = "hu1c_hr_archaon_rider_combat_idle_01"; internal const string RiderRun = "hu1c_hr_archaon_rider_run_01"; internal const string RiderCharge = "hu1c_hr_archaon_rider_charge_01"; private const string FootJump = "hu1c_sws_archaon_jump_attack_01"; private const string RiderJump = "hu1c_hr_archaon_rider_jumping_attack_01"; private static readonly float[] FootJ = new float[4] { 0.45f, 0.9f, 1.05f, 1.5f }; private static readonly float[] RiderJ = new float[4] { 1.1f, 1.5f, 1.7f, 2.2f }; private CharacterBody body; private CharacterMotor motor; private Animator animator; private string current; private float lockedUntil; private int air; private float airClock; private float airborneFor; private bool airMounted; internal Animator Animator { get { if (!((Object)(object)animator != (Object)null)) { return Resolve(); } return animator; } } internal Transform Model { get { if (!((Object)(object)Animator != (Object)null)) { return null; } return ((Component)animator).transform; } } private Animator Resolve() { ModelLocator component = ((Component)this).GetComponent<ModelLocator>(); if ((Object)(object)component != (Object)null && (Object)(object)component.modelTransform != (Object)null) { animator = ((Component)component.modelTransform).GetComponentInChildren<Animator>(true); } return animator; } private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); motor = ((Component)this).GetComponent<CharacterMotor>(); Resolve(); } internal void PlayAction(string state, float startSeconds, float speed, float lockSeconds) { if (!((Object)(object)Animator == (Object)null)) { animator.speed = 1f; air = 0; animator.SetFloat("ActionSpeed", speed); animator.CrossFadeInFixedTime(state, 0.1f, 0, startSeconds); current = state; if (ArchaonMount.IsMounted(body)) { ArchaonMount.Of(body)?.Sync(state, startSeconds, speed, loop: false); } lockedUntil = Time.time + lockSeconds; } } internal void Release() { lockedUntil = 0f; current = null; air = 0; } private bool Jump(bool mounted) { bool flag = (Object)(object)motor == (Object)null || motor.isGrounded; airborneFor = (flag ? 0f : (airborneFor + Time.deltaTime)); ArchaonMount archaonMount = (mounted ? ArchaonMount.Of(body) : null); if (air == 0) { if (airborneFor < 0.12f) { return false; } airMounted = mounted; float[] array = (airMounted ? RiderJ : FootJ); string text = (airMounted ? "hu1c_hr_archaon_rider_jumping_attack_01" : "hu1c_sws_archaon_jump_attack_01"); animator.speed = 1f; animator.SetFloat("ActionSpeed", 1f); animator.CrossFadeInFixedTime(text, 0.08f, 0, array[0]); current = text; air = 1; airClock = array[0]; archaonMount?.Sync(text, array[0], 1f, loop: false); return true; } float[] array2 = (airMounted ? RiderJ : FootJ); string text2 = (airMounted ? "hu1c_hr_archaon_rider_jumping_attack_01" : "hu1c_sws_archaon_jump_attack_01"); if (!flag) { if (air == 1) { airClock += Time.deltaTime; if (airClock >= array2[1]) { animator.SetFloat("ActionSpeed", 0f); archaonMount?.SetRate(0f, all: true); air = 2; } } return true; } air = 0; animator.SetFloat("ActionSpeed", 1.3f); animator.CrossFadeInFixedTime(text2, 0.05f, 0, array2[2]); current = text2; archaonMount?.Sync(text2, array2[2], 1.3f, loop: false); lockedUntil = Time.time + (array2[3] - array2[2]) / 1.3f; return true; } private void Update() { //IL_0045: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Animator == (Object)null || (Object)(object)body == (Object)null || Time.time < lockedUntil) { return; } Vector3 val = (((Object)(object)motor != (Object)null) ? motor.velocity : Vector3.zero); val.y = 0f; bool flag = ArchaonMount.IsMounted(body); if (Jump(flag)) { return; } float num = (Object.op_Implicit((Object)(object)Model) ? Model.lossyScale.x : 1f); float magnitude = ((Vector3)(ref val)).magnitude; float num2 = 1f; string text; if (magnitude < 0.25f) { text = (flag ? "hu1c_hr_archaon_rider_combat_idle_01" : "hu1c_sws_archaon_combat_idle_01"); } else if (flag) { bool isSprinting = body.isSprinting; text = (isSprinting ? "hu1c_hr_archaon_rider_charge_01" : "hu1c_hr_archaon_rider_run_01"); num2 = Mathf.Clamp(magnitude / ((isSprinting ? 8.39f : 4.12f) * num), 0.7f, 1.5f); } else if (magnitude / (0.8f * num) <= 2.2f) { text = "hu1c_sws_archaon_walk_01"; num2 = Mathf.Clamp(magnitude / (0.8f * num), 0.8f, 2.2f); } else { text = "hu1c_sws_archaon_run_01"; num2 = Mathf.Clamp(magnitude / (2.08f * num), 0.9f, 1.5f); } animator.speed = ((text == "hu1c_sws_archaon_combat_idle_01" || text == "hu1c_hr_archaon_rider_combat_idle_01") ? 1f : num2); if (flag) { ArchaonMount.Of(body)?.SetRate(animator.speed); } if (!(text == current)) { animator.SetFloat("ActionSpeed", 1f); animator.CrossFadeInFixedTime(text, 0.2f, 0); current = text; if (flag) { ArchaonMount.Of(body)?.Sync(text, 0f, 1f, loop: true); } } } } internal sealed class ArchaonPersistentVfx : MonoBehaviour { internal Transform model; private readonly List<CAVfxInstance> live = new List<CAVfxInstance>(); private float retry; private void Update() { //IL_008b: 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) if (live.Count > 0 || Time.time < retry) { return; } retry = Time.time + 1f; if ((Object)(object)model == (Object)null) { ArchaonAnimationDriver component = ((Component)this).GetComponent<ArchaonAnimationDriver>(); model = (((Object)(object)component != (Object)null) ? component.Model : null); } if ((Object)(object)model == (Object)null || (Object)(object)ArchaonVfx.Library == (Object)null) { return; } AnimEvents animEvents = ArchaonVfx.Events("hu1c_archaon_sword_and_shield_vfx_persistent_metadata_alive_0"); if (animEvents == null) { return; } float x = model.lossyScale.x; AnimTag[] tags = animEvents.tags; foreach (AnimTag animTag in tags) { if (!(animTag.tag != "EFFECT")) { CAVfxInstance val = ArchaonVfx.SpawnTag(animTag, model, 1f, Color.white); if ((Object)(object)val != (Object)null) { val.maxLifetime = float.PositiveInfinity; val.sim.scale = animTag.scale * x; live.Add(val); } } } } internal void StopAll() { foreach (CAVfxInstance item in live) { if ((Object)(object)item != (Object)null) { item.Stop(); } } live.Clear(); retry = float.PositiveInfinity; } private void OnDisable() { foreach (CAVfxInstance item in live) { if ((Object)(object)item != (Object)null) { item.Kill(); } } live.Clear(); } } public class ArchaonDeathState : GenericCharacterDeath { public override bool shouldAutoDestroy => false; private static bool NetworkServerActive => NetworkServer.active; public override void OnEnter() { ((GenericCharacterDeath)this).OnEnter(); ArchaonAnimationDriver component = ((EntityState)this).GetComponent<ArchaonAnimationDriver>(); bool flag = ArchaonMount.IsMounted(((EntityState)this).characterBody); if ((Object)(object)component != (Object)null) { component.PlayAction(flag ? "hu1c_hr1_archaon_rider_death_01" : "cam_hu1c_sws_death_01", 0f, 1f, 999f); } ArchaonVoice.Say(((EntityState)this).characterBody, ArchaonVoice.OnFinalStage ? Voice.FinalDeath : Voice.Death); ArchaonSfxTimeline.Play(((EntityState)this).gameObject, flag ? "hu1c_hr1_archaon_rider_death_01" : "cam_hu1c_sws_death_01"); ArchaonPersistentVfx component2 = ((EntityState)this).GetComponent<ArchaonPersistentVfx>(); if ((Object)(object)component2 != (Object)null) { component2.StopAll(); } } public override void FixedUpdate() { ((GenericCharacterDeath)this).FixedUpdate(); if (NetworkServerActive && ((EntityState)this).fixedAge > 4.5f) { ((GenericCharacterDeath)this).DestroyBodyAsapServer(); } } } internal sealed class ArchaonMount : MonoBehaviour { internal static GameObject HorsePrefab; internal static SkillDef MountedPrimary; private static readonly Dictionary<CharacterBody, ArchaonMount> all = new Dictionary<CharacterBody, ArchaonMount>(); private CharacterBody body; private ArchaonAnimationDriver driver; private GameObject horse; private Animation horseAnim; private Transform horseRoot; private Transform rig; private Vector3 rigRest; private bool overridden; private float nextStep; private float nextVoice; private float nextTrample; private readonly Dictionary<HealthComponent, float> trampled = new Dictionary<HealthComponent, float>(); private string cueClip; private float cueTime; internal static bool IsMounted(CharacterBody b) { if ((Object)(object)b != (Object)null) { return b.HasBuff(ArchaonBuffs.Dorghar); } return false; } internal static ArchaonMount Of(CharacterBody b) { if (!((Object)(object)b != (Object)null) || !all.TryGetValue(b, out var value)) { return null; } return value; } private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); driver = ((Component)this).GetComponent<ArchaonAnimationDriver>(); } private void OnEnable() { if (Object.op_Implicit((Object)(object)body)) { all[body] = this; } } private void OnDisable() { if (Object.op_Implicit((Object)(object)body)) { all.Remove(body); } Dismount(fx: false); } private static string Pair(string rider) { if (rider == null) { return "hr1_large_legendary_lord_horse_combat_idle_01"; } if (rider.StartsWith("hu1c_hr_archaon_rider_attack_0")) { return "hr1_large_legendary_lord_horse_attack_0" + rider.Substring(rider.Length - 1); } if (rider.Contains("rider_jumping_attack")) { return "hr1_large_legendary_lord_horse_jumping_attack_01"; } if (rider.Contains("rider_run")) { return "hr1_large_heavy_horse_run_01"; } if (rider.Contains("rider_charge")) { return "hr1_large_heavy_horse_charge_01"; } if (rider.Contains("rider_walk")) { return "hr1_large_heavy_horse_walk_01"; } if (rider.Contains("rider_defend") || rider.Contains("reaction")) { return "hr1_defend_front_01"; } if (rider.Contains("rider_death") || rider.Contains("death")) { return "hr1_stand_death_01"; } return "hr1_large_legendary_lord_horse_combat_idle_01"; } internal void Sync(string riderState, float startSeconds, float speed, bool loop) { if (!((Object)(object)horseAnim == (Object)null)) { AnimationState val = horseAnim[Pair(riderState)]; if (!((TrackedReference)(object)val == (TrackedReference)null)) { val.wrapMode = (WrapMode)(loop ? 2 : 8); val.speed = speed; horseAnim.CrossFade(val.name, 0.15f); val.time = startSeconds; } } } internal void SetRate(float rate, bool all = false) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 if ((Object)(object)horseAnim == (Object)null) { return; } foreach (AnimationState item in horseAnim) { AnimationState val = item; if (horseAnim.IsPlaying(val.name) && (all || (int)val.wrapMode == 2)) { val.speed = rate; } } } private void Update() { //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) bool flag = IsMounted(body) && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive; if (flag && (Object)(object)horse == (Object)null) { Mount(); } else if (!flag && (Object)(object)horse != (Object)null && ((Object)(object)body.healthComponent == (Object)null || body.healthComponent.alive)) { Dismount(fx: true); } if (body.hasEffectiveAuthority && Object.op_Implicit((Object)(object)body.skillLocator) && Object.op_Implicit((Object)(object)body.skillLocator.primary) && Object.op_Implicit((Object)(object)MountedPrimary)) { bool flag2 = IsMounted(body); if (flag2 && !overridden) { body.skillLocator.primary.SetSkillOverride((object)this, MountedPrimary, (SkillOverridePriority)4); overridden = true; } else if (!flag2 && overridden) { body.skillLocator.primary.UnsetSkillOverride((object)this, MountedPrimary, (SkillOverridePriority)4); overridden = false; } } if (!((Object)(object)horse == (Object)null)) { CharacterMotor characterMotor = body.characterMotor; if (Object.op_Implicit((Object)(object)characterMotor)) { Vector3 val = new Vector3(characterMotor.velocity.x, 0f, characterMotor.velocity.z); _ = ((Vector3)(ref val)).magnitude; } HoofCues(); if (Time.time >= nextVoice) { nextVoice = Time.time + Random.Range(5f, 10f); ArchaonSfx.Play((Random.value < 0.75f) ? "HorseSnort" : "HorseWhinny", ((Component)this).gameObject); } } } private void HoofCues() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 if ((Object)(object)horseAnim == (Object)null) { return; } AnimationState val = null; foreach (AnimationState item in horseAnim) { AnimationState val2 = item; if (horseAnim.IsPlaying(val2.name) && (int)val2.wrapMode == 2 && ((TrackedReference)(object)val == (TrackedReference)null || val2.weight > val.weight)) { val = val2; } } if ((TrackedReference)(object)val == (TrackedReference)null || val.length <= 0f) { cueClip = null; return; } float num = Mathf.Repeat(val.time, val.length); if (val.name != cueClip) { cueClip = val.name; cueTime = num; return; } foreach (ArchaonSfx.Cue item2 in ArchaonSfx.Cues(val.name)) { if (item2.key != "HorseStep") { continue; } bool num2; if (!(num >= cueTime)) { if (item2.t > cueTime) { goto IL_0150; } num2 = item2.t <= num; } else { if (!(item2.t > cueTime)) { continue; } num2 = item2.t <= num; } if (!num2) { continue; } goto IL_0150; IL_0150: ArchaonSfx.Play("HorseStep", ((Component)this).gameObject); } cueTime = num; } private void LateUpdate() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)horse != (Object)null && (Object)(object)rig != (Object)null && (Object)(object)horseRoot != (Object)null) { rig.position = horseRoot.position; } } private void FixedUpdate() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Invalid comparison between Unknown and I4 //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_0164: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)horse == (Object)null || !NetworkServer.active || Time.fixedTime < nextTrample) { return; } nextTrample = Time.fixedTime + 0.15f; CharacterMotor characterMotor = body.characterMotor; if ((Object)(object)characterMotor == (Object)null) { return; } Vector3 velocity = characterMotor.velocity; velocity.y = 0f; if (((Vector3)(ref velocity)).magnitude < 6f) { return; } float value = ArchaonConfig.ModelScale.Value; Vector3 center = body.footPosition + ((Vector3)(ref velocity)).normalized * (1.2f * value) + Vector3.up * (1f * value); foreach (HealthComponent item in ArchaonSpellZone.Enemies(body, center, 1.6f * value)) { CharacterBody val = item.body; if (!val.isBoss && !val.isChampion && (int)val.hullClassification != 2 && (!trampled.TryGetValue(item, out var value2) || !(Time.fixedTime < value2))) { trampled[item] = Time.fixedTime + 0.8f; Vector3 val2 = Vector3.Cross(Vector3.up, ((Vector3)(ref velocity)).normalized) * Mathf.Sign(Vector3.Dot(val.corePosition - body.corePosition, Vector3.Cross(Vector3.up, ((Vector3)(ref velocity)).normalized)) + 0.001f); Vector3 force = (((Vector3)(ref velocity)).normalized * 0.6f + val2 * 0.8f + Vector3.up * 0.5f) * 2500f; ArchaonSpellZone.Hit(body, item, 1f, DamageTypeCombo.op_Implicit((DamageType)0), force); ArchaonSfx.PlayAt("GroundImpact", val.corePosition, 3f); } } } private void Mount() { //IL_009e: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)HorsePrefab == (Object)null) && !((Object)(object)driver == (Object)null) && !((Object)(object)driver.Model == (Object)null)) { Transform model = driver.Model; rig = model.Find("Archaon_Rig") ?? ((model.childCount > 0) ? model.GetChild(0) : null); if ((Object)(object)rig != (Object)null) { rigRest = rig.localPosition; } horse = Object.Instantiate<GameObject>(HorsePrefab, model); horse.transform.localPosition = Vector3.zero; horse.transform.localRotation = Quaternion.identity; horse.transform.localScale = Vector3.one; horseAnim = horse.GetComponent<Animation>(); horseRoot = FindDeep(horse.transform, "spine_1"); SkinnedMeshRenderer[] componentsInChildren = horse.GetComponentsInChildren<SkinnedMeshRenderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].updateWhenOffscreen = true; } float x = model.lossyScale.x; ArchaonVfx.Spawn("wh2_dlc09_entity_melee_impact_shockwave_mud", body.footPosition, ((Component)this).transform.rotation, 0.6f); ArchaonVfx.Spawn("wh_main_death_aura_casting_short", body.footPosition, ((Component)this).transform.rotation, x * 0.9f); ArchaonSfx.Play("HorseWhinny", ((Component)this).gameObject); nextVoice = Time.time + 8f; driver.Release(); } } private void Dismount(bool fx) { //IL_00a0: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)horse == (Object)null)) { if (fx && Object.op_Implicit((Object)(object)body)) { ArchaonVfx.Spawn("wh2_dlc09_entity_melee_impact_shockwave_mud", body.footPosition, ((Component)this).transform.rotation, 0.6f); ArchaonVfx.Spawn("wh_main_death_aura_casting_short", body.footPosition, ((Component)this).transform.rotation, 1.8f); } Object.Destroy((Object)(object)horse); horse = null; horseAnim = null; horseRoot = null; if ((Object)(object)rig != (Object)null) { rig.localPosition = rigRest; } if ((Object)(object)driver != (Object)null) { driver.Release(); } } } private static Transform FindDeep(Transform t, string n) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (((Object)t).name == n) { return t; } foreach (Transform item in t) { Transform val = FindDeep(item, n); if ((Object)(object)val != (Object)null) { return val; } } return null; } } public class MountedStrike : ArchaonActionState, IStepSetter { private int step; private static readonly string[] Anims = new string[2] { "hu1c_hr_archaon_rider_attack_01", "hu1c_hr_archaon_rider_attack_03" }; private static readonly float[] Starts = new float[2] { 0.45f, 0.7f }; private static readonly float[] Ends = new float[2] { 1.45f, 1.75f }; protected override string Anim => Anims[step]; protected override float SegStart => Starts[step]; protected override float SegEnd => Ends[step]; protected override float BaseSpeed => 1.1f; protected override float DamageCoefficient { get { if (step != 1) { return 1.8f; } return 2.4f; } } protected override float ExitFraction => 0.7f; protected override bool RootDuringAction => false; public void SetStep(int i) { step = i; } public override void OnSerialize(NetworkWriter w) { ((BaseSkillState)this).OnSerialize(w); w.Write((byte)step); } public override void OnDeserialize(NetworkReader r) { ((BaseSkillState)this).OnDeserialize(r); step = r.ReadByte(); } } internal static class ArchaonBuffs { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__Stats; } internal static BuffDef Ruin; internal static BuffDef Uzhul; internal static BuffDef Crown; internal static BuffDef Intimidated; internal static BuffDef FlamingSword; internal static BuffDef Magic; internal static BuffDef Lead; internal static BuffDef Dorghar; internal static BuffDef ParryBonus; internal static BuffDef UzhulMeter; internal static BuffDef ParryCount; internal static void Init() { //IL_0040: 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_008c: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown Sprite icon = icon4("RoR2/Base/WarCryOnMultiKill/bdWarCryBuff.asset"); Sprite val = icon4("RoR2/Base/Common/bdArmorBoost.asset"); Sprite icon2 = icon4("RoR2/Base/Common/bdSlow50.asset"); Sprite icon3 = icon4("RoR2/Base/Common/bdOnFire.asset"); Ruin = Make("ArchaonRuin", new Color(0.8f, 0.15f, 0.1f), stack: true, debuff: false, icon); Uzhul = Make("ArchaonUzhul", new Color(1f, 0.35f, 0.05f), stack: false, debuff: false, icon); Crown = Make("ArchaonCrown", new Color(0.9f, 0.75f, 0.3f), stack: false, debuff: false, val); Intimidated = Make("ArchaonIntimidated", new Color(0.4f, 0.1f, 0.1f), stack: false, debuff: true, icon2); FlamingSword = Make("ArchaonFlamingSword", new Color(1f, 0.5f, 0.1f), stack: false, debuff: false, icon3); Sprite val2 = Icons.Get("Magic"); Magic = Make("ArchaonMagicalAttacks", (Color)(((Object)(object)val2 != (Object)null) ? Color.white : new Color(0.25f, 0.9f, 0.85f)), stack: false, debuff: false, val2 ?? val); Lead = Make("ArchaonTransmutationOfLead", new Color(0.55f, 0.55f, 0.6f), stack: false, debuff: true, icon2); Dorghar = Make("ArchaonDorghar", new Color(0.3f, 0.3f, 0.3f), stack: false, debuff: false, icon); ParryBonus = Make("ArchaonParryBonus", new Color(1f, 0.9f, 0.4f), stack: false, debuff: false, val); UzhulMeter = Make("ArchaonUzhulMeter", Color.white, stack: true, debuff: false, icon); UzhulMeter.isHidden = true; ParryCount = Make("ArchaonParryCount", Color.white, stack: true, debuff: false, val); ParryCount.isHidden = true; object obj = <>O.<0>__Stats; if (obj == null) { StatHookEventHandler val3 = Stats; <>O.<0>__Stats = val3; obj = (object)val3; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; static Sprite icon4(string addr) { //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) try { return Addressables.LoadAssetAsync<BuffDef>((object)addr).WaitForCompletion()?.iconSprite; } catch { return null; } } } private static BuffDef Make(string name, Color c, bool stack, bool debuff, Sprite icon) { //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) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = name; val.buffColor = c; val.canStack = stack; val.isDebuff = debuff; val.iconSprite = icon; Content.Buffs.Add(val); return val; } private static void Stats(CharacterBody body, StatHookEventArgs a) { int buffCount = body.GetBuffCount(Ruin); if (buffCount > 0) { a.attackSpeedMultAdd += 0.025f * (float)buffCount; a.moveSpeedMultAdd += 0.012f * (float)buffCount; } if (body.HasBuff(Uzhul)) { a.damageMultAdd += 0.5f; a.armorAdd += 60f; a.attackSpeedMultAdd += 0.15f; } if (body.HasBuff(Crown)) { a.armorAdd += 20f; } if (body.HasBuff(Intimidated)) { a.moveSpeedReductionMultAdd += 0.2f; a.damageMultAdd -= 0.1f; } if (Object.op_Implicit((Object)(object)((Component)body).GetComponent<ArchaonPassive>())) { a.baseShieldAdd += 0.3f * (body.baseMaxHealth + body.levelMaxHealth * (body.level - 1f)); } if (body.HasBuff(FlamingSword)) { a.damageMultAdd += 0.3f; a.attackSpeedMultAdd += 0.15f; } if (body.HasBuff(Lead)) { bool isBoss = body.isBoss; a.moveSpeedReductionMultAdd += (isBoss ? 0.25f : 0.6f); a.attackSpeedReductionMultAdd += (isBoss ? 0.15f : 0.35f); a.armorAdd -= (isBoss ? 15f : 30f); } if (body.HasBuff(Dorghar)) { a.moveSpeedMultAdd += 1.5f; a.jumpPowerMultAdd += 0.3f; } } } internal sealed class ArchaonPassive : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_UpdateSingleTemporaryVisualEffect_refTemporaryVisualEffect_GameObject_float_bool_string <>9__31_0; public static hook_TakeDamageProcess <>9__31_1; internal void <Hooks>b__31_0(orig_UpdateSingleTemporaryVisualEffect_refTemporaryVisualEffect_GameObject_float_bool_string orig, CharacterBody self, ref TemporaryVisualEffect effect, GameObject prefab, float radius, bool active, string child) { if (all.ContainsKey(self)) { radius *= Mathf.Max(1f, Height / Mathf.Max(0.5f, self.bestFitRadius)); } orig.Invoke(self, ref effect, prefab, radius, active, child); } internal void <Hooks>b__31_1(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo info) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) ArchaonPassive archaonPassive = Of(self.body); if ((Object)(object)archaonPassive != (Object)null && info.damage > 0f && !info.rejected) { if (Time.time < archaonPassive.parryUntil && (Object)(object)info.attacker != (Object)null) { info.rejected = true; archaonPassive.parryUntil = 0f; self.body.AddTimedBuff(ArchaonBuffs.ParryBonus, 6f); self.body.SetBuffCount(ArchaonBuffs.ParryCount.buffIndex, self.body.GetBuffCount(ArchaonBuffs.ParryCount) % 99 + 1); Reflect(self.body, info); } else { archaonPassive.lastHurt = Time.time; } } orig.Invoke(self, info); } } private CharacterBody body; internal float lastHurt; internal float lastHit; internal float uzhulMeter; internal float uzhulUntil; internal float parryUntil; private float tick; private CAVfxInstance uzhulVfx; private static readonly Dictionary<CharacterBody, ArchaonPassive> all = new Dictionary<CharacterBody, ArchaonPassive>(); private bool wasUzhul; private int lastParryCount; private const float ReflectCoefficient = 4f; private static float Height => 2.3f * ArchaonConfig.ModelScale.Value; private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } private void OnEnable() { if (Object.op_Implicit((Object)(object)body)) { all[body] = this; } } private void OnDisable() { if (Object.op_Implicit((Object)(object)body)) { all.Remove(body); } if (Object.op_Implicit((Object)(object)uzhulVfx)) { uzhulVfx.Kill(); } } internal static ArchaonPassive Of(CharacterBody b) { if (!((Object)(object)b != (Object)null) || !all.TryGetValue(b, out var value)) { return null; } return value; } internal static bool UzhulActive(CharacterBody b) { if ((Object)(object)b != (Object)null) { return b.HasBuff(ArchaonBuffs.Uzhul); } return false; } internal static float SpeedBonus(CharacterBody b) { return 1f; } internal static float DamageMultiplier(CharacterBody b) { return 1f; } internal static float UzhulFraction(CharacterBody b) { ArchaonPassive archaonPassive = Of(b); if (!((Object)(object)archaonPassive == (Object)null)) { if (!UzhulActive(b)) { return (float)b.GetBuffCount(ArchaonBuffs.UzhulMeter) / 100f; } return Mathf.Clamp01((archaonPassive.uzhulUntil - Time.time) / ArchaonConfig.UzhulDuration.Value); } return 0f; } internal static void OpenParry(CharacterBody b, float seconds) { ArchaonPassive archaonPassive = Of(b); if (Object.op_Implicit((Object)(object)archaonPassive)) { archaonPassive.parryUntil = Time.time + seconds; } } internal static bool ParryOpen(CharacterBody b) { ArchaonPassive archaonPassive = Of(b); if (Object.op_Implicit((Object)(object)archaonPassive)) { return Time.time < archaonPassive.parryUntil; } return false; } internal static bool ConsumeParryBonus(CharacterBody b) { if ((Object)(object)b == (Object)null || !b.HasBuff(ArchaonBuffs.ParryBonus)) { return false; } if (NetworkServer.active) { b.RemoveBuff(ArchaonBuffs.ParryBonus); } return true; } internal static void OnArchaonHit(CharacterBody b, HealthComponent victim) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) ArchaonPassive archaonPassive = Of(b); if ((Object)(object)archaonPassive == (Object)null) { return; } archaonPassive.lastHit = Time.time; bool flag = (Object)(object)victim != (Object)null && (Object)(object)victim.body != (Object)null && (victim.body.isElite || victim.body.isBoss); if (NetworkServer.active && b.GetBuffCount(ArchaonBuffs.Ruin) < 20) { b.AddBuff(ArchaonBuffs.Ruin); if (flag && b.GetBuffCount(ArchaonBuffs.Ruin) < 20) { b.AddBuff(ArchaonBuffs.Ruin); } } if (NetworkServer.active && !UzhulActive(b)) { archaonPassive.uzhulMeter += ArchaonConfig.UzhulCharge.Value * (flag ? 2f : 1f); if (archaonPassive.uzhulMeter >= 100f) { archaonPassive.uzhulMeter = 0f; b.AddTimedBuff(ArchaonBuffs.Uzhul, ArchaonConfig.UzhulDuration.Value); } b.SetBuffCount(ArchaonBuffs.UzhulMeter.buffIndex, Mathf.Clamp(Mathf.RoundToInt(archaonPassive.uzhulMeter), 0, 100)); } } private void Update() { if (Object.op_Implicit((Object)(object)body)) { bool flag = UzhulActive(body); if (flag && !wasUzhul) { OnUnleash(); } wasUzhul = flag; int buffCount = body.GetBuffCount(ArchaonBuffs.ParryCount); if (buffCount != lastParryCount && buffCount > 0) { OnParried(); } lastParryCount = buffCount; } } private void OnParried() { //IL_0010: 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_002b: 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_005e: 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) EffectManager.SimpleEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/Bandit2ResetEffect"), body.corePosition, Quaternion.identity, false); ArchaonVfx.Spawn("wh3_dlc20_entity_archaon_sword_absorb_energy", body.corePosition, ((Component)this).transform.rotation, 0.4f); ArchaonVoice.Say(body, Voice.Parry); ArchaonSfx.PlayAt("ShieldImpact", body.corePosition, 4f); ArchaonSfx.PlayAt("ShieldHit", body.corePosition, 4f); SkillLocator skillLocator = body.skillLocator; if (body.hasEffectiveAuthority && Object.op_Implicit((Object)(object)skillLocator) && Object.op_Implicit((Object)(object)skillLocator.utility) && (Object)(object)skillLocator.utility.skillDef == (Object)(object)ArchaonSkills.Parry) { skillLocator.utility.Reset(); } } private void OnUnleash() { //IL_012b: 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_0150: 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_0068: 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_00fe: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) uzhulUntil = Time.time + ArchaonConfig.UzhulDuration.Value; ArchaonAnimationDriver component = ((Component)this).GetComponent<ArchaonAnimationDriver>(); Transform val = (((Object)(object)component != (Object)null) ? ArchaonVfx.FindDeep(component.Model, "be_prop_1") : null); if ((Object)(object)val != (Object)null && (Object)(object)ArchaonVfx.Library != (Object)null) { uzhulVfx = CAVfxInstance.Spawn(ArchaonVfx.Library, "wh3_dlc23_flaming_sword_of_rhuin_blade_fire", val.position, val.rotation, 0.9f * val.lossyScale.x, val); if (Object.op_Implicit((Object)(object)uzhulVfx)) { ((Component)uzhulVfx).transform.localPosition = new Vector3(0.6f, 0f, 0f); ((Component)uzhulVfx).transform.localRotation = Quaternion.Euler(0f, 0f, -90f); uzhulVfx.maxLifetime = ArchaonConfig.UzhulDuration.Value; } ArchaonVfx.Spawn("wh_main_fire_aura_casting_short", ((Component)this).transform.position, ((Component)this).transform.rotation, 1.2f); } if (ArchaonConfig.CameraShake.Value) { ShakeEmitter.CreateSimpleShakeEmitter(((Component)this).transform.position, new Wave { amplitude = 4f, frequency = 20f }, 0.6f, 30f, true); } if (body.hasEffectiveAuthority) { Chat.AddMessage("<color=#ff5a1a>Unleash U'zhul!</color>"); } ArchaonVoice.Say(body, Voice.Uzhul); ArchaonSfx.Play("Morkar", ((Component)this).gameObject); } private void FixedUpdate() { //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent) || !body.healthComponent.alive) { return; } tick += Time.fixedDeltaTime; if (tick < 0.5f) { return; } tick = 0f; if (!NetworkServer.active) { return; } HealthComponent healthComponent = body.healthComponent; if (Time.time - lastHurt > 3f && healthComponent.shield < body.maxShield) { healthComponent.Networkshield = Mathf.Min(body.maxShield, healthComponent.shield + body.maxShield * 0.5f * 0.5f); } if (Time.time - lastHit > 5f && body.GetBuffCount(ArchaonBuffs.Ruin) > 0) { body.RemoveBuff(ArchaonBuffs.Ruin); } TeamIndex teamIndex = body.teamComponent.teamIndex; foreach (CharacterBody readOnlyInstances in CharacterBody.readOnlyInstancesList) { if ((Object)(object)readOnlyInstances == (Object)(object)body || !Object.op_Implicit((Object)(object)readOnlyInstances.healthComponent) || !readOnlyInstances.healthComponent.alive) { continue; } Vector3 val = readOnlyInstances.corePosition - body.corePosition; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (readOnlyInstances.teamComponent.teamIndex == teamIndex) { if (sqrMagnitude < 225f) { readOnlyInstances.AddTimedBuff(ArchaonBuffs.Crown, 1.1f); } } else if (sqrMagnitude < 25f && !readOnlyInstances.isBoss) { readOnlyInstances.AddTimedBuff(ArchaonBuffs.Intimidated, 1.1f); } } body.AddTimedBuff(ArchaonBuffs.Crown, 1.1f); } private static void Reflect(CharacterBody self, DamageInfo info) { //IL_006f: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } CharacterBody val = (Object.op_Implicit((Object)(object)info.attacker) ? info.attacker.GetComponent<CharacterBody>() : null); if ((Object)(object)val == (Object)null || (Object)(object)val.healthComponent == (Object)null || !val.healthComponent.alive) { return; } ProjectileController val2 = (Object.op_Implicit((Object)(object)info.inflictor) ? info.inflictor.GetComponent<ProjectileController>() : null); if (!((Object)(object)val2 != (Object)null) && !(Vector3.Distance(val.corePosition, self.corePosition) > 8f)) { return; } GameObject val3 = (((Object)(object)val2 != (Object)null) ? ProjectileCatalog.GetProjectilePrefab(val2.catalogIndex) : null); if ((Object)(object)val3 != (Object)null) { Vector3 val4 = self.corePosition + Vector3.up * 1.5f; Vector3 val5 = val.corePosition - val4; val4 += ((Vector3)(ref val5)).normalized * 2f; ProjectileManager.instance.FireProjectile(new FireProjectileInfo { projectilePrefab = val3, position = val4, rotation = Util.QuaternionSafeLookRotation(val5), owner = ((Component)self).gameObject, target = ((Component)val).gameObject, damage = self.damage * 4f, crit = self.RollCrit(), force = 400f }); } else { GameObject val6 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerGolem"); if (Object.op_Implicit((Object)(object)val6)) { EffectManager.SpawnEffect(val6, new EffectData { origin = val.corePosition, start = self.corePosition + Vector3.up * 1.5f }, true); } DamageInfo val7 = new DamageInfo { attacker = ((Component)self).gameObject, inflictor = ((Component)self).gameObject, position = val.corePosition, damage = self.damage * 4f, crit = self.RollCrit(), procCoefficient = 1f, damageType = DamageTypeCombo.op_Implicit((DamageType)0), damageColorIndex = (DamageColorIndex)0 }; val.healthComponent.TakeDamage(val7); GlobalEventManager.instance.OnHitEnemy(val7, ((Component)val).gameObject); GlobalEventManager.instance.OnHitAll(val7, ((Component)val).gameObject); } ArchaonVfx.Spawn("wh3_dlc20_entity_archaon_sword_absorb_energy", val.corePosition, Quaternion.identity, 0.4f); Log.Info("Parry reflected " + (((Object)(object)val3 != (Object)null) ? ((Object)val3).name : "a shot") + " at " + val.GetDisplayName()); } internal static void Hooks() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown object obj = <>c.<>9__31_0; if (obj == null) { hook_UpdateSingleTemporaryVisualEffect_refTemporaryVisualEffect_GameObject_float_bool_string val = delegate(orig_UpdateSingleTemporaryVisualEffect_refTemporaryVisualEffect_GameObject_float_bool_string orig, CharacterBody self, ref TemporaryVisualEffect effect, GameObject prefab, float radius, bool active, string child) { if (all.ContainsKey(self)) { radius *= Mathf.Max(1f, Height / Mathf.Max(0.5f, self.bestFitRadius)); } orig.Invoke(self, ref effect, prefab, radius, active, child); }; <>c.<>9__31_0 = val; obj = (object)val; } CharacterBody.UpdateSingleTemporaryVisualEffect_refTemporaryVisualEffect_GameObject_float_bool_string += (hook_UpdateSingleTemporaryVisualEffect_refTemporaryVisualEffect_GameObject_float_bool_string)obj; object obj2 = <>c.<>9__31_1; if (obj2 == null) { hook_TakeDamageProcess val2 = delegate(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo info) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) ArchaonPassive archaonPassive = Of(self.body); if ((Object)(object)archaonPassive != (Object)null && info.damage > 0f && !info.rejected) { if (Time.time < archaonPassive.parryUntil && (Object)(object)info.attacker != (Object)null) { info.rejected = true; archaonPassive.parryUntil = 0f; self.body.AddTimedBuff(ArchaonBuffs.ParryBonus, 6f); self.body.SetBuffCount(ArchaonBuffs.ParryCount.buffIndex, self.body.GetBuffCount(ArchaonBuffs.ParryCount) % 99 + 1); Reflect(self.body, info); } else { archaonPassive.lastHurt = Time.time; } } orig.Invoke(self, info); }; <>c.<>9__31_1 = val2; obj2 = (object)val2; } HealthComponent.TakeDamageProcess += (hook_TakeDamageProcess)obj2; } } internal static class ArchaonNet { internal class ZoneSync : INetMessage, ISerializableObject { private int id; private Vector3 pos; private Vector3 vel; public ZoneSync() { } public ZoneSync(int id, Vector3 pos, Vector3 vel) { //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) this.id = id; this.pos = pos; this.vel = vel; } public void Serialize(NetworkWriter w) { //IL_000e: 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) w.Write(id); w.Write(pos); w.Write(vel); } public void Deserialize(NetworkReader r) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) id = r.ReadInt32(); pos = r.ReadVector3(); vel = r.ReadVector3(); } public void OnReceived() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { ArchaonSpellZone.ApplySync(id, pos, vel); } } } internal class VoiceLine : INetMessage, ISerializableObject { private NetworkInstanceId body; private int voice; public VoiceLine() { } public VoiceLine(NetworkInstanceId body, Voice voice) { //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.body = body; this.voice = (int)voice; } public void Serialize(NetworkWriter w) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) w.Write(body); w.Write(voice); } public void Deserialize(NetworkReader r) { //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) body = r.ReadNetworkId(); voice = r.ReadInt32(); } public void OnReceived() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) GameObject val = Util.FindNetworkObject(body); CharacterBody val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<CharacterBody>() : null); if (Object.op_Implicit((Object)(object)val2)) { ArchaonVoice.Say(val2, (Voice)voice); } } } internal static void Init() { NetworkingAPI.RegisterMessageType<ZoneSync>(); NetworkingAPI.RegisterMessageType<VoiceLine>(); } internal static void SayEverywhere(CharacterBody b, Voice v) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)b == (Object)null)) { if (b.hasEffectiveAuthority) { ArchaonVoice.Say(b, v); } else if (NetworkServer.active && Object.op_Implicit((Object)(object)b.networkIdentity)) { NetMessageExtensions.Send((INetMessage)(object)new VoiceLine(b.networkIdentity.netId, v), (NetworkDestination)1); } } } } internal static class Log { private static ManualLogSource source; internal static void Init(ManualLogSource s) { source = s; } internal static void Info(object d) { ManualLogSource obj = source; if (obj != null) { obj.LogInfo(d); } } internal static void Warning(object d) { ManualLogSource obj = source; if (obj != null) { obj.LogWarning(d); } } internal static void Error(object d) { ManualLogSource obj = source; if (obj != null) { obj.LogError(d); } } } internal static class ArchaonConfig { internal static ConfigEntry<KeyboardShortcut> StanceKey; internal static ConfigEntry<bool> CameraShake; internal static ConfigEntry<bool> ShowHud; internal static ConfigEntry<float> LobbyScale; internal static ConfigEntry<float> ModelScale; internal static ConfigEntry<float> EffectBrightness; internal static ConfigEntry<float> PrimarySpeed; internal static ConfigEntry<float> HeavySpeed; internal static ConfigEntry<float> RhuinCooldown; internal static ConfigEntry<float> SearingDoomCooldown; internal static ConfigEntry<float> SpiritLeechCooldown; internal static ConfigEntry<float> BurningHeadCooldown; internal static ConfigEntry<float> TransmutationCooldown; internal static ConfigEntry<float> PurpleSunCooldown; internal static ConfigEntry<float> ParryCooldown; internal static ConfigEntry<float> DorgharCooldown; internal static ConfigEntry<float> SpiritLeechMaxHp; internal static ConfigEntry<float> SpiritLeechBarrier; internal static ConfigEntry<float> UzhulDuration; internal static ConfigEntry<float> UzhulCharge; internal static void Init(ConfigFile c) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) StanceKey = c.Bind<KeyboardShortcut>("Controls", "Stance key", new KeyboardShortcut((KeyCode)102, Array.Empty<KeyCode>()), "Keyboard key that cycles the magic stances Fire > Metal > Death (gamepad: D-pad left)."); CameraShake = c.Bind<bool>("Visuals", "Camera shake", true, "Play the camera shakes authored in Archaon's Total War animations."); ShowHud = c.Bind<bool>("Visuals", "Stance HUD", true, "Show the stance / Ruin / U'zhul indicator under the crosshair."); ModelScale = c.Bind<float>("Visuals", "Model scale", 2.4f, "Archaon size (1 = his Total War size, about 2.3 m; RoR2 characters are smaller than TW units so 1.6 reads right)."); EffectBrightness = c.Bind<float>("Visuals", "Effect brightness", 0.6f, "Multiplier on the Total War effect brightness (their HDR values are tuned for TW:WH3's tonemapper)."); LobbyScale = c.Bind<float>("Visuals", "Lobby scale", 1.35f, "Archaon size on the character select screen."); PrimarySpeed = c.Bind<float>("Gameplay", "Slayer of Kings speed", 0.95f, "Playback speed of the Slayer of Kings combo (before attack speed)."); HeavySpeed = c.Bind<float>("Gameplay", "Apocalyptic Blows speed", 1.1f, "Playback speed of the Apocalyptic Blows combo (before attack speed)."); RhuinCooldown = c.Bind<float>("Spell cooldowns", "Flaming Sword of Rhuin", 44f, "Total War value: 44s"); SearingDoomCooldown = c.Bind<float>("Spell cooldowns", "Searing Doom", 30f, "Total War value: 30s"); SpiritLeechCooldown = c.Bind<float>("Spell cooldowns", "Spirit Leech", 32f, "Total War value: 32s"); BurningHeadCooldown = c.Bind<float>("Spell cooldowns", "The Burning Head", 37f, "Total War value: 37s"); TransmutationCooldown = c.Bind<float>("Spell cooldowns", "Transmutation of Lead", 28f, "Total War value: 28s"); PurpleSunCooldown = c.Bind<float>("Spell cooldowns", "Purple Sun of Xereus", 54f, "Total War value: 54s"); SpiritLeechBarrier = c.Bind<float>("Gameplay", "Spirit Leech barrier percent", 25f, "Percent of the damage drained by Spirit Leech that Archaon gains as barrier."); SpiritLeechMaxHp = c.Bind<float>("Gameplay", "Spirit Leech max HP percent per second", 2f, "Anti-boss drain: percent of the target's max health dealt every second of Spirit Leech (13s), on top of its base damage."); ParryCooldown = c.Bind<float>("Cooldowns", "Shield Parry", 5f, ""); DorgharCooldown = c.Bind<float>("Cooldowns", "Dorghar mount toggle", 2f, "Mount / dismount Dorghar"); UzhulDuration = c.Bind<float>("Gameplay", "Uzhul duration", 10f, "Seconds of Unleash U'zhul once the meter is full."); UzhulCharge = c.Bind<float>("Gameplay", "Uzhul meter per hit", 2f, "Meter gained per enemy hit (x2 on elites and bosses). The meter is 100."); } } internal static class Content { private sealed class Provider : IContentPackProvider { private readonly ContentPack pack = new ContentPack(); public string identifier => "com.abyssano78.archaonsurvivor"; public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { pack.identifier = identifier; pack.bodyPrefabs.Add(Bodies.ToArray()); pack.masterPrefabs.Add(Masters.ToArray()); pack.survivorDefs.Add(Survivors.ToArray()); pack.skillDefs.Add(Skills.ToArray()); pack.skillFamilies.Add(Families.ToArray()); pack.entityStateTypes.Add(States.ToArray()); pack.buffDefs.Add(Buffs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(pack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static CollectContentPackProvidersDelegate <>9__7_0; internal void <Register>b__7_0(AddContentPackProviderDelegate add) { add.Invoke((IContentPackProvider)(object)new Provider()); } } internal static readonly List<GameObject> Bodies = new List<GameObject>(); internal static readonly List<GameObject> Masters = new List<GameObject>(); internal static readonly List<SurvivorDef> Survivors = new List<SurvivorDef>(); internal static readonly List<SkillDef> Skills = new List<SkillDef>(); internal static readonly List<SkillFamily> Families = new List<SkillFamily>(); internal static readonly List<Type> States = new List<Type>(); internal static readonly List<BuffDef> Buffs = new List<BuffDef>(); internal static void Register() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown object obj = <>c.<>9__7_0; if (obj == null) { CollectContentPackProvidersDelegate val = delegate(AddContentPackProviderDelegate add) { add.Invoke((IContentPackProvider)(object)new Provider()); }; <>c.<>9__7_0 = val; obj = (object)val; } ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)obj; } } internal static class Icons { private static readonly Dictionary<string, Sprite> sprites = new Dictionary<string, Sprite>(); internal static void Init(AssetBundle bundle) { Sprite[] array = bundle.LoadAllAssets<Sprite>(); foreach (Sprite val in array) { if (((Object)val).name.StartsWith("ArchaonIcon_")) { sprites[((Object)val).name.Substring(12)] = val; } } Log.Info($"{sprites.Count} icons"); } internal static Sprite Get(string id) { if (!sprites.TryGetValue(id, out var value)) { return null; } return value; } internal static void LoadPng(string dir, string id) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(dir, "ArchaonIcon_" + id + ".png"); if (!File.Exists(text)) { Log.Warning("icon file missing: " + text); return; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (ImageConversion.LoadImage(val, File.ReadAllBytes(text))) { ((Texture)val).wrapMode = (TextureWrapMode)1; sprites[id] = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); } } } internal static class ArchaonSkills { internal static SkillDef[] Secondary = (SkillDef[])(object)new SkillDef[3]; internal static SkillDef[] Special = (SkillDef[])(object)new SkillDef[3]; internal static SkillDef Parry; internal static bool Initialize(GameObject bodyPrefab) { //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) SkillLocator component = bodyPrefab.GetComponent<SkillLocator>(); Type[] array = new Type[11] { typeof(SlayerOfKings), typeof(ApocalypticBlows), typeof(ShieldParry), typeof(DorgharMount), typeof(MountedStrike), typeof(FlamingSwordOfRhuin), typeof(BurningHead), typeof(SearingDoom), typeof(TransmutationOfLead), typeof(SpiritLeech), typeof(PurpleSun) }; foreach (Type item in array) { Content.States.Add(item); } SkillDef val = Stepped("SlayerOfKings", typeof(SlayerOfKings), 3, "Slayer of Kings", "Swing Slayer of Kings in a three-hit combo: <style=cIsDamage>240%</style>, <style=cIsDamage>240%</style>, finisher <style=cIsDamage>420%</style>. Builds <style=cIsUtility>Ruin</style>."); SkillDef val2 = Stepped("ApocalypticBlows", typeof(ApocalypticBlows), 3, "Apocalyptic Blows", "Slow, heavy strikes: <style=cIsDamage>600%</style>, <style=cIsDamage>2x350% + 700%</style>, then drive the sword into the ground for <style=cIsDamage>1600%</style> around you and <style=cIsUtility>stun</style>."); Family(component.primary, "Primary", val, val2); ArchaonMount.MountedPrimary = Stepped("MountedStrike", typeof(MountedStrike), 2, "Rider's Strikes", "On Dorghar: two sweeping strikes from the saddle, <style=cIsDamage>180%</style> and <style=cIsDamage>240%</style>."); ArchaonMount.MountedPrimary.icon = val.icon; Secondary[0] = Make("FlamingSwordOfRhuin", typeof(FlamingSwordOfRhuin), ArchaonConfig.RhuinCooldown.Value, "FIRE: Flaming Sword of Rhuin", "A giant burning sword stabs the ground ahead for <style=cIsDamage>400% damage</style> and <style=cIsDamage>ignites</style>, then Slayer of Kings is ablaze for 28s: <style=cIsDamage>+30% damage</style>, <style=cIsDamage>+15% attack speed</style>, your hits are <style=cIsDamage>flaming</style> (ignite) and <style=cIsDamage>magical</style> (ignore armor)."); Secondary[1] = Make("SearingDoom", typeof(SearingDoom), ArchaonConfig.SearingDoomCooldown.Value, "METAL: Searing Doom", "Up to 200m away, a storm of burning metal shards falls on a 16m area for 9s: <style=cIsDamage>75 shards of 100%</style>."); Secondary[2] = Make("SpiritLeech", typeof(SpiritLeech), ArchaonConfig.SpiritLeechCooldown.Value, "DEATH: Spirit Leech", "Usirian's hand seizes the targeted enemy (up to 300m) and drains it for 13s: every second <style=cIsDamage>80% + 2% of its max health</style> (base damage <style=cIsDamage>x1.5 against elites and bosses</style>). <style=cIsHealing>25% of the damage drained</style> becomes barrier."); Special[0] = Make("BurningHead", typeof(BurningHead), ArchaonConfig.BurningHeadCooldown.Value, "FIRE: The Burning Head", "Up to 150m away, a giant laughing skull of fire (7m radius) rolls forward for 20s, burning everything it touches: <style=cIsDamage>200% per tick</style>, <style=cIsDamage>ignite</style>."); Special[1] = Make("TransmutationOfLead", typeof(TransmutationOfLead), ArchaonConfig.TransmutationCooldown.Value, "METAL: Transmutation of Lead", "Up to 200m away, curse every enemy in a huge area (30m) for 50s: <style=cIsUtility>-60% movement speed, -35% attack speed, -30 armor</style> (weaker on bosses)."); Special[2] = Make("PurpleSun", typeof(PurpleSun), ArchaonConfig.PurpleSunCooldown.Value, "DEATH: Purple Sun of Xereus", "The ultimate death spell: up to 150m away, a sphere of death (12m radius) drifts forward for 22s and <style=cIsDamage>obliterates everything</style> beneath it, flyers included (<style=cIsDamage>800%/s</style>, half against bosses). <style=cIsUtility>Drags small enemies in</style>."); Family(component.secondary, "Secondary", Secondary[0]); Family(component.special, "Special", Special[0]); SkillDef val3 = (Parry = Make("ShieldParry", typeof(ShieldParry), ArchaonConfig.ParryCooldown.Value, "Shield Parry", "Raise the shield. A hit taken in the parry window is <style=cIsUtility>negated</style>, the parry is <style=cIsUtility>ready again</style>, ranged attacks are <style=cIsDamage>sent back for 400%</style>, and your next primary hit deals <style=cIsDamage>double damage</style>.")); val3.interruptPriority = (InterruptPriority)2; SkillDef val4 = Make("Dorghar", typeof(DorgharMount), ArchaonConfig.DorgharCooldown.Value, "Dorghar", "Mount or dismount Dorghar, Steed of the Apocalypse. Mounted: <style=cIsUtility>+150% movement speed</style>, <style=cIsUtility>+30% jump</style>, <style=cIsDamage>trample</style> small enemies, but your strikes are <style=cIsDamage>weaker</style> and you cannot parry."); Family(component.utility, "Utility", val3, val4); component.passiveSkill = new PassiveSkill { enabled = true, skillNameToken = "ARCHAON_PASSIVE_NAME", skillDescriptionToken = "ARCHAON_PASSIVE_DESCRIPTION", icon = Icons.Get("Passive") }; LanguageAPI.Add("ARCHAON_PASSIVE_NAME", "The Everchosen"); LanguageAPI.Add("ARCHAON_PASSIVE_DESCRIPTION", "<style=cIsHealing>Eye of Sheerian</style>: a shield of 30% max health that recharges after 3s without damage. <style=cIsUtility>Crown of Domination</style>: allies nearby gain armor; weak enemies close to you are slowed and deal 10% less damage. <style=cIsDamage>Ruin</style>: hits stack attack and movement speed. Hits fill the <style=cIsDamage>U'zhul</style> meter: when full, <style=cIsDamage>Unleash U'zhul</style> (+50% damage, wider strikes, armor). <style=cIsUtility>D-pad left</style> (or <style=cIsUtility>" + ((object)ArchaonConfig.StanceKey.Value/*cast due to .constrained prefix*/).ToString() + "</style>) cycles the magic stances FIRE > METAL > DEATH."); bodyPrefab.AddComponent<ArchaonStanceController>(); return true; } private static T Init<T>(T s, string id, Type state, float cd, string name, string desc) where T : SkillDef { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) ((Object)(object)s).name = "Archaon" + id; ((SkillDef)s).skillName = "Archaon" + id; ((SkillDef)s).skillNameToken = "ARCHAON_" + id.ToUpperInvariant() + "_NAME"; ((SkillDef)s).skillDescriptionToken = "ARCHAON_" + id.ToUpperInvariant() + "_DESCRIPTION"; ((SkillDef)s).icon = Icons.Get(id); ((SkillDef)s).activationState = new SerializableEntityStateType(state); ((SkillDef)s).activationStateMachineName = "Weapon"; ((SkillDef)s).interruptPriority = (InterruptPriority)1; ((SkillDef)s).baseRechargeInterval = cd; ((SkillDef)s).baseMaxStock = 1; ((SkillDef)s).rechargeStock = 1; ((SkillDef)s).requiredStock = 1; ((SkillDef)s).stockToConsume = 1; ((SkillDef)s).isCombatSkill = true; ((SkillDef)s).mustKeyPress = false; ((SkillDef)s).cancelSprintingOnActivation = true; ((SkillDef)s).canceledFromSprinting = false; ((SkillDef)s).beginSkillCooldownOnSkillEnd = false; ((SkillDef)s).fullRestockOnAssign = true; LanguageAPI.Add(((SkillDef)s).skillNameToken, name); LanguageAPI.Add(((SkillDef)s).skillDescriptionToken, desc); Content.Skills.Add((SkillDef)(object)s); return s; } private static SkillDef Make(string id, Type state, float cd, string name, string desc) { SkillDef obj = Init<SkillDef>(ScriptableObject.CreateInstance<SkillDef>(), id, state, cd, name, desc); obj.mustKeyPress = true; return obj; } private static SkillDef Stepped(string id, Type state, int steps, string name, string desc) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) SteppedSkillDef obj = Init<SteppedSkillDef>(ScriptableObject.CreateInstance<SteppedSkillDef>(), id, state, 0f, name, desc); obj.stepCount = steps; obj.stepGraceDuration = 0.6f; ((SkillDef)obj).interruptPriority = (InterruptPriority)0; ((SkillDef)obj).cancelSprintingOnActivation = true; return (SkillDef)(object)obj; } private static void Family(GenericSkill slot, string slotName, params SkillDef[] skills) { SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val).name = "Archaon" + slotName + "Family"; val.variants = Array.ConvertAll(skills, delegate(SkillDef s) { //IL_0002: 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_0024: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) Variant result = new Variant { skillDef = s }; ((Variant)(ref result)).viewableNode = new Node(s.skillNameToken, false, (Node)null); return result; }); slot._skillFamily = val; Content.Families.Add(val); } } public class DorgharMount : BaseSkillState { public override void OnEnter() { ((BaseState)this).OnEnter(); bool flag = ((EntityState)this).characterBody.HasBuff(ArchaonBuffs.Dorghar); if (NetworkServer.active) { if (flag) { ((EntityState)this).characterBody.RemoveBuff(ArchaonBuffs.Dorghar); } else { ((EntityState)this).characterBody.AddBuff(ArchaonBuffs.Dorghar); } } if (!flag) { ArchaonVoice.Say(((EntityState)this).characterBody, Voice.Dorghar); } } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge > 0.2f) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } internal sealed class ArchaonStanceController : MonoBehaviour { private CharacterBody body; private SkillLocator loc; internal Lore lore; private static readonly Dictionary<CharacterBody, ArchaonStanceController> all = new Dictionary<CharacterBody, ArchaonStanceController>(); internal static Lore Of(CharacterBody b) { if (!((Object)(object)b != (Object)null) || !all.TryGetValue(b, out var value)) { return Lore.Fire; } return value.lore; } private void Start() { body = ((Component)this).GetComponent<CharacterBody>(); loc = ((Component)this).GetComponent<SkillLocator>(); if (Object.op_Implicit((Object)(object)body)) { all[body] = this; } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)body)) { all.Remove(body); } } private void Update() { if (Object.op_Implicit((Object)(object)body) && body.hasEffectiveAuthority && Object.op_Implicit((Object)(object)loc) && Pressed()) { Cycle(); } } private static bool Pressed() { //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) KeyboardShortcut value = ArchaonConfig.StanceKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { return true; } if (!ReInput.isReady) { return false; } Player player = ReInput.players.GetPlayer(0); if (player == null) { return false; } foreach (Joystick joystick in player.controllers.Joysticks) { IGamepadTemplate template = ((Controller)joystick).GetTemplate<IGamepadTemplate>(); if (template != null && template.dPad.left.justPressed) { return true; } } return false; } private void Cycle() { //IL_008e: 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_00c0: Unknown result type (might be due to invalid IL or missing references) int old = (int)lore; lore = (Lore)((int)(lore + 1) % 3); Swap(loc.secondary, ArchaonSkills.Secondary, old); Swap(loc.special, ArchaonSkills.Special, old); string text = lore.ToString().ToUpperInvariant(); ArchaonAnimationDriver component = ((Component)this).GetComponent<ArchaonAnimationDriver>(); ArchaonVfx.Spawn("wh_main_" + lore.ToString().ToLowerInvariant() + "_aura_casting_short", body.footPosition, ((Component)this).transform.rotation, (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.Model)) ? (component.Model.lossyScale.x * 0.8f) : 0.8f); Log.Info("Archaon stance: " + text); ArchaonVoice.Say(body, Voice.Stance); } private void Swap(GenericSkill slot, SkillDef[] defs, int old) { if (old != 0) { slot.UnsetSkillOverride((object)this, defs[old], (SkillOverridePriority)4); } if (lore != Lore.Fire) { float rechargeStopwatch = slot.rechargeStopwatch; int stock = slot.stock; slot.SetSkillOverride((object)this, defs[(int)lore], (SkillOverridePriority)4); slot.stock = stock; slot.rechargeStopwatch = rechargeStopwatch; } } } internal sealed class ArchaonHud : MonoBehaviour { private CharacterBody body; private GUIStyle style; private void Start() { body = ((Component)this).GetComponent<CharacterBody>(); } private void OnGUI() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_018e: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) if (ArchaonConfig.ShowHud.Value && !((Object)(object)body == (Object)null) && body.hasEffectiveAuthority && Object.op_Implicit((Object)(object)body.healthComponent) && body.healthComponent.alive) { if (style == null) { style = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = Mathf.RoundToInt((float)Screen.height / 50f), fontStyle = (FontStyle)1, richText = true }; } Lore lore = ArchaonStanceController.Of(body); string text = lore switch { Lore.Metal => "#d8d0b0", Lore.Fire => "#ff7a2a", _ => "#b06cff", }; int buffCount = body.GetBuffCount(ArchaonBuffs.Ruin); float num = ArchaonPassive.UzhulFra
plugins\ArchaonSurvivor\CAVfx.Runtime.dll
Decompiled 11 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; [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("CAVfx.Runtime")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CAVfx.Runtime")] [assembly: AssemblyTitle("CAVfx.Runtime")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CAVfx { public enum CAView { Alpha, Distortion, Decal, DecalEmissive, Light } public sealed class CAEmitterRuntime { public readonly CAEmitterDef def; public float lifeMin; public float lifeMax; public float startMin; public float startMax; public bool infinite; public int maxParticles; public bool hasBurst; public float burstIntervalMin; public float burstIntervalMax; public float burstLenMin; public float burstLenMax; public CACurveDef rate; public CACurveDef pLife; public CACurveDef initSpeed; public CACurveDef initScale; public CACurveDef initAlpha; public CACurveDef scale; public CACurveDef decel; public CACurveDef forceA; public CACurveDef forceB; public CACurveDef forceC; public CACurveDef emitterPos; public CACurveDef emitterOrient; public CACurveDef spawnArea; public CACurveDef spawnBox; public CACurveDef spinDecel; public CACurveDef vfStrength; public CACurveDef vfSize; public CACurveDef vfTightness; public CACurveDef vfPos; public CACurveDef vfOrient; public int spawnInner = -1; public int spawnOuter = -1; public bool hasSpawnAngle; public Vector2 spawnAngle; public bool hasSpawnSpread; public Vector2 spawnSpread; public bool hasSpawnArc; public Vector2 spawnArc; public bool hasSpreadArc; public Vector2 spreadArc; public Vector3 orientMin; public Vector3 orientMax; public Vector3 spinMin; public Vector3 spinMax; public Vector3 spinDir; public int simSpace; public bool spawnOnTerrain; public bool followTerrain; public bool skipPosUpdate; public bool eventsEnabled; public float mass = 100f; public CAView view; public int translation = -1; public int velMode = -1; public Vector2 pivot = new Vector2(0.5f, 0.5f); public CACurveDef stretch; public float stretchCap = 1000f; public bool trailMode; public int diffuse = -1; public int normal = -1; public bool premul = true; public bool overlay; public Vector2 atlasScale = Vector2.one; public Vector2 atlasOffset = Vector2.zero; public bool hasCell; public int cellNx = 1; public int cellNy = 1; public int cell; public bool cellRandom; public bool hasAnim; public int animNx = 1; public int animNy = 1; public bool animBlend; public bool animRandom; public bool animLoop; public bool rowRestricted; public bool randomizeRow; public float loopsStart = 1f; public float loopsEnd = 1f; public int rowRestriction; public int timeMode; public bool hasFlip; public float flipU; public float flipV; public int uvOrientation; public CACurveDef alpha; public Vector2 alphaStartOff; public Vector2 alphaEndOff; public CACurveDef colour; public int cR; public int cG; public int cB; public int cBright = -1; public bool hasSoft; public float softFactor = 1.5f; public float softScaleStrength = 1f; public bool hasLighting; public float additiveMul = 1f; public float lightEmissive; public float emissiveMul = 1f; public CACurveDef alphaCrush; public bool crushSharp; public bool renderable; public CAEmitterRuntime(CAEmitterDef d) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_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_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_053b: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_05c3: Unknown result type (might be due to invalid IL or missing references) //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_0773: Unknown result type (might be due to invalid IL or missing references) //IL_0816: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0989: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) //IL_09a6: Unknown result type (might be due to invalid IL or missing references) //IL_09ab: Unknown result type (might be due to invalid IL or missing references) //IL_09b0: Unknown result type (might be due to invalid IL or missing references) //IL_0c4a: Unknown result type (might be due to invalid IL or missing references) //IL_0c4f: Unknown result type (might be due to invalid IL or missing references) //IL_0c75: Unknown result type (might be due to invalid IL or missing references) //IL_0c7a: Unknown result type (might be due to invalid IL or missing references) def = d; lifeMin = d.F("LifeTime.min", 1f); lifeMax = d.F("LifeTime.max", lifeMin); startMin = d.F("StartTime.min"); startMax = d.F("StartTime.max", startMin); infinite = d.F("InfiniteLife") > 0.5f; maxParticles = (d.HasF("MaximumParticles") ? Mathf.Max(1, (int)d.F("MaximumParticles")) : 4000); hasBurst = d.HasF("BurstInterval.min"); burstIntervalMin = d.F("BurstInterval.min"); burstIntervalMax = d.F("BurstInterval.max", burstIntervalMin); burstLenMin = d.F("BurstIntervalLength.min"); burstLenMax = d.F("BurstIntervalLength.max", burstLenMin); rate = d.C("EmissionRateCurve"); pLife = d.C("ParticleLifeTime"); initSpeed = d.C("ParticleInitialSpeed"); initScale = d.C("ParticleInitialScale"); initAlpha = d.C("ParticleInitialAlpha"); scale = d.C("ParticleScale"); decel = d.C("ParticleDeceleration"); forceA = d.C("ForceA"); forceB = d.C("ForceB"); forceC = d.C("ForceC"); emitterPos = d.C("EmitterPosition"); emitterOrient = d.C("EmitterOrientation"); spawnArea = d.C("SpawnAreaCurve"); spawnBox = d.C("SpawnAreaBox"); spinDecel = d.C("ParticleSpinDeceleration"); if (spawnArea != null) { spawnInner = spawnArea.CompIndex("inner_radius"); spawnOuter = spawnArea.CompIndex("outer_radius"); } vfStrength = d.C("VectorFieldStrength"); vfSize = d.C("VectorFieldSize"); vfTightness = d.C("VectorFieldTightness"); vfPos = d.C("VectorFieldPosition"); vfOrient = d.C("VectorFieldOrientation"); hasSpawnAngle = d.HasF("SpawnAngle.x"); spawnAngle = new Vector2(d.F("SpawnAngle.x"), d.F("SpawnAngle.y")); hasSpawnSpread = d.HasF("SpawnSpread.min"); spawnSpread = new Vector2(d.F("SpawnSpread.min"), d.F("SpawnSpread.max")); spawnArc = new Vector2(d.F("SpawnArc.x"), d.F("SpawnArc.y")); hasSpawnArc = d.HasF("SpawnArc.x") && (spawnArc.x != 0f || spawnArc.y != 0f); spreadArc = new Vector2(d.F("SpreadArc.min"), d.F("SpreadArc.max")); hasSpreadArc = spreadArc.x != 0f || spreadArc.y != 0f; orientMin = new Vector3(d.F("ParticleOrientationMin.x"), d.F("ParticleOrientationMin.y"), d.F("ParticleOrientationMin.z")); orientMax = new Vector3(d.F("ParticleOrientationMax.x", orientMin.x), d.F("ParticleOrientationMax.y", orientMin.y), d.F("ParticleOrientationMax.z", orientMin.z)); spinMin = new Vector3(d.F("ParticleSpin_Min.x"), d.F("ParticleSpin_Min.y"), d.F("ParticleSpin_Min.z")); spinMax = new Vector3(d.F("ParticleSpin_Max.x", spinMin.x), d.F("ParticleSpin_Max.y", spinMin.y), d.F("ParticleSpin_Max.z", spinMin.z)); spinDir = new Vector3(Dir(d.S("ParticleSpinDirectionX")), Dir(d.S("ParticleSpinDirectionY")), Dir(d.S("ParticleSpinDirectionZ"))); string text = d.S("ParticleSimulationSpace"); simSpace = ((text == "LOCAL_SPACE_POSITION_ROTATION") ? 1 : ((text == "LOCAL_SPACE_POSITION_ONLY") ? 2 : 0)); spawnOnTerrain = d.F("ParticlesSpawnOnTerrain") > 0.5f; followTerrain = d.F("ParticlesFollowTerrain") > 0.5f; skipPosUpdate = d.F("SkipParticlePositionUpdate") > 0.5f; eventsEnabled = d.events != null && d.events.Length != 0; switch (d.view) { case "DISTORTION": view = CAView.Distortion; break; case "DEFERRED_DECAL": view = CAView.Decal; break; case "DEFERRED_DECAL_EMISSIVE": view = CAView.DecalEmissive; break; case "DEFERRED_DYNAMIC_LIGHT": view = CAView.Light; break; default: view = CAView.Alpha; break; } if (d.Has("vs_translation")) { translation = (int)d.F("vs_translation.restriction"); pivot = new Vector2(d.F("vs_translation.pivot_x", 0.5f), d.F("vs_translation.pivot_y", 0.5f)); } else if (d.Has("vs_translation_velocity_v2")) { string text2 = d.S("vs_translation_velocity_v2.orientation_mode"); velMode = text2 switch { "Camera-facing velocity-aligned" => 2, "Vertically-oriented" => 1, "Horizontally-oriented" => 0, _ => text2.StartsWith("Particle only rotating around local Y (vertical") ? 3 : (text2.StartsWith("Particle only rotating around local Y (horizontal") ? 4 : 5), }; pivot = new Vector2(d.F("vs_translation_velocity_v2.pivot_x", 0.5f), d.F("vs_translation_velocity_v2.pivot_y", 0.5f)); stretch = d.C("vs_translation_velocity_v2.velocity_stretch_mul"); stretchCap = d.F("vs_translation_velocity_v2.velocity_stretch_cap", 1000f); trailMode = d.F("enable_trail_mode") > 0.5f || d.F("vs_translation_velocity_v2.enable_trail_mode") > 0.5f; } else { translation = 0; } diffuse = (int)d.F("ps_texture.diffuse", -1f); normal = (int)d.F("ps_texture.normal", -1f); premul = d.F("ps_texture.pre_multiplied_alpha", 1f) > 0.5f; overlay = d.F("ps_texture.overlay_colour") > 0.5f; string text3 = (d.Has("vs_animated_texture") ? "vs_animated_texture" : (d.Has("vs_cell_texture") ? "vs_cell_texture" : null)); if (text3 != null) { int num = Mathf.Max(1, (int)d.F(text3 + ".atlas_number_of_cells_x", 1f)); int num2 = Mathf.Max(1, (int)d.F(text3 + ".atlas_number_of_cells_y", 1f)); int num3 = (int)d.F(text3 + ".atlas_cell"); atlasScale = new Vector2(1f / (float)num, 1f / (float)num2); atlasOffset = new Vector2((float)(num3 % num), (float)(num3 / num)) * atlasScale; } if (d.Has("vs_animated_texture")) { hasAnim = true; animNx = Mathf.Max(1, (int)d.F("vs_animated_texture.no_cells_xy.0", 1f)); animNy = Mathf.Max(1, (int)d.F("vs_animated_texture.no_cells_xy.1", 1f)); animBlend = d.F("vs_animated_texture.cell_blend") > 0.5f; animRandom = d.F("vs_animated_texture.randomize_cell") > 0.5f; animLoop = d.F("vs_animated_texture.loop") > 0.5f; loopsStart = d.F("vs_animated_texture.no_loops.0", 1f); loopsEnd = d.F("vs_animated_texture.no_loops.1", loopsStart); rowRestricted = d.F("vs_animated_texture.row_restricted") > 0.5f; rowRestriction = (int)d.F("vs_animated_texture.row_restriction"); randomizeRow = d.F("vs_animated_texture.randomize_row") > 0.5f; string text4 = d.S("vs_animated_texture.time_mode"); timeMode = ((text4 == "fixed_animation_speed") ? 1 : ((text4 == "trail_distribution") ? 2 : 0)); } else if (d.Has("vs_cell_texture")) { hasCell = true; cellNx = Mathf.Max(1, (int)d.F("vs_cell_texture.number_of_cells_x", 1f)); cellNy = Mathf.Max(1, (int)d.F("vs_cell_texture.number_of_cells_y", 1f)); cell = (int)d.F("vs_cell_texture.cell"); cellRandom = d.F("vs_cell_texture.randomize_cell") > 0.5f; } if (d.Has("vs_flip_uv")) { hasFlip = true; flipU = d.F("vs_flip_uv.flip_u"); flipV = d.F("vs_flip_uv.flip_v"); string text5 = d.S("vs_flip_uv.uv_orientation"); uvOrientation = ((text5 == "90_degrees_ccw") ? 1 : ((text5 == "90_degrees_cw") ? 2 : 0)); } alpha = d.C("vs_vertex_alpha.curve_alpha"); alphaStartOff = new Vector2(d.F("vs_vertex_alpha.alpha_START_offset.0"), d.F("vs_vertex_alpha.alpha_START_offset.1")); alphaEndOff = new Vector2(d.F("vs_vertex_alpha.alpha_END_offset.0"), d.F("vs_vertex_alpha.alpha_END_offset.1")); colour = d.C("vs_colour.curve_colour"); if (colour != null) { cR = colour.CompIndex("r"); cG = colour.CompIndex("g"); cB = colour.CompIndex("b"); cBright = colour.CompIndex("brightness"); } hasSoft = d.Has("ps_soft_edge"); softFactor = d.F("ps_soft_edge.soft_factor", 1.5f); softScaleStrength = d.F("ps_soft_edge.scale_strength", 1f); hasLighting = d.Has("ps_lighting"); additiveMul = d.F("ps_lighting.additive_blend_mul", 1f); lightEmissive = d.F("ps_lighting.emissive"); emissiveMul = (d.Has("ps_emissive") ? d.F("ps_emissive.emissive_mul", 1f) : additiveMul); alphaCrush = d.C("ps_alpha_crush.curve_alpha_crush"); crushSharp = d.F("ps_alpha_crush.sharp_transition") > 0.5f; renderable = (d.rigid ? (d.mesh >= 0) : (diffuse >= 0 || view == CAView.Light)); } private static float Dir(string s) { if (!(s == "CW")) { return 1f; } return -1f; } public static CAEmitterRuntime Of(CAEmitterDef d) { if (d.compiled == null) { d.compiled = new CAEmitterRuntime(d); } return (CAEmitterRuntime)d.compiled; } public float SampleF(CACurveDef c, float t, float rnd, float def) { return c?.Sample(0, t, rnd) ?? def; } public Vector3 SampleV(CACurveDef c, float t, float rnd, Vector3 def) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return c?.Sample3(t, rnd) ?? def; } } public static class CAMeshMaterials { public static void Configure(Material m, CAVfxLibrary lib, CAMaterialDef d) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051a: 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_0539: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0686: Unknown result type (might be due to invalid IL or missing references) //IL_07af: Unknown result type (might be due to invalid IL or missing references) //IL_07b4: Unknown result type (might be due to invalid IL or missing references) //IL_07b9: Unknown result type (might be due to invalid IL or missing references) //IL_07c1: Unknown result type (might be due to invalid IL or missing references) //IL_07c8: Unknown result type (might be due to invalid IL or missing references) //IL_07cf: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_0753: Unknown result type (might be due to invalid IL or missing references) //IL_0758: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Unknown result type (might be due to invalid IL or missing references) //IL_076e: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) string text = d.shader ?? ""; m.SetFloat("_Mode", 0f); m.SetFloat("_TexPower", d.P1("texture_power", 1f)); m.SetFloat("_AlphaStrength", d.P1("total_alpha_strength", 1f) * d.P1("vfx_mesh_alpha", 1f)); Vector4 val = d.P4("glow_colour", Vector4.one); float num = d.P1("glow_strength", 1f); m.SetColor("_Glow", new Color(val.x * num, val.y * num, val.z * num, 1f)); m.SetFloat("_UseVertexColour", d.P1("vertex_colour", 1f)); m.SetVector("_NormalFade", new Vector4(d.P1("normal_fade_in_out", 0f), d.P1("normal_fade_power", 0f), 0f, 0f)); if (text.StartsWith("wh3_vfx_one_shot_mesh")) { Overlay(m, lib, d, "colour_overlay", "colour_overlay_tile", "colour_overlay_pan", "colour_overlay_strength"); for (int i = 1; i <= 3; i++) { Pattern(m, lib, d, i, "tex_" + i, "tex_" + i + "_tile", "tex_" + i + "_pan", "tex_" + i + "_channels", "tex_" + i + "_brightness"); } Mask(m, lib, d, 1, "oneshot_mask", "oneshot_mask_tiling", "oneshot_mask_direction"); Mask(m, lib, d, 2, "global_mask", "global_mask_tile", "global_mask_pan"); } else if (text.StartsWith("wh3_vfx_basic_mesh")) { Overlay(m, lib, d, "colour_overlay", "colour_overlay_tile", "colour_overlay_pan", "colour_overlay_strength"); for (int j = 1; j <= 3; j++) { Pattern(m, lib, d, j, "diffuse_" + j, "diffuse_" + j + "_tile", "diffuse_" + j + "_pan", "diffuse_" + j + "_channels", "diffuse_" + j + "_brightness"); } Mask(m, lib, d, 1, "mask_1", "mask_1_tile", "mask_1_pan"); Mask(m, lib, d, 2, "mask_2", "mask_2_tile", "mask_2_pan"); m.SetFloat("_MaskStrength", d.P1("mask_strength", 1f)); } else if (text.StartsWith("wh_vfx_mesh")) { Overlay(m, lib, d, "colour_overlay", "colour_overlay_tile", "colour_overlay_pan", "colour_overlay_strength"); string[] array = new string[3] { "Texture_A", "Texture_B", "Texture_C" }; string[] array2 = new string[3] { "Texture_A_channels", "Texture_B_Channels", "Texture_C_Channels" }; string[] array3 = new string[3] { "", "2", "3" }; for (int k = 0; k < 3; k++) { Pattern(m, lib, d, k + 1, array[k], "scrolling_colour_tiling" + array3[k], "scrolling_colour_scroll" + array3[k], array2[k], "scrolling_brightness" + array3[k]); } Mask(m, lib, d, 2, "global_mask", "global_mask_tiling", "global_mask_pan"); } else if (text.StartsWith("vfx_mesh_solid")) { Overlay(m, lib, d, "colour_overlay", "colour_overlay_tile", "colour_overlay_pan", "colour_overlay_strength"); string[] array4 = new string[3] { "texture_a", "texture_b", "texture_c" }; for (int l = 0; l < 3; l++) { Pattern(m, lib, d, l + 1, array4[l], array4[l] + "_tiling", array4[l] + "_pan", array4[l] + "_channels", array4[l] + "_brightness"); } Mask(m, lib, d, 2, "global_mask", "global_mask_tiling", "global_mask_pan"); } else if (text.StartsWith("fx_premultiply_animated_uvs_one_shot")) { Pattern(m, lib, d, 1, "diffuse_01", "diffuse_scale_01", "diffuse_direction_01", null, null); Pattern(m, lib, d, 2, "diffuse_02", "diffuse_scale_02", "diffuse_direction_02", null, null); Mask(m, lib, d, 1, "mask_01", "mask_scale_01", "mask_direction_01"); Mask(m, lib, d, 2, "mask_02", "mask_scale_02", "mask_direction_02"); Vector4 val2 = d.P4("main_colour", Vector4.one); float num2 = d.P1("Emission", 1f); m.SetColor("_Glow", new Color(val2.x * num2, val2.y * num2, val2.z * num2, 1f)); m.SetFloat("_TexPower", d.P1("opacity_power", 1f)); m.SetFloat("_AlphaStrength", d.P1("opacity_strenght", 1f)); m.SetFloat("_Mode", 3f); } else if (text.StartsWith("vfx_soulpanning")) { m.SetFloat("_Mode", 1f); Overlay(m, lib, d, "base_colour", "uv_tiling", "uv_panningdirection", null); Pattern(m, lib, d, 1, "noise_tex_01", "uv_noise1tiling", "uv_noise1panningdirection", null, null); Pattern(m, lib, d, 2, "noise_tex_02", "uv_noise2tiling", "uv_noise2panningdirection", null, null); Mask(m, lib, d, 1, "opacity_grad", null, null); float num3 = d.P1("emissive_strength", 1f); m.SetColor("_Glow", new Color(num3, num3, num3, 1f)); m.SetVector("_Fresnel", new Vector4(d.P1("fresnel_bias", 0f), d.P1("fresnel_power", 1f), 1f, 0f)); } else if (text.StartsWith("vfx_rigid_emissive_dissolve")) { m.SetFloat("_Mode", 2f); Overlay(m, lib, d, "base_colour", null, null, null); string[] array5 = new string[3] { "emissive_a", "emissive_b", "emissive_c" }; for (int n = 0; n < 3; n++) { Pattern(m, lib, d, n + 1, array5[n] + "_texture", array5[n] + "_tiling", array5[n] + "_direction", array5[n] + "_channels", array5[n] + "_brightness"); } Vector4 val3 = d.P4("emissive_tint", Vector4.one); m.SetColor("_Glow", new Color(val3.x, val3.y, val3.z, 1f)); } else { m.SetFloat("_Mode", 2f); Overlay(m, lib, d, "base_colour", "diffuse_tiling", null, null); Vector4 val4 = d.P4("light_colour", Vector4.one); m.SetColor("_Glow", new Color(val4.x, val4.y, val4.z, 1f)); m.SetFloat("_AlphaStrength", d.P1("alpha_strength", 1f)); } } private static Vector4 TilePan(CAMaterialDef d, string tile, string pan) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) float[] array = ((tile != null) ? d.P(tile) : null); float[] array2 = ((pan != null) ? d.P(pan) : null); float num = ((array != null && array.Length != 0) ? array[0] : 1f); float num2 = ((array != null && array.Length > 1) ? array[1] : num); if (num == 0f && num2 == 0f) { num = 1f; num2 = 1f; } return new Vector4(num, num2, (array2 != null && array2.Length != 0) ? array2[0] : 0f, (array2 != null && array2.Length > 1) ? array2[1] : 0f); } private static void Overlay(Material m, CAVfxLibrary lib, CAMaterialDef d, string slot, string tile, string pan, string strength) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) Texture2D val = lib.Tex(d.Tex(slot)); m.SetTexture("_Overlay", (Texture)(object)(((Object)(object)val != (Object)null) ? val : Texture2D.whiteTexture)); m.SetVector("_OverlayST", TilePan(d, tile, pan)); m.SetFloat("_OverlayStrength", (strength != null) ? d.P1(strength, 1f) : 1f); } private static void Pattern(Material m, CAVfxLibrary lib, CAMaterialDef d, int i, string slot, string tile, string pan, string channels, string bright) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00ee: Unknown result type (might be due to invalid IL or missing references) Texture2D val = lib.Tex(d.Tex(slot)); bool flag = (Object)(object)val != (Object)null && !((Object)val).name.Contains("default_white"); m.SetTexture("_Tex" + i, (Texture)(object)(flag ? val : Texture2D.whiteTexture)); m.SetVector("_Tex" + i + "ST", TilePan(d, tile, pan)); Vector4 val2 = (Vector4)((channels != null) ? d.P4(channels, new Vector4(1f, 0f, 0f, 0f)) : new Vector4(1f, 0f, 0f, 0f)); if (channels == null) { ((Vector4)(ref val2))..ctor(0.333f, 0.333f, 0.333f, 0f); } m.SetVector("_Tex" + i + "Chan", val2); m.SetFloat("_Tex" + i + "On", (!flag) ? 0f : ((bright != null) ? d.P1(bright, 1f) : 1f)); } private static void Mask(Material m, CAVfxLibrary lib, CAMaterialDef d, int i, string slot, string tile, string pan) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) Texture2D val = lib.Tex(d.Tex(slot)); bool flag = (Object)(object)val != (Object)null && !((Object)val).name.Contains("default_white"); m.SetTexture("_Mask" + i, (Texture)(object)(flag ? val : Texture2D.whiteTexture)); m.SetVector("_Mask" + i + "ST", TilePan(d, tile, pan)); } } public class CAVfxInstance : MonoBehaviour { public CAVfxSim sim; public bool destroyWhenDone = true; public bool manualStep; public float maxLifetime = 60f; private float age; public bool Alive { get { if (sim != null) { return sim.Alive; } return false; } } public static CAVfxInstance Spawn(CAVfxLibrary lib, string name, Vector3 position, Quaternion rotation, float scale = 1f, Transform parent = null) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) CAVfxDef cAVfxDef = (((Object)(object)lib != (Object)null) ? lib.Find(name) : null); if (cAVfxDef == null) { Debug.LogWarning((object)("[CAVfx] unknown effect " + name)); return null; } GameObject val = new GameObject("CAVfx_" + name); if ((Object)(object)parent != (Object)null) { val.transform.SetParent(parent, false); } val.transform.SetPositionAndRotation(position, rotation); CAVfxInstance cAVfxInstance = val.AddComponent<CAVfxInstance>(); cAVfxInstance.sim = new CAVfxSim(lib, cAVfxDef, scale); if (cAVfxInstance.sim.HasInfinite) { cAVfxInstance.maxLifetime = float.PositiveInfinity; } cAVfxInstance.SyncRoot(); return cAVfxInstance; } public void Stop() { if (sim != null) { sim.stopped = true; } } public void Kill() { if (sim != null) { sim.killed = true; } Object.Destroy((Object)(object)((Component)this).gameObject); } public void SyncRoot() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; sim.root = Matrix4x4.TRS(transform.position, transform.rotation, Vector3.one); } private void LateUpdate() { if (sim == null || manualStep) { return; } SyncRoot(); float deltaTime = Time.deltaTime; sim.Step(deltaTime); age += deltaTime; if (age > maxLifetime) { sim.stopped = true; } if (!sim.Alive) { if (destroyWhenDone) { Object.Destroy((Object)(object)((Component)this).gameObject); } } else { CAVfxRenderer.Render(sim, CAVfxSettings.Cam, ((Component)this).transform); } } private void OnDestroy() { if (sim != null) { CAVfxRenderer.Release(sim); } } } [Serializable] public class CACurveDef { public string name; public string comps; public int[] random; public int n; public float[] min; public float[] max; [NonSerialized] private string[] compNames; public int CompCount { get { if (random == null) { return 1; } return random.Length; } } public int CompIndex(string comp) { if (compNames == null) { compNames = (comps ?? "x").Split(','); } return Array.IndexOf(compNames, comp); } public float Sample(int comp, float t, float rnd) { if (n <= 0 || comp < 0) { return 0f; } float num = Mathf.Clamp01(t) * (float)(n - 1); int num2 = Mathf.Min((int)num, (n - 2 >= 0) ? (n - 2) : 0); int num3 = Mathf.Min(num2 + 1, n - 1); float num4 = num - (float)num2; int num5 = comp * n; float num6 = Mathf.Lerp(min[num5 + num2], min[num5 + num3], num4); if (random[comp] == 0) { return num6; } float num7 = Mathf.Lerp(max[num5 + num2], max[num5 + num3], num4); return Mathf.Lerp(num6, num7, rnd); } public Vector3 Sample3(float t, float rnd) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) return new Vector3(Sample(0, t, rnd), (CompCount > 1) ? Sample(1, t, rnd) : 0f, (CompCount > 2) ? Sample(2, t, rnd) : 0f); } } [Serializable] public class CAEventDef { public string name; public string vfx; public float timeOffset; public bool trackPosition; public bool trackScale; public bool trackColour; public bool trackAlpha; public bool trackLifetime; public string orientationMode; } [Serializable] public class CAEmitterDef { public string id; public bool rigid; public string view; public int simpleLight; public string[] fragments; public string[] fNames; public float[] fValues; public string[] sNames; public string[] sValues; public CACurveDef[] curves; public int mesh = -1; public int material = -1; public float[] pivot; public int vectorField = -1; public CAEventDef[] events; [NonSerialized] private Dictionary<string, float> fMap; [NonSerialized] private Dictionary<string, string> sMap; [NonSerialized] private Dictionary<string, CACurveDef> cMap; [NonSerialized] public object compiled; private void Build() { fMap = new Dictionary<string, float>(); for (int i = 0; i < fNames.Length; i++) { fMap[fNames[i]] = fValues[i]; } sMap = new Dictionary<string, string>(); for (int j = 0; j < sNames.Length; j++) { sMap[sNames[j]] = sValues[j]; } cMap = new Dictionary<string, CACurveDef>(); CACurveDef[] array = curves; foreach (CACurveDef cACurveDef in array) { cMap[cACurveDef.name] = cACurveDef; } } public bool HasF(string k) { if (fMap == null) { Build(); } return fMap.ContainsKey(k); } public float F(string k, float def = 0f) { if (fMap == null) { Build(); } if (!fMap.TryGetValue(k, out var value)) { return def; } return value; } public string S(string k, string def = "") { if (sMap == null) { Build(); } if (!sMap.TryGetValue(k, out var value)) { return def; } return value; } public CACurveDef C(string k) { if (cMap == null) { Build(); } if (!cMap.TryGetValue(k, out var value)) { return null; } return value; } public bool Has(string fragment) { if (fragments != null) { return Array.IndexOf(fragments, fragment) >= 0; } return false; } } [Serializable] public class CARefEmitterDef { public string name; public bool enable = true; public float[] tintMin; public float[] tintMax; public float pLifeBiasMin; public float pLifeBiasMax; public float eLifeBiasMin; public float eLifeBiasMax; public float rateMin = 1f; public float rateMax = 1f; } [Serializable] public class CARefDef { public string inst; public string vfx; public float[] pos; public float[] rot; public float scaleMin = 1f; public float scaleMax = 1f; public float startMin; public float startMax; public bool infinite; public float simSpeed = 1f; public CARefEmitterDef[] emitters; } [Serializable] public class CAVfxDef { public string name; public CAEmitterDef[] emitters; public CARefDef[] refs; } [Serializable] public class CAMaterialTexture { public string slot; public int tex = -1; } [Serializable] public class CAMaterialParam { public string name; public float[] v; } [Serializable] public class CAMaterialDef { public string path; public string shader; public CAMaterialTexture[] textures; public CAMaterialParam[] @params; public int Tex(string slot) { CAMaterialTexture[] array = textures; foreach (CAMaterialTexture cAMaterialTexture in array) { if (cAMaterialTexture.slot == slot) { return cAMaterialTexture.tex; } } return -1; } public float[] P(string name) { if (@params != null) { CAMaterialParam[] array = @params; foreach (CAMaterialParam cAMaterialParam in array) { if (cAMaterialParam.name == name) { return cAMaterialParam.v; } } } return null; } public float P1(string name, float def) { float[] array = P(name); if (array == null || array.Length == 0) { return def; } return array[0]; } public Vector4 P4(string name, Vector4 def) { //IL_000b: 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) float[] array = P(name); if (array == null) { return def; } for (int i = 0; i < array.Length && i < 4; i++) { ((Vector4)(ref def))[i] = array[i]; } return def; } } [Serializable] public class CAVectorField { public string path; public int w; public int h; public int d; public float[] data; public Vector3 SampleUnit(Vector3 uvw) { //IL_0011: 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_0065: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) if (data == null || data.Length == 0) { return Vector3.zero; } if (uvw.x < 0f || uvw.y < 0f || uvw.z < 0f || uvw.x > 1f || uvw.y > 1f || uvw.z > 1f) { return Vector3.zero; } float num = uvw.x * (float)(w - 1); float num2 = uvw.y * (float)(h - 1); float num3 = uvw.z * (float)(d - 1); int num4 = Mathf.Min((int)num, w - 1); int num5 = Mathf.Min((int)num2, h - 1); int num6 = Mathf.Min((int)num3, d - 1); int x = Mathf.Min(num4 + 1, w - 1); int y = Mathf.Min(num5 + 1, h - 1); int z = Mathf.Min(num6 + 1, d - 1); float num7 = num - (float)num4; float num8 = num2 - (float)num5; float num9 = num3 - (float)num6; Vector3 val = Vector3.Lerp(V(num4, num5, num6), V(x, num5, num6), num7); Vector3 val2 = Vector3.Lerp(V(num4, y, num6), V(x, y, num6), num7); Vector3 val3 = Vector3.Lerp(V(num4, num5, z), V(x, num5, z), num7); Vector3 val4 = Vector3.Lerp(V(num4, y, z), V(x, y, z), num7); return Vector3.Lerp(Vector3.Lerp(val, val2, num8), Vector3.Lerp(val3, val4, num8), num9); } private Vector3 V(int x, int y, int z) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) int num = ((z * h + y) * w + x) * 3; return new Vector3(data[num], data[num + 1], data[num + 2]); } } public class CAVfxLibrary : ScriptableObject { public List<CAVfxDef> vfx = new List<CAVfxDef>(); public Texture2D[] textures; public string[] texturePaths; public Mesh[] meshes; public string[] meshPaths; public CAMaterialDef[] materials; public CAVectorField[] vectorFields; [Header("Shaders (referenced here so the runtime never needs Shader.Find)")] public Shader particleShader; public Shader distortionShader; public Shader meshShader; [NonSerialized] private Dictionary<string, CAVfxDef> byName; public CAVfxDef Find(string name) { if (string.IsNullOrEmpty(name)) { return null; } if (byName == null) { byName = new Dictionary<string, CAVfxDef>(StringComparer.OrdinalIgnoreCase); foreach (CAVfxDef item in vfx) { byName[item.name] = item; } } if (!byName.TryGetValue(name, out var value)) { return null; } return value; } public Texture2D Tex(int i) { if (textures == null || i < 0 || i >= textures.Length) { return null; } return textures[i]; } public Mesh MeshAt(int i) { if (meshes == null || i < 0 || i >= meshes.Length) { return null; } return meshes[i]; } public CAMaterialDef MaterialAt(int i) { if (materials == null || i < 0 || i >= materials.Length) { return null; } return materials[i]; } public CAVectorField FieldAt(int i) { if (vectorFields == null || i < 0 || i >= vectorFields.Length) { return null; } return vectorFields[i]; } } public static class CAVfxRenderer { private static readonly List<Vector3> verts = new List<Vector3>(); private static readonly List<Vector3> norms = new List<Vector3>(); private static readonly List<Color> cols = new List<Color>(); private static readonly List<Vector4> uv0 = new List<Vector4>(); private static readonly List<Vector4> uv1 = new List<Vector4>(); private static readonly List<int> tris = new List<int>(); private static readonly List<int> order = new List<int>(); private static readonly List<float> dist = new List<float>(); private static readonly Dictionary<CAEmitterDef, Material> materials = new Dictionary<CAEmitterDef, Material>(); private static readonly Dictionary<int, Material> meshMaterials = new Dictionary<int, Material>(); private static MaterialPropertyBlock mpb; private static readonly int ColorId = Shader.PropertyToID("_Color"); private static readonly int AgeId = Shader.PropertyToID("_Age"); private static readonly int LifeId = Shader.PropertyToID("_LifeU"); public static void Render(CAVfxSim sim, Camera cam, Transform lightHost) { if ((Object)(object)cam == (Object)null) { return; } foreach (CAEmitterInstance emitter in sim.emitters) { RenderEmitter(sim, emitter, cam, lightHost); } foreach (CAVfxChild child in sim.children) { Render(child.sim, cam, lightHost); } } public static void Release(CAVfxSim sim) { foreach (CAEmitterInstance emitter in sim.emitters) { if ((Object)(object)emitter.mesh != (Object)null) { Object.Destroy((Object)(object)emitter.mesh); } if (emitter.lights != null) { foreach (Light light in emitter.lights) { if ((Object)(object)light != (Object)null) { Object.Destroy((Object)(object)((Component)light).gameObject); } } } emitter.mesh = null; emitter.lights = null; } foreach (CAVfxChild child in sim.children) { Release(child.sim); } } private static void RenderEmitter(CAVfxSim sim, CAEmitterInstance e, Camera cam, Transform lightHost) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: 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_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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Unknown result type (might be due to invalid IL or missing references) //IL_08d8: Unknown result type (might be due to invalid IL or missing references) //IL_08f8: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_097f: Unknown result type (might be due to invalid IL or missing references) //IL_0984: Unknown result type (might be due to invalid IL or missing references) //IL_098e: Unknown result type (might be due to invalid IL or missing references) //IL_0993: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058a: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_0597: 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_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05f2: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: 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_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_0602: Unknown result type (might be due to invalid IL or missing references) //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_0617: Unknown result type (might be due to invalid IL or missing references) //IL_0618: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Unknown result type (might be due to invalid IL or missing references) //IL_061c: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0369: 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_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: 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_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0429: 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_0430: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0660: 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_037b: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_041e: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0450: 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_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0464: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06ad: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0759: Unknown result type (might be due to invalid IL or missing references) //IL_075b: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_0764: Unknown result type (might be due to invalid IL or missing references) //IL_0769: Unknown result type (might be due to invalid IL or missing references) //IL_076d: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0782: Unknown result type (might be due to invalid IL or missing references) //IL_078c: Unknown result type (might be due to invalid IL or missing references) //IL_077b: Unknown result type (might be due to invalid IL or missing references) //IL_0791: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_07ac: Unknown result type (might be due to invalid IL or missing references) //IL_07ba: Unknown result type (might be due to invalid IL or missing references) //IL_07bf: Unknown result type (might be due to invalid IL or missing references) //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_07cb: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07d9: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_07f9: Unknown result type (might be due to invalid IL or missing references) //IL_0800: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_0810: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_081e: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_083e: Unknown result type (might be due to invalid IL or missing references) CAEmitterRuntime rt = e.rt; if (e.muted) { if ((Object)(object)e.mesh != (Object)null) { e.mesh.Clear(); } return; } if (rt.view == CAView.Light) { RenderLights(sim, e, lightHost); return; } if (!rt.renderable || e.count == 0) { if ((Object)(object)e.mesh != (Object)null) { e.mesh.Clear(); } if ((Object)(object)e.proxy != (Object)null) { ((Component)e.proxy).gameObject.SetActive(false); } return; } if (rt.def.rigid) { RenderRigid(sim, e); return; } Material val = MaterialFor(sim.lib, rt); if ((Object)(object)val == (Object)null) { return; } verts.Clear(); norms.Clear(); cols.Clear(); uv0.Clear(); uv1.Clear(); tris.Clear(); Vector3 position = ((Component)cam).transform.position; Vector3 right = ((Component)cam).transform.right; Vector3 up = ((Component)cam).transform.up; _ = ((Component)cam).transform.forward; order.Clear(); dist.Clear(); Vector3 val2; for (int i = 0; i < e.count; i++) { order.Add(i); List<float> list = dist; val2 = sim.ParticleWorld(e, e.p[i].pos) - position; list.Add(((Vector3)(ref val2)).sqrMagnitude); } order.Sort((int index2, int index) => dist[index].CompareTo(dist[index2])); Vector3 U = default(Vector3); Vector3 V = default(Vector3); foreach (int item in order) { ref CAParticle reference = ref e.p[item]; float num = Mathf.Clamp01(reference.age / reference.life); Vector3 val3 = sim.ParticleWorld(e, reference.pos); Vector3 val4 = sim.ParticleScale(e, ref reference, num); Color val5 = sim.ParticleBaseColour(e, ref reference, num); val5.a = sim.ParticleAlpha(e, ref reference, num); float num2 = sim.ParticleBrightness(e, ref reference, num); if (val5.a <= 0.0005f || (Mathf.Abs(val4.x) < 1E-05f && Mathf.Abs(val4.y) < 1E-05f)) { continue; } float x = val4.x; float num3 = val4.y; val2 = position - val3; Vector3 normalized = ((Vector3)(ref val2)).normalized; if (rt.velMode >= 0) { Vector3 val6 = sim.ParticleWorldVel(e, reference.vel); float magnitude = ((Vector3)(ref val6)).magnitude; Vector3 val7 = ((magnitude > 1E-05f) ? (val6 / magnitude) : Vector3.up); float num4 = magnitude * rt.SampleF(rt.stretch, num, reference.rnd, 1f) / Mathf.Max(e.TotalScale, 0.0001f); if (!rt.trailMode) { num4 += 1f; } num4 = Mathf.Min(num4, rt.stretchCap); switch (rt.velMode) { case 0: { Vector3 val9 = Vector3.Cross(Vector3.up, val7); U = ((((Vector3)(ref val9)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val9)).normalized : Vector3.right); V = val7; break; } case 1: { Vector3 val11 = Vector3.Cross(val7, Vector3.up); U = Vector3.up; Vector3 val12 = Vector3.Cross(val11, Vector3.up); V = ((((Vector3)(ref val12)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val12)).normalized : Vector3.forward); break; } case 2: { Vector3 val10 = Vector3.Cross(normalized, val7); U = ((((Vector3)(ref val10)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val10)).normalized : right); V = val7; break; } case 3: case 4: { Vector3 val13 = Vector3.Cross(val7, Vector3.up); U = ((((Vector3)(ref val13)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val13)).normalized : Vector3.right); V = Vector3.up; break; } default: { Vector3 val8 = Vector3.Cross(normalized, val7); val8 = ((((Vector3)(ref val8)).sqrMagnitude > 1E-06f) ? ((Vector3)(ref val8)).normalized : right); val2 = Vector3.Cross(val8, normalized); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; num4 = Mathf.Max(num4 * Vector3.Dot(val7, normalized2), 1f); U = val8; V = normalized2; break; } } num3 *= num4; if (reference.euler.z != 0f) { float num5 = reference.euler.z * (MathF.PI / 180f); float num6 = Mathf.Cos(num5); float num7 = Mathf.Sin(num5); Vector3 val14 = U * num6 + V * num7; Vector3 val15 = -U * num7 + V * num6; U = val14; V = val15; } } else { switch ((rt.view == CAView.Decal || rt.view == CAView.DecalEmissive) ? 3 : rt.translation) { case 1: { Vector3 val20 = Vector3.Cross(Vector3.up, normalized); U = ((((Vector3)(ref val20)).sqrMagnitude > 1E-08f) ? ((Vector3)(ref val20)).normalized : right); V = Vector3.up; Roll(ref U, ref V, reference.euler.z); break; } case 2: { Quaternion val17 = Quaternion.Euler(reference.euler); Vector3 val18 = val17 * Vector3.right; Vector3 val19 = val17 * Vector3.up; ((Vector3)(ref U))..ctor(val18.x, 0f, val18.y); ((Vector3)(ref V))..ctor(val19.x, 0f, val19.y); break; } case 3: { _ = e.rt.simSpace; Quaternion val16 = e.worldRot * Quaternion.Euler(reference.euler); U = val16 * Vector3.right; V = val16 * Vector3.up; break; } default: U = right; V = up; Roll(ref U, ref V, reference.euler.z); break; } } bool flag = rt.view == CAView.Decal || rt.view == CAView.DecalEmissive; val2 = Vector3.Cross(V, U); Vector3 val21 = ((Vector3)(ref val2)).normalized; if (Vector3.Dot(val21, normalized) < 0f) { val21 = -val21; } CellRects(rt, ref reference, num, out var a, out var b, out var blend); float num8 = (rt.hasSoft ? (rt.softFactor * Mathf.Lerp(1f, Mathf.Min(Mathf.Abs(val4.x), Mathf.Abs(val4.y)), rt.softScaleStrength)) : 0f); float num9 = ((rt.alphaCrush != null) ? rt.alphaCrush.Sample(0, num, reference.rnd) : 0f); int count = verts.Count; for (int num10 = 0; num10 < 4; num10++) { float num11 = (((num10 & 1) == 0) ? 0f : 1f); float num12 = (((num10 & 2) == 0) ? 0f : 1f); float num13 = (num11 - rt.pivot.x) * x; float num14 = (rt.pivot.y - num12) * num3; verts.Add(val3 + U * num13 + V * num14 + (flag ? (Vector3.up * 0.06f) : Vector3.zero)); norms.Add(val21); cols.Add(val5); Vector2 val22 = TransformUV(rt, ref reference, new Vector2(num11, num12)); uv0.Add(new Vector4(a.x + val22.x * a.z, a.y + val22.y * a.w, b.x + val22.x * b.z, b.y + val22.y * b.w)); uv1.Add(new Vector4(blend, num8, num9, num2)); } tris.Add(count); tris.Add(count + 1); tris.Add(count + 2); tris.Add(count + 2); tris.Add(count + 1); tris.Add(count + 3); } if ((Object)(object)e.mesh == (Object)null) { e.mesh = new Mesh { name = "CAVfx_" + rt.def.id }; e.mesh.MarkDynamic(); e.mesh.indexFormat = (IndexFormat)1; } Mesh mesh = e.mesh; mesh.Clear(); if (verts.Count != 0) { mesh.SetVertices(verts); mesh.SetNormals(norms); mesh.SetColors(cols); mesh.SetUVs(0, uv0); mesh.SetUVs(1, uv1); mesh.SetTriangles(tris, 0, false); mesh.bounds = new Bounds(((Component)cam).transform.position, Vector3.one * 100000f); Graphics.DrawMesh(mesh, Matrix4x4.identity, val, CAVfxSettings.renderLayer, CAVfxSettings.drawCamera, 0, (MaterialPropertyBlock)null, (ShadowCastingMode)0, false); } } private static void Roll(ref Vector3 U, ref Vector3 V, float deg) { //IL_001e: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0053: Unknown result type (might be due to invalid IL or missing references) //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_005f: 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_0066: 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) if (deg != 0f) { float num = deg * (MathF.PI / 180f); float num2 = Mathf.Cos(num); float num3 = Mathf.Sin(num); Vector3 val = U * num2 + V * num3; Vector3 val2 = -U * num3 + V * num2; U = val; V = val2; } } private static Vector2 TransformUV(CAEmitterRuntime rt, ref CAParticle p, Vector2 uv) { //IL_0008: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0046: 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_0053: 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_0038: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!rt.hasFlip) { return uv; } if (rt.uvOrientation != 0) { uv -= new Vector2(0.5f, 0.5f); uv = ((rt.uvOrientation == 1) ? new Vector2(0f - uv.y, uv.x) : new Vector2(uv.y, 0f - uv.x)); uv += new Vector2(0.5f, 0.5f); } if (p.flipU) { uv.x = 1f - uv.x; } if (p.flipV) { uv.y = 1f - uv.y; } return uv; } private static void CellRects(CAEmitterRuntime rt, ref CAParticle p, float lu, out Vector4 a, out Vector4 b, out float blend) { //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) blend = 0f; if (rt.hasAnim) { int animNx = rt.animNx; int animNy = rt.animNy; int num = animNx * animNy; float num2; if (rt.timeMode == 1) { num2 = p.age * Mathf.Lerp(rt.loopsStart, rt.loopsEnd, lu); } else if (rt.timeMode == 0) { num2 = Mathf.Lerp(lu * rt.loopsStart, lu * rt.loopsEnd, lu); } else { int num3 = (rt.rowRestricted ? animNx : num); num2 = 1f / (float)num3 * (float)((int)(p.rnd3 * 997f) % num3); } if (rt.animRandom) { num2 += p.rnd3; } num2 = (rt.animLoop ? (num2 - Mathf.Floor(num2)) : Mathf.Clamp01(num2)); int num4 = 0; int num5 = num; if (rt.rowRestricted) { num4 = rt.rowRestriction; num5 = animNx; } if (rt.randomizeRow) { num4 = (int)Mathf.Floor(p.rnd3 * 7.31f % 1f * (float)animNy); } num4 *= animNx; num2 *= (float)num5; int num6 = Mathf.Clamp((int)num2, 0, num5 - 1); float num7 = num2 - Mathf.Floor(num2); int num8 = num6; if (rt.animBlend) { num8 = (rt.animLoop ? ((num6 + 1) % num5) : Mathf.Min(num6 + 1, num5 - 1)); blend = num7; } a = Cell(rt, animNx, animNy, num4 + num6); b = Cell(rt, animNx, animNy, num4 + num8); } else if (rt.hasCell) { int num9 = rt.cellNx * rt.cellNy; int num10 = rt.cell + (rt.cellRandom ? ((int)(p.rnd3 * (float)num9)) : 0); a = Cell(rt, rt.cellNx, rt.cellNy, (num10 % num9 + num9) % num9); b = a; } else { a = new Vector4(rt.atlasOffset.x, rt.atlasOffset.y, rt.atlasScale.x, rt.atlasScale.y); b = a; } } private static Vector4 Cell(CAEmitterRuntime rt, int nx, int ny, int index) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) int num = index % nx; int num2 = index / nx; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(1f / (float)nx, 1f / (float)ny); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor((float)num * val.x, (float)num2 * val.y); return new Vector4(rt.atlasOffset.x + val2.x * rt.atlasScale.x, rt.atlasOffset.y + val2.y * rt.atlasScale.y, rt.atlasScale.x * val.x, rt.atlasScale.y * val.y); } private static Material MaterialFor(CAVfxLibrary lib, CAEmitterRuntime rt) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown if (materials.TryGetValue(rt.def, out var value) && (Object)(object)value != (Object)null) { return value; } Shader val = ((rt.view == CAView.Distortion) ? lib.distortionShader : lib.particleShader); if ((Object)(object)val == (Object)null) { return null; } value = new Material(val) { name = "CAVfx_" + rt.def.id }; Texture2D val2 = lib.Tex(rt.diffuse); if ((Object)(object)val2 != (Object)null) { value.SetTexture("_MainTex", (Texture)(object)val2); } Texture2D val3 = lib.Tex(rt.normal); if ((Object)(object)val3 != (Object)null) { value.SetTexture("_NormalTex", (Texture)(object)val3); } value.SetFloat("_Premul", rt.premul ? 1f : 0f); value.SetFloat("_Lit", rt.hasLighting ? 1f : 0f); value.SetFloat("_LightEmissive", rt.lightEmissive); value.SetFloat("_EmissiveMul", rt.emissiveMul * ((rt.view == CAView.DecalEmissive) ? CAVfxSettings.decalEmissiveBoost : ((rt.view == CAView.Decal) ? CAVfxSettings.decalBoost : 1f))); value.SetFloat("_SoftOn", rt.hasSoft ? 1f : 0f); value.SetFloat("_CrushSharp", rt.crushSharp ? 1f : 0f); value.SetFloat("_HasNormal", ((Object)(object)val3 != (Object)null) ? 1f : 0f); value.renderQueue = ((rt.view == CAView.Decal || rt.view == CAView.DecalEmissive) ? 2950 : 3000); materials[rt.def] = value; return value; } public static Material MeshMaterialFor(CAVfxLibrary lib, int materialIndex, CAEmitterRuntime rt) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown int key = ((materialIndex >= 0) ? materialIndex : (-1000 - rt.def.GetHashCode())); if (meshMaterials.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } CAMaterialDef cAMaterialDef = lib.MaterialAt(materialIndex); if (cAMaterialDef == null || (Object)(object)lib.meshShader == (Object)null) { if ((Object)(object)lib.particleShader == (Object)null) { return null; } value = new Material(lib.particleShader); Texture2D val = lib.Tex(rt.diffuse); if ((Object)(object)val != (Object)null) { value.SetTexture("_MainTex", (Texture)(object)val); } value.SetFloat("_Premul", rt.premul ? 1f : 0f); meshMaterials[key] = value; return value; } value = new Material(lib.meshShader) { name = "CAVfxMesh_" + cAMaterialDef.shader }; CAMeshMaterials.Configure(value, lib, cAMaterialDef); meshMaterials[key] = value; return value; } private static void RenderRigid(CAVfxSim sim, CAEmitterInstance e) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) CAEmitterRuntime rt = e.rt; Mesh val = sim.lib.MeshAt(rt.def.mesh); if ((Object)(object)val == (Object)null) { return; } Material val2 = MeshMaterialFor(sim.lib, rt.def.material, rt); if ((Object)(object)val2 == (Object)null) { return; } if (mpb == null) { mpb = new MaterialPropertyBlock(); } if ((Object)(object)e.proxy != (Object)null) { RenderProxy(sim, e, val2); return; } for (int i = 0; i < e.count; i++) { ref CAParticle reference = ref e.p[i]; float num = Mathf.Clamp01(reference.age / reference.life); Color val3 = sim.ParticleColour(e, ref reference, num); val3.a = sim.ParticleAlpha(e, ref reference, num); if (!(val3.a <= 0.0005f)) { Vector3 val4 = sim.ParticleScale(e, ref reference, num); Vector3 val5 = sim.ParticleWorld(e, reference.pos); Quaternion val6 = e.worldRot * Quaternion.Euler(reference.euler); mpb.Clear(); mpb.SetColor(ColorId, val3); mpb.SetFloat(AgeId, reference.age); mpb.SetFloat(LifeId, num); Matrix4x4 val7 = Matrix4x4.TRS(val5, val6, val4); for (int j = 0; j < val.subMeshCount; j++) { Graphics.DrawMesh(val, val7, val2, CAVfxSettings.renderLayer, CAVfxSettings.drawCamera, j, mpb, (ShadowCastingMode)0, false); } } } } private static void RenderProxy(CAVfxSim sim, CAEmitterInstance e, Material mat) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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) //IL_0116: Unknown result type (might be due to invalid IL or missing references) ref CAParticle reference = ref e.p[0]; float num = Mathf.Clamp01(reference.age / reference.life); Color val = sim.ParticleColour(e, ref reference, num); val.a = sim.ParticleAlpha(e, ref reference, num); Transform proxy = e.proxy; if (val.a <= 0.0005f) { ((Component)proxy).gameObject.SetActive(false); return; } if (!((Component)proxy).gameObject.activeSelf) { ((Component)proxy).gameObject.SetActive(true); } Vector3 val2 = sim.ParticleScale(e, ref reference, num); proxy.SetPositionAndRotation(sim.ParticleWorld(e, reference.pos), e.worldRot * Quaternion.Euler(reference.euler)); Vector3 val3 = (((Object)(object)proxy.parent != (Object)null) ? proxy.parent.lossyScale : Vector3.one); proxy.localScale = new Vector3(val2.x / val3.x, val2.y / val3.y, val2.z / val3.z); mpb.Clear(); mpb.SetColor(ColorId, val); mpb.SetFloat(AgeId, reference.age); mpb.SetFloat(LifeId, num); Renderer[] proxyRenderers = e.proxyRenderers; foreach (Renderer val4 in proxyRenderers) { if ((Object)(object)val4 == (Object)null) { continue; } if ((Object)(object)val4.sharedMaterial != (Object)(object)mat) { Material[] array = (Material[])(object)new Material[val4.sharedMaterials.Length]; for (int j = 0; j < array.Length; j++) { array[j] = mat; } val4.sharedMaterials = array; } val4.SetPropertyBlock(mpb); } } private static void RenderLights(CAVfxSim sim, CAEmitterInstance e, Transform host) { //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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)host == (Object)null) { return; } int maxLightsPerEmitter = CAVfxSettings.maxLightsPerEmitter; if (e.lights == null) { e.lights = new List<Light>(); } int num = 0; for (int i = 0; i < e.count; i++) { if (num >= maxLightsPerEmitter) { break; } ref CAParticle reference = ref e.p[i]; float lu = Mathf.Clamp01(reference.age / reference.life); Color val = sim.ParticleColour(e, ref reference, lu); float num2 = sim.ParticleAlpha(e, ref reference, lu); Vector3 val2 = sim.ParticleScale(e, ref reference, lu); if (num >= e.lights.Count) { GameObject val3 = new GameObject("CAVfxLight"); val3.transform.SetParent(host, false); Light val4 = val3.AddComponent<Light>(); val4.type = (LightType)2; val4.shadows = (LightShadows)0; e.lights.Add(val4); } Light obj = e.lights[num++]; ((Behaviour)obj).enabled = true; ((Component)obj).transform.position = sim.ParticleWorld(e, reference.pos); float num3 = Mathf.Max(val.r, Mathf.Max(val.g, val.b)); obj.color = (Color)((num3 > 0f) ? new Color(val.r / num3, val.g / num3, val.b / num3) : Color.black); obj.intensity = Mathf.Min(num3 * num2, 8f) * CAVfxSettings.lightIntensity; obj.range = Mathf.Max(0.5f, Mathf.Max(val2.x, Mathf.Max(val2.y, val2.z))); } for (int j = num; j < e.lights.Count; j++) { if ((Object)(object)e.lights[j] != (Object)null) { ((Behaviour)e.lights[j]).enabled = false; } } } } public static class CAVfxSettings { public static Camera camera; public static Camera drawCamera; public static int groundMask = -5; public static float brightness = 1f; public static float brightnessCap = 64f; public static float vectorFieldScale = 10f; public static float lightIntensity = 1f; public static float decalEmissiveBoost = 30f; public static float decalBoost = 10f; public static int maxLightsPerEmitter = 4; public static int renderLayer = 0; public static bool groundSnap = true; public static Camera Cam { get { if (!((Object)(object)camera != (Object)null)) { return Camera.main; } return camera; } } } public struct CAParticle { public Vector3 pos; public Vector3 vel; public float age; public float life; public float rnd; public float rnd2; public float rnd3; public float beginU; public Vector3 euler; public Vector3 spin; public Vector3 initScale; public float initAlpha; public Color tint; public bool flipU; public bool flipV; public int child; } public sealed class CAEmitterInstance { public readonly CAEmitterRuntime rt; public readonly CAVfxSim sim; public Matrix4x4 local; public float scale; public float start; public float life; public float simSpeed = 1f; public float rateScale = 1f; public float pLifeBias; public Color tintMin = Color.white; public Color tintMax = Color.white; public bool infinite; public float t; public float emitRnd; public float accum = 0.999f; public float burstInterval; public float burstLen; public CAParticle[] p = new CAParticle[16]; public int count; public Matrix4x4 world; public Quaternion worldRot; public Vector3 worldOrigin; public bool started; public bool burstDone; public bool muted; public Transform proxy; public Renderer[] proxyRenderers; public Mesh mesh; public Material material; public List<Light> lights; public float EmitterAge => t - start; public float EmitterUnary { get { float emitterAge = EmitterAge; if (life <= 0f) { return 1f; } if (!infinite) { return Mathf.Clamp01(emitterAge / life); } return Mathf.Repeat(emitterAge / life, 1f); } } public bool Emitting { get { if (started && !sim.stopped) { if (!infinite) { return EmitterAge < life; } return true; } return false; } } public bool Done { get { if ((started || t >= start) && !Emitting && count == 0) { if (!(EmitterAge >= life)) { return sim.stopped; } return true; } return false; } } public float TotalScale => scale * sim.scale; public CAEmitterInstance(CAEmitterRuntime rt, CAVfxSim sim) { //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_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) this.rt = rt; this.sim = sim; } } public sealed class CAVfxChild { public CAVfxSim sim; public CAEventDef ev; public CAEmitterInstance carrier; public int id; } public sealed class CAVfxSim { public readonly CAVfxLibrary lib; public readonly CAVfxDef def; public readonly List<CAEmitterInstance> emitters = new List<CAEmitterInstance>(); public readonly List<CAVfxChild> children = new List<CAVfxChild>(); public Matrix4x4 root = Matrix4x4.identity; public float scale = 1f; public Color tint = Color.white; public float intensity = 1f; public bool legacyBrightness; public bool stopped; public float time; public float timeScale = 1f; public bool killed; private int nextChildId = 1; private Random rng; public bool Alive { get { if (killed) { return false; } foreach (CAEmitterInstance emitter in emitters) { if (!emitter.Done) { return true; } } foreach (CAVfxChild child in children) { if (child.sim.Alive) { return true; } } return false; } } public bool HasInfinite { get { foreach (CAEmitterInstance emitter in emitters) { if (emitter.infinite) { return true; } } return false; } } private CAVfxChild ChildById(int id) { foreach (CAVfxChild child in children) { if (child.id == id) { return child; } } return null; } public CAVfxSim(CAVfxLibrary lib, CAVfxDef def, float scale = 1f, int seed = 0) { //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_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_008f: Unknown result type (might be due to invalid IL or missing references) this.lib = lib; this.def = def; this.scale = scale; rng = new Random((seed != 0) ? seed : Random.Range(1, int.MaxValue)); Build(def, Matrix4x4.identity, 1f, 0f, 1f, null, 0); } public float R() { return (float)rng.NextDouble(); } public float R(float a, float b) { return a + (b - a) * R(); } private void Build(CAVfxDef d, Matrix4x4 local, float s, float start, float simSpeed, CARefEmitterDef[] overrides, int depth) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) if (d == null || depth > 8) { return; } CAEmitterDef[] array = d.emitters; foreach (CAEmitterDef cAEmitterDef in array) { CARefEmitterDef cARefEmitterDef = null; if (overrides != null) { foreach (CARefEmitterDef cARefEmitterDef2 in overrides) { if (cARefEmitterDef2.name == cAEmitterDef.id) { cARefEmitterDef = cARefEmitterDef2; break; } } } if ((cARefEmitterDef == null || cARefEmitterDef.enable) && (!cAEmitterDef.HasF("Enable") || !(cAEmitterDef.F("Enable") < 0.5f))) { CAEmitterRuntime cAEmitterRuntime = CAEmitterRuntime.Of(cAEmitterDef); CAEmitterInstance cAEmitterInstance = new CAEmitterInstance(cAEmitterRuntime, this) { local = local, scale = s, simSpeed = simSpeed, start = start + R(cAEmitterRuntime.startMin, cAEmitterRuntime.startMax), infinite = cAEmitterRuntime.infinite, emitRnd = R() }; cAEmitterInstance.life = R(cAEmitterRuntime.lifeMin, cAEmitterRuntime.lifeMax); if (cARefEmitterDef != null) { cAEmitterInstance.life = Mathf.Max(0.001f, cAEmitterInstance.life + R(cARefEmitterDef.eLifeBiasMin, cARefEmitterDef.eLifeBiasMax)); cAEmitterInstance.pLifeBias = R(cARefEmitterDef.pLifeBiasMin, cARefEmitterDef.pLifeBiasMax); cAEmitterInstance.rateScale = R(cARefEmitterDef.rateMin, cARefEmitterDef.rateMax); cAEmitterInstance.tintMin = Col(cARefEmitterDef.tintMin); cAEmitterInstance.tintMax = Col(cARefEmitterDef.tintMax); } if (cAEmitterRuntime.hasBurst) { cAEmitterInstance.burstInterval = R(cAEmitterRuntime.burstIntervalMin, cAEmitterRuntime.burstIntervalMax); cAEmitterInstance.burstLen = R(cAEmitterRuntime.burstLenMin, cAEmitterRuntime.burstLenMax); } emitters.Add(cAEmitterInstance); } } CARefDef[] refs = d.refs; foreach (CARefDef cARefDef in refs) { CAVfxDef cAVfxDef = lib.Find(cARefDef.vfx); if (cAVfxDef != null) { float num = R(cARefDef.scaleMin, cARefDef.scaleMax); Matrix4x4 local2 = local * Matrix4x4.TRS(V3(cARefDef.pos), Quaternion.Euler(V3(cARefDef.rot)), Vector3.one * num); Build(cAVfxDef, local2, s * num, start + R(cARefDef.startMin, cARefDef.startMax), simSpeed * ((cARefDef.simSpeed > 0f) ? cARefDef.simSpeed : 1f), cARefDef.emitters, depth + 1); } } } private static Vector3 V3(float[] a) { //IL_0009: 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) if (a == null || a.Length < 3) { return Vector3.zero; } return new Vector3(a[0], a[1], a[2]); } private static Color Col(float[] a) { //IL_0009: 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) if (a == null || a.Length < 4) { return Color.white; } return new Color(a[0], a[1], a[2], a[3]); } public void Mute(string emitterId) { foreach (CAEmitterInstance emitter in emitters) { if (emitter.rt.def.id == emitterId) { emitter.muted = true; } } } public void Proxy(string emitterId, Transform target) { foreach (CAEmitterInstance emitter in emitters) { if (emitter.rt.def.id == emitterId && emitter.rt.def.rigid) { emitter.proxy = target; emitter.proxyRenderers = ((Component)target).GetComponentsInChildren<Renderer>(true); } } } public void Step(float dt) { dt *= timeScale; if (dt <= 0f) { return; } time += dt; foreach (CAEmitterInstance emitter in emitters) { StepEmitter(emitter, dt * emitter.simSpeed); } for (int num = children.Count - 1; num >= 0; num--) { CAVfxChild cAVfxChild = children[num]; UpdateChildLink(cAVfxChild); cAVfxChild.sim.Step(dt); if (!cAVfxChild.sim.Alive) { children.RemoveAt(num); } } } private void ComputeFrame(CAEmitterInstance e) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_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_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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) CAEmitterRuntime rt = e.rt; float emitterUnary = e.EmitterUnary; Vector3 val = rt.SampleV(rt.emitterPos, emitterUnary, e.emitRnd, Vector3.zero); Vector3 val2 = rt.SampleV(rt.emitterOrient, emitterUnary, e.emitRnd, Vector3.zero); e.world = root * Matrix4x4.Scale(Vector3.one * scale) * e.local * Matrix4x4.TRS(val, Quaternion.Euler(val2), Vector3.one); e.worldOrigin = ((Matrix4x4)(ref e.world)).MultiplyPoint3x4(Vector3.zero); e.worldRot = ((Matrix4x4)(ref e.world)).rotation; } private void StepEmitter(CAEmitterInstance e, float dt) { e.t += dt; if (e.t < e.start) { return; } if (!e.started) { e.started = true; } CAEmitterRuntime rt = e.rt; ComputeFrame(e); if (e.Emitting && rt.rate == null) { if (!e.burstDone) { e.burstDone = true; int num = Mathf.Min((rt.maxParticles >= 4000) ? 1 : rt.maxParticles,