using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak.Afflictions; using Photon.Pun; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("AOEHealingFix")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AOEHealingFix")] [assembly: AssemblyTitle("AOEHealingFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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 AOEHealingFix { [BepInPlugin("jill920.aoefix", "AOE Healing Fix", "1.0.0")] public class AOEHealingFixPlugin : BaseUnityPlugin { public const string MOD_GUID = "jill920.aoefix"; public const string MOD_NAME = "AOE Healing Fix"; public const string MOD_VERSION = "1.0.0"; public static AOEHealingFixPlugin Instance; public static ManualLogSource Logger; private void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown Instance = this; Logger = ((BaseUnityPlugin)this).Logger; try { Harmony val = new Harmony("jill920.aoefix"); val.PatchAll(Assembly.GetExecutingAssembly()); Logger.LogInfo((object)"[AOE Healing Fix 1.0.0] Loaded successfully!"); Logger.LogInfo((object)" AOE healing now works on carried/downed players"); } catch (Exception ex) { Logger.LogError((object)("Harmony patch failed: " + ex.Message)); } } } [HarmonyPatch(typeof(AOE), "Explode")] internal static class AOE_Explode_Patch { [HarmonyPrefix] private static bool Prefix(AOE __instance) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: 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_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Expected I4, but got Unknown //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Expected I4, but got Unknown //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Expected I4, but got Unknown AOEHealingFixPlugin.Logger.LogInfo((object)("[AOE DEBUG] Explode() called on " + ((Object)__instance).name)); AOEHealingFixPlugin.Logger.LogInfo((object)$"[AOE DEBUG] statusAmount: {__instance.statusAmount}, statusType: {__instance.statusType}"); AOEHealingFixPlugin.Logger.LogInfo((object)$"[AOE DEBUG] range: {__instance.range}, hasAffliction: {__instance.hasAffliction}"); if (!(__instance.statusAmount < 0f)) { AOEHealingFixPlugin.Logger.LogInfo((object)"[AOE DEBUG] Not a healing AOE (statusAmount >= 0), letting original handle"); return true; } AOEHealingFixPlugin.Logger.LogInfo((object)$"[AOE DEBUG] HEALING AOE DETECTED! statusAmount: {__instance.statusAmount}"); float statusAmount = __instance.statusAmount; STATUSTYPE statusType = __instance.statusType; STATUSTYPE[] addtlStatus = __instance.addtlStatus; bool hasAffliction = __instance.hasAffliction; Affliction affliction = __instance.affliction; __instance.statusAmount = 0f; __instance.hasAffliction = false; __instance.affliction = null; __instance.Explode(); __instance.statusAmount = statusAmount; __instance.hasAffliction = hasAffliction; __instance.affliction = affliction; if (!PhotonNetwork.IsMasterClient) { AOEHealingFixPlugin.Logger.LogInfo((object)"[AOE DEBUG] Skipping healing application - not MasterClient"); return false; } AOEHealingFixPlugin.Logger.LogInfo((object)"[AOE DEBUG] MasterClient: Processing healing..."); float num = Mathf.Abs(statusAmount); Collider[] array = Physics.OverlapSphere(((Component)__instance).transform.position, __instance.range, LayerMask.op_Implicit(HelperFunctions.GetMask(__instance.mask))); List list = new List(); AOEHealingFixPlugin.Logger.LogInfo((object)$"[AOE DEBUG] Found {array.Length} colliders in range"); Collider[] array2 = array; Character item = default(Character); Character val2 = default(Character); foreach (Collider val in array2) { if (CharacterRagdoll.TryGetCharacterFromCollider(val, ref item) && !list.Contains(item)) { list.Add(item); } if (CharacterRagdoll.TryGetCharacterFromCollider(val, ref val2) && (Object)(object)val2.data.carriedPlayer != (Object)null && !list.Contains(val2.data.carriedPlayer)) { list.Add(val2.data.carriedPlayer); AOEHealingFixPlugin.Logger.LogInfo((object)("[AOE DEBUG] Found carried player " + val2.data.carriedPlayer.characterName + " via carrier " + val2.characterName)); } } foreach (Character item2 in list) { float num2 = Vector3.Distance(((Component)__instance).transform.position, item2.Center); if (num2 > __instance.range) { continue; } float num3 = Mathf.Pow(1f - num2 / __instance.range, __instance.factorPow); if (num3 < __instance.minFactor) { continue; } if (__instance.requireLineOfSigh) { RaycastHit val3 = HelperFunctions.LineCheck(((Component)__instance).transform.position, item2.Center, (LayerType)1, 0f, (QueryTriggerInteraction)1); if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val3)).transform)) { continue; } } float num4 = num * num3; AOEHealingFixPlugin.Logger.LogInfo((object)$"[AOE DEBUG] Healing {item2.characterName} for {num4:F4} (factor: {num3:F4}) | IsCarried: {item2.data.isCarried}"); HealingReceiver component = ((Component)item2).GetComponent(); if ((Object)(object)component != (Object)null) { ((MonoBehaviourPun)component).photonView.RPC("RPC_ApplyHealing", ((MonoBehaviourPun)component).photonView.Owner, new object[2] { (int)statusType, num4 }); if (addtlStatus != null) { STATUSTYPE[] array3 = addtlStatus; foreach (STATUSTYPE val4 in array3) { ((MonoBehaviourPun)component).photonView.RPC("RPC_ApplyHealing", ((MonoBehaviourPun)component).photonView.Owner, new object[2] { (int)val4, num4 }); } } if (hasAffliction && affliction != null) { ((MonoBehaviourPun)component).photonView.RPC("RPC_ApplyAffliction", ((MonoBehaviourPun)component).photonView.Owner, new object[1] { (int)affliction.GetAfflictionType() }); } } else { AOEHealingFixPlugin.Logger.LogError((object)("[AOE DEBUG] No HealingReceiver on " + item2.characterName + "! Make sure Character_Awake_Patch is running.")); } } AOEHealingFixPlugin.Logger.LogInfo((object)$"[AOE DEBUG] Healing applied to {list.Count} characters"); return false; } } [HarmonyPatch(typeof(Character), "Awake")] internal static class Character_Awake_Patch { [HarmonyPostfix] private static void Postfix(Character __instance) { if ((Object)(object)((Component)__instance).GetComponent() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); AOEHealingFixPlugin.Logger.LogInfo((object)("Added HealingReceiver to " + __instance.characterName)); } } } public class HealingReceiver : MonoBehaviourPun { private Character character; private void Awake() { character = ((Component)this).GetComponent(); } [PunRPC] public void RPC_ApplyHealing(int statusTypeInt, float amount) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) if (!((MonoBehaviourPun)this).photonView.IsMine) { ManualLogSource logger = AOEHealingFixPlugin.Logger; Character obj = character; logger.LogInfo((object)("[HEAL] Skipped " + ((obj != null) ? obj.characterName : null) + " - not owner")); } else if (!((Object)(object)character == (Object)null) && !(amount <= 0f)) { STATUSTYPE val = (STATUSTYPE)statusTypeInt; float currentStatus = character.refs.afflictions.GetCurrentStatus(val); character.refs.afflictions.SubtractStatus(val, amount, true, false); float currentStatus2 = character.refs.afflictions.GetCurrentStatus(val); AOEHealingFixPlugin.Logger.LogInfo((object)($"[HEAL] {character.characterName} healed: {val} " + $"{currentStatus:F3} → {currentStatus2:F3} (-{amount:F3}) | IsCarried: {character.data.isCarried} | " + "Carrier: " + (((Object)(object)character.data.carrier != (Object)null) ? character.data.carrier.characterName : "none"))); } } [PunRPC] public void RPC_ApplyAffliction(int afflictionTypeInt) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (((MonoBehaviourPun)this).photonView.IsMine && !((Object)(object)character == (Object)null)) { AfflictionType val = (AfflictionType)afflictionTypeInt; Affliction val2 = Affliction.CreateBlankAffliction(val); if (val2 != null) { character.refs.afflictions.AddAffliction(val2, true); } } } } }