using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NicheTweaks.Patches;
using NicheTweaks.Utils;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering.HighDefinition;
using UnityEngine.UI;
[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("NicheTweaks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.8.0")]
[assembly: AssemblyInformationalVersion("0.0.8")]
[assembly: AssemblyProduct("NicheTweaks")]
[assembly: AssemblyTitle("NicheTweaks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.8.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;
}
}
}
[HarmonyPatch(typeof(GrabbableObject), "InspectItem")]
internal static class DisableInspectItemPatch
{
private static bool Prefix()
{
if (!ConfigManager.DisableInspectItem.Value)
{
return true;
}
return false;
}
}
[HarmonyPatch(typeof(QuickMenuManager), "AddUserToPlayerList")]
public static class QuickMenuManager_AddUserToPlayerList_Patch
{
[CompilerGenerated]
private sealed class <ApplyGlobalVolumeNextFrame>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public QuickMenuManager qm;
private float <globalValue>5__1;
private PlayerListSlot[] <>s__2;
private int <>s__3;
private PlayerListSlot <slot>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApplyGlobalVolumeNextFrame>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>s__2 = null;
<slot>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<globalValue>5__1 = GlobalVoiceOverlay.GlobalSlider.value;
<>s__2 = qm.playerListSlots;
for (<>s__3 = 0; <>s__3 < <>s__2.Length; <>s__3++)
{
<slot>5__4 = <>s__2[<>s__3];
if (!((Object)(object)<slot>5__4?.volumeSlider == (Object)null))
{
<slot>5__4.volumeSlider.value = <globalValue>5__1;
<slot>5__4 = null;
}
}
<>s__2 = null;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPostfix]
public static void Postfix(QuickMenuManager __instance)
{
if (ConfigManager.EnableGlobalVolumeMeter.Value && !((Object)(object)GlobalVoiceOverlay.GlobalSlider == (Object)null))
{
((MonoBehaviour)__instance).StartCoroutine(ApplyGlobalVolumeNextFrame(__instance));
}
}
[IteratorStateMachine(typeof(<ApplyGlobalVolumeNextFrame>d__1))]
private static IEnumerator ApplyGlobalVolumeNextFrame(QuickMenuManager qm)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApplyGlobalVolumeNextFrame>d__1(0)
{
qm = qm
};
}
}
namespace NicheTweaks
{
[BepInPlugin("MrHat.NicheTweaks", "NicheTweaks", "0.0.8")]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "MrHat.NicheTweaks";
private const string modName = "NicheTweaks";
private const string modVersion = "0.0.8";
private static Harmony _harmony;
internal static ManualLogSource mls;
internal static Plugin Instance;
internal const float DecalDistance = 1001f;
private void Awake()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
Instance = this;
mls = Logger.CreateLogSource("MrHat.NicheTweaks");
_harmony = new Harmony("MrHat.NicheTweaks");
ConfigManager.CfgInit(((BaseUnityPlugin)this).Config);
if (ConfigManager.EnableDecalDrawDistanceOverride.Value)
{
try
{
_harmony.PatchAll(typeof(DecalProjectorPatch));
mls.LogWarning((object)"[MrHat.NicheTweaks] Decal draw distance set to limitless. Disable in config if this isn't intended!");
}
catch (Exception arg)
{
mls.LogError((object)string.Format("[{0}] Failed to apply decal patch. {1}", "MrHat.NicheTweaks", arg));
}
}
try
{
DawnLibPatch.TryApply(_harmony);
mls.LogDebug((object)"[MrHat.NicheTweaks] DawnLib achievement annihilator 9000 initiated.");
}
catch
{
}
_harmony.PatchAll();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "NicheTweaks";
public const string PLUGIN_NAME = "NicheTweaks";
public const string PLUGIN_VERSION = "0.0.8";
}
}
namespace NicheTweaks.Utils
{
internal static class ConfigManager
{
internal static ConfigEntry<bool> EnableFootprintPoolOverride;
internal static ConfigEntry<int> FootprintPoolSize;
internal static ConfigEntry<bool> DisableClock;
internal static ConfigEntry<bool> DisableChat;
internal static ConfigEntry<bool> DisableCompass;
internal static ConfigEntry<bool> DisableControlTips;
internal static ConfigEntry<bool> DisableAchievementPopups;
internal static ConfigEntry<bool> DisableFilmGrain;
internal static ConfigEntry<bool> DisableHelmetLightShadow;
internal static ConfigEntry<bool> DisableFlashLightShadow;
internal static ConfigEntry<bool> KeepDroppedFlashlightShadows;
internal static ConfigEntry<bool> DisableInspectItem;
internal static ConfigEntry<bool> EnableGlobalVolumeMeter;
internal static ConfigEntry<bool> EnableDropshipPickupDelay;
internal static ConfigEntry<float> DropshipPickupDelayTime;
internal static ConfigEntry<bool> EnableLandmineFix;
internal static ConfigEntry<bool> EnableDecalDrawDistanceOverride { get; private set; }
internal static void CfgInit(ConfigFile config)
{
EnableDecalDrawDistanceOverride = config.Bind<bool>("Decals", "Enable decal draw distance override", false, "If true, breaks the decal draw distance and causes decals to always be rendered. Will impact performance, not recommended without LethalSponge.");
EnableFootprintPoolOverride = config.Bind<bool>("Decals", "Enable footprint pool override", false, "If true, overrides the number of footprint decals allowed to exist.");
FootprintPoolSize = config.Bind<int>("Decals", "Footprint pool size", 250, "Number of footprints that are allowed to be present before the oldest footprints start culling visually. Increasing this will impact performance.");
DisableClock = config.Bind<bool>("UI", "Hide clock from HUD", false, "If enabled, hides the clock from the HUD.");
DisableChat = config.Bind<bool>("UI", "Hide chat from HUD", false, "If true, hides the chat from the HUD. Warning: It remains hidden even if you type in it.");
DisableCompass = config.Bind<bool>("UI", "Hide compass from HUD", false, "If true, hides the compass from the HUD.");
DisableControlTips = config.Bind<bool>("UI", "Hide control tips from HUD", false, "If true, hides the control tip labels (top right of HUD).");
DisableAchievementPopups = config.Bind<bool>("UI", "Hide and mute DawnLib achievement popups", false, "If true, hides DawnLib's achievement popup and sound.");
DisableFilmGrain = config.Bind<bool>("Visuals", "Disable film grain effect globally", false, "If true, attempts to globally disable film grain where it may be present.");
DisableHelmetLightShadow = config.Bind<bool>("Visuals", "Disable helmet light shadow", false, "If true, disables helmet light shadow casting for the local player only. Very useful for modded flashlights with very high intensities.");
DisableFlashLightShadow = config.Bind<bool>("Visuals", "Disable flashlight shadow", false, "If true, disables flashlight shadow casting for the local player only. Affects flashlights in your hand. Very useful for modded flashlights with very high intensities.");
KeepDroppedFlashlightShadows = config.Bind<bool>("Visuals", "Keep dropped flashlight shadows", true, "Keeps shadows enabled for flashlights dropped on the ground. Requires 'Disable flashlight shadow' to be set to true in order to disable this.");
DisableInspectItem = config.Bind<bool>("Visuals", "Disable item inspection", false, "If true, disables the ability to inspect items.");
EnableGlobalVolumeMeter = config.Bind<bool>("QoL", "Enable global voice volume slider", false, "If true, enables the global voice volume slider in the player list.");
EnableDropshipPickupDelay = config.Bind<bool>("QoL", "Enable dropship item pickup delay", false, "If true, adds a short delay to items dropped by the dropship before they can be grabbed.");
DropshipPickupDelayTime = config.Bind<float>("QoL", "Dropship item pickup delay time", 1f, "Time in seconds before dropped items can be picked up.");
EnableLandmineFix = config.Bind<bool>("QoL", "Remove landmine invisible bump", false, "Removes the invisible bump left by landmines after exploding.");
}
}
internal static class RemoveShadowUtils
{
public static void DisableFlashlightShadows(Light light)
{
if (!((Object)(object)light == (Object)null))
{
light.shadows = (LightShadows)0;
HDAdditionalLightData component = ((Component)light).GetComponent<HDAdditionalLightData>();
if ((Object)(object)component != (Object)null)
{
component.shadowDimmer = 0f;
component.volumetricShadowDimmer = 0f;
}
}
}
public static void EnableFlashlightShadows(Light light)
{
if (!((Object)(object)light == (Object)null))
{
light.shadows = (LightShadows)2;
HDAdditionalLightData component = ((Component)light).GetComponent<HDAdditionalLightData>();
if ((Object)(object)component != (Object)null)
{
component.shadowDimmer = 1f;
component.volumetricShadowDimmer = 1f;
}
}
}
}
}
namespace NicheTweaks.Patches
{
internal static class DawnLibPatch
{
internal static void TryApply(Harmony harmony)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
try
{
Type type = Type.GetType("Dusk.AchievementUIGetCanvas, com.github.teamxiaolan.dawnlib.dusk");
if (!(type == null))
{
MethodInfo method = type.GetMethod("QueuePopup", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (!(method == null))
{
MethodInfo method2 = typeof(DawnLibPatch).GetMethod("AfterQueuePopup", BindingFlags.Static | BindingFlags.NonPublic);
harmony.Patch((MethodBase)method, (HarmonyMethod)null, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
}
}
catch (Exception ex)
{
Plugin.mls.LogWarning((object)("Failed to patch DawnLib: " + ex.Message));
}
}
private static void AfterQueuePopup()
{
if (!ConfigManager.DisableAchievementPopups.Value)
{
return;
}
Type type = Type.GetType("Dusk.AchievementUIGetCanvas, com.github.teamxiaolan.dawnlib.dusk");
Object val = Object.FindObjectOfType(type);
if (val == (Object)null)
{
return;
}
Transform[] componentsInChildren = ((Component)((val is Component) ? val : null)).GetComponentsInChildren<Transform>(true);
Transform[] array = componentsInChildren;
foreach (Transform val2 in array)
{
if (((Object)val2).name.Contains("Achievement") || ((Object)val2).name.Contains("Popup"))
{
((Component)val2).gameObject.SetActive(false);
}
}
AudioSource[] componentsInChildren2 = ((Component)((val is Component) ? val : null)).GetComponentsInChildren<AudioSource>(true);
foreach (AudioSource val3 in componentsInChildren2)
{
val3.mute = true;
}
}
}
[HarmonyPatch(typeof(DecalProjector), "Awake")]
internal static class DecalProjectorPatch
{
[HarmonyPostfix]
private static void Postfix(DecalProjector __instance)
{
if (ConfigManager.EnableDecalDrawDistanceOverride.Value)
{
typeof(DecalProjector).GetField("m_DrawDistance", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(__instance, 1001f);
}
}
}
[HarmonyPatch(typeof(FilmGrain))]
internal static class FilmGrainPatch
{
[HarmonyPrefix]
[HarmonyPatch("IsActive")]
private static bool DisableFilmGrain(ref bool __result)
{
if (ConfigManager.DisableFilmGrain.Value)
{
__result = false;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(FlashlightItem))]
internal static class FlashlightItemPatch
{
[HarmonyPostfix]
[HarmonyPatch("SwitchFlashlight")]
private static void HandleFlashlightShadow(FlashlightItem __instance)
{
if (!((Object)(object)__instance.flashlightBulb == (Object)null) && ConfigManager.DisableFlashLightShadow.Value)
{
bool flag = (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)null;
bool isBeingUsed = ((GrabbableObject)__instance).isBeingUsed;
if (flag && isBeingUsed)
{
RemoveShadowUtils.DisableFlashlightShadows(__instance.flashlightBulb);
}
else if (!flag && isBeingUsed && ConfigManager.KeepDroppedFlashlightShadows.Value)
{
RemoveShadowUtils.EnableFlashlightShadows(__instance.flashlightBulb);
}
}
}
[HarmonyPostfix]
[HarmonyPatch("DiscardItem")]
private static void OnDropFlashlight(FlashlightItem __instance)
{
if (!((Object)(object)__instance.flashlightBulb == (Object)null) && ConfigManager.DisableFlashLightShadow.Value && ((GrabbableObject)__instance).isBeingUsed && ConfigManager.KeepDroppedFlashlightShadows.Value)
{
RemoveShadowUtils.EnableFlashlightShadows(__instance.flashlightBulb);
}
}
}
[HarmonyPatch(typeof(GrabbableObject))]
public static class GrabbableObjectPatch
{
[CompilerGenerated]
private sealed class <DisablePickupTemporarily>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GrabbableObject obj;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DisablePickupTemporarily>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
obj.grabbable = false;
goto IL_0050;
case 1:
<>1__state = -1;
goto IL_0050;
case 2:
{
<>1__state = -1;
obj.grabbable = true;
return false;
}
IL_0050:
if (!obj.hasHitGround)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = (object)new WaitForSeconds(ConfigManager.DropshipPickupDelayTime.Value);
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPostfix]
[HarmonyPatch("FallToGround")]
public static void OnSpawn(GrabbableObject __instance)
{
if (ConfigManager.EnableDropshipPickupDelay.Value)
{
((MonoBehaviour)__instance).StartCoroutine(DisablePickupTemporarily(__instance));
}
}
[IteratorStateMachine(typeof(<DisablePickupTemporarily>d__1))]
private static IEnumerator DisablePickupTemporarily(GrabbableObject obj)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisablePickupTemporarily>d__1(0)
{
obj = obj
};
}
}
[HarmonyPatch(typeof(HUDManager))]
internal static class HUDManagerPatch
{
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void OnHUDStart()
{
DisableClock();
DisableChat();
DisableCompass();
DisableControlTips();
}
private static void DisableClock()
{
if (!ConfigManager.DisableClock.Value)
{
return;
}
GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/ProfitQuota");
if ((Object)(object)val == (Object)null)
{
return;
}
Transform val2 = val.transform.Find("Container");
if ((Object)(object)val2 != (Object)null)
{
for (int i = 0; i < val2.childCount; i++)
{
Transform child = val2.GetChild(i);
if ((Object)(object)child.Find("TimeNumber") != (Object)null && (Object)(object)child.Find("Image") != (Object)null)
{
((Component)child).gameObject.SetActive(false);
break;
}
}
}
Transform val3 = val.transform.Find("ShipLeavingIcon");
if (val3 != null)
{
((Component)val3).gameObject.SetActive(false);
}
}
private static void DisableChat()
{
if (!ConfigManager.DisableChat.Value)
{
return;
}
GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/BottomLeftCorner");
if (!((Object)(object)val == (Object)null))
{
for (int i = 0; i < val.transform.childCount; i++)
{
Transform child = val.transform.GetChild(i);
((Component)child).gameObject.SetActive(false);
}
}
}
private static void DisableCompass()
{
if (!ConfigManager.DisableCompass.Value)
{
return;
}
IEnumerable<Transform> enumerable = from t in Object.FindObjectsOfType<Transform>(true)
where ((Object)t).name == "CompassImage"
select t;
foreach (Transform item in enumerable)
{
((Component)item).gameObject.SetActive(false);
}
}
private static void DisableControlTips()
{
if (!ConfigManager.DisableControlTips.Value)
{
return;
}
GameObject val = GameObject.Find("Systems/UI/Canvas/IngamePlayerHUD/TopRightCorner");
if ((Object)(object)val == (Object)null)
{
return;
}
for (int i = 0; i < val.transform.childCount; i++)
{
Transform child = val.transform.GetChild(i);
if (!((Object)(object)child == (Object)null))
{
((Component)child).gameObject.SetActive(false);
}
}
}
}
[HarmonyPatch(typeof(Landmine), "ExplodeMineClientRpc")]
public static class LandminePatch
{
[HarmonyPostfix]
public static void Postfix(Landmine __instance)
{
if (!ConfigManager.EnableLandmineFix.Value)
{
return;
}
try
{
Transform val = ((Component)__instance).transform.Find("Landmine/GameObject") ?? ((Component)__instance).transform.Find("GameObject");
if (val != null)
{
((Component)val).gameObject.SetActive(false);
}
}
catch
{
}
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyAfter(new string[] { "GeneralImprovements" })]
internal static class PlayerControllerBPatch
{
[HarmonyPostfix]
[HarmonyPatch("ChangeHelmetLight")]
private static void Postfix_ChangeHelmetLight(PlayerControllerB __instance)
{
DisableHelmetLightShadow(__instance);
}
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Postfix_Start(PlayerControllerB __instance)
{
DisableHelmetLightShadow(__instance);
}
private static void DisableHelmetLightShadow(PlayerControllerB player)
{
if (!((Object)(object)player?.helmetLight == (Object)null) && ((NetworkBehaviour)player).IsOwner && ConfigManager.DisableHelmetLightShadow.Value)
{
RemoveShadowUtils.DisableFlashlightShadows(player.helmetLight);
}
}
}
[HarmonyPatch(typeof(QuickMenuManager), "Start")]
public class QuickMenuManagerPatch
{
[HarmonyPostfix]
public static void Postfix(QuickMenuManager __instance)
{
if (ConfigManager.EnableGlobalVolumeMeter.Value)
{
GlobalVoiceOverlay.AddGlobalSlider(__instance);
}
}
}
public class GlobalVoiceOverlay : MonoBehaviour
{
public static Slider GlobalSlider;
public static void AddGlobalSlider(QuickMenuManager qm)
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)GlobalSlider != (Object)null)
{
return;
}
PlayerListSlot[] playerListSlots = qm.playerListSlots;
Slider val2 = ((playerListSlots == null) ? null : playerListSlots[0]?.volumeSlider);
if ((Object)(object)val2 == (Object)null)
{
return;
}
GameObject val3 = GameObject.Find("Systems/UI/Canvas/QuickMenu/PlayerList/Image");
if ((Object)(object)val3 == (Object)null)
{
return;
}
GameObject val4 = new GameObject("GlobalVoiceHolder", new Type[1] { typeof(RectTransform) });
val4.transform.SetParent(val3.transform, false);
RectTransform component = val4.GetComponent<RectTransform>();
component.anchorMin = new Vector2(1f, 1f);
component.anchorMax = new Vector2(1f, 1f);
component.pivot = new Vector2(1f, 1f);
component.anchoredPosition = new Vector2(2f, -13f);
component.sizeDelta = new Vector2(125f, 20f);
GlobalSlider = Object.Instantiate<Slider>(val2, val4.transform);
((Object)GlobalSlider).name = "GlobalVoiceVolume";
RectTransform component2 = ((Component)GlobalSlider).GetComponent<RectTransform>();
Vector2 val5 = default(Vector2);
((Vector2)(ref val5))..ctor(0.5f, 0.5f);
component2.pivot = val5;
Vector2 anchorMin = (component2.anchorMax = val5);
component2.anchorMin = anchorMin;
component2.anchoredPosition = Vector2.zero;
component2.sizeDelta = ((Component)val2).GetComponent<RectTransform>().sizeDelta;
Image[] componentsInChildren = ((Component)GlobalSlider).GetComponentsInChildren<Image>();
foreach (Image val7 in componentsInChildren)
{
((Graphic)val7).color = new Color(((Graphic)val7).color.r, ((Graphic)val7).color.g, ((Graphic)val7).color.b, 1f);
}
((Selectable)GlobalSlider).interactable = true;
GlobalSlider.value = val2.value;
((UnityEvent<float>)(object)GlobalSlider.onValueChanged).AddListener((UnityAction<float>)delegate(float val)
{
PlayerListSlot[] playerListSlots2 = qm.playerListSlots;
foreach (PlayerListSlot val8 in playerListSlots2)
{
if ((Object)(object)val8?.volumeSlider != (Object)null)
{
val8.volumeSlider.value = val;
}
}
});
}
}
[HarmonyPatch(typeof(StartOfRound))]
internal static class StartOfRoundPatch
{
private static readonly HashSet<StartOfRound> InitializedRounds = new HashSet<StartOfRound>();
[HarmonyPrefix]
[HarmonyPatch("InstantiateFootprintsPooledObjects")]
private static bool FootprintPool(StartOfRound __instance)
{
if (!ConfigManager.EnableFootprintPoolOverride.Value)
{
return true;
}
if (InitializedRounds.Contains(__instance))
{
return false;
}
InitializedRounds.Add(__instance);
int num = Mathf.Max(1, ConfigManager.FootprintPoolSize.Value);
Transform bloodObjectsContainer = __instance.bloodObjectsContainer;
if ((Object)(object)bloodObjectsContainer != (Object)null)
{
for (int num2 = bloodObjectsContainer.childCount - 1; num2 >= 0; num2--)
{
Transform child = bloodObjectsContainer.GetChild(num2);
if ((Object)(object)child != (Object)null && ((Object)child).name.Contains("FootprintDecal"))
{
Object.DestroyImmediate((Object)(object)((Component)child).gameObject);
}
}
}
__instance.snowFootprintsPooledObjects?.Clear();
for (int i = 0; i < num; i++)
{
GameObject val = Object.Instantiate<GameObject>(__instance.footprintDecal, bloodObjectsContainer);
__instance.snowFootprintsPooledObjects.Add(val.GetComponent<DecalProjector>());
}
return false;
}
}
}