From c40a4aa7cb486d459385a9e11e3fbe961c12cd78 Mon Sep 17 00:00:00 2001 From: Chomp Date: Sun, 22 Dec 2024 15:35:15 +0000 Subject: [PATCH] Added system to allow overriding flea prices via config --- project/assets/configs/ragfair.json | 8 ++++++- .../src/models/spt/config/IRagfairConfig.ts | 2 ++ project/src/services/PostDbLoadService.ts | 23 +++++++++++++------ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/project/assets/configs/ragfair.json b/project/assets/configs/ragfair.json index 47b46be3..869c5b66 100644 --- a/project/assets/configs/ragfair.json +++ b/project/assets/configs/ragfair.json @@ -336,7 +336,13 @@ "handbookPriceOverMultiplier": 11, "newPriceHandbookMultiplier": 11 } - } + }, + "itemPriceOverrideRouble":{ + "66bc98a01a47be227a5e956e": 500000, + "63a8970d7108f713591149f5": 50000, + "63a898a328e385334e0640a5": 100000, + "63a897c6b1ff6e29734fcc95": 200000 + } }, "tieredFlea": { "enabled": false, diff --git a/project/src/models/spt/config/IRagfairConfig.ts b/project/src/models/spt/config/IRagfairConfig.ts index b98a883c..3e81c018 100644 --- a/project/src/models/spt/config/IRagfairConfig.ts +++ b/project/src/models/spt/config/IRagfairConfig.ts @@ -80,6 +80,8 @@ export interface IDynamic { blacklist: IRagfairBlacklist; /** Dict of price limits keyed by item type */ unreasonableModPrices: Record; + /** Custom rouble prices for items to override values from prices.json */ + itemPriceOverrideRouble: Record; } export interface IPriceRanges { diff --git a/project/src/services/PostDbLoadService.ts b/project/src/services/PostDbLoadService.ts index b1e62cbe..c3b83fa9 100644 --- a/project/src/services/PostDbLoadService.ts +++ b/project/src/services/PostDbLoadService.ts @@ -118,14 +118,8 @@ export class PostDbLoadService { } this.addMissingTraderBuyRestrictionMaxValue(); - } - protected addMissingTraderBuyRestrictionMaxValue(): void { - this.databaseService.getGlobals().config.TradingSettings.BuyRestrictionMaxBonus.unheard_edition = { - multiplier: - this.databaseService.getGlobals().config.TradingSettings.BuyRestrictionMaxBonus.edge_of_darkness - .multiplier, - }; + this.applyFleaPriceOverrides(); } protected adjustMinReserveRaiderSpawnChance(): void { @@ -510,4 +504,19 @@ export class PostDbLoadService { } } } + + protected addMissingTraderBuyRestrictionMaxValue(): void { + this.databaseService.getGlobals().config.TradingSettings.BuyRestrictionMaxBonus.unheard_edition = { + multiplier: + this.databaseService.getGlobals().config.TradingSettings.BuyRestrictionMaxBonus.edge_of_darkness + .multiplier, + }; + } + + protected applyFleaPriceOverrides() { + const fleaPrices = this.databaseService.getPrices(); + for (const [key, value] of Object.entries(this.ragfairConfig.dynamic.itemPriceOverrideRouble)) { + fleaPrices[key] = value; + } + } }