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 give you one spray v1.0.3
BepInEx/plugins/give_you_one_spray.dll
Decompiled 6 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; 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 Microsoft.CodeAnalysis; using Unity.Netcode; 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("give_you_one_spray")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("每次降落到星球自动给一个喷漆")] [assembly: AssemblyFileVersion("1.0.3.0")] [assembly: AssemblyInformationalVersion("1.0.3+c062108bcbb02b2370ee204a4d943488fc1fdb23")] [assembly: AssemblyProduct("give_you_one_spray")] [assembly: AssemblyTitle("give_you_one_spray")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.3.0")] [module: UnverifiableCode] [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 give_you_one_spray { [BepInPlugin("zyjdmmm.give_you_one_spray", "give_you_one_spray", "1.0.3")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static bool SprayGivenThisLanding = false; internal static Item PendingSprayDef = null; internal static Vector3 PendingSprayPos; internal static string PendingSprayPlayerName = ""; internal static IEnumerator SpawnSprayNextFrame() { yield return null; if ((Object)(object)PendingSprayDef == (Object)null) { yield break; } GameObject val = Object.Instantiate<GameObject>(PendingSprayDef.spawnPrefab, PendingSprayPos, Quaternion.identity); val.SetActive(true); try { NetworkObject component = val.GetComponent<NetworkObject>(); if ((Object)(object)component != (Object)null && (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer) { component.Spawn(false); Log.LogInfo((object)"Spawn 成功"); } } catch (Exception ex) { Log.LogWarning((object)("Spawn 失败: " + ex.Message)); } Log.LogInfo((object)("喷漆已生成在 " + PendingSprayPlayerName + " 脚下")); PendingSprayDef = null; } private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"give_you_one_spray v1.0.3 已加载!"); Harmony val = new Harmony("zyjdmmm.give_you_one_spray"); try { val.PatchAll(typeof(ShipLandingPatch)); } catch (Exception ex) { Log.LogError((object)("ShipLandingPatch 注册失败: " + ex.Message)); } try { val.PatchAll(typeof(ShipLeavePatch)); } catch (Exception ex2) { Log.LogError((object)("ShipLeavePatch 注册失败: " + ex2.Message)); } Log.LogInfo((object)"Harmony Patch 注册完成"); } } [HarmonyPatch(typeof(StartOfRound), "Update")] internal static class ShipLandingPatch { private static bool _wasLanded; private static void Postfix(StartOfRound __instance) { try { bool shipHasLanded = __instance.shipHasLanded; if (shipHasLanded && !_wasLanded) { _wasLanded = true; OnShipJustLanded(__instance); } else if (!shipHasLanded) { _wasLanded = false; } } catch (Exception ex) { Plugin.Log.LogError((object)("ShipLandingPatch 出错: " + ex.Message)); } } private static void OnShipJustLanded(StartOfRound round) { //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) if (Plugin.SprayGivenThisLanding) { return; } SelectableLevel currentLevel = round.currentLevel; if ((Object)(object)currentLevel == (Object)null) { return; } bool flag = currentLevel.PlanetName == "Gordion" || ((Object)currentLevel).name.IndexOf("Company", StringComparison.OrdinalIgnoreCase) >= 0 || currentLevel.levelID == 3 || !currentLevel.planetHasTime; Plugin.Log.LogInfo((object)$"着陆: PlanetName={currentLevel.PlanetName}, name={((Object)currentLevel).name}, levelID={currentLevel.levelID}, planetHasTime={currentLevel.planetHasTime}, isCompany={flag}"); if (flag) { Plugin.Log.LogInfo((object)"当前在 公司,跳过给喷漆"); return; } Plugin.Log.LogInfo((object)("降落在 " + currentLevel.PlanetName + ",检查背包...")); int num = 0; PlayerControllerB[] allPlayerScripts = round.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val == (Object)null || val.isPlayerDead || !val.isPlayerControlled) { continue; } GrabbableObject[] itemSlots = val.ItemSlots; int num2 = -1; for (int j = 0; j < itemSlots.Length; j++) { if ((Object)(object)itemSlots[j] == (Object)null) { num2 = j; break; } } if (num2 < 0) { Plugin.Log.LogInfo((object)("玩家 " + val.playerUsername + " 背包已满,跳过")); continue; } Item val2 = FindSprayPaintItem(round); if ((Object)(object)val2 == (Object)null || (Object)(object)val2.spawnPrefab == (Object)null) { Plugin.Log.LogError((object)"未在物品列表中找到 Spray paint!"); return; } Plugin.PendingSprayDef = val2; Plugin.PendingSprayPos = ((Component)val).transform.position + ((Component)val).transform.forward * 1.5f; Plugin.PendingSprayPlayerName = val.playerUsername; ((MonoBehaviour)round).StartCoroutine(Plugin.SpawnSprayNextFrame()); num++; } if (num > 0) { Plugin.SprayGivenThisLanding = true; Plugin.Log.LogInfo((object)$"本轮共发放 {num} 个喷漆"); } else { Plugin.Log.LogInfo((object)"没有玩家需要喷漆"); } } private static Item FindSprayPaintItem(StartOfRound round) { List<Item> list = round.allItemsList?.itemsList; if (list == null) { return null; } foreach (Item item in list) { if (item.itemName.Equals("Spray paint", StringComparison.OrdinalIgnoreCase)) { return item; } } return null; } } [HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")] internal static class ShipLeavePatch { private static void Postfix() { Plugin.SprayGivenThisLanding = false; Plugin.Log.LogInfo((object)"飞船起飞,重置喷漆发放标记"); } } internal static class PluginInfo { public const string PLUGIN_GUID = "zyjdmmm.give_you_one_spray"; public const string PLUGIN_NAME = "give_you_one_spray"; public const string PLUGIN_VERSION = "1.0.3"; } }