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 Bernie v1.0.0
plugins/BernieMod.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.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BernieMod.Modules; using BernieMod.Modules.Characters; using BernieMod.Survivors.Bernie; using BernieMod.Survivors.Bernie.Components; using BernieMod.Survivors.Bernie.SkillStates; using EntityStates; using EntityStates.AI.Walker; using HG; using HG.BlendableTypes; using KinematicCharacterController; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ConVar; using RoR2.ContentManagement; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BernieMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+4185ab9f40f44c57e454d2f79127f9537d670741")] [assembly: AssemblyProduct("BernieMod")] [assembly: AssemblyTitle("BernieMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace BernieMod { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.antrim.BernieMod", "BernieMod", "1.0.0")] public class BerniePlugin : BaseUnityPlugin { public const string MODUID = "com.antrim.BernieMod"; public const string MODNAME = "BernieMod"; public const string MODVERSION = "1.0.0"; public const string DEVELOPER_PREFIX = "ANTRIM"; public static BerniePlugin instance; private void Awake() { instance = this; Log.Init(((BaseUnityPlugin)this).Logger); Language.Init(); new BernieSurvivor().Initialize(); new ContentPacks().Initialize(); } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void ErrorAssetBundle(string assetName, string bundleName) { Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } } namespace BernieMod.Survivors.Bernie { public static class BernieAssets { public static GameObject mittenProjectilePrefab; public static GameObject fireTrailPrefab; public static GameObject askBlastEffect; public static GameObject mittenImpactEffect; public static Material taxBeamMaterial; public static GameObject ramImpactEffect; public static GameObject launchEffect; public static GameObject stopEffect; public static GameObject thrusterEffect; public static GameObject landEffect; public static GameObject muzzleEffect; public static GameObject coinEffect; public static GameObject critImpactEffect; public static ModdedDamageType taxDamageType; private static AssetBundle _assetBundle; public static void Init(AssetBundle assetBundle) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) _assetBundle = assetBundle; taxDamageType = DamageAPI.ReserveDamageType(); BernieSound.Init(); fireTrailPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/FireTrail"); askBlastEffect = LoadGame<GameObject>("Prefabs/Effects/ImpactEffects/ExplosionVFX", "RoR2/Base/Common/VFX/OmniExplosionVFX.prefab"); mittenImpactEffect = LoadGame<GameObject>("Prefabs/Effects/OmniEffect/OmniExplosionVFXQuick", "RoR2/Base/Common/VFX/OmniExplosionVFXQuick.prefab"); ramImpactEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/KnockBackHitEnemiesImpact"); critImpactEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/ImpactCrowbar"); launchEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/ExplosionVFX"); stopEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/IgniteExplosionVFX"); thrusterEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/BoostJumpEffect"); landEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/CharacterLandImpact"); muzzleEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MuzzleFlashes/MuzzleflashFireMeatBall"); coinEffect = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/CoinImpact"); Log.Info($"effects: ram={ramImpactEffect} launch={launchEffect} stop={stopEffect} thruster={thrusterEffect} land={landEffect} muzzle={muzzleEffect} coin={coinEffect} mittenImpact={mittenImpactEffect}"); taxBeamMaterial = assetBundle.LoadAsset<Material>("matTaxBeam"); if (!Object.op_Implicit((Object)(object)taxBeamMaterial)) { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerGolem"); LineRenderer val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponentInChildren<LineRenderer>() : null); taxBeamMaterial = (Object.op_Implicit((Object)(object)val2) ? ((Renderer)val2).sharedMaterial : null); Log.Warning("matTaxBeam missing from bundle; using tracer material " + (object)taxBeamMaterial); } Material val3 = assetBundle.LoadAsset<Material>("matKnit"); if (Object.op_Implicit((Object)(object)val3)) { val3.SetFloat("_Cull", 0f); } CreateMittenProjectile(); } public static void Fx(GameObject prefab, Vector3 pos, float scale = 1f, bool transmit = true, Vector3? forward = null) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //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) if (Object.op_Implicit((Object)(object)prefab)) { EffectData val = new EffectData { origin = pos, scale = scale }; if (forward.HasValue) { val.rotation = Util.QuaternionSafeLookRotation(forward.Value); } EffectManager.SpawnEffect(prefab, val, transmit); } } public static void Shake(Vector3 pos, float amplitude, float duration = 0.3f, float radius = 40f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) ShakeEmitter.CreateSimpleShakeEmitter(pos, new Wave { amplitude = amplitude, frequency = 30f, cycleOffset = 0f }, duration, radius, true); } private static T LoadGame<T>(string legacyPath, string addressKey) where T : Object { //IL_0018: 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) T val = LegacyResourcesAPI.Load<T>(legacyPath); if (Object.op_Implicit((Object)(object)val)) { return val; } try { val = Addressables.LoadAssetAsync<T>((object)addressKey).WaitForCompletion(); } catch (Exception ex) { Log.Warning("addressable " + addressKey + ": " + ex.Message); } if (!Object.op_Implicit((Object)(object)val)) { Log.Warning("could not load " + legacyPath + " / " + addressKey); } return val; } private static void CreateMittenProjectile() { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) mittenProjectilePrefab = PrefabAPI.InstantiateClone(LoadGame<GameObject>("Prefabs/Projectiles/ToolbotGrenadeLauncherProjectile", "RoR2/Base/Toolbot/ToolbotGrenadeLauncherProjectile.prefab") ?? LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/CommandoGrenadeProjectile"), "BernieMittenProjectile", true); ProjectileSimple component = mittenProjectilePrefab.GetComponent<ProjectileSimple>(); if (Object.op_Implicit((Object)(object)component)) { component.desiredForwardSpeed = 70f; component.lifetime = 6f; } Rigidbody component2 = mittenProjectilePrefab.GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component2)) { component2.useGravity = true; } AntiGravityForce component3 = mittenProjectilePrefab.GetComponent<AntiGravityForce>(); if (Object.op_Implicit((Object)(object)component3)) { component3.antiGravityCoefficient = 0.45f; } ProjectileImpactExplosion component4 = mittenProjectilePrefab.GetComponent<ProjectileImpactExplosion>(); if (Object.op_Implicit((Object)(object)component4)) { ((ProjectileExplosion)component4).blastRadius = 4.5f; ((ProjectileExplosion)component4).blastDamageCoefficient = 1f; ((ProjectileExplosion)component4).falloffModel = (FalloffModel)0; component4.destroyOnEnemy = true; component4.destroyOnWorld = true; component4.lifetime = 6f; if (Object.op_Implicit((Object)(object)mittenImpactEffect)) { component4.impactEffect = mittenImpactEffect; } } ProjectileController component5 = mittenProjectilePrefab.GetComponent<ProjectileController>(); if (Object.op_Implicit((Object)(object)_assetBundle.LoadAsset<GameObject>("BernieMittenGhost"))) { GameObject val = _assetBundle.CreateProjectileGhostPrefab("BernieMittenGhost"); if (!Object.op_Implicit((Object)(object)val.GetComponent<MittenSpin>())) { val.AddComponent<MittenSpin>(); } component5.ghostPrefab = val; } component5.startSound = ""; mittenProjectilePrefab.AddComponent<MittenImpactSound>(); Content.AddProjectilePrefab(mittenProjectilePrefab); } } public class MittenImpactSound : MonoBehaviour { private void OnDestroy() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)Stage.instance)) { BernieSound.Play("sfx_mitten_hit", ((Component)this).transform.position, null, voice: false, 0.8f); } } } public class MittenSpin : MonoBehaviour { private Transform mesh; private void Awake() { mesh = ((((Component)this).transform.childCount > 0) ? ((Component)this).transform.GetChild(0) : ((Component)this).transform); } private void Update() { mesh.Rotate(720f * Time.deltaTime, 90f * Time.deltaTime, 0f, (Space)1); } } public static class BernieAudioEngine { public class Voice { public float[] data; public int pos; public volatile float left; public volatile float right; public volatile bool stopped; public bool loop; } private struct WaveFormatEx { public ushort wFormatTag; public ushort nChannels; public uint nSamplesPerSec; public uint nAvgBytesPerSec; public ushort nBlockAlign; public ushort wBitsPerSample; public ushort cbSize; } public const int SampleRate = 44100; private const int FramesPerBuffer = 768; private const int BufferCount = 4; private const int HeaderSize = 48; private const int FlagsOffset = 24; private const int WHDR_DONE = 1; private static readonly List<Voice> voices = new List<Voice>(); private static IntPtr device; private static Thread thread; private static volatile bool running; [DllImport("winmm.dll")] private static extern int waveOutOpen(out IntPtr hWaveOut, uint uDeviceID, ref WaveFormatEx lpFormat, IntPtr dwCallback, IntPtr dwInstance, uint fdwOpen); [DllImport("winmm.dll")] private static extern int waveOutPrepareHeader(IntPtr hWaveOut, IntPtr lpWaveOutHdr, int uSize); [DllImport("winmm.dll")] private static extern int waveOutUnprepareHeader(IntPtr hWaveOut, IntPtr lpWaveOutHdr, int uSize); [DllImport("winmm.dll")] private static extern int waveOutWrite(IntPtr hWaveOut, IntPtr lpWaveOutHdr, int uSize); [DllImport("winmm.dll")] private static extern int waveOutReset(IntPtr hWaveOut); [DllImport("winmm.dll")] private static extern int waveOutClose(IntPtr hWaveOut); public static bool Start() { if (running) { return true; } WaveFormatEx lpFormat = new WaveFormatEx { wFormatTag = 1, nChannels = 2, nSamplesPerSec = 44100u, wBitsPerSample = 16, nBlockAlign = 4, nAvgBytesPerSec = 176400u }; int num = waveOutOpen(out device, uint.MaxValue, ref lpFormat, IntPtr.Zero, IntPtr.Zero, 0u); if (num != 0) { Log.Error("BernieAudioEngine: waveOutOpen failed " + num); return false; } running = true; thread = new Thread(Run) { IsBackground = true, Name = "BernieAudio", Priority = ThreadPriority.AboveNormal }; thread.Start(); Application.quitting += Stop; Log.Info("BernieAudioEngine started"); return true; } public static void Stop() { running = false; thread?.Join(500); } public static Voice Play(float[] data, float left, float right, bool loop = false) { if (!running || data == null) { return null; } Voice voice = new Voice { data = data, left = left, right = right, loop = loop }; lock (voices) { voices.Add(voice); return voice; } } private static void Run() { IntPtr[] array = new IntPtr[4]; IntPtr[] array2 = new IntPtr[4]; int num = 3072; float[] array3 = new float[1536]; short[] array4 = new short[1536]; for (int i = 0; i < 4; i++) { array2[i] = Marshal.AllocHGlobal(num); array[i] = Marshal.AllocHGlobal(48); for (int j = 0; j < 48; j += 4) { Marshal.WriteInt32(array[i], j, 0); } Marshal.WriteIntPtr(array[i], 0, array2[i]); Marshal.WriteInt32(array[i], 8, num); waveOutPrepareHeader(device, array[i], 48); Marshal.WriteInt32(array[i], 24, Marshal.ReadInt32(array[i], 24) | 1); } try { while (running) { bool flag = false; for (int k = 0; k < 4; k++) { int num2 = Marshal.ReadInt32(array[k], 24); if ((num2 & 1) != 0) { Mix(array3); for (int l = 0; l < array3.Length; l++) { float num3 = array3[l]; num3 = ((num3 > 1f) ? 1f : ((num3 < -1f) ? (-1f) : num3)); array4[l] = (short)(num3 * 32767f); } Marshal.Copy(array4, 0, array2[k], array4.Length); Marshal.WriteInt32(array[k], 24, num2 & -2); waveOutWrite(device, array[k], 48); flag = true; } } if (!flag) { Thread.Sleep(3); } } } catch (Exception ex) { Log.Error("BernieAudioEngine: " + ex); } finally { waveOutReset(device); for (int m = 0; m < 4; m++) { waveOutUnprepareHeader(device, array[m], 48); Marshal.FreeHGlobal(array[m]); Marshal.FreeHGlobal(array2[m]); } waveOutClose(device); } } private static void Mix(float[] mix) { Array.Clear(mix, 0, mix.Length); lock (voices) { for (int num = voices.Count - 1; num >= 0; num--) { Voice voice = voices[num]; float left = voice.left; float right = voice.right; int num2 = mix.Length / 2; for (int i = 0; i < num2; i++) { if (voice.stopped) { break; } if (voice.pos >= voice.data.Length) { if (!voice.loop) { voice.stopped = true; break; } voice.pos = 0; } float num3 = voice.data[voice.pos++]; mix[i * 2] += num3 * left; mix[i * 2 + 1] += num3 * right; } if (voice.stopped) { voices.RemoveAt(num); } } } } public static float[] LoadWav(string path) { byte[] array = File.ReadAllBytes(path); int num = 1; int num2 = 44100; int num3 = 16; int num4 = -1; int num5 = 0; int num6; for (int i = 12; i + 8 <= array.Length; i += 8 + num6 + (num6 & 1)) { string text = Encoding.ASCII.GetString(array, i, 4); num6 = BitConverter.ToInt32(array, i + 4); if (text == "fmt ") { num = BitConverter.ToInt16(array, i + 10); num2 = BitConverter.ToInt32(array, i + 12); num3 = BitConverter.ToInt16(array, i + 22); } else if (text == "data") { num4 = i + 8; num5 = Math.Min(num6, array.Length - num4); break; } } if (num4 < 0 || num3 != 16) { throw new InvalidDataException($"{path}: need 16-bit PCM wav (bits={num3})"); } int num7 = num5 / (2 * num); float[] array2 = new float[num7]; for (int j = 0; j < num7; j++) { float num8 = 0f; for (int k = 0; k < num; k++) { num8 += (float)BitConverter.ToInt16(array, num4 + (j * num + k) * 2) / 32768f; } array2[j] = num8 / (float)num; } if (num2 == 44100) { return array2; } int num9 = (int)((long)num7 * 44100L / num2); float[] array3 = new float[num9]; double num10 = (double)num2 / 44100.0; for (int l = 0; l < num9; l++) { double num11 = (double)l * num10; int num12 = (int)num11; int num13 = Math.Min(num12 + 1, num7 - 1); float num14 = (float)(num11 - (double)num12); array3[l] = array2[num12] * (1f - num14) + array2[num13] * num14; } return array3; } } public static class BernieBuffs { public static BuffDef solidarityBuff; public static void Init(AssetBundle assetBundle) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) Sprite buffIcon = assetBundle.LoadAsset<Sprite>("texSolidarityBuff") ?? LegacyResourcesAPI.Load<BuffDef>("BuffDefs/Warbanner")?.iconSprite; solidarityBuff = Content.CreateAndAddBuff("BernieSolidarityBuff", buffIcon, new Color(0.85f, 0.2f, 0.2f), canStack: false, isDebuff: false); } } public static class BernieConfig { public static ConfigEntry<float> voiceVolume; public static ConfigEntry<float> sfxVolume; public static void Init() { voiceVolume = Config.BindAndOptions("Audio", "Voice volume", 1f, 0f, 2f, "Volume of Bernie's voice lines (multiplied by the game's SFX volume)"); sfxVolume = Config.BindAndOptions("Audio", "SFX volume", 1f, 0f, 2f, "Volume of Bernie's skill sounds (multiplied by the game's SFX volume)"); } } public class BernieDevTools : MonoBehaviour { public static bool enabledDev; private static readonly (KeyCode key, string cmd)[] binds = new(KeyCode, string)[11] { ((KeyCode)286, "god 1; no_enemies 1; stage1_pod 0"), ((KeyCode)287, "spawn_ai LemurianMaster 3"), ((KeyCode)288, "spawn_ai BeetleMaster 2 Fire"), ((KeyCode)289, "kill_all"), ((KeyCode)290, "give_money 200"), ((KeyCode)291, "spawn_ai GolemMaster 1 Lightning 1"), ((KeyCode)292, "spawn_ai LemurianMaster 5 None 1"), ((KeyCode)293, "time_scale 0.3"), ((KeyCode)285, "time_scale 1"), ((KeyCode)284, "next_stage golemplains"), ((KeyCode)277, "spawn_ai BeetleMaster 4; spawn_ai LemurianMaster 3") }; public static void Init() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown enabledDev = Config.MyConfig.Bind<bool>("Dev", "Enable dev hotkeys", false, "F5 god+no spawns, F6 lemurians, F7 fire beetles, F8 kill all, F9 money, F10 braindead elite golem, F11 braindead lemurians (needs DebugToolkit)").Value; if (enabledDev) { GameObject val = new GameObject("BernieDevTools"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<BernieDevTools>(); Log.Info("BernieDevTools enabled"); } } private void Update() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) (KeyCode, string)[] array = binds; for (int i = 0; i < array.Length; i++) { var (val, text) = array[i]; if (!Input.GetKeyDown(val)) { continue; } NetworkUser val2 = ((NetworkUser.readOnlyLocalPlayersList.Count > 0) ? NetworkUser.readOnlyLocalPlayersList[0] : null); if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)Console.instance)) { string[] array2 = text.Split(';'); foreach (string text2 in array2) { Log.Info("dev cmd: " + text2.Trim()); Console.instance.SubmitCmd(val2, text2.Trim(), false); } } } } } public static class BernieHooks { public static void Init() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage); GlobalEventManager.onServerDamageDealt += OnServerDamageDealt; RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(GetStatCoefficients); } private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (damageInfo != null && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && DamageAPI.HasModdedDamageType(damageInfo, BernieAssets.taxDamageType) && (self.body.isElite || self.body.isBoss || self.body.isChampion)) { damageInfo.damage *= ((self.body.isBoss || self.body.isChampion) ? 1.3f : 1.6f); } orig.Invoke(self, damageInfo); } private static void OnServerDamageDealt(DamageReport report) { //IL_0021: 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_00be: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) if (report?.damageInfo == null || !Object.op_Implicit((Object)(object)report.attackerBody) || !DamageAPI.HasModdedDamageType(report.damageInfo, BernieAssets.taxDamageType)) { return; } float num = report.damageDealt * 0.3f; if (num <= 0f) { return; } ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(report.attackerBody.teamComponent.teamIndex); List<HealthComponent> list = new List<HealthComponent>(); float num2 = 1600f; foreach (TeamComponent item in teamMembers) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.body) && Object.op_Implicit((Object)(object)item.body.healthComponent) && item.body.healthComponent.alive) { Vector3 val = item.body.corePosition - report.attackerBody.corePosition; if (!(((Vector3)(ref val)).sqrMagnitude > num2)) { list.Add(item.body.healthComponent); } } } if (list.Count == 0) { return; } float num3 = ((list.Count == 1) ? num : (num * 0.5f)); float num4 = ((list.Count == 1) ? 0f : (num * 0.5f / (float)(list.Count - 1))); foreach (HealthComponent item2 in list) { item2.Heal(((Object)(object)item2 == (Object)(object)report.attackerBody.healthComponent) ? num3 : num4, default(ProcChainMask), true); } if (BernieDevTools.enabledDev) { object[] array = new object[5]; CharacterBody victimBody = report.victimBody; array[0] = ((victimBody != null) ? ((Object)victimBody).name : null); array[1] = report.damageDealt; CharacterBody victimBody2 = report.victimBody; array[2] = ((victimBody2 != null) ? new bool?(victimBody2.isElite) : ((bool?)null)); array[3] = num; array[4] = list.Count; Log.Info(string.Format("[skill] tax hit {0} dmg={1:F1} elite={2} healed={3:F1} over {4}", array)); } } private static void GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (sender.HasBuff(BernieBuffs.solidarityBuff)) { args.attackSpeedMultAdd += 0.3f; args.armorAdd += 30f; } } } public static class BernieSound { private class Tracked { public BernieAudioEngine.Voice voice; public Transform follow; public Vector3 pos; public float gain; public bool voiceLine; } private class Updater : MonoBehaviour { private void Update() { //IL_007d: 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) lock (BernieSound.tracked) { for (int num = BernieSound.tracked.Count - 1; num >= 0; num--) { Tracked tracked = BernieSound.tracked[num]; if (tracked.voice.stopped) { BernieSound.tracked.RemoveAt(num); } else { if ((Object)(object)tracked.follow == (Object)null && tracked.follow != null) { tracked.follow = null; } else if (Object.op_Implicit((Object)(object)tracked.follow)) { tracked.pos = tracked.follow.position; } Spatialize(tracked, out var left, out var right); tracked.voice.left = left; tracked.voice.right = right; } } } } } private static readonly Dictionary<string, float[][]> groups = new Dictionary<string, float[][]>(); private static readonly Dictionary<string, int> lastPick = new Dictionary<string, int>(); private static readonly List<Tracked> tracked = new List<Tracked>(); public static void Init() { //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_0194: Expected O, but got Unknown string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)BerniePlugin.instance).Info.Location), "Sounds"); if (!Directory.Exists(text)) { Log.Error("BernieSound: missing folder " + text); return; } List<(string, float[])> list = new List<(string, float[])>(); string[] files = Directory.GetFiles(text, "*.wav"); foreach (string path in files) { try { list.Add((Path.GetFileNameWithoutExtension(path), BernieAudioEngine.LoadWav(path))); } catch (Exception ex) { Log.Warning("BernieSound: " + ex.Message); } } foreach (IGrouping<string, (string, float[])> item in from c in list group c by GroupKey(c.name)) { groups[item.Key] = (from c in item orderby c.name select c.data).ToArray(); } Log.Info(string.Format("BernieSound: {0} clips in {1} groups: {2}", list.Count, groups.Count, string.Join(", ", groups.Keys))); if (BernieAudioEngine.Start()) { GameObject val = new GameObject("BernieSoundUpdater"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<Updater>(); } } private static string GroupKey(string clipName) { int num = clipName.LastIndexOf('_'); if (num <= 0 || !int.TryParse(clipName.Substring(num + 1), out var _)) { return clipName; } return clipName.Substring(0, num); } private static float ConVar(string name) { BaseConVar val = (Object.op_Implicit((Object)(object)Console.instance) ? Console.instance.FindConVar(name) : null); if (val == null || !float.TryParse(val.GetString(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return 1f; } return result / 100f; } public static bool Has(string key) { return groups.ContainsKey(key); } public static BernieAudioEngine.Voice Play(string key, Vector3 position, Transform follow = null, bool voice = false, float volume = 1f, bool loop = false) { //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) if (!groups.TryGetValue(key, out var value) || value.Length == 0) { return null; } int num = Random.Range(0, value.Length); if (value.Length > 1 && lastPick.TryGetValue(key, out var value2) && value2 == num) { num = (num + 1) % value.Length; } lastPick[key] = num; float num2 = (voice ? BernieConfig.voiceVolume.Value : BernieConfig.sfxVolume.Value); Tracked tracked = new Tracked { follow = follow, pos = position, gain = volume * num2 * 0.7f, voiceLine = voice }; Spatialize(tracked, out var left, out var right); tracked.voice = BernieAudioEngine.Play(value[num], left, right, loop); if (tracked.voice == null) { return null; } lock (BernieSound.tracked) { BernieSound.tracked.Add(tracked); } return tracked.voice; } public static BernieAudioEngine.Voice Play(string key, GameObject at, bool voice = false, float volume = 1f, bool loop = false) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)at)) { return null; } return Play(key, at.transform.position, at.transform, voice, volume, loop); } public static void Stop(BernieAudioEngine.Voice v) { if (v != null) { v.stopped = true; } } private static void Spatialize(Tracked t, out float left, out float right) { //IL_0031: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) float num = ConVar("volume_master") * ConVar("volume_sfx"); Vector3 val = (Object.op_Implicit((Object)(object)t.follow) ? t.follow.position : t.pos); Camera val2 = null; if (CameraRigController.readOnlyInstancesList.Count > 0) { val2 = CameraRigController.readOnlyInstancesList[0].sceneCam; } if (!Object.op_Implicit((Object)(object)val2)) { val2 = Camera.main; } float num2 = 1f; float num3 = 0f; if (Object.op_Implicit((Object)(object)val2)) { Vector3 val3 = val - ((Component)val2).transform.position; float magnitude = ((Vector3)(ref val3)).magnitude; float num4 = (t.voiceLine ? 25f : 15f); float num5 = (t.voiceLine ? 160f : 110f); num2 = 1f - Mathf.Clamp01((magnitude - num4) / (num5 - num4)); if (magnitude > 0.01f) { num3 = Mathf.Clamp(Vector3.Dot(val3 / magnitude, ((Component)val2).transform.right), -1f, 1f) * 0.6f; } } float num6 = t.gain * num * num2; left = num6 * Mathf.Sqrt(0.5f * (1f - num3)); right = num6 * Mathf.Sqrt(0.5f * (1f + num3)); } } public static class BernieStates { public static void Init() { Content.AddEntityState(typeof(BernieMain)); Content.AddEntityState(typeof(MittenVolley)); Content.AddEntityState(typeof(TaxTheRich)); Content.AddEntityState(typeof(FeelTheBern)); Content.AddEntityState(typeof(OnceAgainAsking)); } } public static class BernieStaticValues { public const float mittenDamageCoefficient = 2.4f; public const float mittenBaseDuration = 0.42f; public const float mittenBlastRadius = 4.5f; public const float taxDamageCoefficientPerSecond = 3f; public const float taxTickRate = 5f; public const float taxMaxDuration = 3f; public const float taxRange = 45f; public const float taxEliteMultiplier = 1.6f; public const float taxBossMultiplier = 1.3f; public const float taxProcCoefficient = 0.35f; public const float taxHealFraction = 0.3f; public const float taxShareRadius = 40f; public const float bernDuration = 0.6f; public const float bernSpeedMultiplier = 5.5f; public const float bernTrailDamagePerSecond = 1.5f; public const float bernTrailLifetime = 4f; public const float bernRamDamageCoefficient = 5f; public const float bernRamRadius = 3.2f; public const float bernRamForce = 2600f; public const float bernLaunchDamageCoefficient = 2f; public const float bernStopDamageCoefficient = 3f; public const float bernStopRadius = 9f; public const float thrusterCooldown = 3f; public const float thrusterFlipDuration = 0.65f; public const float askWindup = 0.7f; public const float askRadius = 30f; public const float askDamageCoefficient = 4f; public const float askStunDuration = 3f; public const int askBaseGoldPerEnemy = 2; public const float askBuffDuration = 8f; } public class BernieSurvivor : SurvivorBase<BernieSurvivor> { public const string BERNIE_PREFIX = "ANTRIM_BERNIE_"; public static readonly Color bodyColor = new Color(0.47f, 0.42f, 0.3f); public static readonly string[] locatorNames = new string[4] { "MainHurtbox", "MuzzleMitten", "MuzzleDish", "Exhaust" }; public override string assetBundleName => "berniebundle"; public override string bodyName => "BernieBody"; public override string masterName => "BernieMonsterMaster"; public override string modelPrefabName => "mdlBernie"; public override string displayPrefabName => "BernieDisplay"; public override string survivorTokenPrefix => "ANTRIM_BERNIE_"; public override BodyInfo bodyInfo => new BodyInfo { bodyName = bodyName, bodyNameToken = "ANTRIM_BERNIE_NAME", subtitleNameToken = "ANTRIM_BERNIE_SUBTITLE", characterPortrait = assetBundle.LoadAsset<Texture>("texBernieIcon"), bodyColor = bodyColor, sortPosition = 100f, crosshair = Asset.LoadCrosshair("Standard"), podPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/SurvivorPod"), maxHealth = 160f, healthRegen = 2f, armor = 20f, jumpCount = 2, moveSpeed = 7f, jumpPower = 15f, aimOriginPosition = new Vector3(0f, 1.4f, 0f), cameraPivotPosition = new Vector3(0f, 1.3f, 0f), cameraParamsVerticalOffset = 1.2f, cameraParamsDepth = -13f }; public override CustomRendererInfo[] customRendererInfos => new CustomRendererInfo[6] { new CustomRendererInfo { childName = "ChassisMesh" }, new CustomRendererInfo { childName = "BodyMesh" }, new CustomRendererInfo { childName = "HeadMesh" }, new CustomRendererInfo { childName = "MittensMesh" }, new CustomRendererInfo { childName = "ArmMeshMesh" }, new CustomRendererInfo { childName = "ArmMittenMesh" } }; public override UnlockableDef characterUnlockableDef => null; public override ItemDisplaysBase itemDisplays => null; public override AssetBundle assetBundle { get; protected set; } public override GameObject bodyPrefab { get; protected set; } public override CharacterBody prefabCharacterBody { get; protected set; } public override GameObject characterModelObject { get; protected set; } public override CharacterModel prefabCharacterModel { get; protected set; } public override GameObject displayPrefab { get; protected set; } public static void AddChildLocator(GameObject model) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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) if (Object.op_Implicit((Object)(object)model.GetComponent<ChildLocator>())) { return; } List<NameTransformPair> list = new List<NameTransformPair>(); Transform[] componentsInChildren = model.GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (Object.op_Implicit((Object)(object)((Component)val).GetComponent<MeshRenderer>())) { list.Add(new NameTransformPair { name = ((Object)val).name + "Mesh", transform = val }); } else if (Array.IndexOf(locatorNames, ((Object)val).name) >= 0) { list.Add(new NameTransformPair { name = ((Object)val).name, transform = val }); } } model.AddComponent<ChildLocator>().transformPairs = list.ToArray(); } protected override void InitializeCharacterBodyPrefab() { GameObject val = assetBundle.LoadAsset<GameObject>(modelPrefabName); AddChildLocator(val); if (!Object.op_Implicit((Object)(object)val.GetComponent<BernieAnimator>())) { val.AddComponent<BernieAnimator>(); } base.InitializeCharacterBodyPrefab(); } protected override void InitializeDisplayPrefab() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) displayPrefab = assetBundle.LoadAsset<GameObject>(displayPrefabName); AddChildLocator(displayPrefab); if (!Object.op_Implicit((Object)(object)displayPrefab.GetComponent<BernieAnimator>())) { displayPrefab.AddComponent<BernieAnimator>(); } CharacterModel val = displayPrefab.GetComponent<CharacterModel>(); if (!Object.op_Implicit((Object)(object)val)) { val = displayPrefab.AddComponent<CharacterModel>(); } List<RendererInfo> list = new List<RendererInfo>(); MeshRenderer[] componentsInChildren = displayPrefab.GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val2 in componentsInChildren) { list.Add(new RendererInfo { renderer = (Renderer)(object)val2, defaultMaterial = ((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo(), defaultShadowCastingMode = (ShadowCastingMode)1 }); } val.baseRendererInfos = list.ToArray(); Asset.ConvertAllRenderersToHopooShader(displayPrefab); ModelSkinController val3 = displayPrefab.GetComponent<ModelSkinController>(); if (!Object.op_Implicit((Object)(object)val3)) { val3 = displayPrefab.AddComponent<ModelSkinController>(); } val3.skins = (SkinDef[])(object)new SkinDef[1] { Skins.CreateSkinDef("DEFAULT_SKIN", assetBundle.LoadAsset<Sprite>("texMainSkin"), val.baseRendererInfos, displayPrefab) }; } public override void InitializeCharacter() { base.InitializeCharacter(); BernieConfig.Init(); BernieStates.Init(); BernieTokens.Init(); BernieAssets.Init(assetBundle); BernieBuffs.Init(assetBundle); InitializeEntityStateMachines(); InitializeSkills(); InitializeSkins(); InitializeCharacterMaster(); AdditionalBodySetup(); BernieHooks.Init(); BernieDevTools.Init(); } private void AdditionalBodySetup() { bodyPrefab.AddComponent<BundledUpComponent>(); bodyPrefab.AddComponent<BernieVoiceComponent>(); bodyPrefab.AddComponent<BernieThrusterComponent>(); SetStateOnHurt component = bodyPrefab.GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component)) { component.canBeFrozen = false; } } public override void InitializeEntityStateMachines() { Prefabs.ClearEntityStateMachines(bodyPrefab); Prefabs.AddMainEntityStateMachine(bodyPrefab, "Body", typeof(BernieMain), typeof(SpawnTeleporterState)); Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon"); Prefabs.AddEntityStateMachine(bodyPrefab, "Weapon2"); } public override void InitializeSkills() { //IL_0018: 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_0057: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) Skills.ClearGenericSkills(bodyPrefab); bodyPrefab.GetComponent<SkillLocator>().passiveSkill = new PassiveSkill { enabled = true, skillNameToken = "ANTRIM_BERNIE_PASSIVE_NAME", skillDescriptionToken = "ANTRIM_BERNIE_PASSIVE_DESCRIPTION", icon = assetBundle.LoadAsset<Sprite>("texPassiveIcon") }; Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)0); SkillDef val = Skills.CreateSkillDef(new SkillDefInfo("BernieMittenVolley", "ANTRIM_BERNIE_PRIMARY_MITTEN_NAME", "ANTRIM_BERNIE_PRIMARY_MITTEN_DESCRIPTION", assetBundle.LoadAsset<Sprite>("texPrimaryIcon"), new SerializableEntityStateType(typeof(MittenVolley)))); Skills.AddPrimarySkills(bodyPrefab, val); Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)1); SkillDef val2 = Skills.CreateSkillDef(new SkillDefInfo { skillName = "BernieTaxTheRich", skillNameToken = "ANTRIM_BERNIE_SECONDARY_TAX_NAME", skillDescriptionToken = "ANTRIM_BERNIE_SECONDARY_TAX_DESCRIPTION", skillIcon = assetBundle.LoadAsset<Sprite>("texSecondaryIcon"), activationState = new SerializableEntityStateType(typeof(TaxTheRich)), activationStateMachineName = "Weapon2", interruptPriority = (InterruptPriority)1, baseRechargeInterval = 6f, baseMaxStock = 1, beginSkillCooldownOnSkillEnd = true, isCombatSkill = true, mustKeyPress = true, cancelSprintingOnActivation = true }); Skills.AddSecondarySkills(bodyPrefab, val2); Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)2); SkillDef val3 = Skills.CreateSkillDef(new SkillDefInfo { skillName = "BernieFeelTheBern", skillNameToken = "ANTRIM_BERNIE_UTILITY_BERN_NAME", skillDescriptionToken = "ANTRIM_BERNIE_UTILITY_BERN_DESCRIPTION", skillIcon = assetBundle.LoadAsset<Sprite>("texUtilityIcon"), activationState = new SerializableEntityStateType(typeof(FeelTheBern)), activationStateMachineName = "Body", interruptPriority = (InterruptPriority)2, baseRechargeInterval = 7f, baseMaxStock = 1, isCombatSkill = false, forceSprintDuringState = true, mustKeyPress = true }); Skills.AddUtilitySkills(bodyPrefab, val3); Skills.CreateGenericSkillWithSkillFamily(bodyPrefab, (SkillSlot)3); SkillDefInfo skillDefInfo = new SkillDefInfo(); skillDefInfo.skillName = "BernieOnceAgainAsking"; skillDefInfo.skillNameToken = "ANTRIM_BERNIE_SPECIAL_ASK_NAME"; skillDefInfo.skillDescriptionToken = "ANTRIM_BERNIE_SPECIAL_ASK_DESCRIPTION"; skillDefInfo.keywordTokens = new string[1] { "KEYWORD_STUNNING" }; skillDefInfo.skillIcon = assetBundle.LoadAsset<Sprite>("texSpecialIcon"); skillDefInfo.activationState = new SerializableEntityStateType(typeof(OnceAgainAsking)); skillDefInfo.activationStateMachineName = "Weapon2"; skillDefInfo.interruptPriority = (InterruptPriority)2; skillDefInfo.baseRechargeInterval = 16f; skillDefInfo.baseMaxStock = 1; skillDefInfo.isCombatSkill = true; skillDefInfo.mustKeyPress = true; skillDefInfo.cancelSprintingOnActivation = true; SkillDef val4 = Skills.CreateSkillDef(skillDefInfo); Skills.AddSpecialSkills(bodyPrefab, val4); } public override void InitializeSkins() { ModelSkinController obj = ((Component)prefabCharacterModel).gameObject.AddComponent<ModelSkinController>(); SkinDef val = Skins.CreateSkinDef("DEFAULT_SKIN", assetBundle.LoadAsset<Sprite>("texMainSkin"), prefabCharacterModel.baseRendererInfos, ((Component)prefabCharacterModel).gameObject); obj.skins = (SkinDef[])(object)new SkinDef[1] { val }; } public override void InitializeCharacterMaster() { Prefabs.CloneDopplegangerMaster(bodyPrefab, masterName, "Commando"); } } public static class BernieTokens { public static void Init() { string text = "ANTRIM_BERNIE_"; Language.Add(text + "NAME", "Bernie"); Language.Add(text + "SUBTITLE", "The Senator from the Cold Seats"); Language.Add(text + "LORE", "He did not come to the planet for glory. He came because somebody had to organize the survivors, and frankly, nobody else had brought a decent pair of mittens.\n\nWelded to a decommissioned MUL-T chassis by a sympathetic maintenance crew, the folding chair goes wherever the people need him. He does not stand up. He does not need to."); Language.Add(text + "OUTRO_FLAVOR", "...and so he left, still seated, still bundled, still asking."); Language.Add(text + "OUTRO_FAILURE", "...and so he vanished, but the movement continued."); Language.Add(text + "DESCRIPTION", "Bernie is a seated, tanky organizer who gets stronger the more the rich have to lose.<color=#CCD3E0>\n\n< ! > Mitten Volley arcs over cover. Lead your shots on moving targets.\n\n< ! > Tax the Rich does far more damage to elites and bosses, and redistributes the health it drains to you and nearby allies.\n\n< ! > Feel the Bern leaves a trail of fire. Dash through crowds, not away from them.\n\n< ! > I Am Once Again Asking turns a dangerous crowd into a funding drive. Use it when you're surrounded.</color>\n"); Language.Add(text + "PASSIVE_NAME", "Bundled Up"); Language.Add(text + "PASSIVE_DESCRIPTION", $"Bernie dressed for the weather. He <style=cIsUtility>cannot be frozen or slowed</style> and has <style=cIsHealing>+20 armor</style>. His chair has <style=cIsUtility>bottom thrusters</style>: jump again in mid-air to rocket upward in a backflip (every {3f} seconds)."); Language.Add(text + "PRIMARY_MITTEN_NAME", "Mitten Volley"); Language.Add(text + "PRIMARY_MITTEN_DESCRIPTION", "Launch a hand-knit mitten in an arc that bursts for " + Tokens.DamageValueText(2.4f) + "."); Language.Add(text + "SECONDARY_TAX_NAME", "Tax the Rich"); Language.Add(text + "SECONDARY_TAX_DESCRIPTION", $"Hold to drain a target for {Tokens.DamageValueText(3f)} per second. Deals <style=cIsDamage>{1.6f}x damage</style> to <style=cIsDamage>elites</style> and <style=cIsDamage>{1.3f}x</style> to <style=cIsDamage>bosses</style>. <style=cIsHealing>Redistribute {30.000002f}% of the damage</style> as healing to you and nearby allies."); Language.Add(text + "UTILITY_BERN_NAME", "Feel the Bern"); Language.Add(text + "UTILITY_BERN_DESCRIPTION", "<style=cIsDamage>Stunning</style>. <style=cIsDamage>Ignite</style>. Fire the chair rockets and <style=cIsUtility>ram forward</style>, smashing enemies aside for " + Tokens.DamageValueText(5f) + " and skidding to a fiery stop for " + Tokens.DamageValueText(3f) + ". Leaves a burning trail."); Language.Add(text + "SPECIAL_ASK_NAME", "I Am Once Again Asking"); Language.Add(text + "SPECIAL_ASK_DESCRIPTION", $"<style=cIsDamage>Stunning</style>. Ask for support. Nearby enemies are stunned and take {Tokens.DamageValueText(4f)} damage, and each one <style=cIsUtility>donates gold</style>. Allies in range gain <style=cIsDamage>Solidarity</style>: +30% attack speed and +30 armor for {8f} seconds."); } } } namespace BernieMod.Survivors.Bernie.SkillStates { public class BernieMain : GenericCharacterMain { private BernieThrusterComponent thrusters; public override void OnEnter() { ((GenericCharacterMain)this).OnEnter(); thrusters = ((EntityState)this).GetComponent<BernieThrusterComponent>(); } public override void ProcessJump() { if (!((BaseCharacterMain)this).hasCharacterMotor || !Object.op_Implicit((Object)(object)thrusters)) { ((GenericCharacterMain)this).ProcessJump(); return; } bool flag = base.jumpInputReceived && !((EntityState)this).characterMotor.isGrounded && ((EntityState)this).characterMotor.jumpCount == 1; if (flag && !thrusters.ready) { if (((EntityState)this).characterBody.maxJumpCount <= 2) { base.jumpInputReceived = false; return; } ((EntityState)this).characterMotor.jumpCount = 2; flag = false; } int jumpCount = ((EntityState)this).characterMotor.jumpCount; ((GenericCharacterMain)this).ProcessJump(); if (flag && ((EntityState)this).characterMotor.jumpCount > jumpCount) { ((EntityState)this).characterMotor.velocity.y *= 1.35f; thrusters.Fire(); } } } public class FeelTheBern : BaseSkillState { private Vector3 dir; private DamageTrail trail; private readonly HashSet<HealthComponent> rammed = new HashSet<HealthComponent>(); private float exhaustTimer; private int ramCount; private float hitStop; public override void OnEnter() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_005a: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); if (BernieDevTools.enabledDev) { Log.Info($"[skill] FeelTheBern enter auth={((EntityState)this).isAuthority} server={NetworkServer.active}"); } Vector3 moveVector = ((EntityState)this).inputBank.moveVector; dir = ((((Vector3)(ref moveVector)).sqrMagnitude > 0.01f) ? moveVector : ((EntityState)this).characterDirection.forward); dir.y = 0f; ((Vector3)(ref dir)).Normalize(); ((EntityState)this).characterDirection.forward = dir; BernieAnimator bernieAnimator = BernieAnimator.Find(((EntityState)this).gameObject); bernieAnimator?.SetBern(on: true); bernieAnimator?.Hop(); BernieSound.Play("sfx_bern", ((EntityState)this).gameObject); ((EntityState)this).gameObject.GetComponent<BernieVoiceComponent>()?.Say("vo_bern", force: true); if (((EntityState)this).isAuthority) { if (((EntityState)this).characterMotor.isGrounded) { ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); ((EntityState)this).characterMotor.velocity.y = Mathf.Max(((EntityState)this).characterMotor.velocity.y, 6f); } Vector3 pos = ((EntityState)this).characterBody.footPosition - dir * 1.5f; BernieAssets.Fx(BernieAssets.launchEffect, pos, 3f); Blast(pos, 6f, 2f, (DamageType)128, 600f); } BernieAssets.Shake(((EntityState)this).transform.position, 1.2f, 0.35f); if (Object.op_Implicit((Object)(object)BernieAssets.fireTrailPrefab)) { trail = Object.Instantiate<GameObject>(BernieAssets.fireTrailPrefab, ((EntityState)this).transform).GetComponent<DamageTrail>(); trail.transform.position = ((EntityState)this).characterBody.footPosition; trail.owner = ((EntityState)this).gameObject; DamageTrail obj = trail; obj.radius *= 2.5f; trail.pointLifetime = 4f; trail.damagePerSecond = ((BaseState)this).damageStat * 1.5f; trail.damageType = DamageTypeCombo.GenericUtility | DamageTypeCombo.op_Implicit((DamageType)128); } if (NetworkServer.active) { ((EntityState)this).characterBody.AddTimedBuff(Buffs.ArmorBoost, 0.85f); } } private void Blast(Vector3 pos, float radius, float coefficient, DamageType extra, float force) { //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_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0047: 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_0056: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) new BlastAttack { attacker = ((EntityState)this).gameObject, inflictor = ((EntityState)this).gameObject, teamIndex = ((BaseState)this).GetTeam(), baseDamage = ((BaseState)this).damageStat * coefficient, baseForce = force, bonusForce = Vector3.up * force * 0.4f, position = pos, radius = radius, procCoefficient = 1f, falloffModel = (FalloffModel)0, damageType = (DamageTypeCombo.GenericUtility | DamageTypeCombo.op_Implicit(extra)), crit = ((BaseState)this).RollCrit(), attackerFiltering = (AttackerFiltering)2 }.Fire(); } public override void FixedUpdate() { //IL_0057: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); exhaustTimer -= Time.fixedDeltaTime; if (exhaustTimer <= 0f) { exhaustTimer = 0.08f; Transform val = ((BaseState)this).FindModelChild("Exhaust"); BernieAssets.Fx(BernieAssets.muzzleEffect, Object.op_Implicit((Object)(object)val) ? val.position : ((EntityState)this).transform.position, 1.5f, transmit: false, -dir); } if (((EntityState)this).isAuthority) { hitStop -= Time.fixedDeltaTime; float num = ((hitStop > 0f) ? 0.15f : 1f); CharacterMotor characterMotor = ((EntityState)this).characterMotor; characterMotor.rootMotion += dir * ((BaseState)this).moveSpeedStat * 5.5f * num * Time.fixedDeltaTime; ((EntityState)this).characterDirection.forward = dir; RamCheck(); if (((EntityState)this).fixedAge >= 0.6f + (float)ramCount * 0.07f) { ((EntityState)this).outer.SetNextStateToMain(); } } } private void RamCheck() { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_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_0059: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0192: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: 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_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) SphereSearch val = new SphereSearch { origin = ((EntityState)this).characterBody.corePosition + dir * 1.2f, radius = 3.2f, mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, queryTriggerInteraction = (QueryTriggerInteraction)0 }; List<HurtBox> list = new List<HurtBox>(); val.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(((BaseState)this).GetTeam())).FilterCandidatesByDistinctHurtBoxEntities() .GetHurtBoxes(list); foreach (HurtBox item in list) { HealthComponent val2 = (Object.op_Implicit((Object)(object)item) ? item.healthComponent : null); if (Object.op_Implicit((Object)(object)val2) && val2.alive && rammed.Add(val2)) { ramCount++; Vector3 position = ((Component)item).transform.position; Vector3 val3 = Vector3.Cross(Vector3.up, dir); if (Vector3.Dot(position - ((EntityState)this).transform.position, val3) < 0f) { val3 = -val3; } Vector3 val4 = dir + val3 * 0.8f + Vector3.up * 0.9f; Vector3 normalized = ((Vector3)(ref val4)).normalized; new BlastAttack { attacker = ((EntityState)this).gameObject, inflictor = ((EntityState)this).gameObject, teamIndex = ((BaseState)this).GetTeam(), baseDamage = ((BaseState)this).damageStat * 5f, baseForce = 0f, bonusForce = normalized * 2600f, position = position, radius = 1.5f, procCoefficient = 1f, falloffModel = (FalloffModel)0, damageType = (DamageTypeCombo.GenericUtility | DamageTypeCombo.op_Implicit((DamageType)32) | DamageTypeCombo.op_Implicit((DamageType)128)), crit = ((BaseState)this).RollCrit(), attackerFiltering = (AttackerFiltering)2 }.Fire(); BernieAssets.Fx(BernieAssets.ramImpactEffect, position, 2f, transmit: true, normalized); BernieAssets.Fx(BernieAssets.critImpactEffect, position, 2f); BernieAssets.Shake(position, 2.5f, 0.25f, 30f); BernieSound.Play("sfx_ram", position, null, voice: false, 1.1f); BernieAnimator.Find(((EntityState)this).gameObject)?.Recoil(0.6f); if (ramCount == 1) { ((EntityState)this).gameObject.GetComponent<BernieVoiceComponent>()?.Say("vo_ram"); } hitStop = 0.07f; } } } public override void OnExit() { //IL_005d: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_0085: 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) BernieAnimator.Find(((EntityState)this).gameObject)?.SetBern(on: false); if (Object.op_Implicit((Object)(object)trail)) { trail.transform.SetParent((Transform)null, true); trail.active = false; Object.Destroy((Object)(object)((Component)trail).gameObject, 4f); } Vector3 val = ((EntityState)this).characterBody.footPosition + dir * 1.5f; if (((EntityState)this).isAuthority) { BernieAssets.Fx(BernieAssets.stopEffect, val, 9f); Blast(val, 9f, 3f, (DamageType)128, 1200f); } BernieSound.Play("sfx_bernstop", val); BernieAssets.Shake(val, 2f); BernieAnimator.Find(((EntityState)this).gameObject)?.Recoil(-0.8f); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)7; } } public class MittenVolley : BaseSkillState { private float duration; public override void OnEnter() { //IL_00a9: 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_00b5: 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_00bd: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); if (BernieDevTools.enabledDev) { Log.Info($"[skill] MittenVolley enter auth={((EntityState)this).isAuthority} server={NetworkServer.active}"); } duration = 0.42f / ((BaseState)this).attackSpeedStat; ((BaseState)this).StartAimMode(2f, false); BernieAnimator.Find(((EntityState)this).gameObject)?.Recoil(0.5f); BernieSound.Play("sfx_mitten", ((EntityState)this).gameObject); Transform val = ((BaseState)this).FindModelChild("MuzzleMitten"); GameObject muzzleEffect = BernieAssets.muzzleEffect; Vector3 pos = (Object.op_Implicit((Object)(object)val) ? val.position : ((EntityState)this).characterBody.corePosition); Ray aimRay = ((BaseState)this).GetAimRay(); BernieAssets.Fx(muzzleEffect, pos, 1.2f, transmit: false, ((Ray)(ref aimRay)).direction); ((BaseState)this).AddRecoil(-0.6f, -1f, -0.3f, 0.3f); if (((EntityState)this).isAuthority) { Ray aimRay2 = ((BaseState)this).GetAimRay(); Vector3 val2 = Vector3.RotateTowards(((Ray)(ref aimRay2)).direction, Vector3.up, MathF.PI / 60f, 0f); ProjectileManager.instance.FireProjectile(BernieAssets.mittenProjectilePrefab, ((Ray)(ref aimRay2)).origin, Util.QuaternionSafeLookRotation(val2), ((EntityState)this).gameObject, ((BaseState)this).damageStat * 2.4f, 300f, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, -1f, (DamageTypeCombo?)null); } ((EntityState)this).characterBody.AddSpreadBloom(0.5f); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } public class OnceAgainAsking : BaseSkillState { private const float extra = 0.5f; private bool fired; public override void OnEnter() { ((BaseState)this).OnEnter(); if (BernieDevTools.enabledDev) { Log.Info($"[skill] OnceAgainAsking enter auth={((EntityState)this).isAuthority} server={NetworkServer.active}"); } ((BaseState)this).StartAimMode(1.2f, false); BernieAnimator.Find(((EntityState)this).gameObject)?.SetAsking(asking: true); ((EntityState)this).gameObject.GetComponent<BernieVoiceComponent>()?.Say("vo_ask", force: true); BernieSound.Play("sfx_arm", ((EntityState)this).gameObject, voice: false, 0.8f); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (!fired && ((EntityState)this).fixedAge >= 0.7f) { Fire(); } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= 1.2f) { ((EntityState)this).outer.SetNextStateToMain(); } } private void Fire() { //IL_0040: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) fired = true; BernieAnimator.Find(((EntityState)this).gameObject)?.Recoil(-0.6f); BernieSound.Play("sfx_ask", ((EntityState)this).gameObject); BernieAssets.Shake(((EntityState)this).characterBody.corePosition, 3f, 0.5f, 60f); Vector3 corePosition = ((EntityState)this).characterBody.corePosition; float num = 30f; if (((EntityState)this).isAuthority) { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/TeamWarCryActivation"); if (Object.op_Implicit((Object)(object)val)) { EffectManager.SpawnEffect(val, new EffectData { origin = corePosition, scale = num }, true); } new BlastAttack { attacker = ((EntityState)this).gameObject, inflictor = ((EntityState)this).gameObject, teamIndex = ((BaseState)this).GetTeam(), baseDamage = ((BaseState)this).damageStat * 4f, baseForce = 400f, position = corePosition, radius = num, procCoefficient = 1f, falloffModel = (FalloffModel)0, damageType = DamageTypeCombo.GenericSpecial, crit = ((BaseState)this).RollCrit(), attackerFiltering = (AttackerFiltering)2 }.Fire(); } if (!NetworkServer.active) { return; } SphereSearch val2 = new SphereSearch { origin = corePosition, radius = num, mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, queryTriggerInteraction = (QueryTriggerInteraction)0 }; List<HurtBox> list = new List<HurtBox>(); val2.RefreshCandidates().FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(((BaseState)this).GetTeam())).FilterCandidatesByDistinctHurtBoxEntities() .GetHurtBoxes(list); uint num2 = (uint)Mathf.Max(1, (!Object.op_Implicit((Object)(object)Run.instance)) ? 1 : Run.instance.GetDifficultyScaledCost(2)); foreach (HurtBox item in list) { if (Object.op_Implicit((Object)(object)item) && Object.op_Implicit((Object)(object)item.healthComponent) && Object.op_Implicit((Object)(object)item.healthComponent.body)) { SetStateOnHurt.SetStunOnObject(((Component)item.healthComponent).gameObject, 3f); if (BernieDevTools.enabledDev) { Log.Info($"[skill] ask hit {((Object)item.healthComponent.body).name} gold={num2}"); } BernieAssets.Fx(BernieAssets.coinEffect, item.healthComponent.body.corePosition, 2f); if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody.mainHurtBox)) { OrbManager.instance.AddOrb((Orb)new GoldOrb { origin = item.healthComponent.body.corePosition, target = ((EntityState)this).characterBody.mainHurtBox, goldAmount = num2, scaleOrb = false }); } } } foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(((BaseState)this).GetTeam())) { if (Object.op_Implicit((Object)(object)teamMember) && Object.op_Implicit((Object)(object)teamMember.body)) { Vector3 val3 = teamMember.body.corePosition - corePosition; if (((Vector3)(ref val3)).sqrMagnitude <= num * num) { teamMember.body.AddTimedBuff(BernieBuffs.solidarityBuff, 8f); } } } } public override void OnExit() { BernieAnimator.Find(((EntityState)this).gameObject)?.SetAsking(asking: false); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)2; } } public class TaxTheRich : BaseSkillState { private float tickTimer; private HurtBox target; private LineRenderer line; private Transform muzzle; private BernieAudioEngine.Voice loop; public override void OnEnter() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); if (BernieDevTools.enabledDev) { Log.Info($"[skill] TaxTheRich enter auth={((EntityState)this).isAuthority} server={NetworkServer.active}"); } ((BaseState)this).StartAimMode(1f, false); muzzle = ((BaseState)this).FindModelChild("MuzzleDish"); if (!Object.op_Implicit((Object)(object)muzzle)) { muzzle = ((EntityState)this).transform; } GameObject val = new GameObject("BernieTaxBeam"); line = val.AddComponent<LineRenderer>(); ((Renderer)line).material = BernieAssets.taxBeamMaterial; line.positionCount = 2; line.widthMultiplier = 0.3f; line.numCapVertices = 4; Gradient val2 = new Gradient(); val2.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(new Color(1f, 0.85f, 0.2f), 0f), new GradientColorKey(new Color(0.3f, 1f, 0.35f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(0.9f, 0f), new GradientAlphaKey(0.9f, 1f) }); line.colorGradient = val2; ((Renderer)line).enabled = false; loop = BernieSound.Play("sfx_tax", ((EntityState)this).gameObject, voice: false, 1f, loop: true); ((EntityState)this).gameObject.GetComponent<BernieVoiceComponent>()?.Say("vo_tax"); } private HurtBox FindTarget(Ray aim) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_003e: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00ec: 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_00f4: 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_00fe: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) BullseyeSearch val = new BullseyeSearch { teamMaskFilter = TeamMask.GetEnemyTeams(((BaseState)this).GetTeam()), filterByLoS = true, searchOrigin = ((Ray)(ref aim)).origin, searchDirection = ((Ray)(ref aim)).direction, sortMode = (SortMode)2, maxDistanceFilter = 45f, maxAngleFilter = 20f }; val.RefreshCandidates(); val.FilterOutGameObject(((EntityState)this).gameObject); HurtBox val2 = (from h in val.GetResults() where Object.op_Implicit((Object)(object)h) && Object.op_Implicit((Object)(object)h.healthComponent) && h.healthComponent.alive orderby h.healthComponent.fullCombinedHealth descending select h).FirstOrDefault(); if (Object.op_Implicit((Object)(object)val2)) { return val2; } BullseyeSearch val3 = new BullseyeSearch { teamMaskFilter = TeamMask.GetEnemyTeams(((BaseState)this).GetTeam()), filterByLoS = true, searchOrigin = ((EntityState)this).characterBody.corePosition, searchDirection = ((Ray)(ref aim)).direction, sortMode = (SortMode)1, maxDistanceFilter = 8f, maxAngleFilter = 180f }; val3.RefreshCandidates(); val3.FilterOutGameObject(((EntityState)this).gameObject); return val3.GetResults().FirstOrDefault((Func<HurtBox, bool>)((HurtBox h) => Object.op_Implicit((Object)(object)h) && Object.op_Implicit((Object)(object)h.healthComponent) && h.healthComponent.alive)); } public override void FixedUpdate() { //IL_0013: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); ((BaseState)this).StartAimMode(0.5f, false); Ray aimRay = ((BaseState)this).GetAimRay(); target = FindTarget(aimRay); tickTimer -= Time.fixedDeltaTime; if (tickTimer <= 0f) { tickTimer += 0.2f; if (Object.op_Implicit((Object)(object)target)) { BernieAnimator.Find(((EntityState)this).gameObject)?.Recoil(0.12f); if (((EntityState)this).isAuthority) { FireTick(((Ray)(ref aimRay)).origin); } } } if (((EntityState)this).isAuthority && (((EntityState)this).fixedAge >= 3f || (!((EntityState)this).inputBank.skill2.down && ((EntityState)this).fixedAge > 0.3f))) { if (BernieDevTools.enabledDev) { Log.Info(string.Format("[skill] TaxTheRich exit age={0:F2} held={1} target={2}", ((EntityState)this).fixedAge, ((EntityState)this).inputBank.skill2.down, Object.op_Implicit((Object)(object)target) ? ((Object)target.healthComponent).name : "none")); } ((EntityState)this).outer.SetNextStateToMain(); } } private void FireTick(Vector3 origin) { //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_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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00ef: Expected O, but got Unknown BulletAttack val = new BulletAttack { owner = ((EntityState)this).gameObject, weapon = ((EntityState)this).gameObject, origin = origin }; Vector3 val2 = ((Component)target).transform.position - origin; val.aimVector = ((Vector3)(ref val2)).normalized; val.minSpread = 0f; val.maxSpread = 0f; val.bulletCount = 1u; val.damage = ((BaseState)this).damageStat * 3f / 5f; val.procCoefficient = 0.35f; val.force = 0f; val.isCrit = ((BaseState)this).RollCrit(); val.falloffModel = (FalloffModel)0; val.maxDistance = 50f; val.radius = 1f; val.smartCollision = true; val.hitMask = CommonMasks.bullet; val.stopperMask = CommonMasks.bullet; val.damageType = DamageTypeCombo.GenericSecondary; DamageAPI.AddModdedDamageType(val, BernieAssets.taxDamageType); val.Fire(); } public override void Update() { //IL_0044: 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) ((EntityState)this).Update(); if (Object.op_Implicit((Object)(object)line)) { ((Renderer)line).enabled = Object.op_Implicit((Object)(object)target); if (Object.op_Implicit((Object)(object)target)) { line.SetPosition(0, muzzle.position); line.SetPosition(1, ((Component)target).transform.position); line.widthMultiplier = 0.25f + 0.08f * Mathf.Sin(Time.time * 30f); } } } public override void OnExit() { if (Object.op_Implicit((Object)(object)line)) { Object.Destroy((Object)(object)((Component)line).gameObject); } BernieSound.Stop(loop); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { return (InterruptPriority)1; } } } namespace BernieMod.Survivors.Bernie.Components { public class BernieAnimator : MonoBehaviour { private Transform chassis; private Transform body; private Transform head; private Transform arm; private Vector3 chassisPos; private Vector3 bodyPos; private Quaternion chassisRot; private Quaternion bodyRot; private Quaternion headRot; private Quaternion armRot; private CharacterBody charBody; private CharacterMotor motor; private InputBankTest input; private Vector3 lastVel; private Vector3 smoothAccel; private float recoil; private float recoilVel; private float hop; private float askWeight; private float askTarget; private float headYaw; private float headPitch; private float headYawVel; private float headPitchVel; private float fidgetTimer = 3f; private float fidgetYaw; private float fidgetTarget; private float treadPhase; private float bernBoost; private float flipTime = -1f; private Quaternion armRestLocal; private Vector3 armRestScale; private static readonly Vector3 flipPivot = new Vector3(0f, 1.1f, 0f); public bool isDisplay => !Object.op_Implicit((Object)(object)charBody); private void Awake() { //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_00c1: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_0196: 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) Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "Chassis" && Object.op_Implicit((Object)(object)((Component)val).GetComponent<MeshRenderer>())) { chassis = val; } else if (((Object)val).name == "Body" && Object.op_Implicit((Object)(object)((Component)val).GetComponent<MeshRenderer>())) { body = val; } else if (((Object)val).name == "Head" && Object.op_Implicit((Object)(object)((Component)val).GetComponent<MeshRenderer>())) { head = val; } else if (((Object)val).name == "AskArm") { arm = val; } } Quaternion val2 = Quaternion.Inverse(((Component)this).transform.rotation); if (Object.op_Implicit((Object)(object)chassis)) { chassisPos = ((Component)this).transform.InverseTransformPoint(chassis.position); chassisRot = val2 * chassis.rotation; } if (Object.op_Implicit((Object)(object)body)) { bodyPos = ((Component)this).transform.InverseTransformPoint(body.position); bodyRot = val2 * body.rotation; } if (Object.op_Implicit((Object)(object)head)) { headRot = val2 * head.rotation; } if (Object.op_Implicit((Object)(object)arm)) { armRot = val2 * arm.rotation; armRestLocal = arm.localRotation; armRestScale = arm.localScale; } } private void Start() { CharacterModel component = ((Component)this).GetComponent<CharacterModel>(); charBody = (Object.op_Implicit((Object)(object)component) ? component.body : null); if (Object.op_Implicit((Object)(object)charBody)) { motor = charBody.characterMotor; input = charBody.inputBank; } } public static BernieAnimator Find(GameObject bodyObject) { ModelLocator val = (Object.op_Implicit((Object)(object)bodyObject) ? bodyObject.GetComponent<ModelLocator>() : null); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.modelTransform)) { return null; } return ((Component)val.modelTransform).GetComponent<BernieAnimator>(); } public void Recoil(float amount = 1f) { recoilVel += amount * 14f; } public void Hop() { hop = 1f; } public void SetAsking(bool asking) { askTarget = (asking ? 1f : 0f); } public void SetBern(bool on) { bernBoost = (on ? 1f : 0f); } public void Backflip() { flipTime = 0f; } private void LateUpdate() { //IL_004b: 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_0050: Unknown result