using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using JetBrains.Annotations;
using Microsoft.CodeAnalysis;
using ServerSync;
using SoftReferenceableAssets;
using TMPro;
using UnityEngine;
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyFileVersion("1.20.0.0")]
[assembly: Guid("85f3bb36-d51d-4e6c-a523-feb593b3156f")]
[assembly: ComVisible(false)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyProduct("Valheim Game Modification")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyTitle("Advize_PlantEverything")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.20.0.0")]
[module: <61d5a0c8-7033-4c14-9538-d7c2ea223f4e>RefSafetyRules(11)]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[<84adf9e7-029e-45be-a120-84c13b7de805>Embedded]
internal sealed class <84adf9e7-029e-45be-a120-84c13b7de805>EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
[CompilerGenerated]
[<84adf9e7-029e-45be-a120-84c13b7de805>Embedded]
internal sealed class <b6194257-56e0-4089-8df8-6802074f0169>NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public <b6194257-56e0-4089-8df8-6802074f0169>NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public <b6194257-56e0-4089-8df8-6802074f0169>NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
[<84adf9e7-029e-45be-a120-84c13b7de805>Embedded]
[CompilerGenerated]
internal sealed class <bf8dd59c-bead-48b7-8dff-298aa7098003>NullableContextAttribute : Attribute
{
public readonly byte Flag;
public <bf8dd59c-bead-48b7-8dff-298aa7098003>NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
[<84adf9e7-029e-45be-a120-84c13b7de805>Embedded]
internal sealed class <61d5a0c8-7033-4c14-9538-d7c2ea223f4e>RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public <61d5a0c8-7033-4c14-9538-d7c2ea223f4e>RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
internal class ConfigurationManagerAttributes
{
public bool? Browsable;
[<b6194257-56e0-4089-8df8-6802074f0169>Nullable(2)]
public string Category;
public int? Order;
public bool? ReadOnly;
}
namespace Advize_PlantEverything
{
public static class SeasonsCompatibility
{
private static bool _isInitialized;
private static bool _isReady;
private const string GUID = "shudnal.Seasons";
private static Assembly _assembly;
private static FieldInfo _seasonState;
private static MethodInfo _getSecondsToRespawnPickable;
private static MethodInfo _getSecondsToGrowPlant;
public static bool IsReady
{
get
{
if (!_isInitialized)
{
Initialize();
}
return _isReady;
}
}
public static double GetSecondsToRespawnPickable(Pickable pickable)
{
return (double)_getSecondsToRespawnPickable.Invoke(_seasonState.GetValue(_seasonState), new object[1] { pickable });
}
public static double GetSecondsToGrowPlant(Plant plant)
{
return (double)_getSecondsToGrowPlant.Invoke(_seasonState.GetValue(_seasonState), new object[1] { plant });
}
private static void Initialize()
{
_isInitialized = true;
if (Chainloader.PluginInfos.TryGetValue("shudnal.Seasons", out var value))
{
_assembly = Assembly.GetAssembly(((object)value.Instance).GetType());
if (_assembly != null)
{
_seasonState = AccessTools.Field(_assembly.GetType("Seasons.Seasons"), "seasonState");
_getSecondsToRespawnPickable = AccessTools.Method(_seasonState.FieldType, "GetSecondsToRespawnPickable", (Type[])null, (Type[])null);
_getSecondsToGrowPlant = AccessTools.Method(_seasonState.FieldType, "GetSecondsToGrowPlant", (Type[])null, (Type[])null);
}
}
_isReady = _seasonState != null && _getSecondsToRespawnPickable != null && _getSecondsToGrowPlant != null;
}
}
internal static class ConfigEventHandlers
{
private static bool s_reInitQueueInProcess = false;
private static bool s_isLocalConfigChange = false;
private static bool s_configSettingChangedFirst = false;
private static bool s_configFileChangedFirst = false;
private static readonly HashSet<Action> s_reInitMethodSet = new HashSet<Action>();
private static readonly Queue<Action> s_reInitMethodQueue = new Queue<Action>();
private static readonly Dictionary<string, Action[]> s_initMethods = new Dictionary<string, Action[]>
{
{
"Core",
new Action[7]
{
PluginInitUtils.InitPieceRefs,
PluginInitUtils.InitPieces,
PluginInitUtils.InitSaplingRefs,
PluginInitUtils.InitSaplings,
PluginInitUtils.InitCrops,
PluginInitUtils.InitVines,
PluginInitUtils.InitCultivator
}
},
{
"Piece",
new Action[3]
{
PluginInitUtils.InitPieceRefs,
PluginInitUtils.InitPieces,
PluginInitUtils.InitCultivator
}
},
{
"Sapling",
new Action[3]
{
PluginInitUtils.InitSaplingRefs,
PluginInitUtils.InitSaplings,
PluginInitUtils.InitCultivator
}
},
{
"Seed",
new Action[1] { PluginInitUtils.ModifyTreeDrops }
},
{
"Crop",
new Action[1] { PluginInitUtils.InitCrops }
},
{
"Vine",
new Action[1] { PluginInitUtils.InitVines }
}
};
private static bool PerformingLocalConfigChange
{
get
{
return s_isLocalConfigChange;
}
set
{
StaticMembers.Dbgl("Config change " + (value ? "is" : "was") + " local.", forceLog: false, (LogLevel)16);
s_isLocalConfigChange = value;
}
}
private static bool ShouldQueueMethod
{
get
{
if (!StaticMembers.isDedicatedServer && !StaticMembers.config.IsSourceOfTruth)
{
return !PerformingLocalConfigChange;
}
return false;
}
}
private static void QueueReInitMethod(Action method)
{
if (!s_reInitQueueInProcess)
{
StaticMembers.Dbgl("Beginning method queue.", forceLog: false, (LogLevel)16);
s_reInitQueueInProcess = true;
}
if (s_reInitMethodSet.Add(method))
{
StaticMembers.Dbgl("Adding method to queue.", forceLog: false, (LogLevel)16);
s_reInitMethodQueue.Enqueue(method);
}
}
internal static void ProcessReInitQueue()
{
StaticMembers.Dbgl("Processing ReInit queue.", forceLog: false, (LogLevel)16);
if (s_reInitMethodQueue.Count == 0 && !StaticMembers.isDedicatedServer && !StaticMembers.config.IsSourceOfTruth && StaticMembers.config.InitialSyncDone)
{
PerformingLocalConfigChange = true;
return;
}
while (s_reInitMethodQueue.Count > 0)
{
s_reInitMethodQueue.Dequeue()();
}
s_reInitMethodSet.Clear();
s_reInitQueueInProcess = false;
}
private static void HandleSettingChange(string category)
{
if (ShouldQueueMethod)
{
Array.ForEach(s_initMethods[category], QueueReInitMethod);
return;
}
Array.ForEach(s_initMethods[category], delegate(Action initMethod)
{
initMethod();
});
PerformingLocalConfigChange = false;
}
internal static void CoreSettingChanged(object o, EventArgs e)
{
StaticMembers.Dbgl("Config setting changed, scheduling re-initialization of mod", forceLog: false, (LogLevel)16);
HandleSettingChange("Core");
}
internal static void PieceSettingChanged(object o, EventArgs e)
{
StaticMembers.Dbgl("Config setting changed, scheduling re-initialization of pieces", forceLog: false, (LogLevel)16);
HandleSettingChange("Piece");
}
internal static void SaplingSettingChanged(object o, EventArgs e)
{
StaticMembers.Dbgl("Config setting changed, scheduling re-initialization of saplings", forceLog: false, (LogLevel)16);
HandleSettingChange("Sapling");
}
internal static void SeedSettingChanged(object o, EventArgs e)
{
StaticMembers.Dbgl("Config setting changed, scheduling modification of TreeBase drop tables", forceLog: false, (LogLevel)16);
HandleSettingChange("Seed");
}
internal static void CropSettingChanged(object o, EventArgs e)
{
StaticMembers.Dbgl("Config setting changed, scheduling re-initialization of crops", forceLog: false, (LogLevel)16);
HandleSettingChange("Crop");
}
internal static void VineSettingChanged(object o, EventArgs e)
{
StaticMembers.Dbgl("Config setting changed, scheduling re-initialization of vines", forceLog: false, (LogLevel)16);
HandleSettingChange("Vine");
}
internal static void ExtraResourcesChanged()
{
StaticMembers.Dbgl("ExtraResourcesChanged", forceLog: false, (LogLevel)16);
StaticMembers.deserializedExtraResources.Clear();
foreach (string item2 in StaticMembers.config.SyncedExtraResources.Value)
{
ExtraResource item = PluginUtils.DeserializeExtraResource(item2);
StaticMembers.deserializedExtraResources.Add(item);
}
if (Object.op_Implicit((Object)(object)ZNetScene.s_instance))
{
PluginInitUtils.InitExtraResourceRefs(ZNetScene.s_instance);
PieceSettingChanged(null, null);
}
}
internal static void ExtraResourcesFileOrSettingChanged(object sender, EventArgs e)
{
StaticMembers.Dbgl("ExtraResources file or setting has changed", forceLog: false, (LogLevel)16);
if (ConfigWatcher.ExtraResourcesWatcher == null)
{
ConfigWatcher.InitExtraResourcesWatcher();
}
if (StaticMembers.config.IsSourceOfTruth)
{
if (StaticMembers.config.EnableExtraResources)
{
StaticMembers.Dbgl("IsSourceOfTruth: true, loading extra resources from disk", forceLog: false, (LogLevel)16);
PluginUtils.LoadExtraResources();
}
else
{
StaticMembers.config.SyncedExtraResources.AssignLocalValue(new List<string>());
}
}
else
{
StaticMembers.Dbgl("IsSourceOfTruth: false, extra resources will not be loaded from disk", forceLog: false, (LogLevel)16);
}
}
internal static void ConfigSettingChanged(object sender, EventArgs e)
{
if (!s_configFileChangedFirst && !ShouldQueueMethod)
{
s_configSettingChangedFirst = true;
StaticMembers.Dbgl("SAVING", forceLog: false, (LogLevel)16);
StaticMembers.config.Save();
}
else
{
s_configFileChangedFirst = false;
}
}
internal static void ConfigFileChanged(object sender, EventArgs e)
{
s_configFileChangedFirst = !s_configSettingChangedFirst;
if (StaticMembers.isDedicatedServer || s_configFileChangedFirst)
{
StaticMembers.Dbgl("RELOADING", forceLog: false, (LogLevel)16);
StaticMembers.config.Reload();
}
s_configSettingChangedFirst = false;
}
internal static void ConfigManagerDisplayingWindowChanged(object sender, EventArgs e)
{
if (!ConfigManagerHelper.IsConfigManagerWindowActive)
{
StaticMembers.Dbgl("Configuration Manager Window Closed", forceLog: false, (LogLevel)16);
}
}
}
[<b6194257-56e0-4089-8df8-6802074f0169>Nullable(0)]
[<bf8dd59c-bead-48b7-8dff-298aa7098003>NullableContext(2)]
internal class ConfigManagerHelper
{
private static object _configManagerInstance;
private static Type _configManagerType;
private static MethodInfo _buildSettingList;
private static PropertyInfo _displayingWindowProperty;
internal static bool IsConfigManagerWindowActive
{
get
{
object obj = _displayingWindowProperty?.GetValue(_configManagerInstance);
bool flag = default(bool);
int num;
if (obj is bool)
{
flag = (bool)obj;
num = 1;
}
else
{
num = 0;
}
return (byte)((uint)num & (flag ? 1u : 0u)) != 0;
}
}
internal static void Initialize()
{
_configManagerType = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault([<bf8dd59c-bead-48b7-8dff-298aa7098003>NullableContext(0)] (Assembly a) => a.GetName().Name == "ConfigurationManager")?.GetType("ConfigurationManager.ConfigurationManager");
_configManagerInstance = ((_configManagerType == null) ? null : Chainloader.ManagerObject.GetComponent(_configManagerType));
_buildSettingList = _configManagerType?.GetMethod("BuildSettingList");
_displayingWindowProperty = _configManagerType?.GetProperty("DisplayingWindow");
EventInfo eventInfo = _configManagerInstance?.GetType().GetEvent("DisplayingWindowChanged");
if ((object)eventInfo != null)
{
EventHandler eventHandler = ConfigEventHandlers.ConfigManagerDisplayingWindowChanged;
Delegate handler = Delegate.CreateDelegate(eventInfo.EventHandlerType, eventHandler.Target, eventHandler.Method);
eventInfo.AddEventHandler(_configManagerInstance, handler);
}
}
internal static void ReloadConfigDisplay()
{
_buildSettingList?.Invoke(_configManagerInstance, Array.Empty<object>());
}
}
internal sealed class ConfigWatcher
{
internal static FileSystemWatcher ExtraResourcesWatcher;
internal static void InitConfigWatcher()
{
FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, "advize.PlantEverything.cfg");
fileSystemWatcher.Changed += ConfigEventHandlers.ConfigFileChanged;
fileSystemWatcher.Created += ConfigEventHandlers.ConfigFileChanged;
fileSystemWatcher.Renamed += ConfigEventHandlers.ConfigFileChanged;
fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
fileSystemWatcher.IncludeSubdirectories = true;
fileSystemWatcher.EnableRaisingEvents = true;
}
internal static void InitExtraResourcesWatcher()
{
ExtraResourcesWatcher = new FileSystemWatcher(StaticMembers.CustomConfigPath, "ExtraResources.json");
ExtraResourcesWatcher.Changed += ConfigEventHandlers.ExtraResourcesFileOrSettingChanged;
ExtraResourcesWatcher.Created += ConfigEventHandlers.ExtraResourcesFileOrSettingChanged;
ExtraResourcesWatcher.Renamed += ConfigEventHandlers.ExtraResourcesFileOrSettingChanged;
ExtraResourcesWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject;
ExtraResourcesWatcher.IncludeSubdirectories = true;
ExtraResourcesWatcher.EnableRaisingEvents = true;
}
}
internal struct ExtraResource
{
public string prefabName;
public string resourceName;
public int resourceCost;
public bool groundOnly;
public string pieceName;
public string pieceDescription;
internal readonly bool IsValid()
{
if (prefabName != null && !prefabName.StartsWith("PE_Fake") && resourceName != null)
{
return resourceCost != 0;
}
return false;
}
}
internal static class PluginInitUtils
{
internal static void InitPrefabRefs()
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Expected O, but got Unknown
StaticMembers.Dbgl("InitPrefabRefs", forceLog: false, (LogLevel)16);
if (StaticMembers.prefabRefs.Count > 0)
{
return;
}
Dictionary<string, AssetID> allAssetPathsInBundleMappedToAssetID = Runtime.GetAllAssetPathsInBundleMappedToAssetID();
bool flag = false;
StaticContent.VanillaPrefabRefs.ForEach(delegate(string s)
{
StaticMembers.prefabRefs.Add(s, null);
});
StaticContent.VanillaPrefabRefs.Clear();
StaticMembers.deserializedExtraResources.ForEach(delegate(ExtraResource er)
{
StaticMembers.prefabRefs[er.prefabName] = null;
});
SoftReference<GameObject> val = default(SoftReference<GameObject>);
foreach (string key3 in allAssetPathsInBundleMappedToAssetID.Keys)
{
if (!key3.EndsWith(".prefab", StringComparison.Ordinal))
{
continue;
}
string key2 = key3.Split(new char[1] { '/' }).Last().Replace(".prefab", "");
if (StaticMembers.prefabRefs.ContainsKey(key2))
{
val..ctor(allAssetPathsInBundleMappedToAssetID[key3]);
val.Load();
StaticMembers.prefabRefs[key2] = val.Asset;
if (!StaticMembers.prefabRefs.Any((KeyValuePair<string, GameObject> key) => !Object.op_Implicit((Object)(object)key.Value)))
{
StaticMembers.Dbgl("Found all prefab references.", forceLog: false, (LogLevel)16);
flag = true;
break;
}
}
}
if (!flag)
{
StaticMembers.Dbgl("Could not find all prefab references, attempting alternate prefab detection method.", forceLog: false, (LogLevel)16);
List<string> list = (from key in StaticMembers.prefabRefs
where !Object.op_Implicit((Object)(object)key.Value)
select key into kvp
select kvp.Key).ToList();
Object[] array = Resources.FindObjectsOfTypeAll(typeof(GameObject));
for (int i = 0; i < array.Length; i++)
{
GameObject val2 = (GameObject)array[i];
if (list.Contains(((Object)val2).name))
{
StaticMembers.prefabRefs[((Object)val2).name] = val2;
list.Remove(((Object)val2).name);
if (!list.Any())
{
StaticMembers.Dbgl("Found all prefab references on second attempt.", forceLog: false, (LogLevel)16);
break;
}
}
}
foreach (string item in list)
{
StaticMembers.Dbgl("prefabRefs[" + item + "] value is null, removing key and value pair.", forceLog: false, (LogLevel)16);
StaticMembers.prefabRefs.Remove(item);
}
}
StaticContent.CustomPrefabRefs.ForEach(delegate(string s)
{
StaticMembers.prefabRefs.Add(s, PluginUtils.CreatePrefab(s));
});
StaticContent.CustomPrefabRefs.Clear();
}
internal static bool InitExtraResourceRefs(ZNetScene instance, bool logErrors = false)
{
StaticMembers.Dbgl("InitExtraResourceRefs", forceLog: false, (LogLevel)16);
bool result = false;
foreach (ExtraResource deserializedExtraResource in StaticMembers.deserializedExtraResources)
{
if (!StaticMembers.prefabRefs.TryGetValue(deserializedExtraResource.prefabName, out var value))
{
value = instance.GetPrefab(deserializedExtraResource.prefabName);
if (Object.op_Implicit((Object)(object)value))
{
StaticMembers.prefabRefs[deserializedExtraResource.prefabName] = value;
StaticMembers.Dbgl("Added " + deserializedExtraResource.prefabName + " to prefabRefs", forceLog: false, (LogLevel)16);
result = true;
}
else
{
StaticMembers.Dbgl("Could not find prefab reference for " + deserializedExtraResource.prefabName + ", skipping entry.", logErrors || StaticMembers.config.EnableDebugMessages, (LogLevel)4);
}
}
}
return result;
}
internal static void InitPieceRefs()
{
StaticMembers.Dbgl("InitPieceRefs", forceLog: false, (LogLevel)16);
if (StaticMembers.pieceRefs.Count > 0)
{
PluginUtils.RemoveFromCultivator(StaticMembers.pieceRefs.ConvertAll((Converter<PieceDB, PrefabDB>)((PieceDB x) => x)));
StaticMembers.pieceRefs.Clear();
}
StaticMembers.pieceRefs = StaticContent.GeneratePieceRefs();
}
internal static void InitPieces()
{
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Expected O, but got Unknown
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Expected O, but got Unknown
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Expected O, but got Unknown
//IL_03be: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
StaticMembers.Dbgl("InitPieces", forceLog: false, (LogLevel)16);
foreach (PieceDB pdb in StaticMembers.pieceRefs)
{
if (StaticMembers.config.DisabledResourceNames.Contains(pdb.key))
{
StaticMembers.Dbgl("Resource disabled: " + pdb.key + ", skipping.", forceLog: false, (LogLevel)16);
pdb.enabled = false;
}
ItemDrop component = ObjectDB.instance.GetItemPrefab(pdb.Resource.Key).GetComponent<ItemDrop>();
if (pdb.Resources.Count > 0)
{
List<Requirement> list = new List<Requirement>();
foreach (string key in pdb.Resources.Keys)
{
list.Add(new Requirement
{
m_resItem = ObjectDB.instance.GetItemPrefab(key).GetComponent<ItemDrop>(),
m_amount = pdb.Resources[key],
m_recover = pdb.recover
});
}
pdb.Piece.m_resources = list.ToArray();
}
else
{
pdb.Piece.m_resources = (Requirement[])(object)new Requirement[1]
{
new Requirement
{
m_resItem = component,
m_amount = pdb.ResourceCost,
m_recover = pdb.recover
}
};
}
pdb.Piece.m_icon = (pdb.icon ? PluginUtils.CreateSprite(pdb.key + "PieceIcon.png", new Rect(0f, 0f, 64f, 64f)) : component.m_itemData.GetIcon());
pdb.Piece.m_placeEffect.m_effectPrefabs = (EffectData[])(object)new EffectData[2]
{
new EffectData
{
m_prefab = StaticMembers.prefabRefs["vfx_Place_wood_pole"],
m_enabled = true
},
new EffectData
{
m_prefab = StaticMembers.prefabRefs["sfx_build_cultivator"],
m_enabled = true
}
};
if (pdb.snapPoints != null)
{
Transform val = pdb.Prefab.transform.Find("_snappoint");
if (StaticMembers.config.SnappableVines)
{
if (!Object.op_Implicit((Object)(object)val))
{
foreach (Vector3 snapPoint in pdb.snapPoints)
{
GameObject val2 = new GameObject("_snappoint")
{
tag = "snappoint"
};
val2.transform.position = snapPoint;
val2.transform.SetParent(pdb.Prefab.transform);
val2.SetActive(false);
}
}
}
else
{
while (Object.op_Implicit((Object)(object)val))
{
Object.DestroyImmediate((Object)(object)((Component)val).gameObject);
val = pdb.Prefab.transform.Find("_snappoint");
}
}
}
Pickable component2 = pdb.Prefab.GetComponent<Pickable>();
if (!Object.op_Implicit((Object)(object)component2) || StaticMembers.deserializedExtraResources.Any((ExtraResource x) => x.prefabName == pdb.key))
{
continue;
}
component2.m_respawnTimeMinutes = pdb.respawnTime;
component2.m_amount = pdb.resourceReturn;
pdb.Piece.m_onlyInBiome = pdb.biome;
if (pdb.hideWhenPicked)
{
component2.m_hideWhenPicked = ((pdb.respawnTime > 0) ? ((Component)component2).gameObject : null);
}
Transform val3 = pdb.Prefab.transform.Find("visual");
if (!Object.op_Implicit((Object)(object)val3))
{
continue;
}
Transform val4 = StaticMembers.prefabRefs[pdb.key + "_Picked"].transform.Find("PE_Picked");
if (Object.op_Implicit((Object)(object)val4))
{
if (StaticMembers.config.ShowPickableSpawners)
{
val4.SetParent(pdb.Prefab.transform);
}
if (!StaticMembers.piecesInitialized)
{
MeshRenderer component3 = ((Component)val4).GetComponent<MeshRenderer>();
MeshRenderer component4 = ((Component)val3).GetComponent<MeshRenderer>();
((Renderer)component3).sharedMaterials = ((pdb.key == "Pickable_Thistle") ? ((Renderer)((Component)val3.Find("default")).GetComponent<MeshRenderer>()).sharedMaterials : ((Renderer)component4).sharedMaterials);
if (pdb.key.Contains("Dandelion"))
{
Material val5 = ((Renderer)component4).sharedMaterials[0];
((Renderer)component3).sharedMaterials = (Material[])(object)new Material[2] { val5, val5 };
}
}
}
else
{
Transform val6 = StaticMembers.prefabRefs[pdb.key].transform.Find("PE_Picked");
if (!StaticMembers.config.ShowPickableSpawners && Object.op_Implicit((Object)(object)val6))
{
val6.SetParent(StaticMembers.prefabRefs[pdb.key + "_Picked"].transform);
}
}
if (pdb.extraDrops)
{
component2.m_extraDrops.m_drops.Clear();
}
}
StaticMembers.piecesInitialized = true;
}
internal static void InitSaplingRefs()
{
StaticMembers.Dbgl("InitSaplingRefs", forceLog: false, (LogLevel)16);
if (StaticMembers.saplingRefs.Count > 0)
{
PluginUtils.RemoveFromCultivator(StaticMembers.saplingRefs.ConvertAll((Converter<SaplingDB, PrefabDB>)((SaplingDB x) => x)));
StaticMembers.saplingRefs.Clear();
}
StaticMembers.saplingRefs = StaticContent.GenerateCustomSaplingRefs();
}
internal static void InitSaplings()
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: 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_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_094c: Unknown result type (might be due to invalid IL or missing references)
//IL_0958: Unknown result type (might be due to invalid IL or missing references)
//IL_0959: Unknown result type (might be due to invalid IL or missing references)
//IL_095b: Unknown result type (might be due to invalid IL or missing references)
//IL_0960: Unknown result type (might be due to invalid IL or missing references)
//IL_0962: Unknown result type (might be due to invalid IL or missing references)
//IL_0953: Unknown result type (might be due to invalid IL or missing references)
//IL_078a: Unknown result type (might be due to invalid IL or missing references)
StaticMembers.Dbgl("InitSaplings", forceLog: false, (LogLevel)16);
ModifyTreeDrops();
AssetID val2 = default(AssetID);
SoftReference<Shader> val3 = default(SoftReference<Shader>);
foreach (SaplingDB item in StaticContent.GenerateVanillaSaplingRefs().Concat(StaticMembers.saplingRefs))
{
Plant component = item.Prefab.GetComponent<Plant>();
Piece component2 = item.Prefab.GetComponent<Piece>();
component.m_growTime = (component.m_growTimeMax = item.growTime);
component.m_growRadius = item.growRadius;
component.m_minScale = item.minScale;
component.m_maxScale = item.maxScale;
component2.m_onlyInBiome = (component.m_biome = item.biome);
component.m_tolerateCold = item.tolerateCold || !StaticMembers.config.PlantsRequireShielding;
component.m_tolerateHeat = item.tolerateHeat || !StaticMembers.config.PlantsRequireShielding;
component.m_destroyIfCantGrow = (component2.m_groundOnly = !StaticMembers.config.PlaceAnywhere);
if (!StaticMembers.saplingRefs.Contains(item))
{
continue;
}
component.m_grownPrefabs = item.grownPrefabs;
List<Requirement> list = new List<Requirement>();
foreach (string key in item.Resources.Keys)
{
list.Add(new Requirement
{
m_resItem = ObjectDB.instance.GetItemPrefab(key).GetComponent<ItemDrop>(),
m_amount = item.Resources[key],
m_recover = false
});
}
component2.m_resources = list.ToArray();
if (StaticMembers.config.DisabledResourceNames.Contains(item.key))
{
StaticMembers.Dbgl("Resource disabled: " + item.key, forceLog: false, (LogLevel)16);
item.enabled = false;
}
if (StaticMembers.saplingsInitialized)
{
continue;
}
string[] array = new string[2] { "healthy", "unhealthy" };
Transform val = StaticMembers.prefabRefs["Birch_Sapling"].transform.Find(array[0]);
Shader shader;
if (!StaticMembers.isDedicatedServer)
{
AssetID.TryParse("f6de4704e075b4095ae641aed283b641", ref val2);
val3..ctor(val2);
val3.Load();
shader = val3.Asset;
}
else
{
shader = Shader.Find("Custom/Piece");
}
if (item.source != "AshlandsTree3")
{
string[] array2 = array;
foreach (string text in array2)
{
((Component)item.Prefab.transform.Find(text)).GetComponent<MeshFilter>().mesh = ((Component)val.Find("Birch_Sapling")).GetComponent<MeshFilter>().mesh;
}
}
switch (item.source)
{
case "YggaShoot_small1":
{
string[] array7 = new string[6] { "birchleafs002", "birchleafs003", "birchleafs008", "birchleafs009", "birchleafs010", "birchleafs011" };
Material[] sharedMaterials3 = (Material[])(object)new Material[1] { ((Renderer)((Component)StaticMembers.prefabRefs[item.source].transform.Find("beech")).GetComponent<MeshRenderer>()).sharedMaterials[0] };
Material[] sharedMaterials4 = (Material[])(object)new Material[1] { ((Renderer)((Component)StaticMembers.prefabRefs[item.source].transform.Find("beech")).GetComponent<MeshRenderer>()).sharedMaterials[1] };
string[] array2 = array;
foreach (string text7 in array2)
{
((Renderer)((Component)item.Prefab.transform.Find(text7)).GetComponent<MeshRenderer>()).sharedMaterials = sharedMaterials4;
}
array2 = array7;
foreach (string text8 in array2)
{
string[] array6 = array;
foreach (string text9 in array6)
{
((Component)item.Prefab.transform.Find(text9).Find(text8)).GetComponent<MeshFilter>().mesh = ((Component)val.Find(text8)).GetComponent<MeshFilter>().mesh;
((Renderer)((Component)item.Prefab.transform.Find(text9).Find(text8)).GetComponent<MeshRenderer>()).sharedMaterials = sharedMaterials3;
}
}
break;
}
case "SwampTree1":
{
Material[] array4 = (Material[])(object)new Material[1] { ((Renderer)((Component)StaticMembers.prefabRefs[item.source].transform.Find("swamptree1")).GetComponent<MeshRenderer>()).sharedMaterials[0] };
array4[0].shader = shader;
string[] array2 = array;
foreach (string text3 in array2)
{
((Renderer)((Component)item.Prefab.transform.Find(text3)).GetComponent<MeshRenderer>()).sharedMaterials = array4;
}
break;
}
case "Birch1_aut":
{
string[] array5 = new string[6] { "birchleafs002", "birchleafs003", "birchleafs008", "birchleafs009", "birchleafs010", "birchleafs011" };
Material[] sharedMaterials = (Material[])(object)new Material[1] { ((Renderer)((Component)StaticMembers.prefabRefs[item.source].transform.Find("Lod0")).GetComponent<MeshRenderer>()).sharedMaterials[0] };
Material[] sharedMaterials2 = (Material[])(object)new Material[1] { ((Renderer)((Component)val.Find("Birch_Sapling")).GetComponent<MeshRenderer>()).sharedMaterials[0] };
string[] array2 = array;
foreach (string text4 in array2)
{
((Renderer)((Component)item.Prefab.transform.Find(text4)).GetComponent<MeshRenderer>()).sharedMaterials = sharedMaterials2;
}
array2 = array5;
foreach (string text5 in array2)
{
string[] array6 = array;
foreach (string text6 in array6)
{
((Component)item.Prefab.transform.Find(text6).Find(text5)).GetComponent<MeshFilter>().mesh = ((Component)val.Find(text5)).GetComponent<MeshFilter>().mesh;
((Renderer)((Component)item.Prefab.transform.Find(text6).Find(text5)).GetComponent<MeshRenderer>()).sharedMaterials = sharedMaterials;
}
}
break;
}
case "AshlandsTree3":
{
Transform val4 = StaticMembers.prefabRefs[item.source].transform.Find("default");
MeshRenderer component3 = ((Component)val4).GetComponent<MeshRenderer>();
Material[] array3 = (Material[])(object)new Material[1] { ((Renderer)component3).sharedMaterials[0] };
array3[0].shader = shader;
array3[0].SetTexture("_EmissionMap", ((Renderer)component3).sharedMaterials[0].GetTexture("_EmissiveTex"));
string[] array2 = array;
foreach (string text2 in array2)
{
((Component)item.Prefab.transform.Find(text2)).GetComponent<MeshFilter>().mesh = ((Component)val4).GetComponent<MeshFilter>().mesh;
((Renderer)((Component)item.Prefab.transform.Find(text2)).GetComponent<MeshRenderer>()).sharedMaterials = array3;
}
break;
}
}
component2.m_icon = (item.icon ? PluginUtils.CreateSprite(item.key + "PieceIcon.png", new Rect(0f, 0f, 64f, 64f)) : component2.m_resources[0].m_resItem.m_itemData.GetIcon());
component2.m_placeEffect.m_effectPrefabs[0].m_prefab = StaticMembers.prefabRefs["vfx_Place_wood_pole"];
component2.m_placeEffect.m_effectPrefabs[1].m_prefab = StaticMembers.prefabRefs["sfx_build_cultivator"];
item.Prefab.GetComponent<Destructible>().m_hitEffect.m_effectPrefabs = StaticMembers.prefabRefs["Birch_Sapling"].GetComponent<Destructible>().m_hitEffect.m_effectPrefabs;
}
StaticMembers.saplingsInitialized = true;
if (StaticMembers.moddedSaplingRefs.Count == 0)
{
return;
}
bool overrideModdedSaplings = StaticMembers.config.OverrideModdedSaplings;
foreach (ModdedPlantDB moddedSaplingRef in StaticMembers.moddedSaplingRefs)
{
if (!Object.op_Implicit((Object)(object)moddedSaplingRef.Prefab))
{
StaticMembers.Dbgl(moddedSaplingRef.key + " reference is null, skipping application of modded sapling override settings", forceLog: true, (LogLevel)4);
continue;
}
Piece component4 = moddedSaplingRef.Prefab.GetComponent<Piece>();
Plant component5 = moddedSaplingRef.Prefab.GetComponent<Plant>();
component5.m_growTime = (overrideModdedSaplings ? StaticMembers.config.ModdedSaplingGrowthTime : moddedSaplingRef.growTime);
component5.m_growTimeMax = (overrideModdedSaplings ? StaticMembers.config.ModdedSaplingGrowthTime : moddedSaplingRef.growTimeMax);
component5.m_growRadius = (overrideModdedSaplings ? StaticMembers.config.ModdedSaplingGrowRadius : moddedSaplingRef.growRadius);
component5.m_minScale = (overrideModdedSaplings ? StaticMembers.config.ModdedSaplingMinScale : moddedSaplingRef.minScale);
component5.m_maxScale = (overrideModdedSaplings ? StaticMembers.config.ModdedSaplingMaxScale : moddedSaplingRef.maxScale);
component4.m_onlyInBiome = (component5.m_biome = ((overrideModdedSaplings && !StaticMembers.config.EnforceBiomes) ? StaticMembers.AllBiomes : moddedSaplingRef.biome));
component5.m_tolerateCold = moddedSaplingRef.tolerateCold || !StaticMembers.config.PlantsRequireShielding;
component5.m_tolerateHeat = moddedSaplingRef.tolerateHeat || !StaticMembers.config.PlantsRequireShielding;
component5.m_destroyIfCantGrow = (component4.m_groundOnly = !StaticMembers.config.PlaceAnywhere);
}
}
internal static void ModifyTreeDrops()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_005a: 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_0074: 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_009f: Unknown result type (might be due to invalid IL or missing references)
if (!StaticMembers.config.EnableSeedOverrides)
{
return;
}
foreach (KeyValuePair<GameObject, GameObject> treesToSeed in StaticContent.TreesToSeeds)
{
TreeBase component = treesToSeed.Key.GetComponent<TreeBase>();
DropData item = default(DropData);
bool flag = false;
foreach (DropData drop in component.m_dropWhenDestroyed.m_drops)
{
if (((object)drop.m_item).Equals((object?)treesToSeed.Value))
{
flag = true;
item = drop;
break;
}
}
if (flag)
{
component.m_dropWhenDestroyed.m_drops.Remove(item);
}
item.m_item = treesToSeed.Value;
item.m_stackMin = StaticMembers.config.SeedDropMin;
item.m_stackMax = StaticMembers.config.SeedDropMax;
item.m_weight = 1f;
component.m_dropWhenDestroyed.m_dropMin = StaticMembers.config.TreeDropMin;
component.m_dropWhenDestroyed.m_dropMax = StaticMembers.config.TreeDropMax;
component.m_dropWhenDestroyed.m_drops.Add(item);
component.m_dropWhenDestroyed.m_dropChance = Mathf.Clamp(StaticMembers.config.DropChance, 0f, 1f);
component.m_dropWhenDestroyed.m_oneOfEach = StaticMembers.config.OneOfEach;
}
}
internal static void InitCrops()
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
StaticMembers.Dbgl("InitCrops", forceLog: false, (LogLevel)16);
bool enableCropOverrides = StaticMembers.config.EnableCropOverrides;
foreach (PrefabDB item in StaticContent.GenerateCropRefs())
{
Piece component = item.Prefab.GetComponent<Piece>();
Plant component2 = item.Prefab.GetComponent<Plant>();
Pickable component3 = component2.m_grownPrefabs[0].GetComponent<Pickable>();
component.m_resources[0].m_amount = item.resourceCost;
((StaticTarget)component).m_primaryTarget = (((StaticTarget)component).m_randomTarget = StaticMembers.config.EnemiesTargetCrops);
component2.m_biome = item.biome;
component2.m_tolerateCold = item.tolerateCold || !StaticMembers.config.PlantsRequireShielding;
component2.m_tolerateHeat = item.tolerateHeat || !StaticMembers.config.PlantsRequireShielding;
component2.m_minScale = (enableCropOverrides ? StaticMembers.config.CropMinScale : 0.9f);
component2.m_maxScale = (enableCropOverrides ? StaticMembers.config.CropMaxScale : 1.1f);
component2.m_growTime = (enableCropOverrides ? StaticMembers.config.CropGrowTimeMin : 4000f);
component2.m_growTimeMax = (enableCropOverrides ? StaticMembers.config.CropGrowTimeMax : 5000f);
component2.m_growRadius = (enableCropOverrides ? StaticMembers.config.CropGrowRadius : 0.5f);
component2.m_needCultivatedGround = (component.m_cultivatedGroundOnly = !enableCropOverrides || StaticMembers.config.CropRequireCultivation);
component3.m_amount = item.resourceReturn;
component3.m_extraDrops.m_drops.Clear();
if (item.extraDrops && !enableCropOverrides)
{
component3.m_extraDrops.m_drops.Add(new DropData
{
m_item = component3.m_itemPrefab,
m_stackMin = 1,
m_stackMax = 1,
m_weight = 0f
});
}
}
if (StaticMembers.moddedCropRefs.Count == 0)
{
return;
}
enableCropOverrides = enableCropOverrides && StaticMembers.config.OverrideModdedCrops;
foreach (ModdedPlantDB moddedCropRef in StaticMembers.moddedCropRefs)
{
if (!Object.op_Implicit((Object)(object)moddedCropRef.Prefab))
{
StaticMembers.Dbgl(moddedCropRef.key + " reference is null, skipping application of crop override settings", forceLog: true, (LogLevel)4);
continue;
}
Piece component4 = moddedCropRef.Prefab.GetComponent<Piece>();
Plant component5 = moddedCropRef.Prefab.GetComponent<Plant>();
((StaticTarget)component4).m_primaryTarget = (((StaticTarget)component4).m_randomTarget = StaticMembers.config.EnemiesTargetCrops);
component5.m_biome = ((enableCropOverrides && !StaticMembers.config.EnforceBiomesVanilla) ? StaticMembers.AllBiomes : moddedCropRef.biome);
component5.m_tolerateCold = moddedCropRef.tolerateCold || !StaticMembers.config.PlantsRequireShielding;
component5.m_tolerateHeat = moddedCropRef.tolerateHeat || !StaticMembers.config.PlantsRequireShielding;
component5.m_minScale = (enableCropOverrides ? StaticMembers.config.CropMinScale : moddedCropRef.minScale);
component5.m_maxScale = (enableCropOverrides ? StaticMembers.config.CropMaxScale : moddedCropRef.maxScale);
component5.m_growTime = (enableCropOverrides ? StaticMembers.config.CropGrowTimeMin : moddedCropRef.growTime);
component5.m_growTimeMax = (enableCropOverrides ? StaticMembers.config.CropGrowTimeMax : moddedCropRef.growTimeMax);
component5.m_growRadius = (enableCropOverrides ? StaticMembers.config.CropGrowRadius : moddedCropRef.growRadius);
component5.m_needCultivatedGround = (component4.m_cultivatedGroundOnly = !enableCropOverrides || StaticMembers.config.CropRequireCultivation);
}
}
internal static void InitVines()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
StaticMembers.Dbgl("InitVines", forceLog: false, (LogLevel)16);
Plant component = StaticMembers.prefabRefs["VineAsh_sapling"].GetComponent<Plant>();
Pickable component2 = StaticMembers.prefabRefs["VineAsh"].GetComponent<Pickable>();
component.m_biome = (Biome)(StaticMembers.config.EnforceBiomesVanilla ? 827 : 895);
component.m_needCultivatedGround = (StaticMembers.prefabRefs["VineAsh_sapling"].GetComponent<Piece>().m_cultivatedGroundOnly = !StaticMembers.config.EnableCropOverrides || StaticMembers.config.CropRequireCultivation);
component.m_growTime = (StaticMembers.config.EnableVineOverrides ? StaticMembers.config.VinesGrowthTime : 200f);
component.m_growTimeMax = (StaticMembers.config.EnableVineOverrides ? StaticMembers.config.VinesGrowthTime : 300f);
component.m_attachDistance = (StaticMembers.config.EnableVineOverrides ? StaticMembers.config.VinesAttachDistance : 1.8f);
component.m_growRadiusVines = (StaticMembers.config.EnableVineOverrides ? StaticMembers.config.VineGrowRadius : 1.8f);
component.m_tolerateCold = !StaticMembers.config.PlantsRequireShielding;
component2.m_amount = (StaticMembers.config.EnableVineOverrides ? StaticMembers.config.VineBerryReturn : 3);
component2.m_respawnTimeInitMax = ((!StaticMembers.config.EnableVineOverrides) ? 150 : 0);
component2.m_respawnTimeMinutes = (StaticMembers.config.EnableVineOverrides ? StaticMembers.config.VineBerryRespawnTime : 200);
}
internal static void InitCultivator()
{
StaticMembers.Dbgl("InitCultivator", forceLog: false, (LogLevel)16);
PieceTable buildPieces = StaticMembers.prefabRefs["Cultivator"].GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces;
for (int i = 0; i < StaticMembers.saplingRefs.Count; i++)
{
if (StaticMembers.saplingRefs[i].enabled && !buildPieces.m_pieces.Contains(StaticMembers.saplingRefs[i].Prefab))
{
buildPieces.m_pieces.Insert(16, StaticMembers.saplingRefs[i].Prefab);
}
}
for (int j = 0; j < StaticMembers.pieceRefs.Count; j++)
{
if (StaticMembers.pieceRefs[j].enabled && !buildPieces.m_pieces.Contains(StaticMembers.pieceRefs[j].Prefab))
{
buildPieces.m_pieces.Add(StaticMembers.pieceRefs[j].Prefab);
}
}
buildPieces.m_canRemovePieces = true;
}
public static void InitLocalization()
{
StaticMembers.Dbgl("InitLocalization", forceLog: false, (LogLevel)16);
foreach (KeyValuePair<string, string> defaultLocalizedString in StaticContent.DefaultLocalizedStrings)
{
Localization.instance.AddWord("pe" + defaultLocalizedString.Key, defaultLocalizedString.Value);
}
StaticContent.DefaultLocalizedStrings.Clear();
}
internal static void FullInit(ZNetScene instance)
{
StaticMembers.Dbgl("Performing full mod initialization", forceLog: false, (LogLevel)16);
InitExtraResourceRefs(instance);
InitPieceRefs();
InitPieces();
InitSaplingRefs();
InitSaplings();
InitCrops();
InitVines();
InitCultivator();
if (StaticContent.DefaultLocalizedStrings.Count > 0)
{
InitLocalization();
}
for (int i = 0; i < StaticMembers.saplingRefs.Count; i++)
{
GameObject prefab = StaticMembers.saplingRefs[i].Prefab;
if (!instance.m_prefabs.Contains(prefab))
{
instance.m_prefabs.Add(prefab);
instance.m_namedPrefabs.Add(instance.GetPrefabHash(prefab), prefab);
}
}
}
}
internal static class StaticMembers
{
internal static ManualLogSource ModLogger = new ManualLogSource(" PlantEverything");
internal static ModConfig config;
private static string customConfigPath;
internal static readonly Dictionary<LogLevel, Action<string>> logActions = new Dictionary<LogLevel, Action<string>>
{
{
(LogLevel)1,
(Action<string>)ModLogger.LogFatal
},
{
(LogLevel)2,
(Action<string>)ModLogger.LogError
},
{
(LogLevel)4,
(Action<string>)ModLogger.LogWarning
},
{
(LogLevel)8,
(Action<string>)ModLogger.LogMessage
},
{
(LogLevel)16,
(Action<string>)ModLogger.LogInfo
},
{
(LogLevel)32,
(Action<string>)ModLogger.LogDebug
}
};
internal static readonly Dictionary<string, GameObject> prefabRefs = new Dictionary<string, GameObject>();
internal static List<PieceDB> pieceRefs = new List<PieceDB>();
internal static List<SaplingDB> saplingRefs = new List<SaplingDB>();
internal static List<ModdedPlantDB> moddedCropRefs = new List<ModdedPlantDB>();
internal static List<ModdedPlantDB> moddedSaplingRefs = new List<ModdedPlantDB>();
internal static List<ExtraResource> deserializedExtraResources = new List<ExtraResource>();
internal static bool piecesInitialized = false;
internal static bool saplingsInitialized = false;
internal static bool resolveMissingReferences = false;
internal static bool isDedicatedServer = false;
internal static AssetBundle assetBundle;
internal static readonly Dictionary<string, Texture2D> cachedTextures = new Dictionary<string, Texture2D>();
internal static readonly Dictionary<Texture2D, Sprite> cachedSprites = new Dictionary<Texture2D, Sprite>();
internal const Biome TemperateBiomes = 25;
internal static Biome AllBiomes = PluginUtils.GetBiomeMask((Biome[])Enum.GetValues(typeof(Biome)));
internal static readonly int PlaceAnywhereHash = StringExtensionMethods.GetStableHashCode("pe_placeAnywhere");
internal static string[] layersForPieceRemoval = new string[4] { "item", "piece_nonsolid", "Default_small", "Default" };
internal static string CustomConfigPath => customConfigPath ?? (customConfigPath = PluginUtils.SetupConfigDirectory());
internal static void Dbgl(string message, bool forceLog = false, LogLevel level = 16)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (forceLog || config.EnableDebugMessages)
{
logActions[level](message);
}
}
}
internal sealed class ModLocalization
{
public List<string> LocalizedStrings = new List<string>();
}
internal static class PluginUtils
{
internal static bool HoldingCultivator
{
get
{
Player localPlayer = Player.m_localPlayer;
return ((localPlayer == null) ? null : ((Humanoid)localPlayer).GetRightItem()?.m_shared.m_name) == "$item_cultivator";
}
}
internal static AssetBundle LoadAssetBundle(string fileName)
{
return AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("Advize_PlantEverything.Assets." + fileName));
}
internal static GameObject CreatePrefab(string name)
{
GameObject obj = StaticMembers.assetBundle.LoadAsset<GameObject>(name);
obj.SetActive(true);
return obj;
}
internal static Piece GetOrAddPieceComponent(GameObject go)
{
return go.GetComponent<Piece>() ?? go.AddComponent<Piece>();
}
internal static string GetPrefabName(Component c)
{
return ((Object)c.transform.root).name.Replace("(Clone)", "");
}
internal static bool IsModdedPrefab(Component c)
{
if (Object.op_Implicit((Object)(object)c))
{
return StaticMembers.prefabRefs.ContainsKey(GetPrefabName(c));
}
return false;
}
internal static bool IsModdedPrefabOrSapling(string s)
{
if (!s.StartsWith("$pe"))
{
return s.EndsWith("_sapling");
}
return true;
}
internal static void RemoveFromCultivator(List<PrefabDB> prefabs)
{
if (HoldingCultivator)
{
SheatheCultivator();
}
PieceTable pieceTable = StaticMembers.prefabRefs["Cultivator"].GetComponent<ItemDrop>().m_itemData.m_shared.m_buildPieces;
prefabs.ForEach(delegate(PrefabDB x)
{
pieceTable.m_pieces.Remove(x.Prefab);
});
}
internal static void SheatheCultivator()
{
StaticMembers.Dbgl("Cultivator updated through config change, unequipping cultivator.", forceLog: true, (LogLevel)16);
if (!ZNet.instance.HaveStopped)
{
((Humanoid)Player.m_localPlayer).HideHandItems(false, true);
}
}
internal static Piece CreatePiece(PieceDB pdb)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
Piece orAddPieceComponent = GetOrAddPieceComponent(StaticMembers.prefabRefs[pdb.key]);
orAddPieceComponent.m_name = (pdb.extraResource ? pdb.pieceName : ("$pe" + pdb.Name + "Name"));
orAddPieceComponent.m_description = (pdb.extraResource ? pdb.pieceDescription : ("$pe" + pdb.Name + "Description"));
orAddPieceComponent.m_category = (PieceCategory)0;
orAddPieceComponent.m_cultivatedGroundOnly = (pdb.key.Contains("berryBush") || pdb.key.Contains("Pickable")) && StaticMembers.config.RequireCultivation;
bool num = pdb.isGrounded ?? (!StaticMembers.config.PlaceAnywhere);
bool groundOnly = num;
orAddPieceComponent.m_groundPiece = num;
orAddPieceComponent.m_groundOnly = groundOnly;
orAddPieceComponent.m_canBeRemoved = pdb.canBeRemoved.GetValueOrDefault(true);
orAddPieceComponent.m_targetNonPlayerBuilt = false;
((StaticTarget)orAddPieceComponent).m_randomTarget = StaticMembers.config.EnemiesTargetPieces;
return orAddPieceComponent;
}
internal static Sprite CreateSprite(string fileName, Rect spriteSection)
{
//IL_0023: 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)
try
{
Texture2D val = LoadTexture(fileName);
Sprite val2;
if (StaticMembers.cachedSprites.ContainsKey(val))
{
val2 = StaticMembers.cachedSprites[val];
}
else
{
val2 = Sprite.Create(val, spriteSection, Vector2.zero);
StaticMembers.cachedSprites.Add(val, val2);
}
return val2;
}
catch
{
StaticMembers.Dbgl("Unable to load texture", forceLog: true, (LogLevel)2);
}
return null;
}
private static Texture2D LoadTexture(string fileName)
{
Texture2D val;
if (StaticMembers.cachedTextures.ContainsKey(fileName))
{
val = StaticMembers.cachedTextures[fileName];
}
else
{
val = StaticMembers.assetBundle.LoadAsset<Texture2D>(fileName);
StaticMembers.cachedTextures.Add(fileName, val);
}
return val;
}
private static string SerializeExtraResource(ExtraResource extraResource, bool prettyPrint = true)
{
return JsonUtility.ToJson((object)extraResource, prettyPrint);
}
internal static ExtraResource DeserializeExtraResource(string extraResource)
{
return JsonUtility.FromJson<ExtraResource>(extraResource);
}
private static void SaveExtraResources()
{
string text = Path.Combine(StaticMembers.CustomConfigPath, "ExtraResources.json");
StaticMembers.Dbgl($"deserializedExtraResources.Count is {StaticMembers.deserializedExtraResources.Count}", forceLog: false, (LogLevel)16);
string text2 = "";
text2 = text2 + SerializeExtraResource(StaticMembers.deserializedExtraResources[0]) + ";\n\n";
text2 = text2 + SerializeExtraResource(StaticMembers.deserializedExtraResources[1], prettyPrint: false) + ";\n";
File.WriteAllText(text, text2);
StaticMembers.Dbgl("Serialized extraResources to " + text, forceLog: true, (LogLevel)16);
}
internal static void LoadExtraResources()
{
StaticMembers.Dbgl("LoadExtraResources", forceLog: false, (LogLevel)16);
StaticMembers.deserializedExtraResources.Clear();
string text = "ExtraResources.json";
string text2 = Path.Combine(StaticMembers.CustomConfigPath, text);
try
{
string[] array = File.ReadAllText(text2).Split(new char[1] { ';' });
foreach (string text3 in array)
{
if (!Utility.IsNullOrWhiteSpace(text3))
{
ExtraResource item = DeserializeExtraResource(text3);
if (item.IsValid())
{
StaticMembers.deserializedExtraResources.Add(item);
}
else if (!item.prefabName.StartsWith("PE_Fake"))
{
StaticMembers.Dbgl("Invalid resource, " + item.prefabName + ", configured in " + text + ", skipping entry", forceLog: true, (LogLevel)4);
}
}
}
StaticMembers.Dbgl("Loaded extra resources from " + text2, forceLog: true, (LogLevel)16);
StaticMembers.Dbgl("Assigning local value from deserializedExtraResources", forceLog: false, (LogLevel)16);
List<string> resourcesToSync = new List<string>();
StaticMembers.deserializedExtraResources.ForEach(delegate(ExtraResource er)
{
resourcesToSync.Add(SerializeExtraResource(er));
});
StaticMembers.config.SyncedExtraResources.AssignLocalValue(resourcesToSync);
}
catch (Exception ex)
{
if (ex is FileNotFoundException)
{
StaticMembers.Dbgl("Error loading data from " + text + ". Generating new file with example values", forceLog: true, (LogLevel)4);
StaticMembers.deserializedExtraResources = StaticContent.GenerateExampleResources();
SaveExtraResources();
}
else
{
StaticMembers.Dbgl("Error loading data from " + text + ". Additional resources have not been added", forceLog: false, (LogLevel)4);
StaticMembers.deserializedExtraResources.Clear();
}
}
}
internal static void LoadLocalizedStrings()
{
string path = StaticMembers.config.Language + "_PlantEverything.json";
string text = Path.Combine(StaticMembers.CustomConfigPath, path);
try
{
foreach (string localizedString in JsonUtility.FromJson<ModLocalization>(File.ReadAllText(text)).LocalizedStrings)
{
string[] array = localizedString.Split(new char[1] { ':' });
StaticContent.DefaultLocalizedStrings.Remove(array[0]);
StaticContent.DefaultLocalizedStrings.Add(array[0], array[1]);
}
StaticMembers.Dbgl("Loaded localized strings from " + text, forceLog: false, (LogLevel)16);
return;
}
catch
{
StaticMembers.Dbgl("EnableLocalization is true but unable to load localized text file, generating new one from default English values", forceLog: true, (LogLevel)16);
}
SerializeDict();
}
private static void SerializeDict()
{
string text = Path.Combine(StaticMembers.CustomConfigPath, "english_PlantEverything.json");
ModLocalization modLocalization = new ModLocalization();
foreach (KeyValuePair<string, string> defaultLocalizedString in StaticContent.DefaultLocalizedStrings)
{
modLocalization.LocalizedStrings.Add(defaultLocalizedString.Key + ":" + defaultLocalizedString.Value);
}
File.WriteAllText(text, JsonUtility.ToJson((object)modLocalization, true));
StaticMembers.Dbgl("Saved english localized strings to " + text, forceLog: false, (LogLevel)16);
}
internal static Biome GetBiomeMask(Biome[] biomes)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
Biome val = (Biome)0;
foreach (Biome val2 in biomes)
{
val |= val2;
}
return val;
}
internal static string SetupConfigDirectory()
{
string text = Path.Combine(Paths.ConfigPath, "PlantEverything");
if (!Directory.Exists(text))
{
Directory.CreateDirectory(text);
}
return text;
}
}
internal static class StaticContent
{
internal static Dictionary<string, string> DefaultLocalizedStrings = new Dictionary<string, string>
{
{ "AncientSaplingName", "Ancient Sapling" },
{ "AncientSaplingDescription", "" },
{ "YggaSaplingName", "Ygga Sapling" },
{ "YggaSaplingDescription", "" },
{ "AutumnBirchSaplingName", "Autumn Birch Sapling" },
{ "AutumnBirchSaplingDescription", "Plains Variant" },
{ "AshwoodSaplingName", "Ashwood Sapling" },
{ "AshwoodSaplingDescription", "" },
{ "VineAshSaplingName", "Custom Ashvine" },
{ "VineAshSaplingDescription", "Plants an Ashvine sapling with the colours defined in the mod config." },
{ "RaspberryBushName", "Raspberry Bush" },
{ "RaspberryBushDescription", "Plant raspberries to grow raspberry bushes." },
{ "BlueberryBushName", "Blueberry Bush" },
{ "BlueberryBushDescription", "Plant blueberries to grow blueberry bushes." },
{ "CloudberryBushName", "Cloudberry Bush" },
{ "CloudberryBushDescription", "Plant cloudberries to grow cloudberry bushes." },
{ "PickableMushroomName", "Pickable Mushrooms" },
{ "PickableMushroomDescription", "Plant mushrooms to grow more pickable mushrooms." },
{ "PickableYellowMushroomName", "Pickable Yellow Mushrooms" },
{ "PickableYellowMushroomDescription", "Plant yellow mushrooms to grow more pickable yellow mushrooms." },
{ "PickableBlueMushroomName", "Pickable Blue Mushrooms" },
{ "PickableBlueMushroomDescription", "Plant blue mushrooms to grow more pickable blue mushrooms." },
{ "PickableThistleName", "Pickable Thistle" },
{ "PickableThistleDescription", "Plant thistle to grow more pickable thistle." },
{ "PickableDandelionName", "Pickable Dandelion" },
{ "PickableDandelionDescription", "Plant dandelion to grow more pickable dandelion." },
{ "BeechSmallName", "Small Beech Tree" },
{ "BeechSmallDescription", "Plant a small beech tree." },
{ "FirSmallName", "Small Fir Tree" },
{ "FirSmallDescription", "Plant a small fir tree." },
{ "FirSmallDeadName", "Small Dead Fir Tree" },
{ "FirSmallDeadDescription", "Plant a small dead fir tree." },
{ "Bush01Name", "Small Bush 1" },
{ "Bush01Description", "Plant a small bush." },
{ "Bush02Name", "Small Bush 2" },
{ "Bush02Description", "Plant a small bush." },
{ "PlainsBushName", "Small Plains Bush" },
{ "PlainsBushDescription", "Plant a bush native to the plains." },
{ "Shrub01Name", "Small Shrub 1" },
{ "Shrub01Description", "Plant a small shrub." },
{ "Shrub02Name", "Small Shrub 2" },
{ "Shrub02Description", "Plant a small shrub." },
{ "YggaShootName", "Small Ygga Shoot" },
{ "YggaShootDescription", "Plant a small ygga shoot." },
{ "VinesName", "Vines" },
{ "VinesDescription", "Plant vines." },
{ "AshlandsFernName", "Ashlands Fern" },
{ "AshlandsFernDescription", "Plant a fern native to the ashlands." },
{ "PickableBranchName", "Pickable Branch" },
{ "PickableBranchDescription", "Plant respawning pickable branches." },
{ "PickableStoneName", "Pickable Stone" },
{ "PickableStoneDescription", "Plant pickable stone." },
{ "PickableFlintName", "Pickable Flint" },
{ "PickableFlintDescription", "Plant respawning pickable flint." },
{ "PickableSmokePuffName", "Pickable Smoke Puff" },
{ "PickableSmokePuffDescription", "Plant smoke puffs to grow more pickable smoke puffs." },
{ "PickableFiddleheadName", "Pickable Fiddlehead" },
{ "PickableFiddleheadDescription", "Plant fiddlehead to grow more pickable fiddlehead." },
{ "GrowthTimeHoverPrefix", "Ready in" }
};
internal static readonly List<string> VanillaPrefabRefs = new List<string>
{
"Acorn", "AncientSeed", "BeechSeeds", "BirchSeeds", "FirCone", "PineCone", "Sap", "Pickable_Branch", "Pickable_Dandelion", "Pickable_Fiddlehead",
"Pickable_Flint", "Pickable_Mushroom", "Pickable_Mushroom_blue", "Pickable_Mushroom_yellow", "Pickable_SmokePuff", "Pickable_Stone", "Pickable_Thistle", "Cultivator", "sfx_build_cultivator", "vfx_Place_wood_pole",
"sapling_barley", "sapling_carrot", "sapling_flax", "sapling_jotunpuffs", "sapling_magecap", "sapling_onion", "sapling_seedcarrot", "sapling_seedonion", "sapling_seedturnip", "sapling_turnip",
"FernAshlands", "AshlandsTree3", "AshlandsTree4", "AshlandsTree5", "AshlandsTree6_big", "Beech1", "Beech_Sapling", "Beech_small1", "Birch1", "Birch1_aut",
"Birch2", "Birch2_aut", "Birch_Sapling", "BlueberryBush", "Bush01", "Bush01_heath", "Bush02_en", "RaspberryBush", "CloudberryBush", "FirTree",
"FirTree_Sapling", "FirTree_small", "FirTree_small_dead", "PineTree_Sapling", "Pinetree_01", "YggaShoot1", "YggaShoot2", "YggaShoot3", "YggaShoot_small1", "shrub_2",
"shrub_2_heath", "SwampTree1", "vines", "VineAsh", "VineAsh_sapling", "Oak1", "Oak_Sapling"
};
internal static readonly List<string> CustomPrefabRefs = new List<string>
{
"Ancient_Sapling", "Ygga_Sapling", "Autumn_Birch_Sapling", "Ashwood_Sapling", "Pickable_Dandelion_Picked", "Pickable_Thistle_Picked", "Pickable_Mushroom_Picked", "Pickable_Mushroom_yellow_Picked", "Pickable_Mushroom_blue_Picked", "Pickable_SmokePuff_Picked",
"Pickable_Fiddlehead_Picked"
};
private static Dictionary<GameObject, GameObject> treesToSeeds;
internal static Dictionary<GameObject, GameObject> TreesToSeeds
{
get
{
object obj = treesToSeeds;
if (obj == null)
{
obj = new Dictionary<GameObject, GameObject>
{
{
StaticMembers.prefabRefs["Birch1"],
StaticMembers.prefabRefs["BirchSeeds"]
},
{
StaticMembers.prefabRefs["Birch2"],
StaticMembers.prefabRefs["BirchSeeds"]
},
{
StaticMembers.prefabRefs["Birch2_aut"],
StaticMembers.prefabRefs["BirchSeeds"]
},
{
StaticMembers.prefabRefs["Birch1_aut"],
StaticMembers.prefabRefs["BirchSeeds"]
},
{
StaticMembers.prefabRefs["Oak1"],
StaticMembers.prefabRefs["Acorn"]
},
{
StaticMembers.prefabRefs["SwampTree1"],
StaticMembers.prefabRefs["AncientSeed"]
},
{
StaticMembers.prefabRefs["Beech1"],
StaticMembers.prefabRefs["BeechSeeds"]
},
{
StaticMembers.prefabRefs["Pinetree_01"],
StaticMembers.prefabRefs["PineCone"]
},
{
StaticMembers.prefabRefs["FirTree"],
StaticMembers.prefabRefs["FirCone"]
}
};
treesToSeeds = (Dictionary<GameObject, GameObject>)obj;
}
return (Dictionary<GameObject, GameObject>)obj;
}
}
internal static List<ExtraResource> GenerateExampleResources()
{
return new List<ExtraResource>(2)
{
new ExtraResource
{
prefabName = "PE_FakePrefab1",
resourceName = "PretendSeeds1",
resourceCost = 1,
groundOnly = true,
pieceName = "PickableMushrooms",
pieceDescription = "Plant this to grow more pickable mushrooms."
},
new ExtraResource
{
prefabName = "PE_FakePrefab2",
resourceName = "PretendSeeds2",
resourceCost = 2,
groundOnly = false
}
};
}
internal static List<PieceDB> GeneratePieceRefs()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0475: Unknown result type (might be due to invalid IL or missing references)
//IL_0784: Unknown result type (might be due to invalid IL or missing references)
//IL_079e: Unknown result type (might be due to invalid IL or missing references)
//IL_07b8: Unknown result type (might be due to invalid IL or missing references)
//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
bool enforceBiomes = StaticMembers.config.EnforceBiomes;
List<PieceDB> list = new List<PieceDB>(10)
{
new PieceDB
{
key = "RaspberryBush",
ResourceCost = StaticMembers.config.RaspberryCost,
resourceReturn = StaticMembers.config.RaspberryReturn,
respawnTime = StaticMembers.config.RaspberryRespawnTime,
biome = (Biome)(enforceBiomes ? 1 : 0),
icon = true,
isGrounded = true,
recover = StaticMembers.config.RecoverResources
},
new PieceDB
{
key = "BlueberryBush",
ResourceCost = StaticMembers.config.BlueberryCost,
resourceReturn = StaticMembers.config.BlueberryReturn,
respawnTime = StaticMembers.config.BlueberryRespawnTime,
biome = (Biome)(enforceBiomes ? 8 : 0),
icon = true,
isGrounded = true,
recover = StaticMembers.config.RecoverResources
},
new PieceDB
{
key = "CloudberryBush",
ResourceCost = StaticMembers.config.CloudberryCost,
resourceReturn = StaticMembers.config.CloudberryReturn,
respawnTime = StaticMembers.config.CloudberryRespawnTime,
biome = (Biome)(enforceBiomes ? 16 : 0),
icon = true,
isGrounded = true,
recover = StaticMembers.config.RecoverResources
},
new PieceDB
{
key = "Pickable_Mushroom",
ResourceCost = StaticMembers.config.MushroomCost,
resourceReturn = StaticMembers.config.MushroomReturn,
respawnTime = StaticMembers.config.MushroomRespawnTime,
recover = StaticMembers.config.RecoverResources,
Name = "PickableMushroom",
isGrounded = true
},
new PieceDB
{
key = "Pickable_Mushroom_yellow",
ResourceCost = StaticMembers.config.YellowMushroomCost,
resourceReturn = StaticMembers.config.YellowMushroomReturn,
respawnTime = StaticMembers.config.YellowMushroomRespawnTime,
recover = StaticMembers.config.RecoverResources,
Name = "PickableYellowMushroom",
isGrounded = true
},
new PieceDB
{
key = "Pickable_Mushroom_blue",
ResourceCost = StaticMembers.config.BlueMushroomCost,
resourceReturn = StaticMembers.config.BlueMushroomReturn,
respawnTime = StaticMembers.config.BlueMushroomRespawnTime,
recover = StaticMembers.config.RecoverResources,
Name = "PickableBlueMushroom",
isGrounded = true
},
new PieceDB
{
key = "Pickable_Thistle",
ResourceCost = StaticMembers.config.ThistleCost,
resourceReturn = StaticMembers.config.ThistleReturn,
respawnTime = StaticMembers.config.ThistleRespawnTime,
biome = (Biome)(enforceBiomes ? 8 : 0),
recover = StaticMembers.config.RecoverResources,
Name = "PickableThistle",
isGrounded = true
},
new PieceDB
{
key = "Pickable_Dandelion",
ResourceCost = StaticMembers.config.DandelionCost,
resourceReturn = StaticMembers.config.DandelionReturn,
respawnTime = StaticMembers.config.DandelionRespawnTime,
biome = (Biome)(enforceBiomes ? 1 : 0),
recover = StaticMembers.config.RecoverResources,
Name = "PickableDandelion",
isGrounded = true
},
new PieceDB
{
key = "Pickable_SmokePuff",
ResourceCost = StaticMembers.config.SmokePuffCost,
resourceReturn = StaticMembers.config.SmokePuffReturn,
respawnTime = StaticMembers.config.SmokePuffRespawnTime,
biome = (Biome)(enforceBiomes ? 32 : 0),
recover = StaticMembers.config.RecoverResources,
Name = "PickableSmokePuff",
isGrounded = true
},
new PieceDB
{
key = "Pickable_Fiddlehead",
ResourceCost = StaticMembers.config.FiddleheadCost,
resourceReturn = StaticMembers.config.FiddleheadReturn,
respawnTime = StaticMembers.config.FiddleheadRespawnTime,
biome = (Biome)(enforceBiomes ? 32 : 0),
icon = true,
recover = StaticMembers.config.RecoverResources,
Name = "PickableFiddlehead",
isGrounded = true,
extraDrops = true
}
};
if (StaticMembers.config.EnableMiscFlora)
{
list.AddRange(new <>z__ReadOnlyArray<PieceDB>(new PieceDB[11]
{
new PieceDB
{
key = "Beech_small1",
Resource = new KeyValuePair<string, int>("BeechSeeds", 1),
icon = true,
Name = "BeechSmall",
canBeRemoved = false
},
new PieceDB
{
key = "FirTree_small",
Resource = new KeyValuePair<string, int>("FirCone", 1),
icon = true,
Name = "FirSmall",
canBeRemoved = false
},
new PieceDB
{
key = "FirTree_small_dead",
Resource = new KeyValuePair<string, int>("FirCone", 1),
icon = true,
Name = "FirSmallDead",
canBeRemoved = false
},
new PieceDB
{
key = "Bush01",
Resource = new KeyValuePair<string, int>("Wood", 2),
icon = true,
canBeRemoved = false
},
new PieceDB
{
key = "Bush01_heath",
Resource = new KeyValuePair<string, int>("Wood", 2),
icon = true,
Name = "Bush02",
canBeRemoved = false
},
new PieceDB
{
key = "Bush02_en",
Resource = new KeyValuePair<string, int>("Wood", 3),
icon = true,
Name = "PlainsBush",
canBeRemoved = false
},
new PieceDB
{
key = "shrub_2",
Resource = new KeyValuePair<string, int>("Wood", 2),
icon = true,
Name = "Shrub01",
canBeRemoved = false
},
new PieceDB
{
key = "shrub_2_heath",
Resource = new KeyValuePair<string, int>("Wood", 2),
icon = true,
Name = "Shrub02",
canBeRemoved = false
},
new PieceDB
{
key = "YggaShoot_small1",
Resources = new Dictionary<string, int>
{
{ "YggdrasilWood", 1 },
{ "Wood", 2 }
},
icon = true,
Name = "YggaShoot",
canBeRemoved = false
},
new PieceDB
{
key = "vines",
Resource = new KeyValuePair<string, int>("Wood", 2),
icon = true,
recover = true,
Name = "Vines",
isGrounded = false,
snapPoints = new List<Vector3>
{
new Vector3(1f, 0.5f, 0f),
new Vector3(-1f, 0.5f, 0f),
new Vector3(1f, -1f, 0f),
new Vector3(-1f, -1f, 0f)
}
},
new PieceDB
{
key = "FernAshlands",
Resource = new KeyValuePair<string, int>("Wood", 2),
icon = true,
Name = "AshlandsFern",
isGrounded = true,
canBeRemoved = false
}
}));
}
if (StaticMembers.config.EnableDebris)
{
list.AddRange(new <>z__ReadOnlyArray<PieceDB>(new PieceDB[3]
{
new PieceDB
{
key = "Pickable_Branch",
ResourceCost = StaticMembers.config.PickableBranchCost,
resourceReturn = StaticMembers.config.PickableBranchReturn,
respawnTime = StaticMembers.config.PickableBranchRespawnTime,
recover = StaticMembers.config.RecoverResources,
Name = "PickableBranch",
isGrounded = true
},
new PieceDB
{
key = "Pickable_Stone",
ResourceCost = StaticMembers.config.PickableStoneCost,
resourceReturn = StaticMembers.config.PickableStoneReturn,
respawnTime = StaticMembers.config.PickableStoneRespawnTime,
recover = StaticMembers.config.RecoverResources,
Name = "PickableStone",
isGrounded = true,
hideWhenPicked = true
},
new PieceDB
{
key = "Pickable_Flint",
ResourceCost = StaticMembers.config.PickableFlintCost,
resourceReturn = StaticMembers.config.PickableFlintReturn,
respawnTime = StaticMembers.config.PickableFlintRespawnTime,
recover = StaticMembers.config.RecoverResources,
Name = "PickableFlint",
isGrounded = true
}
}));
}
if (StaticMembers.config.EnableExtraResources)
{
List<string> list2 = StaticMembers.layersForPieceRemoval.ToList();
bool resolveMissingReferences = false;
foreach (ExtraResource deserializedExtraResource in StaticMembers.deserializedExtraResources)
{
if (!StaticMembers.prefabRefs.ContainsKey(deserializedExtraResource.prefabName) || !Object.op_Implicit((Object)(object)StaticMembers.prefabRefs[deserializedExtraResource.prefabName]))
{
StaticMembers.Dbgl(deserializedExtraResource.prefabName + " is not in dictionary of prefab references or has a null value", forceLog: false, (LogLevel)4);
resolveMissingReferences = true;
continue;
}
ObjectDB instance = ObjectDB.instance;
object obj;
if (instance == null)
{
obj = null;
}
else
{
GameObject itemPrefab = instance.GetItemPrefab(deserializedExtraResource.resourceName);
obj = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null);
}
if (!Object.op_Implicit((Object)obj))
{
StaticMembers.Dbgl(deserializedExtraResource.prefabName + "'s required resource " + deserializedExtraResource.resourceName + " not found", forceLog: false, (LogLevel)4);
resolveMissingReferences = true;
continue;
}
list.Add(new PieceDB
{
key = deserializedExtraResource.prefabName,
Resource = new KeyValuePair<string, int>(deserializedExtraResource.resourceName, deserializedExtraResource.resourceCost),
isGrounded = deserializedExtraResource.groundOnly,
extraResource = true,
pieceName = ((deserializedExtraResource.pieceName == "") ? deserializedExtraResource.prefabName : deserializedExtraResource.pieceName),
pieceDescription = deserializedExtraResource.pieceDescription
});
Collider[] componentsInChildren = StaticMembers.prefabRefs[deserializedExtraResource.prefabName].GetComponentsInChildren<Collider>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
string item = LayerMask.LayerToName(((Component)componentsInChildren[i]).gameObject.layer);
list2.Add(item);
}
}
StaticMembers.layersForPieceRemoval = list2.Distinct().ToArray();
StaticMembers.resolveMissingReferences = resolveMissingReferences;
}
return list;
}
internal static List<SaplingDB> GenerateCustomSaplingRefs()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: 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_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
List<SaplingDB> list = new List<SaplingDB>(4);
list.Add(new SaplingDB
{
key = "Ashwood_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomes ? 57 : ((int)StaticMembers.AllBiomes)),
source = "AshlandsTree3",
Resources = new Dictionary<string, int>
{
{ "BeechSeeds", 1 },
{ "SulfurStone", 1 }
},
icon = true,
growTime = StaticMembers.config.AshwoodGrowthTime,
growRadius = StaticMembers.config.AshwoodGrowRadius,
minScale = StaticMembers.config.AshwoodMinScale,
maxScale = StaticMembers.config.AshwoodMaxScale,
grownPrefabs = (GameObject[])(object)new GameObject[4]
{
StaticMembers.prefabRefs["AshlandsTree3"],
StaticMembers.prefabRefs["AshlandsTree4"],
StaticMembers.prefabRefs["AshlandsTree5"],
StaticMembers.prefabRefs["AshlandsTree6_big"]
},
tolerateHeat = true
});
list.Add(new SaplingDB
{
key = "Ygga_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomes ? 537 : ((int)StaticMembers.AllBiomes)),
source = "YggaShoot_small1",
Resource = new KeyValuePair<string, int>("Sap", 1),
icon = true,
growTime = StaticMembers.config.YggaGrowthTime,
growRadius = StaticMembers.config.YggaGrowRadius,
minScale = StaticMembers.config.YggaMinScale,
maxScale = StaticMembers.config.YggaMaxScale,
grownPrefabs = (GameObject[])(object)new GameObject[3]
{
StaticMembers.prefabRefs["YggaShoot1"],
StaticMembers.prefabRefs["YggaShoot2"],
StaticMembers.prefabRefs["YggaShoot3"]
}
});
list.Add(new SaplingDB
{
key = "Ancient_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomes ? 27 : ((int)StaticMembers.AllBiomes)),
source = "SwampTree1",
Resource = new KeyValuePair<string, int>("AncientSeed", 1),
icon = true,
growTime = StaticMembers.config.AncientGrowthTime,
growRadius = StaticMembers.config.AncientGrowRadius,
minScale = StaticMembers.config.AncientMinScale,
maxScale = StaticMembers.config.AncientMaxScale,
grownPrefabs = (GameObject[])(object)new GameObject[1] { StaticMembers.prefabRefs["SwampTree1"] }
});
list.Add(new SaplingDB
{
key = "Autumn_Birch_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomes ? 25 : ((int)StaticMembers.AllBiomes)),
source = "Birch1_aut",
Resource = new KeyValuePair<string, int>("BirchSeeds", 1),
icon = true,
growTime = StaticMembers.config.AutumnBirchGrowthTime,
growRadius = StaticMembers.config.AutumnBirchGrowRadius,
minScale = StaticMembers.config.AutumnBirchMinScale,
maxScale = StaticMembers.config.AutumnBirchMaxScale,
grownPrefabs = (GameObject[])(object)new GameObject[2]
{
StaticMembers.prefabRefs["Birch1_aut"],
StaticMembers.prefabRefs["Birch2_aut"]
}
});
return list;
}
internal static List<SaplingDB> GenerateVanillaSaplingRefs()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
return new List<SaplingDB>(5)
{
new SaplingDB
{
key = "Beech_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomesVanilla ? 25 : ((int)StaticMembers.AllBiomes)),
growTime = StaticMembers.config.BeechGrowthTime,
growRadius = StaticMembers.config.BeechGrowRadius,
minScale = StaticMembers.config.BeechMinScale,
maxScale = StaticMembers.config.BeechMaxScale
},
new SaplingDB
{
key = "PineTree_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomesVanilla ? 25 : ((int)StaticMembers.AllBiomes)),
growTime = StaticMembers.config.PineGrowthTime,
growRadius = StaticMembers.config.PineGrowRadius,
minScale = StaticMembers.config.PineMinScale,
maxScale = StaticMembers.config.PineMaxScale
},
new SaplingDB
{
key = "FirTree_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomesVanilla ? 29 : ((int)StaticMembers.AllBiomes)),
growTime = StaticMembers.config.FirGrowthTime,
growRadius = StaticMembers.config.FirGrowRadius,
minScale = StaticMembers.config.FirMinScale,
maxScale = StaticMembers.config.FirMaxScale,
tolerateCold = true
},
new SaplingDB
{
key = "Birch_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomesVanilla ? 25 : ((int)StaticMembers.AllBiomes)),
growTime = StaticMembers.config.BirchGrowthTime,
growRadius = StaticMembers.config.BirchGrowRadius,
minScale = StaticMembers.config.BirchMinScale,
maxScale = StaticMembers.config.BirchMaxScale
},
new SaplingDB
{
key = "Oak_Sapling",
biome = (Biome)(StaticMembers.config.EnforceBiomesVanilla ? 25 : ((int)StaticMembers.AllBiomes)),
growTime = StaticMembers.config.OakGrowthTime,
growRadius = StaticMembers.config.OakGrowRadius,
minScale = StaticMembers.config.OakMinScale,
maxScale = StaticMembers.config.OakMaxScale
}
};
}
internal static List<PrefabDB> GenerateCropRefs()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
bool enableCropOverrides = StaticMembers.config.EnableCropOverrides;
bool enforceBiomesVanilla = StaticMembers.config.EnforceBiomesVanilla;
return new List<PrefabDB>(10)
{
new PrefabDB
{
key = "sapling_barley",
biome = (Biome)(enforceBiomesVanilla ? 16 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.BarleyCost),
resourceReturn = (enableCropOverrides ? StaticMembers.config.BarleyReturn : 2)
},
new PrefabDB
{
key = "sapling_carrot",
biome = (Biome)(enforceBiomesVanilla ? 25 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.CarrotCost),
resourceReturn = ((!enableCropOverrides) ? 1 : StaticMembers.config.CarrotReturn)
},
new PrefabDB
{
key = "sapling_flax",
biome = (Biome)(enforceBiomesVanilla ? 16 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.FlaxCost),
resourceReturn = (enableCropOverrides ? StaticMembers.config.FlaxReturn : 2)
},
new PrefabDB
{
key = "sapling_onion",
biome = (Biome)(enforceBiomesVanilla ? 25 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.OnionCost),
resourceReturn = ((!enableCropOverrides) ? 1 : StaticMembers.config.OnionReturn)
},
new PrefabDB
{
key = "sapling_seedcarrot",
biome = (Biome)(enforceBiomesVanilla ? 25 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.SeedCarrotCost),
resourceReturn = (enableCropOverrides ? StaticMembers.config.SeedCarrotReturn : 3)
},
new PrefabDB
{
key = "sapling_seedonion",
biome = (Biome)(enforceBiomesVanilla ? 25 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.SeedOnionCost),
resourceReturn = (enableCropOverrides ? StaticMembers.config.SeedOnionReturn : 3)
},
new PrefabDB
{
key = "sapling_seedturnip",
biome = (Biome)(enforceBiomesVanilla ? 539 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.SeedTurnipCost),
resourceReturn = (enableCropOverrides ? StaticMembers.config.SeedTurnipReturn : 3)
},
new PrefabDB
{
key = "sapling_turnip",
biome = (Biome)(enforceBiomesVanilla ? 539 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.TurnipCost),
resourceReturn = ((!enableCropOverrides) ? 1 : StaticMembers.config.TurnipReturn)
},
new PrefabDB
{
key = "sapling_magecap",
biome = (Biome)(enforceBiomesVanilla ? 512 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.MagecapCost),
resourceReturn = ((!enableCropOverrides) ? 1 : StaticMembers.config.MagecapReturn),
extraDrops = true
},
new PrefabDB
{
key = "sapling_jotunpuffs",
biome = (Biome)(enforceBiomesVanilla ? 512 : ((int)StaticMembers.AllBiomes)),
resourceCost = ((!enableCropOverrides) ? 1 : StaticMembers.config.JotunPuffsCost),
resourceReturn = ((!enableCropOverrides) ? 1 : StaticMembers.config.JotunPuffsReturn),
extraDrops = true
}
};
}
internal static List<ModdedPlantDB> GenerateCustomPlantRefs(List<GameObject> customPlants)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
List<ModdedPlantDB> list = new List<ModdedPlantDB>();
foreach (GameObject customPlant in customPlants)
{
Plant component = customPlant.GetComponent<Plant>();
list.Add(new ModdedPlantDB
{
key = ((Object)customPlant).name,
biome = component.m_biome,
tolerateCold = component.m_tolerateCold,
tolerateHeat = component.m_tolerateHeat,
minScale = component.m_minScale,
maxScale = component.m_maxScale,
growTime = component.m_growTime,
growTimeMax = component.m_growTimeMax,
growRadius = component.m_growRadius
});
StaticMembers.prefabRefs[((Object)customPlant).name] = customPlant;
}
return list;
}
}
internal sealed class ModConfig
{
private readonly ConfigFile ConfigFile;
private readonly ConfigSync ConfigSync;
private ConfigEntry<bool> serverConfigLocked;
internal ConfigEntry<int> nexusID;
private ConfigEntry<bool> enableDebugMessages;
private ConfigEntry<bool> showPickableSpawners;
private ConfigEntry<bool> enableMiscFlora;
private ConfigEntry<bool> enableDebris;
private ConfigEntry<bool> enableExtraResources;
private ConfigEntry<bool> snappableVines;
private ConfigEntry<bool> enableLocalization;
private ConfigEntry<string> language;
private ConfigEntry<string> disabledResourceNames;
private ConfigEntry<bool> requireCultivation;
private ConfigEntry<bool> placeAnywhere;
private ConfigEntry<bool> enforceBiomes;
private ConfigEntry<bool> enforceBiomesVanilla;
private ConfigEntry<bool> plantsRequireShielding;
private ConfigEntry<bool> canRemoveFlora;
private ConfigEntry<bool> recoverResources;
private ConfigEntry<bool> resourcesSpawnEmpty;
private ConfigEntry<bool> enemiesTargetPieces;
private ConfigEntry<int> raspberryCost;
private ConfigEntry<int> blueberryCost;
private ConfigEntry<int> cloudberryCost;
private ConfigEntry<int> raspberryRespawnTime;
private ConfigEntry<int> blueberryRespawnTime;
private ConfigEntry<int> cloudberryRespawnTime;
private ConfigEntry<int> raspberryReturn;
private ConfigEntry<int> blueberryReturn;
private ConfigEntry<int> cloudberryReturn;
private ConfigEntry<bool> enableCropOverrides;
private ConfigEntry<bool> overrideModdedCrops;
private ConfigEntry<bool> cropRequireCultivation;
private ConfigEntry<bool> cropRequireSunlight;
private ConfigEntry<bool> cropRequireGrowthSpace;
private ConfigEntry<bool> enemiesTargetCrops;
private ConfigEntry<float> cropMinScale;
private ConfigEntry<float> cropMaxScale;
private ConfigEntry<float> cropGrowTimeMin;
private ConfigEntry<float> cropGrowTimeMax;
private ConfigEntry<float> cropGrowRadius;
private ConfigEntry<int> barleyCost;
private ConfigEntry<int> barleyReturn;
private ConfigEntry<int> carrotCost;
private ConfigEntry<int> carrotReturn;
private ConfigEntry<int> flaxCost;
private ConfigEntry<int> flaxReturn;
private ConfigEntry<int> onionCost;
private ConfigEntry<int> onionReturn;
private ConfigEntry<int> seedCarrotCost;
private ConfigEntry<int> seedCarrotReturn;
private ConfigEntry<int> seedOnionCost;
private ConfigEntry<int> seedOnionReturn;
private ConfigEntry<int> seedTurnipCost;
private ConfigEntry<int> seedTurnipReturn;
private ConfigEntry<int> turnipCost;
private ConfigEntry<int> turnipReturn;
private ConfigEntry<int> magecapCost;
private ConfigEntry<int> magecapReturn;
private ConfigEntry<int> jotunPuffsCost;
private ConfigEntry<int> jotunPuffsReturn;
private ConfigEntry<int> pickableBranchCost;
private ConfigEntry<int> pickableBranchReturn;
private ConfigEntry<int> pickableBranchRespawnTime;
private ConfigEntry<int> pickableStoneCost;
private ConfigEntry<int> pickableStoneReturn;
private ConfigEntry<int> pickableStoneRespawnTime;
private ConfigEntry<int> pickableFlintCost;
private ConfigEntry<int> pickableFlintReturn;
private ConfigEntry<int> pickableFlintRespawnTime;
private ConfigEntry<int> mushroomCost;
private ConfigEntry<int> yellowMushroomCost;
private ConfigEntry<int> blueMushroomCost;
private ConfigEntry<int> smokePuffCost;
private ConfigEntry<int> mushroomRespawnTime;
private ConfigEntry<int> yellowMushroomRespawnTime;
private ConfigEntry<int> blueMushroomRespawnTime;
private ConfigEntry<int> smokePuffRespawnTime;
private ConfigEntry<int> mushroomReturn;
private ConfigEntry<int> yellowMushroomReturn;
private ConfigEntry<int> blueMushroomReturn;
private ConfigEntry<int> smokePuffReturn;
private ConfigEntry<int> thistleCost;
private ConfigEntry<int> dandelionCost;
private ConfigEntry<int> fiddleheadCost;
private ConfigEntry<int> thistleRespawnTime;
private ConfigEntry<int> dandelionRespawnTime;
private ConfigEntry<int> fiddleheadRespawnTime;
private ConfigEntry<int> thistleReturn;
private ConfigEntry<int> dandelionReturn;
private ConfigEntry<int> fiddleheadReturn;
private ConfigEntry<bool> overrideModdedSaplings;
private ConfigEntry<float> moddedSaplingMinScale;
private ConfigEntry<float> moddedSaplingMaxScale;
private ConfigEntry<float> moddedSaplingGrowthTime;
private ConfigEntry<float> moddedSaplingGrowRadius;
private ConfigEntry<float> birchMinScale;
private ConfigEntry<float> birchMaxScale;
private ConfigEntry<float> oakMinScale;
private ConfigEntry<float> oakMaxScale;
private ConfigEntry<float> ancientMinScale;
private ConfigEntry<float> ancientMaxScale;
private ConfigEntry<float> birchGrowthTime;
private ConfigEntry<float> oakGrowthTime;
private ConfigEntry<float> ancientGrowthTime;
private ConfigEntry<float> birchGrowRadius;
private ConfigEntry<float> oakGrowRadius;
private ConfigEntry<float> ancientGrowRadius;
private ConfigEntry<float> beechGrowthTime;
private ConfigEntry<float> pineGrowthTime;
private ConfigEntry<float> firGrowthTime;
private ConfigEntry<float> beechMinScale;
private ConfigEntry<float> beechMaxScale;
private ConfigEntry<float> pineMinScale;
private ConfigEntry<float> pineMaxScale;
private ConfigEntry<float> firMinScale;
private ConfigEntry<float> firMaxScale;
private ConfigEntry<float> beechGrowRadius;
private ConfigEntry<float> pineGrowRadius;
private ConfigEntry<float> firGrowRadius;
private ConfigEntry<float> yggaMinScale;
private ConfigEntry<float> yggaMaxScale;
private ConfigEntry<float> yggaGrowthTime;
private ConfigEntry<float> yggaGrowRadius;
private ConfigEntry<float> autumnBirchMinScale;
private ConfigEntry<float> autumnBirchMaxScale;
private ConfigEntry<float> autumnBirchGrowthTime;
private ConfigEntry<float> autumnBirchGrowRadius;
private ConfigEntry<float> ashwoodMinScale;
private ConfigEntry<float> ashwoodMaxScale;
private ConfigEntry<float> ashwoodGrowthTime;
private ConfigEntry<float> ashwoodGrowRadius;
private ConfigEntry<bool> enableSeedOverrides;
private ConfigEntry<int> seedDropMin;
private ConfigEntry<int> seedDropMax;
private ConfigEntry<int> treeDropMin;
private ConfigEntry<int> treeDropMax;
private ConfigEntry<float> dropChance;
private ConfigEntry<bool> oneOfEach;
private ConfigEntry<bool> enablePickableTimers;
private ConfigEntry<bool> enablePlantTimers;
private ConfigEntry<bool> growthAsPercentage;
private ConfigEntry<bool> enableVineOverrides;
private ConfigEntry<float> vineAttachDistance;
private ConfigEntry<float> vineGrowRadius;
private ConfigEntry<float> vineGrowthTime;
private ConfigEntry<int> vineBerryRespawnTime;
private ConfigEntry<int> vineBerryReturn;
private CustomSyncedValue<List<string>> extraResources;
private readonly ConfigurationManagerAttributes seedSettingAtrributes = new ConfigurationManagerAttributes();
private readonly List<ConfigurationManagerAttributes> cropSettingAttributes = new List<ConfigurationManagerAttributes>(2)
{
new ConfigurationManagerAttributes(),
new ConfigurationManagerAttributes
{
Order = 27
}
};
internal bool EnableDebugMessages => enableDebugMessages.Value;
internal bool ShowPickableSpawners => showPickableSpawners.Value;
internal bool EnableMiscFlora => enableMiscFlora.Value;
internal bool EnableDebris => enableDebris.Value;
internal bool EnableExtraResources => enableExtraResources.Value;
internal bool SnappableVines => snappableVines.Value;
internal bool EnableLocalization => enableLocalization.Value;
internal string Language => language.Value;
internal string[] DisabledResourceNames => disabledResourceNames.Value.Split(new char[1] { ',' });
internal bool RequireCultivation => requireCultivation.Value;
internal bool PlaceAnywhere => placeAnywhere.Value;
internal bool EnforceBiomes => enforceBiomes.Value;
internal bool EnforceBiomesVanilla => enforceBiomesVanilla.Value;
internal bool PlantsRequireShielding => plantsRequireShielding.Value;
internal bool CanRemoveFlora => canRemoveFlora.Value;
internal bool RecoverResources => recoverResources.Value;
internal bool ResourcesSpawnEmpty => resourcesSpawnEmpty.Value;
internal bool EnemiesTargetPieces => enemiesTargetPieces.Value;
internal int RaspberryCost => raspberryCost.Value;
internal int BlueberryCost => blueberryCost.Value;
internal int CloudberryCost => cloudberryCost.Value;
internal int RaspberryRespawnTime => raspberryRespawnTime.Value;
internal int BlueberryRespawnTime => blueberryRespawnTime.Value;
internal int CloudberryRespawnTime => cloudberryRespawnTime.Value;
internal int RaspberryReturn => raspberryReturn.Value;
internal int BlueberryReturn => blueberryReturn.Value;
internal int CloudberryReturn => cloudberryReturn.Value;
internal bool EnableCropOverrides => enableCropOverrides.Value;
internal bool OverrideModdedCrops => overrideModdedCrops.Value;
internal float CropMinScale => cropMinScale.Value;
internal float CropMaxScale => cropMaxScale.Value;
internal float CropGrowTimeMin => Mathf.Max(cropGrowTimeMin.Value, 10f);
internal float CropGrowTimeMax => Mathf.Max(cropGrowTimeMax.Value, 10f);
internal float CropGrowRadius => cropGrowRadius.Value;
internal bool CropRequireCultivation => cropRequireCultivation.Value;
internal bool CropRequireSunlight => cropRequireSunlight.Value;
internal bool CropRequireGrowthSpace => cropRequireGrowthSpace.Value;
internal bool EnemiesTargetCrops => enemiesTargetCrops.Value;
internal int BarleyCost => barleyCost.Value;
internal int BarleyReturn => barleyReturn.Value;
internal int CarrotCost => carrotCost.Value;
internal int CarrotReturn => carrotReturn.Value;
internal int FlaxCost => flaxCost.Value;
internal int FlaxReturn => flaxReturn.Value;
internal int OnionCost => onionCost.Value;
internal int OnionReturn => onionReturn.Value;
internal int SeedCarrotCost => seedCarrotCost.Value;
internal int SeedCarrotReturn => seedCarrotReturn.Value;
internal int SeedOnionCost => seedOnionCost.Value;
internal int SeedOnionReturn => seedOnionReturn.Value;
internal int SeedTurnipCost => seedTurnipCost.Value;
internal int SeedTurnipReturn => seedTurnipReturn.Value;
internal int TurnipCost => turnipCost.Value;
internal int TurnipReturn => turnipReturn.Value;
internal int MagecapCost => magecapCost.Value;
internal int MagecapReturn => magecapReturn.Value;
internal int JotunPuffsCost => jotunPuffsCost.Value;
internal int JotunPuffsReturn => jotunPuffsReturn.Value;
internal int PickableBranchCost => pickableBranchCost.Value;
internal int PickableBranchReturn => pickableBranchReturn.Value;
internal int PickableBranchRespawnTime => pickableBranchRespawnTime.Value;
internal int PickableStoneCost => pickableStoneCost.Value;
internal int PickableStoneReturn => pickableStoneReturn.Value;
internal int PickableStoneRespawnTime => pickableStoneRespawnTime.Value;
internal int PickableFlintCost => pickableFlintCost.Value;
internal int PickableFlintReturn => pickableFlintReturn.Value;
internal int PickableFlintRespawnTime => pickableFlintRespawnTime.Value;
internal int MushroomCost => mushroomCost.Value;
internal int YellowMushroomCost => yellowMushroomCost.Value;
internal int BlueMushroomCost => blueMushroomCost.Value;
internal int SmokePuffCost => smokePuffCost.Value;
internal int MushroomRespawnTime => mushroomRespawnTime.Value;
internal int YellowMushroomRespawnTime => yellowMushroomRespawnTime.Value;
internal int BlueMushroomRespawnTime => blueMushroomRespawnTime.Value;
internal int SmokePuffRespawnTime => smokePuffRespawnTime.Value;
internal int MushroomReturn => mushroomReturn.Value;
internal int YellowMushroomReturn => yellowMushroomReturn.Value;
internal int BlueMushroomReturn => blueMushroomReturn.Value;
internal int SmokePuffReturn => smokePuffReturn.Value;
internal int ThistleCost => thistleCost.Value;
internal int DandelionCost => dandelionCost.Value;
internal int Fidd