using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Video;
using com.github.zehsteam.DontTouchMyClogs.Dependencies;
using com.github.zehsteam.DontTouchMyClogs.MonoBehaviours;
using com.github.zehsteam.DontTouchMyClogs.NetcodePatcher;
[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("com.github.zehsteam.DontTouchMyClogs")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds a customizable Wooden Clogs scrap item with some functionality.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+b31f231c7f188c33ea8fcb1a00517f1dcf6589ef")]
[assembly: AssemblyProduct("DontTouchMyClogs")]
[assembly: AssemblyTitle("com.github.zehsteam.DontTouchMyClogs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
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 com.github.zehsteam.DontTouchMyClogs
{
internal static class ConfigHelper
{
public static void SetModIcon(Sprite sprite)
{
if (LethalConfigProxy.Enabled)
{
LethalConfigProxy.SetModIcon(sprite);
}
}
public static void SetModDescription(string description)
{
if (LethalConfigProxy.Enabled)
{
LethalConfigProxy.SetModDescription(description);
}
}
public static void SkipAutoGen()
{
if (LethalConfigProxy.Enabled)
{
LethalConfigProxy.SkipAutoGen();
}
}
public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null)
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
if (configFile == null)
{
configFile = ((BaseUnityPlugin)Plugin.Instance).Config;
}
ConfigEntry<T> configEntry = ((acceptableValues == null) ? configFile.Bind<T>(section, key, defaultValue, description) : configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>())));
if (settingChanged != null)
{
configEntry.SettingChanged += delegate
{
settingChanged?.Invoke(configEntry.Value);
};
}
if (LethalConfigProxy.Enabled)
{
if (acceptableValues == null)
{
LethalConfigProxy.AddConfig<T>(configEntry, requiresRestart);
}
else
{
LethalConfigProxy.AddConfigSlider<T>(configEntry, requiresRestart);
}
}
return configEntry;
}
public static void AddButton(string section, string name, string description, string buttonText, Action callback)
{
if (LethalConfigProxy.Enabled)
{
LethalConfigProxy.AddButton(section, name, description, buttonText, callback);
}
}
}
internal class ConfigManager
{
public ConfigEntry<bool> ExtendedLogging { get; private set; }
public ConfigEntry<int> WoodenClogs_SpawnWeight { get; private set; }
public ConfigEntry<bool> WoodenClogs_TwoHanded { get; private set; }
public ConfigEntry<int> WoodenClogs_CarryWeight { get; private set; }
public ConfigEntry<int> WoodenClogs_MinValue { get; private set; }
public ConfigEntry<int> WoodenClogs_MaxValue { get; private set; }
public ConfigEntry<float> WoodenClogs_KaraokeVideoVolume { get; private set; }
public ConfigEntry<bool> WoodenClogs_MusicEnabled { get; private set; }
public ConfigEntry<float> WoodenClogs_MusicVolume { get; private set; }
public ConfigManager()
{
BindConfigs();
SetupChangedEvents();
ClearUnusedEntries();
}
private void BindConfigs()
{
ConfigHelper.SkipAutoGen();
ExtendedLogging = ConfigHelper.Bind("General Settings", "ExtendedLogging", defaultValue: false, requiresRestart: false, "Enable extended logging.");
WoodenClogs_SpawnWeight = ConfigHelper.Bind("Wooden Clogs Settings", "SpawnWeight", 5, requiresRestart: false, "Wooden Clogs spawn chance weight.");
WoodenClogs_TwoHanded = ConfigHelper.Bind("Wooden Clogs Settings", "TwoHanded", defaultValue: false, requiresRestart: false, "If enabled, the Wooden Clogs will be two-handed.");
WoodenClogs_CarryWeight = ConfigHelper.Bind("Wooden Clogs Settings", "CarryWeight", 6, requiresRestart: false, "Wooden Clogs carry weight in pounds.");
WoodenClogs_MinValue = ConfigHelper.Bind("Wooden Clogs Settings", "MinValue", 80, requiresRestart: false, "Wooden Clogs min scrap value.");
WoodenClogs_MaxValue = ConfigHelper.Bind("Wooden Clogs Settings", "MaxValue", 250, requiresRestart: false, "Wooden Clogs max scrap value.");
WoodenClogs_KaraokeVideoVolume = ConfigHelper.Bind("Wooden Clogs Settings", "KaraokeVideoVolume", 70f, requiresRestart: false, "The volume of the karaoke video.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
WoodenClogs_MusicEnabled = ConfigHelper.Bind("Wooden Clogs Settings", "MusicEnabled", defaultValue: false, requiresRestart: false, "STREAMER WARNING! Music is DMCA. (This does not affect Karaoke)");
WoodenClogs_MusicVolume = ConfigHelper.Bind("Wooden Clogs Settings", "MusicVolume", 80f, requiresRestart: false, "The volume of the music.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f));
}
private void SetupChangedEvents()
{
WoodenClogs_SpawnWeight.SettingChanged += WoodenClogs_SpawnWeight_SettingChanged;
WoodenClogs_TwoHanded.SettingChanged += WoodenClogs_Properties_SettingChanged;
WoodenClogs_CarryWeight.SettingChanged += WoodenClogs_Properties_SettingChanged;
WoodenClogs_MinValue.SettingChanged += WoodenClogs_Properties_SettingChanged;
WoodenClogs_MaxValue.SettingChanged += WoodenClogs_Properties_SettingChanged;
WoodenClogs_KaraokeVideoVolume.SettingChanged += KaraokeVideoPlayer.OnSettingsChanged;
WoodenClogs_MusicEnabled.SettingChanged += WoodenClogs.OnSettingsChanged;
WoodenClogs_MusicVolume.SettingChanged += WoodenClogs.OnSettingsChanged;
}
private void WoodenClogs_SpawnWeight_SettingChanged(object sender, EventArgs e)
{
ScrapHelper.UpdateScrapRarity(Content.WoodenClogs, WoodenClogs_SpawnWeight.Value);
}
private void WoodenClogs_Properties_SettingChanged(object sender, EventArgs e)
{
ScrapHelper.UpdateScrapProperties(Content.WoodenClogs, WoodenClogs_TwoHanded.Value, WoodenClogs_CarryWeight.Value, WoodenClogs_MinValue.Value, WoodenClogs_MaxValue.Value);
}
private void ClearUnusedEntries()
{
ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config;
PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null);
dictionary.Clear();
config.Save();
}
}
internal static class Content
{
public static Item WoodenClogs;
public static GameObject VideoPlayerCanvasPrefab;
public static Sprite ModIcon;
public static void Load()
{
LoadAssetsFromAssetBundle();
}
private static void LoadAssetsFromAssetBundle()
{
try
{
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location);
string text = Path.Combine(directoryName, "donttouchmyclogs_assets");
AssetBundle val = AssetBundle.LoadFromFile(text);
WoodenClogs = val.LoadAsset<Item>("WoodenClogs");
VideoPlayerCanvasPrefab = val.LoadAsset<GameObject>("VideoPlayerCanvas");
ModIcon = val.LoadAsset<Sprite>("ModIcon");
Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!");
}
catch (Exception arg)
{
Plugin.logger.LogError((object)$"Failed to load assets from AssetBundle.\n\n{arg}");
}
}
}
internal static class NetworkUtils
{
public static bool IsServer
{
get
{
if ((Object)(object)NetworkManager.Singleton == (Object)null)
{
return false;
}
return NetworkManager.Singleton.IsServer;
}
}
public static bool IsHost
{
get
{
if ((Object)(object)NetworkManager.Singleton == (Object)null)
{
return false;
}
return NetworkManager.Singleton.IsHost;
}
}
public static ulong GetLocalClientId()
{
return NetworkManager.Singleton.LocalClientId;
}
public static bool IsLocalClientId(ulong clientId)
{
return clientId == GetLocalClientId();
}
}
internal static class PlayerUtils
{
public static PlayerControllerB GetLocalPlayerScript()
{
if ((Object)(object)GameNetworkManager.Instance == (Object)null)
{
return null;
}
return GameNetworkManager.Instance.localPlayerController;
}
public static bool IsLocalPlayer(PlayerControllerB playerScript)
{
return (Object)(object)playerScript == (Object)(object)GetLocalPlayerScript();
}
}
[BepInPlugin("com.github.zehsteam.DontTouchMyClogs", "DontTouchMyClogs", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static Plugin Instance;
internal static ManualLogSource logger;
internal static ConfigManager ConfigManager;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = Logger.CreateLogSource("com.github.zehsteam.DontTouchMyClogs");
logger.LogInfo((object)"DontTouchMyClogs has awoken!");
ConfigManager = new ConfigManager();
Content.Load();
ConfigHelper.SetModIcon(Content.ModIcon);
ConfigHelper.SetModDescription("Adds a customizable Wooden Clogs scrap item with some functionality.");
RegisterScrapItems();
NetcodePatcherAwake();
}
private void NetcodePatcherAwake()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
private void RegisterScrapItems()
{
ScrapHelper.RegisterScrap(Content.WoodenClogs, ConfigManager.WoodenClogs_SpawnWeight.Value, ConfigManager.WoodenClogs_TwoHanded.Value, ConfigManager.WoodenClogs_CarryWeight.Value, ConfigManager.WoodenClogs_MinValue.Value, ConfigManager.WoodenClogs_MaxValue.Value);
}
public void SpawnVideoPlayerCanvas()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)KaraokeVideoPlayer.Instance != (Object)null))
{
Object.Instantiate<GameObject>(Content.VideoPlayerCanvasPrefab, Vector3.zero, Quaternion.identity);
logger.LogInfo((object)"Spawned video player canvas.");
}
}
public void LogInfoExtended(object data)
{
if (ConfigManager.ExtendedLogging.Value)
{
logger.LogInfo(data);
}
}
}
internal static class ScrapHelper
{
public static void RegisterScrap(Item item, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue)
{
item.twoHanded = twoHanded;
item.weight = (float)carryWeight / 105f + 1f;
item.minValue = minValue;
item.maxValue = maxValue;
Utilities.FixMixerGroups(item.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab);
Items.RegisterScrap(item, rarity, (LevelTypes)(-1));
Plugin.logger.LogInfo((object)$"Registered \"{item.itemName}\" scrap item with {rarity} rarity.");
}
public static void UpdateScrapRarity(Item item, int rarity)
{
if ((Object)(object)item == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null)
{
return;
}
SelectableLevel[] levels = StartOfRound.Instance.levels;
foreach (SelectableLevel val in levels)
{
foreach (SpawnableItemWithRarity item2 in val.spawnableScrap)
{
if (!((Object)(object)item2.spawnableItem != (Object)(object)item))
{
item2.rarity = rarity;
Plugin.logger.LogInfo((object)$"Updated \"{val.PlanetName}\" \"{item.itemName}\" scrap item rarity to {rarity}.");
}
}
}
}
public static void UpdateScrapProperties(Item item, bool twoHanded, int carryWeight, int minValue, int maxValue)
{
if (!((Object)(object)item == (Object)null))
{
item.twoHanded = twoHanded;
item.weight = (float)carryWeight / 105f + 1f;
item.minValue = minValue;
item.maxValue = maxValue;
Plugin.logger.LogInfo((object)$"Updated \"{item.itemName}\" scrap item properties. (TwoHanded: {twoHanded}, CarryWeight: {carryWeight}, MinValue: {minValue}, MaxValue: {maxValue})");
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.github.zehsteam.DontTouchMyClogs";
public const string PLUGIN_NAME = "DontTouchMyClogs";
public const string PLUGIN_VERSION = "1.1.0";
}
}
namespace com.github.zehsteam.DontTouchMyClogs.MonoBehaviours
{
public class KaraokeVideoPlayer : MonoBehaviour
{
public static KaraokeVideoPlayer Instance;
public GameObject VideoContainerObject;
public VideoPlayer VideoPlayer;
public static bool IsPlaying
{
get
{
if ((Object)(object)Instance == (Object)null)
{
return false;
}
return Instance.VideoPlayer.isPlaying;
}
}
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
}
private void Start()
{
PauseVideo();
ResetVideo();
UpdateSettings();
}
private void OnEnable()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
VideoPlayer.loopPointReached += new EventHandler(OnVideoPlayerFinished);
}
private void OnDisable()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
VideoPlayer.loopPointReached -= new EventHandler(OnVideoPlayerFinished);
}
private void OnVideoPlayerFinished(VideoPlayer source)
{
VideoContainerObject.SetActive(false);
ResetVideo();
}
public void PlayVideo()
{
VideoContainerObject.SetActive(true);
VideoPlayer.Play();
}
public void PauseVideo()
{
VideoContainerObject.SetActive(false);
VideoPlayer.Pause();
}
public void ToggleVideoPlay()
{
if (IsPlaying)
{
PauseVideo();
}
else
{
PlayVideo();
}
}
public void ResetVideo()
{
VideoPlayer.time = 0.75;
}
private void UpdateSettings()
{
VideoPlayer.SetDirectAudioVolume((ushort)0, Plugin.ConfigManager.WoodenClogs_KaraokeVideoVolume.Value * 0.01f);
}
public static void OnSettingsChanged(object sender, EventArgs e)
{
if (!((Object)(object)Instance == (Object)null))
{
Instance.UpdateSettings();
}
}
}
public enum WoodenClogsMode
{
Karaoke,
Music
}
public class WoodenClogs : GrabbableObject
{
[Space(20f)]
[Header("Wooden Clogs")]
[Space(5f)]
public AudioSource MusicAudio;
private WoodenClogsMode _mode;
public PlayerControllerB PreviousPlayerHeldBy { get; private set; }
public override void OnNetworkSpawn()
{
if (NetworkUtils.IsServer)
{
NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected;
}
}
public override void OnNetworkDespawn()
{
if (NetworkUtils.IsServer)
{
NetworkManager.Singleton.OnClientConnectedCallback -= OnClientConnected;
}
}
private void OnClientConnected(ulong clientId)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkUtils.IsLocalClientId(clientId))
{
ClientRpcParams val = default(ClientRpcParams);
val.Send = new ClientRpcSendParams
{
TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(clientId)
};
ClientRpcParams clientRpcParams = val;
SetDataClientRpc(_mode, MusicAudio.isPlaying, MusicAudio.time, clientRpcParams);
}
}
[ClientRpc]
private void SetDataClientRpc(WoodenClogsMode mode, bool isPlayingMusic, float musicTime, ClientRpcParams clientRpcParams = default(ClientRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1068890343u, clientRpcParams, (RpcDelivery)0);
((FastBufferWriter)(ref val)).WriteValueSafe<WoodenClogsMode>(ref mode, default(ForEnums));
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isPlayingMusic, default(ForPrimitives));
((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref musicTime, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val, 1068890343u, clientRpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
SetModeOnLocalClient(mode);
SetPlayingMusicOnLocalClient(isPlayingMusic, musicTime);
}
}
}
public override void Start()
{
((GrabbableObject)this).Start();
UpdateSettings();
}
public override void GrabItem()
{
Plugin.Instance.SpawnVideoPlayerCanvas();
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
PreviousPlayerHeldBy = base.playerHeldBy;
PreviousPlayerHeldBy.equippedUsableItemQE = true;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
int length = Enum.GetValues(typeof(WoodenClogsMode)).Length;
int num = (int)(_mode + 1);
if (num > length - 1)
{
num = 0;
}
SetMode((WoodenClogsMode)num);
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
if ((Object)(object)PreviousPlayerHeldBy != (Object)null)
{
PreviousPlayerHeldBy.equippedUsableItemQE = false;
}
base.isBeingUsed = false;
}
public override void ItemInteractLeftRight(bool right)
{
((GrabbableObject)this).ItemInteractLeftRight(right);
if (right)
{
ItemInteractRight();
}
else
{
ItemInteractLeft();
}
}
private void ItemInteractLeft()
{
if (_mode == WoodenClogsMode.Karaoke)
{
if ((Object)(object)KaraokeVideoPlayer.Instance != (Object)null)
{
KaraokeVideoPlayer.Instance.ResetVideo();
}
else
{
HUDManager.Instance.DisplayTip("Wooden Clogs", "Karaoke video player is not found!", true, false, "LC_Tip1");
}
}
else if (_mode == WoodenClogsMode.Music)
{
ResetMusicServerRpc();
}
}
private void ItemInteractRight()
{
if (_mode == WoodenClogsMode.Karaoke)
{
if ((Object)(object)KaraokeVideoPlayer.Instance != (Object)null)
{
KaraokeVideoPlayer.Instance.ToggleVideoPlay();
((GrabbableObject)this).SetControlTipsForItem();
}
else
{
HUDManager.Instance.DisplayTip("Wooden Clogs", "Karaoke video player is not found!", true, false, "LC_Tip1");
}
}
else if (_mode == WoodenClogsMode.Music)
{
if (Plugin.ConfigManager.WoodenClogs_MusicEnabled.Value)
{
SetPlayingMusic(!MusicAudio.isPlaying);
}
else
{
HUDManager.Instance.DisplayTip("Wooden Clogs", "STREAMER WARNING! Music is DMCA.\n\nMusic is disabled in the DontTouchMyClogs config settings.", true, false, "LC_Tip1");
}
}
}
public override void SetControlTipsForItem()
{
List<string> list = base.itemProperties.toolTips.ToList();
switch (_mode)
{
case WoodenClogsMode.Karaoke:
list.Add(KaraokeVideoPlayer.IsPlaying ? "Pause Karaoke : [E]" : "Play Karaoke : [E]");
list.Add("Reset Karaoke : [Q]");
break;
case WoodenClogsMode.Music:
list.Add(MusicAudio.isPlaying ? "Pause Music : [E]" : "Play Music : [E]");
list.Add("Reset Music : [Q]");
break;
default:
list.Add(string.Empty);
list.Add(string.Empty);
break;
}
HUDManager.Instance.ChangeControlTipMultiple(list.ToArray(), true, base.itemProperties);
}
private void SetMode(WoodenClogsMode mode)
{
//IL_0005: 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)
SetModeServerRpc(mode);
SetModeOnLocalClient(mode);
}
[ServerRpc(RequireOwnership = false)]
private void SetModeServerRpc(WoodenClogsMode mode, ServerRpcParams serverRpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(292491872u, serverRpcParams, (RpcDelivery)0);
((FastBufferWriter)(ref val)).WriteValueSafe<WoodenClogsMode>(ref mode, default(ForEnums));
((NetworkBehaviour)this).__endSendServerRpc(ref val, 292491872u, serverRpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ulong senderClientId = serverRpcParams.Receive.SenderClientId;
if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId))
{
SetModeClientRpc(mode, senderClientId);
}
}
}
[ClientRpc]
private void SetModeClientRpc(WoodenClogsMode mode, ulong senderClientId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1799223892u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<WoodenClogsMode>(ref mode, default(ForEnums));
BytePacker.WriteValueBitPacked(val2, senderClientId);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1799223892u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsLocalClientId(senderClientId))
{
SetModeOnLocalClient(mode);
}
}
}
private void SetModeOnLocalClient(WoodenClogsMode mode)
{
_mode = mode;
if (!PlayerUtils.IsLocalPlayer(base.playerHeldBy))
{
return;
}
if (_mode == WoodenClogsMode.Karaoke)
{
if (MusicAudio.isPlaying)
{
SetPlayingMusic(value: false);
}
}
else if (_mode == WoodenClogsMode.Music && (Object)(object)KaraokeVideoPlayer.Instance != (Object)null && KaraokeVideoPlayer.IsPlaying)
{
KaraokeVideoPlayer.Instance.PauseVideo();
}
((GrabbableObject)this).SetControlTipsForItem();
}
private void SetPlayingMusic(bool value)
{
//IL_0005: 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)
SetPlayingMusicServerRpc(value);
SetPlayingMusicOnLocalClient(value);
}
[ServerRpc(RequireOwnership = false)]
private void SetPlayingMusicServerRpc(bool value, ServerRpcParams serverRpcParams = default(ServerRpcParams))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1675110197u, serverRpcParams, (RpcDelivery)0);
((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val, 1675110197u, serverRpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ulong senderClientId = serverRpcParams.Receive.SenderClientId;
if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId))
{
SetPlayingMusicClientRpc(value, senderClientId);
}
}
}
[ClientRpc]
private void SetPlayingMusicClientRpc(bool value, ulong senderClientId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1668395365u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
BytePacker.WriteValueBitPacked(val2, senderClientId);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1668395365u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsLocalClientId(senderClientId))
{
SetPlayingMusicOnLocalClient(value);
}
}
}
private void SetPlayingMusicOnLocalClient(bool value, float musicTime = -1f)
{
if (musicTime >= 0f)
{
MusicAudio.time = musicTime;
}
if (value)
{
MusicAudio.Play();
}
else
{
MusicAudio.Pause();
}
if (PlayerUtils.IsLocalPlayer(base.playerHeldBy))
{
((GrabbableObject)this).SetControlTipsForItem();
}
Plugin.Instance.LogInfoExtended($"Set playing music on local client: {value} (MusicTime: {musicTime})");
}
[ServerRpc(RequireOwnership = false)]
private void ResetMusicServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1244117105u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1244117105u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ResetMusicClientRpc();
}
}
}
[ClientRpc]
private void ResetMusicClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3655598124u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3655598124u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
MusicAudio.time = 0f;
}
}
}
private void UpdateSettings()
{
MusicAudio.mute = !Plugin.ConfigManager.WoodenClogs_MusicEnabled.Value;
MusicAudio.volume = Plugin.ConfigManager.WoodenClogs_MusicVolume.Value * 0.01f;
}
public static void OnSettingsChanged(object sender, EventArgs e)
{
WoodenClogs[] array = Object.FindObjectsByType<WoodenClogs>((FindObjectsSortMode)0);
foreach (WoodenClogs woodenClogs in array)
{
woodenClogs.UpdateSettings();
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_WoodenClogs()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1068890343u, new RpcReceiveHandler(__rpc_handler_1068890343));
NetworkManager.__rpc_func_table.Add(292491872u, new RpcReceiveHandler(__rpc_handler_292491872));
NetworkManager.__rpc_func_table.Add(1799223892u, new RpcReceiveHandler(__rpc_handler_1799223892));
NetworkManager.__rpc_func_table.Add(1675110197u, new RpcReceiveHandler(__rpc_handler_1675110197));
NetworkManager.__rpc_func_table.Add(1668395365u, new RpcReceiveHandler(__rpc_handler_1668395365));
NetworkManager.__rpc_func_table.Add(1244117105u, new RpcReceiveHandler(__rpc_handler_1244117105));
NetworkManager.__rpc_func_table.Add(3655598124u, new RpcReceiveHandler(__rpc_handler_3655598124));
}
private static void __rpc_handler_1068890343(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: 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)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
WoodenClogsMode mode = default(WoodenClogsMode);
((FastBufferReader)(ref reader)).ReadValueSafe<WoodenClogsMode>(ref mode, default(ForEnums));
bool isPlayingMusic = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isPlayingMusic, default(ForPrimitives));
float musicTime = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref musicTime, default(ForPrimitives));
ClientRpcParams client = rpcParams.Client;
target.__rpc_exec_stage = (__RpcExecStage)2;
((WoodenClogs)(object)target).SetDataClientRpc(mode, isPlayingMusic, musicTime, client);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_292491872(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_003e: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
WoodenClogsMode mode = default(WoodenClogsMode);
((FastBufferReader)(ref reader)).ReadValueSafe<WoodenClogsMode>(ref mode, default(ForEnums));
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((WoodenClogs)(object)target).SetModeServerRpc(mode, server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1799223892(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
WoodenClogsMode mode = default(WoodenClogsMode);
((FastBufferReader)(ref reader)).ReadValueSafe<WoodenClogsMode>(ref mode, default(ForEnums));
ulong senderClientId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId);
target.__rpc_exec_stage = (__RpcExecStage)2;
((WoodenClogs)(object)target).SetModeClientRpc(mode, senderClientId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1675110197(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_003e: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool value = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((WoodenClogs)(object)target).SetPlayingMusicServerRpc(value, server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1668395365(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool value = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
ulong senderClientId = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId);
target.__rpc_exec_stage = (__RpcExecStage)2;
((WoodenClogs)(object)target).SetPlayingMusicClientRpc(value, senderClientId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1244117105(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((WoodenClogs)(object)target).ResetMusicServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3655598124(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((WoodenClogs)(object)target).ResetMusicClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "WoodenClogs";
}
}
}
namespace com.github.zehsteam.DontTouchMyClogs.Dependencies
{
internal static class LethalConfigProxy
{
public const string PLUGIN_GUID = "ainavt.lc.lethalconfig";
public static bool Enabled => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig");
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void SetModIcon(Sprite sprite)
{
LethalConfigManager.SetModIcon(sprite);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void SetModDescription(string description)
{
LethalConfigManager.SetModDescription(description);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void SkipAutoGen()
{
LethalConfigManager.SkipAutoGen();
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void AddConfig<T>(ConfigEntry<T> configEntry, bool requiresRestart = false)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
if (!(configEntry is ConfigEntry<string> val))
{
if (!(configEntry is ConfigEntry<bool> val2))
{
if (!(configEntry is ConfigEntry<float> val3))
{
if (!(configEntry is ConfigEntry<int> val4))
{
throw new NotSupportedException($"Unsupported type: {typeof(T)}");
}
LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(val4, requiresRestart));
}
else
{
LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(val3, requiresRestart));
}
}
else
{
LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val2, requiresRestart));
}
}
else
{
LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(val, requiresRestart));
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void AddConfigSlider<T>(ConfigEntry<T> configEntry, bool requiresRestart = false)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
if (!(configEntry is ConfigEntry<float> val))
{
if (!(configEntry is ConfigEntry<int> val2))
{
throw new NotSupportedException($"Slider not supported for type: {typeof(T)}");
}
LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, requiresRestart));
}
else
{
LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, requiresRestart));
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void AddButton(string section, string name, string description, string buttonText, Action callback)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate
{
callback?.Invoke();
}));
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
{
object IEnumerator.Current => _item;
T IEnumerator<T>.Current => _item;
public Enumerator(T item)
{
_item = item;
}
bool IEnumerator.MoveNext()
{
return !_moveNextCalled && (_moveNextCalled = true);
}
void IEnumerator.Reset()
{
_moveNextCalled = false;
}
void IDisposable.Dispose()
{
}
}
int ICollection.Count => 1;
bool ICollection.IsSynchronized => false;
object ICollection.SyncRoot => this;
object IList.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
set
{
throw new NotSupportedException();
}
}
bool IList.IsFixedSize => true;
bool IList.IsReadOnly => true;
int IReadOnlyCollection<T>.Count => 1;
T IReadOnlyList<T>.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
}
int ICollection<T>.Count => 1;
bool ICollection<T>.IsReadOnly => true;
T IList<T>.this[int index]
{
get
{
if (index != 0)
{
throw new IndexOutOfRangeException();
}
return _item;
}
set
{
throw new NotSupportedException();
}
}
public <>z__ReadOnlySingleElementList(T item)
{
_item = item;
}
IEnumerator IEnumerable.GetEnumerator()
{
return new Enumerator(_item);
}
void ICollection.CopyTo(Array array, int index)
{
array.SetValue(_item, index);
}
int IList.Add(object value)
{
throw new NotSupportedException();
}
void IList.Clear()
{
throw new NotSupportedException();
}
bool IList.Contains(object value)
{
return EqualityComparer<T>.Default.Equals(_item, (T)value);
}
int IList.IndexOf(object value)
{
return (!EqualityComparer<T>.Default.Equals(_item, (T)value)) ? (-1) : 0;
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException();
}
void IList.Remove(object value)
{
throw new NotSupportedException();
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException();
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
{
return new Enumerator(_item);
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException();
}
void ICollection<T>.Clear()
{
throw new NotSupportedException();
}
bool ICollection<T>.Contains(T item)
{
return EqualityComparer<T>.Default.Equals(_item, item);
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
array[arrayIndex] = _item;
}
bool ICollection<T>.Remove(T item)
{
throw new NotSupportedException();
}
int IList<T>.IndexOf(T item)
{
return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 0;
}
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException();
}
}
namespace com.github.zehsteam.DontTouchMyClogs.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}