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 SitRegen v1.0.6
plugins/SitRegen.dll
Decompiled an hour agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("SitRegen")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.6.0")] [assembly: AssemblyInformationalVersion("1.0.6+c001bc60b981d5dabffbdac7bcd236d993db2481")] [assembly: AssemblyProduct("SitRegen")] [assembly: AssemblyTitle("SitRegen")] [assembly: AssemblyVersion("1.0.6.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 SitRegen { public class SE_SitRegen : StatusEffect { public static float Multiplier = 2f; public override void ModifyStaminaRegen(ref float staminaRegen) { if (Multiplier > 1f) { staminaRegen += Multiplier - 1f; } else { staminaRegen *= Multiplier; } } } [BepInPlugin("PimpMyDog.SitRegen", "SitRegen", "1.0.6")] public class SitRegenPlugin : BaseUnityPlugin { public const string PluginGuid = "PimpMyDog.SitRegen"; public const string PluginName = "SitRegen"; public const string PluginVersion = "1.0.6"; private const string EffectObjectName = "SitRegen"; internal static ManualLogSource Log; private ConfigEntry<bool> _modEnabled; private ConfigEntry<float> _multiplier; private ConfigEntry<bool> _showIcon; private SE_SitRegen _prototype; private int _effectNameHash; private bool _triedIcon; private const int IconSize = 64; private void Awake() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _modEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch. Turn off to disable the bonus without uninstalling."); _multiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "StaminaRegenMultiplier", 2f, new ConfigDescription("Stamina regeneration multiplier while sitting. 1.0 is vanilla. Stacks the same way the game's own stamina buffs do.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); _showIcon = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowStatusIcon", true, "Show an icon in the status bar while the bonus is active."); SE_SitRegen.Multiplier = _multiplier.Value; _multiplier.SettingChanged += delegate { SE_SitRegen.Multiplier = _multiplier.Value; }; CreatePrototype(); Log.LogInfo((object)"SitRegen 1.0.6 loaded."); } private void CreatePrototype() { _prototype = ScriptableObject.CreateInstance<SE_SitRegen>(); ((Object)_prototype).hideFlags = (HideFlags)61; ((Object)_prototype).name = "SitRegen"; ((StatusEffect)_prototype).m_name = "Resting legs"; ((StatusEffect)_prototype).m_tooltip = "Sitting down. Stamina recovers faster."; ((StatusEffect)_prototype).m_ttl = 0f; _effectNameHash = ((StatusEffect)_prototype).NameHash(); _triedIcon = false; } private void Update() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } SEMan sEMan = ((Character)localPlayer).GetSEMan(); if (sEMan == null) { return; } if ((Object)(object)_prototype == (Object)null) { CreatePrototype(); } bool flag = _modEnabled.Value && ((Character)localPlayer).IsSitting(); bool flag2 = sEMan.HaveStatusEffect(_effectNameHash); if (flag != flag2) { if (flag) { LoadIconOnce(); sEMan.AddStatusEffect((StatusEffect)(object)_prototype, false, 0, 0f, (short)(-1)); } else { sEMan.RemoveStatusEffect(_effectNameHash, true); } } } private void LoadIconOnce() { if (_triedIcon) { return; } _triedIcon = true; if (!_showIcon.Value) { ((StatusEffect)_prototype).m_hidden = true; return; } Sprite val = LoadEmbeddedSprite("SitRegen.status_icon.rgba"); if ((Object)(object)val != (Object)null) { ((StatusEffect)_prototype).m_icon = val; return; } StatusEffect val2 = (((Object)(object)ObjectDB.instance != (Object)null) ? ObjectDB.instance.GetStatusEffect(SEMan.s_statusEffectRested) : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.m_icon != (Object)null) { ((StatusEffect)_prototype).m_icon = val2.m_icon; Log.LogWarning((object)"Embedded icon failed to load; using the Rested icon instead."); } else { ((StatusEffect)_prototype).m_hidden = true; Log.LogWarning((object)"No icon available; hiding the status effect instead."); } } private static Sprite LoadEmbeddedSprite(string resourceName) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown try { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; int i; int num; for (i = 0; i < array.Length; i += num) { num = stream.Read(array, i, array.Length - i); if (num <= 0) { break; } } if (i != 16384) { return null; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; val.LoadRawTextureData(array); val.Apply(); Sprite obj = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f)); ((Object)obj).hideFlags = (HideFlags)61; return obj; } catch (Exception ex) { Log.LogWarning((object)("Failed to load embedded icon: " + ex.Message)); return null; } } } }