Decompiled source of officerballs MoveTweaks v1.0.1

BepInEx/plugins/officerballs/officerballs.MoveTweaks.dll

Decompiled a day 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.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("officerballs.MoveTweaks")]
[assembly: AssemblyTitle("officerballs.MoveTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "officerballs.MoveTweaks";

		public const string modName = "MoveTweaks";

		public const string modVersion = "1.0.1.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_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			Ray val = Camera.main.ScreenPointToRay(Input.mousePosition);
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, 1000f) && Input.GetMouseButton(2))
			{
				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;
			}
		}
	}
}