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 BepInEx.Bootstrap;
using BepInEx.Configuration;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.RuntimeDetour;
using On.RoR2;
using RoR2;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("SunStroke")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SunStroke")]
[assembly: AssemblyTitle("SunStroke")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 SunStroke
{
[BepInPlugin("xyz.yekoc.SunStroke", "Unmatched Power of the Sun's Heat", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class SunStrokePlugin : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static hook_CheckDotForUpgrade <>9__1_0;
public static Func<Instruction, bool> <>9__1_3;
public static Func<Instruction, bool> <>9__1_4;
public static Func<int, int> <>9__1_2;
public static Manipulator <>9__1_1;
public static Func<Instruction, bool> <>9__2_2;
public static Func<int, int> <>9__2_1;
internal void <Awake>b__1_0(orig_CheckDotForUpgrade orig, Inventory inv, ref InflictDotInfo info)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
if (((int)info.dotIndex == 1 || (int)info.dotIndex == 7 || (int)info.dotIndex == 2) && Object.op_Implicit((Object)(object)info.victimObject))
{
int num = Mathf.Max(1, info.victimObject.GetComponent<CharacterBody>().GetBuffCount(Buffs.Overheat) - 2);
info.damageMultiplier *= num;
info.totalDamage *= num;
Debug.Log((object)("new burn at " + num));
}
orig.Invoke(inv, ref info);
}
internal void <Awake>b__1_1(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
int num = default(int);
if (val.TryGotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchSub(x),
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
}))
{
int index = val.Index;
val.Index = index + 1;
val.EmitDelegate<Func<int, int>>((Func<int, int>)((int orig) => Mathf.Min(orig, 1)));
}
}
internal bool <Awake>b__1_3(Instruction x)
{
return ILPatternMatchingExt.MatchSub(x);
}
internal bool <Awake>b__1_4(Instruction x)
{
int num = default(int);
return ILPatternMatchingExt.MatchStloc(x, ref num);
}
internal int <Awake>b__1_2(int orig)
{
return Mathf.Min(orig, 1);
}
internal bool <PaladinCompat>b__2_2(Instruction x)
{
return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(CharacterBody).GetMethod("GetBuffCount", new Type[1] { typeof(BuffDef) }));
}
internal int <PaladinCompat>b__2_1(int orig)
{
return Mathf.Min(orig, 1);
}
}
public ConfigEntry<bool> vanillaSun;
private void Awake()
{
//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_0041: Expected O, but got Unknown
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
vanillaSun = ((BaseUnityPlugin)this).Config.Bind<bool>("Balance/Compat", "Vanilla Sun Behavior", false, "If set to true,doesn't apply the hook that prevents the sun from applying extra burn.Set for compatibility or to buff grandparents.Default Value: False");
object obj = <>c.<>9__1_0;
if (obj == null)
{
hook_CheckDotForUpgrade val = delegate(orig_CheckDotForUpgrade orig, Inventory inv, ref InflictDotInfo info)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Invalid comparison between Unknown and I4
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
if (((int)info.dotIndex == 1 || (int)info.dotIndex == 7 || (int)info.dotIndex == 2) && Object.op_Implicit((Object)(object)info.victimObject))
{
int num2 = Mathf.Max(1, info.victimObject.GetComponent<CharacterBody>().GetBuffCount(Buffs.Overheat) - 2);
info.damageMultiplier *= num2;
info.totalDamage *= num2;
Debug.Log((object)("new burn at " + num2));
}
orig.Invoke(inv, ref info);
};
<>c.<>9__1_0 = val;
obj = (object)val;
}
StrengthenBurnUtils.CheckDotForUpgrade += (hook_CheckDotForUpgrade)obj;
if (vanillaSun.Value)
{
return;
}
object obj2 = <>c.<>9__1_1;
if (obj2 == null)
{
Manipulator val2 = delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val3 = new ILCursor(il);
int num = default(int);
if (val3.TryGotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchSub(x),
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
}))
{
int index = val3.Index;
val3.Index = index + 1;
val3.EmitDelegate<Func<int, int>>((Func<int, int>)((int orig) => Mathf.Min(orig, 1)));
}
};
<>c.<>9__1_1 = val2;
obj2 = (object)val2;
}
GrandParentSunController.ServerFixedUpdate += (Manipulator)obj2;
if (Chainloader.PluginInfos.ContainsKey("com.rob.Paladin"))
{
PaladinCompat();
}
}
private void PaladinCompat()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
new ILHook((MethodBase)typeof(PaladinSunController).GetMethod("ServerFixedUpdate", (BindingFlags)(-1)), (Manipulator)delegate(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
int locIndex = -1;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(CharacterBody).GetMethod("GetBuffCount", new Type[1] { typeof(BuffDef) })),
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref locIndex),
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locIndex)
}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, locIndex)
}))
{
val.EmitDelegate<Func<int, int>>((Func<int, int>)((int orig) => Mathf.Min(orig, 1)));
}
else
{
((BaseUnityPlugin)this).Logger.LogError((object)"Paladin compat hook failed,his sun will double dip into overheat damage");
}
});
}
}
}