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 Tidehunter v0.1.0
Tidehunter.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 TidehunterMod.Content; using TidehunterMod.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("Tidehunter")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("Tidehunter")] [assembly: AssemblyTitle("Tidehunter")] [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 TidehunterMod { [BepInPlugin("com.tidehunter.mod", "Tidehunter", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class TidehunterPlugin : BaseUnityPlugin { public const string PluginGuid = "com.tidehunter.mod"; public const string PluginName = "Tidehunter"; public const string PluginVersion = "0.1.0"; internal static ManualLogSource Log; internal static TidehunterConfig Cfg; private Harmony _harmony; private void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Cfg = new TidehunterConfig(((BaseUnityPlugin)this).Config); Log.LogInfo((object)"Tidehunter 0.1.0 loading (Dota 2 survivor prototype on the Commando body)."); TidehunterTokens.Init(); TidehunterHooks.Init(); new TidehunterContentPack().Initialize(); _harmony = new Harmony("com.tidehunter.mod"); _harmony.PatchAll(typeof(TidehunterDamagePatch).Assembly); Log.LogInfo((object)"Tidehunter bootstrap complete."); } private void OnDestroy() { TidehunterHooks.Shutdown(); if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } } } internal static class TidehunterAssets { private const string ResourcePrefix = "Tidehunter.Assets."; internal static Texture2D Portrait { get; private set; } internal static Sprite PrimaryIcon { get; private set; } internal static Sprite GushIcon { get; private set; } internal static Sprite AnchorIcon { get; private set; } internal static Sprite RavageIcon { get; private set; } internal static Sprite PassiveIcon { get; private set; } internal static Sprite SpeedBuffIcon { get; private set; } internal static Sprite GushBuffIcon { get; private set; } internal static Sprite PhaseBootsIcon { get; private set; } internal static Sprite HeartIcon { get; private set; } internal static void Build() { if (!Object.op_Implicit((Object)(object)Portrait)) { Portrait = LoadTexture("portrait.png"); PrimaryIcon = LoadSprite("primary.png"); GushIcon = LoadSprite("gush.png"); AnchorIcon = LoadSprite("anchor.png"); RavageIcon = LoadSprite("ravage.png"); PassiveIcon = LoadSprite("passive.png"); SpeedBuffIcon = LoadSprite("buff_speed.png"); GushBuffIcon = LoadSprite("buff_gush.png"); } } internal static IEnumerator LoadRelicIcons() { PhaseBootsIcon = LoadSprite("relic_phase_boots.png"); HeartIcon = LoadSprite("relic_heart.png"); if (!Object.op_Implicit((Object)(object)PhaseBootsIcon) || !Object.op_Implicit((Object)(object)HeartIcon)) { TidehunterPlugin.Log.LogWarning((object)"Tidehunter relic icons fell back to the embedded passive art."); if (!Object.op_Implicit((Object)(object)PhaseBootsIcon)) { PhaseBootsIcon = LoadSprite("passive.png"); } if (!Object.op_Implicit((Object)(object)HeartIcon)) { HeartIcon = LoadSprite("passive.png"); } } yield break; } private static Sprite SolidSprite(Color color, string name) { //IL_0000: 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_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = SolidTexture(color); ((Object)val).name = name; 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 = name; return obj; } 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("Tidehunter.Assets." + fileName); if (stream == null) { TidehunterPlugin.Log.LogError((object)("Tidehunter 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)) { TidehunterPlugin.Log.LogError((object)("Could not decode Tidehunter art: " + fileName)); Object.Destroy((Object)(object)val); return SolidTexture(new Color(0.08f, 0.35f, 0.38f)); } ((Object)val).name = "Tidehunter_" + 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 TidehunterAudio { 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 = "Tidehunter.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; TidehunterPlugin.Log.LogWarning((object)("Tidehunter audio is unavailable: " + ex.Message)); } catch (Exception ex2) { TidehunterPlugin.Log.LogWarning((object)("Tidehunter 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)TidehunterAudioDriver.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)TidehunterAudioDriver.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; TidehunterPlugin.Log.LogWarning((object)("Tidehunter 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; TidehunterConfig cfg = TidehunterPlugin.Cfg; TidehunterPlugin.Log.LogInfo((object)("Tidehunter 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}, " + $"passive x{cfg.SoundPassiveVolume.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, TidehunterPlugin.Cfg.SoundMaxDistance.Value); return Mathf.Clamp(1f - (num - 6f) / num2, 0.12f, 1f); } private static float ChannelGain(Channel channel) { TidehunterConfig cfg = TidehunterPlugin.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.SoundPassiveVolume.Value), _ => 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("Tidehunter.Assets.dota." + fileName); if (stream == null) { TidehunterPlugin.Log.LogWarning((object)("Tidehunter 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) { TidehunterPlugin.Log.LogWarning((object)("Tidehunter sound is not usable PCM: " + fileName)); } } } catch (Exception ex) { TidehunterPlugin.Log.LogWarning((object)("Tidehunter 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 TidehunterAudioDriver : MonoBehaviour { private static TidehunterAudioDriver _instance; internal static TidehunterAudioDriver 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("TidehunterAudioDriver"); Object.DontDestroyOnLoad((Object)val); _instance = val.AddComponent<TidehunterAudioDriver>(); return _instance; } } private void Update() { TidehunterAudio.Tick(); } private void OnDestroy() { TidehunterAudio.ReleaseAll(); if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } } public sealed class TidehunterBodyController : MonoBehaviour { public float damageTakenAccumulator; public GenericSkill relic; private CharacterBody _body; private float _regenCarry; private const float RegenInterval = 0.25f; private void Awake() { _body = ((Component)this).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)relic)) { relic = FindRelicSlot(); } } private GenericSkill FindRelicSlot() { 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 == "TidehunterRelic") { return components[i]; } } return null; } private void FixedUpdate() { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)_body) || !Object.op_Implicit((Object)(object)_body.healthComponent)) { return; } HealthComponent healthComponent = _body.healthComponent; if (!healthComponent.alive) { _regenCarry = 0f; return; } if (!TidehunterRelics.Has(_body, TidehunterRelics.HeartOfTarrasque)) { _regenCarry = 0f; return; } float num = _body.maxHealth * TidehunterPlugin.Cfg.HeartRegenFraction.Value; if (!(num <= 0f)) { _regenCarry += num * Time.fixedDeltaTime; if (!(_regenCarry < num * 0.25f)) { float regenCarry = _regenCarry; _regenCarry = 0f; healthComponent.Heal(regenCarry, default(ProcChainMask), false); } } } } internal static class TidehunterBuffs { internal static readonly List<BuffDef> All = new List<BuffDef>(); internal static BuffDef SpeedBuff { get; private set; } internal static BuffDef GushDebuff { 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) if (!Object.op_Implicit((Object)(object)SpeedBuff)) { SpeedBuff = Create("TidehunterSpeedBuff", TidehunterAssets.SpeedBuffIcon, new Color(0.22f, 0.95f, 0.78f), isDebuff: false); GushDebuff = Create("TidehunterGushDebuff", TidehunterAssets.GushBuffIcon, new Color(0.28f, 0.55f, 1f), isDebuff: true); } } 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 TidehunterCombat { internal static void Cone(CharacterBody owner, Vector3 aimDirection, float radius, float angleDegrees, float coefficient, DamageSource source) { //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_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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0091: 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_0099: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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; Vector3 val = Flatten(aimDirection, ((Component)owner).transform.forward); HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>(); bool crit = owner.RollCrit(); LayerIndex val2 = LayerIndex.entityPrecise; Collider[] array = Physics.OverlapSphere(corePosition, radius, LayerMask.op_Implicit(((LayerIndex)(ref val2)).mask), (QueryTriggerInteraction)2); foreach (Collider val3 in array) { HealthComponent health = GetHealth(val3); if (!IsEnemy(owner, health) || hashSet.Contains(health)) { continue; } Vector3 val4 = val3.ClosestPoint(corePosition); Vector3 val5 = val4 - corePosition; val5.y = 0f; if (!(((Vector3)(ref val5)).sqrMagnitude > 0.01f) || !(Vector3.Angle(val, val5) > angleDegrees * 0.5f)) { val2 = LayerIndex.world; if (!Physics.Linecast(corePosition, val4, LayerMask.op_Implicit(((LayerIndex)(ref val2)).mask), (QueryTriggerInteraction)1)) { hashSet.Add(health); Hit(owner, health, val4, owner.damage * coefficient, crit, source); } } } } internal static void Wave(CharacterBody owner, Vector3 aimDirection, float width, float length, float coefficient, DamageSource source, float debuffDuration) { //IL_001d: 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_0029: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_011b: 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 = AimDirection(aimDirection, ((Component)owner).transform.forward); Vector3 val2 = owner.corePosition + val * 0.8f; Vector3 val3 = val2 + val * (length * 0.5f); Vector3 val4 = default(Vector3); ((Vector3)(ref val4))..ctor(width * 0.5f, 3f, length * 0.5f); Quaternion val5 = Quaternion.LookRotation(val, UpVector(val)); HashSet<HealthComponent> hashSet = new HashSet<HealthComponent>(); bool crit = owner.RollCrit(); Vector3 val6 = val4; LayerIndex val7 = LayerIndex.entityPrecise; Collider[] array = Physics.OverlapBox(val3, val6, val5, LayerMask.op_Implicit(((LayerIndex)(ref val7)).mask), (QueryTriggerInteraction)2); foreach (Collider val8 in array) { HealthComponent health = GetHealth(val8); if (!IsEnemy(owner, health) || hashSet.Contains(health)) { continue; } Vector3 val9 = val8.ClosestPoint(val2); val7 = LayerIndex.world; if (!Physics.Linecast(val2, val9, LayerMask.op_Implicit(((LayerIndex)(ref val7)).mask), (QueryTriggerInteraction)1)) { hashSet.Add(health); Hit(owner, health, val9, owner.damage * coefficient, crit, source); if (debuffDuration > 0f && Object.op_Implicit((Object)(object)TidehunterBuffs.GushDebuff)) { health.body.AddTimedBuff(TidehunterBuffs.GushDebuff, debuffDuration); } } } } internal static void Radial(CharacterBody owner, float radius, float coefficient, DamageSource source, 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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(); 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)) { continue; } hashSet.Add(health); Vector3 point = val.ClosestPoint(corePosition); Hit(owner, health, point, owner.damage * coefficient, crit, source); if (stunDuration > 0f) { SetStateOnHurt component = ((Component)health).GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component) && component.canBeStunned) { component.SetStun(stunDuration); } } } } 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; } private 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 Vector3 Flatten(Vector3 direction, Vector3 fallback) { //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_003f: 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) direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude < 0.001f) { direction = fallback; direction.y = 0f; } if (!(((Vector3)(ref direction)).sqrMagnitude < 0.001f)) { return ((Vector3)(ref direction)).normalized; } return Vector3.forward; } 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 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 TidehunterConfig { 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<float> PassiveDamageReduction; public readonly ConfigEntry<float> PassiveThreshold; public readonly ConfigEntry<float> PassiveSpeedBonus; public readonly ConfigEntry<float> PassiveSpeedDuration; public readonly ConfigEntry<float> PassiveHealthPerKill; public readonly ConfigEntry<float> PrimaryCoefficient; public readonly ConfigEntry<float> PrimaryRange; public readonly ConfigEntry<float> PrimaryAngle; public readonly ConfigEntry<float> PrimaryCooldown; public readonly ConfigEntry<float> GushCoefficient; public readonly ConfigEntry<float> GushWidth; public readonly ConfigEntry<float> GushLength; public readonly ConfigEntry<float> GushCooldown; public readonly ConfigEntry<float> GushSlow; public readonly ConfigEntry<float> GushDamageAmp; public readonly ConfigEntry<float> GushDebuffDuration; public readonly ConfigEntry<float> AnchorCoefficient; public readonly ConfigEntry<float> AnchorRadius; public readonly ConfigEntry<float> AnchorCooldown; public readonly ConfigEntry<float> RavageCoefficient; public readonly ConfigEntry<float> RavageRadius; public readonly ConfigEntry<float> RavageCooldown; public readonly ConfigEntry<float> RavageStun; public readonly ConfigEntry<float> BootsMoveSpeed; public readonly ConfigEntry<float> BootsArmor; public readonly ConfigEntry<float> HeartKillHealthMultiplier; public readonly ConfigEntry<float> HeartRegenFraction; public readonly ConfigEntry<float> SoundVolume; public readonly ConfigEntry<float> SoundPrimaryVolume; public readonly ConfigEntry<float> SoundSkillVolume; public readonly ConfigEntry<float> SoundPassiveVolume; public readonly ConfigEntry<float> SoundMaxDistance; public readonly ConfigEntry<float> HealthPerRadiusStep; public readonly ConfigEntry<float> RadiusPerStep; public readonly ConfigEntry<bool> HealthRadiusAppliesToPrimary; public readonly ConfigEntry<bool> HealthRadiusAppliesToGush; public readonly ConfigEntry<bool> HealthRadiusAppliesToAnchor; public readonly ConfigEntry<bool> HealthRadiusAppliesToRavage; public TidehunterConfig(ConfigFile cfg) { //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Expected O, but got Unknown //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Expected O, but got Unknown //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Expected O, but got Unknown //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Expected O, but got Unknown //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Expected O, but got Unknown //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Expected O, but got Unknown //IL_057f: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Expected O, but got Unknown //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Expected O, but got Unknown //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Expected O, but got Unknown BaseHealth = cfg.Bind<float>("Body", "BaseHealth", 180f, "Базовое здоровье Тайдхантера."); LevelHealth = cfg.Bind<float>("Body", "LevelHealth", 54f, "Прирост здоровья за уровень."); BaseDamage = cfg.Bind<float>("Body", "BaseDamage", 14f, "Базовый урон."); LevelDamage = cfg.Bind<float>("Body", "LevelDamage", 2.8f, "Прирост урона за уровень."); BaseArmor = cfg.Bind<float>("Body", "BaseArmor", 10f, "Базовая броня."); BaseMoveSpeed = cfg.Bind<float>("Body", "BaseMoveSpeed", 7f, "Базовая скорость передвижения."); PassiveDamageReduction = cfg.Bind<float>("Passive.KrakenShell", "DamageReduction", 0.15f, "Доля снижения входящего урона (0.15 = -15%)."); PassiveThreshold = cfg.Bind<float>("Passive.KrakenShell", "CleanseThreshold", 0.1f, "Доля максимального здоровья, после накопления которой снимаются дебаффы (0.10 = 10%)."); PassiveSpeedBonus = cfg.Bind<float>("Passive.KrakenShell", "SpeedBonus", 0.2f, "Прибавка к скорости передвижения после очистки (0.20 = +20%)."); PassiveSpeedDuration = cfg.Bind<float>("Passive.KrakenShell", "SpeedDuration", 10f, "Длительность прибавки к скорости, сек."); PassiveHealthPerKill = cfg.Bind<float>("Passive.KrakenShell", "MaxHealthPerKill", 5f, "Сколько максимального здоровья даёт каждое убийство."); PrimaryCoefficient = cfg.Bind<float>("Skills.Primary", "DamageCoefficient", 3.5f, "Урон ЛКМ в долях базового урона (3.5 = 350%)."); PrimaryRange = cfg.Bind<float>("Skills.Primary", "Range", 6f, "Радиус взмаха, м."); PrimaryAngle = cfg.Bind<float>("Skills.Primary", "Angle", 110f, "Угол конуса взмаха, градусы."); PrimaryCooldown = cfg.Bind<float>("Skills.Primary", "Cooldown", 0.45f, "Перезарядка между взмахами, сек."); GushCoefficient = cfg.Bind<float>("Skills.Gush", "DamageCoefficient", 7f, "Урон ПКМ в долях базового урона (7 = 700%)."); GushWidth = cfg.Bind<float>("Skills.Gush", "Width", 8f, "Ширина волны, м."); GushLength = cfg.Bind<float>("Skills.Gush", "Length", 60f, "Дальность волны, м."); GushCooldown = cfg.Bind<float>("Skills.Gush", "Cooldown", 7f, "Перезарядка, сек."); GushSlow = cfg.Bind<float>("Skills.Gush", "Slow", 0.35f, "Замедление цели (0.35 = -35% скорости)."); GushDamageAmp = cfg.Bind<float>("Skills.Gush", "DamageAmp", 0.25f, "Повышение получаемого целью урона (0.25 = +25%)."); GushDebuffDuration = cfg.Bind<float>("Skills.Gush", "DebuffDuration", 4f, "Длительность замедления и уязвимости, сек."); AnchorCoefficient = cfg.Bind<float>("Skills.AnchorSmash", "DamageCoefficient", 10f, "Урон Shift в долях базового урона (10 = 1000%)."); AnchorRadius = cfg.Bind<float>("Skills.AnchorSmash", "Radius", 15f, "Радиус удара, м."); AnchorCooldown = cfg.Bind<float>("Skills.AnchorSmash", "Cooldown", 10f, "Перезарядка, сек."); RavageCoefficient = cfg.Bind<float>("Skills.Ravage", "DamageCoefficient", 20f, "Урон R в долях базового урона (20 = 2000%)."); RavageRadius = cfg.Bind<float>("Skills.Ravage", "Radius", 30f, "Радиус, м."); RavageCooldown = cfg.Bind<float>("Skills.Ravage", "Cooldown", 20f, "Перезарядка, сек."); RavageStun = cfg.Bind<float>("Skills.Ravage", "StunDuration", 2.5f, "Длительность стана, сек."); BootsMoveSpeed = cfg.Bind<float>("Relics.PhaseBoots", "MoveSpeedBonus", 0.5f, new ConfigDescription("Прибавка к скорости передвижения от Phase Boots (0.50 = +50%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); BootsArmor = cfg.Bind<float>("Relics.PhaseBoots", "ArmorBonus", 10f, "Прибавка к броне от Phase Boots."); HeartKillHealthMultiplier = cfg.Bind<float>("Relics.HeartOfTarrasque", "KillHealthMultiplier", 2f, new ConfigDescription("Во сколько раз Heart of Tarrasque усиливает прирост здоровья за убийство.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); HeartRegenFraction = cfg.Bind<float>("Relics.HeartOfTarrasque", "RegenPercentOfMaxHealth", 0.03f, new ConfigDescription("Доля максимального здоровья, восстанавливаемая в секунду (0.03 = 3%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), Array.Empty<object>())); 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("Множитель громкости звуков умений: Gush, Anchor Smash, Ravage.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); SoundPassiveVolume = cfg.Bind<float>("Audio", "PassiveVolume", 0.7f, 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>())); HealthPerRadiusStep = cfg.Bind<float>("Scaling.HealthToRadius", "HealthPerStep", 100f, new ConfigDescription("Сколько максимального здоровья даёт одну прибавку к радиусам умений (100 = за каждые 100 HP).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 10000f), Array.Empty<object>())); RadiusPerStep = cfg.Bind<float>("Scaling.HealthToRadius", "RadiusPerStep", 1f, new ConfigDescription("Сколько метров радиуса добавляет каждая ступень (1 = +1 м за каждые 100 HP).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); HealthRadiusAppliesToPrimary = cfg.Bind<bool>("Scaling.HealthToRadius", "AffectsPrimary", true, "Учитывать прибавку в ЛКМ (Разрез)."); HealthRadiusAppliesToGush = cfg.Bind<bool>("Scaling.HealthToRadius", "AffectsGush", true, "Учитывать прибавку в ПКМ (Поток): увеличивает ширину и длину волны."); HealthRadiusAppliesToAnchor = cfg.Bind<bool>("Scaling.HealthToRadius", "AffectsAnchorSmash", true, "Учитывать прибавку в Shift (Удар якорем)."); HealthRadiusAppliesToRavage = cfg.Bind<bool>("Scaling.HealthToRadius", "AffectsRavage", true, "Учитывать прибавку в R (Разрушение)."); } } [HarmonyPatch(typeof(HealthComponent), "TakeDamage")] internal static class TidehunterDamagePatch { [HarmonyPrefix] private static void Prefix(HealthComponent __instance, ref DamageInfo __0) { if (!Object.op_Implicit((Object)(object)__instance) || __0.damage <= 0f) { return; } CharacterBody body = __instance.body; if (!Object.op_Implicit((Object)(object)body)) { return; } TidehunterConfig cfg = TidehunterPlugin.Cfg; if (cfg != null) { float num = 1f; if (Object.op_Implicit((Object)(object)((Component)body).GetComponent<TidehunterBodyController>())) { num *= 1f - cfg.PassiveDamageReduction.Value; } if (Object.op_Implicit((Object)(object)TidehunterBuffs.GushDebuff) && body.HasBuff(TidehunterBuffs.GushDebuff)) { num *= 1f + cfg.GushDamageAmp.Value; } if (num != 1f) { DamageInfo obj = __0; obj.damage *= num; } } } } internal static class TidehunterFx { internal const string PrimarySound = "primary1.wav"; internal const string PrimarySound2 = "primary2.wav"; internal const string PrimarySound3 = "primary3.wav"; internal const string GushSound = "gush.wav"; internal const string GushImpactSound = "gush_impact.wav"; internal const string AnchorSound = "anchor.wav"; internal const string RavageSound = "ravage.wav"; internal const string ShellSound = "shell.wav"; private const string ShaderKey = "RoR2/Base/Shaders/HGStandard.shader"; private const string TransparentShaderKey = "RoR2/Base/Shaders/HGStandardTransparent.shader"; private const string ArtPrefix = "Tidehunter.Assets.dota."; private static Material _water; private static Material _face; private static Material _foam; private static Material _splash; private static Material _ring; private static Material _ringSoft; private static Material _tentacle; private static Material _droplet; private static Mesh _quadMesh; private static Mesh _ringMesh; private static Mesh _tentacleMesh; 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_005e: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) try { Shader val = LoadShader("RoR2/Base/Shaders/HGStandard.shader", "HGStandard"); Shader val2 = LoadShader("RoR2/Base/Shaders/HGStandardTransparent.shader", "HGStandardTransparent") ?? val; if (Object.op_Implicit((Object)(object)val2)) { _water = CreateMaterial(val2, LoadArt("water_wave.png"), new Color(0.55f, 0.92f, 1f), "TidehunterWaterFX", new Vector2(1f, 1f)); _face = CreateMaterial(val2, LoadArt("water_face.png"), new Color(0.62f, 0.95f, 1f), "TidehunterWaterFaceFX", new Vector2(1f, 1f)); _foam = CreateMaterial(val2, LoadArt("foam.png"), new Color(1f, 1f, 1f), "TidehunterFoamFX", new Vector2(1f, 1f)); _splash = CreateMaterial(val2, LoadArt("splash.png"), new Color(0.92f, 0.99f, 1f), "TidehunterSplashFX", new Vector2(1f, 1f)); _ring = CreateMaterial(val2, LoadArt("ring_wave.png"), new Color(0.62f, 0.94f, 1f), "TidehunterRingFX", new Vector2(1f, 1f)); _ringSoft = CreateMaterial(val2, LoadArt("ring_fade.png"), new Color(0.85f, 0.98f, 1f), "TidehunterRingSoftFX", new Vector2(1f, 1f)); _tentacle = CreateMaterial(val2, LoadArt("tentacle.png"), new Color(0.72f, 0.93f, 1f), "TidehunterTentacleFX", new Vector2(1f, 1f)); _droplet = CreateMaterial(val2, LoadArt("droplet.png"), new Color(0.95f, 1f, 1f), "TidehunterDropletFX", new Vector2(1f, 1f)); } else { TidehunterPlugin.Log.LogError((object)"Tidehunter FX: no usable shader was found."); } _quadMesh = BuildQuadMesh(); _ringMesh = BuildDiscMesh(); _tentacleMesh = BuildTentacleMesh(); _ready = true; TidehunterPlugin.Log.LogInfo((object)("Tidehunter FX ready: water=" + TexName(_water) + ", face=" + TexName(_face) + ", foam=" + TexName(_foam) + ", ring=" + TexName(_ring) + ", tentacle=" + TexName(_tentacle) + ", " + string.Format("shader={0}, queue={1}, ", Object.op_Implicit((Object)(object)_water) ? ((Object)_water.shader).name : "none", Object.op_Implicit((Object)(object)_water) ? _water.renderQueue : 0) + $"quad={(Object)(object)_quadMesh != (Object)null}, ringMesh={(Object)(object)_ringMesh != (Object)null}, tentacleMesh={(Object)(object)_tentacleMesh != (Object)null}.")); } catch (Exception ex) { _ready = false; TidehunterPlugin.Log.LogError((object)("Tidehunter 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; } TidehunterPlugin.Log.LogWarning((object)("Tidehunter shader key was not found: " + key)); } catch (Exception ex) { TidehunterPlugin.Log.LogWarning((object)("Tidehunter " + 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("Tidehunter.Assets.dota." + fileName); if (stream == null) { TidehunterPlugin.Log.LogWarning((object)("Tidehunter 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)) { TidehunterPlugin.Log.LogWarning((object)("Could not decode Tidehunter effect art: " + fileName)); Object.Destroy((Object)(object)val); return null; } ((Object)val).name = "Tidehunter_" + Path.GetFileNameWithoutExtension(fileName); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).anisoLevel = 2; return val; } catch (Exception ex) { TidehunterPlugin.Log.LogWarning((object)("Tidehunter effect art load failed (" + fileName + "): " + ex.Message)); return null; } } private static Material CreateMaterial(Shader shader, Texture2D texture, Color tint, string name, Vector2 tiling) { //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) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: 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 (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.85f); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0.85f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0f); } if (val.HasProperty("_SpecularStrength")) { val.SetFloat("_SpecularStrength", 1f); } if (val.HasProperty("_EmPower")) { val.SetFloat("_EmPower", 0.25f); } if (val.HasProperty("_EmColor")) { val.SetColor("_EmColor", new Color(0.45f, 0.8f, 0.95f)); } if (val.HasProperty("_DitherOn")) { val.SetFloat("_DitherOn", 1f); } if (val.HasProperty("_Fade")) { val.SetFloat("_Fade", 1f); } if (val.HasProperty("_FadeBias")) { val.SetFloat("_FadeBias", 0.35f); } if (val.HasProperty("_EnableCutout")) { val.SetFloat("_EnableCutout", 1f); } if (val.HasProperty("_Cutoff")) { val.SetFloat("_Cutoff", 0.2f); } if (val.HasProperty("_Cull")) { val.SetFloat("_Cull", 0f); } if (Object.op_Implicit((Object)(object)texture) && val.HasProperty("_MainTex")) { val.SetTexture("_MainTex", (Texture)(object)texture); val.mainTextureScale = tiling; } val.DisableKeyword("_ALPHABLEND_ON"); val.DisableKeyword("_ALPHAPREMULTIPLY_ON"); val.EnableKeyword("_ALPHATEST_ON"); val.SetOverrideTag("RenderType", "TransparentCutout"); val.renderQueue = 2450; val.enableInstancing = false; return val; } internal static string NextPrimarySound() { return (_primaryIndex++ % 3) switch { 1 => "primary2.wav", 2 => "primary3.wav", _ => "primary1.wav", }; } internal static void Arc(CharacterBody body, Vector3 direction) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0051: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) if (Ready(body) && Object.op_Implicit((Object)(object)_quadMesh)) { Vector3 val = Flatten(direction, ((Component)body).transform.forward); Vector3 position = body.corePosition + val * 1f + Vector3.up * 0.45f; float num = 1f; if (TidehunterPlugin.Cfg.HealthRadiusAppliesToPrimary.Value) { float num2 = Mathf.Max(0.5f, TidehunterPlugin.Cfg.PrimaryRange.Value); num = Mathf.Max(1f, TidehunterScaling.Radius(body, num2) / num2); } for (int i = 0; i < 2; i++) { Quaternion rotation = Quaternion.LookRotation(val, Vector3.up) * Quaternion.Euler(0f, (float)i * 62f, 0f); Spawn(TidehunterMeshVfx.Shape.Wave, _quadMesh, _water, body, position, rotation, 0.34f, 2.6f * num, 1.5f * num, 0f, 1.9f * num, val, (float)i * 0.02f); } SpawnGroundRing(body, body.corePosition + val * 1.5f * num, 1.5f * num, 0.34f, _ringSoft, 0.55f); SpawnDroplets(body, body.corePosition + val * 1.4f * num, 7, 0.7f * num, 0.9f); } } internal static void GushWave(CharacterBody body, Vector3 direction) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_021d: 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_022e: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: 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_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: 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_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) if (!Ready(body) || !Object.op_Implicit((Object)(object)_quadMesh)) { return; } Vector3 val = AimDirection(direction, ((Component)body).transform.forward); Quaternion val2 = Quaternion.LookRotation(val, UpVector(val)); TidehunterConfig cfg = TidehunterPlugin.Cfg; float num = Mathf.Max(3f, cfg.GushWidth.Value); float num2 = Mathf.Max(6f, cfg.GushLength.Value); if (cfg.HealthRadiusAppliesToGush.Value) { float num3 = TidehunterScaling.BonusRadius(body); num += num3; num2 += num3 * 2f; } Vector3 val3 = body.corePosition + val * 0.8f; float num4 = Mathf.Clamp(num2 / 24f, 0.6f, 2.1f); for (int i = 0; i < 3; i++) { float num5 = num * (1f - (float)i * 0.16f); float num6 = 2.3f * (1f - (float)i * 0.14f); Vector3 val4 = val3; for (int j = 0; j < 2; j++) { Quaternion rotation = val2 * Quaternion.Euler(0f, (float)j * 70f, 0f); Spawn(TidehunterMeshVfx.Shape.Wave, _quadMesh, _water, body, val4, rotation, num4 + (float)i * 0.08f, num5, num6, 0f, num2 * (1f - (float)i * 0.05f), val, (float)i * 0.07f + (float)j * 0.015f); } Spawn(TidehunterMeshVfx.Shape.Wave, _quadMesh, _foam, body, val4 + val2 * Vector3.up * 0.35f, val2, num4 + (float)i * 0.08f, num5 * 0.8f, num6 * 0.75f, 0f, num2 * (1f - (float)i * 0.05f), val, (float)i * 0.07f); } if (Mathf.Abs(val.y) < 0.5f) { Vector3 val5 = Flatten(val, ((Component)body).transform.forward); Spawn(TidehunterMeshVfx.Shape.Trail, _ringMesh, _ringSoft, body, ((Component)body).transform.position + val5 * 0.8f + Vector3.up * 0.03f, Quaternion.LookRotation(val5, Vector3.up), num4 * 1.35f, num * 0.55f, 1f, 1f, num2 * 0.95f, val5); } SpawnDroplets(body, val3 + val * (num2 * 0.4f), 16, num * 0.4f, 1.2f); Spawn(TidehunterMeshVfx.Shape.Sprite, _quadMesh, _face, body, val3 + val * num2, Quaternion.identity, 0.55f, num * 0.75f, num * 0.75f, 0f, 0f, Vector3.up, Mathf.Min(num4 * 0.7f, 1.2f)); TidehunterAudio.PlayDelayed("gush_impact.wav", val3 + val * num2, Mathf.Min(num4 * 0.7f, 1.2f), 0.9f); } internal static void AnchorRing(CharacterBody body) { //IL_004c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_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_00c4: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (Ready(body) && Object.op_Implicit((Object)(object)_ringMesh)) { TidehunterConfig cfg = TidehunterPlugin.Cfg; float num = Mathf.Max(3f, cfg.AnchorRadius.Value); if (cfg.HealthRadiusAppliesToAnchor.Value) { num = TidehunterScaling.Radius(body, num); } Vector3 val = ((Component)body).transform.position + Vector3.up * 0.06f; SpawnGroundRing(body, val, num, 0.62f, _ring, 1f); SpawnGroundRing(body, val + Vector3.up * 0.02f, num * 0.92f, 0.5f, _ringSoft, 0.7f, 0.05f); Spawn(TidehunterMeshVfx.Shape.Sprite, _quadMesh, _splash, body, val, Quaternion.identity, 0.42f, num * 0.45f, num * 0.45f, 0f, 0f, Vector3.up); SpawnDroplets(body, ((Component)body).transform.position + Vector3.up * 0.35f, 18, num * 0.3f, 1.25f); } } internal static void Ravage(CharacterBody body) { //IL_004c: 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_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_0277: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) if (Ready(body) && Object.op_Implicit((Object)(object)_tentacleMesh)) { TidehunterConfig cfg = TidehunterPlugin.Cfg; float num = Mathf.Max(5f, cfg.RavageRadius.Value); if (cfg.HealthRadiusAppliesToRavage.Value) { num = TidehunterScaling.Radius(body, num); } Vector3 position = ((Component)body).transform.position; for (int i = 0; i < 14; i++) { float num2 = (float)i * MathF.PI * 2f / 13f; float num3 = ((i == 0) ? 0.35f : (num * Mathf.Lerp(0.15f, 0.72f, (float)(i % 4) / 3f))); Vector3 val = position + new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * num3; val.y = position.y - 0.15f; float num4 = ((i == 0) ? 5.4f : 3.3f) * Mathf.Lerp(0.85f, 1.25f, (float)(i % 3) / 2f); Quaternion rotation = Quaternion.Euler(Random.Range(-7f, 7f), num2 * 57.29578f + Random.Range(-30f, 30f), Random.Range(-7f, 7f)); Spawn(TidehunterMeshVfx.Shape.Tentacle, _tentacleMesh, _tentacle, body, val, rotation, 1.45f + (float)(i % 3) * 0.18f, num4 * 0.22f, num4, 0f, 0f, Vector3.up, (float)(i % 4) * 0.06f); Spawn(TidehunterMeshVfx.Shape.Sprite, _quadMesh, _splash, body, val + Vector3.up * 0.2f, Quaternion.identity, 0.4f, num4 * 0.3f, num4 * 0.3f, 0f, 0f, Vector3.up, (float)(i % 4) * 0.06f); } SpawnGroundRing(body, position + Vector3.up * 0.05f, num * 0.92f, 0.7f, _ring, 1f); SpawnGroundRing(body, position + Vector3.up * 0.07f, num * 0.55f, 0.55f, _ringSoft, 0.8f, 0.08f); SpawnDroplets(body, position + Vector3.up * 0.4f, 24, num * 0.5f, 1.35f); } } 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(TidehunterMeshVfx.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 || !Object.op_Implicit((Object)(object)_water)) { return false; } return true; } private static void SpawnDroplets(CharacterBody body, Vector3 center, int count, float spread, float scale) { //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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)_quadMesh) && Object.op_Implicit((Object)(object)_droplet)) { Vector3 val = default(Vector3); for (int i = 0; i < count; i++) { float num = Random.Range(0f, MathF.PI * 2f); ((Vector3)(ref val))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num)); Vector3 position = center + val * Random.Range(0f, spread); Vector3 velocity = val * Random.Range(1.5f, 4.4f) * scale + Vector3.up * Random.Range(3.4f, 7.8f) * scale; Spawn(TidehunterMeshVfx.Shape.Droplet, _quadMesh, _droplet, body, position, Quaternion.LookRotation(((Vector3)(ref velocity)).normalized, Vector3.up), 0.85f, 0.34f * scale, 0.34f * scale, 0f, 0f, Vector3.up, Random.Range(0f, 0.1f), velocity); } } } private static void Spawn(TidehunterMeshVfx.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("Tidehunter" + 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<TidehunterMeshVfx>().Configure(shape, life, width, height, radius, travel, direction, position, delay, velocity, rotation); } catch (Exception ex) { TidehunterPlugin.Log.LogWarning((object)("Tidehunter FX spawn failed: " + ex.Message)); } } private static Vector3 Flatten(Vector3 direction, Vector3 fallback) { //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_003f: 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) direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude < 0.001f) { direction = fallback; direction.y = 0f; } if (!(((Vector3)(ref direction)).sqrMagnitude < 0.001f)) { return ((Vector3)(ref direction)).normalized; } return Vector3.forward; } 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, "TidehunterQuadFX"); } 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, "TidehunterRingFX"); } private static Mesh BuildTentacleMesh() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(315); List<Vector2> list2 = new List<Vector2>(315); List<int> list3 = new List<int>(1680); Vector3 val = default(Vector3); for (int i = 0; i <= 20; i++) { float num = (float)i / 20f; float num2 = Mathf.Sin(num * MathF.PI * 1.15f) * 0.3f - num * num * 0.26f; float num3 = Mathf.Sin((num + 0.01f) * MathF.PI * 1.15f) * 0.3f - (num + 0.01f) * (num + 0.01f) * 0.26f; ((Vector3)(ref val))..ctor(num2, num, num2 * 0.3f); Vector3 val2 = new Vector3(num3, num + 0.01f, num3 * 0.3f) - val; Vector3 normalized = ((Vector3)(ref val2)).normalized; Vector3 forward = Vector3.forward; val2 = Vector3.Cross(normalized, forward); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (((Vector3)(ref val3)).sqrMagnitude < 0.001f) { val3 = Vector3.right; } float num4 = Mathf.Lerp(1f, 0.05f, Mathf.Pow(num, 0.72f)); if (num > 0.9f) { num4 *= Mathf.Max(0f, (1f - num) / 0.1f); } float num5 = 1f + 0.14f * Mathf.Sin(num * MathF.PI * 2.4f); for (int j = 0; j <= 14; j++) { float num6 = (float)j / 14f; float num7 = num6 * MathF.PI * 2f; Vector3 val4 = (forward * Mathf.Cos(num7) + val3 * Mathf.Sin(num7)) * num4 * num5; list.Add(val + val4); list2.Add(new Vector2(num6, num)); } } int num8 = 15; for (int k = 0; k < 20; k++) { for (int l = 0; l < 14; l++) { int num9 = k * num8 + l; list3.Add(num9); list3.Add(num9 + num8); list3.Add(num9 + 1); list3.Add(num9 + 1); list3.Add(num9 + num8); list3.Add(num9 + num8 + 1); } } return Finish(list, list2, list3, "TidehunterTentacleFX"); } 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 TidehunterHooks { [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)TidehunterBuffs.SpeedBuff) && body.HasBuff(TidehunterBuffs.SpeedBuff)) { args.moveSpeedMultAdd += TidehunterPlugin.Cfg.PassiveSpeedBonus.Value; } if (Object.op_Implicit((Object)(object)TidehunterBuffs.GushDebuff) && body.HasBuff(TidehunterBuffs.GushDebuff)) { args.moveSpeedMultAdd -= TidehunterPlugin.Cfg.GushSlow.Value; } if (!Object.op_Implicit((Object)(object)((Component)body).GetComponent<TidehunterBodyController>())) { return; } TidehunterConfig cfg = TidehunterPlugin.Cfg; if (TidehunterRelics.Has(body, TidehunterRelics.PhaseBoots)) { args.moveSpeedMultAdd += cfg.BootsMoveSpeed.Value; args.armorAdd += cfg.BootsArmor.Value; } if (Object.op_Implicit((Object)(object)body.master)) { TidehunterMasterController component = ((Component)body.master).GetComponent<TidehunterMasterController>(); if (Object.op_Implicit((Object)(object)component) && component.bonusMaxHealth > 0f) { args.baseHealthAdd += component.bonusMaxHealth; } } } private static void OnDamageDealt(DamageReport report) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } CharacterBody victimBody = report.victimBody; if (!Object.op_Implicit((Object)(object)victimBody)) { return; } TidehunterBodyController component = ((Component)victimBody).GetComponent<TidehunterBodyController>(); if (!Object.op_Implicit((Object)(object)component) || !victimBody.healthComponent.alive) { return; } float damageDealt = report.damageDealt; if (damageDealt <= 0f) { return; } component.damageTakenAccumulator += damageDealt; float num = victimBody.maxHealth * TidehunterPlugin.Cfg.PassiveThreshold.Value; if (!(num <= 0f) && !(component.damageTakenAccumulator < num)) { component.damageTakenAccumulator = 0f; CleanseSystem.CleanseBodyServer(victimBody, true, false, false, true, true, false); TidehunterAudio.Play("shell.wav", ((Component)victimBody).transform.position, 1f, TidehunterAudio.Channel.Passive); if (Object.op_Implicit((Object)(object)TidehunterBuffs.SpeedBuff)) { victimBody.AddTimedBuff(TidehunterBuffs.SpeedBuff, TidehunterPlugin.Cfg.PassiveSpeedDuration.Value); } } } private static void OnDeath(DamageReport report) { if (!NetworkServer.active) { return; } CharacterBody attackerBody = report.attackerBody; if (!Object.op_Implicit((Object)(object)attackerBody) || !Object.op_Implicit((Object)(object)((Component)attackerBody).GetComponent<TidehunterBodyController>())) { return; } 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))) { TidehunterMasterController tidehunterMasterController = ((Component)val).GetComponent<TidehunterMasterController>(); if (!Object.op_Implicit((Object)(object)tidehunterMasterController)) { tidehunterMasterController = ((Component)val).gameObject.AddComponent<TidehunterMasterController>(); } tidehunterMasterController.killCount++; float num = TidehunterPlugin.Cfg.PassiveHealthPerKill.Value; if (TidehunterRelics.Has(attackerBody, TidehunterRelics.HeartOfTarrasque)) { num *= TidehunterPlugin.Cfg.HeartKillHealthMultiplier.Value; } tidehunterMasterController.bonusMaxHealth += num; attackerBody.RecalculateStats(); } } private static void OnBodyStart(CharacterBody body) { if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)((Component)body).GetComponent<TidehunterBodyController>())) { return; } CharacterMaster master = body.master; if (Object.op_Implicit((Object)(object)master)) { if (!Object.op_Implicit((Object)(object)((Component)master).GetComponent<TidehunterMasterController>())) { ((Component)master).gameObject.AddComponent<TidehunterMasterController>(); } body.RecalculateStats(); } } } public sealed class TidehunterMasterController : Mo