Decompiled source of CleanerLogs v1.0.0

BepInEx/plugins/CleanerLogs.dll

Decompiled 11 months ago
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 BepInEx.Logging;
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("EliteMasterEric")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Cancels out many of the spammy log calls the vanilla game makes.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1e18571a9a2e89df0f217ed5c302a44f87c6b066")]
[assembly: AssemblyProduct("CleanerLogs")]
[assembly: AssemblyTitle("CleanerLogs")]
[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 CleanerLogs
{
	public static class PluginInfo
	{
		public const string PLUGIN_ID = "CleanerLogs";

		public const string PLUGIN_NAME = "CleanerLogs";

		public const string PLUGIN_VERSION = "1.0.0";

		public const string PLUGIN_GUID = "com.elitemastereric.CleanerLogs";
	}
	[BepInPlugin("com.elitemastereric.CleanerLogs", "CleanerLogs", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public ManualLogSource PluginLogger;

		public PluginConfig PluginConfig;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			Instance = this;
			PluginLogger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("com.elitemastereric.CleanerLogs");
			val.PatchAll();
			PluginLogger.LogInfo((object)"Plugin CleanerLogs (com.elitemastereric.CleanerLogs) is loaded!");
			LoadConfig();
			PluginLogger.LogWarning((object)("Base game log messages are being filtered to " + PluginConfig.GetLogLevelString() + ". This may hinder mod debugging."));
			ApplyConfig();
		}

		private void LoadConfig()
		{
			PluginConfig = new PluginConfig();
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
		}

		private void ApplyConfig()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Debug.unityLogger.filterLogType = PluginConfig.GetLogLevelEnum();
		}
	}
	public class PluginConfig
	{
		private ConfigEntry<string> LogLevel;

		public void BindConfig(ConfigFile _config)
		{
			LogLevel = _config.Bind<string>("General", "LogLevel", "Warning", "The log level to use (Log, Warning, Assert, Error, Exception)");
		}

		public string GetLogLevelString()
		{
			return LogLevel.Value;
		}

		public LogType GetLogLevelEnum()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			return (LogType)(LogLevel.Value.ToLower() switch
			{
				"log" => 3, 
				"warning" => 2, 
				"assert" => 1, 
				"error" => 0, 
				"exception" => 4, 
				_ => 2, 
			});
		}
	}
}

SlimeTamingFix.dll

Decompiled 11 months ago
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("EliteMasterEric")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Fixes a bug that made Hygroderes unable to be tamed with Boomboxes.")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e709a2bfea1a28a28a1c571d795598beb5da8515")]
[assembly: AssemblyProduct("SlimeTamingFix")]
[assembly: AssemblyTitle("SlimeTamingFix")]
[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 SlimeTamingFix
{
	public static class PluginInfo
	{
		public const string PLUGIN_ID = "SlimeTamingFix";

		public const string PLUGIN_NAME = "SlimeTamingFix";

		public const string PLUGIN_VERSION = "1.0.0";

		public const string PLUGIN_GUID = "com.elitemastereric.slimetamingfix";
	}
	[BepInPlugin("com.elitemastereric.slimetamingfix", "SlimeTamingFix", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public ManualLogSource PluginLogger;

		public static Plugin Instance { get; private set; }

		private void Awake()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			Instance = this;
			PluginLogger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("com.elitemastereric.slimetamingfix");
			val.PatchAll();
			PluginLogger.LogInfo((object)"Plugin SlimeTamingFix (com.elitemastereric.slimetamingfix) is loaded!");
		}
	}
}
namespace SlimeTamingFix.Patch
{
	[HarmonyPatch(typeof(BlobAI))]
	[HarmonyPatch("OnCollideWithPlayer")]
	internal class BlobAIOnCollideWithPlayerPatch
	{
		public static bool Prefix(BlobAI __instance)
		{
			float value = Traverse.Create((object)__instance).Field("tamedTimer").GetValue<float>();
			float value2 = Traverse.Create((object)__instance).Field("angeredTimer").GetValue<float>();
			if (value > 0f && value2 <= 0f)
			{
				return false;
			}
			return true;
		}
	}
}