Decompiled source of RoamingVikings v1.1.0

RoamingVikings.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using JotunnLib.Entities;
using JotunnLib.Managers;
using Shared;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("CampSiteMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CampSiteMod")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("cbeea9de-53e5-4270-af0c-8f38d4dc740d")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TentPatches
{
	[HarmonyPatch(typeof(Bed), "CheckExposure")]
	public static class Campsite_Bed_Patch
	{
		private static bool Prefix(Bed __instance, ref bool __result)
		{
			if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("campsite"))
			{
				__result = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Bed), "CheckFire")]
	public static class Campsite_Fire_Patch
	{
		private static bool Prefix(Bed __instance, ref bool __result)
		{
			if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("campsite"))
			{
				__result = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Bed), "CheckWet")]
	public static class Campsite_Wet_Patch
	{
		private static bool Prefix(Bed __instance, ref bool __result)
		{
			if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("campsite"))
			{
				__result = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Bed), "CheckExposure")]
	public static class SmallTent_Bed_Patch
	{
		private static bool Prefix(Bed __instance, ref bool __result)
		{
			if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("smalltent"))
			{
				__result = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Bed), "CheckFire")]
	public static class SmallTent_Fire_Patch
	{
		private static bool Prefix(Bed __instance, ref bool __result)
		{
			if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("smalltent"))
			{
				__result = true;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(Bed), "CheckWet")]
	public static class SmallTent_Wet_Patch
	{
		private static bool Prefix(Bed __instance, ref bool __result)
		{
			if (((Object)((Component)__instance).gameObject).name.ToLower().Contains("smalltent"))
			{
				__result = true;
				return false;
			}
			return true;
		}
	}
}
namespace Mod
{
	[BepInPlugin("MagikarpSushi.GypsyVikings", "GypsyVikings", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Mod : BaseUnityPlugin
	{
		private const string modGUID = "MagikarpSushi.GypsyVikings";

		private const string modName = "GypsyVikings";

		private const string modVerison = "1.1.0";

		private readonly Harmony harmony = new Harmony("MagikarpSushi.GypsyVikings");

		private void Awake()
		{
			PrefabManager.Instance.PrefabRegister += RegisterPrefabs;
			PieceManager.Instance.PieceRegister += RegisterPieces;
			harmony.PatchAll();
		}

		private void RegisterPrefabs(object sender, EventArgs e)
		{
			AssetBundle assetBundleFromResources = AssetBundleHelper.GetAssetBundleFromResources("campsite");
			GameObject val = assetBundleFromResources.LoadAsset<GameObject>("Assets/CustomItems/GypsyViking/CampSite.prefab");
			GameObject val2 = assetBundleFromResources.LoadAsset<GameObject>("Assets/CustomItems/GypsyViking/LargeTent.prefab");
			GameObject val3 = assetBundleFromResources.LoadAsset<GameObject>("Assets/CustomItems/GypsyViking/SmallTent.prefab");
			PrefabManager.Instance.RegisterPrefab(val, "piece_CampSite");
			PrefabManager.Instance.RegisterPrefab(val2, "piece_LargeTent");
			PrefabManager.Instance.RegisterPrefab(val3, "piece_SmallTent");
		}

		private void RegisterPieces(object sender, EventArgs e)
		{
			PieceManager.Instance.RegisterPiece("Hammer", "piece_CampSite");
			PieceManager.Instance.RegisterPiece("Hammer", "piece_LargeTent");
			PieceManager.Instance.RegisterPiece("Hammer", "piece_SmallTent");
		}
	}
}
namespace Materials
{
	[BepInPlugin("MagikarpSushi.CampingKitMaterial", "CampingKit_GypsyVikingAdd-In", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Mod : BaseUnityPlugin
	{
		private void Awake()
		{
			PrefabManager.Instance.PrefabRegister += RegisterPrefabs;
			ObjectManager.Instance.ObjectRegister += InitObjects;
		}

		private void RegisterPrefabs(object sender, EventArgs e)
		{
			AssetBundle assetBundleFromResources = AssetBundleHelper.GetAssetBundleFromResources("campingkit");
			GameObject val = assetBundleFromResources.LoadAsset<GameObject>("Assets/CustomItems/GypsyViking/CampingKit.prefab");
			ItemDrop component = val.GetComponent<ItemDrop>();
			AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[2]
			{
				typeof(GameObject),
				typeof(string)
			}, (Type[])null).Invoke(PrefabManager.Instance, new object[2] { val, "CampingKit" });
		}

		private void InitObjects(object sender, EventArgs e)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Expected O, but got Unknown
			ObjectManager.Instance.RegisterItem("CampingKit");
			ObjectManager instance = ObjectManager.Instance;
			RecipeConfig val = new RecipeConfig();
			val.Name = "Recipe_CampingKit";
			val.Item = "CampingKit";
			val.CraftingStation = "piece_workbench";
			val.RepairStation = "piece_workbench";
			val.Requirements = (PieceRequirementConfig[])(object)new PieceRequirementConfig[3]
			{
				new PieceRequirementConfig
				{
					Item = "DeerHide",
					Amount = 12
				},
				new PieceRequirementConfig
				{
					Item = "Wood",
					Amount = 18
				},
				new PieceRequirementConfig
				{
					Item = "LeatherScraps",
					Amount = 15
				}
			};
			instance.RegisterRecipe(val);
		}
	}
}
namespace Shared
{
	internal class AssetBundleHelper
	{
		public static AssetBundle GetAssetBundleFromResources(string filename)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename));
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			return AssetBundle.LoadFromStream(stream);
		}
	}
}