Decompiled source of TillValhalla v2.4.15
plugins/TillValhalla.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using TMPro; using TillValhalla.Configurations; using TillValhalla.Configurations.Sections; using TillValhalla.GameClasses; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("TillValhalla")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TillValhalla")] [assembly: AssemblyCopyright("Copyright © 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] internal static class GameObjectAssistant { private static ConcurrentDictionary<float, Stopwatch> stopwatches = new ConcurrentDictionary<float, Stopwatch>(); public static Stopwatch GetStopwatch(GameObject o) { float gameObjectPosHash = GetGameObjectPosHash(o); Stopwatch value = null; if (!stopwatches.TryGetValue(gameObjectPosHash, out value)) { value = new Stopwatch(); stopwatches.TryAdd(gameObjectPosHash, value); } return value; } private static float GetGameObjectPosHash(GameObject o) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) return 1000f * o.transform.position.x + o.transform.position.y + 0.001f * o.transform.position.z; } public static T GetChildComponentByName<T>(string name, GameObject objected) where T : Component { T[] componentsInChildren = objected.GetComponentsInChildren<T>(true); foreach (T val in componentsInChildren) { if (((Object)((Component)val).gameObject).name == name) { return val; } } return default(T); } } public class HotBarUtils { public static bool IgnoreKeyPresses(bool extra = false) { if (!extra) { if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog()) { Chat instance = Chat.instance; if (instance == null) { return false; } return instance.HasFocus(); } return true; } if (!((Object)(object)ZNetScene.instance == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null) && !Minimap.IsOpen() && !Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog()) { Chat instance2 = Chat.instance; if ((instance2 == null || !instance2.HasFocus()) && !StoreGui.IsVisible() && !InventoryGui.IsVisible() && !Menu.IsVisible()) { TextViewer instance3 = TextViewer.instance; if (instance3 == null) { return false; } return instance3.IsVisible(); } } return true; } public static bool CheckKeyDown(string value) { try { return Input.GetKeyDown(value.ToLower()); } catch { return false; } } } namespace TillValhalla { [BepInPlugin("kwilson.TillValhalla", "TillValhalla", "2.4.15")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class TillValhalla : BaseUnityPlugin { public static class WoodDefinitions { public static readonly string FineWoodName = "$item_finewood"; public static readonly string RoundLogName = "$item_roundlog"; } [HarmonyPatch(typeof(Terminal), "InputText")] private static class InputText_Patch { private static bool Prefix(Terminal __instance) { if (!Configuration.modisenabled.Value) { return true; } string text = ((TMP_InputField)__instance.m_input).text; if (text.ToLower().Equals("hotbarswitch reset")) { ((BaseUnityPlugin)context).Config.Reload(); ((BaseUnityPlugin)context).Config.Save(); Traverse.Create((object)__instance).Method("AddString", new object[1] { text }).GetValue(); Traverse.Create((object)__instance).Method("AddString", new object[1] { "hotbar switch config reloaded" }).GetValue(); return false; } return true; } } public const string PluginGUID = "kwilson.TillValhalla"; public const string PluginName = "TillValhalla"; public const string PluginVersion = "2.4.15"; public readonly Harmony _harmony = new Harmony("kwilson.TillValhalla"); private AssetBundle undestructablewallbundle; private AssetBundle testspritebundle; private static TillValhalla context; private Texture2D Textureprefab; private Sprite wings; private Sprite varpaint1; private CustomLocalization Localization; public static List<string> whitelist = new List<string>(); public static Dictionary<string, AudioClip> SFX = new Dictionary<string, AudioClip>(); public static Dictionary<string, Dictionary<string, AudioClip>> SFXList = new Dictionary<string, Dictionary<string, AudioClip>>(); private void Awake() { context = this; Configuration.Awake((BaseUnityPlugin)(object)this); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Game Configuration"); if (!Configuration.modisenabled.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Error while loading configuration file."); return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Configuration file successfully loaded"); LoadConfigs(); _harmony.PatchAll(); AddLocalizations(); LoadSFX(); PrefabManager.OnVanillaPrefabsAvailable += ModifyVanillaItems; PrefabManager.OnVanillaPrefabsAvailable += DropTableAdd.surtingcoredropadd; PrefabManager.OnVanillaPrefabsAvailable += AddItemsandprefabs; } private void Update() { if (!Configuration.modisenabled.Value || HotBarUtils.IgnoreKeyPresses(extra: true) || !HotBarUtils.CheckKeyDown(inventoryconfiguration.hotKey.Value)) { return; } int height = ((Humanoid)Player.m_localPlayer).GetInventory().GetHeight(); int num = Math.Max(1, Math.Min(height, inventoryconfiguration.rowsToSwitch.Value)); List<ItemData> value = Traverse.Create((object)((Humanoid)Player.m_localPlayer).GetInventory()).Field("m_inventory").GetValue<List<ItemData>>(); for (int i = 0; i < value.Count; i++) { if (value[i].m_gridPos.y < num) { value[i].m_gridPos.y--; if (value[i].m_gridPos.y < 0) { value[i].m_gridPos.y = num - 1; } } } Traverse.Create((object)((Humanoid)Player.m_localPlayer).GetInventory()).Method("Changed", Array.Empty<object>()).GetValue(); } private void LoadSFX() { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Audio"); ((BaseUnityPlugin)this).Logger.LogInfo((object)text); if (Directory.Exists(text)) { SFX.Clear(); SFXList.Clear(); if (Directory.Exists(Path.Combine(text, "SFX"))) { CollectAudioFiles(Path.Combine(text, "SFX"), SFX, SFXList); } else { Directory.CreateDirectory(Path.Combine(text, "SFX")); } } else { Directory.CreateDirectory(text); Directory.CreateDirectory(Path.Combine(text, "SFX")); } } private void CollectAudioFiles(string path, Dictionary<string, AudioClip> customDict, Dictionary<string, Dictionary<string, AudioClip>> customDictDict) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Checking folder " + Path.GetFileName(path))); string[] files = Directory.GetFiles(path); foreach (string path2 in files) { PreloadClipCoroutine(path2, (AudioType)0, customDict); } files = Directory.GetDirectories(path); foreach (string path3 in files) { string fileName = Path.GetFileName(path3); string[] files2 = Directory.GetFiles(path3); customDictDict[fileName] = new Dictionary<string, AudioClip>(); string[] array = files2; foreach (string path4 in array) { PreloadClipCoroutine(path4, (AudioType)0, customDictDict[fileName]); } if (files2.Length == 1 && files2[0].ToLower().EndsWith(".txt")) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(files2[0]); if (customDictDict.ContainsKey(fileNameWithoutExtension)) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("\tLinking music folder " + fileName + " to folder " + fileNameWithoutExtension)); customDictDict[fileName] = customDictDict[fileNameWithoutExtension]; } } } } private void PreloadClipCoroutine(string path, AudioType audioType, Dictionary<string, AudioClip> whichDict) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown if (path.EndsWith(".txt") || !Path.HasExtension(path)) { return; } try { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Path: " + path)); UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(new Uri(path).AbsoluteUri, audioType); try { UnityWebRequestAsyncOperation val = audioClip.SendWebRequest(); while (!((AsyncOperation)val).isDone) { } if ((int)audioClip.result != 1) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Failed to load audio clip. Error: " + audioClip.error + ", URL: " + audioClip.url)); return; } DownloadHandlerAudioClip val2 = (DownloadHandlerAudioClip)audioClip.downloadHandler; AudioClip val3 = ((val2 != null) ? val2.audioClip : null); if ((Object)(object)val3 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Audio clip is null. Response data: " + ((DownloadHandler)val2).text)); return; } string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path); if (!whichDict.ContainsKey(fileNameWithoutExtension)) { whichDict[fileNameWithoutExtension] = val3; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Added audio clip '" + fileNameWithoutExtension + "' to dictionary.")); } } finally { ((IDisposable)audioClip)?.Dispose(); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Exception occurred while loading audio clip: " + ex.Message)); } } private void AddLocalizations() { Localization = LocalizationManager.Instance.GetLocalization(); CustomLocalization localization = Localization; string text = "English"; localization.AddTranslation(ref text, new Dictionary<string, string> { { "fire_wood_chest_name", "Firewood Chest" }, { "fire_wood_chest_description", "Chest for storing wood for the fires to pull from." } }); } private void AddItemsandprefabs() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) PieceConfig val = new PieceConfig(); val.Name = "$fire_wood_chest_name"; val.Description = "$fire_wood_chest_description"; val.PieceTable = "Hammer"; val.Category = "Crafting"; PieceManager.Instance.AddPiece(new CustomPiece("firewood_chest", "piece_chest_wood", val)); PieceManager.Instance.GetPiece("firewood_chest").PiecePrefab.GetComponent<Container>().m_name = "$fire_wood_chest_name"; PieceManager.Instance.GetPiece("firewood_chest").PiecePrefab.GetComponent<Transform>().localScale = new Vector3(0.5f, 0.5f, 0.5f); PrefabManager.OnVanillaPrefabsAvailable -= AddItemsandprefabs; } private void LoadConfigs() { try { GameConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Game Configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Game Configuration"); } try { BeehiveConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load beehive configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Beehive Configuration"); } try { ItemDropConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load ItemDrop configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded ItemDrop Configuration"); } try { inventoryconfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Inventory Configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Inventory Configuration"); } try { ShipConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Ship Configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Ship Configuration"); } try { CraftingStationConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load CraftingStation configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded CraftingStation Configuration"); } try { gatherconfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Gather configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Gather Configuration"); } try { FireplaceConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Fireplace configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Fireplace Configuration"); } try { PlayerConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Player configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Player Configuration"); } try { PlantConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Plant configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Plant Configuration"); } try { containerconfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Container configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Container Configuration"); } try { SmelterConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Smelter configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Smelter Configuration"); } try { SapCollectorConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Sap collection configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Sap Collection Configuration"); } try { ZSFXConfiguration.Awake((BaseUnityPlugin)(object)this); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load ZSFX collection configuration"); } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded ZSFX Collection Configuration"); } SynchronizationManager.OnConfigurationSynchronized += delegate(object obj, ConfigurationSynchronizationEventArgs attr) { if (attr.InitialSynchronization) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Initial Config sync event received"); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Config sync event received"); } }; } private void ModifyVanillaItems() { try { GameObject prefab = PrefabManager.Instance.GetPrefab("SwordCheat"); prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_damages.m_slash = 0f; prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_damages.m_chop = 0f; prefab.GetComponent<ItemDrop>().m_itemData.m_shared.m_damages.m_pickaxe = 0f; } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Error while adding variant item: {arg}"); } finally { PrefabManager.OnVanillaPrefabsAvailable -= ModifyVanillaItems; } } } internal static class helper { public static float applyModifierValue(float targetValue, float value) { if (value <= -100f) { value = -100f; } float num = targetValue; if (value >= 0f) { return targetValue + targetValue / 100f * value; } return targetValue - targetValue / 100f * (value * -1f); } public static int Clamp(int value, int min, int max) { return Math.Min(max, Math.Max(min, value)); } public static float Clamp(float value, float min, float max) { return Math.Min(max, Math.Max(min, value)); } } internal static class InventoryAssistant { public static List<Container> GetNearbyFireWoodChests(GameObject target, float range, bool checkWard = true) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[1] { "piece" }; array = new string[3] { "piece", "item", "vehicle" }; IOrderedEnumerable<Collider> orderedEnumerable = from x in Physics.OverlapSphere(target.transform.position, range, LayerMask.GetMask(array)) orderby Vector3.Distance(((Component)x).gameObject.transform.position, target.transform.position) select x; List<Container> list = new List<Container>(); foreach (Collider item in orderedEnumerable) { try { Container componentInParent = ((Component)item).GetComponentInParent<Container>(); bool flag = componentInParent.CheckAccess(Player.m_localPlayer.GetPlayerID()); if (checkWard) { flag = flag && PrivateArea.CheckAccess(((Component)item).gameObject.transform.position, 0f, false, true); } Piece componentInParent2 = ((Component)componentInParent).GetComponentInParent<Piece>(); _ = (Object)(object)((Component)componentInParent).GetComponentInParent<Vagon>() != (Object)null; _ = (Object)(object)((Component)componentInParent).GetComponentInParent<Ship>() != (Object)null; if ((Object)(object)componentInParent2 != (Object)null && flag && componentInParent.GetInventory() != null && componentInParent2.IsPlacedByPlayer() && componentInParent.m_name == "$fire_wood_chest_name") { list.Add(componentInParent); } } catch { } } return list; } public static List<Container> GetNearbyChests(GameObject target, float range, bool checkWard = true) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[1] { "piece" }; if (CraftingStationConfiguration.craftFromCarts.Value || CraftingStationConfiguration.craftFromShips.Value) { array = new string[3] { "piece", "item", "vehicle" }; } IOrderedEnumerable<Collider> orderedEnumerable = from x in Physics.OverlapSphere(target.transform.position, range, LayerMask.GetMask(array)) orderby Vector3.Distance(((Component)x).gameObject.transform.position, target.transform.position) select x; List<Container> list = new List<Container>(); foreach (Collider item in orderedEnumerable) { try { Container componentInParent = ((Component)item).GetComponentInParent<Container>(); bool flag = componentInParent.CheckAccess(Player.m_localPlayer.GetPlayerID()); if (checkWard) { flag = flag && PrivateArea.CheckAccess(((Component)item).gameObject.transform.position, 0f, false, true); } Piece componentInParent2 = ((Component)componentInParent).GetComponentInParent<Piece>(); bool flag2 = (Object)(object)((Component)componentInParent).GetComponentInParent<Vagon>() != (Object)null; bool flag3 = (Object)(object)((Component)componentInParent).GetComponentInParent<Ship>() != (Object)null; if ((Object)(object)componentInParent2 != (Object)null && flag && componentInParent.GetInventory() != null && (!flag2 || CraftingStationConfiguration.craftFromCarts.Value) && (!flag3 || CraftingStationConfiguration.craftFromShips.Value) && (componentInParent2.IsPlacedByPlayer() || (flag3 && CraftingStationConfiguration.craftFromShips.Value)) && componentInParent.m_name != "$fire_wood_chest_name") { list.Add(componentInParent); } } catch { } } return list; } public static List<Container> GetNearbyChestsWithItem(GameObject target, float range, ItemData itemInfo, bool checkWard = true) { List<Container> nearbyChests = GetNearbyChests(target, range, checkWard); List<Container> list = new List<Container>(); foreach (Container item in nearbyChests) { if (ChestContainsItem(item, itemInfo)) { list.Add(item); } } return list; } public static bool ChestContainsItem(Container chest, ItemData needle) { foreach (ItemData allItem in chest.GetInventory().GetAllItems()) { if (allItem.m_shared.m_name == needle.m_shared.m_name) { return true; } } return false; } public static bool ChestContainsItem(Container chest, string needle) { foreach (ItemData allItem in chest.GetInventory().GetAllItems()) { if (allItem.m_shared.m_name == needle) { return true; } } return false; } public static List<ItemData> GetNearbyChestItems(GameObject target, float range = 10f, bool checkWard = true) { List<ItemData> list = new List<ItemData>(); foreach (Container nearbyChest in GetNearbyChests(target, range, checkWard)) { foreach (ItemData allItem in nearbyChest.GetInventory().GetAllItems()) { list.Add(allItem); } } return list; } public static List<ItemData> GetNearbyChestItemsByContainerList(List<Container> nearbyChests) { List<ItemData> list = new List<ItemData>(); foreach (Container nearbyChest in nearbyChests) { foreach (ItemData allItem in nearbyChest.GetInventory().GetAllItems()) { list.Add(allItem); } } return list; } public static int GetItemAmountInItemList(List<ItemData> itemList, ItemData needle) { int num = 0; foreach (ItemData item in itemList) { if (item.m_shared.m_name == needle.m_shared.m_name) { num += item.m_stack; } } return num; } public static int GetItemAmountInItemList(List<ItemData> itemList, string needle) { int num = 0; foreach (ItemData item in itemList) { if (item.m_shared.m_name == needle) { num += item.m_stack; } } return num; } public static int RemoveItemInAmountFromAllNearbyChests(GameObject target, float range, ItemData needle, int amount, bool checkWard = true) { List<Container> nearbyChests = GetNearbyChests(target, range, checkWard); GetItemAmountInItemList(GetNearbyChestItemsByContainerList(nearbyChests), needle); if (amount == 0) { return 0; } int num = 0; foreach (Container item in nearbyChests) { if (num != amount) { int num2 = RemoveItemFromChest(item, needle, amount); num += num2; amount -= num2; } } return num; } public static int RemoveFireWoodItemInAmountFromAllNearbyChests(GameObject target, float range, ItemData needle, int amount, bool checkWard = true) { List<Container> nearbyFireWoodChests = GetNearbyFireWoodChests(target, range, checkWard); GetItemAmountInItemList(GetNearbyChestItemsByContainerList(nearbyFireWoodChests), needle); if (amount == 0) { return 0; } int num = 0; foreach (Container item in nearbyFireWoodChests) { if (num != amount) { int num2 = RemoveItemFromChest(item, needle, amount); num += num2; amount -= num2; } } return num; } public static int RemoveItemInAmountFromAllNearbyChests(GameObject target, float range, string needle, int amount, bool checkWard = true) { List<Container> nearbyChests = GetNearbyChests(target, range, checkWard); GetItemAmountInItemList(GetNearbyChestItemsByContainerList(nearbyChests), needle); if (amount == 0) { return 0; } int num = 0; foreach (Container item in nearbyChests) { if (num != amount) { int num2 = RemoveItemFromChest(item, needle, amount); num += num2; amount -= num2; } } return num; } public static int RemoveItemFromChest(Container chest, ItemData needle, int amount = 1) { if (!ChestContainsItem(chest, needle)) { return 0; } int num = 0; List<ItemData> allItems = chest.GetInventory().GetAllItems(); foreach (ItemData item in allItems) { if (item.m_shared.m_name == needle.m_shared.m_name) { int num2 = Mathf.Min(item.m_stack, amount); item.m_stack -= num2; amount -= num2; num += num2; if (amount <= 0) { break; } } } if (num == 0) { return 0; } allItems.RemoveAll((ItemData x) => x.m_stack <= 0); chest.m_inventory.m_inventory = allItems; ConveyContainerToNetwork(chest); return num; } public static int RemoveItemFromChest(Container chest, string needle, int amount = 1) { if (!ChestContainsItem(chest, needle)) { return 0; } int num = 0; List<ItemData> allItems = chest.GetInventory().GetAllItems(); foreach (ItemData item in allItems) { if (item.m_shared.m_name == needle) { int num2 = Mathf.Min(item.m_stack, amount); item.m_stack -= num2; amount -= num2; num += num2; if (amount <= 0) { break; } } } if (num == 0) { return 0; } allItems.RemoveAll((ItemData x) => x.m_stack <= 0); chest.m_inventory.m_inventory = allItems; ConveyContainerToNetwork(chest); return num; } public static void ConveyContainerToNetwork(Container c) { c.Save(); c.GetInventory().Changed(); } } } namespace TillValhalla.GameClasses { [HarmonyPatch(typeof(CookingStation), "FindCookableItem")] public static class CookingStation_FindCookableItem_Transpiler { private static List<Container> nearbyChests = null; private static MethodInfo method_PullCookableItemFromNearbyChests = AccessTools.Method(typeof(CookingStation_FindCookableItem_Transpiler), "PullCookableItemFromNearbyChests", (Type[])null, (Type[])null); [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown if (!CraftingStationConfiguration.craftFromChests.Value || CraftingStationConfiguration.disableCookingStation.Value) { return instructions; } List<CodeInstruction> list = instructions.ToList(); int num = -1; for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldnull) { list[i] = new CodeInstruction(OpCodes.Ldarg_0, (object)null) { labels = list[i].labels }; list.Insert(++i, new CodeInstruction(OpCodes.Call, (object)method_PullCookableItemFromNearbyChests)); list.Insert(++i, new CodeInstruction(OpCodes.Stloc_3, (object)null)); list.Insert(++i, new CodeInstruction(OpCodes.Ldloc_3, (object)null)); num = i; break; } } if (num == -1) { ZLog.LogError((object)"Failed to apply CookingStation_FindCookableItem_Transpiler"); return instructions; } return list.AsEnumerable(); } private static ItemData PullCookableItemFromNearbyChests(CookingStation station) { if (station.GetFreeSlot() == -1) { return null; } Stopwatch stopwatch = GameObjectAssistant.GetStopwatch(((Component)station).gameObject); int num = helper.Clamp(3, 1, 10) * 1000; if (!stopwatch.IsRunning || stopwatch.ElapsedMilliseconds > num) { nearbyChests = InventoryAssistant.GetNearbyChests(((Component)station).gameObject, helper.Clamp(CraftingStationConfiguration.craftFromChestRange.Value, 1, 50), !CraftingStationConfiguration.ignorePrivateAreaCheck.Value); stopwatch.Restart(); } foreach (ItemConversion item in station.m_conversion) { ItemData itemData = item.m_from.m_itemData; foreach (Container nearbyChest in nearbyChests) { if (nearbyChest.GetInventory().HaveItem(itemData.m_shared.m_name, true)) { InventoryAssistant.RemoveItemFromChest(nearbyChest, itemData); GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(((Object)((Component)item.m_from).gameObject).name); ZNetView.m_forceDisableInit = true; GameObject obj = Object.Instantiate<GameObject>(itemPrefab); ZNetView.m_forceDisableInit = false; return obj.GetComponent<ItemDrop>().m_itemData; } } } return null; } } [HarmonyPatch(typeof(Container), "Awake")] public static class Container_Awake_Patch { private static void Postfix(Container __instance, ref Inventory ___m_inventory) { if (!containerconfiguration.enabled.Value && !Configuration.modisenabled.Value) { return; } if ((Object)(object)__instance == (Object)null || ___m_inventory == null || !Object.op_Implicit((Object)(object)((Component)__instance).transform.parent)) { if (___m_inventory != null) { string name = ___m_inventory.m_name; ref int width = ref ___m_inventory.m_width; ref int height = ref ___m_inventory.m_height; switch (name) { case "$piece_chestprivate": height = helper.Clamp(containerconfiguration.privateChestCol.Value, 2, 20); width = helper.Clamp(containerconfiguration.privateChestRows.Value, 3, 8); break; case "$piece_chestwood": height = helper.Clamp(containerconfiguration.woodChestInventoryCol.Value, 2, 10); width = helper.Clamp(containerconfiguration.woodChestInventoryRows.Value, 3, 8); break; case "$piece_chest": height = helper.Clamp(containerconfiguration.ironChestCol.Value, 3, 20); width = helper.Clamp(containerconfiguration.ironChestRows.Value, 3, 8); break; case "$piece_chestblackmetal": height = helper.Clamp(containerconfiguration.blackMetalChestCol.Value, 3, 20); width = helper.Clamp(containerconfiguration.blackMetalChestRows.Value, 3, 8); break; } } } else { string name2 = ((Object)((Component)__instance).transform.parent).name; _ = ___m_inventory.m_name; ref int width2 = ref ___m_inventory.m_width; ref int height2 = ref ___m_inventory.m_height; if (name2.Contains("Karve")) { height2 = helper.Clamp(containerconfiguration.karveChestCol.Value, 2, 30); width2 = helper.Clamp(containerconfiguration.karveChestRows.Value, 2, 8); } else if (name2.Contains("VikingShip")) { height2 = helper.Clamp(containerconfiguration.vikingshipChestCol.Value, 3, 30); width2 = helper.Clamp(containerconfiguration.vikingshipChestRows.Value, 6, 8); } else if (name2.Contains("Cart")) { height2 = helper.Clamp(containerconfiguration.cartChestCol.Value, 3, 30); width2 = helper.Clamp(containerconfiguration.cartChestRows.Value, 6, 8); } } } } [HarmonyPatch(typeof(CraftingStation), "Start")] public static class CraftingStation_Awake_Patch { public static void Postfix(CraftingStation __instance) { __instance.m_craftRequireRoof = CraftingStationConfiguration.craftingroofrequired.Value; __instance.m_rangeBuild = CraftingStationConfiguration.workbenchcraftingRange.Value; } } [HarmonyPatch(typeof(Piece), "Awake")] public static class Piece_Awake_Patch { public static void Postfix(Piece __instance) { if (__instance.m_name.Contains("_ext") && !CraftingStationConfiguration.UpgradeSpaceRequirementEnabled.Value) { __instance.m_spaceRequirement = 0f; } } } [HarmonyPatch(typeof(DropTable), "GetDropList", new Type[] { typeof(int) })] public static class DropTable_GetDropList_Patch { private static float originalDropChance; private static void Prefix(ref DropTable __instance, ref List<GameObject> __result, int amount) { originalDropChance = __instance.m_dropChance; if (gatherconfiguration.enabled.Value && gatherconfiguration.Dropchance.Value != 0f) { float num = helper.applyModifierValue(__instance.m_dropChance, gatherconfiguration.Dropchance.Value); if (num >= 1f) { num = 1f; } if (num <= 0f) { num = 0f; } if (__instance.m_dropChance != 1f) { __instance.m_dropChance = num; } } } private static void Postfix(ref DropTable __instance, ref List<GameObject> __result, int amount) { __instance.m_dropChance = originalDropChance; if (!gatherconfiguration.enabled.Value) { return; } int num = 0; GameObject item = null; int num2 = 0; GameObject item2 = null; int num3 = 0; GameObject item3 = null; int num4 = 0; GameObject item4 = null; int num5 = 0; GameObject item5 = null; int num6 = 0; GameObject item6 = null; int num7 = 0; GameObject item7 = null; int num8 = 0; GameObject item8 = null; int num9 = 0; GameObject item9 = null; int num10 = 0; GameObject item10 = null; int num11 = 0; GameObject item11 = null; int num12 = 0; GameObject item12 = null; int num13 = 0; GameObject item13 = null; List<GameObject> list = new List<GameObject>(); foreach (GameObject item14 in __result) { switch (((Object)item14).name) { case "Wood": num++; item = item14; break; case "RoundLog": num2++; item2 = item14; break; case "Stone": num3++; item3 = item14; break; case "IronScrap": num4++; item4 = item14; break; case "TinOre": num5++; item5 = item14; break; case "CopperOre": num6++; item6 = item14; break; case "SilverOre": num7++; item7 = item14; break; case "ElderBark": num8++; item8 = item14; break; case "FineWood": num9++; item9 = item14; break; case "YggdrasilWood": num10++; item10 = item14; break; case "SoftTissue": num12++; item12 = item14; break; case "BlackMarble": num13++; item13 = item14; break; default: list.Add(item14); break; } } for (int i = 0; (float)i < helper.applyModifierValue(num, gatherconfiguration.wood.Value); i++) { list.Add(item); } for (int j = 0; (float)j < helper.applyModifierValue(num2, gatherconfiguration.coreWood.Value); j++) { list.Add(item2); } for (int k = 0; (float)k < helper.applyModifierValue(num3, gatherconfiguration.stone.Value); k++) { list.Add(item3); } for (int l = 0; (float)l < helper.applyModifierValue(num4, gatherconfiguration.ironScrap.Value); l++) { list.Add(item4); } for (int m = 0; (float)m < helper.applyModifierValue(num5, gatherconfiguration.tinOre.Value); m++) { list.Add(item5); } for (int n = 0; (float)n < helper.applyModifierValue(num6, gatherconfiguration.copperOre.Value); n++) { list.Add(item6); } for (int num14 = 0; (float)num14 < helper.applyModifierValue(num7, gatherconfiguration.silverOre.Value); num14++) { list.Add(item7); } for (int num15 = 0; (float)num15 < helper.applyModifierValue(num8, gatherconfiguration.elderBark.Value); num15++) { list.Add(item8); } for (int num16 = 0; (float)num16 < helper.applyModifierValue(num9, gatherconfiguration.fineWood.Value); num16++) { list.Add(item9); } for (int num17 = 0; (float)num17 < helper.applyModifierValue(num11, gatherconfiguration.chitin.Value); num17++) { list.Add(item11); } for (int num18 = 0; (float)num18 < helper.applyModifierValue(num10, gatherconfiguration.YggdrasilWood.Value); num18++) { list.Add(item10); } for (int num19 = 0; (float)num19 < helper.applyModifierValue(num12, gatherconfiguration.SoftTissue.Value); num19++) { list.Add(item12); } for (int num20 = 0; (float)num20 < helper.applyModifierValue(num13, gatherconfiguration.BlackMarble.Value); num20++) { list.Add(item13); } __result = list; } } public class DropTableAdd { public static void surtingcoredropadd() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown try { GameObject prefab = PrefabManager.Instance.GetPrefab("SurtlingCore"); GameObject prefab2 = PrefabManager.Instance.GetPrefab("GreydwarfEye"); CharacterDrop component = PrefabManager.Instance.GetPrefab("Greydwarf").GetComponent<CharacterDrop>(); CharacterDrop component2 = PrefabManager.Instance.GetPrefab("Greydwarf_Elite").GetComponent<CharacterDrop>(); CharacterDrop component3 = PrefabManager.Instance.GetPrefab("Greydwarf_Shaman").GetComponent<CharacterDrop>(); PrefabManager.Instance.GetPrefab("Greyling").GetComponent<CharacterDrop>().m_drops.Add(new Drop { m_amountMax = 3, m_amountMin = 1, m_chance = 40f, m_levelMultiplier = true, m_onePerPlayer = false, m_prefab = prefab2 }); component.m_drops.Add(new Drop { m_amountMax = 2, m_amountMin = 0, m_chance = 20f, m_levelMultiplier = true, m_onePerPlayer = false, m_prefab = prefab }); component2.m_drops.Add(new Drop { m_amountMax = 2, m_amountMin = 1, m_chance = 25f, m_levelMultiplier = true, m_onePerPlayer = false, m_prefab = prefab }); component3.m_drops.Add(new Drop { m_amountMax = 2, m_amountMin = 1, m_chance = 20f, m_levelMultiplier = true, m_onePerPlayer = false, m_prefab = prefab }); } catch { Logger.LogError((object)"Failed to load surtling drop tables"); } finally { PrefabManager.OnVanillaPrefabsAvailable -= surtingcoredropadd; } } } [HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")] public static class Character_Drop_Add { [HarmonyPrefix] private static bool MultiplyLoot(CharacterDrop __instance, ref List<KeyValuePair<GameObject, int>> __result) { List<KeyValuePair<GameObject, int>> list = new List<KeyValuePair<GameObject, int>>(); int num = ((!Object.op_Implicit((Object)(object)__instance.m_character)) ? 1 : Mathf.Max(1, (int)Mathf.Pow(2f, (float)(__instance.m_character.GetLevel() - 1)))); foreach (Drop drop in __instance.m_drops) { if ((Object)(object)drop.m_prefab == (Object)null) { continue; } float num2 = drop.m_chance; if (drop.m_levelMultiplier) { num2 *= (float)num; } if (!(Random.value <= num2)) { continue; } int num3 = Random.Range(drop.m_amountMin, drop.m_amountMax); if (drop.m_levelMultiplier) { num3 *= num; } if (drop.m_onePerPlayer) { num3 = ZNet.instance.GetNrOfPlayers(); } if (num3 <= 0 || !((Object)(object)drop.m_prefab != (Object)null)) { continue; } switch (((Object)drop.m_prefab).name) { case "BlackMetalScrap": { float num9 = helper.applyModifierValue(num3, gatherconfiguration.BlackMetalScrap.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num9))); break; } case "GreydwarfEye": { if (num3 == 0) { num3 = 1; } float num19 = helper.applyModifierValue(num3, gatherconfiguration.GreydwarfEye.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num19))); break; } case "RawMeat": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num10 = helper.applyModifierValue(num3, gatherconfiguration.RawMeat.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num10))); break; } case "DeerMeat": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num5 = helper.applyModifierValue(num3, gatherconfiguration.DeerMeat.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num5))); break; } case "HareMeat": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num17 = helper.applyModifierValue(num3, gatherconfiguration.HareMeat.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num17))); break; } case "LoxMeat": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num6 = helper.applyModifierValue(num3, gatherconfiguration.LoxMeat.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num6))); break; } case "NeckTail": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num7 = helper.applyModifierValue(num3, gatherconfiguration.NeckTail.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num7))); break; } case "BugMeat": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num14 = helper.applyModifierValue(num3, gatherconfiguration.BugMeat.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num14))); break; } case "SerpentMeat": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num15 = helper.applyModifierValue(num3, gatherconfiguration.SerpentMeat.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num15))); break; } case "WolfMeat": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num18 = helper.applyModifierValue(num3, gatherconfiguration.WolfMeat.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num18))); break; } case "ChickenMeat": { if (num3 == 0 && gatherconfiguration.FoodDropMinimumEnabled.Value) { num3 = 1; } float num13 = helper.applyModifierValue(num3, gatherconfiguration.ChickenMeat.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num13))); break; } case "DeerHide": { if (num3 == 0 && ItemDropConfiguration.HideAlwaysDropOneEnabled.Value) { num3 = 1; } float num11 = helper.applyModifierValue(num3, ItemDropConfiguration.DeerHide.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num11))); break; } case "ScaleHide": { if (num3 == 0 && ItemDropConfiguration.HideAlwaysDropOneEnabled.Value) { num3 = 1; } float num20 = helper.applyModifierValue(num3, ItemDropConfiguration.ScaleHide.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num20))); break; } case "LoxPelt": { if (num3 == 0 && ItemDropConfiguration.HideAlwaysDropOneEnabled.Value) { num3 = 1; } float num16 = helper.applyModifierValue(num3, ItemDropConfiguration.LoxPelt.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num16))); break; } case "WolfPelt": { if (num3 == 0 && ItemDropConfiguration.HideAlwaysDropOneEnabled.Value) { num3 = 1; } float num12 = helper.applyModifierValue(num3, ItemDropConfiguration.WolfPelt.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num12))); break; } case "LeatherScraps": { if (num3 == 0 && ItemDropConfiguration.HideAlwaysDropOneEnabled.Value) { num3 = 1; } float num8 = helper.applyModifierValue(num3, ItemDropConfiguration.LeatherScraps.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num8))); break; } case "Bloodbag": { if (num3 == 0 && ItemDropConfiguration.HideAlwaysDropOneEnabled.Value) { num3 = 1; } float num4 = helper.applyModifierValue(num3, ItemDropConfiguration.Bloodbag.Value); list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, (int)Math.Round(num4))); break; } default: list.Add(new KeyValuePair<GameObject, int>(drop.m_prefab, num3)); break; } } __result = list; return false; } } public static class FirePlaceDefinitions { public static readonly string FirePitName = "$piece_fire"; public static readonly string BonfireName = "$piece_bonfire"; public static readonly string HearthName = "$piece_hearth"; } [HarmonyPatch(typeof(Fireplace), "Awake")] public static class Fireplace_Awake_Patch { private static void Postfix(Fireplace __instance) { if (__instance.m_name.Contains("torch")) { __instance.m_infiniteFuel = FireplaceConfiguration.TorchInfiniteFuel.Value; } else if (__instance.m_name.Contains("sconce")) { __instance.m_infiniteFuel = FireplaceConfiguration.TorchInfiniteFuel.Value; } else if (__instance.m_name.Contains("Brazier")) { __instance.m_infiniteFuel = FireplaceConfiguration.BrazierInfiniteFuel.Value; } else if (__instance.m_name.Equals(FirePlaceDefinitions.FirePitName)) { __instance.m_infiniteFuel = FireplaceConfiguration.FireplaceInfiniteFuel.Value; } else if (__instance.m_name.Equals(FirePlaceDefinitions.HearthName)) { __instance.m_infiniteFuel = FireplaceConfiguration.FireplaceInfiniteFuel.Value; } else if (__instance.m_name.Equals(FirePlaceDefinitions.BonfireName)) { __instance.m_infiniteFuel = FireplaceConfiguration.FireplaceInfiniteFuel.Value; } } } [HarmonyPatch(typeof(Fireplace), "UpdateFireplace")] public static class Fireplace_UpdateSmelter_Patch { private static void Prefix(Fireplace __instance) { if ((Object)(object)__instance == (Object)null || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || (Object)(object)__instance.m_nview == (Object)null || !__instance.m_nview.IsOwner()) { return; } Stopwatch stopwatch = GameObjectAssistant.GetStopwatch(((Component)__instance).gameObject); if (stopwatch.IsRunning && stopwatch.ElapsedMilliseconds < 1000) { return; } stopwatch.Restart(); float value = 0f; bool flag = false; if (__instance.m_name.Equals(FirePlaceDefinitions.FirePitName)) { if (!FireplaceConfiguration.FireplaceIsEnabled.Value || !FireplaceConfiguration.FireplaceAutoFuel.Value) { return; } value = FireplaceConfiguration.FireplaceAutoRange.Value; flag = false; } else if (__instance.m_name.Equals(FirePlaceDefinitions.HearthName)) { if (!FireplaceConfiguration.FireplaceIsEnabled.Value || !FireplaceConfiguration.FireplaceAutoFuel.Value) { return; } value = FireplaceConfiguration.FireplaceAutoRange.Value; flag = false; } else if (__instance.m_name.Equals(FirePlaceDefinitions.BonfireName)) { if (!FireplaceConfiguration.FireplaceIsEnabled.Value || !FireplaceConfiguration.FireplaceAutoFuel.Value) { return; } value = FireplaceConfiguration.FireplaceAutoRange.Value; flag = false; } else if (__instance.m_name.Contains("torch")) { if (!FireplaceConfiguration.FireplaceIsEnabled.Value || !FireplaceConfiguration.TorchAutoFuel.Value) { return; } value = FireplaceConfiguration.TorchAutoRange.Value; flag = false; } else if (__instance.m_name.Contains("brazier")) { if (!FireplaceConfiguration.FireplaceIsEnabled.Value || !FireplaceConfiguration.BrazierAutoFuel.Value) { return; } value = FireplaceConfiguration.BrazierAutoRange.Value; flag = false; } value = helper.Clamp(value, 1f, 50f); int num = (int)__instance.m_maxFuel - (int)Math.Ceiling(__instance.m_nview.GetZDO().GetFloat(ZDOVars.s_fuel, 0f)); if (Object.op_Implicit((Object)(object)__instance.m_fuelItem) && num > 0) { ItemData itemData = __instance.m_fuelItem.m_itemData; int num2 = InventoryAssistant.RemoveFireWoodItemInAmountFromAllNearbyChests(((Component)__instance).gameObject, value, itemData, num, !flag); for (int i = 0; i < num2; i++) { __instance.m_nview.InvokeRPC("RPC_AddFuel", Array.Empty<object>()); } if (num2 > 0) { ZLog.Log((object)("Added " + num2 + " fuel(" + itemData.m_shared.m_name + ") in " + __instance.m_name)); } } } } [HarmonyPatch(typeof(Game), "UpdateRespawn")] public static class Player_UpdateRespawn_Transpiler { [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { string operand = GameConfiguration.firstspawnmessage.Value.ToString(); List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldstr) { list[i].operand = operand; return list.AsEnumerable(); } } return instructions; } } [HarmonyPatch(typeof(Location), "IsInsideNoBuildLocation")] public static class Location_IsInsideNoBuildLocation_Patch { public static bool Prefix(ref bool __result) { if (GameConfiguration.DisableBuildRestrictions.Value && GameConfiguration.enabled.Value) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(Inventory), "TopFirst")] public static class Inventory_TopFirst_Patch { public static bool Prefix(ref bool __result) { if (inventoryconfiguration.enabled.Value && inventoryconfiguration.toptobottomfill.Value) { __result = true; return false; } return true; } } [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static class Inventory_Constructor_Patch { private const int playerInventoryMaxRows = 20; private const int playerInventoryMinRows = 4; public static void Prefix(string name, ref int w, ref int h) { if (inventoryconfiguration.enabled.Value && (name == "Grave" || name == "Inventory")) { h = helper.Clamp(inventoryconfiguration.playerinventoryrows.Value, 4, 20); } } } [HarmonyPatch(typeof(Inventory), "MoveAll")] public static class Inventory_MoveAll_Patch { private static void Prefix(ref Inventory __instance, ref Inventory fromInventory) { foreach (ItemData item in new List<ItemData>(fromInventory.GetAllItems())) { if (item.m_shared.m_maxStackSize <= 1) { continue; } foreach (ItemData item2 in __instance.m_inventory) { if (item2.m_shared.m_name == item.m_shared.m_name && item2.m_quality == item.m_quality) { int num = Math.Min(item2.m_shared.m_maxStackSize - item2.m_stack, item.m_stack); item2.m_stack += num; if (item.m_stack == num) { fromInventory.RemoveItem(item); break; } item.m_stack -= num; } } } } } public static class Inventory_NearbyChests_Cache { public static List<Container> chests = new List<Container>(); public static readonly Stopwatch delta = new Stopwatch(); } [HarmonyPatch(typeof(InventoryGui), "Show")] public class InventoryGui_Show_Patch { private const float oneRowSize = 70.5f; private const float containerOriginalY = -90f; private const float containerHeight = -340f; private static float lastValue; public static void Postfix(ref InventoryGui __instance) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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) if (inventoryconfiguration.enabled.Value) { RectTransform container = __instance.m_container; RectTransform player = __instance.m_player; GameObject gameObject = ((Component)InventoryGui.instance.m_playerGrid).gameObject; int num = Math.Min(6, Math.Max(4, inventoryconfiguration.playerinventoryrows.Value)); float num2 = -90f - 70.5f * (float)num; player.SetSizeWithCurrentAnchors((Axis)1, (float)num * 70.5f); container.offsetMax = new Vector2(610f, num2); container.offsetMin = new Vector2(40f, num2 + -340f); if (!Object.op_Implicit((Object)(object)gameObject.GetComponent<InventoryGrid>().m_scrollbar)) { GameObject val = Object.Instantiate<GameObject>(((Component)InventoryGui.instance.m_containerGrid.m_scrollbar).gameObject, gameObject.transform.parent); ((Object)val).name = "PlayerScroll"; ((Behaviour)gameObject.GetComponent<RectMask2D>()).enabled = true; ScrollRect obj = gameObject.AddComponent<ScrollRect>(); gameObject.GetComponent<RectTransform>().offsetMax = new Vector2(800f, gameObject.GetComponent<RectTransform>().offsetMax.y); gameObject.GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 1f); obj.content = gameObject.GetComponent<InventoryGrid>().m_gridRoot; obj.viewport = ((Component)__instance.m_player).GetComponentInChildren<RectTransform>(); obj.verticalScrollbar = val.GetComponent<Scrollbar>(); gameObject.GetComponent<InventoryGrid>().m_scrollbar = val.GetComponent<Scrollbar>(); obj.horizontal = false; obj.movementType = (MovementType)2; obj.scrollSensitivity = 70.5f; obj.inertia = false; obj.verticalScrollbarVisibility = (ScrollbarVisibility)1; lastValue = val.GetComponent<Scrollbar>().value; } } } } [HarmonyPatch(typeof(InventoryGui), "RepairOneItem")] public static class InventoryGui_RepairOneItem_Transpiler { private static MethodInfo method_EffectList_Create = AccessTools.Method(typeof(EffectList), "Create", (Type[])null, (Type[])null); private static MethodInfo method_CreateNoop = AccessTools.Method(typeof(InventoryGui_RepairOneItem_Transpiler), "CreateNoop", (Type[])null, (Type[])null); [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions) { if (!PlayerConfiguration.enabled.Value) { return instructions; } List<CodeInstruction> list = instructions.ToList(); if (PlayerConfiguration.autorepair.Value) { for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], method_EffectList_Create)) { list[i].opcode = OpCodes.Call; list[i].operand = method_CreateNoop; } } } return list.AsEnumerable(); } private static GameObject[] CreateNoop(Vector3 _0, Quaternion _1, Transform _2, float _3, int _4) { return null; } } [HarmonyPatch(typeof(InventoryGui), "DoCrafting")] public static class InventoryGui_DoCrafting_Transpiler { private static MethodInfo method_Player_Inventory_RemoveItem = AccessTools.Method(typeof(Inventory), "RemoveItem", new Type[4] { typeof(string), typeof(int), typeof(int), typeof(bool) }, (Type[])null); private static MethodInfo method_UseItemFromInventoryOrChest = AccessTools.Method(typeof(InventoryGui_DoCrafting_Transpiler), "UseItemFromInventoryOrChest", (Type[])null, (Type[])null); [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown if (!CraftingStationConfiguration.craftFromChests.Value) { return instructions; } List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], method_Player_Inventory_RemoveItem)) { list[i] = new CodeInstruction(OpCodes.Call, (object)method_UseItemFromInventoryOrChest); list.RemoveAt(i - 8); return list.AsEnumerable(); } } return instructions; } private static void UseItemFromInventoryOrChest(Player player, string itemName, int quantity, int quality, bool worldLevelBased) { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory.CountItems(itemName, quality, true) >= quantity) { inventory.RemoveItem(itemName, quantity, quality, worldLevelBased); return; } CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); GameObject val = ((currentCraftingStation != null) ? ((Component)currentCraftingStation).gameObject : null); if (!Object.op_Implicit((Object)(object)val) || !CraftingStationConfiguration.craftFromWorkbench.Value) { val = ((Component)player).gameObject; } List<Container> nearbyChests = InventoryAssistant.GetNearbyChests(val, helper.Clamp(CraftingStationConfiguration.craftFromChestRange.Value, 1, 50), !CraftingStationConfiguration.ignorePrivateAreaCheck.Value); int num = quantity; foreach (Container item in nearbyChests) { if (item.GetInventory().CountItems(itemName, quality, true) > 0) { num -= InventoryAssistant.RemoveItemFromChest(item, itemName, num); if (num == 0) { break; } } } } } [HarmonyPatch(typeof(InventoryGui), "SetupRequirement")] public static class InventoryGui_SetupRequirement_Patch { private static bool Prefix(Transform elementRoot, Requirement req, Player player, bool craft, int quality, ref bool __result) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) if (!CraftingStationConfiguration.craftFromChests.Value) { return true; } Image component = ((Component)((Component)elementRoot).transform.Find("res_icon")).GetComponent<Image>(); TMP_Text component2 = ((Component)((Component)elementRoot).transform.Find("res_name")).GetComponent<TMP_Text>(); TMP_Text component3 = ((Component)((Component)elementRoot).transform.Find("res_amount")).GetComponent<TMP_Text>(); UITooltip component4 = ((Component)elementRoot).GetComponent<UITooltip>(); if ((Object)(object)req.m_resItem != (Object)null) { ((Component)component).gameObject.SetActive(true); ((Component)component2).gameObject.SetActive(true); ((Component)component3).gameObject.SetActive(true); component.sprite = req.m_resItem.m_itemData.GetIcon(); ((Graphic)component).color = Color.white; component4.m_text = Localization.instance.Localize(req.m_resItem.m_itemData.m_shared.m_name); component2.text = Localization.instance.Localize(req.m_resItem.m_itemData.m_shared.m_name); int num = ((Humanoid)player).GetInventory().CountItems(req.m_resItem.m_itemData.m_shared.m_name, -1, true); int amount = req.GetAmount(quality); if (amount <= 0) { InventoryGui.HideRequirement(elementRoot); __result = false; return false; } if (CraftingStationConfiguration.craftFromChests.Value) { CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); GameObject val = ((currentCraftingStation != null) ? ((Component)currentCraftingStation).gameObject : null); Stopwatch stopwatch; if (!Object.op_Implicit((Object)(object)val) || !CraftingStationConfiguration.craftFromWorkbench.Value) { val = ((Component)player).gameObject; stopwatch = Inventory_NearbyChests_Cache.delta; } else { stopwatch = GameObjectAssistant.GetStopwatch(val); } int num2 = helper.Clamp(3, 1, 10) * 1000; if (!stopwatch.IsRunning || stopwatch.ElapsedMilliseconds > num2) { Inventory_NearbyChests_Cache.chests = InventoryAssistant.GetNearbyChests(val, helper.Clamp(CraftingStationConfiguration.craftFromChestRange.Value, 1f, 50f)); stopwatch.Restart(); } num += InventoryAssistant.GetItemAmountInItemList(InventoryAssistant.GetNearbyChestItemsByContainerList(Inventory_NearbyChests_Cache.chests), req.m_resItem.m_itemData); } component3.text = num + "/" + amount; if (num < amount) { ((Graphic)component3).color = ((Mathf.Sin(Time.time * 10f) > 0f) ? Color.red : Color.white); } else { ((Graphic)component3).color = Color.white; } component3.fontSize = 14f; if (component3.text.Length > 5) { component3.fontSize -= (float)(component3.text.Length - 5); } } __result = true; return false; } } [HarmonyPatch(typeof(InventoryGui), "UpdateRepair")] public static class InventoryGui_UpdateRepair_Patch { [HarmonyPrefix] public static void Prefix(InventoryGui __instance) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!PlayerConfiguration.enabled.Value || !PlayerConfiguration.autorepair.Value) { return; } CraftingStation currentCraftingStation = Player.m_localPlayer.GetCurrentCraftingStation(); if ((Object)(object)currentCraftingStation != (Object)null) { int num = 0; while (__instance.HaveRepairableItems()) { __instance.RepairOneItem(); num++; } if (num > 0) { currentCraftingStation.m_repairItemDoneEffects.Create(((Component)currentCraftingStation).transform.position, Quaternion.identity, (Transform)null, 1f, -1); } } } } [HarmonyPatch(typeof(Plant), "HaveGrowSpace")] public class Plant_HaveGrowSpace_Patch { public static bool Postfix(bool __result) { __result = !PlantConfiguration.needgrowspace.Value; return __result; } } [HarmonyPatch(typeof(Plant), "Awake")] public static class Plant_Awake_Patch { public static void Postfix(Plant __instance) { __instance.m_needCultivatedGround = PlantConfiguration.needcultivatedground.Value; Component componentInParent = ((Component)__instance).GetComponentInParent(typeof(Piece)); ((Piece)((componentInParent is Piece) ? componentInParent : null)).m_cultivatedGroundOnly = PlantConfiguration.needcultivatedground.Value; } } [HarmonyPatch(typeof(ItemDrop), "Awake")] public static class ItemDrop_Awake_Patch { public static void Postfix(ItemDrop __instance) { if (ItemDropConfiguration.noteleportprevention.Value && Configuration.modisenabled.Value) { __instance.m_itemData.m_shared.m_teleportable = true; } if (Configuration.modisenabled.Value) { string text = ((object)(ItemType)(ref __instance.m_itemData.m_shared.m_itemType)).ToString(); float num = helper.applyModifierValue(__instance.m_itemData.m_shared.m_maxStackSize, inventoryconfiguration.maxstacksizemultiplier.Value); switch (((object)(ItemType)(ref __instance.m_itemData.m_shared.m_itemType)).ToString()) { case "Consumable": case "Material": case "Ammo": __instance.m_itemData.m_shared.m_maxStackSize = (int)Math.Round(num); break; } __instance.m_itemData.m_shared.m_movementModifier = ItemDropConfiguration.movementmodifier.Value; } } } [HarmonyPatch(typeof(Beehive), "Awake")] public static class Beehive_Awake_Patch { private static void Postfix(Beehive __instance) { if (BeehiveConfiguration.enabled.Value && Configuration.modisenabled.Value) { __instance.m_maxHoney = BeehiveConfiguration.beehivemaxhoney.Value; __instance.m_secPerUnit = BeehiveConfiguration.beehiveHoneyProductionSpeed.Value; } } } [HarmonyPatch(typeof(ResourceRoot), "Awake")] public class ResourceRoot_Awake_Patch { public static void Postfix(ResourceRoot __instance) { if (SapCollectorConfiguration.enabled.Value || Configuration.modisenabled.Value) { __instance.m_maxLevel = SapCollectorConfiguration.rootmaxcapacity.Value; __instance.m_regenPerSec = SapCollectorConfiguration.rootregenpersec.Value; } } } [HarmonyPatch(typeof(SapCollector), "Awake")] public class SapCollector_Awake_Patch { public static void Postfix(SapCollector __instance) { if (SapCollectorConfiguration.enabled.Value || Configuration.modisenabled.Value) { __instance.m_secPerUnit = SapCollectorConfiguration.collectorsecperunit.Value; __instance.m_maxLevel = SapCollectorConfiguration.collectormaxcapacity.Value; } } } public static class SmelterDefinitions { public static readonly string KilnName = "$piece_charcoalkiln"; public static readonly string SmelterName = "$piece_smelter"; public static readonly string FurnaceName = "$piece_blastfurnace"; public static readonly string WindmillName = "$piece_windmill"; public static readonly string SpinningWheelName = "$piece_spinningwheel"; public static readonly string EitrRefineryName = "$piece_eitrrefinery"; } [HarmonyPatch(typeof(Smelter), "Awake")] public static class Smelter_Awake_Patch { private static void Prefix(ref Smelter __instance) { if (__instance.m_name.Equals(SmelterDefinitions.KilnName) && SmelterConfiguration.kilnIsEnabled.Value) { __instance.m_maxOre = SmelterConfiguration.kilnMaxWood.Value; __instance.m_secPerProduct = SmelterConfiguration.kilnSpeed.Value; } else if (__instance.m_name.Equals(SmelterDefinitions.SmelterName) && SmelterConfiguration.smelterIsEnabled.Value) { __instance.m_maxOre = SmelterConfiguration.smelterMaxOre.Value; __instance.m_maxFuel = SmelterConfiguration.smelterMaxCoal.Value; __instance.m_secPerProduct = SmelterConfiguration.smelterSpeed.Value; __instance.m_fuelPerProduct = SmelterConfiguration.smelterCoalUsedPerProduct.Value; } else if (__instance.m_name.Equals(SmelterDefinitions.FurnaceName) && SmelterConfiguration.furnaceIsEnabled.Value) { __instance.m_maxOre = SmelterConfiguration.furnaceMaxOre.Value; __instance.m_maxFuel = SmelterConfiguration.furnaceMaxCoal.Value; __instance.m_secPerProduct = SmelterConfiguration.furnaceSpeed.Value; __instance.m_fuelPerProduct = SmelterConfiguration.furnaceCoalUsedPerProduct.Value; } else if (__instance.m_name.Equals(SmelterDefinitions.WindmillName) && SmelterConfiguration.windmillIsEnabled.Value) { __instance.m_maxOre = SmelterConfiguration.windmillMaxBarley.Value; __instance.m_secPerProduct = SmelterConfiguration.windmillProductionSpeed.Value; } else if (__instance.m_name.Equals(SmelterDefinitions.SpinningWheelName) && SmelterConfiguration.spinningWheelIsEnabled.Value) { __instance.m_maxOre = SmelterConfiguration.spinningWheelMaxFlax.Value; __instance.m_secPerProduct = SmelterConfiguration.spinningWheelProductionSpeed.Value; } else if (__instance.m_name.Equals(SmelterDefinitions.EitrRefineryName) && SmelterConfiguration.eitrRefineryIsEnabled.Value) { __instance.m_maxOre = SmelterConfiguration.eitrRefineryMaxOre.Value; __instance.m_maxFuel = SmelterConfiguration.eitrRefineryMaxCoal.Value; __instance.m_secPerProduct = SmelterConfiguration.eitrRefinerySpeed.Value; __instance.m_fuelPerProduct = SmelterConfiguration.eitrRefineryCoalUsedPerProduct.Value; } } } [HarmonyPatch(typeof(Smelter), "FindCookableItem")] public static class Smelter_FindCookableItem_Transpiler { private static MethodInfo method_PreventUsingSpecificWood = AccessTools.Method(typeof(Smelter_FindCookableItem_Transpiler), "PreventUsingSpecificWood", (Type[])null, (Type[])null); [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown if (!SmelterConfiguration.kilnIsEnabled.Value) { return instructions; } int num = -1; List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Stloc_1) { list.Insert(++i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Insert(++i, new CodeInstruction(OpCodes.Ldloc_1, (object)null)); list.Insert(++i, new CodeInstruction(OpCodes.Call, (object)method_PreventUsingSpecificWood)); num = i; } else if (num != -1 && list[i].opcode == OpCodes.Brfalse) { list.Insert(++num, new CodeInstruction(OpCodes.Brtrue, list[i].operand)); return list.AsEnumerable(); } } ZLog.LogError((object)"Failed to apply Smelter_FindCookableItem_Transpiler"); return instructions; } private static bool PreventUsingSpecificWood(Smelter smelter, ItemConversion itemConversion) { if (smelter.m_name.Equals(SmelterDefinitions.KilnName) && ((SmelterConfiguration.dontProcessFineWood.Value && itemConversion.m_from.m_itemData.m_shared.m_name.Equals(TillValhalla.WoodDefinitions.FineWoodName)) || (SmelterConfiguration.dontProcessRoundLog.Value && itemConversion.m_from.m_itemData.m_shared.m_name.Equals(TillValhalla.WoodDefinitions.RoundLogName)))) { return true; } return false; } } [HarmonyPatch(typeof(Smelter), "Spawn")] public static class Smelter_Spawn_Patch { private static bool Prefix(string ore, int stack, ref Smelter __instance) { Smelter smelter = __instance; if (!smelter.m_nview.IsOwner()) { return true; } if (__instance.m_name.Equals(SmelterDefinitions.KilnName) && SmelterConfiguration.kilnIsEnabled.Value && SmelterConfiguration.kilnAutoDeposit.Value) { return spawn(helper.Clamp(SmelterConfiguration.kilnAutoRange.Value, 1f, 50f), ignorePrivateAreaCheck: false); } if (__instance.m_name.Equals(SmelterDefinitions.SmelterName) && SmelterConfiguration.smelterIsEnabled.Value && SmelterConfiguration.smelterAutoDeposit.Value) { return spawn(helper.Clamp(SmelterConfiguration.smelterAutoRange.Value, 1f, 50f), ignorePrivateAreaCheck: false); } if (__instance.m_name.Equals(SmelterDefinitions.FurnaceName) && SmelterConfiguration.furnaceIsEnabled.Value && SmelterConfiguration.furnaceAutoDeposit.Value) { return spawn(helper.Clamp(SmelterConfiguration.furnaceAutoRange.Value, 1f, 50f), ignorePrivateAreaCheck: false); } if (__instance.m_name.Equals(SmelterDefinitions.WindmillName) && SmelterConfiguration.windmillIsEnabled.Value && SmelterConfiguration.windmillAutoDeposit.Value) { return spawn(helper.Clamp(SmelterConfiguration.windmillAutoRange.Value, 1f, 50f), ignorePrivateAreaCheck: false); } if (__instance.m_name.Equals(SmelterDefinitions.SpinningWheelName) && SmelterConfiguration.spinningWheelIsEnabled.Value && SmelterConfiguration.spinningWheelAutoDeposit.Value) { return spawn(helper.Clamp(SmelterConfiguration.spinningWheelAutoRange.Value, 1f, 50f), ignorePrivateAreaCheck: false); } if (__instance.m_name.Equals(SmelterDefinitions.EitrRefineryName) && SmelterConfiguration.eitrRefineryIsEnabled.Value && SmelterConfiguration.eitrRefineryAutoDeposit.Value) { return spawn(helper.Clamp(SmelterConfiguration.eitrRefineryAutoRange.Value, 1f, 50f), ignorePrivateAreaCheck: false); } return true; bool spawn(float autoDepositRange, bool ignorePrivateAreaCheck) { List<Container> nearbyChests = InventoryAssistant.GetNearbyChests(((Component)smelter).gameObject, autoDepositRange, !ignorePrivateAreaCheck); ItemDrop comp; if (nearbyChests.Count != 0) { if (autoDepositRange > 50f) { autoDepositRange = 50f; } else if (autoDepositRange < 1f) { autoDepositRange = 1f; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(((Object)((Component)smelter.GetItemConversion(ore).m_to).gameObject).name); ZNetView.m_forceDisableInit = true; GameObject val = Object.Instantiate<GameObject>(itemPrefab); ZNetView.m_forceDisableInit = false; comp = val.GetComponent<ItemDrop>(); comp.m_itemData.m_stack = stack; bool result = spawnNearbyChest(mustHaveItem: true); Object.Destroy((Object)(object)val); return result; } return true; bool spawnNearbyChest(bool mustHaveItem) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) foreach (Container item in nearbyChests) { Inventory inventory = item.GetInventory(); if ((!mustHaveItem || inventory.HaveItem(comp.m_itemData.m_shared.m_name, true)) && inventory.AddItem(comp.m_itemData)) { smelter.m_produceEffects.Create(((Component)smelter).transform.position, ((Component)smelter).transform.rotation, (Transform)null, 1f, -1); InventoryAssistant.ConveyContainerToNetwork(item); return false; } } if (mustHaveItem) { return spawnNearbyChest(mustHaveItem: false); } return true; } } } } [HarmonyPatch(typeof(Smelter), "UpdateSmelter")] public static class Smelter_UpdateSmelter_Patch { private static void Prefix(Smelter __instance) { if ((Object)(object)__instance == (Object)null || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || (Object)(object)__instance.m_nview == (Object)null || !__instance.m_nview.IsOwner()) { return; } Stopwatch stopwatch = GameObjectAssistant.GetStopwatch(((Component)__instance).gameObject); if (stopwatch.IsRunning && stopwatch.ElapsedMilliseconds < 1000) { return; } stopwatch.Restart(); float value = 0f; bool flag = false; bool flag2 = false; if (__instance.m_name.Equals(SmelterDefinitions.KilnName)) { if (!SmelterConfiguration.kilnIsEnabled.Value || !SmelterConfiguration.kilnAutoFuel.Value) { return; } flag2 = true; value = SmelterConfiguration.kilnAutoRange.Value; flag = false; } else if (__instance.m_name.Equals(SmelterDefinitions.SmelterName)) { if (!SmelterConfiguration.smelterIsEnabled.Value || !SmelterConfiguration.smelterAutoFuel.Value) { return; } value = SmelterConfiguration.smelterAutoRange.Value; flag = false; } else if (__instance.m_name.Equals(SmelterDefinitions.FurnaceName)) { if (!SmelterConfiguration.furnaceIsEnabled.Value || !SmelterConfiguration.furnaceAutoFuel.Value) { return; } value = SmelterConfiguration.furnaceAutoRange.Value; flag = false; } else if (__instance.m_name.Equals(SmelterDefinitions.WindmillName)) { if (!SmelterConfiguration.windmillIsEnabled.Value || !SmelterConfiguration.windmillAutoFuel.Value) { return; } value = SmelterConfiguration.windmillAutoRange.Value; flag = false; } else if (__instance.m_name.Equals(SmelterDefinitions.SpinningWheelName)) { if (!SmelterConfiguration.spinningWheelIsEnabled.Value || !SmelterConfiguration.spinningWheelAutoFuel.Value) { return; } value = SmelterConfiguration.eitrRefineryAutoRange.Value; flag = false; } else if (__instance.m_name.Equals(SmelterDefinitions.EitrRefineryName)) { if (!SmelterConfiguration.eitrRefineryIsEnabled.Value || !SmelterConfiguration.eitrRefineryAutoFuel.Value) { return; } value = SmelterConfiguration.eitrRefineryAutoRange.Value; flag = false; } value = helper.Clamp(value, 1f, 50f); int num = __instance.m_maxOre - __instance.GetQueueSize(); int num2 = __instance.m_maxFuel - (int)Math.Ceiling(__instance.GetFuel()); if (Object.op_Implicit((Object)(object)__instance.m_fuelItem) && num2 > 0) { ItemData itemData = __instance.m_fuelItem.m_itemData; int num3 = InventoryAssistant.RemoveItemInAmountFromAllNearbyChests(((Component)__instance).gameObject, value, itemData, num2, !flag); for (int i = 0; i < num3; i++) { __instance.m_nview.InvokeRPC("RPC_AddFuel", Array.Empty<object>()); } if (num3 > 0) { ZLog.Log((object)("Added " + num3 + " fuel(" + itemData.m_shared.m_name + ") in " + __instance.m_name)); } } if (num <= 0) { return; } List<Container> nearbyChests = InventoryAssistant.GetNearbyChests(((Component)__instance).gameObject, value); foreach (Container item in nearbyChests) { foreach (ItemConversion item2 in __instance.m_conversion) { if (flag2) { if ((SmelterConfiguration.dontProcessFineWood.Value && item2.m_from.m_itemData.m_shared.m_name.Equals(TillValhalla.WoodDefinitions.FineWoodName)) || (SmelterConfiguration.dontProcessRoundLog.Value && item2.m_from.m_itemData.m_shared.m_name.Equals(TillValhalla.WoodDefinitions.RoundLogName))) { continue; } int num4 = ((SmelterConfiguration.kilnStopAutoFuelThreshold.Value >= 0) ? SmelterConfiguration.kilnStopAutoFuelThreshold.Value : 0); if (num4 > 0 && InventoryAssistant.GetItemAmountInItemList(InventoryAssistant.GetNearbyChestItemsByContainerList(nearbyChests), item2.m_to.m_itemData) >= num4) { return; } } ItemData itemData2 = item2.m_from.m_itemData; int num5 = InventoryAssistant.RemoveItemFromChest(item, itemData2, num); if (num5 > 0) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(((Object)((Component)item2.m_from).gameObject).name); for (int j = 0; j < num5; j++) { __instance.m_nview.InvokeRPC("RPC_AddOre", new object[1] { ((Object)itemPrefab).name }); } num -= num5; if (num5 > 0) { ZLog.Log((object)("Added " + num5 + " ores(" + itemData2.m_shared.m_name + ") in " + __instance.m_name)); } if (num == 0) { return; } } } } } } [HarmonyPatch(typeof(ZSFX), "Awake")] public static class ZSFX_Awake_Patch { public static void Postfix(ZSFX __instance) { if (!Configuration.modisenabled.Value && !ZSFXConfiguration.enabled.Value) { return; } string zSFXName = GetZSFXName(__instance); if (ZSFXConfiguration.debugMode.Value) { Logger.LogInfo((object)("Check SFX:" + zSFXName)); } Dictionary<string, Dictionary<string, AudioClip>> sFXList = TillValhalla.SFXList; if (sFXList != null && sFXList.TryGetValue(zSFXName, out var value)) { if (ZSFXConfiguration.debugMode.Value) { Logger.LogInfo((object)("replacing SFX list by name: " + zSFXName)); } __instance.m_audioClips = value.Values.ToArray(); } else { if (TillValhalla.SFX == null || __instance.m_audioClips == null) { return; } for (int i = 0; i < __instance.m_audioClips.Length; i++) { if (__instance.m_audioClips[i] == null) { continue; } if (ZSFXConfiguration.debugMode.Value) { Logger.LogInfo((object)("checking SFX: " + zSFXName + ", clip: " + ((Object)__instance.m_audioClips[i]).name)); } if (TillValhalla.SFX.TryGetValue(((Object)__instance.m_audioClips[i]).name, out var value2)) { if (ZSFXConfiguration.debugMode.Value) { Logger.LogInfo((object)("replacing SFX: " + zSFXName + ", clip: " + ((Object)__instance.m_audioClips[i]).name)); } __instance.m_audioClips[i] = value2; } } } } public static string GetZSFXName(ZSFX zfx) { string name = ((Object)zfx).name; char[] anyOf = new char[2] { '(', ' ' }; int num = name.IndexOfAny(anyOf); if (num != -1) { return name.Remove(num); } return name; } } public static class Waterproof { [HarmonyPatch(typeof(EnvMan), "IsWet")] public class EnvMan_Patch { public static bool Postfix(bool __result) { if (!PlayerConfiguration.WetFromRain.Value) { __result = iswet; } return __result; } } [HarmonyPatch(typeof(Player), "UpdateEnvStatusEffects")] public static class Player_UpdateEnvStats_Patch { public static bool Prefix() { AddingStatFromEnv++; return true; } public static void Postfix(Player __instance) { AddingStatFromEnv--; } } [HarmonyPatch(typeof(SEMan), "AddStatusEffect", new Type[] { typeof(int), typeof(bool), typeof(int), typeof(float) })] public static class SEMan_RemoveWetFromRain_Patch { public static bool Prefix(SEMan __instance, int nameHash) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!PlayerConfiguration.WetFromRain.Value && AddingStatFromEnv > 0 && __instance.m_character.IsPlayer() && nameHash == -1273337594 && iswet) { _ = (Player)__instance.m_character; return false; } return true; } } public static int AddingStatFromEnv; public static bool iswet; } [HarmonyPatch(typeof(Player), "Awake")] public static class Player_Awake_Patch { private static void Postfix(Player __instance) { if (PlayerConfiguration.enabled.Value) { __instance.m_maxCarryWeight = PlayerConfiguration.basemaximumweight.Value; __instance.m_baseHP = PlayerConfiguration.basehp.Value; __instance.m_baseStamina = PlayerConfiguration.basestamina.Value; } } } [HarmonyPatch(typeof(SE_Rested), "GetNearbyComfortPieces")] public static class SE_Rested_GetNearbyComfortPieces_Transpiler { private static readonly MethodInfo RangeValueGetter = AccessTools.DeclaredMethod(typeof(SE_Rested_GetNearbyComfortPieces_Transpiler), "getRangeValue", (Type[])null, (Type[])null); public static float getRangeValue() { return 10f; } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); List<CodeInstruction> list2 = new List<CodeInstruction>(); for (int i = 0; i < list.Count(); i++) { CodeInstruction val = list[i]; if (val.opcode == OpCodes.Ldc_R4 && CodeInstructionExtensions.OperandIs(val, (object)10)) { val = new CodeInstruction(OpCodes.Callvirt, (object)RangeValueGetter); } list2.Add(val); } return list2; } } [HarmonyPatch(typeof(SE_Stats), "Setup")] public static class SE_Stats_Setup_Patch { private static void Postfix(ref SE_Stats __instance) { if (PlayerConfiguration.enabled.Value) { _ = __instance.m_addMaxCarryWeight; if (__instance.m_addMaxCarryWeight > 0f) { __instance.m_addMaxCarryWeight = __instance.m_addMaxCarryWeight - 150f + PlayerConfiguration.baseMegingjordBuff.Value; } } } } [HarmonyPatch(typeof(Player), "HaveRequirementItems", new Type[] { typeof(Recipe), typeof(bool), typeof(int), typeof(int) })] public static class Player_HaveRequirementItems_Transpiler { private static MethodInfo method_Inventory_CountItems = AccessTools.Method(typeof(Inventory), "CountItems", (Type[])null, (Type[])null); private static MethodInfo method_ComputeItemQuantity = AccessTools.Method(typeof(Player_HaveRequirementItems_Transpiler), "ComputeItemQuantity", (Type[])null, (Type[])null); [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown if (!CraftingStationConfiguration.craftFromChests.Value) { return instructions; } List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], method_Inventory_CountItems)) { list.Insert(++i, new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Insert(++i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Insert(++i, new CodeInstruction(OpCodes.Call, (object)method_ComputeItemQuantity)); } } return list.AsEnumerable(); } private static int ComputeItemQuantity(int fromInventory, Requirement item, Player player) { CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); GameObject val = ((currentCraftingStation != null) ? ((Component)currentCraftingStation).gameObject : null); Stopwatch stopwatch; if (!Object.op_Implicit((Object)(object)val) || !CraftingStationConfiguration.craftFromWorkbench.Value) { val = ((Component)player).gameObject; stopwatch = Inventory_NearbyChests_Cache.delta; } else { stopwatch = GameObjectAssistant.GetStopwatch(val); } int num = helper.Clamp(3, 1, 10) * 1000; if (!stopwatch.IsRunning || stopwatch.ElapsedMilliseconds > num) { Inventory_NearbyChests_Cache.chests = InventoryAssistant.GetNearbyChests(val, helper.Clamp(CraftingStationConfiguration.craftFromChestRange.Value, 1, 50), !CraftingStationConfiguration.ignorePrivateAreaCheck.Value); stopwatch.Restart(); } return fromInventory + InventoryAssistant.GetItemAmountInItemList(InventoryAssistant.GetNearbyChestItemsByContainerList(Inventory_NearbyChests_Cache.chests), item.m_resItem.m_itemData); } } [HarmonyPatch(typeof(Player), "HaveRequirements", new Type[] { typeof(Piece), typeof(RequirementMode) })] public static class Player_HaveRequirements_Transpiler { private static MethodInfo method_Inventory_CountItems = AccessTools.Method(typeof(Inventory), "CountItems", (Type[])null, (Type[])null); private static MethodInfo method_ComputeItemQuantity = AccessTools.Method(typeof(Player_HaveRequirements_Transpiler), "ComputeItemQuantity", (Type[])null, (Type[])null); [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown if (!CraftingStationConfiguration.craftFromChests.Value) { return instructions; } List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (CodeInstructionExtensions.Calls(list[i], method_Inventory_CountItems)) { list.Insert(++i, new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Insert(++i, new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Insert(++i, new CodeInstruction(OpCodes.Call, (object)method_ComputeItemQuantity)); } } return list.AsEnumerable(); } private static int ComputeItemQuantity(int fromInventory, Requirement item, Player player) { CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); GameObject val = ((currentCraftingStation != null) ? ((Component)currentCraftingStation).gameObject : null); Stopwatch stopwatch; if (!Object.op_Implicit((Object)(object)val) || !CraftingStationConfiguration.craftFromWorkbench.Value) { val = ((Component)player).gameObject; stopwatch = Inventory_NearbyChests_Cache.delta; } else { stopwatch = GameObjectAssistant.GetStopwatch(val); } int num = helper.Clamp(3, 1, 10) * 1000; if (!stopwatch.IsRunning || stopwatch.ElapsedMilliseconds > num) { Inventory_NearbyChests_Cache.chests = InventoryAssistant.GetNearbyChests(val, helper.Clamp(CraftingStationConfiguration.craftFromChestRange.Value, 1, 50), !CraftingStationConfiguration.ignorePrivateAreaCheck.Value); stopwatch.Restart(); } return fromInventory + InventoryAssistant.GetItemAmountInItemList(InventoryAssistant.GetNearbyChestItemsByContainerList(Inventory_NearbyChests_Cache.chests), item.m_resItem.m_itemData); } } [HarmonyPatch(typeof(Player), "ConsumeResources", new Type[] { typeof(Requirement[]), typeof(int), typeof(int), typeof(int) })] public static class Player_ConsumeResources_Transpiler { private static MethodInfo method_Inventory_RemoveItem = AccessTools.Method(typeof(Inventory), "RemoveItem", new Type[4] { typeof(string), typeof(int), typeof(int), typeof(bool) }, (Type[])null); private static MethodInfo method_RemoveItemsFromInventoryAndNearbyChests = AccessTools.Method(typeof(Player_ConsumeResources_Transpiler), "RemoveItemsFromInventoryAndNearbyChests", (Type[])null, (Type[])null); [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown if (!CraftingStationConfiguration.craftFromChests.Value) { return instructions; } List<CodeInstruction> list = instructions.ToList(); int num = -1; int num2 = -1; for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldarg_0) { num = i; } else if (CodeInstructionExtensions.Calls(list[i], method_Inventory_RemoveItem)) { num2 = i; break; } } if (num == -1 || num2 == -1) { ZLog.LogError((object)"Failed to apply Player_ConsumeResources_Transpiler"); return instructions; } list.RemoveRange(num + 1, num2 - num); list.Insert(++num, new CodeInstruction(OpCodes.Ldloc_2, (object)null)); list.Insert(++num, new CodeInstruction(OpCodes.Ldloc_3, (object)null)); list.Insert(++num, new CodeInstruction(OpCodes.Ldarg_3, (object)null)); list.Insert(++num, new CodeInstruction(OpCodes.Call, (object)method_RemoveItemsFromInventoryAndNearbyChests)); return list.AsEnumerable(); } private static void RemoveItemsFromInventoryAndNearbyChests(Player player, Requirement item, int amount, int itemQuality) { CraftingStation currentCraftingStation = player.GetCurrentCraftingStation(); GameObject val = ((currentCraftingStation != null) ? ((Component)currentCraftingStation).gameObject : null); if (!Object.op_Implicit((Object)(object)val) || !CraftingStationConfiguration.craftFromWorkbench.Value) { val = ((Component)player).gameObject; } int num = ((Humanoid)player).m_inventory.CountItems(item.m_resItem.m_itemData.m_shared.m_name, -1, true); ((Humanoid)player).m_inventory.RemoveItem(item.m_resItem.m_itemData.m_shared.m_name, amount, itemQuality, true); amount -= num; if (amount > 0) { InventoryAssistant.RemoveItemInAmountFromAllNearbyChests(val, helper.Clamp(CraftingStationConfiguration.craftFromChestRange.Value, 1, 50), item.m_resItem.m_itemData, amount, !CraftingStationConfiguration.ignorePrivateAreaCheck.Value); } } } [HarmonyPatch(typeof(Player), "GetFirstRequiredItem")] public static class Player_GetFirstRequiredItem_Transpiler { [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions) { List<CodeInstruction> list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Ldarg_0) { list[i].opcode = OpCodes.Ldarg_1; list.RemoveAt(i + 1); return list.AsEnumerable(); } } return instructions; } } [HarmonyPatch(typeof(Ship), "Awake")] public static class Ship_Awake_Patch { public static void Postfix(Ship __instance) { __instance.m_stearForce = ShipConfiguration.stearforce.Value; __instance.m_rudderSpeed = ShipConfiguration.rudderspeed.Value; __instance.m_sailForceFactor = ShipConfiguration.sailforcefactor.Value; } } } namespace TillValhalla.Configurations { public class Configuration { public static ConfigEntry<bool> modisenabled; public static void Awake(BaseUnityPlugin cfg) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown modisenabled = cfg.Config.Bind<bool>("1. General", "isenabled", true, new ConfigDescription("Set this to true to enable this mod", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } } } namespace TillValhalla.Configurations.Sections { public class BeehiveConfiguration { public static ConfigEntry<bool> enabled; public static ConfigEntry<int> beehivemaxhoney; public static ConfigEntry<float> beehiveHoneyProductionSpeed; public static void Awake(BaseUnityPlugin Plugin) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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 Plugin.Config.SaveOnConfigSet = true; enabled = Plugin.Config.Bind<bool>("Beehive", "enabled", false, new ConfigDescription("Set this to true if you want this section enabled", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); beehivemaxhoney = Plugin.Config.Bind<int>("Beehive", "beehivemaxhoney", 1, new ConfigDescription("This is the max amount of honey allowed in beehives", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); beehiveHoneyProductionSpeed = Plugin.Config.Bind<float>("Beehive", "beehiveHoneyProductionSpeed", 1200f, new ConfigDescription("Speed of honey production in seconds", (AcceptableValueBase)(object)new AcceptableValueRange<float>(20f, 20000f), new object[1] { (object)new ConfigurationManagerAttributes { IsAdminOnly = true } })); } } public class containerconfiguration { public static ConfigEntry<bool> enabled; public static ConfigEntry<int> woodChestInventoryRows; public static ConfigEntry<int> woodChestInventoryCol; public static ConfigEntry<int> ironChestRows; public static ConfigEntry<int> ironChestCol; public static ConfigEntry<int> blackMetalChestRows; public static ConfigEntry<int> blackMetalChestCol; public static ConfigEntry<int> privateChestRows; public static ConfigEntry<int> privateChestCol; public static ConfigEntry<int> karveChestRows; public static ConfigEntry<int> karveChestCol; public static ConfigEntry<int> vikingshipChestRows; public static ConfigEntry<int> vikingshipChestCol; public static ConfigEntry<int> cartChestRows; public static ConfigEntry<int> cartChestCol; public static void Awake(BaseUnityPlugin containercfg) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL o