Decompiled source of officerballs MoveTweaks v1.0.2

BepInEx/plugins/officerballs/officerballs.MoveTweaks.dll

Decompiled 2 weeks ago
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using MoveTweaks.patches;
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(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("officerballs.MoveTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("officerballs.MoveTweaks")]
[assembly: AssemblyTitle("officerballs.MoveTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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 MoveTweaks
{
	[BepInPlugin("officerballs.MoveTweaks", "MoveTweaks", "1.0.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "officerballs.MoveTweaks";

		public const string modName = "MoveTweaks";

		public const string modVersion = "1.0.2.0";

		private Harmony harmony = new Harmony("officerballs.MoveTweaks");

		public ManualLogSource mls = Logger.CreateLogSource("officerballs.MoveTweaks");

		private void Awake()
		{
			mls.LogInfo((object)"Movement tweaks loaded.");
			harmony.PatchAll(typeof(AddModdedTag));
			harmony.PatchAll(typeof(SprintX));
			harmony.PatchAll(typeof(SprintY));
			harmony.PatchAll(typeof(MovementPatch));
			harmony.PatchAll(typeof(BubblePatch));
			harmony.PatchAll(typeof(InfiniteBubbles));
		}
	}
}
namespace MoveTweaks.patches
{
	[HarmonyPatch(typeof(MultiplayerManager))]
	public class AddModdedTag
	{
		[HarmonyPatch("CreateLobby")]
		[HarmonyPrefix]
		public static void NameChanger(ref List<bool> ___FilterSocialTags)
		{
			int filterPlayerValue = MonoSingleton<MultiplayerManager>.I.FilterPlayerValue;
			string text = MonoSingleton<MainMenuUIController>.I.CreateSessionNameInputField.text;
			___FilterSocialTags[4] = true;
		}
	}
	[HarmonyPatch(typeof(MainSceneManager))]
	public static class BubblePatch
	{
		[HarmonyPatch("Init")]
		[HarmonyPostfix]
		public static void MovePatch(ref bool ___IsBubbleAutoPop)
		{
			___IsBubbleAutoPop = false;
		}
	}
	[HarmonyPatch(typeof(InventoryManager))]
	public static class InfiniteBubbles
	{
		[HarmonyPatch("DecreaseItemCount")]
		[HarmonyPrefix]
		public static bool ConsumePatch(ref ShopItemType itemType)
		{
			if ((int)itemType == 0 || (int)itemType == 1 || (int)itemType == 2 || (int)itemType == 3 || (int)itemType == 4)
			{
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(PlayerMovementController))]
	public static class MovementPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		public static void MovePatch(PlayerMovementController __instance)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetMouseButton(2))
			{
				Ray val = Camera.main.ScreenPointToRay(Input.mousePosition);
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Raycast(val, ref val2, 1000f))
				{
					Transform transform = ((Component)NetworkSingleton<TextChannelManager>.I.MainPlayer).transform;
					Vector3 point = ((RaycastHit)(ref val2)).point;
					point.y = transform.position.y;
					transform.LookAt(point);
					((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, transform.rotation, 5f * Time.deltaTime);
				}
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class SprintX
	{
		[HarmonyPostfix]
		public static void xPost(ref float __result)
		{
			if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))
			{
				__result *= 2.5f;
			}
			else if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))
			{
				__result *= 0.25f;
			}
		}
	}
	[HarmonyPatch(/*Could not decode attribute arguments.*/)]
	public static class SprintY
	{
		[HarmonyPostfix]
		public static void yPost(ref float __result)
		{
			if (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303))
			{
				__result *= 2.5f;
			}
			else if (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305))
			{
				__result *= 0.25f;
			}
		}
	}
}