diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 280194e3..712de833 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ ## How to setup your environment for V+ development How to setup the development enviroment to compile ValheimPlus yourself. -1. Download the [BepInEx for Valheim package](https://valheim.thunderstore.io/package/download/denikson/BepInExPack_Valheim/5.4.1901/). +1. Download the [BepInEx for Valheim package](https://valheim.thunderstore.io/package/download/denikson/BepInExPack_Valheim/5.4.2100/). - Extract zip contents and copy the contents inside `/BepInExPack_Valheim/` and paste them in your Valheim root folder and overwrite every file when asked. - This package sets up your Valheim game with BepInEx configurations specifically for mod devs. Created by [BepInEx](https://github.com/BepInEx). 1. Copy over all the DLLs from Valheim/unstripped_corlib to Valheim/valheim_Data/Managed *(overwrite when asked)* diff --git a/ValheimPlus/Configurations/Configuration.cs b/ValheimPlus/Configurations/Configuration.cs index 115f6e94..cc4fb183 100644 --- a/ValheimPlus/Configurations/Configuration.cs +++ b/ValheimPlus/Configurations/Configuration.cs @@ -53,5 +53,7 @@ public class Configuration public GameClockConfiguration GameClock { get; set; } public BrightnessConfiguration Brightness { get; set; } public ChatConfiguration Chat { get; set; } + public WispSpawnerConfiguration WispSpawner { get; set; } + public EitrRefineryConfiguration EitrRefinery { get; set; } } } diff --git a/ValheimPlus/Configurations/Sections/EitrRefineryConfiguration.cs b/ValheimPlus/Configurations/Sections/EitrRefineryConfiguration.cs new file mode 100644 index 00000000..f052c9ca --- /dev/null +++ b/ValheimPlus/Configurations/Sections/EitrRefineryConfiguration.cs @@ -0,0 +1,13 @@ +namespace ValheimPlus.Configurations.Sections +{ + public class EitrRefineryConfiguration : ServerSyncConfig + { + public int maximumSoftTissue { get; internal set; } = 20; + public int maximumSap { get; internal set; } = 20; + public float productionSpeed { get; internal set; } = 40; + public bool autoDeposit { get; internal set; } = false; + public bool autoFuel { get; internal set; } = false; + public bool ignorePrivateAreaCheck { get; internal set; } = true; + public float autoRange { get; internal set; } = 10; + } +} \ No newline at end of file diff --git a/ValheimPlus/GameClasses/Chat.cs b/ValheimPlus/GameClasses/Chat.cs index 3dfde7d5..15bdc076 100644 --- a/ValheimPlus/GameClasses/Chat.cs +++ b/ValheimPlus/GameClasses/Chat.cs @@ -10,10 +10,10 @@ namespace ValheimPlus.GameClasses /// /// Change Ping and global message behavior /// - [HarmonyPatch(typeof(Chat), nameof(Chat.OnNewChatMessage), new System.Type[] { typeof(GameObject), typeof(long), typeof(Vector3), typeof(Talker.Type), typeof(string), typeof(string), typeof(string) })] + [HarmonyPatch(typeof(Chat), nameof(Chat.OnNewChatMessage), new System.Type[] { typeof(GameObject), typeof(long), typeof(Vector3), typeof(Talker.Type), typeof(UserInfo), typeof(string), typeof(string) })] public static class Chat_AddInworldText_Patch { - private static bool Prefix(ref Chat __instance, GameObject go, long senderID, Vector3 pos, Talker.Type type, string user, string text, string senderNetworkUserId) + private static bool Prefix(ref Chat __instance, GameObject go, long senderID, Vector3 pos, Talker.Type type, UserInfo user, string text, string senderNetworkUserId) { if (Configuration.Current.Chat.IsEnabled) @@ -50,7 +50,7 @@ private static bool Prefix(ref Chat __instance, GameObject go, long senderID, Ve { // Only add string to chat window and show no ping if (Configuration.Current.Chat.outOfRangeShoutsDisplayInChatWindow) - __instance.AddString(user, text, Talker.Type.Shout); + __instance.AddString(user.GetDisplayName(senderNetworkUserId), text, Talker.Type.Shout); return false; } } @@ -64,7 +64,7 @@ private static bool Prefix(ref Chat __instance, GameObject go, long senderID, Ve - [HarmonyPatch(typeof(Chat), nameof(Chat.AddInworldText), new System.Type[] { typeof(GameObject), typeof(long), typeof(Vector3), typeof(Talker.Type), typeof(string), typeof(string) })] + [HarmonyPatch(typeof(Chat), nameof(Chat.AddInworldText), new System.Type[] { typeof(GameObject), typeof(long), typeof(Vector3), typeof(Talker.Type), typeof(UserInfo), typeof(string) })] public static class Chat_AddInworldText_Transpiler { /// diff --git a/ValheimPlus/GameClasses/FejdStartup.cs b/ValheimPlus/GameClasses/FejdStartup.cs index e7f44bb7..edfdfdfb 100644 --- a/ValheimPlus/GameClasses/FejdStartup.cs +++ b/ValheimPlus/GameClasses/FejdStartup.cs @@ -40,9 +40,9 @@ private static void Postfix(ref FejdStartup __instance) // version text for bottom right of startup __instance.m_versionLabel.fontSize = 14; - __instance.m_versionLabel.GetComponent().sizeDelta = new Vector2(300, 30); + __instance.m_versionLabel.GetComponent().sizeDelta = new Vector2(600, 30); string gameVersion = Version.CombineVersion(global::Version.m_major, global::Version.m_minor, global::Version.m_patch); - __instance.m_versionLabel.text = "version " + gameVersion + "\n" + "ValheimPlus " + ValheimPlusPlugin.version; + __instance.m_versionLabel.text = "version " + gameVersion + "\n" + "ValheimPlus " + ValheimPlusPlugin.version + " (Grantapher Temporary)"; if (Configuration.Current.ValheimPlus.IsEnabled && Configuration.Current.ValheimPlus.serverBrowserAdvertisement) diff --git a/ValheimPlus/GameClasses/InventoryGUI.cs b/ValheimPlus/GameClasses/InventoryGUI.cs index 076f72c8..77ff9f94 100644 --- a/ValheimPlus/GameClasses/InventoryGUI.cs +++ b/ValheimPlus/GameClasses/InventoryGUI.cs @@ -261,7 +261,8 @@ public static IEnumerable Transpile(IEnumerable nearbyChests = InventoryAssistant.GetNearbyChests(smelter.gameObject, autoDepositRange, !ignorePrivateAreaCheck); @@ -196,6 +206,13 @@ static void Prefix(Smelter __instance) autoFuelRange = Configuration.Current.SpinningWheel.autoRange; ignorePrivateAreaCheck = Configuration.Current.SpinningWheel.ignorePrivateAreaCheck; } + else if (__instance.m_name.Equals(SmelterDefinitions.EitrRefineryName)) + { + if (!Configuration.Current.EitrRefinery.IsEnabled || !Configuration.Current.EitrRefinery.autoFuel) + return; + autoFuelRange = Configuration.Current.EitrRefinery.autoRange; + ignorePrivateAreaCheck = Configuration.Current.EitrRefinery.ignorePrivateAreaCheck; + } autoFuelRange = Helper.Clamp(autoFuelRange, 1, 50); @@ -345,15 +362,18 @@ public static class SmelterDefinitions public static readonly string FurnaceName = "$piece_blastfurnace"; public static readonly string WindmillName = "$piece_windmill"; public static readonly string SpinningWheelName = "$piece_spinningwheel"; + public static readonly string EitrRefineryName = "$piece_eitrrefinery"; } public static class FurnaceDefinitions { + public static readonly string SapPrefabName = "Sap"; public static readonly string CopperOrePrefabName = "CopperOre"; public static readonly string ScrapIronPrefabName = "IronScrap"; public static readonly string SilverOrePrefabName = "SilverOre"; public static readonly string TinOrePrefabName = "TinOre"; + public static readonly string RefinedEitrPrefabName = "Eitr"; public static readonly string CopperPrefabName = "Copper"; public static readonly string IronPrefabName = "Iron"; public static readonly string SilverPrefabName = "Silver"; @@ -364,7 +384,8 @@ public static class FurnaceDefinitions new Smelter.ItemConversion() { m_from = ObjectDB.instance.GetItemPrefab(CopperOrePrefabName).GetComponent(), m_to = ObjectDB.instance.GetItemPrefab(CopperPrefabName).GetComponent().GetComponent() }, new Smelter.ItemConversion() { m_from = ObjectDB.instance.GetItemPrefab(ScrapIronPrefabName).GetComponent(), m_to = ObjectDB.instance.GetItemPrefab(IronPrefabName).GetComponent().GetComponent() }, new Smelter.ItemConversion() { m_from = ObjectDB.instance.GetItemPrefab(SilverOrePrefabName).GetComponent(), m_to = ObjectDB.instance.GetItemPrefab(SilverPrefabName).GetComponent().GetComponent() }, - new Smelter.ItemConversion() { m_from = ObjectDB.instance.GetItemPrefab(TinOrePrefabName).GetComponent(), m_to = ObjectDB.instance.GetItemPrefab(TinPrefabName).GetComponent().GetComponent() } + new Smelter.ItemConversion() { m_from = ObjectDB.instance.GetItemPrefab(TinOrePrefabName).GetComponent(), m_to = ObjectDB.instance.GetItemPrefab(TinPrefabName).GetComponent().GetComponent() }, + new Smelter.ItemConversion() { m_from = ObjectDB.instance.GetItemPrefab(SapPrefabName).GetComponent(), m_to = ObjectDB.instance.GetItemPrefab(RefinedEitrPrefabName).GetComponent().GetComponent() } }; } diff --git a/ValheimPlus/ValheimPlus.cs b/ValheimPlus/ValheimPlus.cs index 9abe9aa7..b361212e 100644 --- a/ValheimPlus/ValheimPlus.cs +++ b/ValheimPlus/ValheimPlus.cs @@ -16,7 +16,7 @@ namespace ValheimPlus [BepInPlugin("org.bepinex.plugins.valheim_plus", "Valheim Plus", version)] public class ValheimPlusPlugin : BaseUnityPlugin { - public const string version = "0.9.9.11"; + public const string version = "0.9.9.12"; public static string newestVersion = ""; public static bool isUpToDate = false; @@ -29,11 +29,11 @@ public class ValheimPlusPlugin : BaseUnityPlugin public static Harmony harmony = new Harmony("mod.valheim_plus"); // Project Repository Info - public static string Repository = "https://github.com/valheimPlus/ValheimPlus"; - public static string ApiRepository = "https://api.github.com/repos/valheimPlus/valheimPlus/tags"; + public static string Repository = "https://github.com/grantapher/ValheimPlus"; + public static string ApiRepository = "https://api.github.com/repos/grantapher/valheimPlus/tags"; // Website INI for auto update - public static string iniFile = "https://raw.githubusercontent.com/valheimPlus/ValheimPlus/" + version + "/valheim_plus.cfg"; + public static string iniFile = "https://raw.githubusercontent.com/grantapher/ValheimPlus/" + version + "/valheim_plus.cfg"; // Awake is called once when both the game and the plug-in are loaded void Awake() diff --git a/valheim_plus.cfg b/valheim_plus.cfg index 32a8340e..3e9a6f9e 100644 --- a/valheim_plus.cfg +++ b/valheim_plus.cfg @@ -1110,3 +1110,48 @@ defaultNormalDistance = 15 ; This value determines the range in meters that you can see shout text messages by default. defaultShoutDistance = 70 + +[WispSpawner] + +; Change false to true to enable this section. +enabled = false + +; This value determines the maximum amount of Wisp per spawner. +maximumWisps = 3 + +; This value determines if the Wisps can spawn during the day. +onlySpawnAtNight = true + +; This value determines the rate at which the Wisps try to spawn. A multiplier of -50 will result in a wisp trying to spawn every 2.5 seconds (5 seconds by default). +wispSpawnIntervalMultiplier = 0 + +; This value determines the chance of a Wisp to spawn. A multiplier of 200 will result in a 100% wisp spawn chance. +wispSpawnChanceMultiplier = 0 + +[EitrRefinery] + +; Change false to true to enable this section. +enabled = false + +; Maximum amount of soft tissue in an eitr refinery. +maximumSoftTissue = 20 + +; Maximum amount of sap in an eitr refinery. +maximumSap = 20 + +; The time it takes for the eitr refinery to produce a single refined eitr in seconds. +productionSpeed = 40 + +; Instead of dropping the items, they will be placed inside the nearest nearby chests. +autoDeposit = false + +; The eitr refinery will pull sap from nearby chests to be automatically added to it when its empty. +autoFuel = false + +; This option prevents the eitr refinery to pull items from warded areas if it isn't placed inside of it. +; For convenience, we recommend this to be set to true. +ignorePrivateAreaCheck = true + +; The range of the chest detection for the auto deposit and auto fuel features. +; Maximum is 50 +autoRange = 10