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.Configuration;
using Microsoft.CodeAnalysis;
using On;
using Relics;
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("ConsistentShots")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ConsistentShots")]
[assembly: AssemblyTitle("ConsistentShots")]
[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 ConsistentShots
{
public class AimBehaviour : MonoBehaviour
{
private const string SnappingAngle = "Snapping Angle";
private const string QuantizeAimVector = "Quantize Aim Vector";
private float _snappingAngle;
private bool _quantizeAimVector;
public void Init(ConfigFile config)
{
_snappingAngle = config.Bind<float>("Options", "Snapping Angle", 0.05f, "The number of degrees to snap while scrolling. 0.05 is the default and close to the vanilla behaviour.").Value;
_quantizeAimVector = config.Bind<bool>("Options", "Quantize Aim Vector", true, "Rounds vector components near zero back to zero. Realistically only applies when moving the aimer back to a straight downward trajectory.").Value;
}
public void OnEnable()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
PachinkoBall.ApplyRotationToAimer += new hook_ApplyRotationToAimer(PachinkoBallOnApplyRotationToAimer);
}
public void OnDisable()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
PachinkoBall.ApplyRotationToAimer -= new hook_ApplyRotationToAimer(PachinkoBallOnApplyRotationToAimer);
}
private void PachinkoBallOnApplyRotationToAimer(orig_ApplyRotationToAimer orig, PachinkoBall self, float zRotate, bool keepAccel)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
float num = self._player.GetAxis("VerticalSlow");
bool flag = num != 0f;
if (_snappingAngle > 0f && flag)
{
Quaternion rotation = ((Component)self).transform.rotation;
float z = ((Quaternion)(ref rotation)).eulerAngles.z;
if (z > 90f && z < 270f)
{
num *= -1f;
}
float num2 = z + Mathf.Sign(num) * _snappingAngle;
num2 = Mathf.Round(num2 / _snappingAngle) * _snappingAngle;
((Component)self).transform.rotation = Quaternion.Euler(0f, 0f, num2);
self._currentControllerRotateSpeed = 0f;
rotation = ((Component)self).transform.rotation;
self._aimVector = Vector2.op_Implicit(((Quaternion)(ref rotation)).normalized * Vector3.right);
((Behaviour)self._trajectorySimulation).enabled = true;
}
else
{
orig.Invoke(self, zRotate, keepAccel);
}
if (_quantizeAimVector)
{
self._aimVector = Vector2.op_Implicit(new Vector3((Mathf.Abs(self._aimVector.x) < 1E-06f) ? 0f : self._aimVector.x, (Mathf.Abs(self._aimVector.y) < 1E-06f) ? 0f : self._aimVector.y));
}
}
}
public class DeterministicLongPegBehavior : MonoBehaviour
{
private class ExtraCollider : MonoBehaviour
{
public LongPeg reference;
private void FixedUpdate()
{
if (reference._beingHit)
{
LongPeg obj = reference;
obj._timeHit += Time.deltaTime;
float num = reference.TimeToDisappear;
if ((((Peg)reference).relicManager.RelicEffectActive((RelicEffect)10) || ((Peg)reference)._blockPoppingFromThisHit) && ((Peg)reference)._numBounces < ((Peg)reference).BouncesToPop)
{
num += 0.5f;
}
if (reference._timeHit >= num)
{
reference.SetActiveStatus(false);
reference._beingHit = false;
reference._timeHit = 0f;
}
}
}
}
private bool _useDeterministicLongPegRemoval;
private const string DeterministicLongPegRemoval = "Deterministic Long Peg Removal";
public void Init(ConfigFile config)
{
_useDeterministicLongPegRemoval = config.Bind<bool>("Options", "Deterministic Long Peg Removal", true, (ConfigDescription)null).Value;
}
public void OnEnable()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
LongPeg.OnEnable += new hook_OnEnable(LongPegOnOnEnable);
LongPeg.OnDisable += new hook_OnDisable(LongPegOnOnDisable);
LongPeg.Update += new hook_Update(LongPegOnUpdate);
}
private void OnDisable()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
LongPeg.OnEnable -= new hook_OnEnable(LongPegOnOnEnable);
LongPeg.OnDisable -= new hook_OnDisable(LongPegOnOnDisable);
LongPeg.Update -= new hook_Update(LongPegOnUpdate);
}
private void LongPegOnOnEnable(orig_OnEnable orig, LongPeg self)
{
orig.Invoke(self);
if (_useDeterministicLongPegRemoval)
{
((Component)self).gameObject.AddComponent<ExtraCollider>().reference = self;
}
}
private void LongPegOnOnDisable(orig_OnDisable orig, LongPeg self)
{
orig.Invoke(self);
ExtraCollider extraCollider = default(ExtraCollider);
if (((Component)self).gameObject.TryGetComponent<ExtraCollider>(ref extraCollider))
{
Object.Destroy((Object)(object)extraCollider);
}
}
private void LongPegOnUpdate(orig_Update orig, LongPeg self)
{
if (!_useDeterministicLongPegRemoval)
{
orig.Invoke(self);
}
}
}
[BepInPlugin("ConsistentShots", "ConsistentShots", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
((Component)this).gameObject.AddComponent<AimBehaviour>().Init(((BaseUnityPlugin)this).Config);
((Component)this).gameObject.AddComponent<DeterministicLongPegBehavior>().Init(((BaseUnityPlugin)this).Config);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin ConsistentShots is loaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "ConsistentShots";
public const string PLUGIN_NAME = "ConsistentShots";
public const string PLUGIN_VERSION = "1.0.0";
}
}