0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 06:10:44 -05:00

Update flea prices + Add sytem for adjusting unreasonable high mod prices on flea

This commit is contained in:
Dev 2023-07-30 15:22:19 +01:00
parent 6b8fadef40
commit 5b7199b952
4 changed files with 2304 additions and 2228 deletions

View File

@ -150,6 +150,11 @@
"enableBsgList": true,
"enableQuestList": true,
"traderItems": false
}
},
"unreasonableModPrices": {
"enabled": true,
"handbookPriceOverMultiplier": 8
"newPriceHandbookMultiplier": 8
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -85,6 +85,15 @@ export interface Dynamic
removeSeasonalItemsWhenNotInEvent: boolean
/** Flea blacklist settings */
blacklist: Blacklist
/** Should prices over the multiplier be adjusted */
unreasonableModPrices: IUnreasonableModPrices
}
export interface IUnreasonableModPrices
{
enabled: boolean
handbookPriceOverMultiplier: number
newPriceHandbookMultiplier: number
}
export interface Barter

View File

@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe";
import { HideoutHelper } from "../helpers/HideoutHelper";
import { InventoryHelper } from "../helpers/InventoryHelper";
import { ItemHelper } from "../helpers/ItemHelper";
import { IPmcData } from "../models/eft/common/IPmcData";
import { Bonus, HideoutSlot } from "../models/eft/common/tables/IBotBase";
import {
@ -9,11 +10,13 @@ import {
} from "../models/eft/common/tables/IRepeatableQuests";
import { StageBonus } from "../models/eft/hideout/IHideoutArea";
import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
import { BaseClasses } from "../models/enums/BaseClasses";
import { ConfigTypes } from "../models/enums/ConfigTypes";
import { HideoutAreas } from "../models/enums/HideoutAreas";
import { QuestStatus } from "../models/enums/QuestStatus";
import { Traders } from "../models/enums/Traders";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
import { IRagfairConfig } from "../models/spt/config/IRagfairConfig";
import { ILogger } from "../models/spt/utils/ILogger";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
@ -25,12 +28,14 @@ import { LocalisationService } from "./LocalisationService";
export class ProfileFixerService
{
protected coreConfig: ICoreConfig;
protected ragfairConfig: IRagfairConfig;
constructor(
@inject("WinstonLogger") protected logger: ILogger,
@inject("Watermark") protected watermark: Watermark,
@inject("HideoutHelper") protected hideoutHelper: HideoutHelper,
@inject("InventoryHelper") protected inventoryHelper: InventoryHelper,
@inject("ItemHelper") protected itemHelper: ItemHelper,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("TimeUtil") protected timeUtil: TimeUtil,
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
@ -38,6 +43,7 @@ export class ProfileFixerService
)
{
this.coreConfig = this.configServer.getConfig(ConfigTypes.CORE);
this.ragfairConfig = this.configServer.getConfig(ConfigTypes.RAGFAIR);
}
/**
@ -93,6 +99,40 @@ export class ProfileFixerService
this.fixNullTraderSalesSums(pmcProfile);
this.updateProfilePocketsToNewId(pmcProfile);
this.updateProfileQuestDataValues(pmcProfile);
if (this.ragfairConfig.dynamic.unreasonableModPrices.enabled)
{
this.adjustUnreasonableModFleaPrices();
}
}
protected adjustUnreasonableModFleaPrices(): void
{
const db = this.databaseServer.getTables();
const fleaPrices = db.templates.prices;
const handbookPrices = db.templates.handbook.Items;
for (const itemTpl in fleaPrices)
{
if (this.itemHelper.isOfBaseclass(itemTpl, BaseClasses.MOD))
{
const itemHandbookPrice = handbookPrices.find(x => x.Id === itemTpl);
if (!itemHandbookPrice)
{
continue;
}
if (fleaPrices[itemTpl] > (itemHandbookPrice.Price * this.ragfairConfig.dynamic.unreasonableModPrices.handbookPriceOverMultiplier))
{
if (fleaPrices[itemTpl] <= 1)
{
continue;
}
// Price is over limit, adjust
fleaPrices[itemTpl] = itemHandbookPrice.Price * this.ragfairConfig.dynamic.unreasonableModPrices.newPriceHandbookMultiplier;
}
}
}
}
/**