Please disclose if any significant portion of your mod was created 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 FruityCompany v1.0.0
FruityCompany.dll
Decompiled a year agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using FruityCompany.Behaviours; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; 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("FruityCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FruityCompany")] [assembly: AssemblyTitle("FruityCompany")] [assembly: AssemblyVersion("1.0.0.0")] 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; } } } namespace FruityCompany { [BepInPlugin("Kaiser.FruityCompany", "FruityCompany", "1.0.0.0")] public class FruityCompany : BaseUnityPlugin { private const string GUID = "Kaiser.FruityCompany"; private const string NAME = "FruityCompany"; private const string VERSION = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Kaiser.FruityCompany"); internal ManualLogSource mls; public static FruityCompany Instance { get; private set; } private void Awake() { Instance = this; mls = Logger.CreateLogSource("Kaiser.FruityCompany"); harmony.PatchAll(typeof(NightVisionPatch)); mls.LogInfo((object)"Patched NightVisionPatch"); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "fruitycompany"); AssetBundle val = AssetBundle.LoadFromFile(text); Item val2 = val.LoadAsset<Item>("Assets/SnusCanItem.asset"); val2.holdButtonUse = true; SnusCan snusCan = val2.spawnPrefab.AddComponent<SnusCan>(); AudioClip snusUseSound = val.LoadAsset<AudioClip>("Assets/snus_use.mp3"); snusCan.snusUseSound = snusUseSound; ((GrabbableObject)snusCan).grabbable = true; ((GrabbableObject)snusCan).grabbableToEnemies = true; ((GrabbableObject)snusCan).itemProperties = val2; NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 1000, (LevelTypes)(-1)); harmony.PatchAll(typeof(FruityCompany)); mls.LogInfo((object)"Loaded FruityCompany"); } } } namespace FruityCompany.Behaviours { [HarmonyPatch(typeof(PlayerControllerB))] internal class NightVisionPatch { private static MethodInfo TargetMethod() { return typeof(PlayerControllerB).GetMethod("SetNightVisionEnabled", BindingFlags.Instance | BindingFlags.NonPublic); } [HarmonyPrefix] private static void Prefix(PlayerControllerB __instance) { if (!((Object)(object)__instance.nightVision == (Object)null)) { SnusEffect component = ((Component)__instance).GetComponent<SnusEffect>(); if ((Object)(object)component != (Object)null && ((Behaviour)component).enabled) { __instance.nightVision.intensity = 100000f; __instance.nightVision.range = 100000f; __instance.nightVision.shadowStrength = 0f; __instance.nightVision.shadows = (LightShadows)0; __instance.nightVision.shape = (LightShape)2; ((Behaviour)__instance.nightVision).enabled = true; } } } } public class SnusEffect : MonoBehaviour { private void Start() { FruityCompany.Instance.mls.LogInfo((object)"SnusEffect Start called"); PlayerControllerB component = ((Component)this).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { FruityCompany.Instance.mls.LogInfo((object)"Enabling night vision from SnusEffect Start"); ((Behaviour)component.nightVision).enabled = true; } } private void OnDestroy() { FruityCompany.Instance.mls.LogInfo((object)"SnusEffect OnDestroy called"); PlayerControllerB component = ((Component)this).GetComponent<PlayerControllerB>(); if ((Object)(object)component != (Object)null) { FruityCompany.Instance.mls.LogInfo((object)"Disabling night vision from SnusEffect OnDestroy"); ((Behaviour)component.nightVision).enabled = false; component.nightVision.intensity = 1f; component.nightVision.range = 12f; component.nightVision.shadowStrength = 1f; component.nightVision.shadows = (LightShadows)2; typeof(PlayerControllerB).GetMethod("SetNightVisionEnabled", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(component, new object[1] { false }); } } } internal class SnusCan : PhysicsProp { private float originalSprintMeter; private float originalMovementSpeed; private float originalMovementSpeedForReal; private bool originalNightVisionState; private float originalDrunkness; private bool isInUse = false; private int remainingUses = 3; public AudioClip snusUseSound; private AudioSource audioSource; private void Start() { audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); audioSource.playOnAwake = false; } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown || !((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)) { return; } FruityCompany.Instance.mls.LogInfo((object)$"SnusCan ItemActivate called. Remaining uses: {remainingUses}"); if (remainingUses <= 0) { FruityCompany.Instance.mls.LogInfo((object)"No uses remaining"); HUDManager.Instance.DisplayTip("SNUS", "None left!", false, false, "LC_Tip1"); return; } audioSource.PlayOneShot(snusUseSound); remainingUses--; FruityCompany.Instance.mls.LogInfo((object)$"Uses decremented to: {remainingUses}"); originalMovementSpeed = ((GrabbableObject)this).playerHeldBy.movementSpeed; if ((double)((GrabbableObject)this).playerHeldBy.movementSpeed > 4.5) { originalMovementSpeedForReal = ((GrabbableObject)this).playerHeldBy.movementSpeed; } FruityCompany.Instance.mls.LogInfo((object)$"Original movement speed: {originalMovementSpeed}"); ((GrabbableObject)this).playerHeldBy.movementSpeed = originalMovementSpeed * 1.75f; FruityCompany.Instance.mls.LogInfo((object)$"New movement speed: {((GrabbableObject)this).playerHeldBy.movementSpeed}"); FruityCompany.Instance.mls.LogInfo((object)"Adding SnusEffect component"); ((Component)((GrabbableObject)this).playerHeldBy).gameObject.AddComponent<SnusEffect>(); if (isInUse) { FruityCompany.Instance.mls.LogInfo((object)"Already in use - applying additional effects"); originalDrunkness = ((GrabbableObject)this).playerHeldBy.drunkness; FruityCompany.Instance.mls.LogInfo((object)$"Original drunkness: {originalDrunkness}"); ((GrabbableObject)this).playerHeldBy.drunkness = originalDrunkness + 1f; FruityCompany.Instance.mls.LogInfo((object)$"New drunkness: {((GrabbableObject)this).playerHeldBy.drunkness}"); ((GrabbableObject)this).playerHeldBy.DamagePlayer(20, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); FruityCompany.Instance.mls.LogInfo((object)"Applied 20 damage"); ((GrabbableObject)this).playerHeldBy.movementSpeed = 1f; FruityCompany.Instance.mls.LogInfo((object)"Set movement speed to 1"); } if (remainingUses <= 0) { FruityCompany.Instance.mls.LogInfo((object)"Item used up - setting scrap value to 0"); ((GrabbableObject)this).itemUsedUp = true; ((GrabbableObject)this).SetScrapValue(0); } HUDManager.Instance.DisplayTip("SNUS", "Popped a snus!", false, false, "LC_Tip1"); isInUse = true; ((MonoBehaviour)this).StartCoroutine(ResetEffectsAfterTime(30f, ((GrabbableObject)this).playerHeldBy)); } private IEnumerator ResetEffectsAfterTime(float duration, PlayerControllerB player) { FruityCompany.Instance.mls.LogInfo((object)$"Starting ResetEffectsAfterTime coroutine for {duration} seconds"); yield return (object)new WaitForSeconds(duration); if ((Object)(object)player != (Object)null) { FruityCompany.Instance.mls.LogInfo((object)"Resetting effects"); player.movementSpeed = originalMovementSpeedForReal; FruityCompany.Instance.mls.LogInfo((object)$"Reset movement speed to: {originalMovementSpeed}"); player.drunkness = 0f; FruityCompany.Instance.mls.LogInfo((object)"Reset drunkness to 0"); SnusEffect effect = ((Component)player).GetComponent<SnusEffect>(); if ((Object)(object)effect != (Object)null) { FruityCompany.Instance.mls.LogInfo((object)"Destroying SnusEffect component"); Object.Destroy((Object)(object)effect); } isInUse = false; FruityCompany.Instance.mls.LogInfo((object)"Effects reset complete"); } else { FruityCompany.Instance.mls.LogInfo((object)"Player was null during reset"); } } } }