diff --git a/Digitalroot.Valheim.GoldBars/Assets/goldbar b/Digitalroot.Valheim.GoldBars/Assets/goldbar index 827451c..112f3f9 100644 Binary files a/Digitalroot.Valheim.GoldBars/Assets/goldbar and b/Digitalroot.Valheim.GoldBars/Assets/goldbar differ diff --git a/Digitalroot.Valheim.GoldBars/Assets/goldbar.manifest b/Digitalroot.Valheim.GoldBars/Assets/goldbar.manifest index ae1340f..1fc3972 100644 --- a/Digitalroot.Valheim.GoldBars/Assets/goldbar.manifest +++ b/Digitalroot.Valheim.GoldBars/Assets/goldbar.manifest @@ -1,9 +1,9 @@ ManifestFileVersion: 0 -CRC: 2071901047 +CRC: 1034725428 Hashes: AssetFileHash: serializedVersion: 2 - Hash: 9dae3f13c352580b18fc6cd9662ab161 + Hash: 5ce449734985d83597488d68658ba38f TypeTreeHash: serializedVersion: 2 Hash: 00e7c6fed9bd803af65bb04f52de1402 diff --git a/Digitalroot.Valheim.GoldBars/Main.cs b/Digitalroot.Valheim.GoldBars/Main.cs index 578cc7d..f770cb1 100644 --- a/Digitalroot.Valheim.GoldBars/Main.cs +++ b/Digitalroot.Valheim.GoldBars/Main.cs @@ -1,4 +1,5 @@ using BepInEx; +using BepInEx.Configuration; using JetBrains.Annotations; using Jotunn.Configs; using Jotunn.Entities; @@ -13,12 +14,16 @@ namespace Digitalroot.Valheim.GoldBars [NetworkCompatibility(CompatibilityLevel.EveryoneMustHaveMod, VersionStrictness.Minor)] public class Main : BaseUnityPlugin { - public const string Version = "1.0.0"; + public const string Version = "1.1.0"; public const string Name = "Digitalroot GoldBars"; public const string Guid = "digitalroot.mods.GoldBars"; public const string Namespace = "Digitalroot.Valheim.GoldBars"; public static Main Instance; + public static ConfigEntry NexusId; + public static ConfigEntry CoinPilePieceComfort; + public static ConfigEntry GoldStackPieceComfort; + private GameObject _goldBar; private GameObject _coinPile; private GameObject _coinPilePiece; @@ -28,6 +33,9 @@ public class Main : BaseUnityPlugin public Main() { Instance = this; + NexusId = Config.Bind("General", "NexusID", 1448, new ConfigDescription("Nexus mod ID for updates", null, new ConfigurationManagerAttributes { IsAdminOnly = false, Browsable = false, ReadOnly = true })); + CoinPilePieceComfort = Config.Bind("General", "CoinPilePieceComfort", 1, new ConfigDescription("Coin Pile Comfort Level", null, new ConfigurationManagerAttributes { IsAdminOnly = true })); + GoldStackPieceComfort = Config.Bind("General", "GoldStackPieceComfort", 2, new ConfigDescription("Gold Stack Comfort Level", null, new ConfigurationManagerAttributes { IsAdminOnly = true })); } [UsedImplicitly] @@ -70,7 +78,7 @@ private void LoadPrefabs() private void LoadRecipes() { - CustomRecipe coinRecipe = new CustomRecipe(new RecipeConfig() + CustomRecipe coinRecipe = new CustomRecipe(new RecipeConfig { Amount = 200, Item = "Coins", // Name of the item prefab to be crafted Name = "PileToCoins" @@ -81,7 +89,7 @@ private void LoadRecipes() }); ItemManager.Instance.AddRecipe(coinRecipe); - CustomRecipe coinRecipe2 = new CustomRecipe(new RecipeConfig() + CustomRecipe coinRecipe2 = new CustomRecipe(new RecipeConfig { Amount = 100, Item = "Coins", CraftingStation = "forge", Name = "GoldIngotToCoins", MinStationLevel = 2, Requirements = new[] // Resources and amount needed for it to be crafted { @@ -102,42 +110,57 @@ private void LoadConversion() private void LoadPieces() { - _goldStackPiece = _assetBundle.LoadAsset("assets/goldingot/piece_goldstack.prefab"); + AddGoldStack(); + AddCoinPile(); + } + + private void AddCoinPile() + { + _coinPilePiece = _assetBundle.LoadAsset("assets/goldingot/piece_coinpile.prefab"); #if DEBUG - Jotunn.Logger.LogDebug($"_goldStackPiece == null : {_goldStackPiece == null}"); // This is null? + Jotunn.Logger.LogDebug($"_coinPilePiece == null : {_coinPilePiece == null}"); // This is null? #endif - var goldBarStack = new CustomPiece(_goldStackPiece, + var coinPilePiece = new CustomPiece(_coinPilePiece, new PieceConfig { - PieceTable = "_HammerPieceTable", - CraftingStation = "", - Enabled = true, - Requirements = new[] + PieceTable = "_HammerPieceTable", CraftingStation = "", Enabled = true, Requirements = new[] { - new RequirementConfig { Item = "GoldIngot", Amount = 48, Recover = true }, + new RequirementConfig { Item = "Coins", Amount = 200, Recover = true }, } - }); - PieceManager.Instance.AddPiece(goldBarStack); - + }) + { + Piece = + { + m_comfort = CoinPilePieceComfort.Value + } + }; + PieceManager.Instance.AddPiece(coinPilePiece); + } - _coinPilePiece = _assetBundle.LoadAsset("assets/goldingot/piece_coinpile.prefab"); + private void AddGoldStack() + { + _goldStackPiece = _assetBundle.LoadAsset("assets/goldingot/piece_goldstack.prefab"); #if DEBUG - Jotunn.Logger.LogDebug($"_coinPilePiece == null : {_coinPilePiece == null}"); // This is null? + Jotunn.Logger.LogDebug($"_goldStackPiece == null : {_goldStackPiece == null}"); // This is null? #endif - var coinPilePiece = new CustomPiece(_coinPilePiece, + var goldBarStack = new CustomPiece(_goldStackPiece, new PieceConfig { - PieceTable = "_HammerPieceTable", - CraftingStation = "", - Enabled = true, - Requirements = new[] + PieceTable = "_HammerPieceTable", CraftingStation = "", Enabled = true, Requirements = new[] { - new RequirementConfig { Item = "Coins", Amount = 200, Recover = true }, + new RequirementConfig { Item = "GoldIngot", Amount = 48, Recover = true }, } - }); - PieceManager.Instance.AddPiece(coinPilePiece); + , + }) + { + Piece = + { + m_comfort = GoldStackPieceComfort.Value + } + }; + PieceManager.Instance.AddPiece(goldBarStack); } } }