Version 1.1.0
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyName>AutoPriceUpdater</AssemblyName>
|
||||
<Product>Auto Price Updater</Product>
|
||||
<Version>1.0.0</Version>
|
||||
<Version>1.1.0</Version>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RestoreAdditionalProjectSources>
|
||||
|
||||
19
CHANGELOG
Normal file
19
CHANGELOG
Normal 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
21
LICENSE
Normal 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.
|
||||
15
Plugin.cs
15
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<bool> EnableAutoUpdate;
|
||||
private static ConfigEntry<float> AmountToAdd;
|
||||
public static ConfigEntry<KeyCode> UpdateKey;
|
||||
private static List<DisplaySlot> m_CachedDisplaySlots = new List<DisplaySlot>(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<Scene, LoadSceneMode>) OnSceneLoaded;
|
||||
|
||||
Log.LogInfo($"Plugin {PLUGIN_GUID} is loaded!");
|
||||
Log.LogInfo($"{PLUGIN_NAME} loaded successfully");
|
||||
}
|
||||
|
||||
public static void UpdatePrice()
|
||||
{
|
||||
if(!EnableAutoUpdate.Value) return;
|
||||
List<Pricing> pricesSetByPlayer = Singleton<SaveManager>.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<DisplayManager>.Instance.GetDisplaySlots(pricing.ProductID, false, m_CachedDisplaySlots) > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user