Decompiled source of NPCInteract360 v1.1.1

Mods/NPCInteract360_IL2Cpp.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using Il2CppScheduleOne.AvatarFramework;
using Il2CppScheduleOne.Interaction;
using Il2CppScheduleOne.NPCs;
using Il2CppScheduleOne.PlayerScripts;
using MelonLoader;
using Microsoft.CodeAnalysis;
using NPCInteract360;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "NPCInteract360", "1.1.1", "j0ckinjz", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyMetadata("NexusModID", "1001")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("NPCInteract360_IL2Cpp")]
[assembly: AssemblyConfiguration("IL2CPP")]
[assembly: AssemblyFileVersion("1.1.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NPCInteract360_IL2Cpp")]
[assembly: AssemblyTitle("NPCInteract360_IL2Cpp")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 NPCInteract360
{
	public class Core : MelonMod
	{
		internal static int totalPatches;

		internal static int framePatches;

		internal static bool sceneInitComplete;

		internal const int IgnoreNPCLayer = 31;

		public override void OnInitializeMelon()
		{
			Harmony.CreateAndPatchAll(typeof(Core).Assembly, (string)null);
			Log.Msg("Mod Initialized. Version " + ((MelonBase)this).Info.Version);
		}

		public override void OnSceneWasInitialized(int buildIndex, string sceneName)
		{
			((MelonMod)this).OnSceneWasInitialized(buildIndex, sceneName);
			totalPatches = 0;
			framePatches = 0;
			sceneInitComplete = false;
		}

		public override void OnLateUpdate()
		{
			if (!sceneInitComplete && totalPatches > 0)
			{
				sceneInitComplete = true;
				Log.Msg($"{totalPatches} NPCs patched.");
			}
			if (framePatches > 0)
			{
				Log.Msg($"{framePatches} NPC{((framePatches > 1) ? "s" : "")} patched.");
				framePatches = 0;
			}
		}
	}
	[HarmonyPatch(typeof(Avatar), "LateUpdate")]
	public static class Patch_Avatar_LateUpdate
	{
		private static readonly HashSet<Transform> adjusted = new HashSet<Transform>();

		private static void Postfix(Avatar __instance)
		{
			Transform transform = ((Component)__instance).transform;
			Transform val = ((transform != null) ? transform.root : null);
			if ((Object)(object)val == (Object)null || adjusted.Contains(val) || (Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
			{
				return;
			}
			bool flag = (Object)(object)((Component)val).GetComponentInChildren<NPC>() != (Object)null;
			foreach (Collider componentsInChild in ((Component)val).GetComponentsInChildren<Collider>(true))
			{
				GameObject gameObject = ((Component)componentsInChild).gameObject;
				string text = ((Object)gameObject).name.ToLowerInvariant();
				if (flag && text.Contains("capsule"))
				{
					gameObject.layer = 31;
				}
			}
			foreach (InteractableObject componentsInChild2 in ((Component)val).GetComponentsInChildren<InteractableObject>(true))
			{
				if (!((Object)(object)componentsInChild2 == (Object)null))
				{
					string text2 = ((Object)componentsInChild2).name.ToLowerInvariant();
					if (!(text2 != "interaction"))
					{
						componentsInChild2.LimitInteractionAngle = false;
					}
				}
			}
			adjusted.Add(val);
			Core.totalPatches++;
			if (Core.sceneInitComplete)
			{
				Core.framePatches++;
			}
		}
	}
	[HarmonyPatch(typeof(InteractionManager), "Start")]
	public static class Patch_InteractionManager_Start
	{
		private static void Postfix(InteractionManager __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			LayerMask interaction_SearchMask = __instance.interaction_SearchMask;
			int value = ((LayerMask)(ref interaction_SearchMask)).value;
			int value2 = value & 0x7FFFFFFF;
			interaction_SearchMask = default(LayerMask);
			((LayerMask)(ref interaction_SearchMask)).value = value2;
			__instance.interaction_SearchMask = interaction_SearchMask;
		}
	}
	internal static class Log
	{
		public static void Msg(string msg)
		{
			Melon<Core>.Logger.Msg(msg);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}

Mods/NPCInteract360_Mono.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using NPCInteract360;
using ScheduleOne.AvatarFramework;
using ScheduleOne.Interaction;
using ScheduleOne.NPCs;
using ScheduleOne.PlayerScripts;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Core), "NPCInteract360", "1.1.1", "j0ckinjz", null)]
[assembly: MelonGame("TVGS", "Schedule I")]
[assembly: AssemblyMetadata("NexusModID", "1001")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("NPCInteract360_Mono")]
[assembly: AssemblyConfiguration("MONO")]
[assembly: AssemblyFileVersion("1.1.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NPCInteract360_Mono")]
[assembly: AssemblyTitle("NPCInteract360_Mono")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 NPCInteract360
{
	public class Core : MelonMod
	{
		internal static int totalPatches;

		internal static int framePatches;

		internal static bool sceneInitComplete;

		internal const int IgnoreNPCLayer = 31;

		public override void OnInitializeMelon()
		{
			Harmony.CreateAndPatchAll(typeof(Core).Assembly, (string)null);
			Log.Msg("Mod Initialized. Version " + ((MelonBase)this).Info.Version);
		}

		public override void OnSceneWasInitialized(int buildIndex, string sceneName)
		{
			((MelonMod)this).OnSceneWasInitialized(buildIndex, sceneName);
			totalPatches = 0;
			framePatches = 0;
			sceneInitComplete = false;
		}

		public override void OnLateUpdate()
		{
			if (!sceneInitComplete && totalPatches > 0)
			{
				sceneInitComplete = true;
				Log.Msg($"{totalPatches} NPCs patched.");
			}
			if (framePatches > 0)
			{
				Log.Msg(string.Format("{0} NPC{1} patched.", framePatches, (framePatches > 1) ? "s" : ""));
				framePatches = 0;
			}
		}
	}
	[HarmonyPatch(typeof(Avatar), "LateUpdate")]
	public static class Patch_Avatar_LateUpdate
	{
		private static readonly HashSet<Transform> adjusted = new HashSet<Transform>();

		private static void Postfix(Avatar __instance)
		{
			Transform transform = ((Component)__instance).transform;
			Transform val = ((transform != null) ? transform.root : null);
			if ((Object)(object)val == (Object)null || adjusted.Contains(val) || (Object)(object)((Component)val).GetComponentInParent<Player>() != (Object)null)
			{
				return;
			}
			bool flag = (Object)(object)((Component)val).GetComponentInChildren<NPC>() != (Object)null;
			Collider[] componentsInChildren = ((Component)val).GetComponentsInChildren<Collider>(true);
			foreach (Collider val2 in componentsInChildren)
			{
				GameObject gameObject = ((Component)val2).gameObject;
				string text = ((Object)gameObject).name.ToLowerInvariant();
				if (flag && text.Contains("capsule"))
				{
					gameObject.layer = 31;
				}
			}
			InteractableObject[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<InteractableObject>(true);
			foreach (InteractableObject val3 in componentsInChildren2)
			{
				if (!((Object)(object)val3 == (Object)null))
				{
					string text2 = ((Object)val3).name.ToLowerInvariant();
					if (!(text2 != "interaction"))
					{
						val3.LimitInteractionAngle = false;
					}
				}
			}
			adjusted.Add(val);
			Core.totalPatches++;
			if (Core.sceneInitComplete)
			{
				Core.framePatches++;
			}
		}
	}
	[HarmonyPatch(typeof(InteractionManager), "Start")]
	public static class Patch_InteractionManager_Start
	{
		private static void Postfix(InteractionManager __instance)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			int value = ((LayerMask)(ref __instance.interaction_SearchMask)).value;
			int value2 = value & 0x7FFFFFFF;
			LayerMask interaction_SearchMask = default(LayerMask);
			((LayerMask)(ref interaction_SearchMask)).value = value2;
			__instance.interaction_SearchMask = interaction_SearchMask;
		}
	}
	internal static class Log
	{
		public static void Msg(string msg)
		{
			Melon<Core>.Logger.Msg(msg);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}