refactor: remove armour logic
This commit is contained in:
parent
6b63df76bf
commit
de9619a654
@ -2,11 +2,6 @@
|
|||||||
"baselineBulletId": "59e6906286f7746c9f75e847",
|
"baselineBulletId": "59e6906286f7746c9f75e847",
|
||||||
"baselineBulletPrice": 1000,
|
"baselineBulletPrice": 1000,
|
||||||
"bulletDamageMultiplierRedutionFactor": 0.7,
|
"bulletDamageMultiplierRedutionFactor": 0.7,
|
||||||
"baselineArmourId": "5c0e655586f774045612eeb2",
|
|
||||||
"baselineArmourWeight": 10,
|
|
||||||
"baselineArmourPrice": 200000,
|
|
||||||
"pricePerArmourClassStep": 100000,
|
|
||||||
"armourWeightMultiplierReductionFactor": 0.7,
|
|
||||||
"enableDebug": false,
|
"enableDebug": false,
|
||||||
"excludedCategories": ["5b5f78b786f77447ed5636af", "5b47574386f77428ca22b33c"],
|
"excludedCategories": ["5b5f78b786f77447ed5636af", "5b47574386f77428ca22b33c"],
|
||||||
"gunPriceFallback": 100000,
|
"gunPriceFallback": 100000,
|
||||||
|
25
src/mod.ts
25
src/mod.ts
@ -36,7 +36,6 @@ class TheBlacklistMod implements IPostDBLoadModAsync {
|
|||||||
|
|
||||||
// We to adjust for pricing using a baseline when mods like SPT Realism are used
|
// We to adjust for pricing using a baseline when mods like SPT Realism are used
|
||||||
private baselineBullet: ITemplateItem;
|
private baselineBullet: ITemplateItem;
|
||||||
private baselineArmour: ITemplateItem;
|
|
||||||
|
|
||||||
// Store the category IDs of all attachments in the handbook so we don't have to manually enter them in json
|
// Store the category IDs of all attachments in the handbook so we don't have to manually enter them in json
|
||||||
private attachmentCategoryIds: string[] = [];
|
private attachmentCategoryIds: string[] = [];
|
||||||
@ -57,7 +56,6 @@ class TheBlacklistMod implements IPostDBLoadModAsync {
|
|||||||
ragfairConfig.dynamic.useTraderPriceForOffersIfHigher = advancedConfig.useTraderPriceForOffersIfHigher != null ? advancedConfig.useTraderPriceForOffersIfHigher : true;
|
ragfairConfig.dynamic.useTraderPriceForOffersIfHigher = advancedConfig.useTraderPriceForOffersIfHigher != null ? advancedConfig.useTraderPriceForOffersIfHigher : true;
|
||||||
|
|
||||||
this.baselineBullet = itemTable[advancedConfig.baselineBulletId];
|
this.baselineBullet = itemTable[advancedConfig.baselineBulletId];
|
||||||
this.baselineArmour = itemTable[advancedConfig.baselineArmourId];
|
|
||||||
|
|
||||||
let blacklistedItemsUpdatedCount = 0;
|
let blacklistedItemsUpdatedCount = 0;
|
||||||
let nonBlacklistedItemsUpdatedCount = 0;
|
let nonBlacklistedItemsUpdatedCount = 0;
|
||||||
@ -171,14 +169,11 @@ class TheBlacklistMod implements IPostDBLoadModAsync {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private getUpdatedPrice(item: ITemplateItem, prices: Record<string, number>): number | undefined {
|
private getUpdatedPrice(item: ITemplateItem, prices: Record<string, number>): number | undefined {
|
||||||
// Note that this price can be affected by other mods like Lua's market updater.
|
|
||||||
const currentFleaPrice = prices[item._id];
|
const currentFleaPrice = prices[item._id];
|
||||||
let newPrice: number;
|
let newPrice: number;
|
||||||
|
|
||||||
if (this.isBulletOrShotgunShell(item)) {
|
if (this.isBulletOrShotgunShell(item)) {
|
||||||
newPrice = this.getUpdatedAmmoPrice(item);
|
newPrice = this.getUpdatedAmmoPrice(item);
|
||||||
} else if (this.isArmour(item)) {
|
|
||||||
newPrice = this.getUpdatedArmourPrice(item);
|
|
||||||
} else if (this.isGun(item) && currentFleaPrice == null) {
|
} else if (this.isGun(item) && currentFleaPrice == null) {
|
||||||
newPrice = this.getFallbackGunPrice();
|
newPrice = this.getFallbackGunPrice();
|
||||||
}
|
}
|
||||||
@ -193,10 +188,6 @@ class TheBlacklistMod implements IPostDBLoadModAsync {
|
|||||||
return props.ammoType === "bullet" || props.ammoType === "buckshot";
|
return props.ammoType === "bullet" || props.ammoType === "buckshot";
|
||||||
}
|
}
|
||||||
|
|
||||||
private isArmour(item: ITemplateItem): boolean {
|
|
||||||
return Number(item._props.armorClass) > 0 && item._props.armorZone?.some(zone => zone === "Chest")
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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.
|
// 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.
|
||||||
private isGun(item: ITemplateItem): boolean {
|
private isGun(item: ITemplateItem): boolean {
|
||||||
const marksmanRiflesItemCategoryId = "5447b6194bdc2d67278b4567";
|
const marksmanRiflesItemCategoryId = "5447b6194bdc2d67278b4567";
|
||||||
@ -234,22 +225,6 @@ class TheBlacklistMod implements IPostDBLoadModAsync {
|
|||||||
return advancedConfig.baselineBulletPrice * penetrationMultiplier * damageMultiplier * config.blacklistedAmmoAdditionalPriceMultiplier;
|
return advancedConfig.baselineBulletPrice * penetrationMultiplier * damageMultiplier * config.blacklistedAmmoAdditionalPriceMultiplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some default armour prices are too high like the Zabralo so I want a more balanced way to calculate the price.
|
|
||||||
private getUpdatedArmourPrice(item: ITemplateItem) {
|
|
||||||
const baselineArmourClass = Number(this.baselineArmour._props.armorClass);
|
|
||||||
|
|
||||||
// Instead of doing a simple multiplier by dividing the two armour classes, this will give us a much bigger price range for different tiered armours.
|
|
||||||
const armourClassCost = (Number(item._props.armorClass) - baselineArmourClass) * advancedConfig.pricePerArmourClassStep;
|
|
||||||
const baseArmourWeightMultiplier = advancedConfig.baselineArmourWeight / item._props.Weight;
|
|
||||||
|
|
||||||
// Reduces the effect of the weight multiplier so some lighter armour aren't super expensive.
|
|
||||||
// Eg. let baseArmourWeightMultiplier = 2 & armourWeightMultiplierReductionFactor = 0.7. Instead of a 2x price when an armour is half as light as the baseline, we instead get:
|
|
||||||
// 2 + (1 - 2) * 0.7 = 2 - 0.7 = 1.3x the price.
|
|
||||||
const armourWeightMultiplier = baseArmourWeightMultiplier + (1 - baseArmourWeightMultiplier) * advancedConfig.armourWeightMultiplierReductionFactor;
|
|
||||||
|
|
||||||
return (advancedConfig.baselineArmourPrice + armourClassCost) * armourWeightMultiplier * config.blacklistedArmourAdditionalPriceMultiplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
private getFallbackGunPrice() {
|
private getFallbackGunPrice() {
|
||||||
return advancedConfig.gunPriceFallback || 100000;
|
return advancedConfig.gunPriceFallback || 100000;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user