using System; 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.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Fusion; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Microsoft.CodeAnalysis; using SSSGame; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("AskaPlantGrass")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.1")] [assembly: AssemblyInformationalVersion("0.1.1+7c364faa42026cad6715d0ae44ec3a76cfd58241")] [assembly: AssemblyProduct("Aska Plant Grass")] [assembly: AssemblyTitle("AskaPlantGrass")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.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 AskaPlantGrass { [HarmonyPatch(typeof(Character))] public static class CharacterSpawnPatch { [HarmonyPostfix] [HarmonyPatch("Spawned")] public static void Spawned(Character __instance) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (__instance.IsPlayer() && ((NetworkBehaviour)__instance).GetLocalAuthorityMask() == 1 && !((Object)(object)((Component)__instance).GetComponentInChildren() != (Object)null)) { GameObject val = new GameObject("AskaPlantGrass_Tool"); val.transform.SetParent(((Component)__instance).gameObject.transform, false); val.transform.localPosition = new Vector3(0f, 0f, 2f); val.AddComponent(); val.AddComponent(); Plugin.Log.LogInfo((object)"PlantGrassTool attached to local player."); } } } public class PlantGrassTool : MonoBehaviour { private const float RadiusMeters = 1f; private HeightmapTool _heightmapTool; private readonly TerraformingToolOperation _operation = (TerraformingToolOperation)3; private void Start() { _heightmapTool = ((Component)this).GetComponent(); if ((Object)(object)_heightmapTool == (Object)null) { Plugin.Log.LogError((object)"PlantGrassTool: HeightmapTool component missing!"); } } private void Update() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.ConfigEnabled.Value || (Object)(object)_heightmapTool == (Object)null || !Input.GetKeyDown(Plugin.ConfigKey.Value)) { return; } Vector3 position = ((Component)this).transform.position; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val; foreach (Collider item in (Il2CppArrayBase)(object)Physics.OverlapSphere(position, 1f)) { if (!((Component)item).CompareTag(Structure.c_FootprintTag)) { continue; } Structure componentInParent = ((Component)item).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { ManualLogSource log = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(87, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Skipped grass restore at "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(position); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": blocked by structure '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(componentInParent.GetName()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("(footprint collider '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)((Component)item).gameObject).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' at "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Component)item).transform.position); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Vector3.Distance(position, ((Component)item).transform.position), "F2"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("m away)."); } log.LogInfo(val); return; } } _heightmapTool.radius = 1f; _heightmapTool.clearVegetation = false; _heightmapTool.setTerrainType = true; _heightmapTool.terrainType = (TerrainType)0; _heightmapTool.requiresTerrainType = true; _heightmapTool.requiredTerrainType = (TerrainType)1; _heightmapTool.Run(_operation, position); _heightmapTool.PaintHere(); ManualLogSource log2 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Grass restored at "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(position); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log2.LogInfo(val); } } [BepInPlugin("smithio.aska.plantgrass", "Aska Plant Grass", "0.1.1")] public class Plugin : BasePlugin { public const string PluginGuid = "smithio.aska.plantgrass"; public const string PluginName = "Aska Plant Grass"; public const string PluginVersion = "0.1.1"; internal static ManualLogSource Log; internal static ConfigEntry ConfigEnabled; internal static ConfigEntry ConfigKey; public override void Load() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown Log = ((BasePlugin)this).Log; ConfigEnabled = ((BasePlugin)this).Config.Bind("PlantGrass", "Enabled", true, "Master on/off switch for the grass-restore tool."); ConfigKey = ((BasePlugin)this).Config.Bind("PlantGrass", "Key", (KeyCode)93, "Key that paints grass at your feet."); ClassInjector.RegisterTypeInIl2Cpp(); Harmony.CreateAndPatchAll(typeof(CharacterSpawnPatch), (string)null); ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("Aska Plant Grass"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("0.1.1"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded."); } log.LogInfo(val); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "AskaPlantGrass"; public const string PLUGIN_NAME = "Aska Plant Grass"; public const string PLUGIN_VERSION = "0.1.1"; } }