From 343be66806428ac72ebcfb1099e86f0c1e414ba6 Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 30 Jun 2023 14:00:08 +0100 Subject: [PATCH] Add property to ragfair blacklist to toggle removal of `damaged` ammo packs --- project/assets/configs/ragfair.json | 1 + project/src/helpers/RagfairServerHelper.ts | 7 +++++++ project/src/models/spt/config/IRagfairConfig.ts | 2 ++ 3 files changed, 10 insertions(+) diff --git a/project/assets/configs/ragfair.json b/project/assets/configs/ragfair.json index 78dc3f7c..3a7c8eb7 100644 --- a/project/assets/configs/ragfair.json +++ b/project/assets/configs/ragfair.json @@ -145,6 +145,7 @@ ], "removeSeasonalItemsWhenNotInEvent": true, "blacklist": { + "damagedAmmoPacks": true, "custom": [], "enableBsgList": true, "enableQuestList": true, diff --git a/project/src/helpers/RagfairServerHelper.ts b/project/src/helpers/RagfairServerHelper.ts index f1cbaf5d..3c659146 100644 --- a/project/src/helpers/RagfairServerHelper.ts +++ b/project/src/helpers/RagfairServerHelper.ts @@ -2,6 +2,7 @@ import { inject, injectable } from "tsyringe"; import { Item } from "../models/eft/common/tables/IItem"; import { ITemplateItem } from "../models/eft/common/tables/ITemplateItem"; +import { BaseClasses } from "../models/enums/BaseClasses"; import { ConfigTypes } from "../models/enums/ConfigTypes"; import { MemberCategory } from "../models/enums/MemberCategory"; import { MessageType } from "../models/enums/MessageType"; @@ -87,6 +88,12 @@ export class RagfairServerHelper return false; } + // Don't include damaged ammo packs + if (this.ragfairConfig.dynamic.blacklist.damagedAmmoPacks && itemDetails[1]._parent === BaseClasses.AMMO_BOX && itemDetails[1]._name.includes("_damaged")) + { + return false; + } + return true; } diff --git a/project/src/models/spt/config/IRagfairConfig.ts b/project/src/models/spt/config/IRagfairConfig.ts index f62e0464..4a15f4b2 100644 --- a/project/src/models/spt/config/IRagfairConfig.ts +++ b/project/src/models/spt/config/IRagfairConfig.ts @@ -129,6 +129,8 @@ export interface Condition export interface Blacklist { + /** Damaged ammo packs */ + damagedAmmoPacks: boolean /** Custom blacklist for item Tpls */ custom: string[] /** BSG blacklist a large number of items from flea, true = use blacklist */