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 RaincoatRestored v0.1.3
RaincoatRestored.dll
Decompiled 4 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using RoR2; using RoR2.Items; using UnityEngine; using UnityEngine.AddressableAssets; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.3.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Prototype { [BepInPlugin("prototype.raincoat", "RaincoatRestored", "0.1.3")] public class RaincoatRestored : BaseUnityPlugin { public const string identifier = "prototype.raincoat"; public const string version = "0.1.3"; [HarmonyPatch(typeof(ImmuneToDebuffBehavior), "TryApplyOverride")] [HarmonyPrefix] private static bool TryApplyOverride(CharacterBody body, ref bool __result) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_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) ImmuneToDebuffBehavior component = ((Component)body).GetComponent<ImmuneToDebuffBehavior>(); __result = Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.healthComponent); if (__result) { EffectManager.SimpleImpactEffect(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/ImmuneToDebuff/ImmuneToDebuffEffect.prefab").WaitForCompletion(), body.corePosition, Vector3.up, true); } return false; } [HarmonyPatch(typeof(ImmuneToDebuffBehavior), "OverrideDebuff", new Type[] { typeof(BuffDef), typeof(CharacterBody) })] [HarmonyPrefix] private static bool OverrideDebuff(BuffDef buffDef, ref bool __result) { return __result = (Object)(object)Buffs.PermanentCurse != (Object)(object)buffDef; } [HarmonyPatch(typeof(CharacterBody), "RecalculateStats")] [HarmonyILManipulator] private static void RecalculateStats(ILContext context) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004a: 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) ILCursor val = new ILCursor(context); MethodInfo target = typeof(CharacterBody).GetProperty("maxHealth").SetMethod; if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction instruction) => ILPatternMatchingExt.MatchCall(instruction, (MethodBase)target) })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<CharacterBody, float>>((Func<CharacterBody, float>)((CharacterBody body) => (!Object.op_Implicit((Object)(object)body.inventory)) ? 0f : (100f * (float)body.inventory.GetItemCount(Items.ImmuneToDebuff)))); val.Emit(OpCodes.Add); } else { Debug.Log((object)"Unable to restore health bonus for `Ben's Raincoat`."); } } [HarmonyPatch(typeof(CharacterBody), "AddBuff", new Type[] { typeof(BuffIndex) })] [HarmonyPrefix] private static void AddBuff(CharacterBody __instance, ref BuffIndex buffType) { if (ImmuneToDebuffBehavior.OverrideDebuff(buffType, __instance)) { buffType = (BuffIndex)(-1); } } protected void Awake() { Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null); Language.onCurrentLanguageChanged += delegate { Language currentLanguage = Language.currentLanguage; string text = currentLanguage?.name; if (text != null) { string text2; string text3; switch (text.Length) { default: return; case 2: switch (text[0]) { default: return; case 'e': if (!(text == "en")) { return; } text2 = "Become immune to all debuffs. Increase maximum health."; text3 = "Whenever you would receive a <style=cIsDamage>debuff</style>, prevent it. Increases <style=cIsHealing>maximum health</style> by <style=cIsHealing>100</style> <style=cStack>(+100 per stack)</style>."; break; case 'd': if (!(text == "de")) { return; } text2 = "Werde immun gegen alle Debuffs. Erhöhe die maximale Gesundheit."; text3 = "Wann immer du einen <style=cIsDamage>Debuff</style> erhalten würdest, wehre ihn ab. Erhöht <style=cIsHealing>maximale Gesundheit</style> um <style=cIsHealing>100</style> <style=cStack>(+100 pro Stapel)</style>."; break; case 'F': if (!(text == "FR")) { return; } text2 = "Devenez immunisé à tous les affaiblissements. Augmente les PV max."; text3 = "Quand vous êtes sur le point de subir un <style=cIsDamage>affaiblissement</style>, évitez-le. Améliore les <style=cIsHealing>PV max</style> de <style=cIsHealing>100</style> <style=cStack>(+100 par cumul)</style>."; break; case 'I': if (!(text == "IT")) { return; } text2 = "Diventa immune a tutti i debuff. Aumenta la salute massima."; text3 = "Ogni volta che riceveresti un <style=cIsDamage>debuff</style>, previenilo. Aumenta la <style=cIsHealing>salute massima</style> di <style=cIsHealing>100</style> <style=cStack>(+100 per accumulo)</style>."; break; case 'j': if (!(text == "ja")) { return; } text2 = "すべてのデバフの影響を受けない。最大ヘルスが上昇。"; text3 = "<style=cIsDamage>デバフ</style>を受けるといつも、それを防ぐ。<style=cIsHealing>最大ヘルス</style>を <style=cIsHealing>100</style> <style=cStack>(スタックごとに +100)</style> 増やす。"; break; case 'k': if (!(text == "ko")) { return; } text2 = "모든 디버프에 면역이 됩니다. 최대 체력이 증가합니다."; text3 = "<style=cIsDamage>디버프</style>를 방지합니다. <style=cIsHealing>최대 체력</style>이 <style=cIsHealing>100</style><style=cStack>(중첩당 +100)</style> 증가합니다."; break; case 'R': if (!(text == "RU")) { return; } text2 = "Получает невосприимчивость ко всем отрицательным эффектам. Увеличивает максимальный запас здоровья."; text3 = "Отменяет получаемый <style=cIsDamage>отрицательный эффект</style>. Увеличивает <style=cIsHealing>максимальный запас здоровья</style> на <style=cIsHealing>100</style> <style=cStack>(+100 за шт.)</style>."; break; case 't': if (!(text == "tr")) { return; } text2 = "Tüm düşürücülere karşı bağışıklık kazan. Maksimum sağlığı artırır."; text3 = "Ne zaman bir <style=cIsDamage>düşürücü</style> alırsan, onu önle. <style=cIsHealing>Maksimum sağlığı</style> <style=cIsHealing>100</style> <style=cStack>(birikim başına +100)</style> artırır."; break; } break; case 5: switch (text[0]) { default: return; case 'e': if (!(text == "es-ES")) { return; } text2 = "Te vuelve inmune a todas las penalizaciones. Aumenta la salud máxima."; text3 = "Siempre que recibes una <style=cIsDamage>penalización</style>, la anula. Aumenta la <style=cIsHealing>salud máxima</style> en <style=cIsHealing>100</style> <style=cStack>(+100 por acumulación)</style>."; break; case 'p': if (!(text == "pt-BR")) { return; } text2 = "Concede imunidade a todas as penalidades. Aumenta a saúde máxima."; text3 = "Sempre que receber uma <style=cIsDamage>penalidade</style>, anule-a. Aumenta a <style=cIsHealing>saúde máxima</style> em <style=cIsHealing>100</style> <style=cStack>(+100 por acúmulo)</style>."; break; case 'z': if (!(text == "zh-CN")) { return; } text2 = "免疫所有减益效果。增加最大生命值。"; text3 = "防止你获得<style=cIsDamage>减益</style>效果。使<style=cIsHealing>最大生命值</style>增加<style=cIsHealing>100</style><style=cStack>(每层+100)</style>。"; break; } break; } currentLanguage.SetStringByToken("ITEM_IMMUNETODEBUFF_PICKUP", text2); currentLanguage.SetStringByToken("ITEM_IMMUNETODEBUFF_DESC", text3); } }; } [HarmonyPatch(typeof(ImmuneToDebuffBehavior), "FixedUpdate")] [HarmonyPrefix] private static bool FixedUpdate() { return false; } } }