diff --git a/advancedConfig.json b/advancedConfig.json index 8ea2ac2..519a345 100644 --- a/advancedConfig.json +++ b/advancedConfig.json @@ -4,6 +4,6 @@ "bulletDamageMultiplierRedutionFactor": 0.7, "enableDebug": false, "excludedCategories": ["5b5f78b786f77447ed5636af", "5b47574386f77428ca22b33c"], - "gunPriceFallback": 100000, - "useTraderPriceForOffersIfHigher": true + "useTraderPriceForOffersIfHigher": true, + "handbookPriceMultiplier": 3 } \ No newline at end of file diff --git a/src/helpers.ts b/src/helpers.ts index 00c3df1..7a8955b 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -47,18 +47,6 @@ export function isBulletOrShotgunShell(item: ITemplateItem): boolean { return props.ammoType === "bullet" || props.ammoType === "buckshot"; } -// Some blacklisted guns are very cheap because they don't have a flea price, just a handbook price. The ones listed below will get a much higher default price. -export function isGun(item: ITemplateItem): boolean { - const marksmanRiflesItemCategoryId = "5447b6194bdc2d67278b4567"; - const assaultRiflesItemCategoryId = "5447b5f14bdc2d61278b4567"; - const sniperRiflesItemCategoryId = "5447b6254bdc2dc3278b4568"; - const smgsItemCategoryId = "5447b5e04bdc2d62278b4567"; - const carbinesItemCategoryId = "5447b5fc4bdc2d87278b4567"; - const gunCategories = [marksmanRiflesItemCategoryId, assaultRiflesItemCategoryId, sniperRiflesItemCategoryId, smgsItemCategoryId, carbinesItemCategoryId]; - - return gunCategories.includes(item._parent); -} - export function getUpdatedAmmoPrice(item: ITemplateItem): number { const baselinePen = this.baselineBullet._props.PenetrationPower; const baselineDamage = this.baselineBullet._props.Damage; @@ -82,8 +70,4 @@ export function getUpdatedAmmoPrice(item: ITemplateItem): number { const damageMultiplier = baseDamageMultiplier + (1 - baseDamageMultiplier) * advancedConfig.bulletDamageMultiplierRedutionFactor; return advancedConfig.baselineBulletPrice * penetrationMultiplier * damageMultiplier * config.blacklistedAmmoAdditionalPriceMultiplier; -} - -export function getFallbackGunPrice(): number { - return advancedConfig.gunPriceFallback || 100000; } \ No newline at end of file diff --git a/src/mod.ts b/src/mod.ts index 560c297..5c80bd3 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -24,11 +24,11 @@ import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; -import { Category, HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; +import { HandbookItem } from "@spt-aki/models/eft/common/tables/IHandbookBase"; import config from "../config.json"; import advancedConfig from "../advancedConfig.json"; -import { getAttachmentCategoryIds, getFallbackGunPrice, getUpdatedAmmoPrice, isBulletOrShotgunShell, isGun } from "./helpers"; +import { getAttachmentCategoryIds, getUpdatedAmmoPrice, isBulletOrShotgunShell } from "./helpers"; class TheBlacklistMod implements IPostDBLoadModAsync { private logger: ILogger; @@ -95,7 +95,7 @@ class TheBlacklistMod implements IPostDBLoadModAsync { return; } - prices[item._id] = this.getUpdatedPrice(item, prices); + prices[item._id] = this.getUpdatedPrice(handbookItem, item, prices); if (!prices[item._id]) { this.debug(`There are no flea prices for ${item._id} - ${item._name}!`); @@ -106,8 +106,6 @@ class TheBlacklistMod implements IPostDBLoadModAsync { this.blacklistedItemsUpdatedCount++; } - - }); this.logger.success(`${this.modName}: Success! Found ${this.blacklistedItemsUpdatedCount} blacklisted & ${this.nonBlacklistedItemsUpdatedCount} non-blacklisted items to update.`); @@ -186,19 +184,15 @@ class TheBlacklistMod implements IPostDBLoadModAsync { this.ammoPricesUpdatedCount++; } - private getUpdatedPrice(item: ITemplateItem, prices: Record): number | undefined { - const currentFleaPrice = prices[item._id]; - let newPrice: number; + private getUpdatedPrice(handbookItem: HandbookItem, item: ITemplateItem, prices: Record): number | undefined { + // If a flea price doesn't exist for an item, we can multiply its handbook price which usually exists. + if (prices[item._id] == null) { + const handbookPrice = handbookItem.Price; - if (isBulletOrShotgunShell(item)) { - newPrice = getUpdatedAmmoPrice(item); - } else if (isGun(item) && currentFleaPrice == null) { - newPrice = getFallbackGunPrice(); + return handbookPrice * advancedConfig.handbookPriceMultiplier; } - // Avoids NaN. Also we shouldn't have any prices of 0. - const price = newPrice || currentFleaPrice; - return price && price * config.blacklistedItemPriceMultiplier; + return prices[item._id] * config.blacklistedItemPriceMultiplier; } private debug(message: string) { diff --git a/src/priceService.ts b/src/priceService.ts deleted file mode 100644 index 723ab4b..0000000 --- a/src/priceService.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (C) 2024 Platinum -// -// This file is part of spt-the-blacklist. -// -// spt-the-blacklist is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// spt-the-blacklist is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with spt-the-blacklist. If not, see . -