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 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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MediocratesBulletRandomizer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MediocratesBulletRandomizer")]
[assembly: AssemblyTitle("MediocratesBulletRandomizer")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace MediocratesBulletRandomizer;
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInPlugin("MediocratesLIVE.MediocratesBulletRandomizerPlugin", "MediocratesBulletRandomizerPlugin", "1.3.0")]
public class MediocratesBulletRandomizerPlugin : BaseUnityPlugin
{
public const string PluginGUID = "MediocratesLIVE.MediocratesBulletRandomizerPlugin";
public const string PluginAuthor = "MediocratesLIVE";
public const string PluginName = "MediocratesBulletRandomizerPlugin";
public const string PluginVersion = "1.3.0";
private void Awake()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
BulletAttack.Fire += new hook_Fire(BulletAttack_Fire_Hook);
}
private void BulletAttack_Fire_Hook(orig_Fire orig, BulletAttack self)
{
OnBulletFired(self);
orig.Invoke(self);
}
private void OnBulletFired(BulletAttack bullet)
{
bullet.damage *= RandomRange(0.5f, 2f);
bullet.spreadPitchScale *= RandomRange(0.5f, 1.5f);
bullet.spreadYawScale *= RandomRange(0.5f, 1.5f);
bullet.force *= RandomRange(0.8f, 1.5f);
bullet.procCoefficient *= RandomRange(0.7f, 1.3f);
bullet.tracerEffectPrefab = GetRandomTracer();
}
private float RandomRange(float min, float max)
{
return Random.Range(min, max);
}
private GameObject GetRandomTracer()
{
GameObject[] array = (GameObject[])(object)new GameObject[7]
{
LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerCommandoDefault"),
LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerGoldGat"),
LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerEngiTurret"),
LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerToolbotRebar"),
LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerVoidSurvivorDefault"),
LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerLunarGolemTwinShot"),
LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/TracerClayBruiserMinigun")
};
int num = Random.Range(0, array.Length);
return array[num];
}
}