[Enhancement] Custom flea category blacklist (!244)

Allows modders to blacklist entire categories from ragfair in relation to https://dev.sp-tarkov.com/SPT-AKI/Issues/issues/525

new properties under `RagfairConfig.dynamic.blacklist`
`enableCustomItemCategoryList` - this enables the custom custom category blacklist
`customItemCategoryList` - this is an array to take a list of parent id's

I tested it to confirm its working, will need some further testing.

Co-authored-by: Corey <dirtbikercj@gmail.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/244
Co-authored-by: Cj <cj@noreply.dev.sp-tarkov.com>
Co-committed-by: Cj <cj@noreply.dev.sp-tarkov.com>
This commit is contained in:
Cj 2024-03-04 19:36:31 +00:00 committed by chomp
parent c7a577d903
commit 534e9d2ba1
3 changed files with 26 additions and 1 deletions

View File

@ -297,7 +297,9 @@
"armorPlate": {
"maxProtectionLevel": 4,
"ignoreSlots": ["right_side_plate", "left_side_plate"]
}
},
"enableCustomItemCategoryList": false,
"customItemCategoryList": []
},
"unreasonableModPrices": {
"5448fe124bdc2da5018b4567": {

View File

@ -90,6 +90,15 @@ export class RagfairServerHelper
return false;
}
// Skip custom category blacklisted items
if (
blacklistConfig.enableCustomItemCategoryList
&& this.isItemCategoryOnCustomFleaBlacklist(itemDetails[1]._parent)
)
{
return false;
}
// Skip quest items
if (blacklistConfig.enableQuestList && this.itemHelper.isQuestItem(itemDetails[1]._id))
{
@ -123,6 +132,16 @@ export class RagfairServerHelper
return this.ragfairConfig.dynamic.blacklist.custom.includes(itemTemplateId);
}
/**
* Is supplied parent id on the ragfair custom item category blacklist
* @param parentId Parent Id to check is blacklisted
* @returns true if blacklisted
*/
protected isItemCategoryOnCustomFleaBlacklist(itemParentId: string): boolean
{
return this.ragfairConfig.dynamic.blacklist.customItemCategoryList.includes(itemParentId);
}
/**
* is supplied id a trader
* @param traderId

View File

@ -150,6 +150,10 @@ export interface Blacklist
traderItems: boolean;
/** Maximum level an armor plate can be found in a flea-listed armor item */
armorPlate: IArmorPlateBlacklistSettings;
/** Should specific categories be blacklisted from the flea, true = use blacklist */
enableCustomItemCategoryList: boolean;
/** Custom category blacklist for parent Ids */
customItemCategoryList: string[];
}
export interface IArmorPlateBlacklistSettings