using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.UI;
using On.RoR2.UI.MainMenu;
using RedGuyMod;
using RedGuyMod.Content.Survivors;
using RoR2;
using RoR2.UI;
using UnityEngine;
[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("FixRav")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FixRav")]
[assembly: AssemblyTitle("FixRav")]
[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 FixRav
{
[BepInPlugin("_score.FixRavager", "FixRavager", "0.0.1")]
public class FixRavPlugin : BaseUnityPlugin
{
public const string PluginGUID = "_score.FixRavager";
public const string PluginAuthor = "score";
public const string PluginName = "FixRavager";
public const string PluginVersion = "0.0.1";
public void Awake()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (AccessTools.Field(typeof(MainPlugin), "MODVERSION").GetValue(null) as string == "1.4.3")
{
new Harmony("_score.FixRavager").CreateClassProcessor(typeof(Fix)).Patch();
return;
}
Debug.LogError((object)"Ravager is fixed, uninstall this mod :)");
Object.Destroy((Object)(object)this);
}
}
[HarmonyPatch]
public class Fix
{
[CompilerGenerated]
private static class <>O
{
public static Action<HUD> <0>__HUDSetup;
public static Action<DamageReport> <1>__GlobalEventManager_onCharacterDeathGlobal;
public static hook_TakeDamage <2>__HealthComponent_TakeDamage;
public static hook_UpdateLastHitTime <3>__HealthComponent_UpdateLastHitTime;
public static hook_Rebuild <4>__LoadoutPanelController_Rebuild;
public static hook_Update <5>__BaseMainMenuScreen_Update;
}
[HarmonyPatch(typeof(MainPlugin), "LateSetup")]
[HarmonyPrefix]
public static bool Patch2()
{
return false;
}
[HarmonyPatch(typeof(RedGuy), "Hook")]
[HarmonyPrefix]
public static bool Patch()
{
//IL_0050: 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_005b: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0090: 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_009b: Expected O, but got Unknown
//IL_00b0: 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_00bb: Expected O, but got Unknown
HUD.onHudTargetChangedGlobal += RedGuy.HUDSetup;
GlobalEventManager.onCharacterDeathGlobal += RedGuy.GlobalEventManager_onCharacterDeathGlobal;
object obj = <>O.<2>__HealthComponent_TakeDamage;
if (obj == null)
{
hook_TakeDamage val = RedGuy.HealthComponent_TakeDamage;
<>O.<2>__HealthComponent_TakeDamage = val;
obj = (object)val;
}
HealthComponent.TakeDamage += (hook_TakeDamage)obj;
object obj2 = <>O.<3>__HealthComponent_UpdateLastHitTime;
if (obj2 == null)
{
hook_UpdateLastHitTime val2 = HealthComponent_UpdateLastHitTime;
<>O.<3>__HealthComponent_UpdateLastHitTime = val2;
obj2 = (object)val2;
}
HealthComponent.UpdateLastHitTime += (hook_UpdateLastHitTime)obj2;
object obj3 = <>O.<4>__LoadoutPanelController_Rebuild;
if (obj3 == null)
{
hook_Rebuild val3 = RedGuy.LoadoutPanelController_Rebuild;
<>O.<4>__LoadoutPanelController_Rebuild = val3;
obj3 = (object)val3;
}
LoadoutPanelController.Rebuild += (hook_Rebuild)obj3;
object obj4 = <>O.<5>__BaseMainMenuScreen_Update;
if (obj4 == null)
{
hook_Update val4 = RedGuy.BaseMainMenuScreen_Update;
<>O.<5>__BaseMainMenuScreen_Update = val4;
obj4 = (object)val4;
}
BaseMainMenuScreen.Update += (hook_Update)obj4;
return false;
}
public static void HealthComponent_UpdateLastHitTime(orig_UpdateLastHitTime orig, HealthComponent self, float damageValue, Vector3 damagePosition, bool damageIsSilent, GameObject attacker, bool delayedDamage, bool firstHitOfDelayedDamage)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, damageValue, damagePosition, damageIsSilent, attacker, delayedDamage, firstHitOfDelayedDamage);
if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body) && self.body.HasBuff(RedGuy.grabbedBuff) && self.health <= 0f)
{
self.health = 1f;
}
}
}
}