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 VikingMushrooms v0.5.3
BepInEx/plugins/VikingMushrooms/VikingMushrooms.dll
Decompiled 3 days 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.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Animations; using UnityEngine.Audio; using UnityEngine.Playables; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using VikingMushrooms.Model; using VikingMushrooms.Systems; [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("VikingMushrooms")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.5.2.0")] [assembly: AssemblyInformationalVersion("0.5.2")] [assembly: AssemblyProduct("VikingMushrooms")] [assembly: AssemblyTitle("VikingMushrooms")] [assembly: AssemblyVersion("0.5.2.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 VikingMushrooms { internal static class ModConfig { private static readonly Dictionary<string, ConfigEntryBase> Entries = new Dictionary<string, ConfigEntryBase>(); private static ConfigFile File; internal static bool B(string key) { return ((ConfigEntry<bool>)(object)Entries[key]).Value; } internal static float F(string key) { float value = ((ConfigEntry<float>)(object)Entries[key]).Value; if (!float.IsNaN(value) && !float.IsInfinity(value)) { return value; } return (float)Entries[key].DefaultValue; } internal static string S(string key) { return ((ConfigEntry<string>)(object)Entries[key]).Value; } internal static void Set(string key, string value) { ((ConfigEntry<string>)(object)Entries[key]).Value = value; } private static void Bind<T>(string key, T value, string description = "") { int num = key.IndexOf('.'); Entries[key] = (ConfigEntryBase)(object)File.Bind<T>(key.Substring(0, num), key.Substring(num + 1), value, description); } private static void Number(string key, float value, float min = 0f, float max = 10000f) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown int num = key.IndexOf('.'); Entries[key] = (ConfigEntryBase)(object)File.Bind<float>(key.Substring(0, num), key.Substring(num + 1), value, new ConfigDescription("See docs/CONFIG_SPEC.md. Changes apply locally; use matching gameplay settings on all clients.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>())); } internal static void Bind(ConfigFile config) { File = config; VisualFxLab.BindSettings(Number); Bind("General.Enabled", value: true); Bind("General.DebugLogging", value: false); Bind("General.EnableFxLab", value: false, "Enable the optional F8 visual testing panel. Only released trances are available."); Bind("General.AllowTranceReplacement", value: true); Bind("General.Language", "es", "HUD language: es or en."); Bind("Items.LogUnmappedMushroomLikeItems", value: true); string[] array = new string[6] { "RedMushroom", "YellowMushroom", "Magecap", "JotunPuff", "SmokePuff", "Toadstool" }; foreach (string text in array) { Bind("Items." + text + "Prefab", "", "Exact ObjectDB prefab ID. Empty: use the asset-manifest candidate, then validate against ObjectDB. Unknown candidates are never mapped."); } Bind("Berserker.RequireNoMetalChest", value: true); Bind("Berserker.RequireRestrictionThroughoutTrance", value: true); Bind("Berserker.BlockedChestPrefabs", "ArmorBronzeChest,ArmorIronChest,ArmorWolfChest,ArmorPaddedCuirass,ArmorCarapaceChest,ArmorFlametalChest", "Comma-separated exact chest prefab IDs, verified in the installed asset manifest. Add custom or new metal armor explicitly; no guessed isMetal flag."); Number("Berserker.HealthFloor", 1f, 0.1f, 10f); Number("Berserker.DebtMaxHealthFactor", 1f, 0.01f, 10f); Number("Berserker.MaxMeleeDamageBonus", 0.5f, 0f, 5f); Number("Berserker.MaxAttackSpeedBonus", 0.3f, 0f, 2f); Number("Berserker.MaxMoveSpeedBonus", 0.1f, 0f, 2f); Number("Berserker.MaxStaggerResistanceBonus", 0.75f, 0f, 1f); Number("Berserker.HealingDebtEfficiency", 0.5f, 0f, 1f); Number("Berserker.LastBreathSeconds", 5f, 0.1f, 60f); Number("HelVision.Range", 22f, 1f, 100f); Number("HelVision.PulseInterval", 2f, 0.2f, 60f); Number("HelVision.HighlightSeconds", 0.8f, 0.1f, 5f); Bind("HelVision.RequireLineOfSight", value: false); Number("HelVision.PhantomRatePerMinute", 8f, 0f, 60f); Bind("EitrOverload.CapacityMode", "MaxOf100OrMaxEitr", "Fixed or MaxOf100OrMaxEitr."); Number("EitrOverload.FixedCapacity", 100f, 1f); Number("EitrOverload.MaxMagicDamageBonus", 0.4f, 0f, 5f); Number("EitrOverload.MaxCastSpeedBonus", 0.2f, 0f, 2f); Number("EitrOverload.MaxEitrRegenBonus", 0.3f, 0f, 5f); Number("EitrOverload.RuptureStaminaDrainFraction", 0.8f, 0f, 1f); Number("EitrOverload.RuptureEitrRegenPenaltySeconds", 6f, 0f, 60f); Number("EitrOverload.RuptureSelfDamage", 0f); Number("Jotunn.CarryWeightBonus", 150f); Number("Jotunn.BaseMoveSpeedPenalty", 0.05f, 0f, 0.9f); Number("Jotunn.MomentumMax", 100f, 1f); Number("Jotunn.MomentumGainPerSecond", 18f); Number("Jotunn.MomentumDecayDelay", 0.75f); Number("Jotunn.MomentumDecayPerSecond", 12f); Number("Jotunn.MaxBonusPush", 2f, 0f, 10f); Number("Jotunn.MaxBonusStagger", 1f, 0f, 10f); Number("Jotunn.KnockbackResistance", 0.75f, 0f, 1f); Number("Jotunn.StaggerResistance", 0.5f, 0f, 1f); Number("AshBody.DensityMax", 100f, 1f); Number("AshBody.DamagePreventionFraction", 0.35f, 0f, 1f); Number("AshBody.DensityCostPerPreventedDamage", 1f, 0.01f, 100f); Number("AshBody.RegenDelay", 4f); Number("AshBody.RegenPerSecond", 12f); Bind("AshBody.EnableDodgeRestore", value: false); Number("AshBody.DodgeRestore", 15f); Number("Delirium.BenefitMagnitudeScale", 1f, 0f, 3f); Number("Delirium.DrawbackMagnitudeScale", 1f, 0f, 2f); Bind("Delirium.AvoidExactInversePairs", value: true); Bind("Visual.PreferValheimAssets", value: true, "Read native particle materials and audio clips at runtime; never clone gameplay prefabs."); Number("Audio.Volume", 0.25f, 0f, 1f); Number("Visual.HallucinationIntensity", 1f, 0f, 1f); Number("Visual.DistortionGain", 4f, 0f, 8f); Bind("Visual.EnablePostProcessing", value: true, "Local fullscreen shader for Delirium prototype. Does not modify shared postprocessing profiles."); Bind("Visual.EnablePhantomSilhouettes", value: true); Bind("Visual.EnablePhantomAudio", value: true); Bind("Visual.EnableFOVEffects", value: true); Bind("Visual.EnableCameraShake", value: true); Bind("Visual.EnableCameraSway", value: true); Bind("Visual.EnableCameraRoll", value: true); Bind("Visual.EnableScreenDistortion", value: true); Bind("Visual.EnableColorGrading", value: true); Bind("Visual.EnableGammaShift", value: true); Bind("Visual.EnableAfterimages", value: true); Bind("Visual.EnableDoubleVision", value: true); Bind("Hud.ShowTranceStatus", value: true); Bind("Hud.ShowResourceMeters", value: true); Bind("Visual.EnableChromaticEffects", value: true, "RGB separation in the Delirium fullscreen shader."); Number("Visual.MaxLocalPhantoms", 6f, 0f, 20f); Number("Hud.Scale", 1f, 0.5f, 2f); Bind("Hud.Enabled", value: true); Number("Hud.DebtBarGap", 10f, 0f, 200f); Bind("Hud.DebtAvoidOverlap", value: true, "Keep the debt bar above health, avoiding existing stamina/eitr/adrenaline bars. Does not move vanilla bars."); } } [BepInPlugin("TheLionCid.VikingMushrooms", "Viking mushrooms", "0.5.2")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "TheLionCid.VikingMushrooms"; public const string PluginName = "Viking mushrooms"; public const string PluginVersion = "0.5.2"; internal static ManualLogSource Log; private Harmony harmony; private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; ModConfig.Bind(((BaseUnityPlugin)this).Config); if (((object)Version.CurrentVersion/*cast due to .constrained prefix*/).ToString() != "1.0.16") { Log.LogError((object)("Unsupported Valheim version: " + ((object)Version.CurrentVersion/*cast due to .constrained prefix*/).ToString() + ". Inspected version: 1.0.16. Gameplay patches disabled.")); ((Behaviour)this).enabled = false; return; } harmony = new Harmony("TheLionCid.VikingMushrooms"); try { harmony.PatchAll(typeof(Plugin).Assembly); } catch (Exception ex) { harmony.UnpatchSelf(); ((Behaviour)this).enabled = false; Log.LogError((object)("Patch installation failed; rolled back: " + ex)); return; } PrefabRegistry.Resolve(ObjectDB.instance); Log.LogInfo((object)"Viking mushrooms 0.5.2 loaded. Owner-authoritative gameplay; client-local presentation."); } private void Update() { MushroomEffectManager.Tick(Time.deltaTime); VisualFxLab.Tick(); } private void LateUpdate() { BloodDebtHud.Tick(); TranceStatusHud.Tick(); SecondaryResourceHud.Tick(); BerserkPresentation.LateTick(); HelPresentation.LateTick(); } private void OnGUI() { HudSystem.Draw(); VisualFxLab.Draw(); } private void OnDisable() { HallucinationSystem.Clear(); VisualFxLab.Clear(); TranceStatusHud.Clear(); SecondaryResourceHud.Clear(); BloodDebtHud.Clear(); } private void OnDestroy() { MushroomEffectManager.Clear(); BloodDebtHud.Clear(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } } namespace VikingMushrooms.Systems { internal static class BerserkPresentation { private sealed class Part { internal Renderer Source; internal Mesh Mesh; internal readonly List<int> EyeSubmeshes = new List<int>(); } private sealed class EyeBinding { internal Transform Anchor; internal Transform Glow; internal Renderer Native; } private sealed class Aura { internal Character Source; internal GameObject Root; internal readonly List<EyeBinding> Eyes = new List<EyeBinding>(); internal readonly List<Part> Parts = new List<Part>(); } private sealed class Event { internal GameObject Root; internal GameObject Rig; internal Material Material; internal readonly List<EyeBinding> Eyes = new List<EyeBinding>(); internal readonly List<Renderer> Renderers = new List<Renderer>(); internal readonly Dictionary<Transform, Transform> Bones = new Dictionary<Transform, Transform>(); internal AnimationClip Run; internal Vector3 Origin; internal Vector3 Velocity; internal float Start; internal float Duration; internal float Spin; internal bool Boar; internal PlayableGraph Animation; internal bool Crossed; } private static readonly Dictionary<Character, Aura> Auras = new Dictionary<Character, Aura>(); private static readonly List<Event> Events = new List<Event>(); private static readonly MaterialPropertyBlock Block = new MaterialPropertyBlock(); private static Material AuraMaterial; private static Material PlayerAuraMaterial; private static Material EyeMaterial; private static Material EyeSurfaceMaterial; private static Material TrailMaterial; private static Mesh Quad; private static float StressStarted = -100f; private static float NextStress; private static CommandBuffer AuraCommands; private static Camera AuraCamera; private static float NextScan; private static float NextRune; private static float NextBoar; private static int RuneIndex; private static bool LoggedRun; private static readonly HashSet<string> LoggedEyeModels = new HashSet<string>(); internal static float CrossingStress { get { float num = Time.time - StressStarted; if (!(num < 0f) && !(num >= 0.8f)) { return Mathf.SmoothStep(0f, 1f, num / 0.07f) * (1f - Mathf.SmoothStep(0.07f, 0.8f, num)); } return 0f; } } internal static bool Active => Events.Count > 0; private static void Destroy(Object value) { GameObject val = (GameObject)(object)((value is GameObject) ? value : null); if (val != null) { val.SetActive(false); } if (Object.op_Implicit(value)) { Object.Destroy(value); } } private static void Dispose(Event e) { if (((PlayableGraph)(ref e.Animation)).IsValid()) { ((PlayableGraph)(ref e.Animation)).Destroy(); } Destroy((Object)(object)e.Root); Destroy((Object)(object)e.Material); } private static void Dispose(Aura aura) { Destroy((Object)(object)aura.Root); } internal static void Clear() { ReleaseCommands(); foreach (Aura value in Auras.Values) { Dispose(value); } Auras.Clear(); foreach (Event @event in Events) { Dispose(@event); } Events.Clear(); Destroy((Object)(object)AuraMaterial); Destroy((Object)(object)EyeMaterial); Destroy((Object)(object)EyeSurfaceMaterial); Destroy((Object)(object)TrailMaterial); Destroy((Object)(object)Quad); Destroy((Object)(object)PlayerAuraMaterial); PlayerAuraMaterial = null; StressStarted = -100f; NextStress = 0f; AuraMaterial = (EyeMaterial = (EyeSurfaceMaterial = (TrailMaterial = null))); Quad = null; NextScan = (NextRune = (NextBoar = 0f)); } private static void ReleaseCommands() { if (Object.op_Implicit((Object)(object)AuraCamera) && AuraCommands != null) { AuraCamera.RemoveCommandBuffer((CameraEvent)17, AuraCommands); } if (AuraCommands != null) { AuraCommands.Release(); } AuraCommands = null; AuraCamera = null; } private static bool Ensure() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_014b: 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_0166: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)AuraMaterial)) { return true; } Shader val = FxBundle.Load<Shader>("Assets/BerserkSpectral.shader"); if (!Object.op_Implicit((Object)(object)val) || !val.isSupported) { return false; } AuraMaterial = new Material(val) { hideFlags = (HideFlags)61 }; AuraMaterial.SetFloat("_Shell", 0f); AuraMaterial.SetFloat("_Body", 0.015f); AuraMaterial.SetFloat("_VM_AuraOnly", 1f); PlayerAuraMaterial = new Material(AuraMaterial); PlayerAuraMaterial.SetFloat("_VM_PlayerContour", 1f); EyeSurfaceMaterial = new Material(AuraMaterial); EyeSurfaceMaterial.SetFloat("_VM_AuraOnly", 2f); EyeMaterial = new Material(val) { hideFlags = (HideFlags)61 }; EyeMaterial.SetFloat("_Glow", 1f); TrailMaterial = new Material(val) { hideFlags = (HideFlags)61 }; TrailMaterial.SetFloat("_Body", 1f); TrailMaterial.SetFloat("_UseVertexColor", 1f); Mesh val2 = new Mesh(); ((Object)val2).name = "VM.BerserkQuad"; val2.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f, 0f), new Vector3(0.5f, -0.5f, 0f), new Vector3(0.5f, 0.5f, 0f), new Vector3(-0.5f, 0.5f, 0f) }; val2.uv = (Vector2[])(object)new Vector2[4] { Vector2.zero, Vector2.right, Vector2.one, Vector2.up }; val2.triangles = new int[6] { 0, 2, 1, 0, 3, 2 }; Quad = val2; Quad.RecalculateNormals(); Quad.RecalculateBounds(); return true; } internal static void Tick(Player player, float intensity) { if (!Object.op_Implicit((Object)(object)player) || intensity <= 0f || !ModConfig.B("Visual.EnablePhantomSilhouettes")) { Clear(); } else if (Ensure() && Object.op_Implicit((Object)(object)Camera.main)) { if (Time.time >= NextScan) { NextScan = Time.time + 0.8f; Scan(player); } int num = Mathf.Clamp((int)ModConfig.F("Visual.MaxLocalPhantoms"), 0, 3); if (!Events.Exists((Event e) => e.Boar) && Events.Count < num && Time.time >= NextBoar && intensity >= 0.18f) { NextBoar = Time.time + Random.Range(7f, 15f) * Mathf.Lerp(1.15f, 0.7f, intensity); SpawnBoar(player); } if (Events.Count < num && Time.time >= NextRune) { NextRune = Time.time + Random.Range(2.5f, 4.2f); SpawnRune(player); } } } internal static void LateTick() { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || !Object.op_Implicit((Object)(object)AuraMaterial) || !Object.op_Implicit((Object)(object)Camera.main)) { return; } float intensity = VisualFxLab.Intensity; if (intensity <= 0f) { CommandBuffer auraCommands = AuraCommands; if (auraCommands != null) { auraCommands.Clear(); } return; } try { UpdateAuras(Player.m_localPlayer, intensity); UpdateEvents(intensity); } catch (Exception ex) { Clear(); Plugin.Log.LogWarning((object)("Berserk late presentation stopped: " + ex)); } } private static void Scan(Player player) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) List<Character> list = new List<Character>(); foreach (Character allCharacter in Character.GetAllCharacters()) { if (Object.op_Implicit((Object)(object)allCharacter) && !allCharacter.IsDead() && Vector3.SqrMagnitude(((Component)allCharacter).transform.position - ((Component)player).transform.position) < 576f) { list.Add(allCharacter); } } list.Sort((Character a, Character b) => (!((Object)(object)a == (Object)(object)b)) ? ((!((Object)(object)a == (Object)(object)player)) ? (((Object)(object)b == (Object)(object)player) ? 1 : Vector3.SqrMagnitude(((Component)a).transform.position - ((Component)player).transform.position).CompareTo(Vector3.SqrMagnitude(((Component)b).transform.position - ((Component)player).transform.position))) : (-1)) : 0); if (list.Count > 8) { list.RemoveRange(8, list.Count - 8); } List<Character> list2 = new List<Character>(); foreach (KeyValuePair<Character, Aura> aura in Auras) { if (!Object.op_Implicit((Object)(object)aura.Key) || !list.Contains(aura.Key)) { Dispose(aura.Value); list2.Add(aura.Key); } } foreach (Character item in list2) { Auras.Remove(item); } foreach (Character item2 in list) { if (!Auras.ContainsKey(item2)) { Auras.Add(item2, MakeAura(item2)); } } } private static void Setup(Renderer renderer, Material material, int count = 1) { Material[] array = (Material[])(object)new Material[Mathf.Max(1, count)]; for (int i = 0; i < array.Length; i++) { array[i] = material; } renderer.sharedMaterials = array; renderer.shadowCastingMode = (ShadowCastingMode)0; renderer.receiveShadows = false; renderer.lightProbeUsage = (LightProbeUsage)0; renderer.reflectionProbeUsage = (ReflectionProbeUsage)0; } private static Aura MakeAura(Character character) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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) Aura aura = new Aura { Source = character, Root = new GameObject("VM.Local.CrimsonAura") }; Renderer[] componentsInChildren = ((Component)character).GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (aura.Parts.Count >= 8) { break; } Mesh val2 = null; SkinnedMeshRenderer val3 = (SkinnedMeshRenderer)(object)((val is SkinnedMeshRenderer) ? val : null); if (val3 != null && Object.op_Implicit((Object)(object)val3.sharedMesh) && val3.sharedMesh.vertexCount < 100000) { val2 = val3.sharedMesh; } else if (val is MeshRenderer) { MeshFilter component = ((Component)val).GetComponent<MeshFilter>(); if (component != null && Object.op_Implicit((Object)(object)component.sharedMesh)) { val2 = component.sharedMesh; } } if (!Object.op_Implicit((Object)(object)val2)) { continue; } Part part = new Part { Source = val, Mesh = val2 }; _ = val.sharedMaterials; Bounds bounds = val.bounds; float num = Mathf.Max(0.2f, character.GetCenterPoint().y - ((Component)character).transform.position.y) * 2f; Vector3 size = ((Bounds)(ref bounds)).size; if (((Vector3)(ref size)).magnitude < Mathf.Min(0.25f, num * 0.18f) && ((Bounds)(ref bounds)).center.y > ((Component)character).transform.position.y + num * 0.55f && IsEyeName(((Object)val).name)) { for (int j = 0; j < val2.subMeshCount; j++) { part.EyeSubmeshes.Add(j); } } aura.Parts.Add(part); if (part.EyeSubmeshes.Count == val2.subMeshCount) { Transform transform = new GameObject("VM.NativeEyeTrail").transform; transform.SetParent(aura.Root.transform, false); Bounds bounds2 = val.bounds; transform.position = ((Bounds)(ref bounds2)).center; AddTrail(((Component)transform).gameObject, 0.42f, 0.045f); aura.Eyes.Add(new EyeBinding { Native = val, Glow = transform }); } } if (!aura.Parts.Exists((Part p) => p.EyeSubmeshes.Count > 0)) { Transform[] componentsInChildren2 = ((Component)character).GetComponentsInChildren<Transform>(true); foreach (Transform val4 in componentsInChildren2) { if (!((Object)(object)val4 == (Object)(object)character.m_eye) && IsEyeSocket(((Object)val4).name)) { aura.Eyes.Add(MakeEye(val4, aura.Root.transform)); if (aura.Eyes.Count >= 2) { break; } } } } if (LoggedEyeModels.Add(((Object)((Component)character).gameObject).name)) { Plugin.Log.LogInfo((object)("Berserk anatomical eyes: " + ((Object)((Component)character).gameObject).name + "; eye renderers=" + aura.Parts.FindAll((Part p) => p.EyeSubmeshes.Count > 0).Count + "; anchors/trails=" + aura.Eyes.Count + "; unresolved eye placements are suppressed")); } return aura; } private static bool IsEyeName(string name) { name = name.ToLowerInvariant(); if (name.Contains("eye") && !name.Contains("brow") && !name.Contains("lash")) { return !name.Contains("lid"); } return false; } private static bool IsEyeSocket(string name) { name = name.ToLowerInvariant().Replace(" ", ""); switch (name) { default: return name == "eyeball_r"; case "eye.l": case "eye.r": case "eye_l": case "eye_r": case "lefteye": case "righteye": case "eyeleft": case "eyeright": case "eyeball_l": return true; } } private static void UpdateAuras(Player player, float intensity) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0089: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)AuraCamera != (Object)(object)Camera.main || AuraCommands == null) { ReleaseCommands(); AuraCamera = Camera.main; AuraCommands = new CommandBuffer { name = "VikingMushrooms.NativeRendererAura" }; AuraCamera.AddCommandBuffer((CameraEvent)17, AuraCommands); } AuraCommands.Clear(); AuraMaterial.SetColor("_VM_AuraTint", new Color(2.8f, 0.035f, 0.008f, intensity * 0.64f * (0.8f + 0.2f * TranceAudio.BerserkPulse))); PlayerAuraMaterial.SetColor("_VM_AuraTint", new Color(1.05f, 0.012f, 0.06f, intensity * 0.38f)); EyeSurfaceMaterial.SetColor("_VM_AuraTint", new Color(4f, 0.025f, 0.004f, intensity * 0.75f)); foreach (Aura value in Auras.Values) { if (!Object.op_Implicit((Object)(object)value.Source) || value.Source.IsDead()) { value.Root.SetActive(false); continue; } float num = 1f - Mathf.Clamp01(Vector3.Distance(((Component)player).transform.position, ((Component)value.Source).transform.position) / 26f); Block.Clear(); Block.SetColor("_Color", new Color(2.8f, 0.035f, 0.008f, intensity * (0.36f + 0.4f * num) * (0.8f + 0.2f * TranceAudio.BerserkPulse))); bool visible = false; foreach (Part part in value.Parts) { if (!Object.op_Implicit((Object)(object)part.Source) || !part.Source.enabled || !((Component)part.Source).gameObject.activeInHierarchy || !part.Source.isVisible) { continue; } visible = true; for (int i = 0; i < part.Mesh.subMeshCount; i++) { AuraCommands.DrawRenderer(part.Source, ((Object)(object)value.Source == (Object)(object)player) ? PlayerAuraMaterial : AuraMaterial, i, 0); } foreach (int eyeSubmesh in part.EyeSubmeshes) { AuraCommands.DrawRenderer(part.Source, EyeSurfaceMaterial, eyeSubmesh, 0); } } UpdateEyes(value.Eyes, intensity, visible); } } private static EyeBinding MakeEye(Transform socket, Transform parent) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Transform transform = new GameObject("VM.AnatomicalEye", new Type[2] { typeof(MeshFilter), typeof(MeshRenderer) }).transform; transform.SetParent(parent, false); transform.localScale = Vector3.one * 0.045f; transform.position = socket.position; ((Component)transform).GetComponent<MeshFilter>().sharedMesh = Quad; Setup((Renderer)(object)((Component)transform).GetComponent<MeshRenderer>(), EyeMaterial); AddTrail(((Component)transform).gameObject, 0.42f, 0.04f); return new EyeBinding { Anchor = socket, Glow = transform }; } private static TrailRenderer AddTrail(GameObject root, float lifetime, float width) { //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_005a: 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) GameObject val = new GameObject("RedMotionTrail"); val.transform.SetParent(root.transform, false); TrailRenderer obj = val.AddComponent<TrailRenderer>(); ((Renderer)obj).sharedMaterial = TrailMaterial; obj.time = lifetime; obj.startWidth = width; obj.endWidth = 0f; obj.startColor = new Color(1.35f, 0.15f, 0.12f, 0.9f); obj.endColor = new Color(1f, 0.02f, 0.04f, 0f); obj.minVertexDistance = 0.01f; obj.generateLightingData = true; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; obj.Clear(); return obj; } private static void UpdateEyes(List<EyeBinding> eyes, float intensity, bool visible = true) { //IL_0036: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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) Block.Clear(); Block.SetColor("_Color", new Color(4f, 0.025f, 0.004f, intensity * (0.85f + 0.15f * TranceAudio.BerserkPulse))); foreach (EyeBinding eye in eyes) { bool flag = visible && (Object.op_Implicit((Object)(object)eye.Anchor) || Object.op_Implicit((Object)(object)eye.Native)); ((Component)eye.Glow).gameObject.SetActive(flag); if (flag) { Vector3 val; if (!Object.op_Implicit((Object)(object)eye.Anchor)) { Bounds bounds = eye.Native.bounds; val = ((Bounds)(ref bounds)).center; } else { val = eye.Anchor.position; } Vector3 val2 = val; TrailRenderer componentInChildren = ((Component)eye.Glow).GetComponentInChildren<TrailRenderer>(); Vector3 val3 = val2 - eye.Glow.position; if (((Vector3)(ref val3)).sqrMagnitude > 4f) { componentInChildren.Clear(); } eye.Glow.position = val2; eye.Glow.rotation = ((Component)Camera.main).transform.rotation; Renderer[] componentsInChildren = ((Component)eye.Glow).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].SetPropertyBlock(Block); } } } } private static Event NewEvent(bool boar) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown Event obj = new Event { Root = new GameObject(boar ? "VM.Local.SpectralBoar" : "VM.Local.WarRune"), Boar = boar, Start = Time.time, Duration = (boar ? 3.2f : Random.Range(3.3f, 4.7f)), Spin = Random.Range(-24f, 24f), Material = new Material(AuraMaterial) }; obj.Material.SetFloat("_Shell", 0f); obj.Material.SetFloat("_VM_AuraOnly", 0f); obj.Material.SetFloat("_VM_BoarGlow", (float)(boar ? 1 : 0)); Events.Add(obj); return obj; } private static void SpawnRune(Player player) { //IL_005b: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) Texture2D val = VisualAssetCatalog.Texture((RuneIndex++ % 2 == 0) ? "VM_Berserk_RuneStrength" : "VM_Berserk_RuneWar"); if (Object.op_Implicit((Object)(object)val)) { Event obj = NewEvent(boar: false); obj.Material.SetTexture("_MainTex", (Texture)(object)val); obj.Material.SetFloat("_UseTexture", 1f); obj.Origin = ((Character)player).GetCenterPoint() + ((Component)Camera.main).transform.forward * Random.Range(4f, 8f) + ((Component)Camera.main).transform.right * Random.Range(-4f, 4f) + Vector3.up * Random.Range(-0.2f, 1.5f); obj.Velocity = ((Component)Camera.main).transform.forward * Random.Range(-0.3f, 0.3f) + Vector3.up * 0.12f; GameObject val2 = new GameObject("Rune", new Type[2] { typeof(MeshFilter), typeof(MeshRenderer) }); val2.transform.SetParent(obj.Root.transform, false); val2.transform.localScale = Vector3.one * Random.Range(0.9f, 1.6f); val2.GetComponent<MeshFilter>().sharedMesh = Quad; MeshRenderer component = val2.GetComponent<MeshRenderer>(); Setup((Renderer)(object)component, obj.Material); obj.Renderers.Add((Renderer)(object)component); } } private static Transform CopyRig(Transform source, Transform parent, Dictionary<Transform, Transform> map) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown Transform transform = new GameObject(((Object)source).name).transform; transform.SetParent(parent, false); transform.localPosition = source.localPosition; transform.localRotation = source.localRotation; transform.localScale = source.localScale; map.Add(source, transform); foreach (Transform item in source) { CopyRig(item, transform, map); } return transform; } private static bool Ground(Vector3 position, out Vector3 grounded) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_004e: 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) RaycastHit val = default(RaycastHit); bool flag = Physics.Raycast(position + Vector3.up * 12f, Vector3.down, ref val, 30f, LayerMask.GetMask(new string[3] { "terrain", "static_solid", "piece" })); grounded = (flag ? ((RaycastHit)(ref val)).point : position); return flag; } private static void SpawnBoar(Player player) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_011e: 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_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_0134: 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_018e: 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_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) GameObject val = (Object.op_Implicit((Object)(object)ZNetScene.instance) ? ZNetScene.instance.GetPrefab("Boar") : null); if (!Object.op_Implicit((Object)(object)val)) { return; } float num = ((!(Random.value < 0.5f)) ? 1 : (-1)); Vector3 val2 = Vector3.ProjectOnPlane(((Component)Camera.main).transform.right, Vector3.up); Vector3 normalized = ((Vector3)(ref val2)).normalized; val2 = Vector3.ProjectOnPlane(((Component)Camera.main).transform.forward, Vector3.up); Vector3 normalized2 = ((Vector3)(ref val2)).normalized; float num2 = ((Random.value < 0.3f) ? Random.Range(-0.3f, 0.3f) : Random.Range(6f, 12f)); Vector3 grounded = ((Component)player).transform.position + normalized2 * num2 + normalized * num * 11f; if (!Ground(grounded, out grounded) || !Ground(grounded - normalized * num * 22f, out var _)) { return; } Event obj = NewEvent(boar: true); obj.Origin = grounded; obj.Velocity = -normalized * num * 7f; obj.Root.transform.rotation = Quaternion.LookRotation(obj.Velocity); obj.Material.SetFloat("_Body", 0.24f); Transform val3 = CopyRig(val.transform, obj.Root.transform, obj.Bones); val3.localPosition = Vector3.zero; val3.localRotation = Quaternion.identity; val3.localScale = val.transform.localScale * 1.75f; obj.Rig = ((Component)val3).gameObject; SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val4 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val4.sharedMesh)) { SkinnedMeshRenderer val5 = ((Component)obj.Bones[((Component)val4).transform]).gameObject.AddComponent<SkinnedMeshRenderer>(); val5.sharedMesh = val4.sharedMesh; Transform[] bones = val4.bones; for (int j = 0; j < bones.Length; j++) { bones[j] = ((Object.op_Implicit((Object)(object)bones[j]) && obj.Bones.TryGetValue(bones[j], out var value)) ? value : null); } val5.bones = bones; val5.rootBone = ((Object.op_Implicit((Object)(object)val4.rootBone) && obj.Bones.TryGetValue(val4.rootBone, out var value2)) ? value2 : val3); ((Renderer)val5).localBounds = ((Renderer)val4).localBounds; val5.updateWhenOffscreen = true; Setup((Renderer)(object)val5, obj.Material, val4.sharedMesh.subMeshCount); obj.Renderers.Add((Renderer)(object)val5); } } Animator componentInChildren = val.GetComponentInChildren<Animator>(true); if (Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren.runtimeAnimatorController)) { AnimationClip[] animationClips = componentInChildren.runtimeAnimatorController.animationClips; foreach (AnimationClip val6 in animationClips) { if (Object.op_Implicit((Object)(object)val6) && ((Object)val6).name.IndexOf("run", StringComparison.OrdinalIgnoreCase) >= 0) { obj.Run = val6; obj.Rig = ((Component)obj.Bones[((Component)componentInChildren).transform]).gameObject; break; } } } if (!Object.op_Implicit((Object)(object)obj.Run) || !Object.op_Implicit((Object)(object)componentInChildren)) { Plugin.Log.LogWarning((object)("Boar apparition skipped: no native run clip. Available=" + ((Object.op_Implicit((Object)(object)componentInChildren) && Object.op_Implicit((Object)(object)componentInChildren.runtimeAnimatorController)) ? string.Join(", ", Array.ConvertAll(componentInChildren.runtimeAnimatorController.animationClips, (AnimationClip c) => (!Object.op_Implicit((Object)(object)c)) ? "null" : ((Object)c).name)) : "no controller"))); Dispose(obj); Events.Remove(obj); return; } Animator val7 = obj.Rig.AddComponent<Animator>(); val7.avatar = componentInChildren.avatar; val7.applyRootMotion = false; val7.fireEvents = false; val7.cullingMode = (AnimatorCullingMode)0; obj.Animation = PlayableGraph.Create("VM.BoarRun.Local"); ((PlayableGraph)(ref obj.Animation)).SetTimeUpdateMode((DirectorUpdateMode)3); AnimationPlayableOutput val8 = AnimationPlayableOutput.Create(obj.Animation, "Run", val7); AnimationClipPlayable val9 = AnimationClipPlayable.Create(obj.Animation, obj.Run); ((AnimationClipPlayable)(ref val9)).SetApplyFootIK(false); ((AnimationClipPlayable)(ref val9)).SetApplyPlayableIK(false); PlayableOutputExtensions.SetSourcePlayable<AnimationPlayableOutput, AnimationClipPlayable>(val8, val9); ((PlayableGraph)(ref obj.Animation)).Play(); ((PlayableGraph)(ref obj.Animation)).Evaluate(0f); if (!LoggedRun) { LoggedRun = true; Plugin.Log.LogInfo((object)("Boar visual animation: clip=" + ((Object)obj.Run).name + "; duration=" + obj.Run.length + "; avatar=" + (Object.op_Implicit((Object)(object)val7.avatar) ? ((Object)val7.avatar).name : "none") + "; local PlayableGraph, events disabled")); } Character component = val.GetComponent<Character>(); foreach (KeyValuePair<Transform, Transform> bone in obj.Bones) { if ((!Object.op_Implicit((Object)(object)component) || (Object)(object)bone.Key != (Object)(object)component.m_eye) && IsEyeSocket(((Object)bone.Key).name)) { obj.Eyes.Add(MakeEye(bone.Value, obj.Root.transform)); if (obj.Eyes.Count >= 2) { break; } } } if (obj.Renderers.Count == 0) { Dispose(obj); Events.Remove(obj); return; } obj.Root.transform.position = grounded; Transform transform = new GameObject("VM.BoarTrail").transform; transform.SetParent(obj.Root.transform, false); Bounds bounds = obj.Renderers[0].bounds; transform.position = ((Bounds)(ref bounds)).center; obj.Renderers.Add((Renderer)(object)AddTrail(((Component)transform).gameObject, 0.4f, 0.24f)); } private static void UpdateEvents(float intensity) { //IL_0075: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0189: 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_0190: 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_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) for (int num = Events.Count - 1; num >= 0; num--) { Event obj = Events[num]; float num2 = Time.time - obj.Start; if (num2 >= obj.Duration) { Dispose(obj); Events.RemoveAt(num); continue; } float num3 = Mathf.SmoothStep(0f, 1f, Mathf.Min(num2 / 0.35f, (obj.Duration - num2) / 0.65f)); Vector3 grounded = obj.Origin + obj.Velocity * num2; if (obj.Boar) { if (!Ground(grounded, out grounded)) { Dispose(obj); Events.RemoveAt(num); continue; } if (((PlayableGraph)(ref obj.Animation)).IsValid()) { ((PlayableGraph)(ref obj.Animation)).Evaluate(Time.deltaTime); } grounded += Vector3.up * 0.03f; } else { obj.Root.transform.rotation = ((Component)Camera.main).transform.rotation * Quaternion.Euler(0f, 0f, obj.Spin * num2); } if (obj.Boar && !obj.Crossed && Object.op_Implicit((Object)(object)Player.m_localPlayer)) { Vector3 position = obj.Root.transform.position; Vector3 val = grounded - position; float num4 = ((((Vector3)(ref val)).sqrMagnitude > 0.0001f) ? Mathf.Clamp01(Vector3.Dot(((Component)Player.m_localPlayer).transform.position - position, val) / ((Vector3)(ref val)).sqrMagnitude) : 0f); Vector3 val2 = position + val * num4 - ((Component)Player.m_localPlayer).transform.position; if (((Vector3)(ref val2)).sqrMagnitude < 0.7225f) { obj.Crossed = true; if (Time.time >= NextStress) { StressStarted = Time.time; NextStress = Time.time + 2f; TranceAudio.OneShot("VM_Berserk_Debt_Threshold", 0.35f, native: false); } } } obj.Root.transform.position = grounded; Block.Clear(); Block.SetColor("_Color", obj.Boar ? new Color(1.7f, 0.008f, 0.11f, num3 * Mathf.Lerp(0.45f, 0.85f, intensity)) : new Color(3.2f, 0.055f, 0.008f, num3 * Mathf.Lerp(0.25f, 0.9f, intensity))); foreach (Renderer renderer in obj.Renderers) { if (Object.op_Implicit((Object)(object)renderer)) { renderer.SetPropertyBlock(Block); } } UpdateEyes(obj.Eyes, num3 * intensity); } } } internal static class BloodDebtHud { private static readonly Dictionary<RectTransform, RectTransform> Rects = new Dictionary<RectTransform, RectTransform>(); private static readonly FieldInfo FullWidth = AccessTools.Field(typeof(GuiBar), "m_width"); private static RectTransform Source; private static RectTransform Root; private static TextMeshProUGUI Number; private static TextMeshProUGUI Caption; private static GuiBar Fast; private static GuiBar Slow; private static TMP_Text TextSource; private static float Smooth; internal static bool Visible { get { if (Object.op_Implicit((Object)(object)Root)) { return ((Component)Root).gameObject.activeInHierarchy; } return false; } } internal static void Clear() { if (Object.op_Implicit((Object)(object)Root)) { Object.Destroy((Object)(object)((Component)Root).gameObject); } Root = (Source = null); Fast = (Slow = null); TextSource = null; Number = (Caption = null); Rects.Clear(); Smooth = 0f; } private static void Layout(RectTransform from, RectTransform to) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_004a: Unknown result type (might be due to invalid IL or missing references) to.anchorMin = from.anchorMin; to.anchorMax = from.anchorMax; to.pivot = from.pivot; to.sizeDelta = from.sizeDelta; to.anchoredPosition3D = from.anchoredPosition3D; ((Transform)to).localRotation = ((Transform)from).localRotation; ((Transform)to).localScale = ((Transform)from).localScale; } private static void ImageStyle(Image from, Image to) { //IL_001a: 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_006e: Unknown result type (might be due to invalid IL or missing references) to.sprite = from.sprite; to.overrideSprite = from.overrideSprite; to.type = from.type; to.preserveAspect = from.preserveAspect; to.fillCenter = from.fillCenter; to.fillMethod = from.fillMethod; to.fillOrigin = from.fillOrigin; to.fillClockwise = from.fillClockwise; to.fillAmount = from.fillAmount; ((Graphic)to).color = ((Graphic)from).color; ((Graphic)to).material = ((Graphic)from).material; ((Graphic)to).raycastTarget = false; ((Behaviour)to).enabled = ((Behaviour)from).enabled; } private static RectTransform CopyGraphics(RectTransform from, Transform parent) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown RectTransform component = new GameObject("VM_" + ((Object)from).name, new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); Layout(from, component); Rects[from] = component; Image val = default(Image); if (((Component)from).TryGetComponent<Image>(ref val)) { ImageStyle(val, ((Component)component).gameObject.AddComponent<Image>()); } RawImage val2 = default(RawImage); if (((Component)from).TryGetComponent<RawImage>(ref val2)) { RawImage obj = ((Component)component).gameObject.AddComponent<RawImage>(); obj.texture = val2.texture; obj.uvRect = val2.uvRect; ((Graphic)obj).color = ((Graphic)val2).color; ((Graphic)obj).material = ((Graphic)val2).material; ((Graphic)obj).raycastTarget = false; } Mask val3 = default(Mask); if (((Component)from).TryGetComponent<Mask>(ref val3)) { ((Component)component).gameObject.AddComponent<Mask>().showMaskGraphic = val3.showMaskGraphic; } RectMask2D val4 = default(RectMask2D); if (((Component)from).TryGetComponent<RectMask2D>(ref val4)) { RectMask2D obj2 = ((Component)component).gameObject.AddComponent<RectMask2D>(); obj2.padding = val4.padding; obj2.softness = val4.softness; } foreach (Transform item in (Transform)from) { object obj3 = (object)item; RectTransform val5 = (RectTransform)((obj3 is RectTransform) ? obj3 : null); if (val5 != null) { CopyGraphics(val5, (Transform)(object)component); } } ((Component)component).gameObject.SetActive(((Component)from).gameObject.activeSelf); return component; } private static TextMeshProUGUI MakeText(string name) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = new GameObject(name, new Type[1] { typeof(RectTransform) }).AddComponent<TextMeshProUGUI>(); ((TMP_Text)val).transform.SetParent((Transform)(object)Root, false); ((Graphic)val).raycastTarget = false; RectTransform rectTransform = ((TMP_Text)val).rectTransform; RectTransform rectTransform2 = ((TMP_Text)val).rectTransform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0.5f, 0.5f); rectTransform2.anchorMax = val2; rectTransform.anchorMin = val2; ((TMP_Text)val).rectTransform.pivot = new Vector2(0.5f, 0.5f); ((TMP_Text)val).alignment = (TextAlignmentOptions)514; ((TMP_Text)val).textWrappingMode = (TextWrappingModes)0; return val; } private static void Font(TMP_Text from, TMP_Text to) { //IL_0026: 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) to.font = from.font; to.fontSharedMaterial = from.fontSharedMaterial; to.fontSize = from.fontSize; to.fontStyle = from.fontStyle; ((Graphic)to).color = ((Graphic)from).color; } internal static void Tick() { //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) Hud instance = Hud.instance; PlayerTranceState state = null; if (!ModConfig.B("Hud.Enabled") || !ModConfig.B("Hud.ShowResourceMeters") || !MushroomEffectManager.TryGet((Character)(object)Player.m_localPlayer, out state) || (state.ActiveTrance != TranceType.Berserksgangr && !(state.BloodDebt > 0f)) || !Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)instance.m_healthBarRoot) || !Object.op_Implicit((Object)(object)instance.m_healthBarFast) || !Object.op_Implicit((Object)(object)instance.m_healthText)) { if (Object.op_Implicit((Object)(object)Root)) { ((Component)Root).gameObject.SetActive(false); } return; } if ((Object)(object)Source != (Object)(object)instance.m_healthBarRoot || (Object)(object)Fast != (Object)(object)instance.m_healthBarFast || (Object)(object)Slow != (Object)(object)instance.m_healthBarSlow || (Object)(object)TextSource != (Object)(object)instance.m_healthText || !Object.op_Implicit((Object)(object)Root)) { Clear(); Source = instance.m_healthBarRoot; Fast = instance.m_healthBarFast; Slow = instance.m_healthBarSlow; TextSource = instance.m_healthText; Root = CopyGraphics(Source, ((Transform)Source).parent); ((Object)Root).name = "VikingMushrooms.BloodDebt"; ((Component)Root).gameObject.AddComponent<LayoutElement>().ignoreLayout = true; Number = MakeText("DebtNumber"); Caption = MakeText("DebtCaption"); Smooth = state.BloodDebt / Mathf.Max(1f, state.BloodDebtMax); } if ((Object)(object)((Transform)Root).parent != (Object)(object)((Transform)Source).parent) { ((Transform)Root).SetParent(((Transform)Source).parent, false); } Image val = default(Image); Image to = default(Image); foreach (KeyValuePair<RectTransform, RectTransform> rect2 in Rects) { if (Object.op_Implicit((Object)(object)rect2.Key) && Object.op_Implicit((Object)(object)rect2.Value)) { Layout(rect2.Key, rect2.Value); if ((Object)(object)rect2.Key != (Object)(object)Source) { ((Component)rect2.Value).gameObject.SetActive(((Component)rect2.Key).gameObject.activeSelf); } if (((Component)rect2.Key).TryGetComponent<Image>(ref val) && ((Component)rect2.Value).TryGetComponent<Image>(ref to)) { ImageStyle(val, to); } } } RectTransform root = Root; Vector2 anchoredPosition = root.anchoredPosition; Rect rect = Source.rect; root.anchoredPosition = anchoredPosition + new Vector2(0f, ((Rect)(ref rect)).height * Mathf.Abs(((Transform)Source).localScale.y) + ModConfig.F("Hud.DebtBarGap")); ((Component)Root).gameObject.SetActive(((Component)Source).gameObject.activeInHierarchy); float num = Mathf.Clamp01(state.BloodDebt / Mathf.Max(0.01f, state.BloodDebtMax)); Smooth = Mathf.MoveTowards(Smooth, num, Time.unscaledDeltaTime * 1.5f); SetBar(Fast, num); SetBar(Slow, Smooth); Font(TextSource, (TMP_Text)(object)Number); Font(TextSource, (TMP_Text)(object)Caption); rect = Source.rect; float num2 = Mathf.Max(((Rect)(ref rect)).height, TextSource.fontSize + 4f); RectTransform rectTransform = ((TMP_Text)Number).rectTransform; rect = Source.rect; rectTransform.sizeDelta = new Vector2(Mathf.Max(((Rect)(ref rect)).width, 60f), num2); ((TMP_Text)Number).text = $"-{state.BloodDebt:0}"; RectTransform rectTransform2 = ((TMP_Text)Caption).rectTransform; rect = Source.rect; rectTransform2.sizeDelta = new Vector2(Mathf.Max(220f, ((Rect)(ref rect)).width), num2); RectTransform rectTransform3 = ((TMP_Text)Caption).rectTransform; rect = Source.rect; rectTransform3.anchoredPosition = new Vector2(0f, ((Rect)(ref rect)).height * 0.5f + num2 * 0.5f + 2f); ((TMP_Text)Caption).fontSize = Mathf.Min(TextSource.fontSize, 14f); bool flag = ModConfig.S("General.Language") != "en"; ((TMP_Text)Caption).text = ((state.LastBreathRemaining > 0f) ? ((flag ? "Último Aliento" : "Last Breath") + $" {state.LastBreathRemaining:0.0}s") : (flag ? "Deuda de Sangre" : "Blood Debt")); if (ModConfig.B("Hud.DebtAvoidOverlap")) { AvoidBars(instance); } } private static void AvoidBars(Hud hud) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) RectTransform[] array = (RectTransform[])(object)new RectTransform[3] { hud.m_staminaBar2Root, hud.m_eitrBarRoot, hud.m_adrenalineBarRoot }; for (int i = 0; i < array.Length; i++) { RectTransform[] array2 = array; foreach (RectTransform val in array2) { if (Object.op_Implicit((Object)(object)val) && ((Component)val).gameObject.activeInHierarchy && !((Object)(object)val == (Object)(object)Source)) { Bounds val2 = RectTransformUtility.CalculateRelativeRectTransformBounds(((Transform)Source).parent, (Transform)(object)Root); Bounds val3 = RectTransformUtility.CalculateRelativeRectTransformBounds(((Transform)Source).parent, (Transform)(object)val); if (!(((Bounds)(ref val2)).max.x <= ((Bounds)(ref val3)).min.x) && !(((Bounds)(ref val2)).min.x >= ((Bounds)(ref val3)).max.x) && !(((Bounds)(ref val2)).max.y <= ((Bounds)(ref val3)).min.y) && !(((Bounds)(ref val2)).min.y >= ((Bounds)(ref val3)).max.y)) { RectTransform root = Root; root.anchoredPosition += new Vector2(0f, ((Bounds)(ref val3)).max.y - ((Bounds)(ref val2)).min.y + ModConfig.F("Hud.DebtBarGap")); } } } } } private static void SetBar(GuiBar source, float fraction) { //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) if (Object.op_Implicit((Object)(object)source) && Object.op_Implicit((Object)(object)source.m_bar) && Rects.TryGetValue(source.m_bar, out var value)) { float num; if (!(FullWidth != null)) { Rect rect = Source.rect; num = ((Rect)(ref rect)).width; } else { num = (float)FullWidth.GetValue(source); } float num2 = num; value.SetSizeWithCurrentAnchors((Axis)0, Mathf.Max(0f, num2) * fraction); } } } internal static class BerserkerSystem { internal static float Ratio(PlayerTranceState s) { if (!(s.BloodDebtMax > 0f)) { return 0f; } return Mathf.Clamp01(s.BloodDebt / s.BloodDebtMax); } internal static bool ChestAllowed(Player player) { if (!ModConfig.B("Berserker.RequireNoMetalChest")) { return true; } object? value = AccessTools.Field(typeof(Humanoid), "m_chestItem").GetValue(player); ItemData val = (ItemData)((value is ItemData) ? value : null); if (val == null) { return true; } string text = (Object.op_Implicit((Object)(object)val.m_dropPrefab) ? ((Object)val.m_dropPrefab).name : ""); if (text.Length == 0) { return false; } string[] array = ModConfig.S("Berserker.BlockedChestPrefabs").Split(','); foreach (string text2 in array) { if (string.Equals(text, text2.Trim(), StringComparison.Ordinal)) { return false; } } return true; } internal static void End(PlayerTranceState s) { if (s.BloodDebt > 0f && s.LastBreathRemaining <= 0f) { s.LastBreathRemaining = ModConfig.F("Berserker.LastBreathSeconds"); } } internal static float Damage(Player player, PlayerTranceState s, float damage) { float floor = Mathf.Min(((Character)player).GetMaxHealth(), ModConfig.F("Berserker.HealthFloor")); float result = TranceMath.Damage(((Character)player).GetHealth(), damage, floor, ref s.BloodDebt); if (s.BloodDebt >= s.BloodDebtMax) { s.Fatal = true; return 0f; } return result; } } internal static class AshBodySystem { internal static float Damage(PlayerTranceState s, float damage) { s.LastDamage = Time.time; float num = TranceMath.Prevent(damage, ModConfig.F("AshBody.DamagePreventionFraction"), ModConfig.F("AshBody.DensityCostPerPreventedDamage"), ref s.Density); HallucinationSystem.Ash(damage - num); return num; } internal static void Tick(PlayerTranceState s, float dt) { if (Time.time - s.LastDamage >= ModConfig.F("AshBody.RegenDelay")) { s.Density = Mathf.Min(ModConfig.F("AshBody.DensityMax"), s.Density + ModConfig.F("AshBody.RegenPerSecond") * dt); } } } internal static class JotunnBloodSystem { internal static void Tick(Player p, PlayerTranceState s, float dt) { //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) Vector3 velocity = ((Character)p).GetVelocity(); velocity.y = 0f; if (((Character)p).IsRunning() && ((Vector3)(ref velocity)).sqrMagnitude > 1f && ((Character)p).IsOnGround()) { s.LastMotion = Time.time; s.Momentum = Mathf.Min(ModConfig.F("Jotunn.MomentumMax"), s.Momentum + ModConfig.F("Jotunn.MomentumGainPerSecond") * dt); } else if (Time.time - s.LastMotion >= ModConfig.F("Jotunn.MomentumDecayDelay")) { s.Momentum = Mathf.Max(0f, s.Momentum - ModConfig.F("Jotunn.MomentumDecayPerSecond") * dt); } } internal static void Hit(Player p, PlayerTranceState s, HitData hit) { float num = (((bool)AccessTools.Field(typeof(Humanoid), "m_currentAttackIsSecondary").GetValue(p) || (((Character)p).IsRunning() && s.Momentum >= ModConfig.F("Jotunn.MomentumMax") * 0.25f)) ? (s.Momentum / ModConfig.F("Jotunn.MomentumMax")) : 0f); hit.m_pushForce *= 1.1f + ModConfig.F("Jotunn.MaxBonusPush") * num; hit.m_staggerMultiplier *= 1f + ModConfig.F("Jotunn.MaxBonusStagger") * num; if (num > 0f) { s.Momentum = 0f; HallucinationSystem.Momentum(num); } } } internal static class DeliriumSystem { private static readonly Random Rng = new Random(); internal static void Roll(PlayerTranceState s) { s.DeliriumBenefit = (DeliriumBenefit)Rng.Next(1, 6); do { s.DeliriumDrawback = (DeliriumDrawback)Rng.Next(1, 6); } while (ModConfig.B("Delirium.AvoidExactInversePairs") && TranceMath.Inverse(s.DeliriumBenefit, s.DeliriumDrawback)); s.DeliriumHallucination = (DeliriumHallucination)Rng.Next(1, 7); } internal static float Benefit(PlayerTranceState s, DeliriumBenefit b, float magnitude) { if (s.ActiveTrance != TranceType.Delirium || s.DeliriumBenefit != b) { return 0f; } return magnitude * ModConfig.F("Delirium.BenefitMagnitudeScale"); } internal static float Drawback(PlayerTranceState s, DeliriumDrawback d, float magnitude) { if (s.ActiveTrance != TranceType.Delirium || s.DeliriumDrawback != d) { return 0f; } return magnitude * ModConfig.F("Delirium.DrawbackMagnitudeScale"); } } internal static class DeliriumWorldDirector { private static GameObject Root; private static Material Material; private static readonly List<Mesh> Meshes = new List<Mesh>(); private static float Start; private static float End; private static float Next; private static int Last = -1; private static Vector3 Origin; private static bool Bird; private static bool Billboard; private static bool Atlas; private static int EventIndex; private static Color Tint; private static readonly MaterialPropertyBlock Properties = new MaterialPropertyBlock(); private static readonly List<MeshRenderer> Renderers = new List<MeshRenderer>(); internal static bool Active => Object.op_Implicit((Object)(object)Root); internal static void Clear() { Dispose(); Next = 0f; Last = -1; } private static void Dispose() { if (Object.op_Implicit((Object)(object)Root)) { Root.SetActive(false); Object.Destroy((Object)(object)Root); } Root = null; foreach (Mesh mesh in Meshes) { if (Object.op_Implicit((Object)(object)mesh)) { Object.Destroy((Object)(object)mesh); } } Meshes.Clear(); Renderers.Clear(); if (Object.op_Implicit((Object)(object)Material)) { Object.Destroy((Object)(object)Material); } Material = null; } internal static void Tick(Player player, float intensity) { //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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: 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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //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_0116: Unknown result type (might be due to invalid IL or missing references) //IL_030f: 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) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0376: 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_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Expected O, but got Unknown //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: 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) if (!Object.op_Implicit((Object)(object)player) || intensity <= 0f || ModConfig.F("Visual.MaxLocalPhantoms") < 1f || !ModConfig.B("Visual.EnablePhantomSilhouettes")) { Dispose(); } else if (Object.op_Implicit((Object)(object)Root)) { float num = Time.time - Start; float num2 = End - Time.time; if (!(num2 <= 0f)) { float num3 = Mathf.SmoothStep(0f, 1f, Mathf.Min(num / 0.8f, num2 / 0.8f)); Root.transform.position = Origin + Vector3.up * Mathf.Sin(num * 0.7f) * (Bird ? 0.35f : 0.06f); if (Billboard && Object.op_Implicit((Object)(object)Camera.main)) { Root.transform.rotation = Quaternion.LookRotation(Root.transform.position - ((Component)Camera.main).transform.position); } Tint.a = num3 * intensity * 0.65f; Properties.SetColor("_Color", Tint); if (Atlas) { int num4 = Mathf.FloorToInt(num * 12f) % 16; Material.SetTextureScale("_MainTex", new Vector2(0.25f, 0.25f)); Material.SetTextureOffset("_MainTex", new Vector2((float)(num4 % 4) * 0.25f, (float)(3 - num4 / 4) * 0.25f)); } { foreach (MeshRenderer renderer in Renderers) { if (Object.op_Implicit((Object)(object)renderer)) { ((Renderer)renderer).SetPropertyBlock(Properties); } } return; } } Dispose(); } else { if (intensity < 0.16f || Time.time < Next || !Object.op_Implicit((Object)(object)Camera.main)) { return; } Next = Time.time + Random.Range(6f, 11f) / Mathf.Lerp(0.65f, 1f, intensity); int num5 = EventIndex++ % 3; if (num5 == Last) { num5 = (num5 + 1) % 3; } Last = num5; Bird = false; Billboard = num5 != 1; Atlas = num5 == 2; Tint = HallucinationSystem.Profile(new PlayerTranceState { ActiveTrance = TranceScreenProfile.Current }); Tint = Color.Lerp(Tint, Color.white, 0.4f); Vector3 position = ((Component)player).transform.position; Vector3 val = Vector3.ProjectOnPlane(((Component)Camera.main).transform.forward, Vector3.up); Vector3 val2 = position + ((Vector3)(ref val)).normalized * (float)Random.Range(10, 17) + ((Component)Camera.main).transform.right * (float)((!(Random.value < 0.5f)) ? 1 : (-1)) * (float)Random.Range(5, 9); RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(val2 + Vector3.up * 15f, Vector3.down, ref val3, 40f, LayerMask.GetMask(new string[3] { "terrain", "static_solid", "piece" }))) { return; } val2 = ((RaycastHit)(ref val3)).point + Vector3.up * (Bird ? 2.5f : (Billboard ? 2f : 0.05f)); try { Shader val4 = FxBundle.Load<Shader>("Assets/Spectral.shader"); if (Object.op_Implicit((Object)(object)val4) && val4.isSupported) { Material = new Material(val4) { hideFlags = (HideFlags)61 }; Root = new GameObject("VikingMushrooms.RenderOnlyApparition"); Root.transform.position = (Origin = val2); Start = Time.time; End = Start + Random.Range(2.5f, 4f); if (Billboard) { Rune(); } else { Fauna(num5); } if (Renderers.Count == 0) { Dispose(); } } } catch (Exception ex) { Dispose(); Plugin.Log.LogWarning((object)("Delirium apparition skipped: " + ex.Message)); } } } private static MeshRenderer Part(Mesh mesh, Transform source, Transform model) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_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_0099: 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_00a7: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("RenderOnly", new Type[2] { typeof(MeshFilter), typeof(MeshRenderer) }); val.transform.SetParent(Root.transform, false); if (Object.op_Implicit((Object)(object)source)) { val.transform.localPosition = model.InverseTransformPoint(source.position); val.transform.localRotation = Quaternion.Inverse(model.rotation) * source.rotation; Vector3 lossyScale = source.lossyScale; Vector3 lossyScale2 = model.lossyScale; val.transform.localScale = new Vector3(lossyScale.x / lossyScale2.x, lossyScale.y / lossyScale2.y, lossyScale.z / lossyScale2.z); } val.GetComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer component = val.GetComponent<MeshRenderer>(); Material[] array = (Material[])(object)new Material[mesh.subMeshCount]; for (int i = 0; i < array.Length; i++) { array[i] = Material; } ((Renderer)component).sharedMaterials = array; ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; ((Renderer)component).lightProbeUsage = (LightProbeUsage)0; ((Renderer)component).reflectionProbeUsage = (ReflectionProbeUsage)0; Renderers.Add(component); return component; } private static void Rune() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_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_00fc: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) List<string> list = VisualAssetCatalog.Pool(Atlas ? "atlas" : "apparition"); if (list.Count != 0) { Texture2D val = VisualAssetCatalog.Texture(list[EventIndex / 3 % list.Count]); if (Object.op_Implicit((Object)(object)val)) { Material.SetTexture("_MainTex", (Texture)(object)val); Material.SetFloat("_UseTexture", 1f); Mesh val2 = new Mesh(); val2.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.6f, -0.6f, 0f), new Vector3(0.6f, -0.6f, 0f), new Vector3(0.6f, 0.6f, 0f), new Vector3(-0.6f, 0.6f, 0f) }; val2.uv = (Vector2[])(object)new Vector2[4] { Vector2.zero, Vector2.right, Vector2.one, Vector2.up }; val2.triangles = new int[6] { 0, 2, 1, 0, 3, 2 }; Mesh val3 = val2; val3.RecalculateNormals(); val3.RecalculateBounds(); Meshes.Add(val3); Part(val3, null, null); } } } private static void Fauna(int kind) { //IL_0098: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown GameObject val = null; string text = ((TranceScreenProfile.Current == TranceType.JotunnBlood) ? "Troll" : ((TranceScreenProfile.Current == TranceType.Berserksgangr) ? "Wolf" : ((TranceScreenProfile.Current == TranceType.VisionOfHel) ? "Skeleton" : ((TranceScreenProfile.Current == TranceType.EitrOverload) ? "Greydwarf" : "Deer")))); if (Object.op_Implicit((Object)(object)ZNetScene.instance)) { val = ZNetScene.instance.GetPrefab(text) ?? ZNetScene.instance.GetPrefab("Deer"); } if (!Object.op_Implicit((Object)(object)val)) { return; } Root.transform.rotation = Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f); Root.transform.localScale = val.transform.lossyScale; SkinnedMeshRenderer[] componentsInChildren = val.GetComponentsInChildren<SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2.sharedMesh) && val2.sharedMesh.vertexCount <= 100000 && Renderers.Count < 4) { Mesh val3 = new Mesh(); Meshes.Add(val3); val2.BakeMesh(val3); Part(val3, ((Component)val2).transform, val.transform); } } MeshFilter[] componentsInChildren2 = val.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val4 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val4.sharedMesh) && val4.sharedMesh.vertexCount <= 100000 && Renderers.Count < 4 && Object.op_Implicit((Object)(object)((Component)val4).GetComponent<MeshRenderer>())) { Part(val4.sharedMesh, ((Component)val4).transform, val.transform); } } } } internal sealed class CastContext { internal Player Player; internal float Cost; internal CastContext Previous; } internal static class EitrOverloadSystem { [ThreadStatic] internal static CastContext Current; internal static bool IsMagic(SkillType skill) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)skill != 9) { return (int)skill == 10; } return true; } internal static float Ratio(PlayerTranceState s) { if (!(s.OverloadMax > 0f)) { return 0f; } return Mathf.Clamp01(s.Overload / s.OverloadMax); } internal static CastContext Enter(Attack attack, Humanoid character, ItemData weapon) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) CastContext castContext = new CastContext { Previous = Current }; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && weapon != null && IsMagic(weapon.m_shared.m_skillType) && MushroomEffectManager.TryGet((Character)(object)val, out var state) && state.ActiveTrance == TranceType.EitrOverload) { castContext.Player = val; castContext.Cost = Mathf.Max(0f, attack.GetAttackEitr((Character)(object)val, weapon) * Game.m_eitrRate); } Current = castContext; return castContext; } internal static bool Allowed(Player player, PlayerTranceState s, float cost) { return TranceMath.CanBorrow(player.GetEitr(), cost, s.Overload, s.OverloadMax); } internal static void Spend(Player player, PlayerTranceState s, float cost) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown s.Overload += TranceMath.Shortfall(player.GetEitr(), cost); if (s.Overload >= s.OverloadMax) { s.Overload = 0f; s.RuptureUntil = Time.time + ModConfig.F("EitrOverload.RuptureEitrRegenPenaltySeconds"); float num = player.GetStamina() * (1f - ModConfig.F("EitrOverload.RuptureStaminaDrainFraction")); AccessTools.Field(typeof(Player), "m_stamina").SetValue(player, num); HallucinationSystem.Pulse(); float num2 = ModConfig.F("EitrOverload.RuptureSelfDamage"); if (num2 > 0f) { HitData val = new HitData(); val.m_damage.m_damage = num2; ((Character)player).ApplyDamage(val, true, true, (DamageModifier)0); } } } } [HarmonyPatch(typeof(Attack), "Start")] internal static class CastStartPatch { private static void Prefix(Attack __instance, Humanoid character, ItemData weapon, out CastContext __state) { __state = EitrOverloadSystem.Enter(__instance, character, weapon); } private static Exception Finalizer(Exception __exception, CastContext __state) { if (__state != null) { EitrOverloadSystem.Current = __state.Previous; } return __exception; } } [HarmonyPatch(typeof(Attack), "Update")] internal static class CastUpdatePatch { private static bool Prefix(Attack __instance, Humanoid ___m_character, ItemData ___m_weapon, bool ___m_wasInAttack, out CastContext __state) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 __state = EitrOverloadSystem.Enter(__instance, ___m_character, ___m_weapon); Player player = __state.Player; if (Object.op_Implicit((Object)(object)player) && !___m_wasInAttack && ((Character)player).InAttack() && ((int)__instance.m_attackType != 2 || !__instance.m_perBurstResourceUsage) && MushroomEffectManager.TryGet((Character)(object)player, out var state) && !EitrOverloadSystem.Allowed(player, state, __state.Cost)) { __instance.Abort(); return false; } return true; } private static Exception Finalizer(Exception __exception, CastContext __state) { if (__state != null) { EitrOverloadSystem.Current = __state.Previous; } return __exception; } } [HarmonyPatch(typeof(Attack), "FireProjectileBurst")] internal static class CastBurstPatch { private static void Prefix(Attack __instance, Humanoid ___m_character, ItemData ___m_weapon, out CastContext __state) { __state = EitrOverloadSystem.Enter(__instance, ___m_character, ___m_weapon); } private static Exception Finalizer(Exception __exception, CastContext __state) { if (__state != null) { EitrOverloadSystem.Current = __state.Previous; } return __exception; } } [HarmonyPatch(typeof(Player), "HaveEitr")] internal static class HaveEitrPatch { private static void Postfix(Player __instance, ref bool __result) { CastContext current = EitrOverloadSystem.Current; if (!((Object)(object)current?.Player != (Object)(object)__instance) && MushroomEffectManager.TryGet((Character)(object)__instance, out var state)) { __result = EitrOverloadSystem.Allowed(__instance, state, current.Cost); } } } [HarmonyPatch(typeof(Player), "RPC_UseEitr")] internal static class SpendEitrPatch { private static void Prefix(Player __instance, float v) { if ((Object)(object)EitrOverloadSystem.Current?.Player == (Object)(object)__instance && v > 0f && MushroomEffectManager.TryGet((Character)(object)__instance, out var state)) { EitrOverloadSystem.Spend(__instance, state, v); } } } internal static class FxAssets { private static readonly Dictionary<string, Texture2D> Textures = new Dictionary<string, Texture2D>(); private static readonly Dictionary<string, AudioClip> Clips = new Dictionary<string, AudioClip>(); private static readonly HashSet<string> Logged = new HashSet<string>(); internal static Texture2D Texture(string name) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown if (Textures.TryGetValue(name, out var value)) { return value; } Texture2D val = null; try { using Stream stream = typeof(Plugin).Assembly.GetManifestResourceStream("VikingMushrooms.FX." + name + ".png"); if (stream != null) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, memoryStream.ToArray(), true)) { Object.Destroy((Object)(object)val); val = null; } if (Object.op_Implicit((Object)(object)val)) { ((Object)val).name = name; ((Texture)val).wrapMode = (TextureWrapMode)1; } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("FX texture unavailable: " + name + ": " + ex.Message)); if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } val = null; } Textures[name] = val; return val; } internal static AudioClip Wave(string name) { if (Clips.TryGetValue(name, out var value)) { return value; } AudioClip val = null; try { using Stream stream = typeof(Plugin).Assembly.GetManifestResourceStream("VikingMushrooms.FX." + name + ".wav"); if (stream != null) { PcmWave pcmWave = PcmWave.Read(stream); val = AudioClip.Create(name, pcmWave.Samples.Length / pcmWave.Channels, pcmWave.Channels, pcmWave.SampleRate, false); val.SetData(pcmWave.Samples, 0); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("FX audio unavailable: " + name + ": " + ex.Message)); if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } val = null; } Clips[name] = val; return val; } private static GameObject Prefab(string id) { if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { return null; } return ZNetScene.instance.GetPrefab(id); } internal static Material NativeMaterial(TranceType trance) { if (!ModConfig.B("Visual.PreferValheimAssets")) { return null; } object obj; switch (trance) { default: obj = new string[2] { "vfx_ghost_spawn", "vfx_Potion_eitr_minor" }; break; case TranceType.EitrOverload: obj = new string[2] { "vfx_Potion_eitr_minor", "vfx_ghost_spawn" }; break; case TranceType.JotunnBlood: case TranceType.AshBody: obj = new string[2] { "vfx_stonegolem_footstep", "vfx_ghost_spawn" }; break; } string[] array = (string[])obj; foreach (string text in array) { GameObject val = Prefab(text); if (!Object.op_Implicit((Object)(object)val)) { continue; } ParticleSystemRenderer[] componentsInChildren = val.GetComponentsInChildren<ParticleSystemRenderer>(true); for (int j = 0; j < componentsInChildren.Length; j++) { Material sharedMaterial = ((Renderer)componentsInChildren[j]).sharedMaterial; if (Object.op_Implicit((Object)(object)sharedMaterial) && Object.op_Implicit((Object)(object)sharedMaterial.shader) && sharedMaterial.shader.isSupported && sharedMaterial.renderQueue >= 2500) { Report("material", text + "/" + ((Object)sharedMaterial).name); return sharedMaterial; } } } return null; } internal static AudioClip NativeSound(TranceType trance, string eventName = null) { if (!ModConfig.B("Visual.PreferValheimAssets")) { return null; } string[] array = trance switch { TranceType.Berserksgangr => new string[1] { "sfx_draugr_idle" }, TranceType.EitrOverload => new string[1] { "sfx_Potion_eitr_minor" }, TranceType.JotunnBlood => new string[1] { "sfx_stonegolem_idle" }, _ => new string[3] { "sfx_ghosts_idle", "sfx_ghost_idle", "sfx_wraith_idle" }, }; if (eventName == "VM_Jotunn_Momentum_Impact") { array = new string[1] { "sfx_stonegolem_attack_hit" }; } if (eventName == "VM_Ash_SpiritPhase") { array = new string[1] { "sfx_ghost_death" }; } if (eventName == "VM_Hel_Crow") { array = new string[1] { "sfx_crow_idle" }; } string[] array2 = array; foreach (string tex