Please disclose if your mod was created primarily 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 ChaosArmor v14.0.0
BepInEx/plugins/AeehyehssReeper-ChaosArmor/ChaosArmor.dll
Decompiled 9 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BlacksmithTools; using HarmonyLib; using JetBrains.Annotations; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Newtonsoft.Json; using UnityEngine; using UnityEngine.Audio; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace ChaosArmor; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("ReepusDeepusDelmeepus4902761.ChaosArmor", "ChaosArmor", "14.0.0")] public class ReepusDeepusDelmeepusChaosArmor : BaseUnityPlugin { [Serializable] public struct ItemConfiguration { public string Prefab; public ItemConfig Config; public SetConfiguration? Set; } [Serializable] public struct SetConfiguration { public string Name; public string StatusEffect; public int Size; } [HarmonyPatch] public static class AudioManPatch { private static void SetAudioMixerGroup(GameObject prefab, AudioMixerGroup group) { AudioSource component = prefab.GetComponent<AudioSource>(); component.outputAudioMixerGroup = group; } [HarmonyPatch(typeof(AudioMan), "Awake")] [HarmonyPostfix] public static void Patch_AudioManAwake(AudioMan __instance) { if (!((Object)(object)Clanka.prefabStep == (Object)null)) { AudioMixerGroup group = __instance.m_ambientMixer.audioMixer.FindMatchingGroups("Effects/SFX").FirstOrDefault(); SetAudioMixerGroup(Clanka.prefabStep, group); SetAudioMixerGroup(Clanka.prefabRun, group); SetAudioMixerGroup(Clanka.prefabDodge, group); SetAudioMixerGroup(Clanka.prefabLand, group); SetAudioMixerGroup(Clanka.prefabJump, group); SetAudioMixerGroup(Clanka.prefabBootRun, group); SetAudioMixerGroup(Clanka.prefabBootStep, group); } } } private const string ModName = "ChaosArmor"; private const string ModVersion = "14.0.0"; private const string ModGUID = "ReepusDeepusDelmeepus4902761.ChaosArmor"; public static readonly ManualLogSource ArmorLogger = Logger.CreateLogSource("ChaosArmor"); private const string T0Chest = "T0ChaosPlateArmor"; private const string T1Chest = "T1ChaosPlateArmor"; private const string T2Chest = "T2ChaosPlateArmor"; private const string T3Chest = "ChaosPlateArmorBody"; private const string T4Chest = "EliteChaosPlateArmor"; private const string T5UChest = "EliteChaosPlateArmorT2"; private const string T5Chest = "EliteChaosPlateArmorTzeentch"; private const string T0ASSLegs = "T0ChaosPlateLegs"; private const string T1ASSLegs = "T1ChaosPlateLegs"; private const string T2ASSLegs = "T2ChaosPlateLegs"; private const string T3ASSLegs = "ChaosPlateLegs"; private const string T4ASSLegs = "EliteChaosPlateLegs"; private const string T5UASSLegs = "EliteChaosPlateLegsT2"; private const string T5ASSLegs = "EliteChaosPlateLegsTzeentch"; private static string shieldVanilla = "Staff_shield"; public static int T1Hash; public static int T2Hash; public static int T3Hash; public static int T4Hash; public static int T5Hash; public static int T5UHash; public static HashSet<int> clankyPrefabNames = new HashSet<int>(); public static SE_Shield staffShield; private Dictionary<string, SE_Stats> _statusEffects = new Dictionary<string, SE_Stats>(); private Assembly assembly; private AssetBundle _assetBundle; private bool _BSTInstalled = false; private static ConfigEntry<bool> doTheRoar; public static bool DoTheRoar => doTheRoar.Value; public void Awake() { //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Expected O, but got Unknown assembly = Assembly.GetExecutingAssembly(); T1Hash = StringExtensionMethods.GetStableHashCode("T1ChaosPlateArmor"); T2Hash = StringExtensionMethods.GetStableHashCode("T2ChaosPlateArmor"); T3Hash = StringExtensionMethods.GetStableHashCode("ChaosPlateArmorBody"); T4Hash = StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmor"); T5Hash = StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmorTzeentch"); T5UHash = StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmorT2"); _assetBundle = AssetUtils.LoadAssetBundleFromResources("chaosarmor", Assembly.GetExecutingAssembly()); if ((Object)(object)_assetBundle == (Object)null) { ArmorLogger.LogError((object)"Could not load asset bundle! This mod will not work as expected!"); return; } clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T0ChaosPlateArmor")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T1ChaosPlateArmor")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T2ChaosPlateArmor")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("ChaosPlateArmorBody")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmor")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmorTzeentch")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateArmorT2")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T0ChaosPlateLegs")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T1ChaosPlateLegs")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("T2ChaosPlateLegs")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("ChaosPlateLegs")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateLegs")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateLegsT2")); clankyPrefabNames.Add(StringExtensionMethods.GetStableHashCode("EliteChaosPlateLegsTzeentch")); SetStatusEffects(); PrefabManager.OnVanillaPrefabsAvailable += LoadItems; Clanka.prefabStep = _assetBundle.LoadAsset<GameObject>("sfx_reepus_footstepClankChaos"); Clanka.prefabRun = _assetBundle.LoadAsset<GameObject>("sfx_reepus_footstepClank2Chaos"); Clanka.prefabDodge = _assetBundle.LoadAsset<GameObject>("sfx_reepus_dodgeChaos"); Clanka.prefabLand = _assetBundle.LoadAsset<GameObject>("sfx_reepus_landChaos"); Clanka.prefabJump = _assetBundle.LoadAsset<GameObject>("sfx_reepus_jumpClankChaos"); Clanka.prefabBootStep = _assetBundle.LoadAsset<GameObject>("sfx_reepus_footstepBootWalkChaos"); Clanka.prefabBootRun = _assetBundle.LoadAsset<GameObject>("sfx_reepus_footstepBootRunChaos"); Clanka.jumpData = new EffectData { m_enabled = true, m_prefab = Clanka.prefabJump }; Clanka.dodgeData = new EffectData { m_enabled = true, m_prefab = Clanka.prefabDodge }; PrefabManager.Instance.AddPrefab(Clanka.prefabStep); PrefabManager.Instance.AddPrefab(Clanka.prefabRun); PrefabManager.Instance.AddPrefab(Clanka.prefabDodge); PrefabManager.Instance.AddPrefab(Clanka.prefabLand); PrefabManager.Instance.AddPrefab(Clanka.prefabJump); PrefabManager.Instance.AddPrefab(Clanka.prefabBootStep); PrefabManager.Instance.AddPrefab(Clanka.prefabBootRun); ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "ReepusDelmeepus.ChaosArmorClank.cfg"), true); doTheRoar = val.Bind<bool>("General", "do the clank", true, "Make player go clank-clank if chaos armor is equipped. Not synced with server."); _BSTInstalled = Chainloader.PluginInfos.ContainsKey("GoldenJude_BlacksmithTools"); if (_BSTInstalled) { RegisterBlacksmithTools(); } Harmony.CreateAndPatchAll(assembly, (string)null); } private void LoadItems() { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode(shieldVanilla)); staffShield = (SE_Shield)(object)((statusEffect is SE_Shield) ? statusEffect : null); List<ItemConfiguration> list = LoadJsons(); foreach (ItemConfiguration item in list) { GameObject val = _assetBundle.LoadAsset<GameObject>(item.Prefab); ItemDrop component = val.GetComponent<ItemDrop>(); if (item.Set.HasValue) { component.m_itemData.m_shared.m_setName = item.Set.Value.Name; component.m_itemData.m_shared.m_setStatusEffect = (StatusEffect)(object)_statusEffects[item.Set.Value.StatusEffect]; component.m_itemData.m_shared.m_setSize = item.Set.Value.Size; } ItemManager.Instance.AddItem(new CustomItem(val, false, item.Config)); } } private List<ItemConfiguration> LoadJsons() { string text = AssetUtils.LoadTextFromResources("Configurations.json", Assembly.GetExecutingAssembly()); try { return JsonConvert.DeserializeObject<List<ItemConfiguration>>(text); } catch { ArmorLogger.LogError((object)"Issue loading items! Contact the mod author."); } return new List<ItemConfiguration>(); } public static void AttachShieldFx(SE_Shield shield) { if ((Object)(object)staffShield != (Object)null) { ((StatusEffect)shield).m_startEffects.m_effectPrefabs = ((StatusEffect)staffShield).m_startEffects.m_effectPrefabs.Concat(staffShield.m_hitEffects.m_effectPrefabs).ToArray(); shield.m_breakEffects = staffShield.m_breakEffects; shield.m_hitEffects = staffShield.m_hitEffects; ((StatusEffect)shield).m_stopEffects = staffShield.m_breakEffects; } } private void SetStatusEffects() { try { SE_Stats val = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val).name = "ChaosT3SetEffect"; val.m_staminaRegenMultiplier = 1.05f; val.m_addMaxCarryWeight = 16f; _statusEffects.Add("T3SetStatus", val); SE_Stats val2 = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)val2).name = "ChaosT4SetEffect"; val2.m_staminaRegenMultiplier = 1.15f; val2.m_addMaxCarryWeight = 32f; _statusEffects.Add("T4SetStatus", val2); } catch (Exception ex) { ArmorLogger.LogWarning((object)"Unable to create custom set status effects!"); ArmorLogger.LogError((object)ex); } } private void RegisterBlacksmithTools() { try { List<bodyPart> value = new List<bodyPart> { (bodyPart)1, (bodyPart)2, (bodyPart)3, (bodyPart)4, (bodyPart)5, (bodyPart)6, (bodyPart)7 }; BodypartSystem.bodypartSettings.Add("T0ChaosPlateArmor", value); BodypartSystem.bodypartSettings.Add("T1ChaosPlateArmor", value); BodypartSystem.bodypartSettings.Add("T2ChaosPlateArmor", value); BodypartSystem.bodypartSettings.Add("ChaosPlateArmorBody", value); BodypartSystem.bodypartSettings.Add("EliteChaosPlateArmor", value); BodypartSystem.bodypartSettings.Add("EliteChaosPlateArmorTzeentch", value); BodypartSystem.bodypartSettings.Add("EliteChaosPlateArmorT2", value); List<bodyPart> value2 = new List<bodyPart> { (bodyPart)11, (bodyPart)8, (bodyPart)12, (bodyPart)13, (bodyPart)9, (bodyPart)10 }; BodypartSystem.bodypartSettings.Add("T0ChaosPlateLegs", value2); BodypartSystem.bodypartSettings.Add("T1ChaosPlateLegs", value2); BodypartSystem.bodypartSettings.Add("T2ChaosPlateLegs", value2); BodypartSystem.bodypartSettings.Add("ChaosPlateLegs", value2); BodypartSystem.bodypartSettings.Add("EliteChaosPlateLegs", value2); BodypartSystem.bodypartSettings.Add("EliteChaosPlateLegsTzeentch", value2); BodypartSystem.bodypartSettings.Add("EliteChaosPlateLegsT2", value2); } catch (Exception) { ArmorLogger.LogWarning((object)"Blacksmith's Tools failed to register but Chaos Armor should still be functional; keep an eye out for updates to Blacksmith's Tools"); } } } public class ButchersNails : MonoBehaviour { private Humanoid wearer; public void Start() { Transform root = ((Component)this).transform.root; object obj; if (root == null) { obj = null; } else { GameObject gameObject = ((Component)root).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null); } wearer = (Humanoid)obj; if ((Object)(object)wearer != (Object)null) { Humanoid obj2 = wearer; ((Character)obj2).m_onDamaged = (Action<float, Character>)Delegate.Combine(((Character)obj2).m_onDamaged, new Action<float, Character>(OnDamaged)); } } public void OnDisable() { if ((Object)(object)wearer != (Object)null) { Humanoid obj = wearer; ((Character)obj).m_onDamaged = (Action<float, Character>)Delegate.Remove(((Character)obj).m_onDamaged, new Action<float, Character>(OnDamaged)); } wearer = null; } public void OnDamaged(float dmg, Character idfkLol) { float maxHealth = ((Character)wearer).GetMaxHealth(); if (dmg > Math.Min(50f, maxHealth / 2f)) { ((Character)wearer).AddStamina(40f); } else if (dmg >= 5f) { ((Character)wearer).AddStamina(15f); } } } public class Clanka : MonoBehaviour { public static GameObject prefabStep; public static GameObject prefabRun; public static GameObject prefabJump; public static GameObject prefabDodge; public static GameObject prefabLand; public static GameObject prefabBootStep; public static GameObject prefabBootRun; public static EffectData jumpData; public static EffectData dodgeData; private Player wearer; public void Start() { if (ReepusDeepusDelmeepusChaosArmor.DoTheRoar && !((Object)(object)prefabStep == (Object)null)) { Transform root = ((Component)this).transform.root; object obj; if (root == null) { obj = null; } else { GameObject gameObject = ((Component)root).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null); } wearer = (Player)obj; if ((Object)(object)wearer != (Object)null) { MakePlayerClanky(wearer); } } } public void OnDisable() { if (ReepusDeepusDelmeepusChaosArmor.DoTheRoar && !((Object)(object)prefabStep == (Object)null)) { if ((Object)(object)wearer != (Object)null && !ReepusDeepusDelmeepusChaosArmor.clankyPrefabNames.Contains(((Humanoid)wearer).m_visEquipment?.m_currentChestItemHash ?? (-1)) && !ReepusDeepusDelmeepusChaosArmor.clankyPrefabNames.Contains(((Humanoid)wearer).m_visEquipment?.m_currentLegItemHash ?? (-1))) { UnclankPlayer(wearer); } wearer = null; } } private static void MakePlayerClanky(Player player) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 FootStep component = ((Component)player).GetComponent<FootStep>(); if ((Object)(object)component == (Object)null || ((Character)player).m_jumpEffects == null || player.m_dodgeEffects == null) { return; } foreach (StepEffect effect in component.m_effects) { HashSet<GameObject> hashSet = new HashSet<GameObject>(effect.m_effectPrefabs); bool flag = false; MotionType motionType = effect.m_motionType; MotionType val = motionType; if (((int)val == 2 || (int)val == 8) ? (hashSet.Add(prefabRun) | hashSet.Add(prefabBootRun)) : (((int)val != 32) ? (hashSet.Add(prefabStep) | hashSet.Add(prefabBootStep)) : (hashSet.Add(prefabLand) | hashSet.Add(prefabBootRun)))) { effect.m_effectPrefabs = hashSet.ToArray(); } } HashSet<EffectData> hashSet2 = new HashSet<EffectData>(((Character)player).m_jumpEffects.m_effectPrefabs); bool flag2 = hashSet2.Add(jumpData); HashSet<EffectData> hashSet3 = new HashSet<EffectData>(player.m_dodgeEffects.m_effectPrefabs); bool flag3 = hashSet3.Add(dodgeData); if (flag2) { ((Character)player).m_jumpEffects.m_effectPrefabs = hashSet2.ToArray(); } if (flag3) { player.m_dodgeEffects.m_effectPrefabs = hashSet3.ToArray(); } } private static void UnclankPlayer(Player player) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 FootStep component = ((Component)player).GetComponent<FootStep>(); if ((Object)(object)component == (Object)null || ((Character)player).m_jumpEffects == null || player.m_dodgeEffects == null) { return; } foreach (StepEffect effect in component.m_effects) { HashSet<GameObject> hashSet = new HashSet<GameObject>(effect.m_effectPrefabs); bool flag = false; MotionType motionType = effect.m_motionType; MotionType val = motionType; if (((int)val == 2 || (int)val == 8) ? (hashSet.Remove(prefabRun) | hashSet.Remove(prefabBootRun)) : (((int)val != 32) ? (hashSet.Remove(prefabStep) | hashSet.Remove(prefabBootStep)) : (hashSet.Remove(prefabLand) | hashSet.Remove(prefabBootRun)))) { effect.m_effectPrefabs = hashSet.ToArray(); } } HashSet<EffectData> hashSet2 = new HashSet<EffectData>(((Character)player).m_jumpEffects.m_effectPrefabs); bool flag2 = hashSet2.Remove(jumpData); HashSet<EffectData> hashSet3 = new HashSet<EffectData>(player.m_dodgeEffects.m_effectPrefabs); bool flag3 = hashSet3.Remove(dodgeData); if (flag2) { ((Character)player).m_jumpEffects.m_effectPrefabs = hashSet2.ToArray(); } if (flag3) { player.m_dodgeEffects.m_effectPrefabs = hashSet3.ToArray(); } } } public class EitrDynamo : MonoBehaviour { private Humanoid wearer; public void Start() { Transform root = ((Component)this).transform.root; object obj; if (root == null) { obj = null; } else { GameObject gameObject = ((Component)root).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null); } wearer = (Humanoid)obj; if ((Object)(object)wearer != (Object)null) { Humanoid obj2 = wearer; ((Character)obj2).m_onDamaged = (Action<float, Character>)Delegate.Combine(((Character)obj2).m_onDamaged, new Action<float, Character>(OnDamaged)); } } public void OnDisable() { if ((Object)(object)wearer != (Object)null) { Humanoid obj = wearer; ((Character)obj).m_onDamaged = (Action<float, Character>)Delegate.Remove(((Character)obj).m_onDamaged, new Action<float, Character>(OnDamaged)); } wearer = null; } public void OnDamaged(float dmg, Character idfkLol) { bool flag = ((Character)wearer).HaveEitr(0f); float maxEitr = ((Character)wearer).GetMaxEitr(); float maxHealth = ((Character)wearer).GetMaxHealth(); if (maxEitr > 0f) { if (dmg > Math.Min(50f, maxHealth / 3f)) { ((Character)wearer).AddEitr(70f); } else if (dmg > 30f) { ((Character)wearer).AddEitr(40f); } else if (dmg < 20f && !((Character)wearer).m_blocking) { ((Character)wearer).AddEitr(3f); } else { ((Character)wearer).AddEitr(25f); } } } } public class EitrShield : MonoBehaviour { private Humanoid wearer; private const string shieldName = "TzeentchReactiveShield"; private int shieldHash; public void Start() { Transform root = ((Component)this).transform.root; object obj; if (root == null) { obj = null; } else { GameObject gameObject = ((Component)root).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null); } wearer = (Humanoid)obj; if ((Object)(object)wearer != (Object)null) { shieldHash = StringExtensionMethods.GetStableHashCode("TzeentchReactiveShield"); Humanoid obj2 = wearer; ((Character)obj2).m_onDamaged = (Action<float, Character>)Delegate.Combine(((Character)obj2).m_onDamaged, new Action<float, Character>(OnDamaged)); } } public void OnDisable() { if ((Object)(object)wearer != (Object)null) { Humanoid obj = wearer; ((Character)obj).m_onDamaged = (Action<float, Character>)Delegate.Remove(((Character)obj).m_onDamaged, new Action<float, Character>(OnDamaged)); } wearer = null; } public void OnDamaged(float dmg, Character idfkLol) { //IL_00e9: Unknown result type (might be due to invalid IL or missing references) bool flag = ((Character)wearer).HaveEitr(0f); float maxHealth = ((Character)wearer).GetMaxHealth(); float num = Math.Max(25f, maxHealth / 4f); float num2 = (flag ? (((Character)wearer).GetEitrPercentage() * ((Character)wearer).GetMaxEitr()) : 0f); bool flag2 = ((Character)wearer).GetHealth() <= num; bool flag3 = dmg < 10f; SEMan sEMan = ((Character)wearer).GetSEMan(); if (flag3 && (!flag2 || sEMan.HaveStatusEffect(shieldHash))) { return; } SE_Shield val = ScriptableObject.CreateInstance<SE_Shield>(); ((Object)val).name = "TzeentchReactiveShield"; ((StatusEffect)val).m_nameHash = shieldHash; ((StatusEffect)val).m_ttl = ((flag3 && flag2) ? 5f : (20f + 0.35f * num2)); val.m_levelUpSkillOnBreak = (SkillType)10; val.m_levelUpSkillFactor = 0.5f; val.m_absorbDamagePerSkillLevel = 1f; val.m_absorbDamage = ((flag3 && flag2) ? 5f : (5f + num2)); ReepusDeepusDelmeepusChaosArmor.AttachShieldFx(val); float num3 = Math.Min(75f, maxHealth / 2f); float num4 = Math.Min(25f, maxHealth / 3f); if (dmg >= num3) { val.m_absorbDamage += 120f; } else { float num5 = dmg; if (num5 < num3 && num5 >= num4) { val.m_absorbDamage += 70f; } else { float num6 = dmg; if (num6 < num4 && num6 >= 10f) { val.m_absorbDamage += 30f; } } } val.m_absorbDamage = Math.Min(val.m_absorbDamage, 900f); ((StatusEffect)val).m_ttl = Math.Min(((StatusEffect)val).m_ttl, 100f); sEMan.AddStatusEffect((StatusEffect)(object)val, false, 0, 0f); } } public class EmergencyShield : MonoBehaviour { private Humanoid wearer; private const string shieldName = "UndividedReactiveEmergencyShield"; private int shieldHash; public void Start() { Transform root = ((Component)this).transform.root; object obj; if (root == null) { obj = null; } else { GameObject gameObject = ((Component)root).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent<Player>() : null); } wearer = (Humanoid)obj; if ((Object)(object)wearer != (Object)null) { shieldHash = StringExtensionMethods.GetStableHashCode("UndividedReactiveEmergencyShield"); Humanoid obj2 = wearer; ((Character)obj2).m_onDamaged = (Action<float, Character>)Delegate.Combine(((Character)obj2).m_onDamaged, new Action<float, Character>(OnDamaged)); } } public void OnDisable() { if ((Object)(object)wearer != (Object)null) { Humanoid obj = wearer; ((Character)obj).m_onDamaged = (Action<float, Character>)Delegate.Remove(((Character)obj).m_onDamaged, new Action<float, Character>(OnDamaged)); } wearer = null; } public void OnDamaged(float dmg, Character idfkLol) { float maxHealth = ((Character)wearer).GetMaxHealth(); float num = Math.Max(25f, maxHealth / 4f); bool flag = ((Character)wearer).GetHealth() <= num; float num2 = Math.Min(50f, maxHealth / 2f); bool flag2 = dmg < num2; SEMan sEMan = ((Character)wearer).GetSEMan(); if (!flag2 || (flag && !sEMan.HaveStatusEffect(shieldHash))) { SE_Shield val = ScriptableObject.CreateInstance<SE_Shield>(); ((Object)val).name = "UndividedReactiveEmergencyShield"; ((StatusEffect)val).m_nameHash = shieldHash; ((StatusEffect)val).m_ttl = ((flag2 && flag) ? 10f : 25f); val.m_absorbDamage = 25f; ReepusDeepusDelmeepusChaosArmor.AttachShieldFx(val); sEMan.AddStatusEffect((StatusEffect)(object)val, false, 0, 0f); } } } public static class PoiseBois { [HarmonyPatch(typeof(Character), "RPC_Damage")] public static class ReduceDamageTaken { [UsedImplicitly] private static void Prefix(Character __instance, HitData hit) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val != null) { if (((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T4Hash || ((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T5Hash || ((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T5UHash) { hit.m_pushForce *= 0.15f; hit.m_staggerMultiplier *= 0.75f; } else if (((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T3Hash) { hit.m_pushForce *= 0.4f; hit.m_staggerMultiplier *= 0.85f; } else if (((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T2Hash || ((Humanoid)val).m_visEquipment.m_currentChestItemHash == ReepusDeepusDelmeepusChaosArmor.T1Hash) { hit.m_pushForce *= 0.65f; } } } } }