using System; using System.Collections; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; 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 Peak.Afflictions; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("awyeh.cancanneed")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.3.0")] [assembly: AssemblyInformationalVersion("0.1.3+b86a49fcaf90158d9c5c03863fd57695c86e9fc4")] [assembly: AssemblyProduct("awyeh.cancanneed")] [assembly: AssemblyTitle("cancanneed")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.3.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 PeakTest { [BepInPlugin("awyeh.cancanneed", "cancanneed", "0.1.0")] public class Plugin : BaseUnityPlugin { private ConfigEntry _triggerKey; private ConfigEntry _holdDuration; private ConfigEntry _cooldownDuration; private ConfigEntry _cooldownMessageTime; private ConfigEntry _cooldownMessageText; private ConfigEntry _hungerDelta; private ConfigEntry _injuryDelta; private ConfigEntry _sporesDelta; private ConfigEntry _poisonDelta; private ConfigEntry _drowsyDelta; private ConfigEntry _numbDuration; private ConfigEntry _itemName; private float _holdTimer; private float _lastSpawnTime = -999f; private float _cooldownMessageTimer; private bool _cooldownMessageActive; private bool _completed; private bool _ready; private string _currentScene = ""; private UI_UseItemProgress? _uiProgress; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _triggerKey = ((BaseUnityPlugin)this).Config.Bind("按键", "触发按键", (KeyCode)99, "按住此按键触发模组"); _holdDuration = ((BaseUnityPlugin)this).Config.Bind("数值", "按住时长", 2f, new ConfigDescription("按住多少秒后触发", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 10f), Array.Empty())); _cooldownDuration = ((BaseUnityPlugin)this).Config.Bind("数值", "冷却时长", 600f, new ConfigDescription("两次触发之间的冷却时间(秒)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 3600f), Array.Empty())); _cooldownMessageTime = ((BaseUnityPlugin)this).Config.Bind("数值", "冷却提示时长", 1.5f, new ConfigDescription("冷却提示显示多少秒", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 10f), Array.Empty())); _cooldownMessageText = ((BaseUnityPlugin)this).Config.Bind("文字", "冷却提示文字", "刚打过,休息一下好不好", "冷却中显示的提示文字"); _hungerDelta = ((BaseUnityPlugin)this).Config.Bind("效果", "饥饿变化", 0.1f, new ConfigDescription("饥饿值变化(正=恢复)", (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 1f), Array.Empty())); _injuryDelta = ((BaseUnityPlugin)this).Config.Bind("效果", "受伤变化", 0.025f, new ConfigDescription("受伤值变化(正=恢复)", (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 1f), Array.Empty())); _sporesDelta = ((BaseUnityPlugin)this).Config.Bind("效果", "孢子变化", 0.05f, new ConfigDescription("孢子值变化(正=恢复)", (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 1f), Array.Empty())); _poisonDelta = ((BaseUnityPlugin)this).Config.Bind("效果", "中毒变化", -0.2f, new ConfigDescription("中毒值变化(正=恢复)", (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 1f), Array.Empty())); _drowsyDelta = ((BaseUnityPlugin)this).Config.Bind("效果", "眩晕变化", 0.1f, new ConfigDescription("眩晕值变化(正=恢复)", (AcceptableValueBase)(object)new AcceptableValueRange(-1f, 1f), Array.Empty())); _numbDuration = ((BaseUnityPlugin)this).Config.Bind("效果", "麻木时长", 5f, new ConfigDescription("麻木效果持续秒数", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 30f), Array.Empty())); _itemName = ((BaseUnityPlugin)this).Config.Bind("效果", "生成物品名", "FortifiedMilk", "生成的物品名称"); Log.LogInfo((object)"cancanneed Awake"); ((MonoBehaviour)this).StartCoroutine(Init()); } private IEnumerator Init() { while ((Object)(object)Character.localCharacter == (Object)null) { yield return (object)new WaitForSeconds(1f); } _ready = true; Log.LogInfo((object)$"=== SYSTEM READY — Hold {_triggerKey.Value} for {_holdDuration.Value}s! ==="); } private void Update() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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_007a: Unknown result type (might be due to invalid IL or missing references) if (!_ready) { return; } if ((Object)(object)_uiProgress == (Object)null) { _uiProgress = Object.FindAnyObjectByType(); } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name != _currentScene) { activeScene = SceneManager.GetActiveScene(); _currentScene = ((Scene)(ref activeScene)).name; _lastSpawnTime = -999f; } if (IsInvincible()) { _holdTimer = 0f; _completed = false; } else if (Input.GetKey(_triggerKey.Value)) { if (Time.time - _lastSpawnTime < _cooldownDuration.Value) { _holdTimer = 0f; _completed = false; _cooldownMessageTimer = _cooldownMessageTime.Value; return; } _holdTimer += Time.deltaTime; if (!_completed && _holdTimer >= _holdDuration.Value) { _completed = true; _holdTimer = 0f; _lastSpawnTime = Time.time; SpawnFortifiedMilk(); } } else { _holdTimer = 0f; _completed = false; } } private void LateUpdate() { if (_ready && !((Object)(object)_uiProgress == (Object)null)) { if (_cooldownMessageTimer > 0f) { _cooldownMessageTimer -= Time.deltaTime; _cooldownMessageActive = true; GUIManager instance = GUIManager.instance; instance.interactName.SetActive(true); ((TMP_Text)instance.interactNameText).text = _cooldownMessageText.Value; } else if (_cooldownMessageActive) { _cooldownMessageActive = false; GUIManager.instance.interactName.SetActive(false); } if (_holdTimer > 0f) { float fillAmount = Mathf.Clamp01(_holdTimer / _holdDuration.Value); _uiProgress.fill.fillAmount = fillAmount; ((Behaviour)_uiProgress.fill).enabled = true; ((Behaviour)_uiProgress.empty).enabled = true; } } } private void SpawnFortifiedMilk() { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null) { return; } CharacterAfflictions afflictions = localCharacter.refs.afflictions; afflictions.SetStatus((STATUSTYPE)1, afflictions.GetCurrentStatus((STATUSTYPE)1) + _hungerDelta.Value, true); afflictions.SetStatus((STATUSTYPE)0, afflictions.GetCurrentStatus((STATUSTYPE)0) + _injuryDelta.Value, true); afflictions.SetStatus((STATUSTYPE)10, afflictions.GetCurrentStatus((STATUSTYPE)10) + _sporesDelta.Value, true); afflictions.SetStatus((STATUSTYPE)3, afflictions.GetCurrentStatus((STATUSTYPE)3) + _poisonDelta.Value, true); afflictions.SetStatus((STATUSTYPE)6, afflictions.GetCurrentStatus((STATUSTYPE)6) + _drowsyDelta.Value, true); Log.LogInfo((object)"Status effects applied locally!"); if (_numbDuration.Value > 0f) { localCharacter.refs.afflictions.AddAffliction((Affliction)new Affliction_Numb { totalTime = _numbDuration.Value }, false); } try { localCharacter.refs.items.SpawnItemInHand(_itemName.Value); Log.LogInfo((object)(_itemName.Value + " spawned in hand!")); } catch (Exception ex) { Log.LogError((object)("Spawn failed: " + ex.Message)); } } private static bool IsInvincible() { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter != (Object)null) { if (!localCharacter.data.isInvincible) { return localCharacter.data.isInvincibleMilk; } return true; } return false; } private void OnDestroy() { Harmony.UnpatchID("awyeh.cancanneed"); } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }