using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Digitalroot.Valheim.Common;
using Digitalroot.Valheim.Common.Json;
using Digitalroot.Valheim.Common.Names.Vanilla;
using JetBrains.Annotations;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using SimpleJson;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Digitalroot Technologies")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCopyright("Copyright © Digitalroot Technologies 2021 - 2024")]
[assembly: AssemblyDescription("Add new upgrades for the Club weapon.")]
[assembly: AssemblyFileVersion("1.1.42.0")]
[assembly: AssemblyInformationalVersion("1.1.42+0eb7934165916a53f7c0e6cc1a97957b243b7305")]
[assembly: AssemblyProduct("Digitalroot Valheim Better Clubs")]
[assembly: AssemblyTitle("Digitalroot.Valheim.BetterClubs")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Digitalroot-Valheim/Digitalroot.Valheim.BetterClubs")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.42.0")]
[module: UnverifiableCode]
namespace Digitalroot.Valheim.BetterClubs
{
[BepInPlugin("digitalroot.mods.betterclubs", "Digitalroot Better Clubs", "1.1.42")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class Main : BaseUnityPlugin, ITraceableLogging
{
[UsedImplicitly]
public static Main Instance;
[UsedImplicitly]
public static ConfigEntry<int> NexusId;
public const string Version = "1.1.42";
public const string Name = "Digitalroot Better Clubs";
public const string Guid = "digitalroot.mods.betterclubs";
public const string Namespace = "Digitalroot.Valheim.BetterClubs";
public string Source => "Digitalroot.Valheim.BetterClubs";
public bool EnableTrace { get; private set; }
public Main()
{
//IL_0036: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
Instance = this;
EnableTrace = false;
NexusId = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 2301, new ConfigDescription("Nexus mod ID for updates", (AcceptableValueBase)null, new object[1] { (object)new ConfigurationManagerAttributes
{
Browsable = false,
ReadOnly = true
} }));
Log.RegisterSource(Instance);
Log.Trace(Instance, "Digitalroot.Valheim.BetterClubs." + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + "." + MethodBase.GetCurrentMethod()?.Name);
}
[UsedImplicitly]
public void Awake()
{
try
{
Log.Trace(Instance, "Digitalroot.Valheim.BetterClubs." + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + "." + MethodBase.GetCurrentMethod()?.Name);
PrefabManager.OnVanillaPrefabsAvailable += AddClonedItems;
}
catch (Exception e)
{
Log.Error(Instance, e);
}
}
private void AddClonedItems()
{
try
{
Log.Trace(Instance, "Digitalroot.Valheim.BetterClubs." + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + "." + MethodBase.GetCurrentMethod()?.Name);
ClubBronzeNail();
ClubIronNail();
ClubFire();
ClubStone();
ClubBee();
ClubPoison();
PrefabManager.OnVanillaPrefabsAvailable -= AddClonedItems;
}
catch (Exception e)
{
Log.Error(Instance, e);
}
}
private void ClubBronzeNail()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
CustomItem val = new CustomItem("ClubBronzeNail", ItemDropNames.Club);
ItemManager.Instance.AddItem(val);
ItemDrop itemDrop = val.ItemDrop;
itemDrop.m_itemData.m_shared.m_name = "$item_club_bronze_nail";
itemDrop.m_itemData.m_shared.m_description = "$item_club_bronze_nail_description";
itemDrop.m_itemData.m_shared.m_damages.m_pierce = 5f;
itemDrop.m_itemData.m_shared.m_damagesPerLevel.m_pierce = 2f;
itemDrop.m_itemData.m_shared.m_maxQuality = 5;
RecipeClubBronzeNail(itemDrop);
}
private static void RecipeClubBronzeNail(ItemDrop itemDrop)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
Recipe val = ScriptableObject.CreateInstance<Recipe>();
((Object)val).name = "Recipe_ClubBronzeNail";
val.m_item = itemDrop;
val.m_craftingStation = Cache.GetPrefab<CraftingStation>(CraftingStationNames.Workbench);
val.m_resources = (Requirement[])(object)new Requirement[2]
{
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Club),
m_amount = 1,
m_amountPerLevel = 0
},
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.BronzeNails),
m_amount = 1,
m_amountPerLevel = 1
}
};
CustomRecipe val2 = new CustomRecipe(val, false, false);
ItemManager.Instance.AddRecipe(val2);
}
private void ClubIronNail()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
CustomItem val = new CustomItem("ClubIronNail", ItemDropNames.Club);
ItemManager.Instance.AddItem(val);
ItemDrop itemDrop = val.ItemDrop;
itemDrop.m_itemData.m_shared.m_name = "$item_club_iron_nail";
itemDrop.m_itemData.m_shared.m_description = "$item_club_iron_nail_description";
itemDrop.m_itemData.m_shared.m_damages.m_pierce = 6f;
itemDrop.m_itemData.m_shared.m_damagesPerLevel.m_pierce = 3f;
itemDrop.m_itemData.m_shared.m_maxQuality = 5;
RecipeClubIronNail(itemDrop);
}
private static void RecipeClubIronNail(ItemDrop itemDrop)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
Recipe val = ScriptableObject.CreateInstance<Recipe>();
((Object)val).name = "Recipe_ClubIronNail";
val.m_item = itemDrop;
val.m_craftingStation = Cache.GetPrefab<CraftingStation>(CraftingStationNames.Workbench);
val.m_resources = (Requirement[])(object)new Requirement[2]
{
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Club),
m_amount = 1,
m_amountPerLevel = 0
},
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.IronNails),
m_amount = 1,
m_amountPerLevel = 1
}
};
CustomRecipe val2 = new CustomRecipe(val, false, false);
ItemManager.Instance.AddRecipe(val2);
}
private void ClubFire()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
CustomItem val = new CustomItem("ClubFire", ItemDropNames.Club);
ItemManager.Instance.AddItem(val);
ItemDrop itemDrop = val.ItemDrop;
itemDrop.m_itemData.m_shared.m_name = "$item_club_fire";
itemDrop.m_itemData.m_shared.m_description = "$item_club_fire_description";
itemDrop.m_itemData.m_shared.m_damages.m_fire = 5f;
itemDrop.m_itemData.m_shared.m_damagesPerLevel.m_fire = 4f;
itemDrop.m_itemData.m_shared.m_maxQuality = 5;
RecipeClubFire(itemDrop);
}
private static void RecipeClubFire(ItemDrop itemDrop)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
Recipe val = ScriptableObject.CreateInstance<Recipe>();
((Object)val).name = "Recipe_ClubFire";
val.m_item = itemDrop;
val.m_craftingStation = Cache.GetPrefab<CraftingStation>(CraftingStationNames.Workbench);
val.m_resources = (Requirement[])(object)new Requirement[3]
{
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Club),
m_amount = 1,
m_amountPerLevel = 0
},
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Resin),
m_amount = 2,
m_amountPerLevel = 2
},
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Flint),
m_amount = 1,
m_amountPerLevel = 1
}
};
CustomRecipe val2 = new CustomRecipe(val, false, false);
ItemManager.Instance.AddRecipe(val2);
}
private void ClubStone()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
CustomItem val = new CustomItem("ClubStone", ItemDropNames.Club);
ItemManager.Instance.AddItem(val);
ItemDrop itemDrop = val.ItemDrop;
itemDrop.m_itemData.m_shared.m_name = "$item_club_stone";
itemDrop.m_itemData.m_shared.m_description = "$item_club_stone_description";
itemDrop.m_itemData.m_shared.m_damages.m_blunt = 15f;
itemDrop.m_itemData.m_shared.m_damagesPerLevel.m_blunt = 8f;
itemDrop.m_itemData.m_shared.m_maxQuality = 5;
itemDrop.m_itemData.m_shared.m_movementModifier = -0.06f;
itemDrop.m_itemData.m_shared.m_weight = 5f;
RecipeClubStone(itemDrop);
}
private static void RecipeClubStone(ItemDrop itemDrop)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
Recipe val = ScriptableObject.CreateInstance<Recipe>();
((Object)val).name = "Recipe_ClubStone";
val.m_item = itemDrop;
val.m_craftingStation = Cache.GetPrefab<CraftingStation>(CraftingStationNames.Workbench);
val.m_resources = (Requirement[])(object)new Requirement[2]
{
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Club),
m_amount = 1,
m_amountPerLevel = 0
},
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Stone),
m_amount = 4,
m_amountPerLevel = 4
}
};
CustomRecipe val2 = new CustomRecipe(val, false, false);
ItemManager.Instance.AddRecipe(val2);
}
private void ClubBee()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
CustomItem val = new CustomItem("ClubBee", ItemDropNames.Club);
ItemManager.Instance.AddItem(val);
ItemDrop itemDrop = val.ItemDrop;
itemDrop.m_itemData.m_shared.m_name = "$item_club_bee";
itemDrop.m_itemData.m_shared.m_description = "$item_club_bee_description";
itemDrop.m_itemData.m_shared.m_damages.m_poison = 5f;
itemDrop.m_itemData.m_shared.m_damages.m_pierce = 1f;
itemDrop.m_itemData.m_shared.m_maxQuality = 1;
RecipeClubBee(itemDrop);
}
private static void RecipeClubBee(ItemDrop itemDrop)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
Recipe val = ScriptableObject.CreateInstance<Recipe>();
((Object)val).name = "Recipe_ClubBee";
val.m_item = itemDrop;
val.m_craftingStation = Cache.GetPrefab<CraftingStation>(CraftingStationNames.Workbench);
val.m_resources = (Requirement[])(object)new Requirement[2]
{
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Club),
m_amount = 1,
m_amountPerLevel = 0
},
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.QueenBee),
m_amount = 1,
m_amountPerLevel = 200
}
};
CustomRecipe val2 = new CustomRecipe(val, false, false);
ItemManager.Instance.AddRecipe(val2);
}
private void ClubPoison()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
CustomItem val = new CustomItem("ClubPoison", ItemDropNames.Club);
ItemManager.Instance.AddItem(val);
ItemDrop itemDrop = val.ItemDrop;
itemDrop.m_itemData.m_shared.m_name = "$item_club_poison";
itemDrop.m_itemData.m_shared.m_description = "$item_club_poison_description";
itemDrop.m_itemData.m_shared.m_damages.m_poison = 8f;
itemDrop.m_itemData.m_shared.m_damagesPerLevel.m_poison = 4f;
itemDrop.m_itemData.m_shared.m_maxQuality = 5;
RecipeClubPoison(itemDrop);
}
private static void RecipeClubPoison(ItemDrop itemDrop)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
Recipe val = ScriptableObject.CreateInstance<Recipe>();
((Object)val).name = "Recipe_ClubPoison";
val.m_item = itemDrop;
val.m_craftingStation = Cache.GetPrefab<CraftingStation>(CraftingStationNames.Workbench);
val.m_resources = (Requirement[])(object)new Requirement[2]
{
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Club),
m_amount = 1,
m_amountPerLevel = 0
},
new Requirement
{
m_resItem = Cache.GetPrefab<ItemDrop>(ItemDropNames.Guck),
m_amount = 1,
m_amountPerLevel = 3
}
};
CustomRecipe val2 = new CustomRecipe(val, false, false);
ItemManager.Instance.AddRecipe(val2);
}
}
}
namespace Digitalroot.Valheim.Common
{
internal interface ITraceableLogging
{
string Source { get; }
bool EnableTrace { get; }
}
internal sealed class Log
{
private static readonly Dictionary<string, TraceLogger> TraceLoggers;
[UsedImplicitly]
private static Log Instance { get; }
static Log()
{
TraceLoggers = new Dictionary<string, TraceLogger>();
Instance = new Log();
}
private Log()
{
TraceLoggers.Add("Digitalroot", new TraceLogger("Digitalroot", enableTrace: false));
}
public static void RegisterSource(ITraceableLogging sender)
{
if ((!TraceLoggers.ContainsKey(sender.Source) || TraceLoggers[sender.Source].IsTraceEnabled != sender.EnableTrace) && (!TraceLoggers.ContainsKey(sender.Source) || sender.EnableTrace))
{
if (TraceLoggers.ContainsKey(sender.Source) && sender.EnableTrace)
{
TraceLoggers[sender.Source].EnableTrace();
}
else
{
TraceLoggers.Add(sender.Source, new TraceLogger(sender.Source, sender.EnableTrace));
}
}
}
private static TraceLogger GetTraceLogger(ITraceableLogging sender)
{
if (!TraceLoggers.ContainsKey(sender.Source))
{
return TraceLoggers["Digitalroot"];
}
return TraceLoggers[sender.Source];
}
[UsedImplicitly]
public static void SetEnableTrace(ITraceableLogging sender, bool value)
{
if (value)
{
GetTraceLogger(sender).EnableTrace();
}
else
{
GetTraceLogger(sender).DisableTrace();
}
}
[UsedImplicitly]
public static void SetEnableTraceForAllLoggers(bool value)
{
foreach (TraceLogger value2 in TraceLoggers.Values)
{
if (value)
{
value2.EnableTrace();
}
else
{
value2.DisableTrace();
}
}
}
[UsedImplicitly]
public static void Debug(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogDebug(value);
}
[UsedImplicitly]
public static void Error(ITraceableLogging sender, Exception e, int i = 1)
{
Error(sender, "Message: " + e.Message);
Error(sender, $"TargetSite: {e.TargetSite}");
Error(sender, "StackTrace: " + e.StackTrace);
Error(sender, "Source: " + e.Source);
if (e.Data.Count > 0)
{
foreach (object key in e.Data.Keys)
{
Error(sender, $"key: {key}, value: {e.Data[key]}");
}
}
if (e.InnerException != null)
{
Error(sender, $"--- InnerException [{i}][Start] ---");
Error(sender, e.InnerException, ++i);
}
}
[UsedImplicitly]
public static void Error(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogError(value);
}
[UsedImplicitly]
public static void Info(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogInfo(value);
}
[UsedImplicitly]
public static void Fatal(ITraceableLogging sender, Exception e, int i = 1)
{
Fatal(sender, "Message: " + e.Message);
Fatal(sender, $"TargetSite: {e.TargetSite}");
Fatal(sender, "StackTrace: " + e.StackTrace);
Fatal(sender, "Source: " + e.Source);
if (e.Data.Count > 0)
{
foreach (object key in e.Data.Keys)
{
Fatal(sender, $"key: {key}, value: {e.Data[key]}");
}
}
if (e.InnerException != null)
{
Fatal(sender, $"--- InnerException [{i}][Start] ---");
Fatal(sender, e.InnerException, ++i);
}
}
[UsedImplicitly]
public static void Fatal(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogFatal(value);
}
[UsedImplicitly]
public static void Message(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogMessage(value);
}
[UsedImplicitly]
public static void Trace(ITraceableLogging sender, object value)
{
if (GetTraceLogger(sender).IsTraceEnabled || sender.EnableTrace)
{
GetTraceLogger(sender).LoggerRef.Log((LogLevel)63, value);
}
}
[UsedImplicitly]
public static void Warning(ITraceableLogging sender, object value)
{
GetTraceLogger(sender).LoggerRef.LogWarning(value);
}
}
internal class TraceLogger
{
internal readonly ManualLogSource LoggerRef;
private readonly string _source;
private readonly FileInfo _traceFileInfo;
public bool IsTraceEnabled { get; private set; }
private DirectoryInfo AssemblyDirectory => new FileInfo(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)).Directory;
public TraceLogger(string source, bool enableTrace)
{
_source = source;
IsTraceEnabled = enableTrace;
LoggerRef = Logger.CreateLogSource(_source);
_traceFileInfo = new FileInfo(Path.Combine(Paths.BepInExRootPath ?? AssemblyDirectory.FullName, "logs", _source + ".Trace.log"));
if (_traceFileInfo.DirectoryName != null)
{
Directory.CreateDirectory(_traceFileInfo.DirectoryName);
}
if (_traceFileInfo.Exists)
{
_traceFileInfo.Delete();
_traceFileInfo.Refresh();
}
LoggerRef.LogEvent += OnLogEvent;
}
public void EnableTrace()
{
IsTraceEnabled = true;
}
public void DisableTrace()
{
IsTraceEnabled = false;
}
[UsedImplicitly]
public void StopTrace()
{
LoggerRef.LogEvent -= OnLogEvent;
}
private void OnLogEvent(object sender, LogEventArgs e)
{
//IL_00b0: 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)
if (e.Source.SourceName != _source || !IsTraceEnabled)
{
return;
}
using Mutex mutex = new Mutex(initiallyOwned: false, "Digitalroot.Valheim.Common.TraceLogger." + _source);
mutex.WaitOne();
try
{
if (e.Data is string)
{
string contents = $"[{e.Level,-7}:{e.Source.SourceName,10}] {e.Data}{Environment.NewLine}";
File.AppendAllText(_traceFileInfo.FullName, contents, Encoding.UTF8);
}
else
{
string contents2 = $"[{e.Level,-7}:{e.Source.SourceName,10}] {JsonSerializationProvider.Serialize(e.Data)}{Environment.NewLine}";
File.AppendAllText(_traceFileInfo.FullName, contents2, Encoding.UTF8);
}
}
finally
{
mutex.ReleaseMutex();
}
}
}
}
namespace Digitalroot.Valheim.Common.Json
{
[UsedImplicitly]
internal static class JsonSerializationProvider
{
[Obsolete("Use Deserialize<T>()")]
public static T FromJson<T>(string json)
{
return Deserialize<T>(json);
}
public static T Deserialize<T>(string json)
{
return SimpleJson.DeserializeObject<T>(json, (IJsonSerializerStrategy)(object)new DigitalrootJsonSerializerStrategy());
}
[Obsolete("Use Serialize()")]
public static string ToJson(object obj, bool pretty = false)
{
return Serialize(obj);
}
public static string Serialize(object obj)
{
return SimpleJson.SerializeObject(obj, (IJsonSerializerStrategy)(object)new DigitalrootJsonSerializerStrategy());
}
}
internal class DigitalrootJsonSerializerStrategy : PocoJsonSerializerStrategy
{
public override bool TrySerializeNonPrimitiveObject(object input, out object output)
{
//IL_0009: 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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
if (!(input is Vector3 val))
{
if (input is Quaternion val2)
{
output = new float[4] { val2.x, val2.y, val2.z, val2.w };
return true;
}
return ((PocoJsonSerializerStrategy)this).TrySerializeNonPrimitiveObject(input, ref output);
}
output = new float[3] { val.x, val.y, val.z };
return true;
}
public override object DeserializeObject(object value, Type type)
{
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
if (type == null)
{
throw new ArgumentNullException("type");
}
if (value == null)
{
throw new ArgumentNullException("value");
}
if (value is string value2)
{
if (string.IsNullOrWhiteSpace(value2))
{
throw new ArgumentNullException("value");
}
if (type == typeof(Vector3))
{
if (!(((PocoJsonSerializerStrategy)this).DeserializeObject(value, typeof(float[])) is float[] array) || (array != null && array.Length != 3))
{
throw new ArgumentException(string.Format("The value '{0}' can be converted to a {1}.", value, "Vector3"), "value");
}
return (object)new Vector3(array[0], array[1], array[2]);
}
if (type == typeof(Quaternion))
{
if (!(((PocoJsonSerializerStrategy)this).DeserializeObject(value, typeof(float[])) is float[] array2) || (array2 != null && array2.Length != 4))
{
throw new ArgumentException(string.Format("The value '{0}' can be converted to a {1}.", value, "Quaternion"), "value");
}
return (object)new Quaternion(array2[0], array2[1], array2[2], array2[3]);
}
return ((PocoJsonSerializerStrategy)this).DeserializeObject(value, type);
}
throw new ArgumentException($"The value '{value}' can be converted to a {type.Name}.", "value");
}
}
}
namespace Digitalroot.Valheim.Common.Names.Vanilla
{
internal static class ItemDropNames
{
public static readonly IEnumerable<string> AllNames = Utils.AllNames(typeof(ItemDropNames));
public static string Acorn = "Acorn";
public static string Amber = "Amber";
public static string AmberPearl = "AmberPearl";
public static string AncientSkull = "ancient_skull";
public static string AncientSeed = "AncientSeed";
public static string ArmorCarapaceChest = "ArmorCarapaceChest";
public static string ArmorCarapaceLegs = "ArmorCarapaceLegs";
public static string ArmorDress1 = "ArmorDress1";
public static string ArmorDress2 = "ArmorDress2";
public static string ArmorDress3 = "ArmorDress3";
public static string ArmorDress4 = "ArmorDress4";
public static string ArmorDress5 = "ArmorDress5";
public static string ArmorDress6 = "ArmorDress6";
public static string ArmorDress7 = "ArmorDress7";
public static string ArmorDress8 = "ArmorDress8";
public static string ArmorDress9 = "ArmorDress9";
public static string ArmorDress10 = "ArmorDress10";
public static string ArmorFenringChest = "ArmorFenringChest";
public static string ArmorFenringLegs = "ArmorFenringLegs";
public static string ArmorFlametalChest = "ArmorFlametalChest";
public static string ArmorFlametalLegs = "ArmorFlametalLegs";
public static string ArmorAshlandsMediumChest = "ArmorAshlandsMediumChest";
public static string ArmorAshlandsMediumlegs = "ArmorAshlandsMediumlegs";
public static string ArmorBronzeChest = "ArmorBronzeChest";
public static string ArmorBronzeLegs = "ArmorBronzeLegs";
public static string ArmorIronChest = "ArmorIronChest";
public static string ArmorIronLegs = "ArmorIronLegs";
public static string ArmorMageChest = "ArmorMageChest";
public static string ArmorMageLegs = "ArmorMageLegs";
public static string ArmorMageLegsAshlands = "ArmorMageLegs_Ashlands";
public static string ArmorLeatherChest = "ArmorLeatherChest";
public static string ArmorLeatherLegs = "ArmorLeatherLegs";
public static string ArmorPaddedCuirass = "ArmorPaddedCuirass";
public static string ArmorPaddedGreaves = "ArmorPaddedGreaves";
public static string ArmorRagsChest = "ArmorRagsChest";
public static string ArmorRagsLegs = "ArmorRagsLegs";
public static string ArmorRootChest = "ArmorRootChest";
public static string ArmorRootLegs = "ArmorRootLegs";
public static string ArmorTrollLeatherChest = "ArmorTrollLeatherChest";
public static string ArmorTrollLeatherLegs = "ArmorTrollLeatherLegs";
public static string ArmorTunic1 = "ArmorTunic1";
public static string ArmorTunic2 = "ArmorTunic2";
public static string ArmorTunic3 = "ArmorTunic3";
public static string ArmorTunic4 = "ArmorTunic4";
public static string ArmorTunic5 = "ArmorTunic5";
public static string ArmorTunic6 = "ArmorTunic6";
public static string ArmorTunic7 = "ArmorTunic7";
public static string ArmorTunic8 = "ArmorTunic8";
public static string ArmorTunic9 = "ArmorTunic9";
public static string ArmorTunic10 = "ArmorTunic10";
public static string ArmorWolfChest = "ArmorWolfChest";
public static string ArmorWolfLegs = "ArmorWolfLegs";
public static string ArrowBronze = "ArrowBronze";
public static string ArrowCarapace = "ArrowCarapace";
public static string ArrowCharred = "ArrowCharred";
public static string ArrowFire = "ArrowFire";
public static string ArrowFlint = "ArrowFlint";
public static string ArrowFrost = "ArrowFrost";
public static string ArrowIron = "ArrowIron";
public static string ArrowNeedle = "ArrowNeedle";
public static string ArrowObsidian = "ArrowObsidian";
public static string ArrowPoison = "ArrowPoison";
public static string ArrowSilver = "ArrowSilver";
public static string ArrowWood = "ArrowWood";
public static string AtgeirBlackmetal = "AtgeirBlackmetal";
public static string AtgeirBronze = "AtgeirBronze";
public static string AtgeirHimminAfl = "AtgeirHimminAfl";
public static string AtgeirIron = "AtgeirIron";
public static string AxeBlackMetal = "AxeBlackMetal";
public static string AxeBronze = "AxeBronze";
public static string AxeFlint = "AxeFlint";
public static string AxeIron = "AxeIron";
public static string AxeJotunBane = "AxeJotunBane";
public static string AxeStone = "AxeStone";
public static string BarberKit = "BarberKit";
public static string Barley = "Barley";
public static string BarleyFlour = "BarleyFlour";
public static string BarleyWine = "BarleyWine";
public static string BarleyWineBase = "BarleyWineBase";
public static string Battleaxe = "Battleaxe";
public static string BattleaxeCrystal = "BattleaxeCrystal";
public static string BeechSeeds = "BeechSeeds";
public static string Bell = "Bell";
public static string BeltStrength = "BeltStrength";
public static string Bilebag = "Bilebag";
public static string BirchSeeds = "BirchSeeds";
public static string BlackCore = "BlackCore";
public static string BlackMarble = "BlackMarble";
public static string BlackMetal = "BlackMetal";
public static string BlackMetalScrap = "BlackMetalScrap";
public static string BlackSoup = "BlackSoup";
public static string Blackwood = "Blackwood";
public static string Bloodbag = "Bloodbag";
public static string BloodPudding = "BloodPudding";
public static string Blueberries = "Blueberries";
public static string BoarJerky = "BoarJerky";
public static string BoltBlackmetal = "BoltBlackmetal";
public static string BoltBone = "BoltBone";
public static string BoltCarapace = "BoltCarapace";
public static string BoltCharred = "BoltCharred";
public static string BoltIron = "BoltIron";
public static string BombBile = "BombBile";
public static string BombLava = "BombLava";
public static string BombOoze = "BombOoze";
public static string BombSiege = "BombSiege";
public static string BombSmoke = "BombSmoke";
public static string BoneFragments = "BoneFragments";
public static string BoneMawSerpentMeat = "BoneMawSerpentMeat";
public static string BonemawSerpentScale = "BonemawSerpentScale";
public static string BonemawSerpentTooth = "BonemawSerpentTooth";
public static string Bow = "Bow";
public static string BowAshlands = "BowAshlands";
public static string BowAshlandsBlood = "BowAshlandsBlood";
public static string BowAshlandsRoot = "BowAshlandsRoot";
public static string BowAshlandsStorm = "BowAshlandsStorm";
public static string BowDraugrFang = "BowDraugrFang";
public static string BowFineWood = "BowFineWood";
public static string BowHuntsman = "BowHuntsman";
public static string BowSpineSnap = "BowSpineSnap";
public static string Bread = "Bread";
public static string BreadDough = "BreadDough";
public static string Bronze = "Bronze";
public static string BronzeNails = "BronzeNails";
public static string BronzeScrap = "BronzeScrap";
public static string BugMeat = "BugMeat";
public static string CapeAsh = "CapeAsh";
public static string CapeAsksvin = "CapeAsksvin";
public static string CapeDeerHide = "CapeDeerHide";
public static string CapeFeather = "CapeFeather";
public static string CapeLinen = "CapeLinen";
public static string CapeLox = "CapeLox";
public static string CapeOdin = "CapeOdin";
public static string CapeTest = "CapeTest";
public static string CapeTrollHide = "CapeTrollHide";
public static string CapeWolf = "CapeWolf";
public static string Carapace = "Carapace";
public static string Carrot = "Carrot";
public static string CarrotSeeds = "CarrotSeeds";
public static string CarrotSoup = "CarrotSoup";
public static string CelestialFeather = "CelestialFeather";
public static string CeramicPlate = "CeramicPlate";
public static string Chain = "Chain";
public static string CharcoalResin = "CharcoalResin";
public static string CharredBone = "CharredBone";
public static string CharredCogwheel = "CharredCogwheel";
public static string CharredBreastplate = "Charred_Breastplate";
public static string CharredHelmet = "Charred_Helmet";
public static string CharredHipCloth = "Charred_HipCloth";
public static string CharredMageCloths = "Charred_MageCloths";
public static string ChestHildir1 = "chest_hildir1";
public static string ChestHildir2 = "chest_hildir2";
public static string ChestHildir3 = "chest_hildir3";
public static string Chicken = "Chicken";
public static string ChickenEgg = "ChickenEgg";
public static string ChickenMeat = "ChickenMeat";
public static string Chitin = "Chitin";
public static string Cinder = "Cinder";
public static string Cloudberry = "Cloudberry";
public static string Club = "Club";
public static string Coal = "Coal";
public static string Coins = "Coins";
public static string CookedAsksvinMeat = "CookedAsksvinMeat";
public static string CookedBoneMawSerpentMeat = "CookedBoneMawSerpentMeat";
public static string CookedBugMeat = "CookedBugMeat";
public static string CookedChickenMeat = "CookedChickenMeat";
public static string CookedDeerMeat = "CookedDeerMeat";
public static string CookedEgg = "CookedEgg";
public static string CookedHareMeat = "CookedHareMeat";
public static string CookedLoxMeat = "CookedLoxMeat";
public static string CookedWolfMeat = "CookedWolfMeat";
public static string CookedMeat = "CookedMeat";
public static string CookedVoltureMeat = "CookedVoltureMeat";
public static string Copper = "Copper";
public static string CopperOre = "CopperOre";
public static string CopperScrap = "CopperScrap";
public static string CrossbowArbalest = "CrossbowArbalest";
public static string CryptKey = "CryptKey";
public static string Crystal = "Crystal";
public static string Cultivator = "Cultivator";
public static string Dandelion = "Dandelion";
public static string DeerHide = "DeerHide";
public static string DeerMeat = "DeerMeat";
public static string DeerStew = "DeerStew";
public static string Demister = "Demister";
public static string DragonEgg = "DragonEgg";
public static string DragonTear = "DragonTear";
public static string DvergrKey = "DvergrKey";
public static string DvergrKeyFragment = "DvergrKeyFragment";
public static string DvergrNeedle = "DvergrNeedle";
public static string DvergerStaffFire = "DvergerStaffFire";
public static string DvergerStaffHeal = "DvergerStaffHeal";
public static string DvergerStaffIce = "DvergerStaffIce";
public static string DvergerStaffSupport = "DvergerStaffSupport";
public static string DvergerSuitArbalest = "DvergerSuitArbalest";
public static string DvergerSuitArbalestAshlands = "DvergerSuitArbalest_Ashlands";
public static string DvergerSuitFire = "DvergerSuitFire";
public static string DvergerSuitIce = "DvergerSuitIce";
public static string DvergerSuitSupport = "DvergerSuitSupport";
public static string DyrnwynBladeFragment = "DyrnwynBladeFragment";
public static string DyrnwynHiltFragment = "DyrnwynHiltFragment";
public static string DyrnwynTipFragment = "DyrnwynTipFragment";
public static string Eitr = "Eitr";
public static string Eikthyrnir = "Eikthyrnir";
public static string ElderBark = "ElderBark";
public static string Entrails = "Entrails";
public static string Eyescream = "Eyescream";
public static string FaderDrop = "FaderDrop";
public static string Feathers = "Feathers";
public static string FineWood = "FineWood";
public static string FirCone = "FirCone";
public static string FishAndBread = "FishAndBread";
public static string FishAndBreadUncooked = "FishAndBreadUncooked";
public static string FishAnglerRaw = "FishAnglerRaw";
public static string FishCooked = "FishCooked";
public static string FishingBait = "FishingBait";
public static string FishingBaitAshlands = "FishingBaitAshlands";
public static string FishingBaitCave = "FishingBaitCave";
public static string FishingBaitDeepNorth = "FishingBaitDeepNorth";
public static string FishingBaitForest = "FishingBaitForest";
public static string FishingBaitMistlands = "FishingBaitMistlands";
public static string FishingBaitOcean = "FishingBaitOcean";
public static string FishingBaitPlains = "FishingBaitPlains";
public static string FishingBaitSwamp = "FishingBaitSwamp";
public static string FishingRod = "FishingRod";
public static string FishRaw = "FishRaw";
public static string FishWraps = "FishWraps";
public static string FistFenrirClaw = "FistFenrirClaw";
public static string Flametal = "Flametal";
public static string FlametalNew = "FlametalNew";
public static string FlametalOre = "FlametalOre";
public static string FlametalOreNew = "FlametalOreNew";
public static string Flax = "Flax";
public static string Flint = "Flint";
public static string FreezeGland = "FreezeGland";
public static string GemstoneBlue = "GemstoneBlue";
public static string GemstoneGreen = "GemstoneGreen";
public static string GemstoneRed = "GemstoneRed";
public static string GiantBloodSack = "GiantBloodSack";
public static string GlowingMushroom = "GlowingMushroom";
public static string GoblinGem = "Goblin_Gem";
public static string GoblinTotem = "GoblinTotem";
public static string Grausten = "Grausten";
public static string GreydwarfEye = "GreydwarfEye";
public static string Guck = "Guck";
public static string Hammer = "Hammer";
public static string HareMeat = "HareMeat";
public static string HardAntler = "HardAntler";
public static string HelmetAshlandsMediumHood = "HelmetAshlandsMediumHood";
public static string HelmetBronze = "HelmetBronze";
public static string HelmetCarapace = "HelmetCarapace";
public static string HelmetDrake = "HelmetDrake";
public static string HelmetDverger = "HelmetDverger";
public static string HelmetFenring = "HelmetFenring";
public static string HelmetFishingHat = "HelmetFishingHat";
public static string HelmetFlametal = "HelmetFlametal";
public static string HelmetHat1 = "HelmetHat1";
public static string HelmetHat2 = "HelmetHat2";
public static string HelmetHat3 = "HelmetHat3";
public static string HelmetHat4 = "HelmetHat4";
public static string HelmetHat5 = "HelmetHat5";
public static string HelmetHat6 = "HelmetHat6";
public static string HelmetHat7 = "HelmetHat7";
public static string HelmetHat8 = "HelmetHat8";
public static string HelmetHat9 = "HelmetHat9";
public static string HelmetHat10 = "HelmetHat10";
public static string HelmetIron = "HelmetIron";
public static string HelmetLeather = "HelmetLeather";
public static string HelmetMage = "HelmetMage";
public static string HelmetMageAshlands = "HelmetMage_Ashlands";
public static string HelmetMidsummerCrown = "HelmetMidsummerCrown";
public static string HelmetOdin = "HelmetOdin";
public static string HelmetPadded = "HelmetPadded";
public static string HelmetPointyHat = "HelmetPointyHat";
public static string HelmetRoot = "HelmetRoot";
public static string HelmetTrollLeather = "HelmetTrollLeather";
public static string HelmetYule = "HelmetYule";
public static string Hoe = "Hoe";
public static string Honey = "Honey";
public static string HoneyGlazedChicken = "HoneyGlazedChicken";
public static string HoneyGlazedChickenUncooked = "HoneyGlazedChickenUncooked";
public static string Iron = "Iron";
public static string IronNails = "IronNails";
public static string IronOre = "IronOre";
public static string IronScrap = "IronScrap";
public static string JuteBlue = "JuteBlue";
public static string JuteRed = "JuteRed";
public static string KnifeBlackMetal = "KnifeBlackMetal";
public static string KnifeButcher = "KnifeButcher";
public static string KnifeChitin = "KnifeChitin";
public static string KnifeCopper = "KnifeCopper";
public static string KnifeFlint = "KnifeFlint";
public static string KnifeSilver = "KnifeSilver";
public static string KnifeSkollAndHati = "KnifeSkollAndHati";
public static string Lantern = "Lantern";
public static string Larva = "Larva";
public static string LavaRock = "LavaRock";
public static string LeatherScraps = "LeatherScraps";
public static string LinenThread = "LinenThread";
public static string LoxMeat = "LoxMeat";
public static string LoxPelt = "LoxPelt";
public static string LoxPie = "LoxPie";
public static string LoxPieUncooked = "LoxPieUncooked";
public static string LuredWisp = "LuredWisp";
public static string MaceBronze = "MaceBronze";
public static string MaceEldner = "MaceEldner";
public static string MaceEldnerBlood = "MaceEldnerBlood";
public static string MaceEldnerLightning = "MaceEldnerLightning";
public static string MaceEldnerNature = "MaceEldnerNature";
public static string MaceIron = "MaceIron";
public static string MaceNeedle = "MaceNeedle";
public static string MaceSilver = "MaceSilver";
public static string MagicallyStuffedShroom = "MagicallyStuffedShroom";
public static string MagicallyStuffedShroomUncooked = "MagicallyStuffedShroomUncooked";
public static string Mandible = "Mandible";
public static string MarinatedGreens = "MarinatedGreens";
public static string MashedMeat = "MashedMeat";
public static string MeadBaseEitrLingering = "MeadBaseEitrLingering";
public static string MeadBaseEitrMinor = "MeadBaseEitrMinor";
public static string MeadBaseFrostResist = "MeadBaseFrostResist";
public static string MeadBaseHealthLingering = "MeadBaseHealthLingering";
public static string MeadBaseHealthMajor = "MeadBaseHealthMajor";
public static string MeadBaseHealthMedium = "MeadBaseHealthMedium";
public static string MeadBaseHealthMinor = "MeadBaseHealthMinor";
public static string MeadBasePoisonResist = "MeadBasePoisonResist";
public static string MeadBaseStaminaLingering = "MeadBaseStaminaLingering";
public static string MeadBaseStaminaMedium = "MeadBaseStaminaMedium";
public static string MeadBaseStaminaMinor = "MeadBaseStaminaMinor";
public static string MeadBaseTasty = "MeadBaseTasty";
public static string MeadEitrLingering = "MeadEitrLingering";
public static string MeadEitrMinor = "MeadEitrMinor";
public static string MeadFrostResist = "MeadFrostResist";
public static string MeadHealthLingering = "MeadHealthLingering";
public static string MeadHealthMajor = "MeadHealthMajor";
public static string MeadHealthMedium = "MeadHealthMedium";
public static string MeadHealthMinor = "MeadHealthMinor";
public static string MeadPoisonResist = "MeadPoisonResist";
public static string MeadStaminaLingering = "MeadStaminaLingering";
public static string MeadStaminaMedium = "MeadStaminaMedium";
public static string MeadStaminaMinor = "MeadStaminaMinor";
public static string MeadTasty = "MeadTasty";
public static string MeatPlatter = "MeatPlatter";
public static string MeatPlatterUncooked = "MeatPlatterUncooked";
public static string MechanicalSpring = "MechanicalSpring";
public static string MinceMeatSauce = "MinceMeatSauce";
public static string MisthareSupreme = "MisthareSupreme";
public static string MisthareSupremeUncooked = "MisthareSupremeUncooked";
public static string MistileKamikaze = "Mistile_kamikaze";
public static string MoltenCore = "MoltenCore";
public static string MorgenHeart = "MorgenHeart";
public static string Mushroom = "Mushroom";
public static string MushroomBlue = "MushroomBlue";
public static string MushroomJotunPuffs = "MushroomJotunPuffs";
public static string MushroomMagecap = "MushroomMagecap";
public static string MushroomOmelette = "MushroomOmelette";
public static string MushroomSmokePuff = "MushroomSmokePuff";
public static string MushroomYellow = "MushroomYellow";
public static string NeckTail = "NeckTail";
public static string NeckTailGrilled = "NeckTailGrilled";
public static string Needle = "Needle";
public static string Obsidian = "Obsidian";
public static string Onion = "Onion";
public static string OnionSeeds = "OnionSeeds";
public static string OnionSoup = "OnionSoup";
public static string Ooze = "Ooze";
public static string PickaxeAntler = "PickaxeAntler";
public static string PickaxeBlackMetal = "PickaxeBlackMetal";
public static string PickaxeBronze = "PickaxeBronze";
public static string PickaxeIron = "PickaxeIron";
public static string PickaxeStone = "PickaxeStone";
public static string PineCone = "PineCone";
public static string PiquantPie = "PiquantPie";
public static string PiquantPieUncooked = "PiquantPieUncooked";
public static string PlaceofMystery1 = "PlaceofMystery1";
public static string PlaceofMystery2 = "PlaceofMystery2";
public static string PlaceofMystery3 = "PlaceofMystery3";
public static string PotShardGreen = "Pot_Shard_Green";
public static string PotShardRed = "Pot_Shard_Red";
public static string ProustitePowder = "ProustitePowder";
public static string PukeBerries = "Pukeberries";
public static string QueenBee = "QueenBee";
public static string QueenDrop = "QueenDrop";
public static string QueensJam = "QueensJam";
public static string Raspberry = "Raspberry";
public static string RawMeat = "RawMeat";
public static string Resin = "Resin";
public static string RoastedCrustPie = "RoastedCrustPie";
public static string RoastedCrustPieUncooked = "RoastedCrustPieUncooked";
public static string RoundLog = "RoundLog";
public static string RottenMeat = "RottenMeat";
public static string RoyalJelly = "RoyalJelly";
public static string Ruby = "Ruby";
public static string SaddleLox = "SaddleLox";
public static string Salad = "Salad";
public static string Sap = "Sap";
public static string Sausages = "Sausages";
public static string ScaleHide = "ScaleHide";
public static string ScorchingMedley = "ScorchingMedley";
public static string SerpentMeat = "SerpentMeat";
public static string SerpentMeatCooked = "SerpentMeatCooked";
public static string SerpentScale = "SerpentScale";
public static string SerpentStew = "SerpentStew";
public static string SharpeningStone = "SharpeningStone";
public static string ShieldBanded = "ShieldBanded";
public static string ShieldBlackmetal = "ShieldBlackmetal";
public static string ShieldBlackmetalTower = "ShieldBlackmetalTower";
public static string ShieldBoneTower = "ShieldBoneTower";
public static string ShieldBronzeBuckler = "ShieldBronzeBuckler";
public static string ShieldCarapace = "ShieldCarapace";
public static string ShieldCarapaceBuckler = "ShieldCarapaceBuckler";
public static string ShieldCore = "ShieldCore";
public static string ShieldFlametal = "ShieldFlametal";
public static string ShieldFlametalTower = "ShieldFlametalTower";
public static string ShieldIronBuckler = "ShieldIronBuckler";
public static string ShieldIronSquare = "ShieldIronSquare";
public static string ShieldIronTower = "ShieldIronTower";
public static string ShieldKnight = "ShieldKnight";
public static string ShieldSerpentscale = "ShieldSerpentscale";
public static string ShieldSilver = "ShieldSilver";
public static string ShieldWood = "ShieldWood";
public static string ShieldWoodTower = "ShieldWoodTower";
public static string ShocklateSmoothie = "ShocklateSmoothie";
public static string Silver = "Silver";
public static string SilverNecklace = "SilverNecklace";
public static string SilverOre = "SilverOre";
public static string SizzlingBerryBroth = "SizzlingBerryBroth";
public static string SledgeCheat = "SledgeCheat";
public static string SledgeDemolisher = "SledgeDemolisher";
public static string SledgeIron = "SledgeIron";
public static string SledgeStagbreaker = "SledgeStagbreaker";
public static string Softtissue = "Softtissue";
public static string SpearBronze = "SpearBronze";
public static string SpearCarapace = "SpearCarapace";
public static string SpearChitin = "SpearChitin";
public static string SpearElderbark = "SpearElderbark";
public static string SpearFlint = "SpearFlint";
public static string SpearSplitner = "SpearSplitner";
public static string SpearSplitnerBlood = "SpearSplitner_Blood";
public static string SpearSplitnerLightning = "SpearSplitner_Lightning";
public static string SpearSplitnerNature = "SpearSplitner_Nature";
public static string SpearWolfFang = "SpearWolfFang";
public static string SpicyMarmalade = "SpicyMarmalade";
public static string StaffClusterbomb = "StaffClusterbomb";
public static string StaffFireball = "StaffFireball";
public static string StaffGreenRoots = "StaffGreenRoots";
public static string StaffIceShards = "StaffIceShards";
public static string StaffLightning = "StaffLightning";
public static string StaffRedTroll = "StaffRedTroll";
public static string StaffShield = "StaffShield";
public static string StaffSkeleton = "StaffSkeleton";
public static string StaminaUpgradeGreydwarf = "StaminaUpgrade_Greydwarf";
public static string StaminaUpgradeTroll = "StaminaUpgrade_Troll";
public static string StaminaUpgradeWraith = "StaminaUpgrade_Wraith";
public static string Stone = "Stone";
public static string SurtlingCore = "SurtlingCore";
public static string SwordBlackmetal = "SwordBlackmetal";
public static string SwordBronze = "SwordBronze";
public static string SwordCheat = "SwordCheat";
public static string SwordDyrnwyn = "SwordDyrnwyn";
public static string SwordIron = "SwordIron";
public static string SwordIronFire = "SwordIronFire";
public static string SwordMistwalker = "SwordMistwalker";
public static string SwordNiedhogg = "SwordNiedhogg";
public static string SwordNiedhoggBlood = "SwordNiedhoggBlood";
public static string SwordNiedhoggLightning = "SwordNiedhoggLightning";
public static string SwordNiedhoggNature = "SwordNiedhoggNature";
public static string SwordSilver = "SwordSilver";
public static string Tankard = "Tankard";
public static string TankardDvergr = "Tankard_dvergr";
public static string TankardAnniversary = "TankardAnniversary";
public static string TankardOdin = "TankardOdin";
public static string Tar = "Tar";
public static string TarLiquid = "TarLiquid";
public static string ThSwordKrom = "THSwordKrom";
public static string ThSwordSlayer = "THSwordSlayer";
public static string ThSwordSlayerBlood = "THSwordSlayerBlood";
public static string ThSwordSlayerLightning = "THSwordSlayerLightning";
public static string ThSwordSlayerNature = "THSwordSlayerNature";
public static string Thistle = "Thistle";
public static string Thunderstone = "Thunderstone";
public static string Tin = "Tin";
public static string TinOre = "TinOre";
public static string TolrokoFlyer = "tolroko_flyer";
public static string Torch = "Torch";
public static string TorchMist = "TorchMist";
public static string TreasurePile = "treasure_pile";
public static string TreasureStack = "treasure_stack";
public static string TrollHide = "TrollHide";
public static string TrophyAbomination = "TrophyAbomination";
public static string TrophyAsksvin = "TrophyAsksvin";
public static string TrophyBlob = "TrophyBlob";
public static string TrophyBoar = "TrophyBoar";
public static string TrophyBonemass = "TrophyBonemass";
public static string TrophyBonemawSerpent = "TrophyBonemawSerpent";
public static string TrophyCharredArcher = "TrophyCharredArcher";
public static string TrophyCharredMage = "TrophyCharredMage";
public static string TrophyCharredMelee = "TrophyCharredMelee";
public static string TrophyCultist = "TrophyCultist";
public static string TrophyCultistHildir = "TrophyCultist_Hildir";
public static string TrophyDeathsquito = "TrophyDeathsquito";
public static string TrophyDeer = "TrophyDeer";
public static string TrophyDragonQueen = "TrophyDragonQueen";
public static string TrophyDraugr = "TrophyDraugr";
public static string TrophyDraugrElite = "TrophyDraugrElite";
public static string TrophyDraugrFem = "TrophyDraugrFem";
public static string TrophyDvergr = "TrophyDvergr";
public static string TrophyEikthyr = "TrophyEikthyr";
public static string TrophyFader = "TrophyFader";
public static string TrophyFallenValkyrie = "TrophyFallenValkyrie";
public static string TrophyFenring = "TrophyFenring";
public static string TrophyForestTroll = "TrophyForestTroll";
public static string TrophyFrostTroll = "TrophyFrostTroll";
public static string TrophyGjall = "TrophyGjall";
public static string TrophyGoblin = "TrophyGoblin";
public static string TrophyGoblinBrute = "TrophyGoblinBrute";
public static string TrophyGoblinBruteBrosBrute = "TrophyGoblinBruteBrosBrute";
public static string TrophyGoblinBruteBrosShaman = "TrophyGoblinBruteBrosShaman";
public static string TrophyGoblinKing = "TrophyGoblinKing";
public static string TrophyGoblinShaman = "TrophyGoblinShaman";
public static string TrophyGreydwarf = "TrophyGreydwarf";
public static string TrophyGreydwarfBrute = "TrophyGreydwarfBrute";
public static string TrophyGreydwarfShaman = "TrophyGreydwarfShaman";
public static string TrophyGrowth = "TrophyGrowth";
public static string TrophyHare = "TrophyHare";
public static string TrophyHatchling = "TrophyHatchling";
public static string TrophyLeech = "TrophyLeech";
public static string TrophyLox = "TrophyLox";
public static string TrophyMorgen = "TrophyMorgen";
public static string TrophyNeck = "TrophyNeck";
public static string TrophySeeker = "TrophySeeker";
public static string TrophySeekerBrute = "TrophySeekerBrute";
public static string TrophySeekerQueen = "TrophySeekerQueen";
public static string TrophySerpent = "TrophySerpent";
public static string TrophySGolem = "TrophySGolem";
public static string TrophySkeleton = "TrophySkeleton";
public static string TrophySkeletonHildir = "TrophySkeletonHildir";
public static string TrophySkeletonPoison = "TrophySkeletonPoison";
public static string TrophySurtling = "TrophySurtling";
public static string TrophyTheElder = "TrophyTheElder";
public static string TrophyTick = "TrophyTick";
public static string TrophyUlv = "TrophyUlv";
public static string TrophyVolture = "TrophyVolture";
public static string TrophyWolf = "TrophyWolf";
public static string TrophyWraith = "TrophyWraith";
public static string Turnip = "Turnip";
public static string TurnipSeeds = "TurnipSeeds";
public static string TurnipStew = "TurnipStew";
public static string TurretBolt = "TurretBolt";
public static string TurretBoltBone = "TurretBoltBone";
public static string TurretBoltFlametal = "TurretBoltFlametal";
public static string TurretBoltWood = "TurretBoltWood";
public static string VegvisirShardBonemass = "VegvisirShard_Bonemass";
public static string VineAsh = "VineAsh";
public static string Vineberry = "Vineberry";
public static string VineberrySeeds = "VineberrySeeds";
public static string VoltureEgg = "VoltureEgg";
public static string VoltureMeat = "VoltureMeat";
public static string VoltureNest = "VoltureNest";
public static string WaterLiquid = "WaterLiquid";
public static string Wishbone = "Wishbone";
public static string Wisp = "Wisp";
public static string WitheredBone = "WitheredBone";
public static string WolfClaw = "WolfClaw";
public static string WolfHairBundle = "WolfHairBundle";
public static string WolfFang = "WolfFang";
public static string WolfJerky = "WolfJerky";
public static string WolfMeat = "WolfMeat";
public static string WolfMeatSkewer = "WolfMeatSkewer";
public static string WolfPelt = "WolfPelt";
public static string Wood = "Wood";
public static string YagluthDrop = "YagluthDrop";
public static string YggdrasilPorridge = "YggdrasilPorridge";
public static string YggdrasilRoot = "YggdrasilRoot";
public static string YggdrasilWood = "YggdrasilWood";
public static string YmirRemains = "YmirRemains";
}
}
namespace Digitalroot.Valheim.Common
{
internal static class Utils
{
private static readonly ITraceableLogging Logger = GetLogger();
[UsedImplicitly]
public static DirectoryInfo AssemblyDirectory => new FileInfo(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)).Directory;
[UsedImplicitly]
public static bool IsDedicated => ZNet.instance.IsDedicated();
[UsedImplicitly]
public static bool IsServer => ZNet.instance.IsServer();
public static bool IsRunningFromNUnit => AppDomain.CurrentDomain.GetAssemblies().Any((Assembly a) => a.FullName.ToLowerInvariant().StartsWith("nunit.framework"));
public static string Namespace => "Digitalroot.Valheim.Common";
private static ITraceableLogging GetLogger()
{
return new StaticSourceLogger();
}
[UsedImplicitly]
public static bool IsHeadless()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Invalid comparison between Unknown and I4
return (int)SystemInfo.graphicsDeviceType == 4;
}
[UsedImplicitly]
public static List<T> AllOf<T>()
{
return Enum.GetValues(typeof(T)).OfType<T>().ToList();
}
[UsedImplicitly]
public static IEnumerable<string> AllNames(Type type)
{
foreach (FieldInfo item in from f1 in type.GetFields()
where f1.FieldType == typeof(string)
select f1)
{
yield return item.GetValue(null).ToString();
}
}
[UsedImplicitly]
public static bool DoesPluginExist(string pluginGuid)
{
return Chainloader.PluginInfos.Any((KeyValuePair<string, PluginInfo> keyValuePair) => keyValuePair.Value.Metadata.GUID == pluginGuid);
}
[UsedImplicitly]
public static Vector3 GetGroundHeight(int x, int z)
{
//IL_0007: 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)
return Utils.GetGroundHeight(new Vector3Int(x, 500, z));
}
[UsedImplicitly]
public static Vector3 GetGroundHeight(float x, float z)
{
//IL_0007: 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)
return Utils.GetGroundHeight(new Vector3(x, 500f, z));
}
public static Vector3 GetGroundHeight(Vector3Int vector3)
{
//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_0020: Unknown result type (might be due to invalid IL or missing references)
return new Vector3((float)((Vector3Int)(ref vector3)).x, ZoneSystem.instance.GetGroundHeight(Vector3Int.op_Implicit(vector3)), (float)((Vector3Int)(ref vector3)).z);
}
public static Vector3 GetGroundHeight(Vector3 vector3)
{
//IL_0000: 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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
return new Vector3(vector3.x, ZoneSystem.instance.GetGroundHeight(vector3), vector3.z);
}
[UsedImplicitly]
public static GameObject GetItemPrefab(string itemName)
{
if (!IsObjectDBReady())
{
return null;
}
return GetObjectDB().GetItemPrefab(itemName);
}
[UsedImplicitly]
public static GameObject GetItemPrefab(int hash)
{
if (!IsObjectDBReady())
{
return null;
}
return GetObjectDB().GetItemPrefab(hash);
}
[UsedImplicitly]
public static Player GetLocalPlayer()
{
return Player.m_localPlayer;
}
[UsedImplicitly]
public static Vector3 GetLocalPlayersPosition()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
return ((Component)Player.m_localPlayer).transform.position;
}
[UsedImplicitly]
public static ObjectDB GetObjectDB()
{
return ObjectDB.instance;
}
[UsedImplicitly]
public static string GetPluginPath(Type modPluginType)
{
return Path.GetDirectoryName(modPluginType.Assembly.Location);
}
[UsedImplicitly]
public static GameObject GetPrefab(string itemName)
{
if (!IsZNetSceneReady())
{
return null;
}
return ZNetScene.instance.GetPrefab(itemName);
}
[UsedImplicitly]
public static GameObject GetPrefab(int hash)
{
if (!IsZNetSceneReady())
{
return null;
}
return ZNetScene.instance.GetPrefab(hash);
}
[UsedImplicitly]
public static T GetPrivateField<T>(object instance, string name)
{
FieldInfo field = instance.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
return (T)field.GetValue(instance);
}
Log.Error(Logger, "Variable " + name + " does not exist on type: " + instance.GetType());
return default(T);
}
[UsedImplicitly]
public static object InvokePrivate(object instance, string name, object[] args = null)
{
MethodInfo method = instance.GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic);
if (method == null)
{
Type[] types = ((args == null) ? Type.EmptyTypes : args.Select((object arg) => arg.GetType()).ToArray());
method = instance.GetType().GetMethod(name, types);
}
if (method == null)
{
Log.Error(Logger, "Method " + name + " does not exist on type: " + instance.GetType());
return null;
}
return method.Invoke(instance, args);
}
[UsedImplicitly]
public static bool IsGameInMainScene()
{
return (Object)(object)ZNetScene.instance != (Object)null;
}
[UsedImplicitly]
public static bool IsObjectDBReady()
{
if (!((Object)(object)GetObjectDB() != (Object)null) || GetObjectDB().m_items.Count == 0 || !((Object)(object)GetItemPrefab("Amber") != (Object)null))
{
return IsRunningFromNUnit;
}
return true;
}
[UsedImplicitly]
public static bool IsPlayerReady()
{
return (Object)(object)GetLocalPlayer() != (Object)null;
}
[UsedImplicitly]
public static bool IsZNetSceneReady()
{
if ((Object)(object)ZNetScene.instance != (Object)null)
{
List<GameObject> list = ZNetScene.instance?.m_prefabs;
if (list != null)
{
return list.Count > 0;
}
return false;
}
return false;
}
[UsedImplicitly]
public static bool IsZNetReady()
{
return (Object)(object)ZNet.instance != (Object)null;
}
[UsedImplicitly]
public static string Localize(string value)
{
return Localization.instance.Localize(value);
}
[UsedImplicitly]
public static Vector3 GetStartTemplesPosition()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
LocationInstance val = default(LocationInstance);
if (ZoneSystem.instance.FindClosestLocation("StartTemple", Vector3.zero, ref val))
{
Log.Trace(Logger, $"[GetStartTemplesPosition] StartTemple at {val.m_position}");
return val.m_position;
}
Log.Error(Logger, "[GetStartTemplesPosition] Can't find StartTemple");
return Vector3.zero;
}
[UsedImplicitly]
public static void SetPrivateField(object instance, string name, object value)
{
FieldInfo field = instance.GetType().GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
if (field == null)
{
Log.Error(Logger, "Variable " + name + " does not exist on type: " + instance.GetType());
}
else
{
field.SetValue(instance, value);
}
}
[UsedImplicitly]
public static GameObject Spawn([NotNull] string prefabName, Vector3 location, [CanBeNull] Transform parent = null)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
Log.Trace(Logger, $"{Namespace}.{MethodBase.GetCurrentMethod().DeclaringType?.Name}.{MethodBase.GetCurrentMethod().Name}({prefabName}, {location}, {((parent != null) ? ((Object)parent).name : null)})");
GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(prefabName));
if (!((Object)(object)itemPrefab == (Object)null))
{
return Spawn(itemPrefab, location, parent);
}
return null;
}
[UsedImplicitly]
public static GameObject Spawn([NotNull] GameObject prefab, Vector3 location, [CanBeNull] Transform parent = null)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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)
Log.Trace(Logger, $"{Namespace}.{MethodBase.GetCurrentMethod().DeclaringType?.Name}.{MethodBase.GetCurrentMethod().Name}({((Object)prefab).name}, {location}, {((parent != null) ? ((Object)parent).name : null)})");
if ((Object)(object)parent == (Object)null)
{
return Object.Instantiate<GameObject>(prefab, location, Quaternion.identity);
}
return Object.Instantiate<GameObject>(prefab, location, Quaternion.identity, parent);
}
public static AssetBundle LoadAssetBundleFromResources(string bundleName, Assembly resourceAssembly)
{
if (resourceAssembly == null)
{
throw new ArgumentNullException("resourceAssembly");
}
string text = null;
try
{
text = resourceAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(bundleName));
}
catch (Exception)
{
}
if (text == null)
{
Log.Error(Logger, "AssetBundle " + bundleName + " not found in assembly manifest");
return null;
}
using Stream stream = resourceAssembly.GetManifestResourceStream(text);
return AssetBundle.LoadFromStream(stream);
}
}
[DebuggerDisplay("Source = {Source}, EnableTrace = {EnableTrace}", Name = "{Source}")]
internal class StaticSourceLogger : ITraceableLogging
{
public static StaticSourceLogger PreMadeTraceableInstance = new StaticSourceLogger(enableTrace: true);
public static StaticSourceLogger PreMadeNonTraceableInstance = new StaticSourceLogger();
public string Source { get; }
public bool EnableTrace { get; }
public StaticSourceLogger(bool enableTrace = false)
: this("Digitalroot", enableTrace)
{
}
public StaticSourceLogger(string source, bool enableTrace = false)
{
Source = source;
EnableTrace = enableTrace;
}
}
}
namespace Digitalroot.Valheim.Common.Names.Vanilla
{
internal static class CraftingStationNames
{
public static readonly IEnumerable<string> AllNames = Utils.AllNames(typeof(CraftingStationNames));
public static readonly string ArtisanTable = "piece_artisanstation";
public static readonly string Blackforge = "blackforge";
public static readonly string Cauldron = "piece_cauldron";
public static readonly string Forge = "forge";
public static readonly string MageTable = "piece_magetable";
public static readonly string Stonecutter = "piece_stonecutter";
public static readonly string Workbench = "piece_workbench";
}
}
internal class DigitalrootValheimBetterClubs_ProcessedByFody
{
internal const string FodyVersion = "6.6.0.0";
internal const string ILMerge = "1.22.0.0";
}