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 ShadowFiend v0.1.0
ShadowFiend.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using HarmonyLib; using Microsoft.CodeAnalysis; using R2API; using RoR2; using RoR2.ContentManagement; using RoR2.Skills; using ShadowFiendMod.Content; using ShadowFiendMod.States; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; [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("ShadowFiend")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("ShadowFiend")] [assembly: AssemblyTitle("ShadowFiend")] [assembly: AssemblyVersion("0.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ShadowFiendMod { [BepInPlugin("com.ShadowFiend.mod", "ShadowFiend", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class ShadowFiendPlugin : BaseUnityPlugin { public const string PluginGuid = "com.ShadowFiend.mod"; public const string PluginName = "ShadowFiend"; public const string PluginVersion = "0.1.0"; internal static ManualLogSource Log; internal static ShadowFiendConfig Cfg; private Harmony _harmony; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; Cfg = new ShadowFiendConfig(((BaseUnityPlugin)this).Config); Log.LogInfo((object)"ShadowFiend 0.1.0 loading (Dota 2 survivor with the original model and animations)."); ShadowFiendTokens.Init(); ShadowFiendHooks.Init(); new ShadowFiendContentPack().Initialize(); Log.LogInfo((object)"ShadowFiend bootstrap complete."); } private void OnDestroy() { ShadowFiendHooks.Shutdown(); if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } } } internal static class ShadowFiendAssets { private const string ResourcePrefix = "ShadowFiend.Assets."; internal static Texture2D Portrait { get; private set; } internal static Sprite PrimaryIcon { get; private set; } internal static Sprite RazeIcon { get; private set; } internal static Sprite FrenzyIcon { get; private set; } internal static Sprite RequiemIcon { get; private set; } internal static Sprite PassiveIcon { get; private set; } internal static Sprite SpeedBuffIcon { get; private set; } internal static Sprite ShredBuffIcon { get; private set; } internal static Sprite DaedalusIcon { get; private set; } internal static Sprite YashaKayaIcon { get; private set; } internal static void Build() { if (!Object.op_Implicit((Object)(object)Portrait)) { Portrait = LoadTexture("portrait.png"); PrimaryIcon = LoadSprite("primary.png"); RazeIcon = LoadSprite("raze.png"); FrenzyIcon = LoadSprite("frenzy.png"); RequiemIcon = LoadSprite("requiem.png"); PassiveIcon = LoadSprite("passive.png"); SpeedBuffIcon = LoadSprite("frenzy.png"); ShredBuffIcon = LoadSprite("passive.png"); DaedalusIcon = LoadSprite("item_daedalus.png"); YashaKayaIcon = LoadSprite("item_yasha_kaya.png"); } } private static bool Valid<T>(AsyncOperationHandle<T> handle) where T : Object { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)handle.Status == 1) { return Object.op_Implicit((Object)(object)handle.Result); } return false; } private static Texture2D LoadTexture(string fileName) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ShadowFiend.Assets." + fileName); if (stream == null) { ShadowFiendPlugin.Log.LogError((object)("ShadowFiend art is missing from the DLL: " + fileName)); return SolidTexture(new Color(0.08f, 0.35f, 0.38f)); } byte[] array = new byte[stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, array)) { ShadowFiendPlugin.Log.LogError((object)("Could not decode ShadowFiend art: " + fileName)); Object.Destroy((Object)(object)val); return SolidTexture(new Color(0.08f, 0.35f, 0.38f)); } ((Object)val).name = "SHADOWFIEND_" + Path.GetFileNameWithoutExtension(fileName); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; return val; } private static Sprite LoadSprite(string fileName) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Texture2D val = LoadTexture(fileName); Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); ((Object)obj).name = ((Object)val).name; return obj; } private static Texture2D SolidTexture(Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(4, 4, (TextureFormat)4, false); Color32[] array = (Color32[])(object)new Color32[16]; for (int i = 0; i < array.Length; i++) { array[i] = Color32.op_Implicit(color); } val.SetPixels32(array); val.Apply(); return val; } } internal static class ShadowFiendAudio { internal enum Channel { Skill, Primary, Passive } private sealed class Clip { internal byte[] Pcm; internal int Channels; internal int SampleRate; internal int BitsPerSample; internal float Seconds; } private sealed class Voice { internal IntPtr Handle; internal IntPtr Header; internal IntPtr Data; internal float Deadline; } private sealed class Pending { internal string File; internal Vector3 Position; internal float Volume; internal Channel Channel; internal float Due; } [StructLayout(LayoutKind.Sequential, Pack = 1)] private struct WaveFormat { public ushort wFormatTag; public ushort nChannels; public uint nSamplesPerSec; public uint nAvgBytesPerSec; public ushort nBlockAlign; public ushort wBitsPerSample; public ushort cbSize; } private struct WaveHeader { public IntPtr lpData; public int dwBufferLength; public int dwBytesRecorded; public IntPtr dwUser; public int dwFlags; public int dwLoops; public IntPtr lpNext; public IntPtr reserved; } private const string Prefix = "ShadowFiend.Assets.dota."; private const int WaveMapper = -1; private const int WhdrDone = 1; private const int MaxVoices = 16; private const float DuplicateWindow = 0.04f; private static readonly Dictionary<string, Clip> Clips = new Dictionary<string, Clip>(StringComparer.OrdinalIgnoreCase); private static readonly Dictionary<string, float> LastPlayed = new Dictionary<string, float>(StringComparer.OrdinalIgnoreCase); private static readonly List<Voice> Voices = new List<Voice>(); private static readonly List<Pending> PendingSounds = new List<Pending>(); private static bool _unavailable; private static bool _driverMissing; private static bool _announced; private static int WaveHeaderSize => Marshal.SizeOf(typeof(WaveHeader)); internal static void Play(string fileName, Vector3 position, float volume = 1f, Channel channel = Channel.Skill) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (_unavailable || string.IsNullOrEmpty(fileName)) { return; } try { PlayInternal(fileName, position, volume, channel); } catch (DllNotFoundException ex) { _unavailable = true; ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend audio is unavailable: " + ex.Message)); } catch (Exception ex2) { ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend audio failed for " + fileName + ": " + ex2.Message)); } } internal static void PlayDelayed(string fileName, Vector3 position, float delay, float volume = 1f, Channel channel = Channel.Skill) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (!_unavailable && !string.IsNullOrEmpty(fileName)) { if (delay <= 0.01f) { Play(fileName, position, volume, channel); } else if (PendingSounds.Count <= 32 && Object.op_Implicit((Object)(object)ShadowFiendAudioDriver.Instance)) { PendingSounds.Add(new Pending { File = fileName, Position = position, Volume = volume, Channel = channel, Due = Time.unscaledTime + delay }); } } } private static void TickPending() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) if (PendingSounds.Count == 0) { return; } float unscaledTime = Time.unscaledTime; for (int num = PendingSounds.Count - 1; num >= 0; num--) { Pending pending = PendingSounds[num]; if (!(unscaledTime < pending.Due)) { PendingSounds.RemoveAt(num); Play(pending.File, pending.Position, pending.Volume, pending.Channel); } } } private static void PlayInternal(string fileName, Vector3 position, float volume, Channel channel) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) float unscaledTime = Time.unscaledTime; if (LastPlayed.TryGetValue(fileName, out var value) && unscaledTime - value < 0.04f) { return; } Clip clip = GetClip(fileName); if (clip == null || Voices.Count >= 16 || !Object.op_Implicit((Object)(object)ShadowFiendAudioDriver.Instance)) { return; } float num = Mathf.Clamp01(volume * DistanceGain(position) * ChannelGain(channel)); if (num <= 0.02f) { return; } byte[] array = Scale(clip, num); IntPtr intPtr = Marshal.AllocHGlobal(array.Length); Marshal.Copy(array, 0, intPtr, array.Length); WaveFormat format = new WaveFormat { wFormatTag = 1, nChannels = (ushort)clip.Channels, nSamplesPerSec = (uint)clip.SampleRate, wBitsPerSample = (ushort)clip.BitsPerSample, nBlockAlign = (ushort)(clip.Channels * clip.BitsPerSample / 8), cbSize = 0 }; format.nAvgBytesPerSec = format.nSamplesPerSec * format.nBlockAlign; IntPtr handle; int num2 = waveOutOpen(out handle, -1, ref format, IntPtr.Zero, IntPtr.Zero, 0); if (num2 != 0) { Marshal.FreeHGlobal(intPtr); if (!_driverMissing) { _driverMissing = true; ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend audio: no playback device (waveOutOpen returned " + num2 + ").")); } return; } IntPtr intPtr2 = Marshal.AllocHGlobal(WaveHeaderSize); Marshal.StructureToPtr(new WaveHeader { lpData = intPtr, dwBufferLength = array.Length, dwFlags = 0 }, intPtr2, fDeleteOld: false); waveOutPrepareHeader(handle, intPtr2, WaveHeaderSize); waveOutWrite(handle, intPtr2, WaveHeaderSize); if (!_announced) { _announced = true; ShadowFiendConfig cfg = ShadowFiendPlugin.Cfg; ShadowFiendPlugin.Log.LogInfo((object)("ShadowFiend audio ready: original Dota 2 WAV samples through Windows PCM. " + $"volume={cfg.SoundVolume.Value:0.00} " + $"(primary x{cfg.SoundPrimaryVolume.Value:0.00}, " + $"skills x{cfg.SoundSkillVolume.Value:0.00}, " + $"skill x{cfg.SoundSkillVolume.Value:0.00}), " + $"range={cfg.SoundMaxDistance.Value:0}m.")); } LastPlayed[fileName] = unscaledTime; Voices.Add(new Voice { Handle = handle, Header = intPtr2, Data = intPtr, Deadline = unscaledTime + clip.Seconds + 2f }); } private static float DistanceGain(Vector3 position) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main)) { return 0.75f; } float num = Vector3.Distance(((Component)main).transform.position, position); float num2 = Mathf.Max(10f, ShadowFiendPlugin.Cfg.SoundMaxDistance.Value); return Mathf.Clamp(1f - (num - 6f) / num2, 0.12f, 1f); } private static float ChannelGain(Channel channel) { ShadowFiendConfig cfg = ShadowFiendPlugin.Cfg; float num = Mathf.Clamp01(cfg.SoundVolume.Value); return channel switch { Channel.Primary => num * Mathf.Clamp01(cfg.SoundPrimaryVolume.Value), Channel.Skill => num * Mathf.Clamp01(cfg.SoundSkillVolume.Value), Channel.Passive => num * Mathf.Clamp01(cfg.SoundSkillVolume.Value) * 0.7f, _ => num, }; } private static byte[] Scale(Clip clip, float gain) { byte[] pcm = clip.Pcm; if (gain >= 0.999f) { return pcm; } byte[] array = new byte[pcm.Length]; for (int i = 0; i + 1 < pcm.Length; i += 2) { int num = (int)((float)(short)(pcm[i] | (pcm[i + 1] << 8)) * gain); if (num > 32767) { num = 32767; } else if (num < -32768) { num = -32768; } array[i] = (byte)(num & 0xFF); array[i + 1] = (byte)((num >> 8) & 0xFF); } return array; } private static Clip GetClip(string fileName) { if (Clips.TryGetValue(fileName, out var value)) { return value; } Clip clip = null; try { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ShadowFiend.Assets.dota." + fileName); if (stream == null) { ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend sound is missing from the DLL: " + fileName)); } else { byte[] array = new byte[stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } clip = Parse(array); if (clip == null) { ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend sound is not usable PCM: " + fileName)); } } } catch (Exception ex) { ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend sound load failed (" + fileName + "): " + ex.Message)); } Clips[fileName] = clip; return clip; } private static Clip Parse(byte[] wav) { if (wav == null || wav.Length < 44) { return null; } if (wav[0] != 82 || wav[1] != 73 || wav[2] != 70 || wav[3] != 70) { return null; } if (wav[8] != 87 || wav[9] != 65 || wav[10] != 86 || wav[11] != 69) { return null; } int num = 0; int num2 = 0; int num3 = 0; int num4 = -1; int num5 = 0; int num6 = 12; while (num6 + 8 <= wav.Length) { int num7 = BitConverter.ToInt32(wav, num6 + 4); int num8 = num6 + 8; if (num7 < 0) { break; } if (wav[num6] == 102 && wav[num6 + 1] == 109 && wav[num6 + 2] == 116 && wav[num6 + 3] == 32) { ushort num9 = BitConverter.ToUInt16(wav, num8); num = BitConverter.ToUInt16(wav, num8 + 2); num2 = (int)BitConverter.ToUInt32(wav, num8 + 4); num3 = BitConverter.ToUInt16(wav, num8 + 14); if (num9 != 1) { return null; } } else if (wav[num6] == 100 && wav[num6 + 1] == 97 && wav[num6 + 2] == 116 && wav[num6 + 3] == 97) { num4 = num8; num5 = num7; if (num4 + num5 > wav.Length) { num5 = wav.Length - num4; } break; } num6 = num8 + num7 + (num7 & 1); } if (num4 < 0 || num5 <= 0 || num <= 0 || num2 <= 0 || num3 != 16) { return null; } byte[] array = new byte[num5]; Buffer.BlockCopy(wav, num4, array, 0, num5); return new Clip { Pcm = array, Channels = num, SampleRate = num2, BitsPerSample = num3, Seconds = (float)num5 / (float)(num2 * num * (num3 / 8)) }; } internal static void ReleaseAll() { PendingSounds.Clear(); for (int num = Voices.Count - 1; num >= 0; num--) { Release(Voices[num]); } Voices.Clear(); } private static void Release(Voice voice) { try { waveOutReset(voice.Handle); waveOutUnprepareHeader(voice.Handle, voice.Header, WaveHeaderSize); waveOutClose(voice.Handle); } catch (Exception) { } if (voice.Header != IntPtr.Zero) { Marshal.FreeHGlobal(voice.Header); } if (voice.Data != IntPtr.Zero) { Marshal.FreeHGlobal(voice.Data); } voice.Header = IntPtr.Zero; voice.Data = IntPtr.Zero; } internal static void Tick() { TickPending(); if (Voices.Count == 0) { return; } float unscaledTime = Time.unscaledTime; for (int num = Voices.Count - 1; num >= 0; num--) { Voice voice = Voices[num]; bool flag; try { flag = (((WaveHeader)Marshal.PtrToStructure(voice.Header, typeof(WaveHeader))).dwFlags & 1) != 0; } catch (Exception) { flag = true; } if (flag || unscaledTime >= voice.Deadline) { Release(voice); Voices.RemoveAt(num); } } } [DllImport("winmm.dll", SetLastError = true)] private static extern int waveOutOpen(out IntPtr handle, int deviceId, ref WaveFormat format, IntPtr callback, IntPtr instance, int flags); [DllImport("winmm.dll")] private static extern int waveOutPrepareHeader(IntPtr handle, IntPtr header, int size); [DllImport("winmm.dll")] private static extern int waveOutWrite(IntPtr handle, IntPtr header, int size); [DllImport("winmm.dll")] private static extern int waveOutUnprepareHeader(IntPtr handle, IntPtr header, int size); [DllImport("winmm.dll")] private static extern int waveOutReset(IntPtr handle); [DllImport("winmm.dll")] private static extern int waveOutClose(IntPtr handle); } internal sealed class ShadowFiendAudioDriver : MonoBehaviour { private static ShadowFiendAudioDriver _instance; internal static ShadowFiendAudioDriver Instance { get { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)_instance)) { return _instance; } GameObject val = new GameObject("ShadowFiendAudioDriver"); Object.DontDestroyOnLoad((Object)val); _instance = val.AddComponent<ShadowFiendAudioDriver>(); return _instance; } } private void Update() { ShadowFiendAudio.Tick(); } private void OnDestroy() { ShadowFiendAudio.ReleaseAll(); if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } } public sealed class ShadowFiendBodyController : MonoBehaviour { private CharacterBody _body; private float _nextAuraTick; private float _nextAuraCleanup; public GenericSkill item; private const float AuraInterval = 0.25f; private const float CleanupInterval = 1f; private void Awake() { _body = ((Component)this).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)item)) { return; } GenericSkill[] components = ((Component)this).GetComponents<GenericSkill>(); for (int i = 0; i < components.Length; i++) { if (Object.op_Implicit((Object)(object)components[i]) && components[i].skillName == "ShadowFiendItem") { item = components[i]; break; } } } private void FixedUpdate() { if (NetworkServer.active && Object.op_Implicit((Object)(object)_body) && Object.op_Implicit((Object)(object)_body.healthComponent) && _body.healthComponent.alive) { float time = Time.time; if (time >= _nextAuraTick) { _nextAuraTick = time + 0.25f; ShadowFiendSouls.TickAura(_body); } if (time >= _nextAuraCleanup) { _nextAuraCleanup = time + 1f; ShadowFiendSouls.ExpireAuraShreds(); } } } } public sealed class ShadowFiendArmorShred : MonoBehaviour { public float armorReduction; public float expireTime; } internal static class ShadowFiendBuffs { internal static readonly List<BuffDef> All = new List<BuffDef>(); internal static BuffDef SpeedBuff { get; private set; } internal static BuffDef ArmorShredDebuff { get; private set; } internal static BuffDef SoulBuff { get; private set; } internal static void Build() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) if (!Object.op_Implicit((Object)(object)SpeedBuff)) { SpeedBuff = Create("ShadowFiendFrenzyBuff", ShadowFiendAssets.SpeedBuffIcon, new Color(0.85f, 0.25f, 0.2f), isDebuff: false); ArmorShredDebuff = Create("ShadowFiendArmorShred", ShadowFiendAssets.ShredBuffIcon, new Color(0.45f, 0.1f, 0.55f), isDebuff: true); SoulBuff = Create("ShadowFiendSoulBuff", ShadowFiendAssets.PassiveIcon, new Color(0.6f, 0.2f, 0.85f), isDebuff: false); if (Object.op_Implicit((Object)(object)SoulBuff)) { SoulBuff.canStack = true; SoulBuff.stackingDisplayMethod = (StackingDisplayMethod)0; SoulBuff.isHidden = false; } } } private static BuffDef Create(string name, Sprite icon, Color color, bool isDebuff) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = name; val.iconSprite = icon; val.buffColor = color; val.canStack = false; val.isDebuff = isDebuff; val.eliteDef = null; All.Add(val); return val; } } internal static class ShadowFiendCombat { private const float BoltRadius = 2.5f; internal static void Bolt(CharacterBody owner, Vector3 origin, Vector3 direction, float range, float coefficient, float extraCoefficient) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_014a: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_0110: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || !owner.healthComponent.alive) { return; } Vector3 val = ((((Vector3)(ref direction)).sqrMagnitude < 0.001f) ? ((Component)owner).transform.forward : ((Vector3)(ref direction)).normalized); HealthComponent val2 = null; float num = float.MaxValue; Vector3 point = origin; Vector3 val3 = origin + val * range; LayerIndex val4 = LayerIndex.entityPrecise; Collider[] array = Physics.OverlapCapsule(origin, val3, 2.5f, LayerMask.op_Implicit(((LayerIndex)(ref val4)).mask), (QueryTriggerInteraction)2); foreach (Collider val5 in array) { HealthComponent health = GetHealth(val5); if (!IsEnemy(owner, health)) { continue; } Vector3 val6 = val5.ClosestPoint(origin); Vector3 val7 = val6 - origin; float num2 = Vector3.Dot(val7, val); if (num2 < 0f || num2 > range) { continue; } Vector3 val8 = val7 - val * num2; if (!(((Vector3)(ref val8)).magnitude > 5f)) { val4 = LayerIndex.world; if (!Physics.Linecast(origin, val6, LayerMask.op_Implicit(((LayerIndex)(ref val4)).mask), (QueryTriggerInteraction)1) && num2 < num) { num = num2; val2 = health; point = val6; } } } if (Object.op_Implicit((Object)(object)val2)) { bool crit = owner.RollCrit(); float damage = owner.damage * (coefficient + extraCoefficient) * RollDaedalus(owner); Hit(owner, val2, point, damage, crit, (DamageSource)1); } } internal static void Raze(CharacterBody owner, Vector3 point, float radius, float coefficient, float attackDamageFraction) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || !owner.healthComponent.alive) { return; } HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>(); bool crit = owner.RollCrit(); float num = SpellMultiplier(owner); float damage = owner.damage * (coefficient + attackDamageFraction) * num; LayerIndex val = LayerIndex.entityPrecise; Collider[] array = Physics.OverlapSphere(point, radius, LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)2); foreach (Collider val2 in array) { HealthComponent health = GetHealth(val2); if (IsEnemy(owner, health) && !hashSet.Contains(health)) { Vector3 val3 = val2.ClosestPoint(point); val = LayerIndex.world; if (!Physics.Linecast(point, val3, LayerMask.op_Implicit(((LayerIndex)(ref val)).mask), (QueryTriggerInteraction)1)) { hashSet.Add(health); Hit(owner, health, val3, damage, crit, (DamageSource)2); } } } } private static float SpellMultiplier(CharacterBody owner) { if (!ShadowFiendItems.Has(owner, ShadowFiendItems.YashaKaya)) { return 1f; } return ShadowFiendPlugin.Cfg.YashaKayaSpellMultiplier.Value; } private static float RollDaedalus(CharacterBody owner) { if (!ShadowFiendItems.Has(owner, ShadowFiendItems.Daedalus)) { return 1f; } ShadowFiendConfig cfg = ShadowFiendPlugin.Cfg; if (!(Random.value < cfg.DaedalusCritChance.Value)) { return 1f; } return cfg.DaedalusCritMultiplier.Value; } internal static void Requiem(CharacterBody owner, float radius, float coefficient, float stunDuration) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)owner) || !owner.healthComponent.alive) { return; } Vector3 corePosition = owner.corePosition; HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>(); bool crit = owner.RollCrit(); float num = SpellMultiplier(owner); LayerIndex entityPrecise = LayerIndex.entityPrecise; Collider[] array = Physics.OverlapSphere(corePosition, radius, LayerMask.op_Implicit(((LayerIndex)(ref entityPrecise)).mask), (QueryTriggerInteraction)2); foreach (Collider val in array) { HealthComponent health = GetHealth(val); if (IsEnemy(owner, health) && !hashSet.Contains(health)) { hashSet.Add(health); Vector3 point = val.ClosestPoint(corePosition); Hit(owner, health, point, owner.damage * coefficient * num, crit, (DamageSource)8); if (stunDuration > 0f) { ApplyFear(health, stunDuration); } } } } private static void ApplyFear(HealthComponent health, float duration) { if (Object.op_Implicit((Object)(object)health) && Object.op_Implicit((Object)(object)health.body)) { SetStateOnHurt component = ((Component)health.body).GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component) && component.canBeStunned) { component.SetStun(duration); } } } private static HealthComponent GetHealth(Collider collider) { HurtBox val = (Object.op_Implicit((Object)(object)collider) ? ((Component)collider).GetComponent<HurtBox>() : null); if (!Object.op_Implicit((Object)(object)val)) { return null; } return val.healthComponent; } internal static bool IsEnemy(CharacterBody owner, HealthComponent health) { //IL_0053: 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) if (!Object.op_Implicit((Object)(object)health) || !health.alive || !Object.op_Implicit((Object)(object)health.body)) { return false; } if ((Object)(object)health.body == (Object)(object)owner) { return false; } TeamComponent teamComponent = health.body.teamComponent; TeamComponent teamComponent2 = owner.teamComponent; if (Object.op_Implicit((Object)(object)teamComponent) && Object.op_Implicit((Object)(object)teamComponent2)) { return teamComponent.teamIndex != teamComponent2.teamIndex; } return false; } private static void Hit(CharacterBody owner, HealthComponent health, Vector3 point, float damage, bool crit, DamageSource source) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown DamageInfo val = new DamageInfo { attacker = ((Component)owner).gameObject, inflictor = ((Component)owner).gameObject, position = point, damage = damage, crit = crit, procCoefficient = 1f, damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)0), (DamageTypeExtended)0, source) }; health.TakeDamage(val); if (!val.rejected) { GlobalEventManager instance = GlobalEventManager.instance; if (Object.op_Implicit((Object)(object)instance)) { instance.OnHitEnemy(val, ((Component)health).gameObject); instance.OnHitAll(val, ((Component)health).gameObject); } } } } internal sealed class ShadowFiendConfig { public readonly ConfigEntry<float> BaseHealth; public readonly ConfigEntry<float> LevelHealth; public readonly ConfigEntry<float> BaseDamage; public readonly ConfigEntry<float> LevelDamage; public readonly ConfigEntry<float> BaseArmor; public readonly ConfigEntry<float> BaseMoveSpeed; public readonly ConfigEntry<int> KillsPerSoul; public readonly ConfigEntry<int> MaxSouls; public readonly ConfigEntry<float> DamagePerSoul; public readonly ConfigEntry<float> AuraRadius; public readonly ConfigEntry<float> AuraArmorBase; public readonly ConfigEntry<float> AuraArmorPerTwoSouls; public readonly ConfigEntry<float> PrimaryCoefficient; public readonly ConfigEntry<float> PrimaryRange; public readonly ConfigEntry<float> PrimaryCooldown; public readonly ConfigEntry<float> RazeRadius; public readonly ConfigEntry<float> RazeCoefficient; public readonly ConfigEntry<float> RazeAttackDamageFraction; public readonly ConfigEntry<int> RazeCharges; public readonly ConfigEntry<float> RazeCooldown; public readonly ConfigEntry<float> RazeRange; public readonly ConfigEntry<float> FrenzySpeedBonus; public readonly ConfigEntry<float> FrenzyAttackSpeedBonus; public readonly ConfigEntry<float> FrenzyDuration; public readonly ConfigEntry<float> FrenzyCooldown; public readonly ConfigEntry<float> RequiemRadius; public readonly ConfigEntry<float> RequiemCoefficient; public readonly ConfigEntry<float> RequiemPerSoulCoefficient; public readonly ConfigEntry<float> RequiemCooldown; public readonly ConfigEntry<float> RequiemFearDuration; public readonly ConfigEntry<float> RequiemCastDelay; public readonly ConfigEntry<float> DaedalusCritChance; public readonly ConfigEntry<float> DaedalusCritMultiplier; public readonly ConfigEntry<float> YashaKayaSpellMultiplier; public readonly ConfigEntry<float> SoundVolume; public readonly ConfigEntry<float> SoundPrimaryVolume; public readonly ConfigEntry<float> SoundSkillVolume; public readonly ConfigEntry<float> SoundMaxDistance; public ShadowFiendConfig(ConfigFile cfg) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Expected O, but got Unknown //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Expected O, but got Unknown //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Expected O, but got Unknown //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Expected O, but got Unknown //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Expected O, but got Unknown //IL_0558: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Expected O, but got Unknown //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Expected O, but got Unknown //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Expected O, but got Unknown BaseHealth = cfg.Bind<float>("Body", "BaseHealth", 130f, "Базовое здоровье Шэдоу Фиенда."); LevelHealth = cfg.Bind<float>("Body", "LevelHealth", 36f, "Прирост здоровья за уровень."); BaseDamage = cfg.Bind<float>("Body", "BaseDamage", 14f, "Базовый урон."); LevelDamage = cfg.Bind<float>("Body", "LevelDamage", 2.8f, "Прирост урона за уровень."); BaseArmor = cfg.Bind<float>("Body", "BaseArmor", 0f, "Базовая броня."); BaseMoveSpeed = cfg.Bind<float>("Body", "BaseMoveSpeed", 7f, "Базовая скорость передвижения."); KillsPerSoul = cfg.Bind<int>("Passive.Necromastery", "KillsPerSoul", 10, new ConfigDescription("Сколько убийств даёт одну душу.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 1000), Array.Empty<object>())); MaxSouls = cfg.Bind<int>("Passive.Necromastery", "MaxSouls", 20, new ConfigDescription("Максимальное число душ.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 200), Array.Empty<object>())); DamagePerSoul = cfg.Bind<float>("Passive.Necromastery", "DamagePerSoul", 0.1f, new ConfigDescription("Прибавка к урону от атак за каждую душу (0.10 = +10%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>())); AuraRadius = cfg.Bind<float>("Passive.Necromastery", "AuraRadius", 20f, "Радиус ауры, снижающей броню врагов, м."); AuraArmorBase = cfg.Bind<float>("Passive.Necromastery", "AuraArmorBase", 5f, "Базовое снижение брони врагов в ауре."); AuraArmorPerTwoSouls = cfg.Bind<float>("Passive.Necromastery", "AuraArmorPerTwoSouls", 1f, "Дополнительное снижение брони за каждые 2 души."); PrimaryCoefficient = cfg.Bind<float>("Skills.Primary", "DamageCoefficient", 1f, "Урон ЛКМ в долях базового урона (1 = 100%)."); PrimaryRange = cfg.Bind<float>("Skills.Primary", "Range", 250f, "Дальность атаки, м."); PrimaryCooldown = cfg.Bind<float>("Skills.Primary", "Cooldown", 0.85f, "Перезарядка между атаками, сек. Не меньше длительности анимации замаха."); RazeRadius = cfg.Bind<float>("Skills.Shadowraze", "Radius", 10f, "Радиус Шадоурейза, м."); RazeCoefficient = cfg.Bind<float>("Skills.Shadowraze", "DamageCoefficient", 2f, "Урон Шадоурейза в долях базового урона (2 = 200%)."); RazeAttackDamageFraction = cfg.Bind<float>("Skills.Shadowraze", "AttackDamageFraction", 1f, "Дополнительный урон от обычной атаки в долях урона (1 = +100%, с учётом душ)."); RazeCharges = cfg.Bind<int>("Skills.Shadowraze", "Charges", 3, new ConfigDescription("Количество зарядов Шадоурейза.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); RazeCooldown = cfg.Bind<float>("Skills.Shadowraze", "Cooldown", 13f, "Общая перезарядка всех зарядов, сек."); RazeRange = cfg.Bind<float>("Skills.Shadowraze", "Range", 120f, "Максимальная дальность выбора точки, м."); FrenzySpeedBonus = cfg.Bind<float>("Skills.PresenceOfTheDarkLord", "MoveSpeedBonus", 0.5f, new ConfigDescription("Прибавка к скорости передвижения (0.50 = +50%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); FrenzyAttackSpeedBonus = cfg.Bind<float>("Skills.PresenceOfTheDarkLord", "AttackSpeedBonus", 1f, new ConfigDescription("Прибавка к скорости атаки (1.0 = +100%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); FrenzyDuration = cfg.Bind<float>("Skills.PresenceOfTheDarkLord", "Duration", 7f, "Длительность усиления, сек."); FrenzyCooldown = cfg.Bind<float>("Skills.PresenceOfTheDarkLord", "Cooldown", 15f, "Перезарядка, сек."); RequiemRadius = cfg.Bind<float>("Skills.RequiemOfSouls", "Radius", 30f, "Радиус волны, м."); RequiemCoefficient = cfg.Bind<float>("Skills.RequiemOfSouls", "DamageCoefficient", 10f, "Базовый урон в долях базового урона (10 = 1000%)."); RequiemPerSoulCoefficient = cfg.Bind<float>("Skills.RequiemOfSouls", "PerSoulCoefficient", 1f, "Дополнительный урон за каждую душу (1 = +100%)."); RequiemCooldown = cfg.Bind<float>("Skills.RequiemOfSouls", "Cooldown", 30f, "Перезарядка, сек."); RequiemFearDuration = cfg.Bind<float>("Skills.RequiemOfSouls", "FearDuration", 2.5f, "Длительность страха/оглушения, сек."); RequiemCastDelay = cfg.Bind<float>("Skills.RequiemOfSouls", "CastDelay", 0.55f, new ConfigDescription("Задержка между кастом и срабатыванием волны, сек (как замах в оригинале).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); DaedalusCritChance = cfg.Bind<float>("Items.Daedalus", "CritChance", 0.5f, new ConfigDescription("Шанс, что атака нанесёт двойной урон (0.5 = 50%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); DaedalusCritMultiplier = cfg.Bind<float>("Items.Daedalus", "CritMultiplier", 2f, "Множитель урона при срабатывании."); YashaKayaSpellMultiplier = cfg.Bind<float>("Items.YashaAndKaya", "SpellMultiplier", 1.5f, "Множитель урона Шадоурейза и Реквиема."); SoundVolume = cfg.Bind<float>("Audio", "EffectVolume", 0.45f, new ConfigDescription("Общая громкость всех звуков Шэдоу Фиенда. 0 — выключено, 1 — оригинальная громкость Dota.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SoundPrimaryVolume = cfg.Bind<float>("Audio", "PrimaryVolume", 0.8f, new ConfigDescription("Множитель громкости звуков ЛКМ.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SoundSkillVolume = cfg.Bind<float>("Audio", "SkillVolume", 1f, new ConfigDescription("Множитель громкости звуков умений.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SoundMaxDistance = cfg.Bind<float>("Audio", "MaxDistance", 65f, new ConfigDescription("Расстояние в метрах, дальше которого звуки умений почти не слышны.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 200f), Array.Empty<object>())); } } internal static class ShadowFiendFx { internal const string PrimarySound = "attack1.wav"; internal const string PrimarySound2 = "attack2.wav"; internal const string RazeSound = "shadowraze.wav"; internal const string RazeImpactSound = "raze_flames.wav"; internal const string FrenzySound = "frenzy.wav"; internal const string RequiemSound = "requiem_cast.wav"; internal const string RequiemImpactSound = "requiem.wav"; internal const string SoulSound = "impact.wav"; private const string AdditiveShaderKey = "RoR2/Base/Shaders/ParticleSimpleAdditive_switch.shader"; private const string AlphaShaderKey = "RoR2/Base/Shaders/ParticleSimpleAlpha_switch.shader"; private const string ArtPrefix = "ShadowFiend.Assets.dota."; private static Material _fire; private static Material _fireCore; private static Material _fireDark; private static Material _orb; private static Material _trail; private static Material _ring; private static Material _ringSoft; private static Mesh _quadMesh; private static Mesh _ringMesh; private static Mesh _trailMesh; private static bool _ready; private static int _primaryIndex; internal static IEnumerator Build() { Setup(); yield break; } private static void Setup() { //IL_004a: 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_00a8: 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_0106: 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_0164: Unknown result type (might be due to invalid IL or missing references) try { Shader val = LoadShader("RoR2/Base/Shaders/ParticleSimpleAdditive_switch.shader", "ParticleSimpleAdditive"); Shader shader = LoadShader("RoR2/Base/Shaders/ParticleSimpleAlpha_switch.shader", "ParticleSimpleAlpha") ?? val; if (Object.op_Implicit((Object)(object)val)) { _fire = CreateMaterial(val, LoadArt("fire_red.png"), new Color(1f, 1f, 1f), "ShadowFiendFireFX", additive: true); _fireCore = CreateMaterial(val, LoadArt("fire_core.png"), new Color(1f, 1f, 1f), "ShadowFiendFireCoreFX", additive: true); _fireDark = CreateMaterial(val, LoadArt("fire_dark.png"), new Color(1f, 1f, 1f), "ShadowFiendFireDarkFX", additive: true); _orb = CreateMaterial(val, LoadArt("soul_orb.png"), new Color(1f, 1f, 1f), "ShadowFiendOrbFX", additive: true); _trail = CreateMaterial(val, LoadArt("soul_trail.png"), new Color(1f, 1f, 1f), "ShadowFiendTrailFX", additive: true); _ring = CreateMaterial(shader, LoadArt("ring_fire.png"), new Color(1f, 1f, 1f), "ShadowFiendRingFX", additive: false); _ringSoft = CreateMaterial(shader, LoadArt("glow_radial.png"), new Color(1f, 1f, 1f), "ShadowFiendRingSoftFX", additive: false); } else { ShadowFiendPlugin.Log.LogError((object)"ShadowFiend FX: no usable particle shader was found."); } _quadMesh = BuildQuadMesh(); _ringMesh = BuildDiscMesh(); _trailMesh = BuildTrailMesh(); _ready = true; ShadowFiendPlugin.Log.LogInfo((object)("ShadowFiend FX ready: fire=" + TexName(_fire) + ", orb=" + TexName(_orb) + ", trail=" + TexName(_trail) + ", shader=" + (Object.op_Implicit((Object)(object)_fire) ? ((Object)_fire.shader).name : "none") + ", " + $"quad={(Object)(object)_quadMesh != (Object)null}, ring={(Object)(object)_ringMesh != (Object)null}, trail={(Object)(object)_trailMesh != (Object)null}.")); } catch (Exception ex) { _ready = false; ShadowFiendPlugin.Log.LogError((object)("ShadowFiend FX setup failed (skills still work): " + ex)); } } private static string TexName(Material material) { if (!Object.op_Implicit((Object)(object)material)) { return "null"; } if (!Object.op_Implicit((Object)(object)material.mainTexture)) { return "noTex"; } return ((Object)material.mainTexture).name; } private static Shader LoadShader(string key, string label) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 try { AsyncOperationHandle<Shader> val = Addressables.LoadAssetAsync<Shader>((object)key); val.WaitForCompletion(); if ((int)val.Status == 1 && Object.op_Implicit((Object)(object)val.Result)) { return val.Result; } ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend shader key was not found: " + key)); } catch (Exception ex) { ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend " + label + " shader load failed: " + ex.Message)); } return TryFind("Standard") ?? TryFind("Unlit/Color") ?? TryFind("Sprites/Default"); } private static Shader TryFind(string name) { try { return Shader.Find(name); } catch (Exception) { return null; } } private static Texture2D LoadArt(string fileName) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown try { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ShadowFiend.Assets.dota." + fileName); if (stream == null) { ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend effect art is missing: " + fileName)); return null; } byte[] array = new byte[stream.Length]; int num; for (int i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, array)) { ShadowFiendPlugin.Log.LogWarning((object)("Could not decode ShadowFiend effect art: " + fileName)); Object.Destroy((Object)(object)val); return null; } ((Object)val).name = "SHADOWFIEND_" + Path.GetFileNameWithoutExtension(fileName); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).anisoLevel = 2; return val; } catch (Exception ex) { ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend effect art load failed (" + fileName + "): " + ex.Message)); return null; } } private static Material CreateMaterial(Shader shader, Texture2D texture, Color tint, string name, bool additive) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(shader) { name = name }; if (val.HasProperty("_Color")) { val.SetColor("_Color", tint); } if (val.HasProperty("_TintColor")) { val.SetColor("_TintColor", tint); } if (val.HasProperty("_MainColor")) { val.SetColor("_MainColor", tint); } if (Object.op_Implicit((Object)(object)texture)) { if (val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)texture); } if (val.HasProperty("_BaseMap")) { val.SetTexture("_BaseMap", (Texture)(object)texture); } } if (val.HasProperty("_Additive")) { val.SetFloat("_Additive", additive ? 1f : 0f); } if (val.HasProperty("_Blend")) { val.SetFloat("_Blend", additive ? 1f : 0f); } if (val.HasProperty("_EnableCutout")) { val.SetFloat("_EnableCutout", 0f); } if (val.HasProperty("_Cull")) { val.SetFloat("_Cull", 0f); } if (additive) { val.EnableKeyword("_ADDITIVE"); } else { val.DisableKeyword("_ADDITIVE"); } val.SetOverrideTag("RenderType", "Transparent"); val.renderQueue = 3000; val.enableInstancing = false; return val; } internal static string NextPrimarySound() { if (_primaryIndex++ % 2 != 1) { return "attack1.wav"; } return "attack2.wav"; } internal static void SoulBolt(CharacterBody body, Vector3 origin, Vector3 direction, float range) { //IL_0009: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_017a: Unknown result type (might be due to invalid IL or missing references) if (!Ready(body)) { return; } Vector3 val = AimDirection(direction, ((Component)body).transform.forward); Vector3 val2 = origin + val * 0.8f; Quaternion rotation = Quaternion.LookRotation(val, UpVector(val)); float num = Mathf.Min(range, 70f); float num2 = Mathf.Clamp(num / 55f, 0.25f, 1.6f); if (Object.op_Implicit((Object)(object)_quadMesh) && Object.op_Implicit((Object)(object)_orb)) { Spawn(ShadowFiendMeshVfx.Shape.Bolt, _quadMesh, _orb, body, val2, rotation, num2, 1.5f, 1.5f, 0f, num, val); } if (Object.op_Implicit((Object)(object)_trailMesh) && Object.op_Implicit((Object)(object)_trail)) { Spawn(ShadowFiendMeshVfx.Shape.Trail, _trailMesh, _trail, body, val2, rotation, num2, 1f, 1f, 0f, num, val); } if (Object.op_Implicit((Object)(object)_quadMesh) && Object.op_Implicit((Object)(object)_fire)) { for (int i = 0; i < 3; i++) { Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, _fire, body, val2 + val * (num * (0.25f + (float)i * 0.2f)), rotation, 0.22f, 0.9f, 0.9f, 0f, 0f, Vector3.up, num2 * (0.2f + (float)i * 0.18f)); } } } internal static void Shadowraze(CharacterBody body, Vector3 point, float radius) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e2: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) if (!Ready(body)) { return; } if (Object.op_Implicit((Object)(object)_ringMesh) && Object.op_Implicit((Object)(object)_ring)) { SpawnGroundRing(body, point + Vector3.up * 0.05f, radius, 0.7f, _ring, 1f); SpawnGroundRing(body, point + Vector3.up * 0.08f, radius * 0.65f, 0.55f, _ringSoft, 0.8f, 0.06f); } if (!Object.op_Implicit((Object)(object)_quadMesh)) { return; } for (int i = 0; i < 7; i++) { float num = (float)i / 6f; float num2 = radius * (0.12f + num * 1.05f); float num3 = radius * Mathf.Lerp(1f, 0.45f, num); float num4 = (float)i * 0.028f; Vector3 val = point + Vector3.up * num2; Quaternion rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f); Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, _fire, body, val, rotation, 0.5f + num * 0.25f, num3 * 1.5f, num3 * 1.7f, 0f, 0f, Vector3.up, num4); if (num < 0.6f) { Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, _fireCore, body, val + Vector3.up * 0.2f, rotation, 0.35f + num * 0.2f, num3 * 0.7f, num3 * 0.9f, 0f, 0f, Vector3.up, num4 + 0.02f); } } for (int j = 0; j < 10; j++) { float num5 = Random.Range(0f, MathF.PI * 2f); float num6 = radius * Random.Range(0.15f, 0.9f); Vector3 val2 = new Vector3(Mathf.Cos(num5), 0f, Mathf.Sin(num5)) * num6; float num7 = radius * Random.Range(0.1f, 0.55f); Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, (j % 3 == 0) ? _fireDark : _fire, body, point + val2 + Vector3.up * num7, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), 0.45f + Random.Range(0f, 0.3f), radius * Random.Range(0.4f, 0.8f), radius * Random.Range(0.5f, 1f), 0f, 0f, Vector3.up, Random.Range(0.02f, 0.16f)); } ShadowFiendAudio.PlayDelayed("raze_flames.wav", point + Vector3.up * 0.5f, 0.05f, 0.9f); } internal static void Frenzy(CharacterBody body) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00e1: 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) if (!Ready(body)) { return; } Vector3 corePosition = body.corePosition; Quaternion rotation = Quaternion.LookRotation(((Component)body).transform.forward, Vector3.up); Vector3 velocity; if (Object.op_Implicit((Object)(object)_quadMesh) && Object.op_Implicit((Object)(object)_fire)) { for (int i = 0; i < 2; i++) { float num = ((i == 0) ? (-1f) : 1f); Vector3 val = ((Component)body).transform.right * num; velocity = ((Component)body).transform.forward + val * 0.9f; Quaternion rotation2 = Quaternion.LookRotation(((Vector3)(ref velocity)).normalized, Vector3.up); Mesh quadMesh = _quadMesh; Material fire = _fire; Vector3 position = corePosition + val * 1f; velocity = default(Vector3); Spawn(ShadowFiendMeshVfx.Shape.Sprite, quadMesh, fire, body, position, rotation2, 0.55f, 3f, 2.6f, 0f, 1.6f, val, 0f, velocity); } Mesh quadMesh2 = _quadMesh; Material fireCore = _fireCore; Vector3 up = Vector3.up; velocity = default(Vector3); Spawn(ShadowFiendMeshVfx.Shape.Sprite, quadMesh2, fireCore, body, corePosition, rotation, 0.4f, 2.6f, 2.6f, 0f, 0f, up, 0f, velocity); } if (Object.op_Implicit((Object)(object)_ringMesh) && Object.op_Implicit((Object)(object)_ring)) { SpawnGroundRing(body, ((Component)body).transform.position + Vector3.up * 0.05f, 4.5f, 0.55f, _ring, 1f); } if (Object.op_Implicit((Object)(object)_quadMesh) && Object.op_Implicit((Object)(object)_fireDark)) { Vector3 val2 = default(Vector3); for (int j = 0; j < 8; j++) { float num2 = (float)j * MathF.PI * 2f / 8f; ((Vector3)(ref val2))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); Mesh quadMesh3 = _quadMesh; Material fireDark = _fireDark; Vector3 position2 = ((Component)body).transform.position + val2 * 1.2f + Vector3.up * 0.5f; Quaternion rotation3 = Quaternion.LookRotation(val2, Vector3.up); Vector3 direction = val2; float delay = (float)j * 0.02f; velocity = default(Vector3); Spawn(ShadowFiendMeshVfx.Shape.Sprite, quadMesh3, fireDark, body, position2, rotation3, 0.5f, 1.6f, 1.6f, 0f, 1.3f, direction, delay, velocity); } } } internal static void RequiemCharge(CharacterBody body, int souls, float duration) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (Ready(body) && Object.op_Implicit((Object)(object)_quadMesh) && Object.op_Implicit((Object)(object)_fire)) { Vector3 corePosition = body.corePosition; int num = Mathf.Clamp(souls, 6, 24); float num2 = duration / (float)Mathf.Max(1, num); Vector3 val = default(Vector3); for (int i = 0; i < num; i++) { float num3 = (float)i * (MathF.PI * 2f / (float)num); ((Vector3)(ref val))..ctor(Mathf.Cos(num3), 0f, Mathf.Sin(num3)); Vector3 position = corePosition + val * 3.2f; Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, _fireCore, body, position, Quaternion.LookRotation(-val, Vector3.up), 0.45f, 0.8f, 0.8f, 0f, -2.6f, val, (float)i * num2); } ShadowFiendAudio.Play("requiem_cast.wav", corePosition); } } internal static void RequiemBlast(CharacterBody body, int souls) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_0105: 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_0117: 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_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_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_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028f: 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) if (!Ready(body)) { return; } ShadowFiendConfig cfg = ShadowFiendPlugin.Cfg; float num = Mathf.Max(5f, cfg.RequiemRadius.Value); Vector3 corePosition = body.corePosition; if (Object.op_Implicit((Object)(object)_ringMesh) && Object.op_Implicit((Object)(object)_ring)) { SpawnGroundRing(body, ((Component)body).transform.position + Vector3.up * 0.05f, num, 0.95f, _ring, 1f); SpawnGroundRing(body, ((Component)body).transform.position + Vector3.up * 0.1f, num * 0.72f, 0.75f, _ringSoft, 0.8f, 0.1f); } if (!Object.op_Implicit((Object)(object)_quadMesh)) { return; } if (Object.op_Implicit((Object)(object)_fireCore)) { Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, _fireCore, body, corePosition, Quaternion.identity, 0.5f, 5f, 5f, 0f, 0f, Vector3.up); } int num2 = Mathf.Clamp(souls, 6, 24); Vector3 val = default(Vector3); for (int i = 0; i < num2; i++) { float num3 = (float)i * (MathF.PI * 2f / (float)num2) + Random.Range(-0.08f, 0.08f); ((Vector3)(ref val))..ctor(Mathf.Cos(num3), 0f, Mathf.Sin(num3)); Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, _fire, body, corePosition + val * 0.8f, Quaternion.LookRotation(val, Vector3.up), 0.75f, 1.7f, 1.7f, 0f, num * 0.9f, val, 0.03f + (float)(i % 5) * 0.025f); } if (Object.op_Implicit((Object)(object)_fireDark)) { Vector3 val2 = default(Vector3); for (int j = 0; j < 16; j++) { float num4 = (float)j * (MathF.PI / 8f); ((Vector3)(ref val2))..ctor(Mathf.Cos(num4), 0f, Mathf.Sin(num4)); Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, _fireDark, body, ((Component)body).transform.position + val2 * num * 0.55f + Vector3.up * 0.6f, Quaternion.LookRotation(val2, Vector3.up), 0.6f, 2.4f, 2.8f, 0f, num * 0.4f, val2, (float)j * 0.012f); } } ShadowFiendAudio.PlayDelayed("requiem.wav", corePosition, 0.05f); } internal static void SoulGain(CharacterBody body, int souls) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (Ready(body) && Object.op_Implicit((Object)(object)_quadMesh) && Object.op_Implicit((Object)(object)_fireCore)) { Vector3 position = body.corePosition + Vector3.up * 0.9f; float num = Mathf.Clamp(0.7f + (float)souls * 0.07f, 0.7f, 2.2f); Spawn(ShadowFiendMeshVfx.Shape.Sprite, _quadMesh, _fireCore, body, position, Quaternion.identity, 0.55f, num, num, 0f, 1.1f, Vector3.up); } } private static void SpawnGroundRing(CharacterBody body, Vector3 position, float radius, float life, Material material, float heightScale, float delay = 0f) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)material) && Object.op_Implicit((Object)(object)_ringMesh)) { Spawn(ShadowFiendMeshVfx.Shape.Ring, _ringMesh, material, body, position, Quaternion.identity, life, 1f, heightScale, radius, 0f, ((Component)body).transform.forward, delay); } } private static bool Ready(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return false; } if (_ready) { return Object.op_Implicit((Object)(object)_fire); } return false; } private static void Spawn(ShadowFiendMeshVfx.Shape shape, Mesh mesh, Material material, CharacterBody body, Vector3 position, Quaternion rotation, float life, float width, float height, float radius, float travel, Vector3 direction, float delay = 0f, Vector3 velocity = default(Vector3)) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)mesh) || !Object.op_Implicit((Object)(object)material)) { return; } try { GameObject val = new GameObject("ShadowFiend" + shape.ToString() + "FX"); val.transform.SetPositionAndRotation(position, rotation); val.transform.localScale = Vector3.zero; val.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = material; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; ((Renderer)obj).lightProbeUsage = (LightProbeUsage)0; ((Renderer)obj).reflectionProbeUsage = (ReflectionProbeUsage)0; val.AddComponent<ShadowFiendMeshVfx>().Configure(shape, life, width, height, radius, travel, direction, position, delay, velocity, rotation); } catch (Exception ex) { ShadowFiendPlugin.Log.LogWarning((object)("ShadowFiend FX spawn failed: " + ex.Message)); } } private static Vector3 AimDirection(Vector3 direction, Vector3 fallback) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (((Vector3)(ref direction)).sqrMagnitude < 0.001f) { direction = fallback; } if (!(((Vector3)(ref direction)).sqrMagnitude < 0.001f)) { return ((Vector3)(ref direction)).normalized; } return Vector3.forward; } private static Vector3 UpVector(Vector3 forward) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (!(Mathf.Abs(forward.y) > 0.985f)) { return Vector3.up; } return Vector3.forward; } private static Mesh BuildQuadMesh() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00a7: 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) List<Vector3> vertices = new List<Vector3> { new Vector3(-0.5f, 0f, 0f), new Vector3(0.5f, 0f, 0f), new Vector3(-0.5f, 1f, 0f), new Vector3(0.5f, 1f, 0f) }; List<Vector2> uvs = new List<Vector2> { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f) }; List<int> triangles = new List<int> { 0, 3, 1, 0, 2, 3 }; return Finish(vertices, uvs, triangles, "ShadowFiendQuadFX"); } private static Mesh BuildDiscMesh() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) List<Vector3> list = new List<Vector3>(50); List<Vector2> list2 = new List<Vector2>(50); List<int> list3 = new List<int>(144); list.Add(new Vector3(0f, 0f, 0f)); list2.Add(new Vector2(0.5f, 0.5f)); for (int i = 0; i <= 48; i++) { float num = (float)i / 48f * MathF.PI * 2f; float num2 = Mathf.Cos(num); float num3 = Mathf.Sin(num); list.Add(new Vector3(num2, 0f, num3)); list2.Add(new Vector2(num2 * 0.5f + 0.5f, num3 * 0.5f + 0.5f)); } for (int j = 1; j <= 48; j++) { list3.Add(0); list3.Add(j + 1); list3.Add(j); } return Finish(list, list2, list3, "ShadowFiendRingFX"); } private static Mesh BuildTrailMesh() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_00a7: 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) List<Vector3> vertices = new List<Vector3> { new Vector3(-1f, 0f, -0.12f), new Vector3(1f, 0f, -0.12f), new Vector3(-1f, 0f, 0.12f), new Vector3(1f, 0f, 0.12f) }; List<Vector2> uvs = new List<Vector2> { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f) }; List<int> triangles = new List<int> { 0, 3, 1, 0, 2, 3 }; return Finish(vertices, uvs, triangles, "ShadowFiendTrailFX"); } private static Mesh Finish(List<Vector3> vertices, List<Vector2> uvs, List<int> triangles, string name) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown Mesh val = new Mesh { name = name }; if (vertices.Count > 65535) { val.indexFormat = (IndexFormat)1; } val.SetVertices(vertices); val.SetUVs(0, uvs); val.SetTriangles(triangles, 0); val.RecalculateNormals(); val.RecalculateBounds(); return val; } } internal static class ShadowFiendHooks { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__OnStatCoefficients; public static Action<DamageReport> <1>__OnDamageDealt; public static Action<DamageReport> <2>__OnDeath; public static Action<CharacterBody> <3>__OnBodyStart; } private static bool _installed; internal static void Init() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (!_installed) { _installed = true; object obj = <>O.<0>__OnStatCoefficients; if (obj == null) { StatHookEventHandler val = OnStatCoefficients; <>O.<0>__OnStatCoefficients = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; GlobalEventManager.onServerDamageDealt += OnDamageDealt; GlobalEventManager.onDeathProcServer += OnDeath; CharacterBody.onBodyStartGlobal += OnBodyStart; } } internal static void Shutdown() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (_installed) { _installed = false; object obj = <>O.<0>__OnStatCoefficients; if (obj == null) { StatHookEventHandler val = OnStatCoefficients; <>O.<0>__OnStatCoefficients = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients -= (StatHookEventHandler)obj; GlobalEventManager.onServerDamageDealt -= OnDamageDealt; GlobalEventManager.onDeathProcServer -= OnDeath; CharacterBody.onBodyStartGlobal -= OnBodyStart; } } private static void OnStatCoefficients(CharacterBody body, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)body)) { return; } if (Object.op_Implicit((Object)(object)((Component)body).GetComponent<ShadowFiendBodyController>())) { float num = ShadowFiendSouls.DamageMultiplier(body); if (num > 0f) { args.damageMultAdd += num; } if (Object.op_Implicit((Object)(object)ShadowFiendBuffs.SpeedBuff) && body.HasBuff(ShadowFiendBuffs.SpeedBuff)) { args.moveSpeedMultAdd += ShadowFiendPlugin.Cfg.FrenzySpeedBonus.Value; args.attackSpeedMultAdd += ShadowFiendPlugin.Cfg.FrenzyAttackSpeedBonus.Value; } } ShadowFiendArmorShred component = ((Component)body).GetComponent<ShadowFiendArmorShred>(); if (Object.op_Implicit((Object)(object)component) && component.armorReduction > 0f) { args.armorAdd -= component.armorReduction; } } private static void OnDamageDealt(DamageReport report) { _ = NetworkServer.active; } private static void OnDeath(DamageReport report) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } CharacterBody attackerBody = report.attackerBody; if (Object.op_Implicit((Object)(object)attackerBody) && Object.op_Implicit((Object)(object)((Component)attackerBody).GetComponent<ShadowFiendBodyController>())) { CharacterMaster val = (Object.op_Implicit((Object)(object)report.attackerMaster) ? report.attackerMaster : attackerBody.master); if (Object.op_Implicit((Object)(object)val) && (!Object.op_Implicit((Object)(object)report.victimBody) || !((Object)(object)report.victimBody == (Object)(object)attackerBody)) && ShadowFiendSouls.RegisterKill(attackerBody, val)) { ShadowFiendMasterController shadowFiendMasterController = ShadowFiendSouls.State(val); int souls = (Object.op_Implicit((Object)(object)shadowFiendMasterController) ? shadowFiendMasterController.souls : 0); ShadowFiendAudio.Play("impact.wav", attackerBody.corePosition, 0.8f, ShadowFiendAudio.Channel.Passive); ShadowFiendFx.SoulGain(attackerBody, souls); } } } private static void OnBodyStart(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)((Component)body).GetComponent<ShadowFiendBodyController>())) { return; } ShadowFiendMasterController shadowFiendMasterController = ShadowFiendSouls.State(body); if (Object.op_Implicit((Object)(object)shadowFiendMasterController)) { ShadowFiendSouls.SyncSoulDisplay(body, shadowFiendMasterController.souls); if (shadowFiendMasterController.souls > 0) { body.RecalculateStats(); } } } } internal static class ShadowFiendItems { internal const string TitleToken = "SHADOWFIEND_ITEM_TITLE"; internal const string SlotName = "ShadowFiendItem"; private static readonly FieldInfo SkillFamilyField = typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.NonPublic); internal static SkillDef None { get; private set; } internal static SkillDef Daedalus { get; private set; } internal static SkillDef YashaKaya { get; private set; } internal static SkillDef Selected(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body)) { return null; } ShadowFiendBodyController component = ((Component)body).GetComponent<ShadowFiendBodyController>(); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)component.item)) { return null; } return component.item.skillDef; } internal static bool Has(CharacterBody body, SkillDef item) { if (Object.op_Implicit((Object)(object)item)) { return (Object)(object)Selected(body) == (Object)(object)item; } return false; } internal static void Build(GameObject bodyPrefab) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0132: 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) if (!Object.op_Implicit((Object)(object)bodyPrefab)) { return; } ShadowFiendBodyController component = bodyPrefab.GetComponent<ShadowFiendBodyController>(); if (!Object.op_Implicit((Object)(object)component)) { ShadowFiendPlugin.Log.LogError((object)"ShadowFiend body has no ShadowFiendBodyController; items were not installed."); return; } GenericSkill val = bodyPrefab.AddComponent<GenericSkill>(); if (!Object.op_Implicit((Object)(object)val)) { ShadowFiendPlugin.Log.LogError((object)"Could not add the item skill slot to the prefab."); return; } val.skillName = "ShadowFiendItem"; val.loadoutTitleToken = "SHADOWFIEND_ITEM_TITLE"; val.hideInCharacterSelect = false; val.hideInLoadoutSelect = false; component.item = val; None = Create("NONE", "ShadowFiendItemNone", ShadowFiendAssets.PassiveIcon); Daedalus = Create("DAEDALUS", "ShadowFiendItemDaedalus", ShadowFiendAssets.DaedalusIcon); YashaKaya = Create("YASHA_KAYA", "ShadowFiendItemYashaKaya", ShadowFiendAssets.YashaKayaIcon); SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val2).name = "ShadowFiendItemFamily"; SkillDef[] array = (SkillDef[])(object)new SkillDef[3] { None, Daedalus, YashaKaya }; Variant[] array2 = (Variant[])(object)new Variant[array.Length]; for (int i = 0; i < array.Length; i++) { int num = i; Variant val3 = new Variant { skillDef = array[i], unlockableDef = null }; ((Variant)(ref val3)).viewableNode = new Node(array[i].skillNameToken, false, (Node)null); array2[num] = val3; } val2.variants = array2; val2.defaultVariantIndex = 0u; AssignFamily(val, val2); ShadowFiendSkills.SkillFamilies.Add(val2); ShadowFiendPlugin.Log.LogInfo((object)"ShadowFiend item slot installed: None, Daedalus, Yasha and Kaya."); } private static void AssignFamily(GenericSkill slot, SkillFamily family) { if (SkillFamilyField != null) { SkillFamilyField.SetValue(slot, family); } else { ShadowFiendPlugin.Log.LogError((object)"Could not find GenericSkill._skillFamily; item assignment failed."); } } private static SkillDef Create(string token, string skillName, Sprite icon) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) SkillDef val = ScriptableObject.CreateInstance<SkillDef>(); ((Object)val).name = skillName; val.skillName = skillName; val.skillNameToken = "SHADOWFIEND_ITEM_" + token + "_NAME"; val.skillDescriptionToken = "SHADOWFIEND_ITEM_" + token + "_DESC"; val.icon = icon; val.activationState = new SerializableEntityStateType(typeof(Idle)); val.activationStateMachineName = "Body"; val.interruptPriority = (InterruptPriority)2; val.baseMaxStock = 1; val.baseRechargeInterval = 0f; val.rechargeStock = 1; val.requiredStock = 1; val.stockToConsume = 0; val.fullRestockOnAssign = true; val.mustKeyPress = true; val.cancelSprintingOnActivation = false; val.canceledFromSprinting = false; val.beginSkillCooldownOnSkillEnd = false; val.isCombatSkill = false; val.hideCooldown = true; val.hideStockCount = true; val.suppressSkillActivation = true; ShadowFiendSkills.SkillDefs.Add(val); return val; } } public sealed class ShadowFiendMasterController : MonoBehaviour { public int killCount; public int souls; public int killProgress; public float soulDamageBonus; } [DisallowMultipleComponent] internal sealed class ShadowFiendMeshVfx : MonoBehaviour { internal enum Shape { Wave, Ring, Arc, Tentacle, Trail, Droplet, Sprite, Bolt } private Shape _shape; private float _life; private float _width; private float _height; private float _radius; private float _travel; private float _delay; private Vector3 _origin; private Vector3 _direction; private Vector3 _velocity; private Quaternion _baseRotation = Quaternion.identity; private float _age; private bool _started; private MeshRenderer _renderer; private MaterialPropertyBlock _block; private Color _baseColor = Color.white; private bool _hasColor; private bool _hasCutoff; private bool _hasFade; internal void Configure(Shape shape, float life, float width, float height, float radius, float travel, Vector3 direction, Vector3 origin, float delay, Vector3 velocity = default(Vector3), Quaternion baseRotation = default(Quaternion)) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_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_005c: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) _shape = shape; _life = Mathf.Max(0.05f, life); _width = width; _height = height; _radius = radius; _travel = travel; _direction = ((((Vector3)(ref direction)).sqrMagnitude > 0.001f) ? ((Vector3)(ref direction)).normalized : Vector3.forward); _origin = origin; _delay = delay; _velocity = velocity; _baseRotation = ((baseRotation == default(Quaternion)) ? Quaternion.identity : baseRotation); ((Component)this).transform.localScale = Vector3.zero; } private void Update() { //IL_0042: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing refe