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 GrocSkin v0.1.2
GrocSkin.dll
Decompiled 3 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using Microsoft.CodeAnalysis; using ModMenu; using ModelReplacement; using ModelReplacement.AvatarBodyUpdater; using SkinShared; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GrocSkin")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.2.0")] [assembly: AssemblyInformationalVersion("0.1.2+7338f80c8a7274b1f103fdeee1603b653c323966")] [assembly: AssemblyProduct("GrocSkin")] [assembly: AssemblyTitle("GrocSkin")] [assembly: AssemblyVersion("0.1.2.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 SkinShared { internal static class SuitTexture { internal static void Ensure(string dllPath, string suitName, string resource, ManualLogSource log) { string text = suitName + ".png"; string text2 = Path.Combine(Path.GetDirectoryName(dllPath) ?? Paths.PluginPath, "moresuits"); try { if (File.Exists(Path.Combine(text2, text))) { log.LogInfo((object)("Suit texture found: " + Path.Combine(text2, text))); return; } try { string[] directories = Directory.GetDirectories(Paths.PluginPath, "moresuits", SearchOption.AllDirectories); foreach (string path in directories) { if (File.Exists(Path.Combine(path, text))) { log.LogInfo((object)("Suit texture found: " + Path.Combine(path, text))); return; } } } catch (Exception ex) { log.LogWarning((object)("Could not scan plugins for moresuits folders (" + ex.Message + "); writing our own copy")); } using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource)) { if (stream == null) { log.LogError((object)("Embedded suit texture " + resource + " is missing; the suit will not be on the rack")); return; } Directory.CreateDirectory(text2); string text3 = Path.Combine(text2, text + ".tmp"); using (FileStream destination = File.Create(text3)) { stream.CopyTo(destination); } File.Move(text3, Path.Combine(text2, text)); } log.LogWarning((object)("No moresuits folder had \"" + text + "\" (the mod manager flattened it?); wrote it to " + text2 + " so More Suits puts the suit on the rack")); } catch (Exception ex2) { log.LogError((object)("Could not write the suit texture to " + text2 + ": " + ex2.Message + "; the suit will not be on the rack")); } } } internal static class SkinMenu { internal const string ModMenuGuid = "daniel.lethalcompany.modmenu"; private const string Tab = "Skins"; internal static bool MenuInstalled => Chainloader.PluginInfos.ContainsKey("daniel.lethalcompany.modmenu"); private static PlayerControllerB Me { get { if (!((Object)(object)StartOfRound.Instance != (Object)null)) { return null; } return StartOfRound.Instance.localPlayerController; } } [MethodImpl(MethodImplOptions.NoInlining)] internal static void Register(string suitName, string who, ConfigEntry<bool> followEmotes = null) { MenuApi.Button("Skins", "Wear " + who, (Func<string>)(() => Wear(suitName, who)), false, false, (Func<string>)(() => Blocked(suitName)), "puts on the \"" + suitName + "\" suit from the rack; everyone sees it"); if (followEmotes != null) { MenuApi.Toggle("Skins", who + " follows emotes", (Func<bool>)(() => followEmotes.Value), (Func<bool, string>)delegate(bool on) { followEmotes.Value = on; return (!on) ? (who + " stays upright during emotes") : (who + " turns and lies down with TooManyEmotes emotes"); }, false, false, (Func<string>)null, "FollowEmotes, saved in the config; only on your game"); } } private static string Key(string s) { return (s ?? "").Replace(" ", "").ToLowerInvariant(); } private static UnlockableSuit Rack(string suitName) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.unlockablesList == (Object)null) { return null; } List<UnlockableItem> list = instance.unlockablesList.unlockables; string want = Key(suitName); return ((IEnumerable<UnlockableSuit>)Object.FindObjectsOfType<UnlockableSuit>()).FirstOrDefault((Func<UnlockableSuit, bool>)((UnlockableSuit s) => (Object)(object)s != (Object)null && s.suitID >= 0 && s.suitID < list.Count && Key(list[s.suitID].unlockableName) == want)); } private static string Blocked(string suitName) { PlayerControllerB me = Me; if ((Object)(object)me == (Object)null) { return "not in a game"; } if (me.isPlayerDead) { return "you're dead"; } UnlockableSuit val = Rack(suitName); if ((Object)(object)val == (Object)null) { return "suit not on the rack (needs More Suits)"; } if (me.currentSuitID != val.suitID) { return null; } return "wearing it"; } private static string Wear(string suitName, string who) { UnlockableSuit val = Rack(suitName); if ((Object)(object)val == (Object)null || (Object)(object)Me == (Object)null) { return null; } val.SwitchSuitToThis(Me); return "put on the " + who + " suit"; } } } namespace GrocSkin { public static class PluginInfo { public const string Guid = "daniel.lethalcompany.grocskin"; public const string Name = "GrocSkin"; public const string Version = "0.1.2"; public const string SuitName = "Groc The Sping"; } [BepInPlugin("daniel.lethalcompany.grocskin", "GrocSkin", "0.1.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static AssetBundle Bundle; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; SuitTexture.Ensure(((BaseUnityPlugin)this).Info.Location, "Groc The Sping", "GrocSkin.suit.png", Log); using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("GrocSkin.grocsuit")) { if (stream == null) { Log.LogError((object)"Embedded bundle GrocSkin.grocsuit is missing"); return; } Bundle = AssetBundle.LoadFromStream(stream); } if ((Object)(object)Bundle == (Object)null) { Log.LogError((object)"Could not load the Groc bundle"); return; } ModelReplacementAPI.RegisterSuitModelReplacement("Groc The Sping", typeof(GrocReplacement)); Log.LogInfo((object)"GrocSkin 0.1.2 loaded: suit \"Groc The Sping\" -> Groc the Sping"); if (SkinMenu.MenuInstalled) { SkinMenu.Register("Groc The Sping", "Groc"); } } } public class GrocReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { return Plugin.Bundle.LoadAsset<GameObject>("groc"); } protected override AvatarUpdater GetAvatarUpdater() { return (AvatarUpdater)(object)new GrocUpdater(); } } public class GrocUpdater : AvatarUpdater { internal const float ItemShiftRight = 0.06f; private Transform hand; private Transform point; public override void AssignModelReplacement(GameObject player, GameObject replacement) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) ((AvatarUpdater)this).AssignModelReplacement(player, replacement); hand = ((AvatarUpdater)this).CustomHandTransformRight; if ((Object)(object)hand == (Object)null) { return; } point = new GameObject("GrocItemPoint").transform; point.SetParent(hand, false); PropertyInfo property = typeof(AvatarUpdater).GetProperty("CustomHandTransformRight"); try { property.SetValue(this, point); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Groc item offset not applied: " + ex.Message)); point = null; } } protected override void UpdateModel() { //IL_002f: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) ((AvatarUpdater)this).UpdateModel(); if (!((Object)(object)point == (Object)null) && !((Object)(object)hand == (Object)null)) { point.position = hand.position + base.replacement.transform.right * (0.06f * base.replacement.transform.lossyScale.x); } } } }