Decompiled source of BiggerPing v1.0.2

plugins/BiggerPing.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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 = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BiggerPing")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BiggerPing")]
[assembly: AssemblyTitle("BiggerPing")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
[BepInPlugin("GinjeesPacks.BiggerPing", "Ping Scale Mod", "1.0.1")]
public class PingScaleMod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PointPinger), "ReceivePoint_Rpc")]
	public static class PointPinger_ReceivePoint_Rpc_Patch
	{
		public static void Postfix(PointPinger __instance)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				FieldInfo field = typeof(PointPinger).GetField("pingInstance", BindingFlags.Instance | BindingFlags.NonPublic);
				if (field == null)
				{
					Debug.LogError((object)"[PingScaleMod] ERROR: Could not find 'pingInstance' field.");
					return;
				}
				object? value = field.GetValue(__instance);
				GameObject val = (GameObject)((value is GameObject) ? value : null);
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogWarning((object)"[PingScaleMod] WARNING: pingInstance is null.");
					return;
				}
				PointPing component = val.GetComponent<PointPing>();
				if ((Object)(object)component != (Object)null && (Object)(object)component.renderer != (Object)null)
				{
					float num = pointerScale?.Value ?? 3f;
					Transform transform = ((Component)component.renderer).transform;
					transform.localScale *= num;
					float num2 = 0.7f + (num - 3f) * 1f;
					Transform transform2 = val.transform;
					transform2.position += Vector3.up * num2;
					Debug.Log((object)$"[PingScaleMod] SUCCESS: Scaled renderer by {num}x and lifted ping by {num2} units.");
				}
				else
				{
					Debug.LogWarning((object)"[PingScaleMod] WARNING: Could not find renderer on PointPing.");
				}
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"[PingScaleMod] ERROR in Postfix: {arg}");
			}
		}
	}

	private const float BaseScale = 3f;

	private const float BaseOffset = 0.7f;

	private const float OffsetPerStep = 1f;

	public static ConfigEntry<float>? pointerScale;

	private void Awake()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Expected O, but got Unknown
		pointerScale = ((BaseUnityPlugin)this).Config.Bind<float>("General", "PointerScale", 3f, new ConfigDescription("Scale multiplier for the pointer prefab", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 10f), Array.Empty<object>()));
		Harmony val = new Harmony("GinjeesPacks.pingscalemod");
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[PingScaleMod] Plugin loaded. Harmony patches applied.");
	}
}