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 IL.RoR2;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using R2API;
using RoR2;
[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 = "")]
[assembly: AssemblyCompany("HuntersHarpoonBuff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HuntersHarpoonBuff")]
[assembly: AssemblyTitle("HuntersHarpoonBuff")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace HuntersHarpoonBuff;
[BepInPlugin("OakPrime.HuntersHarpoonRework", "HuntersHarpoonRework", "2.0.2")]
public class HuntersHarpoonRework : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Func<Instruction, bool> <>9__5_1;
public static Func<Instruction, bool> <>9__5_2;
public static Func<Instruction, bool> <>9__5_3;
public static Action<int, CharacterBody> <>9__5_4;
public static Manipulator <>9__5_0;
internal void <Awake>b__5_0(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = default(ILLabel);
val.TryGotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 52),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2)
});
val.Index += 4;
val.RemoveRange(37);
val.Emit(OpCodes.Ldloc, 15);
val.EmitDelegate<Action<int, CharacterBody>>((Action<int, CharacterBody>)delegate(int itemCount, CharacterBody body)
{
if (body != null)
{
body.ClearTimedBuffs(Buffs.KillMoveSpeed);
}
for (int i = 0; i < 4; i++)
{
if (body != null)
{
body.AddTimedBuff(Buffs.KillMoveSpeed, 2f * (float)itemCount * (float)Math.Pow(0.75, i));
}
}
});
}
internal bool <Awake>b__5_1(Instruction x)
{
return ILPatternMatchingExt.MatchLdloc(x, 52);
}
internal bool <Awake>b__5_2(Instruction x)
{
return ILPatternMatchingExt.MatchLdcI4(x, 0);
}
internal bool <Awake>b__5_3(Instruction x)
{
ILLabel val = default(ILLabel);
return ILPatternMatchingExt.MatchBle(x, ref val);
}
internal void <Awake>b__5_4(int itemCount, CharacterBody body)
{
if (body != null)
{
body.ClearTimedBuffs(Buffs.KillMoveSpeed);
}
for (int i = 0; i < 4; i++)
{
if (body != null)
{
body.AddTimedBuff(Buffs.KillMoveSpeed, 2f * (float)itemCount * (float)Math.Pow(0.75, i));
}
}
}
}
public const string PluginGUID = "OakPrime.HuntersHarpoonRework";
public const string PluginAuthor = "OakPrime";
public const string PluginName = "HuntersHarpoonRework";
public const string PluginVersion = "2.0.2";
private readonly Dictionary<string, string> DefaultLanguage = new Dictionary<string, string>();
public void Awake()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
try
{
UpdateText();
object obj = <>c.<>9__5_0;
if (obj == null)
{
Manipulator val = delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
ILCursor val2 = new ILCursor(il);
ILLabel val3 = default(ILLabel);
val2.TryGotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 52),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val3)
});
val2.Index += 4;
val2.RemoveRange(37);
val2.Emit(OpCodes.Ldloc, 15);
val2.EmitDelegate<Action<int, CharacterBody>>((Action<int, CharacterBody>)delegate(int itemCount, CharacterBody body)
{
if (body != null)
{
body.ClearTimedBuffs(Buffs.KillMoveSpeed);
}
for (int i = 0; i < 4; i++)
{
if (body != null)
{
body.AddTimedBuff(Buffs.KillMoveSpeed, 2f * (float)itemCount * (float)Math.Pow(0.75, i));
}
}
});
};
<>c.<>9__5_0 = val;
obj = (object)val;
}
GlobalEventManager.OnCharacterDeath += (Manipulator)obj;
}
catch (Exception ex)
{
((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace));
}
}
private void UpdateText()
{
ReplaceString("ITEM_MOVESPEEDONKILL_DESC", "Killing an enemy increases <style=cIsUtility>movement speed</style> by <style=cIsUtility>100%</style> fading over <style=cIsUtility>2</style> <style=cStack>(+2 per stack)</style> seconds.");
}
private void ReplaceString(string token, string newText)
{
DefaultLanguage[token] = Language.GetString(token);
LanguageAPI.Add(token, newText);
}
}
internal static class Log
{
internal static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void LogDebug(object data)
{
_logSource.LogDebug(data);
}
internal static void LogError(object data)
{
_logSource.LogError(data);
}
internal static void LogFatal(object data)
{
_logSource.LogFatal(data);
}
internal static void LogInfo(object data)
{
_logSource.LogInfo(data);
}
internal static void LogMessage(object data)
{
_logSource.LogMessage(data);
}
internal static void LogWarning(object data)
{
_logSource.LogWarning(data);
}
}