Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Atos Arrows JVL v1.0.37
plugins/AtosArrowsJVL.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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.Configuration; using BepInEx.Logging; using Digitalroot.Valheim.Common; using Digitalroot.Valheim.Common.Json; using JetBrains.Annotations; using Jotunn.Configs; 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("Port of AtosArrows to JvL.")] [assembly: AssemblyFileVersion("1.0.37.0")] [assembly: AssemblyInformationalVersion("1.0.37+c18836cbf96f4ef9a50e2155d31dddc07760f8c7")] [assembly: AssemblyProduct("AtosArrowsJvL")] [assembly: AssemblyTitle("AtosArrowsJVL")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Digitalroot-Valheim/Atokal-AtosArrowsJVL")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.37.0")] [module: UnverifiableCode] namespace AtosArrowsJVL { [BepInPlugin("digitalroot.valheim.mods.atosarrows.jvl", "AtosArrowsJVL", "1.0.37")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("com.bepinex.plugins.atosarrows")] public class Main : BaseUnityPlugin, ITraceableLogging { public static Main Instance; private AssetBundle _assetBundle; public static ConfigEntry<int> NexusId; public const string Version = "1.0.37"; private const string Name = "AtosArrowsJVL"; public const string Guid = "digitalroot.valheim.mods.atosarrows.jvl"; public const string Namespace = "AtosArrowsJVL"; public string Source => "AtosArrowsJVL"; public bool EnableTrace { get; } 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 try { EnableTrace = false; Instance = this; NexusId = ((BaseUnityPlugin)this).Config.Bind<int>("General", "NexusID", 1301, 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, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); } catch (Exception ex) { ZLog.LogError((object)ex); } } [UsedImplicitly] public void Awake() { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); PrefabManager.OnVanillaPrefabsAvailable += AddClonedItems; } private void AddClonedItems() { try { Log.Trace(Instance, "AtosArrowsJVL." + MethodBase.GetCurrentMethod()?.DeclaringType?.Name + "." + MethodBase.GetCurrentMethod()?.Name); _assetBundle = AssetUtils.LoadAssetBundleFromResources("atoarrows", typeof(Main).Assembly); AddStoneArrows(); AddBluntedArrows(); AddBoneArrows(); AddFlintArrows(); AddObsidianArrows(); AddNeedleArrows(); AddFireArrows(); AddIceArrows(); AddPoisonArrows(); AddBombs(); AddXbow(); _assetBundle.Unload(false); PrefabManager.OnVanillaPrefabsAvailable -= AddClonedItems; } catch (Exception e) { Log.Error(Instance, e); } } private void AddBombs() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/items/firebomb.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 5; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 3; val.Name = "FireBomb"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Coal", Amount = 10 }, new RequirementConfig { Item = "Resin", Amount = 8 }, new RequirementConfig { Item = "LeatherScraps", Amount = 8 }, new RequirementConfig { Item = "Entrails", Amount = 2 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_ato_firebomb"; ItemManager.Instance.AddItem(val2); GameObject obj2 = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/items/icebomb.prefab"); val = new ItemConfig(); val.Amount = 5; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 3; val.Name = "IceBomb"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "FreezeGland", Amount = 10 }, new RequirementConfig { Item = "Resin", Amount = 8 }, new RequirementConfig { Item = "LeatherScraps", Amount = 8 }, new RequirementConfig { Item = "Entrails", Amount = 2 } }; CustomItem val3 = new CustomItem(obj2, false, val); val3.ItemDrop.m_itemData.m_shared.m_name = "$item_ato_icebomb"; ItemManager.Instance.AddItem(val3); } catch (Exception e) { Log.Error(Instance, e); } } private void AddBoneArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/arrowbone.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 20; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 3; val.Name = "BoneArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "BoneFragments", Amount = 4 }, new RequirementConfig { Item = "Wood", Amount = 8 }, new RequirementConfig { Item = "Feathers", Amount = 2 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_bone"; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val2); GameObject obj2 = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/heavy/arrowheavybone.prefab"); val = new ItemConfig(); val.Amount = 10; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 3; val.Name = "Heavy Bone Arrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "BoneFragments", Amount = 6 }, new RequirementConfig { Item = "RoundLog", Amount = 10 }, new RequirementConfig { Item = "Feathers", Amount = 5 } }; CustomItem val3 = new CustomItem(obj2, false, val); val3.ItemDrop.m_itemData.m_shared.m_description = "$item_atoarrow_heavy_bone_description"; val3.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_heavy_bone"; val3.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; val3.ItemDrop.m_itemData.m_shared.m_damages.m_pierce = 32f; val3.ItemDrop.m_itemData.m_shared.m_damages.m_slash = 32f; val3.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 10f; ItemManager.Instance.AddItem(val3); } catch (Exception e) { Log.Error(Instance, e); } } private void AddBluntedArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/arrowcore.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 20; val.CraftingStation = "forge"; val.Enabled = true; val.MinStationLevel = 2; val.Name = "CoreArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Bronze", Amount = 1 }, new RequirementConfig { Item = "Stone", Amount = 2 }, new RequirementConfig { Item = "RoundLog", Amount = 8 }, new RequirementConfig { Item = "Feathers", Amount = 2 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_core"; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val2); GameObject obj2 = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/heavy/arrowheavycore.prefab"); val = new ItemConfig(); val.Amount = 10; val.CraftingStation = "forge"; val.Enabled = true; val.MinStationLevel = 3; val.Name = "HeavyCoreArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Bronze", Amount = 2 }, new RequirementConfig { Item = "Stone", Amount = 4 }, new RequirementConfig { Item = "RoundLog", Amount = 12 }, new RequirementConfig { Item = "Feathers", Amount = 2 } }; CustomItem val3 = new CustomItem(obj2, false, val); val3.ItemDrop.m_itemData.m_shared.m_description = "$item_atoarrow_heavy_core_description"; val3.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_heavy_core"; val3.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; val3.ItemDrop.m_itemData.m_shared.m_damages.m_blunt = 64f; val3.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 10f; ItemManager.Instance.AddItem(val3); } catch (Exception e) { Log.Error(Instance, e); } } private void AddFireArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Expected O, but got Unknown //IL_01dc: 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_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Expected O, but got Unknown //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Expected O, but got Unknown //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Expected O, but got Unknown //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Expected O, but got Unknown //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/arrowobsidianfire.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 20; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 4; val.Name = "BigFireArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Obsidian", Amount = 4 }, new RequirementConfig { Item = "Resin", Amount = 8 }, new RequirementConfig { Item = "Wood", Amount = 8 }, new RequirementConfig { Item = "Feathers", Amount = 2 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_arrow_obsidianfire"; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val2); GameObject obj2 = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/heavy/arrowheavyfire.prefab"); val = new ItemConfig(); val.Amount = 10; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 4; val.Name = "HeavyFireArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Obsidian", Amount = 6 }, new RequirementConfig { Item = "Resin", Amount = 10 }, new RequirementConfig { Item = "FineWood", Amount = 10 }, new RequirementConfig { Item = "Feathers", Amount = 5 } }; CustomItem val3 = new CustomItem(obj2, false, val); val3.ItemDrop.m_itemData.m_shared.m_description = "$item_arrow_heavyfire_description"; val3.ItemDrop.m_itemData.m_shared.m_name = "$item_arrow_heavyfire"; val3.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; val3.ItemDrop.m_itemData.m_shared.m_damages.m_pierce = 32f; val3.ItemDrop.m_itemData.m_shared.m_damages.m_fire = 72f; val3.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 10f; ItemManager.Instance.AddItem(val3); GameObject obj3 = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/arrowfireaoe.prefab"); val = new ItemConfig(); val.Amount = 5; val.CraftingStation = "forge"; val.Enabled = true; val.MinStationLevel = 6; val.Name = "FireAoeArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Crystal", Amount = 4 }, new RequirementConfig { Item = "FireBomb", Amount = 1 }, new RequirementConfig { Item = "FineWood", Amount = 8 }, new RequirementConfig { Item = "Feathers", Amount = 2 } }; CustomItem val4 = new CustomItem(obj3, false, val); val4.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_bigfire"; val4.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val4); } catch (Exception e) { Log.Error(Instance, e); } } private void AddFlintArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00de: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/heavy/arrowheavyflint.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 10; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 3; val.Name = "HeavyFlintArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Flint", Amount = 6 }, new RequirementConfig { Item = "RoundLog", Amount = 12 }, new RequirementConfig { Item = "Feathers", Amount = 5 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_description = "$item_atoarrow_heavy_flint_description"; val2.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_heavy_flint"; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; val2.ItemDrop.m_itemData.m_shared.m_damages.m_pierce = 47f; val2.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 10f; ItemManager.Instance.AddItem(val2); } catch (Exception e) { Log.Error(Instance, e); } } private void AddIceArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00de: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/heavy/arrowheavyfrost.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 10; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 4; val.Name = "HeavyIceArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Obsidian", Amount = 6 }, new RequirementConfig { Item = "FreezeGland", Amount = 10 }, new RequirementConfig { Item = "FineWood", Amount = 10 }, new RequirementConfig { Item = "Feathers", Amount = 5 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_arrow_heavy_frost"; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; val2.ItemDrop.m_itemData.m_shared.m_damages.m_pierce = 32f; val2.ItemDrop.m_itemData.m_shared.m_damages.m_frost = 72f; val2.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 10f; ItemManager.Instance.AddItem(val2); GameObject obj2 = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/arrowiceaoe.prefab"); val = new ItemConfig(); val.Amount = 5; val.CraftingStation = "forge"; val.Enabled = true; val.MinStationLevel = 6; val.Name = "IceAoeArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Crystal", Amount = 4 }, new RequirementConfig { Item = "IceBomb", Amount = 1 }, new RequirementConfig { Item = "FineWood", Amount = 8 }, new RequirementConfig { Item = "Feathers", Amount = 2 } }; CustomItem val3 = new CustomItem(obj2, false, val); val3.ItemDrop.m_itemData.m_shared.m_description = "$item_atoarrow_bigice_description"; val3.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_bigice"; val3.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val3); } catch (Exception e) { Log.Error(Instance, e); } } private void AddNeedleArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/heavy/arrowheavyneedle.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 10; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 4; val.Name = "HeavyNeedleArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Needle", Amount = 10 }, new RequirementConfig { Item = "FineWood", Amount = 10 }, new RequirementConfig { Item = "Feathers", Amount = 5 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_arrow_heavyneedle"; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; val2.ItemDrop.m_itemData.m_shared.m_damages.m_pierce = 72f; val2.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 10f; ItemManager.Instance.AddItem(val2); } catch (Exception e) { Log.Error(Instance, e); } } private void AddObsidianArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00de: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/heavy/arrowheavyobsidian.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 10; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 4; val.Name = "HeavyObsidianArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Obsidian", Amount = 6 }, new RequirementConfig { Item = "FineWood", Amount = 12 }, new RequirementConfig { Item = "Feathers", Amount = 5 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_arrow_heavyobsidian"; val2.ItemDrop.m_itemData.m_shared.m_damages.m_pierce = 67f; val2.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 10f; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val2); } catch (Exception e) { Log.Error(Instance, e); } } private void AddPoisonArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00de: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/heavy/arrowheavypoison.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 10; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 4; val.Name = "HeavyPoisonArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Obsidian", Amount = 6 }, new RequirementConfig { Item = "Ooze", Amount = 10 }, new RequirementConfig { Item = "FineWood", Amount = 10 }, new RequirementConfig { Item = "Feathers", Amount = 5 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_arrow_heavy_poison"; val2.ItemDrop.m_itemData.m_shared.m_damages.m_pierce = 32f; val2.ItemDrop.m_itemData.m_shared.m_damages.m_poison = 72f; val2.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 10f; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val2); GameObject obj2 = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/arrowpoisonaoe.prefab"); val = new ItemConfig(); val.Amount = 5; val.CraftingStation = "forge"; val.Enabled = true; val.MinStationLevel = 6; val.Name = "PoisonAoeArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Crystal", Amount = 4 }, new RequirementConfig { Item = "BombOoze", Amount = 1 }, new RequirementConfig { Item = "FineWood", Amount = 8 }, new RequirementConfig { Item = "Feathers", Amount = 2 } }; CustomItem val3 = new CustomItem(obj2, false, val); val3.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_aoepoison"; val3.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val3); } catch (Exception e) { Log.Error(Instance, e); } } private void AddStoneArrows() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/arrows/arrowstone.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 20; val.CraftingStation = "piece_workbench"; val.Enabled = true; val.MinStationLevel = 1; val.Name = "StoneArrow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[3] { new RequirementConfig { Item = "Stone", Amount = 2 }, new RequirementConfig { Item = "Wood", Amount = 8 }, new RequirementConfig { Item = "Feathers", Amount = 2 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_atoarrow_stone"; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val2); } catch (Exception e) { Log.Error(Instance, e); } } private void AddXbow() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_00d5: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0112: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown try { Log.Trace(Instance, ((object)this).GetType().Namespace + "." + ((object)this).GetType().Name + "." + MethodBase.GetCurrentMethod()?.Name + "()"); GameObject obj = _assetBundle.LoadAsset<GameObject>("assets/atosarrows/bows/xbow.prefab"); ItemConfig val = new ItemConfig(); val.Amount = 1; val.CraftingStation = "forge"; val.RepairStation = "forge"; val.Enabled = true; val.MinStationLevel = 1; val.Name = "XBow"; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig { Item = "Crystal", Amount = 10, AmountPerLevel = 2 }, new RequirementConfig { Item = "BlackMetal", Amount = 60, AmountPerLevel = 10 }, new RequirementConfig { Item = "FineWood", Amount = 8 }, new RequirementConfig { Item = "LinenThread", Amount = 20, AmountPerLevel = 2 } }; CustomItem val2 = new CustomItem(obj, false, val); val2.ItemDrop.m_itemData.m_shared.m_name = "$item_xbow"; val2.ItemDrop.m_itemData.m_shared.m_attackForce = 0f; val2.ItemDrop.m_itemData.m_shared.m_attack.m_projectileVel = 65f; val2.ItemDrop.m_itemData.m_shared.m_maxDurability = 600f; val2.ItemDrop.m_itemData.m_shared.m_blockPower = 10f; val2.ItemDrop.m_itemData.m_shared.m_maxStackSize = 1; val2.ItemDrop.m_itemData.m_shared.m_ammoType = "$ammo_arrows"; ItemManager.Instance.AddItem(val2); } catch (Exception e) { Log.Error(Instance, e); } } } } 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"); } } } internal class AtosArrowsJVL_ProcessedByFody { internal const string FodyVersion = "6.6.0.0"; internal const string ILMerge = "1.22.0.0"; }