Decompiled source of Venture Signs v1.0.0

Plugins/VentureValheim.VentureSigns.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("VentureValheim.VentureSigns")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VentureValheim.VentureSigns")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7C95117E-DB85-4805-BAF8-72BEE6209084")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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 VentureValheim.VentureSigns
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.orianaventure.mod.VentureSigns", "VentureSigns", "1.0.0")]
	public class VentureSignsPlugin : BaseUnityPlugin
	{
		private const string ModName = "VentureSigns";

		private const string ModVersion = "1.0.0";

		private const string Author = "com.orianaventure.mod";

		private const string ModGUID = "com.orianaventure.mod.VentureSigns";

		private readonly Harmony HarmonyInstance = new Harmony("com.orianaventure.mod.VentureSigns");

		public static readonly ManualLogSource VentureSignsLogger = Logger.CreateLogSource("VentureSigns");

		public static GameObject Root;

		internal static AssetBundle SignBundle;

		public void Awake()
		{
			VentureSignsLogger.LogInfo((object)"That trail that we blaze!");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			HarmonyInstance.PatchAll(executingAssembly);
			SignBundle = AssetUtils.LoadAssetBundleFromResources("vv_signs", Assembly.GetExecutingAssembly());
			PrefabManager.OnPrefabsRegistered += PiecesSigns.Initialize;
		}
	}
	public class PiecesSigns
	{
		[HarmonyPatch(typeof(Sign), "Awake")]
		public static class Patch_Sign_Awake
		{
			private static void Prefix(Sign __instance)
			{
				if ((Object)(object)__instance.m_textWidget == (Object)null)
				{
					__instance.m_textWidget = ((Component)__instance).GetComponentInChildren<TextMeshProUGUI>();
				}
			}
		}

		public static void Initialize()
		{
			MakeSign("VV_SignLeft");
			MakeSign("VV_SignRight");
			MakePole("VV_SignPole3m");
			PrefabManager.OnPrefabsRegistered -= Initialize;
		}

		private static void MakeSign(string assetName)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			GameObject val = VentureSignsPlugin.SignBundle.LoadAsset<GameObject>(assetName);
			string name = ((Object)val).name;
			((Object)val).name = ((Object)val).name + "_old";
			GameObject val2 = PrefabManager.Instance.CreateClonedPrefab(name, val);
			PieceConfig val3 = new PieceConfig();
			val3.PieceTable = PieceTables.Hammer;
			val3.Category = PieceCategories.Furniture;
			val3.Usage = new string[1] { PieceUsages.Decor };
			val3.Name = "$piece_sign";
			val3.Description = "$piece_sign_description";
			val3.CraftingStation = CraftingStations.Workbench;
			val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
			{
				new RequirementConfig
				{
					Item = "Wood",
					Amount = 2,
					Recover = true
				},
				new RequirementConfig
				{
					Item = "Coal",
					Amount = 1,
					Recover = true
				}
			};
			PieceConfig val4 = val3;
			PieceManager.Instance.AddPiece(new CustomPiece(val2, true, val4));
		}

		private static void MakePole(string assetName)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			GameObject val = VentureSignsPlugin.SignBundle.LoadAsset<GameObject>(assetName);
			string name = ((Object)val).name;
			((Object)val).name = ((Object)val).name + "_old";
			GameObject val2 = PrefabManager.Instance.CreateClonedPrefab(name, val);
			PieceConfig val3 = new PieceConfig();
			val3.PieceTable = PieceTables.Hammer;
			val3.Category = PieceCategories.Furniture;
			val3.Usage = new string[1] { PieceUsages.Decor };
			val3.Name = "$piece_woodpole 3m";
			val3.Description = "$piece_woodpoles_description";
			val3.CraftingStation = CraftingStations.Workbench;
			val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
			{
				new RequirementConfig
				{
					Item = "Wood",
					Amount = 2,
					Recover = true
				}
			};
			PieceConfig val4 = val3;
			PieceManager.Instance.AddPiece(new CustomPiece(val2, true, val4));
		}
	}
}