using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BadCrispberry.Allergies;
using BadCrispberry.TrappedItems;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Peak;
using Photon.Pun;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core;
[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("waffl.BadCrispberry")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.2.2.0")]
[assembly: AssemblyInformationalVersion("2.2.2+706d419c6a0d4ee20319892dddd33a661a80367a")]
[assembly: AssemblyProduct("waffl.BadCrispberry")]
[assembly: AssemblyTitle("BadCrispberry")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://codeberg.org/hwaefl/BadCrispberry")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.2.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
[Embedded]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace Microsoft.CodeAnalysis
{
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace BadCrispberry
{
public class ModConfig
{
private ConfigFile configFile;
private Dictionary<ushort, ConfigEntry<float>> _afflictionsItemConfigs = new Dictionary<ushort, ConfigEntry<float>>();
public Dictionary<STATUSTYPE, ConfigEntry<float>> afflictions = new Dictionary<STATUSTYPE, ConfigEntry<float>>();
public Dictionary<ushort, ConfigEntry<float>> afflictionsItemConfigs = new Dictionary<ushort, ConfigEntry<float>>();
public Dictionary<STATUSTYPE, ConfigEntry<float>> allergicResponse = new Dictionary<STATUSTYPE, ConfigEntry<float>>();
public Dictionary<ushort, ConfigEntry<bool>> allergiesItemOverrides = new Dictionary<ushort, ConfigEntry<bool>>();
public ConfigEntry<bool> enableTrappedItemsConfig;
public ConfigEntry<bool> enableAllergiesConfig;
public ConfigEntry<bool> enableAllergiesItemOverridesConfig;
public ConfigEntry<bool> enableAllergiesFoodOnlyConfig;
public ConfigEntry<bool> enableAllergiesCampfireRerollConfig;
public ConfigEntry<bool> enableAllergiesRerollReplacesConfig;
public ConfigEntry<bool> enableAfflictionsConfig;
public ConfigEntry<int> allergicAmtMinConfig;
public ConfigEntry<int> allergicExtraRollsConfig;
public ConfigEntry<float> allergicDelayMinConfig;
public ConfigEntry<float> allergicDelayMaxConfig;
public ConfigEntry<float> allergicMinConfig;
public ConfigEntry<float> allergicMaxConfig;
public ConfigEntry<KeyCode> menuHotkey;
public bool enableTrappedItems { get; set; }
public ModConfig(ConfigFile configFile)
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Expected O, but got Unknown
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Expected O, but got Unknown
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Expected O, but got Unknown
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Expected O, but got Unknown
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Expected O, but got Unknown
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Expected O, but got Unknown
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Expected O, but got Unknown
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: Expected O, but got Unknown
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_035b: Expected O, but got Unknown
//IL_0390: Unknown result type (might be due to invalid IL or missing references)
//IL_039a: Expected O, but got Unknown
//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
//IL_03d9: Expected O, but got Unknown
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_0418: Expected O, but got Unknown
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0457: Expected O, but got Unknown
//IL_048d: Unknown result type (might be due to invalid IL or missing references)
//IL_0497: Expected O, but got Unknown
//IL_04cd: Unknown result type (might be due to invalid IL or missing references)
//IL_04d7: Expected O, but got Unknown
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_04fe: Expected O, but got Unknown
//IL_0533: Unknown result type (might be due to invalid IL or missing references)
//IL_053d: Expected O, but got Unknown
//IL_0572: Unknown result type (might be due to invalid IL or missing references)
//IL_057c: Expected O, but got Unknown
//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
//IL_05bb: Expected O, but got Unknown
//IL_05f0: Unknown result type (might be due to invalid IL or missing references)
//IL_05fa: Expected O, but got Unknown
//IL_062f: Unknown result type (might be due to invalid IL or missing references)
//IL_0639: Expected O, but got Unknown
//IL_066e: Unknown result type (might be due to invalid IL or missing references)
//IL_0678: Expected O, but got Unknown
//IL_06ad: Unknown result type (might be due to invalid IL or missing references)
//IL_06b7: Expected O, but got Unknown
//IL_06ec: Unknown result type (might be due to invalid IL or missing references)
//IL_06f6: Expected O, but got Unknown
//IL_072c: Unknown result type (might be due to invalid IL or missing references)
//IL_0736: Expected O, but got Unknown
//IL_076c: Unknown result type (might be due to invalid IL or missing references)
//IL_0776: Expected O, but got Unknown
//IL_07ac: Unknown result type (might be due to invalid IL or missing references)
//IL_07b6: Expected O, but got Unknown
this.configFile = configFile;
enableTrappedItemsConfig = configFile.Bind<bool>("Enable - Trapped Items", "Enable Trapped Items", true, new ConfigDescription("Enable the trapped items part of the mod.", (AcceptableValueBase)null, Array.Empty<object>()));
enableAllergiesConfig = configFile.Bind<bool>("Enable - Allergies", "Enable Allergies", true, new ConfigDescription("Enable the allergies part of the mod. Each player is randomly severely allergic to a specific food item.", (AcceptableValueBase)null, Array.Empty<object>()));
enableAllergiesFoodOnlyConfig = configFile.Bind<bool>("Options - Allergies", "Food Allergies Only", false, new ConfigDescription("Only generate allergies for food items.", (AcceptableValueBase)null, Array.Empty<object>()));
enableAllergiesCampfireRerollConfig = configFile.Bind<bool>("Options - Allergies", "Enable Campfire Reroll", true, new ConfigDescription("Enable rolling for new allergies per campfire.", (AcceptableValueBase)null, Array.Empty<object>()));
enableAllergiesRerollReplacesConfig = configFile.Bind<bool>("Options - Allergies", "Rerolls Replaces Old Allergies", false, new ConfigDescription("Enable replacing old allergies with rerolls. If disabled, new allergy rolls stack with old ones.", (AcceptableValueBase)null, Array.Empty<object>()));
enableAllergiesItemOverridesConfig = configFile.Bind<bool>("Enable - Allergies", "Enable Allergies Item Pool Overrides", false, new ConfigDescription("Toggle whether or not your item pool overrides are used to generate allergies.", (AcceptableValueBase)null, Array.Empty<object>()));
menuHotkey = configFile.Bind<KeyCode>("Menu Hotkey", "Menu Hotkey", (KeyCode)284, "Key to open mod menu.");
allergicAmtMinConfig = configFile.Bind<int>("Options - Allergies", "Minimum allergies", 1, new ConfigDescription("Set minimum number of guaranteed allergies.", (AcceptableValueBase)null, Array.Empty<object>()));
allergicExtraRollsConfig = configFile.Bind<int>("Options - Allergies", "Additional allergy rolls", 6, new ConfigDescription("Set number of additional potential allergy rolls.", (AcceptableValueBase)null, Array.Empty<object>()));
allergicDelayMinConfig = configFile.Bind<float>("Options - Allergies", "Minimum allergy delay", 0f, new ConfigDescription("Set minimum time for allergic response.", (AcceptableValueBase)null, Array.Empty<object>()));
allergicDelayMaxConfig = configFile.Bind<float>("Options - Allergies", "Maximum allergy delay", 7f, new ConfigDescription("Set maximum time for allergic response.", (AcceptableValueBase)null, Array.Empty<object>()));
allergicMinConfig = configFile.Bind<float>("Options - Allergies", "Minimum affliction from allergy", 0.5f, new ConfigDescription("Set minimum affliction to apply.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
allergicMaxConfig = configFile.Bind<float>("Options - Allergies", "Maximum affliction from allergy", 1.05f, new ConfigDescription("Set maximum affliction to apply.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 2f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)0] = configFile.Bind<float>("Options - Allergies", "Injury", 0f, new ConfigDescription("Set injury.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)1] = configFile.Bind<float>("Options - Allergies", "Hunger", 0f, new ConfigDescription("Set hunger.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)2] = configFile.Bind<float>("Options - Allergies", "Cold", 0f, new ConfigDescription("Set cold.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)3] = configFile.Bind<float>("Options - Allergies", "Poison", 1f, new ConfigDescription("Set poison.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)4] = configFile.Bind<float>("Options - Allergies", "Crab", 0f, new ConfigDescription("Set crab.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)5] = configFile.Bind<float>("Options - Allergies", "Curse", 0f, new ConfigDescription("Set curse.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)6] = configFile.Bind<float>("Options - Allergies", "Drowsy", 0f, new ConfigDescription("Set drowsy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)8] = configFile.Bind<float>("Options - Allergies", "Hot", 0f, new ConfigDescription("Set hot.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)10] = configFile.Bind<float>("Options - Allergies", "Spores", 0f, new ConfigDescription("Set spores.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
allergicResponse[(STATUSTYPE)11] = configFile.Bind<float>("Options - Allergies", "Web", 0f, new ConfigDescription("Set web.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
enableAfflictionsConfig = configFile.Bind<bool>("Afflictions - Trapped Items", "Enable Afflictions Trap", true, new ConfigDescription("Enable afflictions trap.", (AcceptableValueBase)null, Array.Empty<object>()));
afflictions[(STATUSTYPE)0] = configFile.Bind<float>("Afflictions - Trapped Items", "Injury", 0f, new ConfigDescription("Set injury.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)1] = configFile.Bind<float>("Afflictions - Trapped Items", "Hunger", 0f, new ConfigDescription("Set hunger.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)2] = configFile.Bind<float>("Afflictions - Trapped Items", "Cold", 0f, new ConfigDescription("Set cold.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)3] = configFile.Bind<float>("Afflictions - Trapped Items", "Poison", 0f, new ConfigDescription("Set poison.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)4] = configFile.Bind<float>("Afflictions - Trapped Items", "Crab", 0f, new ConfigDescription("Set crab.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)5] = configFile.Bind<float>("Afflictions - Trapped Items", "Curse", 0.025f, new ConfigDescription("Set curse.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)6] = configFile.Bind<float>("Afflictions - Trapped Items", "Drowsy", 0f, new ConfigDescription("Set drowsy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)8] = configFile.Bind<float>("Afflictions - Trapped Items", "Hot", 0f, new ConfigDescription("Set hot.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)10] = configFile.Bind<float>("Afflictions - Trapped Items", "Spores", 0f, new ConfigDescription("Set spores.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)13] = configFile.Bind<float>("Afflictions - Trapped Items", "Petrify", 0f, new ConfigDescription("Set petrify.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
afflictions[(STATUSTYPE)14] = configFile.Bind<float>("Afflictions - Trapped Items", "Fly Trap", 0f, new ConfigDescription("Set fly trap.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
GenerateItemConfigs();
}
public void GenerateItemConfigs()
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Expected O, but got Unknown
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Expected O, but got Unknown
if (afflictionsItemConfigs.Count > 0)
{
return;
}
foreach (KeyValuePair<ushort, Item> item in SingletonAsset<ItemDatabase>.Instance.itemLookup)
{
if (Object.op_Implicit((Object)(object)item.Value))
{
afflictionsItemConfigs[item.Key] = configFile.Bind<float>("Options - Trapped Items Multiplier", ((Object)item.Value).name, 1f, new ConfigDescription("Strength of afflictions when using/eating " + ((Object)item.Value).name, (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f), Array.Empty<object>()));
}
}
foreach (KeyValuePair<ushort, Item> item2 in SingletonAsset<ItemDatabase>.Instance.itemLookup)
{
if (Object.op_Implicit((Object)(object)item2.Value))
{
allergiesItemOverrides[item2.Key] = configFile.Bind<bool>("Options - Allergies Item Pool", ((Object)item2.Value).name, false, new ConfigDescription("Toggle whether or not item " + ((Object)item2.Value).name + " is included in the allergies pool.", (AcceptableValueBase)null, Array.Empty<object>()));
}
}
}
}
public class ModMenu : MonoBehaviour
{
internal bool ToggleGui;
private Rect _mainWindow;
private Rect _secondaryWindow;
private int _mainWindowID = 666;
private int _secondaryWindowID = 667;
private Vector2 _mainWindowScroll = Vector2.zero;
private Vector2 _secondaryWindowScroll = Vector2.zero;
private string? _selectedCharacterID;
private Dictionary<string, Character>? _characterDict;
internal void InitGUI()
{
//IL_002e: 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_0066: 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)
_selectedCharacterID = null;
_characterDict = BadCrispberry.Allergies.Allergies.CachedCharacters;
_mainWindow = new Rect(32f, 16f, (float)(Screen.width / 12), (float)(Screen.height / 4));
_secondaryWindow = new Rect(((Rect)(ref _mainWindow)).xMax + 8f, ((Rect)(ref _mainWindow)).y, (float)(Screen.width / 12), (float)(Screen.height / 4));
ToggleGui = !ToggleGui;
}
private void OnGUI()
{
//IL_0033: 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_006e: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
if (ToggleGui)
{
GUI.skin.label.fontSize = 18;
GUI.skin.button.fontSize = 18;
_mainWindow = GUILayout.Window(_mainWindowID, _mainWindow, new WindowFunction(DrawMainWindow), "bad crispberry!!", (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.MinWidth(70f),
GUILayout.MinHeight(100f)
});
if (_selectedCharacterID != null)
{
((Rect)(ref _secondaryWindow)).x = ((Rect)(ref _mainWindow)).xMax + 8f;
((Rect)(ref _secondaryWindow)).y = ((Rect)(ref _mainWindow)).y;
_secondaryWindow = GUILayout.Window(_secondaryWindowID, _secondaryWindow, new WindowFunction(DrawSecondaryWindow), _characterDict[_selectedCharacterID].characterName, Array.Empty<GUILayoutOption>());
}
}
}
private void DrawMainWindow(int windowID)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: 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_005e: Unknown result type (might be due to invalid IL or missing references)
_mainWindowScroll = GUILayout.BeginScrollView(_mainWindowScroll, Array.Empty<GUILayoutOption>());
if (_characterDict != null && _characterDict.Count > 0)
{
foreach (KeyValuePair<string, Character> item in _characterDict)
{
GUI.backgroundColor = ((_selectedCharacterID == item.Key) ? Color.cyan : Color.white);
if (GUILayout.Button(item.Value.characterName ?? "", Array.Empty<GUILayoutOption>()))
{
if (_selectedCharacterID == item.Key)
{
_selectedCharacterID = null;
}
else
{
_selectedCharacterID = item.Key;
}
}
}
}
GUILayout.EndScrollView();
GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _mainWindow)).width, 20f));
}
private void DrawSecondaryWindow(int windowID)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
_secondaryWindowScroll = GUILayout.BeginScrollView(_secondaryWindowScroll, Array.Empty<GUILayoutOption>());
GUILayout.Label("Allergic to:", GUI.skin.box, Array.Empty<GUILayoutOption>());
Dictionary<ushort, Item> itemLookup = SingletonAsset<ItemDatabase>.Instance.itemLookup;
if (BadCrispberry.Allergies.Allergies.PlayerAllergies.TryGetValue(_selectedCharacterID, out HashSet<ushort> value))
{
foreach (ushort item in value)
{
GUILayout.Label(" " + ((Object)itemLookup[item]).name + " ", Array.Empty<GUILayoutOption>());
}
}
else
{
GUILayout.Label("No allergies found", Array.Empty<GUILayoutOption>());
}
GUILayout.EndScrollView();
if (GUILayout.Button("Reroll current allergies", Array.Empty<GUILayoutOption>()))
{
BadCrispberry.Allergies.Allergies.GenerateAllergiesPairings(_characterDict[_selectedCharacterID], forceRegenerate: true);
}
if (GUILayout.Button("Roll additional allergies", Array.Empty<GUILayoutOption>()))
{
BadCrispberry.Allergies.Allergies.GenerateAllergiesPairings(_characterDict[_selectedCharacterID]);
}
GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _secondaryWindow)).width, 20f));
}
}
[HarmonyPatch(typeof(Quicksave))]
public static class Quicksave_Patch
{
[HarmonyPostfix]
[HarmonyPatch("LoadSavedGameScene")]
public static void LoadSavedGameScene_Patch()
{
try
{
if (PhotonNetwork.IsMasterClient && Plugin.config.enableAllergiesConfig.Value && (BadCrispberry.Allergies.Allergies.PlayerAllergies == null || !BadCrispberry.Allergies.Allergies.PlayerAllergies.TryGetValue(((MonoBehaviourPun)Character.localCharacter).photonView.Owner.UserId, out HashSet<ushort> _)))
{
Plugin.ResetState();
Plugin.IsInRun = true;
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)Plugin.GenerateAfterWait());
}
}
catch (Exception ex)
{
Plugin.Log.LogError((object)ex);
}
}
}
[HarmonyPatch(typeof(Action_ReduceUses))]
public static class Action_ReduceUsesPatch
{
[HarmonyPrefix]
[HarmonyPatch("ReduceUsesRPC")]
public static void ReduceUsesRPCPatch(ItemAction __instance)
{
try
{
Character trueHolderCharacter = ((ItemActionBase)__instance).item.trueHolderCharacter;
Traps.TryTriggerTrap(((ItemActionBase)__instance).item);
string userId = ((MonoBehaviourPun)trueHolderCharacter).photonView.Owner.UserId;
if (BadCrispberry.Allergies.Allergies.CachedFeedDataDict.TryGetValue(userId, out CachedFeedData value))
{
BadCrispberry.Allergies.Allergies.TryApplyAllergyOnPrimary(((ItemActionBase)__instance).item, trueHolderCharacter);
value.feedData = null;
}
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"Error: {arg}");
}
}
}
[HarmonyPatch(typeof(Campfire))]
public static class CampfirePatch
{
[HarmonyPostfix]
[HarmonyPatch("Light_Rpc")]
private static void Postfix()
{
if (!PhotonNetwork.IsMasterClient || !Plugin.config.enableAllergiesConfig.Value || !Plugin.config.enableAllergiesCampfireRerollConfig.Value)
{
return;
}
foreach (Character allPlayerCharacter in PlayerHandler.GetAllPlayerCharacters())
{
BadCrispberry.Allergies.Allergies.GenerateAllergiesPairings(allPlayerCharacter, Plugin.config.enableAllergiesRerollReplacesConfig.Value);
}
}
}
[HarmonyPatch(typeof(Character))]
public static class CharacterPatch
{
[HarmonyPostfix]
[HarmonyPatch("RPCA_InitializeScoutReport")]
public static void RPCA_InitializeScoutReportPostfix(Character __instance)
{
try
{
if (!PhotonNetwork.IsMasterClient || (Object)(object)Character.localCharacter == (Object)(object)__instance)
{
return;
}
Plugin.Log.LogInfo((object)("Generating allergies for new character " + __instance.characterName));
if (BadCrispberry.Allergies.Allergies.PlayerAllergies != null)
{
BadCrispberry.Allergies.Allergies.PlayerAllergies.TryGetValue(((MonoBehaviourPun)__instance).photonView.Owner.UserId, out HashSet<ushort> value);
if (value != null)
{
return;
}
}
BadCrispberry.Allergies.Allergies.GenerateAllergiesPairings(__instance, forceRegenerate: true);
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"Error: {arg}");
}
}
[HarmonyPrefix]
[HarmonyPatch("FeedItem")]
public static void FeedItemPatch(ref Item item, Character __instance)
{
Traps.TryTriggerTrap(item);
BadCrispberry.Allergies.Allergies.TryApplyAllergyOnFeed(item, __instance);
}
}
[HarmonyPatch(typeof(Item))]
public static class ItemPatch
{
[HarmonyPrefix]
[HarmonyPatch("Consume")]
public static void ConsumePatch(Item __instance)
{
try
{
Character trueHolderCharacter = __instance.trueHolderCharacter;
Traps.TryTriggerTrap(__instance, isConsume: true);
string userId = ((MonoBehaviourPun)trueHolderCharacter).photonView.Owner.UserId;
if (BadCrispberry.Allergies.Allergies.CachedFeedDataDict.TryGetValue(userId, out CachedFeedData value))
{
BadCrispberry.Allergies.Allergies.TryApplyAllergyOnPrimary(__instance, trueHolderCharacter, isConsumeMethod: true);
value.feedData = null;
}
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"Error: {arg}");
}
}
[HarmonyPostfix]
[HarmonyPatch("SendFeedDataRPC")]
public static void SendFeedDataRPC(ref int giverID, ref int recieverID, ref int itemID, ref float totalUsingTime, Item __instance)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
if (PhotonNetwork.IsMasterClient)
{
Character component = ((Component)PhotonView.Find(giverID)).GetComponent<Character>();
string userId = ((MonoBehaviourPun)component).photonView.Owner.UserId;
if (BadCrispberry.Allergies.Allergies.CachedFeedDataDict.TryGetValue(userId, out CachedFeedData value))
{
value.feedData = null;
FeedData feedData = new FeedData
{
giverID = giverID,
receiverID = recieverID,
itemID = (ushort)itemID,
totalItemTime = totalUsingTime
};
value.feedData = feedData;
}
}
}
[HarmonyPrefix]
[HarmonyPatch("RemoveFeedDataRPC")]
public static void RemoveFeedDataRPC(int giverID, Item __instance)
{
string userId = PhotonView.Find(giverID).Owner.UserId;
if (BadCrispberry.Allergies.Allergies.CachedFeedDataDict.TryGetValue(userId, out CachedFeedData _))
{
BadCrispberry.Allergies.Allergies.CachedFeedDataDict[userId].ScheduleRemoveFeedData();
}
}
}
[HarmonyPatch(typeof(Rope))]
public static class RopePatch
{
[HarmonyPrefix]
[HarmonyPatch("Detach_Rpc")]
public static void Detach_RpcPatch(Rope __instance)
{
Traps.TryTriggerTrap(((ItemComponent)__instance.spool).item);
}
}
[HarmonyPatch(typeof(Lantern))]
public static class LanternPatch
{
[HarmonyPostfix]
[HarmonyPatch("LightLantern")]
public static void LightLanternPatch(bool litValue, Lantern __instance)
{
if (litValue)
{
Traps.TryTriggerTrap(__instance.item);
}
}
}
[HarmonyPatch(typeof(Candle))]
public static class CandlePatch
{
[HarmonyPostfix]
[HarmonyPatch("LightCandle")]
public static void LightCandlePatch(bool litValue, Candle __instance)
{
if (litValue)
{
Traps.TryTriggerTrap(((ItemComponent)__instance).item);
}
}
}
[HarmonyPatch(typeof(ItemDatabase))]
public static class ItemDatabasePatch
{
[HarmonyPostfix]
[HarmonyPatch("OnLoaded")]
public static void OnLoadedPostfix()
{
Plugin.config.GenerateItemConfigs();
}
}
[BepInPlugin("waffl.BadCrispberry", "BadCrispberry", "2.2.2")]
public class Plugin : BaseUnityPlugin
{
internal static ModConfig config;
internal static ModMenu Menu;
public static Plugin Instance;
internal static bool IsInRun;
internal static bool ToggleGui;
private Harmony _harmony;
public const string Id = "waffl.BadCrispberry";
internal static ManualLogSource Log { get; private set; }
public static string Name => "BadCrispberry";
public static string Version => "2.2.2";
private void Awake()
{
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
config = new ModConfig(((BaseUnityPlugin)this).Config);
Menu = ((Component)this).gameObject.AddComponent<ModMenu>();
SceneManager.sceneLoaded += OnSceneLoaded;
_harmony = new Harmony("waffl.BadCrispberry");
_harmony.PatchAll();
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
_harmony = null;
if ((Object)(object)Menu != (Object)null)
{
Object.Destroy((Object)(object)Menu);
Menu = null;
}
config = null;
Instance = null;
Log.LogInfo((object)("Plugin " + Name + " unloaded!"));
}
private void Update()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown(config.menuHotkey.Value) && (Object)(object)Menu != (Object)null)
{
Menu.InitGUI();
}
}
private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (((Scene)(ref scene)).name.Contains("Airport"))
{
Log.LogInfo((object)"Resetting plugin state");
IsInRun = false;
ResetState();
}
else if (((Scene)(ref scene)).name.Contains("Level"))
{
Log.LogInfo((object)"On level loading hook");
IsInRun = false;
ResetState();
IsInRun = true;
((MonoBehaviour)Instance).StartCoroutine((IEnumerator)GenerateAfterWait());
}
}
private static void RestartPlugin()
{
IsInRun = false;
ResetState();
IsInRun = true;
foreach (Character allCharacter in Character.AllCharacters)
{
BadCrispberry.Allergies.Allergies.GenerateAllergiesPairings(allCharacter, forceRegenerate: true);
}
}
internal static IEnumerator<WaitUntil> GenerateAfterWait()
{
yield return new WaitUntil((Func<bool>)(() => Character.AllCharacters.Any((Character c) => (Object)(object)((MonoBehaviourPun)c).photonView != (Object)null && (Object)(object)c == (Object)(object)Character.localCharacter)));
BadCrispberry.Allergies.Allergies.GenerateAllergiesPairings(Character.localCharacter, forceRegenerate: true);
}
public static bool IsValidItem(Item item)
{
if (((Object)item).name.StartsWith("C_") || ((Object)item).name.EndsWith("TEMP") || ((Object)item).name.Contains("UNUSED") || ((Object)item).name.Contains("Mushroom Glow") || ((Object)item).name.Contains("Cheat") || ((Object)item).name.Contains("Portable") || ((Object)item).name.Contains("_Hidden") || ((Object)item).name.Contains("Infinite"))
{
return false;
}
bool flag;
switch (item.itemID)
{
case 30:
case 107:
case 170:
case 179:
case 180:
case 182:
flag = true;
break;
default:
flag = false;
break;
}
if (flag)
{
return false;
}
if ((Object)(object)((Component)item).GetComponent<Action_ReduceUses>() != (Object)null || (Object)(object)((Component)item).GetComponent<Action_Consume>() != (Object)null)
{
if (config.enableAllergiesFoodOnlyConfig.Value && (Object)(object)((Component)item).GetComponent<Action_RestoreHunger>() == (Object)null)
{
return false;
}
return true;
}
return false;
}
internal static void ResetState()
{
if (!IsInRun)
{
BadCrispberry.Allergies.Allergies.PlayerAllergies = new Dictionary<string, HashSet<ushort>>();
BadCrispberry.Allergies.Allergies.CachedFeedDataDict = new Dictionary<string, CachedFeedData>();
BadCrispberry.Allergies.Allergies.CachedFeedDataDict[PhotonNetwork.LocalPlayer.UserId] = new CachedFeedData((MonoBehaviour)(object)Instance, PhotonNetwork.LocalPlayer.UserId);
}
}
}
}
namespace BadCrispberry.TrappedItems
{
public static class Traps
{
private static void TriggerAfflictions(Item item, bool isConsume = false)
{
if (Object.op_Implicit((Object)(object)item.trueHolderCharacter))
{
if (ShouldApplyStatus(item, isConsume))
{
ApplyStatus(item, item.trueHolderCharacter);
}
}
else if (Object.op_Implicit((Object)(object)item.overrideHolderCharacter) && ShouldApplyStatus(item, isConsume))
{
ApplyStatus(item, item.overrideHolderCharacter);
}
static void ApplyStatus(Item val, Character character)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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)
if (PhotonNetwork.IsMasterClient)
{
float[] array = new float[CharacterAfflictions.NumStatusTypes];
foreach (STATUSTYPE key in Plugin.config.afflictions.Keys)
{
array[key] = Plugin.config.afflictions[key].Value * Plugin.config.afflictionsItemConfigs[val.itemID].Value;
}
if (!character.data.dead)
{
((MonoBehaviourPun)character).photonView.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array });
}
}
}
static bool ShouldApplyStatus(Item val, bool flag)
{
if (Plugin.config.afflictionsItemConfigs[val.itemID].Value < 0.01f)
{
return false;
}
if (flag)
{
OptionableIntItemData data = val.GetData<OptionableIntItemData>((DataEntryKey)2);
if (data.HasData && data.Value == 0)
{
return false;
}
if (val.itemID == 65 || val.itemID == 1)
{
return false;
}
}
return true;
}
}
public static void TryTriggerTrap(Item item, bool isConsume = false)
{
if (PhotonNetwork.IsMasterClient && Plugin.config.enableTrappedItemsConfig.Value)
{
TriggerAfflictions(item, isConsume);
}
}
}
public enum TrapType
{
Afflictions,
Bees,
Blind,
Dynamite,
Fart,
Numb,
Scoutmaster,
Teleport
}
public class TrapTypeAttribute : Attribute
{
public TrapType Type;
public TrapTypeAttribute(TrapType type)
{
Type = type;
}
}
}
namespace BadCrispberry.Allergies
{
public static class Allergies
{
public static Dictionary<string, Character> CachedCharacters = new Dictionary<string, Character>();
public static Dictionary<string, HashSet<ushort>>? PlayerAllergies = new Dictionary<string, HashSet<ushort>>();
public static Dictionary<string, CachedFeedData> CachedFeedDataDict = new Dictionary<string, CachedFeedData>();
private static bool ShouldApplyAllergy(Item item, Character character, bool isConsumeMethod)
{
if (isConsumeMethod)
{
OptionableIntItemData data = item.GetData<OptionableIntItemData>((DataEntryKey)2);
if (data.HasData && data.Value == 0)
{
return false;
}
}
string userId = ((MonoBehaviourPun)character).photonView.Owner.UserId;
if (PlayerAllergies == null)
{
return false;
}
if (!PlayerAllergies.TryGetValue(userId, out HashSet<ushort> value))
{
return false;
}
if (!value.Contains(item.itemID))
{
return false;
}
return true;
}
private static IEnumerator<WaitForSeconds> ApplyAllergy(Character character, float waitTime)
{
float[] statuses = new float[CharacterAfflictions.NumStatusTypes];
float[] array = new float[CharacterAfflictions.NumStatusTypes];
float num = 0f;
foreach (ConfigEntry<float> value in Plugin.config.allergicResponse.Values)
{
num = ((value.Value > 0.001f) ? (num + value.Value) : num);
}
foreach (STATUSTYPE key in Plugin.config.allergicResponse.Keys)
{
array[key] = Plugin.config.allergicResponse[key].Value / num;
statuses[key] = array[key] * Random.Range(Plugin.config.allergicMinConfig.Value, Plugin.config.allergicMaxConfig.Value);
}
if (!character.data.dead)
{
Plugin.Log.LogInfo((object)("ApplyAllergy: Applying allergic response to " + ((Object)character).name));
yield return new WaitForSeconds(waitTime);
((MonoBehaviourPun)character).photonView.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { statuses });
}
else
{
yield return new WaitForSeconds(0f);
}
}
public static void TryApplyAllergyOnPrimary(Item item, Character character, bool isConsumeMethod = false)
{
if (!PhotonNetwork.IsMasterClient || !Plugin.config.enableAllergiesConfig.Value)
{
return;
}
string userId = ((MonoBehaviourPun)character).photonView.Owner.UserId;
if (!PlayerAllergies.TryGetValue(userId, out HashSet<ushort> value) || value.Count < 1)
{
return;
}
Character character2 = character;
try
{
if (CachedFeedDataDict[userId].IsFeeding())
{
if ((Object)(object)Character.localCharacter == (Object)(object)character)
{
return;
}
PhotonView val = PhotonView.Find(CachedFeedDataDict[userId].GetFeedeeID());
Character val2 = ((val != null) ? ((Component)val).GetComponent<Character>() : null);
character2 = val2;
}
if (ShouldApplyAllergy(item, character2, isConsumeMethod))
{
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)ApplyAllergy(character2, Random.Range(Plugin.config.allergicDelayMinConfig.Value, Plugin.config.allergicDelayMaxConfig.Value)));
}
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"Error: {arg}");
}
}
public static void TryApplyAllergyOnFeed(Item item, Character character)
{
if (!PhotonNetwork.IsMasterClient || !Plugin.config.enableAllergiesConfig.Value)
{
return;
}
string userId = ((MonoBehaviourPun)character).photonView.Owner.UserId;
if (!PlayerAllergies.TryGetValue(userId, out HashSet<ushort> value) || value.Count < 1)
{
return;
}
try
{
if (ShouldApplyAllergy(item, character, isConsumeMethod: false))
{
((MonoBehaviour)Plugin.Instance).StartCoroutine((IEnumerator)ApplyAllergy(character, Random.Range(Plugin.config.allergicDelayMinConfig.Value, Plugin.config.allergicDelayMaxConfig.Value)));
}
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"Error: {arg}");
}
}
public static void GenerateAllergiesPairings(Character character, bool forceRegenerate = false)
{
try
{
if (!PhotonNetwork.IsMasterClient || !Plugin.config.enableAllergiesConfig.Value)
{
return;
}
if (!Plugin.IsInRun)
{
Plugin.IsInRun = true;
}
string userId = ((MonoBehaviourPun)character).photonView.Owner.UserId;
if (forceRegenerate)
{
PlayerAllergies[userId] = new HashSet<ushort>();
}
if (!CachedFeedDataDict.TryGetValue(userId, out CachedFeedData _))
{
CachedFeedDataDict[userId] = new CachedFeedData((MonoBehaviour)(object)Plugin.Instance, userId);
}
CachedCharacters[((MonoBehaviourPun)character).photonView.Owner.UserId] = character;
List<ushort> list = new List<ushort>();
ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
if ((Object)(object)instance == (Object)null)
{
Plugin.Log.LogWarning((object)"ItemDatabase not loaded");
}
if (Plugin.config.enableAllergiesItemOverridesConfig.Value)
{
foreach (KeyValuePair<ushort, Item> item in instance.itemLookup)
{
if (Plugin.config.allergiesItemOverrides[item.Key].Value)
{
list.Add(item.Key);
}
}
}
else
{
foreach (KeyValuePair<ushort, Item> item2 in instance.itemLookup)
{
if (Plugin.IsValidItem(item2.Value))
{
list.Add(item2.Key);
}
}
}
Plugin.Log.LogInfo((object)"FINISHED adding valid items");
List<ushort> list2 = new List<ushort>(list);
if (!PlayerAllergies.ContainsKey(userId))
{
PlayerAllergies[userId] = new HashSet<ushort>();
}
for (int i = 0; i < Plugin.config.allergicAmtMinConfig.Value; i++)
{
if (list2.Count == 0)
{
break;
}
int index = Random.Range(0, list2.Count);
ushort num = list2[index];
PlayerAllergies[userId].Add(num);
list2.Remove(num);
Plugin.Log.LogInfo((object)("Character " + ((Object)character).name + " is allergic to " + ((Object)instance.itemLookup[num]).name));
}
for (int j = 0; j < Plugin.config.allergicExtraRollsConfig.Value; j++)
{
if (list2.Count == 0)
{
break;
}
int index = Random.Range(0, list2.Count);
ushort num = list2[index];
float num2 = Mathf.Clamp(1f / (float)(j + 2), 0.15f, 1f);
float value2 = Random.value;
if (value2 <= num2)
{
PlayerAllergies[userId].Add(num);
list2.Remove(num);
Plugin.Log.LogInfo((object)("Character " + ((Object)character).name + " is allergic to " + ((Object)instance.itemLookup[num]).name));
}
}
}
catch (Exception arg)
{
Plugin.Log.LogError((object)$"{arg}");
}
}
}
public class CachedFeedData
{
private const float DEFAULT_WAIT_INTERVAL = 0.35f;
private FeedData? _feedData;
private readonly string _userID;
private readonly MonoBehaviour _instance;
private Coroutine? _timer;
public FeedData? feedData
{
get
{
return _feedData;
}
set
{
StopTimer();
if (value == null)
{
_feedData = null;
}
else
{
_feedData = value;
}
}
}
public CachedFeedData(MonoBehaviour instance, string userID)
{
_instance = instance;
_userID = userID;
}
public bool IsFeeding()
{
return feedData != null;
}
public int GetFeedeeID()
{
if (IsFeeding())
{
return feedData.receiverID;
}
return -1;
}
public void ScheduleRemoveFeedData(float seconds = 0.35f)
{
StopTimer();
if (IsFeeding())
{
_timer = _instance.StartCoroutine((IEnumerator)WaitThenRemove(seconds));
}
}
private void StopTimer()
{
if (_timer != null)
{
_instance.StopCoroutine(_timer);
_timer = null;
}
}
private IEnumerator<WaitForSeconds> WaitThenRemove(float seconds)
{
yield return new WaitForSeconds(seconds);
_feedData = null;
_timer = null;
}
}
}
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
{
}
}