diff --git a/AutoPriceUpdater.csproj b/AutoPriceUpdater.csproj index 1bd8a3e..8d573ec 100644 --- a/AutoPriceUpdater.csproj +++ b/AutoPriceUpdater.csproj @@ -4,7 +4,7 @@ net6.0 AutoPriceUpdater Auto Price Updater - 1.0.0 + 1.1.0 true latest diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..52dbfc1 --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,19 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.1.0] - 2026-01-26 + +### Added +- New option to disable the mod +- Configurable amount to add to the market price (can be negative) + +## [1.0.0] - 2026-01-23 + +### Added +- Initial release +- Automatically updates the price of each product to the market price minus 0.10 ct +- Manually updates by pressing the update key \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2667006 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Marc Philipp Burgmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Plugin.cs b/Plugin.cs index 3548f32..0927540 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -18,31 +18,36 @@ public class Plugin : BasePlugin { public const string PLUGIN_GUID = "de.mpburgmann.AutoPriceUpdater"; public const string PLUGIN_NAME = "Auto Price Updater"; - public const string PLUGIN_VERSION = "1.0.0"; + public const string PLUGIN_VERSION = "1.1.0"; public static new ManualLogSource Log; + private static ConfigEntry EnableAutoUpdate; + private static ConfigEntry AmountToAdd; public static ConfigEntry UpdateKey; private static List m_CachedDisplaySlots = new List(250); public override void Load() { Log = base.Log; + Log.LogInfo($"Loading {PLUGIN_NAME} v{PLUGIN_VERSION}"); Harmony harmony = new(PLUGIN_GUID); harmony.PatchAll(); - UpdateKey = Config.Bind("Settings", "UpdateKey", KeyCode.F9); + EnableAutoUpdate = Config.Bind("Settings", "Enabled", true, "If enabled, prices will be automatically updated at the start of each day."); + UpdateKey = Config.Bind("Settings", "UpdateKey", KeyCode.F9, "Key to manually update prices. Not working when Enabled is false."); + AmountToAdd = Config.Bind("Price Settings", "Amount To Add", 0.1f, "Amount to add to market price. Can be negative."); SceneManager.sceneLoaded += (UnityAction) OnSceneLoaded; - - Log.LogInfo($"Plugin {PLUGIN_GUID} is loaded!"); + Log.LogInfo($"{PLUGIN_NAME} loaded successfully"); } public static void UpdatePrice() { + if(!EnableAutoUpdate.Value) return; List pricesSetByPlayer = Singleton.Instance.Price.PricesSetByPlayer; foreach (Pricing pricing in pricesSetByPlayer) { - pricing.Price = pricing.MarketPrice - 0.1f; + pricing.Price = pricing.MarketPrice + AmountToAdd.Value; Log.LogInfo($"Updated price for product ID {pricing.ProductID} to {pricing.Price}"); if(Singleton.Instance.GetDisplaySlots(pricing.ProductID, false, m_CachedDisplaySlots) > 0) {