Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of StanielCup v1.0.5
TheChaosChimaera.StanielCupMod.dll
Decompiled a year agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using StanielCupMod.Behaviors; using Unity.Netcode; using UnityEngine; [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("TheChaosChimaera.StanielCupMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("StanielCupMod")] [assembly: AssemblyTitle("TheChaosChimaera.StanielCupMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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 StanielCupMod { [BepInPlugin("TheChaosChimaera.StanielCupMod", "StanielCupMod", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class StanielCupMod : BaseUnityPlugin { public static AssetBundle StanielAssets; public static StanielCupMod Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "stanielcup"); AssetBundle val = AssetBundle.LoadFromFile(text); int num = 30; Item val2 = val.LoadAsset<Item>("Assets/StanielCup.asset"); HydrationBoost hydrationBoost = val2.spawnPrefab.AddComponent<HydrationBoost>(); ((GrabbableObject)hydrationBoost).grabbable = true; ((GrabbableObject)hydrationBoost).grabbableToEnemies = true; ((GrabbableObject)hydrationBoost).itemProperties = val2; NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, num, (LevelTypes)(-1)); Item val3 = val.LoadAsset<Item>("Assets/StanielCupLimitedEdition.asset"); HydrationBoost hydrationBoost2 = val3.spawnPrefab.AddComponent<HydrationBoost>(); ((GrabbableObject)hydrationBoost2).grabbable = true; ((GrabbableObject)hydrationBoost2).grabbableToEnemies = true; ((GrabbableObject)hydrationBoost2).itemProperties = val3; NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab); Utilities.FixMixerGroups(val3.spawnPrefab); Items.RegisterScrap(val3, 3, (LevelTypes)(-1)); Item val4 = val.LoadAsset<Item>("Assets/StanielCupLarge.asset"); HydrationBoostLarge hydrationBoostLarge = val4.spawnPrefab.AddComponent<HydrationBoostLarge>(); ((GrabbableObject)hydrationBoostLarge).grabbable = true; ((GrabbableObject)hydrationBoostLarge).grabbableToEnemies = true; ((GrabbableObject)hydrationBoostLarge).itemProperties = val4; NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab); Utilities.FixMixerGroups(val4.spawnPrefab); Items.RegisterScrap(val4, 8, (LevelTypes)(-1)); UnlockablesList val5 = val.LoadAsset<UnlockablesList>("Assets/LethalCompany/Mods/TutorialMod/Prefabs/HydrationTerminal/HydrationList.asset"); UnlockableItem val6 = val5.unlockables[0]; NetworkPrefabs.RegisterNetworkPrefab(val6.prefabObject); TerminalNode shopSelectionNode = val6.shopSelectionNode; Unlockables.RegisterUnlockable(val6, (StoreType)2, (TerminalNode)null, (TerminalNode)null, shopSelectionNode, shopSelectionNode.itemCost); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "TheChaosChimaera.StanielCupMod"; public const string PLUGIN_NAME = "StanielCupMod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace StanielCupMod.Patches { [HarmonyPatch(typeof(TVScript))] public class ExampleTVPatch { [HarmonyPatch("SwitchTVLocalClient")] [HarmonyPrefix] private static void SwitchTVPrefix(TVScript __instance) { StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn); } } } namespace StanielCupMod.Behaviors { internal class HydrationBoost : PhysicsProp { [CompilerGenerated] private sealed class <undoAnimation>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HydrationBoost <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <undoAnimation>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (((NetworkBehaviour)<>4__this).IsOwner) { ((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false); ((GrabbableObject)<>4__this).playerHeldBy.activatingItem = false; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private bool drank = false; private string tip = "Drink [LMB]"; private Ray ray; private RaycastHit hit; private PlayerControllerB previousPlayerHeldBy; public override void GrabItem() { HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(new string[1] { tip }, true, ((GrabbableObject)this).itemProperties); } public override void EquipItem() { if (((NetworkBehaviour)this).IsOwner) { previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; previousPlayerHeldBy.equippedUsableItemQE = true; HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(new string[1] { tip }, true, ((GrabbableObject)this).itemProperties); } ((GrabbableObject)this).EnableItemMeshes(true); ((GrabbableObject)this).isPocketed = false; if (!((GrabbableObject)this).hasBeenHeld) { ((GrabbableObject)this).hasBeenHeld = true; if (!((GrabbableObject)this).isInShipRoom && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { RoundManager instance = RoundManager.Instance; instance.valueOfFoundScrapItems += ((GrabbableObject)this).scrapValue; } } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && !drank) { ((GrabbableObject)this).playerHeldBy.sprintMeter = 100f; drank = true; tip = "The Cup is Empty"; ((Component)this).gameObject.GetComponent<AudioSource>().PlayOneShot(((GrabbableObject)this).itemProperties.throwSFX, 1f); HUDManager.Instance.ChangeControlTipMultiple(new string[1] { tip }, true, ((GrabbableObject)this).itemProperties); ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", buttonDown); } ((MonoBehaviour)this).StartCoroutine(undoAnimation()); } } [IteratorStateMachine(typeof(<undoAnimation>d__8))] public IEnumerator undoAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <undoAnimation>d__8(0) { <>4__this = this }; } public override void ItemInteractLeftRight(bool right) { //IL_0039: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemInteractLeftRight(right); if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && right) { ray = new Ray(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward); LayerMask val = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Room" })); if (Physics.Raycast(ray, ref hit, 1f, LayerMask.op_Implicit(val)) && (Object)(object)((RaycastHit)(ref hit)).collider != (Object)null && ((Object)((Component)((RaycastHit)(ref hit)).collider).gameObject).name == "Hydration Station") { drank = false; tip = "Drink [LMB]"; HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(new string[1] { tip }, true, ((GrabbableObject)this).itemProperties); } } } } internal class HydrationBoostLarge : PhysicsProp { [CompilerGenerated] private sealed class <undoAnimation>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public HydrationBoostLarge <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <undoAnimation>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (((NetworkBehaviour)<>4__this).IsOwner) { ((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", false); ((GrabbableObject)<>4__this).playerHeldBy.activatingItem = false; } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private int drinks = 6; private string tip = "Drink [LMB]"; private Ray ray; private RaycastHit hit; private PlayerControllerB previousPlayerHeldBy; public override void GrabItem() { HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(new string[1] { tip }, true, ((GrabbableObject)this).itemProperties); } public override void EquipItem() { if (((NetworkBehaviour)this).IsOwner) { previousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; previousPlayerHeldBy.equippedUsableItemQE = true; HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(new string[1] { tip }, true, ((GrabbableObject)this).itemProperties); } ((GrabbableObject)this).EnableItemMeshes(true); ((GrabbableObject)this).isPocketed = false; if (!((GrabbableObject)this).hasBeenHeld) { ((GrabbableObject)this).hasBeenHeld = true; if (!((GrabbableObject)this).isInShipRoom && !StartOfRound.Instance.inShipPhase && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap) { RoundManager instance = RoundManager.Instance; instance.valueOfFoundScrapItems += ((GrabbableObject)this).scrapValue; } } } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown) { return; } if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && drinks != 0) { ((GrabbableObject)this).playerHeldBy.sprintMeter = 100f; drinks--; if (drinks == 0) { tip = "The Cup is Empty"; ((Component)this).gameObject.GetComponent<AudioSource>().PlayOneShot(((GrabbableObject)this).itemProperties.throwSFX, 1f); HUDManager.Instance.ChangeControlTipMultiple(new string[1] { tip }, true, ((GrabbableObject)this).itemProperties); } ((GrabbableObject)this).playerHeldBy.playerBodyAnimator.SetBool("useTZPItem", buttonDown); } ((MonoBehaviour)this).StartCoroutine(undoAnimation()); } [IteratorStateMachine(typeof(<undoAnimation>d__8))] public IEnumerator undoAnimation() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <undoAnimation>d__8(0) { <>4__this = this }; } public override void ItemInteractLeftRight(bool right) { //IL_0039: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemInteractLeftRight(right); if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && right) { ray = new Ray(((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)this).playerHeldBy.gameplayCamera).transform.forward); LayerMask val = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "Room" })); if (Physics.Raycast(ray, ref hit, 1f, LayerMask.op_Implicit(val)) && (Object)(object)((RaycastHit)(ref hit)).collider != (Object)null && ((Object)((Component)((RaycastHit)(ref hit)).collider).gameObject).name == "Hydration Station") { drinks = 6; tip = "Drink [LMB]"; HUDManager.Instance.ClearControlTips(); HUDManager.Instance.ChangeControlTipMultiple(new string[1] { tip }, true, ((GrabbableObject)this).itemProperties); } } } } internal class Refill { public void RefillStaniel() { GrabbableObject currentlyHeldObjectServer = GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer; if (!((Object)(object)currentlyHeldObjectServer == (Object)null) && !(currentlyHeldObjectServer.itemProperties.itemName == "Staniel Cup")) { } } } }