@@ -634,27 +634,28 @@ export class CircleOfCultistService {
634
634
) : string [ ] {
635
635
const rewardPool = new Set < string > ( ) ;
636
636
const hideoutDbData = this . databaseService . getHideout ( ) ;
637
+ const itemsDb = this . databaseService . getItems ( ) ;
637
638
638
- // Merge reward item blacklist and boss item blacklist with cultist circle blacklist from config
639
- const itemRewardBlacklist = [
639
+ // Get all items that match the blacklisted types and fold into item blacklist below
640
+ const itemTypeBlacklist = this . itemFilterService . getItemRewardBaseTypeBlacklist ( ) ;
641
+ const itemsMatchingTypeBlacklist = Object . values ( itemsDb )
642
+ . filter ( ( templateItem ) => this . itemHelper . isOfBaseclasses ( templateItem . _parent , itemTypeBlacklist ) )
643
+ . map ( ( templateItem ) => templateItem . _id ) ;
644
+
645
+ // Create set of unique values to ignore
646
+ const itemRewardBlacklist = new Set ( [
640
647
...this . seasonalEventService . getInactiveSeasonalEventItems ( ) ,
641
648
...this . itemFilterService . getItemRewardBlacklist ( ) ,
642
649
...cultistCircleConfig . rewardItemBlacklist ,
643
- ] ;
644
-
645
- const itemBaseTypeBlacklist = this . itemFilterService . getItemRewardBaseTypeBlacklist ( ) ;
650
+ ...itemsMatchingTypeBlacklist ,
651
+ ] ) ;
646
652
647
653
// Hideout and task rewards are ONLY if the bonus is active
648
654
switch ( craftingInfo . rewardType ) {
649
655
case CircleRewardType . RANDOM : {
650
656
// Does reward pass the high value threshold
651
657
const isHighValueReward = craftingInfo . rewardAmountRoubles >= cultistCircleConfig . highValueThresholdRub ;
652
- this . generateRandomisedItemsAndAddToRewardPool (
653
- rewardPool ,
654
- itemRewardBlacklist ,
655
- itemBaseTypeBlacklist ,
656
- isHighValueReward ,
657
- ) ;
658
+ this . generateRandomisedItemsAndAddToRewardPool ( rewardPool , itemRewardBlacklist , isHighValueReward ) ;
658
659
659
660
break ;
660
661
}
@@ -665,12 +666,7 @@ export class CircleOfCultistService {
665
666
666
667
// If we have no tasks or hideout stuff left or need more loot to fill it out, default to high value
667
668
if ( rewardPool . size < cultistCircleConfig . maxRewardItemCount + 2 ) {
668
- this . generateRandomisedItemsAndAddToRewardPool (
669
- rewardPool ,
670
- itemRewardBlacklist ,
671
- itemBaseTypeBlacklist ,
672
- true ,
673
- ) ;
669
+ this . generateRandomisedItemsAndAddToRewardPool ( rewardPool , itemRewardBlacklist , true ) ;
674
670
}
675
671
break ;
676
672
}
@@ -679,7 +675,7 @@ export class CircleOfCultistService {
679
675
// Add custom rewards from config
680
676
if ( cultistCircleConfig . additionalRewardItemPool . length > 0 ) {
681
677
for ( const additionalReward of cultistCircleConfig . additionalRewardItemPool ) {
682
- if ( itemRewardBlacklist . includes ( additionalReward ) ) {
678
+ if ( itemRewardBlacklist . has ( additionalReward ) ) {
683
679
continue ;
684
680
}
685
681
@@ -699,7 +695,7 @@ export class CircleOfCultistService {
699
695
*/
700
696
protected addTaskItemRequirementsToRewardPool (
701
697
pmcData : IPmcData ,
702
- itemRewardBlacklist : string [ ] ,
698
+ itemRewardBlacklist : Set < string > ,
703
699
rewardPool : Set < string > ,
704
700
) : void {
705
701
const activeTasks = pmcData . Quests . filter ( ( quest ) => quest . status === QuestStatus . Started ) ;
@@ -710,7 +706,7 @@ export class CircleOfCultistService {
710
706
) ;
711
707
for ( const condition of handoverConditions ) {
712
708
for ( const neededItem of condition . target ) {
713
- if ( itemRewardBlacklist . includes ( neededItem ) || ! this . itemHelper . isValidItem ( neededItem ) ) {
709
+ if ( itemRewardBlacklist . has ( neededItem ) || ! this . itemHelper . isValidItem ( neededItem ) ) {
714
710
continue ;
715
711
}
716
712
this . logger . debug ( `Added Task Loot: ${ this . itemHelper . getItemName ( neededItem ) } ` ) ;
@@ -730,7 +726,7 @@ export class CircleOfCultistService {
730
726
protected addHideoutUpgradeRequirementsToRewardPool (
731
727
hideoutDbData : IHideout ,
732
728
pmcData : IPmcData ,
733
- itemRewardBlacklist : string [ ] ,
729
+ itemRewardBlacklist : Set < string > ,
734
730
rewardPool : Set < string > ,
735
731
) : void {
736
732
const dbAreas = hideoutDbData . areas ;
@@ -746,7 +742,7 @@ export class CircleOfCultistService {
746
742
const itemRequirements = this . getItemRequirements ( nextStageDbData . requirements ) ;
747
743
for ( const rewardToAdd of itemRequirements ) {
748
744
if (
749
- itemRewardBlacklist . includes ( rewardToAdd . templateId ) ||
745
+ itemRewardBlacklist . has ( rewardToAdd . templateId ) ||
750
746
! this . itemHelper . isValidItem ( rewardToAdd . templateId )
751
747
) {
752
748
// Dont reward items sacrificed
@@ -779,14 +775,12 @@ export class CircleOfCultistService {
779
775
* Get array of random reward items
780
776
* @param rewardPool Reward pool to add to
781
777
* @param itemRewardBlacklist Item tpls to ignore
782
- * @param itemBaseTypeBlacklist Item base types to ignore
783
778
* @param itemsShouldBeHighValue Should these items meet the valuable threshold
784
779
* @returns Set of item tpls
785
780
*/
786
781
protected generateRandomisedItemsAndAddToRewardPool (
787
782
rewardPool : Set < string > ,
788
- itemRewardBlacklist : string [ ] ,
789
- itemBaseTypeBlacklist : string [ ] ,
783
+ itemRewardBlacklist : Set < string > ,
790
784
itemsShouldBeHighValue : boolean ,
791
785
) : Set < string > {
792
786
const allItems = this . itemHelper . getItems ( ) ;
@@ -799,16 +793,7 @@ export class CircleOfCultistService {
799
793
) {
800
794
attempts ++ ;
801
795
const randomItem = this . randomUtil . getArrayValue ( allItems ) ;
802
- if (
803
- itemRewardBlacklist . includes ( randomItem . _id ) ||
804
- itemRewardBlacklist . includes ( randomItem . _parent ) ||
805
- ! this . itemHelper . isValidItem ( randomItem . _id )
806
- ) {
807
- continue ;
808
- }
809
-
810
- // Item has a blacklisted type, skip
811
- if ( this . itemHelper . isOfBaseclasses ( randomItem . _parent , itemBaseTypeBlacklist ) ) {
796
+ if ( itemRewardBlacklist . has ( randomItem . _id ) || ! this . itemHelper . isValidItem ( randomItem . _id ) ) {
812
797
continue ;
813
798
}
814
799
0 commit comments