Skip to content

Commit

Permalink
Added globalLootBlacklist to pmc config
Browse files Browse the repository at this point in the history
Reworked `PmcLootGenerator` to make use of new property
Unified how pocket/vest/backpack slots create blacklist
Utilise set when combining blacklist sources

Blacklisted prestige dogtags from reward pool and PMC loot
  • Loading branch information
Chomp committed Dec 30, 2024
1 parent 84e0236 commit 502f08c
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 147 deletions.
4 changes: 3 additions & 1 deletion project/assets/configs/item.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@
"675aaab74bca0b001d02f356",
"675aaa8f7f3c962069072b27",
"675aaaf674a7619a5304c233",
"675aaa003107dac10006332f"
"675aaa003107dac10006332f",
"6764207f2fa5e32733055c4a",
"6764202ae307804338014c1a"
],
"bossItems": [
"6275303a9f372d6ea97f9ec7",
Expand Down
175 changes: 54 additions & 121 deletions project/assets/configs/pmc.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,53 +32,10 @@
"57864bb7245977548b3b66c2",
"57864c322459775490116fbf",
"57864e4c24597754843f8723",
"57864ee62459775490116fc1",
"5c164d2286f774194c5e69fa",
"5c99f98d86f7745c314214b3",
"55818add4bdc2d5b648b456f",
"55818ad54bdc2ddc698b4569",
"55818aeb4bdc2ddc698b456a",
"55818ae44bdc2dde698b456c",
"55818b164bdc2ddc698b456c",
"5447e1d04bdc2dff2f8b4567",
"5448eb774bdc2d0a728b4567",
"550aa4cd4bdc2dd8348b456c",
"55818af64bdc2d5b648b4570",
"5448ecbe4bdc2d60728b4568",
"5d650c3e815116009f6201d2",
"5448e54d4bdc2dcc718b4568",
"543be5cb4bdc2deb348b4568",
"5485a8684bdc2da71d8b4567",
"543be5dd4bdc2deb348b4569",
"5fca13ca637ee0341a484f46",
"59f32c3b86f77472a31742f0",
"6662e9f37fa79a6d83730fa0",
"6662ea05f6259762c56f3189",
"59f32bb586f774757e1e8442",
"6662e9aca7e0b43baa3d5f74",
"6662e9cda7e0b43baa3d5f76",
"617aa4dd8166f034d57de9c5",
"5a2a57cfc4a2826c6e06d44a",
"619256e5f8af2c1a4e1f5d92",
"5a0c27731526d80618476ac4",
"57864c8c245977548867e7f1",
"6087e570b998180e9f76dc24",
"6391fcf5744e45201147080f",
"614451b71e5874611e2c7ae5",
"6540d2162ae6d96b540afcaf",
"65ca457b4aafb5d7fc0dcb5d",
"6331ba83f2ab4f3f09502983",
"67409848d0b2f8eb9b034db9",
"67449b6c89d5e1ddc603f504",
"67449b6c89d5e1ddc603f504",
"675aab0d6b6addc02a08f097",
"675aaae1dcf102478202c537",
"675aaa9a3107dac100063331",
"675aaae75a3ab8372d0b02a7",
"675aaab74bca0b001d02f356",
"675aaa8f7f3c962069072b27",
"675aaaf674a7619a5304c233",
"675aaa003107dac10006332f"
"543be5dd4bdc2deb348b4569"
]
},
"pocketLoot": {
Expand All @@ -102,53 +59,11 @@
"5448eb774bdc2d0a728b4567",
"5448f3ac4bdc2dce718b4569"
],
"blacklist": [
"5448e8d04bdc2ddf718b4569",
"5448e8d64bdc2dce718b4568",
"57864ee62459775490116fc1",
"5c164d2286f774194c5e69fa",
"5c99f98d86f7745c314214b3",
"55818add4bdc2d5b648b456f",
"55818ad54bdc2ddc698b4569",
"55818aeb4bdc2ddc698b456a",
"55818ae44bdc2dde698b456c",
"55818b164bdc2ddc698b456c",
"5447e1d04bdc2dff2f8b4567",
"550aa4cd4bdc2dd8348b456c",
"5d650c3e815116009f6201d2",
"5448e54d4bdc2dcc718b4568",
"543be5cb4bdc2deb348b4568",
"5fca13ca637ee0341a484f46",
"59f32c3b86f77472a31742f0",
"6662e9f37fa79a6d83730fa0",
"6662ea05f6259762c56f3189",
"59f32bb586f774757e1e8442",
"6662e9aca7e0b43baa3d5f74",
"6662e9cda7e0b43baa3d5f76",
"617aa4dd8166f034d57de9c5",
"5a2a57cfc4a2826c6e06d44a",
"619256e5f8af2c1a4e1f5d92",
"5a0c27731526d80618476ac4",
"57864c8c245977548867e7f1",
"6087e570b998180e9f76dc24",
"6391fcf5744e45201147080f",
"65ca457b4aafb5d7fc0dcb5d",
"660bbc98c38b837877075e4a",
"6331ba83f2ab4f3f09502983",
"67449b6c89d5e1ddc603f504",
"67449b6c89d5e1ddc603f504",
"675aab0d6b6addc02a08f097",
"675aaae1dcf102478202c537",
"675aaa9a3107dac100063331",
"675aaae75a3ab8372d0b02a7",
"675aaab74bca0b001d02f356",
"675aaa8f7f3c962069072b27",
"675aaaf674a7619a5304c233",
"675aaa003107dac10006332f"
]
"blacklist": []
},
"backpackLoot": {
"whitelist": [
"617aa4dd8166f034d57de9c5",
"57864a3d24597754843f8721",
"57864a66245977548f04a81f",
"57864ada245977548638de91",
Expand Down Expand Up @@ -184,40 +99,58 @@
"543be6564bdc2df4348b4568",
"5448f3ac4bdc2dce718b4569"
],
"blacklist": [
"5e99711486f7744bfc4af328",
"5fca13ca637ee0341a484f46",
"59f32c3b86f77472a31742f0",
"6662e9f37fa79a6d83730fa0",
"6662ea05f6259762c56f3189",
"59f32bb586f774757e1e8442",
"6662e9aca7e0b43baa3d5f74",
"6662e9cda7e0b43baa3d5f76",
"617aa4dd8166f034d57de9c5",
"5a2a57cfc4a2826c6e06d44a",
"619256e5f8af2c1a4e1f5d92",
"5a0c27731526d80618476ac4",
"6087e570b998180e9f76dc24",
"63495c500c297e20065a08b1",
"6391fcf5744e45201147080f",
"614451b71e5874611e2c7ae5",
"6540d2162ae6d96b540afcaf",
"65ca457b4aafb5d7fc0dcb5d",
"660bbc98c38b837877075e4a",
"66d9f7256916142b3b02276e",
"6331ba83f2ab4f3f09502983",
"67409848d0b2f8eb9b034db9",
"67449b6c89d5e1ddc603f504",
"675aab0d6b6addc02a08f097",
"675aaae1dcf102478202c537",
"675aaa9a3107dac100063331",
"675aaae75a3ab8372d0b02a7",
"675aaab74bca0b001d02f356",
"675aaa8f7f3c962069072b27",
"675aaaf674a7619a5304c233",
"675aaa003107dac10006332f"
]
"blacklist": ["66d9f7256916142b3b02276e", "63495c500c297e20065a08b1", "6087e570b998180e9f76dc24"]
},
"globalLootBlacklist": [
"5448e8d04bdc2ddf718b4569",
"5448e8d64bdc2dce718b4568",
"57864ee62459775490116fc1",
"5c164d2286f774194c5e69fa",
"5c99f98d86f7745c314214b3",
"55818add4bdc2d5b648b456f",
"55818ad54bdc2ddc698b4569",
"55818aeb4bdc2ddc698b456a",
"55818ae44bdc2dde698b456c",
"55818b164bdc2ddc698b456c",
"5447e1d04bdc2dff2f8b4567",
"550aa4cd4bdc2dd8348b456c",
"5d650c3e815116009f6201d2",
"5448e54d4bdc2dcc718b4568",
"543be5cb4bdc2deb348b4568",
"6662e9f37fa79a6d83730fa0",
"5e99711486f7744bfc4af328",
"5fca13ca637ee0341a484f46",
"59f32c3b86f77472a31742f0",
"6662ea05f6259762c56f3189",
"59f32bb586f774757e1e8442",
"6662e9aca7e0b43baa3d5f74",
"6662e9cda7e0b43baa3d5f76",
"617aa4dd8166f034d57de9c5",
"5a0c27731526d80618476ac4",
"614451b71e5874611e2c7ae5",
"6540d2162ae6d96b540afcaf",
"65ca457b4aafb5d7fc0dcb5d",
"5a2a57cfc4a2826c6e06d44a",
"619256e5f8af2c1a4e1f5d92",
"57864c8c245977548867e7f1",
"6087e570b998180e9f76dc24",
"6391fcf5744e45201147080f",
"660bbc98c38b837877075e4a",
"6331ba83f2ab4f3f09502983",
"67409848d0b2f8eb9b034db9",
"675aab0d6b6addc02a08f097",
"675aaae1dcf102478202c537",
"675aaa9a3107dac100063331",
"675aaae75a3ab8372d0b02a7",
"675aaab74bca0b001d02f356",
"675aaa8f7f3c962069072b27",
"675aaaf674a7619a5304c233",
"675aaa003107dac10006332f",
"6764202ae307804338014c1a",
"6764207f2fa5e32733055c4a",
"675dc9d37ae1a8792107ca96",
"675dcb0545b1a2d108011b2b"
],
"useDifficultyOverride": false,
"difficulty": "AsOnline",
"botRelativeLevelDeltaMax": 10,
Expand Down
65 changes: 40 additions & 25 deletions project/src/generators/PMCLootGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,24 @@ export class PMCLootGenerator {
const pmcPriceOverrides =
this.databaseService.getBots().types[botRole === "pmcBEAR" ? "bear" : "usec"].inventory.items.Pockets;

const allowedItemTypes = this.pmcConfig.pocketLoot.whitelist;
const pmcItemBlacklist = this.pmcConfig.pocketLoot.blacklist;
const itemBlacklist = this.itemFilterService.getBlacklistedItems();

// Blacklist inactive seasonal items
itemBlacklist.push(...this.seasonalEventService.getInactiveSeasonalEventItems());
const allowedItemTypeWhitelist = this.pmcConfig.pocketLoot.whitelist;

const blacklist = new Set();
for (const id of [
...this.pmcConfig.pocketLoot.blacklist,
...this.pmcConfig.globalLootBlacklist,
...this.itemFilterService.getBlacklistedItems(),
...this.seasonalEventService.getInactiveSeasonalEventItems(),
]) {
blacklist.add(id);
}

const itemsToAdd = Object.values(items).filter(
(item) =>
allowedItemTypes.includes(item._parent) &&
allowedItemTypeWhitelist.includes(item._parent) &&
this.itemHelper.isValidItem(item._id) &&
!pmcItemBlacklist.includes(item._id) &&
!itemBlacklist.includes(item._id) &&
!blacklist.has(item._id) &&
!blacklist.has(item._parent) &&
this.itemFitsInto1By2Slot(item),
);

Expand Down Expand Up @@ -97,19 +102,24 @@ export class PMCLootGenerator {
this.databaseService.getBots().types[botRole === "pmcBEAR" ? "bear" : "usec"].inventory.items
.TacticalVest;

const allowedItemTypes = this.pmcConfig.vestLoot.whitelist;
const pmcItemBlacklist = this.pmcConfig.vestLoot.blacklist;
const itemBlacklist = this.itemFilterService.getBlacklistedItems();
const allowedItemTypeWhitelist = this.pmcConfig.vestLoot.whitelist;

// Blacklist seasonal items
itemBlacklist.push(...this.seasonalEventService.getInactiveSeasonalEventItems());
const blacklist = new Set();
for (const id of [
...this.pmcConfig.vestLoot.blacklist,
...this.pmcConfig.globalLootBlacklist,
...this.itemFilterService.getBlacklistedItems(),
...this.seasonalEventService.getInactiveSeasonalEventItems(),
]) {
blacklist.add(id);
}

const itemsToAdd = Object.values(items).filter(
(item) =>
allowedItemTypes.includes(item._parent) &&
allowedItemTypeWhitelist.includes(item._parent) &&
this.itemHelper.isValidItem(item._id) &&
!pmcItemBlacklist.includes(item._id) &&
!itemBlacklist.includes(item._id) &&
!blacklist.has(item._id) &&
!blacklist.has(item._parent) &&
this.itemFitsInto2By2Slot(item),
);

Expand Down Expand Up @@ -176,19 +186,24 @@ export class PMCLootGenerator {
const pmcPriceOverrides =
this.databaseService.getBots().types[botRole === "pmcBEAR" ? "bear" : "usec"].inventory.items.Backpack;

const allowedItemTypes = this.pmcConfig.backpackLoot.whitelist;
const pmcItemBlacklist = this.pmcConfig.backpackLoot.blacklist;
const itemBlacklist = this.itemFilterService.getBlacklistedItems();
const allowedItemTypeWhitelist = this.pmcConfig.backpackLoot.whitelist;

// Blacklist seasonal items
itemBlacklist.push(...this.seasonalEventService.getInactiveSeasonalEventItems());
const blacklist = new Set();
for (const id of [
...this.pmcConfig.backpackLoot.blacklist,
...this.pmcConfig.globalLootBlacklist,
...this.itemFilterService.getBlacklistedItems(),
...this.seasonalEventService.getInactiveSeasonalEventItems(),
]) {
blacklist.add(id);
}

const itemsToAdd = Object.values(items).filter(
(item) =>
allowedItemTypes.includes(item._parent) &&
allowedItemTypeWhitelist.includes(item._parent) &&
this.itemHelper.isValidItem(item._id) &&
!pmcItemBlacklist.includes(item._id) &&
!itemBlacklist.includes(item._id),
!blacklist.has(item._id) &&
!blacklist.has(item._parent),
);

for (const itemToAdd of itemsToAdd) {
Expand Down
1 change: 1 addition & 0 deletions project/src/models/spt/config/IPmcConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface IPmcConfig extends IBaseConfig {
pocketLoot: ISlotLootSettings;
/** Global whitelist/blacklist of backpack loot for PMCs */
backpackLoot: ISlotLootSettings;
globalLootBlacklist: string[];
/** Use difficulty defined in config/bot.json/difficulty instead of chosen difficulty dropdown value */
useDifficultyOverride: boolean;
/** Difficulty override e.g. "AsOnline/Hard" */
Expand Down

0 comments on commit 502f08c

Please sign in to comment.