1
0

Version 1.1.0

This commit is contained in:
2026-01-26 01:18:39 +01:00
parent 96d67285ab
commit c80e6396d9
4 changed files with 51 additions and 6 deletions

View File

@@ -4,7 +4,7 @@
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
<AssemblyName>AutoPriceUpdater</AssemblyName> <AssemblyName>AutoPriceUpdater</AssemblyName>
<Product>Auto Price Updater</Product> <Product>Auto Price Updater</Product>
<Version>1.0.0</Version> <Version>1.1.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources> <RestoreAdditionalProjectSources>

19
CHANGELOG Normal file
View File

@@ -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

21
LICENSE Normal file
View File

@@ -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.

View File

@@ -18,31 +18,36 @@ public class Plugin : BasePlugin
{ {
public const string PLUGIN_GUID = "de.mpburgmann.AutoPriceUpdater"; public const string PLUGIN_GUID = "de.mpburgmann.AutoPriceUpdater";
public const string PLUGIN_NAME = "Auto Price Updater"; 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; public static new ManualLogSource Log;
private static ConfigEntry<bool> EnableAutoUpdate;
private static ConfigEntry<float> AmountToAdd;
public static ConfigEntry<KeyCode> UpdateKey; public static ConfigEntry<KeyCode> UpdateKey;
private static List<DisplaySlot> m_CachedDisplaySlots = new List<DisplaySlot>(250); private static List<DisplaySlot> m_CachedDisplaySlots = new List<DisplaySlot>(250);
public override void Load() public override void Load()
{ {
Log = base.Log; Log = base.Log;
Log.LogInfo($"Loading {PLUGIN_NAME} v{PLUGIN_VERSION}");
Harmony harmony = new(PLUGIN_GUID); Harmony harmony = new(PLUGIN_GUID);
harmony.PatchAll(); 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<Scene, LoadSceneMode>) OnSceneLoaded; SceneManager.sceneLoaded += (UnityAction<Scene, LoadSceneMode>) OnSceneLoaded;
Log.LogInfo($"{PLUGIN_NAME} loaded successfully");
Log.LogInfo($"Plugin {PLUGIN_GUID} is loaded!");
} }
public static void UpdatePrice() public static void UpdatePrice()
{ {
if(!EnableAutoUpdate.Value) return;
List<Pricing> pricesSetByPlayer = Singleton<SaveManager>.Instance.Price.PricesSetByPlayer; List<Pricing> pricesSetByPlayer = Singleton<SaveManager>.Instance.Price.PricesSetByPlayer;
foreach (Pricing pricing in 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}"); Log.LogInfo($"Updated price for product ID {pricing.ProductID} to {pricing.Price}");
if(Singleton<DisplayManager>.Instance.GetDisplaySlots(pricing.ProductID, false, m_CachedDisplaySlots) > 0) if(Singleton<DisplayManager>.Instance.GetDisplaySlots(pricing.ProductID, false, m_CachedDisplaySlots) > 0)
{ {