Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Frostys Fastest Company v1.2.6
Frostys Fastest Company.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Dissonance; using FrostysCompany.Patch; using Frostys_Fastest_Company.Patches; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Frostys Fastest Company")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("20803")] [assembly: AssemblyProduct("Frostys Fastest Company")] [assembly: AssemblyCopyright("Copyright © 20803 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d1e76cdc-f135-4a9b-b58b-6fb397bbd595")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Frostys_Fastest_Company.Patches { [HarmonyPatch(typeof(PlayerControllerB), "Start")] internal class ControllerBStartPatch { public Harmony entity = new Harmony("fv.entity"); public Harmony prop = new Harmony("fv.prop"); public Harmony test = new Harmony("fv.test"); [HarmonyPrefix] private static void StartPatch(PlayerControllerB __instance) { FloorPatch.RemoveLodFromGameObject("CatwalkStairs"); HDAdditionalCameraData[] array = Resources.FindObjectsOfTypeAll<HDAdditionalCameraData>(); HDAdditionalCameraData[] array2 = array; foreach (HDAdditionalCameraData val in array2) { if (!((Object)((Component)val).gameObject).name.Equals("MapCamera")) { val.customRenderingSettings = true; FloorPatch.TCP(val); FloorPatch.setLOD(val); FloorPatch.setShadowQuality(GraphicsPatch.assetBundle, val); FloorPatch.ToggleFogWithQuality(val); string name = ((Object)((Component)val).gameObject).name; if (!name.Equals("SecurityCamera") && !name.Equals("ShipCamera")) { FloorPatch.SetAA(val); } } } array = null; FloorPatch.compressTextures(); Type typeFromHandle = typeof(Physics); FieldInfo field = typeFromHandle.GetField("defaultSolverIterations", BindingFlags.Static | BindingFlags.NonPublic); if (field != null) { field.SetValue(null, 3); } } public void entityFix() { entity.PatchAll(typeof(entityPatch)); } public void propFix() { prop.PatchAll(typeof(propPatch)); } } [HarmonyPatch(typeof(CentipedeAI), "DoAIInterval")] internal class entityPatch { private static Dictionary<int, ulong> instanceMap = new Dictionary<int, ulong>(); [HarmonyPrefix] private void StartPatch(CentipedeAI __instance) { if (((EnemyAI)__instance).TargetClosestPlayer(1.5f, false, 70f)) { return; } int instanceID = ((Object)__instance).GetInstanceID(); ulong num = (ulong)Time.frameCount; if (!instanceMap.ContainsKey(instanceID)) { instanceMap.Add(instanceID, num); return; } ulong num2 = instanceMap[instanceID]; if (num - num2 <= 25) { ((EnemyAI)__instance).KillEnemy(true); instanceMap.Remove(instanceID); } else { instanceMap[instanceID] = num; } } } internal class FloorPatch { public static void compressTextures() { QualitySettings.globalTextureMipmapLimit = 0; } public static void SetAA(HDAdditionalCameraData cameraData) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) cameraData.antialiasing = (AntialiasingMode)0; } public static void ToggleFogWithQuality(HDAdditionalCameraData cameraData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0046: Unknown result type (might be due to invalid IL or missing references) BitArray128 mask = cameraData.renderingPathCustomFrameSettingsOverrideMask.mask; ((BitArray128)(ref mask))[28u] = true; cameraData.renderingPathCustomFrameSettingsOverrideMask.mask = mask; FrameSettings renderingPathCustomFrameSettings = cameraData.renderingPathCustomFrameSettings; ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)28, GraphicsPatch.FogToggled); cameraData.renderingPathCustomFrameSettings = renderingPathCustomFrameSettings; Volume[] array = Resources.FindObjectsOfTypeAll<Volume>(); if (array.Length == 0) { return; } Fog val = null; Volume[] array2 = array; foreach (Volume val2 in array2) { if (val2.sharedProfile.TryGet<Fog>(ref val)) { VolumeComponentWithQuality val3 = (VolumeComponentWithQuality)(object)val; ((VolumeParameter<int>)(object)val3.quality).Override(3); if (GraphicsPatch.FogToggled) { val.volumetricFogBudget = 0.333f; val.resolutionDepthRatio = 0.5f; } else { val.volumetricFogBudget = 0.01f; val.resolutionDepthRatio = 0.1f; } } } } public static void TCP(HDAdditionalCameraData cameraData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) BitArray128 mask = cameraData.renderingPathCustomFrameSettingsOverrideMask.mask; ((BitArray128)(ref mask))[6u] = true; cameraData.renderingPathCustomFrameSettingsOverrideMask.mask = mask; FrameSettings renderingPathCustomFrameSettings = cameraData.renderingPathCustomFrameSettings; ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)6, false); cameraData.renderingPathCustomFrameSettings = renderingPathCustomFrameSettings; } public static void setLOD(HDAdditionalCameraData cameraData) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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_00bf: Unknown result type (might be due to invalid IL or missing references) BitArray128 mask = cameraData.renderingPathCustomFrameSettingsOverrideMask.mask; ((BitArray128)(ref mask))[60u] = true; ((BitArray128)(ref mask))[61u] = true; cameraData.renderingPathCustomFrameSettingsOverrideMask.mask = mask; FrameSettings renderingPathCustomFrameSettings = cameraData.renderingPathCustomFrameSettings; ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)60, true); ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)54, false); ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)52, true); ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)61, false); ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)23, false); ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)98, false); ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)81, false); cameraData.renderingPathCustomFrameSettings = renderingPathCustomFrameSettings; cameraData.renderingPathCustomFrameSettings.lodBiasQualityLevel = 1; cameraData.renderingPathCustomFrameSettings.materialQuality = (MaterialQuality)1; cameraData.renderingPathCustomFrameSettings.msaaMode = (MSAAMode)1; cameraData.renderingPathCustomFrameSettings.lodBiasMode = (LODBiasMode)0; cameraData.renderingPathCustomFrameSettings.lodBias = 0.125f; ((Component)cameraData).GetComponent<Camera>().farClipPlane = 75f; } public static void setShadowQuality(AssetBundle assetBundle, HDAdditionalCameraData cameraData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_001a: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0079: Expected O, but got Unknown if (!((Object)assetBundle == (Object)null)) { BitArray128 mask = cameraData.renderingPathCustomFrameSettingsOverrideMask.mask; ((BitArray128)(ref mask))[20u] = true; cameraData.renderingPathCustomFrameSettingsOverrideMask.mask = mask; FrameSettings renderingPathCustomFrameSettings = cameraData.renderingPathCustomFrameSettings; ((FrameSettings)(ref renderingPathCustomFrameSettings)).SetEnabled((FrameSettingsField)20, true); cameraData.renderingPathCustomFrameSettings = renderingPathCustomFrameSettings; GraphicsPatch.myAsset = assetBundle.LoadAsset<HDRenderPipelineAsset>("Assets/assetBundles/VeryLowShadowsAsset.asset"); QualitySettings.renderPipeline = (RenderPipelineAsset)GraphicsPatch.myAsset; } } public static void RemoveLodFromGameObject(string name) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown Object[] array = Resources.FindObjectsOfTypeAll(typeof(LODGroup)); Object[] array2 = array; foreach (Object val in array2) { LODGroup val2 = (LODGroup)((val is LODGroup) ? val : null); if (((Object)((Component)val2).gameObject).name == name) { val2.enabled = false; } } } } [HarmonyPatch(typeof(PlayerControllerB), "Awake")] internal class PlayerControllerAwakePatch { [HarmonyPrefix] public static void StartPrefix(PlayerControllerB __instance) { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I4 if (QualitySettings.asyncUploadPersistentBuffer) { QualitySettings.asyncUploadPersistentBuffer = false; } if (QualitySettings.antiAliasing != 0) { QualitySettings.antiAliasing = 0; } QualitySettings.asyncUploadTimeSlice = 1; QualitySettings.shadowCascades = 1; QualitySettings.anisotropicFiltering = (AnisotropicFiltering)0; QualitySettings.pixelLightCount = 0; if (QualitySettings.realtimeReflectionProbes) { QualitySettings.realtimeReflectionProbes = false; } if (!QualitySettings.useLegacyDetailDistribution) { QualitySettings.useLegacyDetailDistribution = true; } QualitySettings.SetLODSettings(3f, 0, true); QualitySettings.shadowResolution = (ShadowResolution)256; if (QualitySettings.asyncUploadPersistentBuffer) { Debug.Log((object)"reducing memory footprint..."); QualitySettings.asyncUploadPersistentBuffer = false; } if (QualitySettings.terrainDetailDistance != 25f) { QualitySettings.terrainDetailDistance = 25f; } if (QualitySettings.resolutionScalingFixedDPIFactor != 0.1f) { QualitySettings.resolutionScalingFixedDPIFactor = 0.1f; } if ((int)QualitySettings.shadowResolution > 0) { QualitySettings.SetQualityLevel(0); QualitySettings.shadows = (ShadowQuality)1; QualitySettings.shadowResolution = (ShadowResolution)0; } if (QualitySettings.streamingMipmapsMemoryBudget != 128f) { Debug.Log((object)("reducing streaming memoryBudget... [" + QualitySettings.streamingMipmapsMemoryBudget + "]")); QualitySettings.streamingMipmapsMemoryBudget = 128f; Debug.Log((object)("reduced memoryBudget - " + QualitySettings.streamingMipmapsMemoryBudget)); } if (QualitySettings.lodBias != 0.1f) { QualitySettings.lodBias = 0.1f; QualitySettings.anisotropicFiltering = (AnisotropicFiltering)0; } } } [HarmonyPatch(typeof(StartOfRound), "EndOfGame")] internal class propPatch { [HarmonyPrefix] private void Unload() { try { RoundManager.Instance.UnloadSceneObjectsEarly(); } catch (Exception) { } } } } namespace FrostysCompany { [BepInPlugin("FrostysFastestCompany", "FrostysFastestCompany-frostfv", "1.2.6")] public class FrostysCompanyInitialization : BaseUnityPlugin { public const string modGuid = "FrostysFastestCompany"; public const string Name = "FrostysFastestCompany-frostfv"; public const string Ver = "1.2.6"; public static ConfigEntry<bool> ToggleFog; internal ManualLogSource mls; public readonly Harmony harmony = new Harmony("FrostysFastestCompany"); [DllImport("user32.dll", CharSet = CharSet.Unicode)] public static extern int MessageBox(IntPtr hWnd, string text, string caption, uint type); public void Awake() { mls = Logger.CreateLogSource("FrostysFastestCompany"); mls.LogInfo((object)"Frosty's Fastest Company (v1.2.6) was loaded successfully !"); LoadConfig(); GraphicsPatch.assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assetBundles/Frostys")); harmony.PatchAll(typeof(ControllerBStartPatch)); harmony.PatchAll(typeof(PlayerControllerAwakePatch)); Debug.unityLogger.filterLogType = (LogType)0; Logs.SetLogLevel((LogCategory)1, (LogLevel)4); } private void LoadConfig() { ToggleFog = ((BaseUnityPlugin)this).Config.Bind<bool>("GRAPHICS", "ToggleFog", true, "Toggle Fog - Enable or disable to reduce stuttering in-game."); GraphicsPatch.FogToggled = ToggleFog.Value; } } } namespace FrostysCompany.Patch { internal class GraphicsPatch { public static HDRenderPipelineAsset myAsset; public static AssetBundle assetBundle; public static bool FogToggled; } } namespace FrostysCompany.Tools { public class Reflection { public static object GetInstanceField(Type type, object instance, string fieldName) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = type.GetField(fieldName, bindingAttr); return field.GetValue(instance); } public static object CallMethod(object instance, string methodName, params object[] args) { MethodInfo method = instance.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { return method.Invoke(instance, args); } return null; } } } 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 Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } }