using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using R2API;
using R2API.Utils;
using RoR2;
[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("LaserScopeCritChance")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+712da9165f6fc261deb7d14b315799e1bc965d50")]
[assembly: AssemblyProduct("LaserScopeCritChance")]
[assembly: AssemblyTitle("LaserScopeCritChance")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LaserScopeCritChance;
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("quasikyo.LaserScopeCritChance", "LaserScopeCritChance", "1.0.1")]
public class LaserScopeCritChance : BaseUnityPlugin
{
public const string PluginGUID = "quasikyo.LaserScopeCritChance";
public const string PluginAuthor = "quasikyo";
public const string PluginName = "LaserScopeCritChance";
public const string PluginVersion = "1.0.1";
private const string laserScopeInternalName = "CritDamage";
private ItemIndex LaserScopeItemIndex { get; set; }
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
Run.onRunStartGlobal += delegate
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
LaserScopeItemIndex = ItemCatalog.FindItemIndex("CritDamage");
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(AddLaserScopeCritChance);
};
Run.onRunDestroyGlobal += delegate
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients -= new StatHookEventHandler(AddLaserScopeCritChance);
};
}
private void AddLaserScopeCritChance(CharacterBody body, StatHookEventArgs args)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
int? obj;
if (body == null)
{
obj = null;
}
else
{
Inventory inventory = body.inventory;
obj = ((inventory != null) ? new int?(inventory.GetItemCount(LaserScopeItemIndex)) : null);
}
int? num = obj;
if (num.GetValueOrDefault() > 0)
{
args.critAdd += 5f;
}
}
}
internal static class Log
{
private static ManualLogSource Logger { get; set; }
internal static void Init(ManualLogSource logger)
{
Logger = logger;
}
[Conditional("DEBUG")]
internal static void Debug(object data)
{
Logger.LogDebug(data);
}
internal static void Info(object data)
{
Logger.LogInfo(data);
}
internal static void Message(object data)
{
Logger.LogMessage(data);
}
internal static void Warning(object data)
{
Logger.LogWarning(data);
}
internal static void Error(object data)
{
Logger.LogError(data);
}
internal static void Fatal(object data)
{
Logger.LogFatal(data);
}
}