@@ -124,7 +124,7 @@ export class CircleOfCultistService {
124
124
}
125
125
}
126
126
127
- let rewards = hasDirectReward
127
+ const rewards = hasDirectReward
128
128
? this . getDirectRewards ( sessionId , directRewardSettings , cultistCircleStashId )
129
129
: this . getRewardsWithinBudget (
130
130
this . getCultistCircleRewardPool ( sessionId , pmcData , craftingInfo , this . hideoutConfig . cultistCircle ) ,
@@ -138,28 +138,27 @@ export class CircleOfCultistService {
138
138
139
139
// Ensure rewards fit into container
140
140
const containerGrid = this . inventoryHelper . getContainerSlotMap ( cultistStashDbItem [ 1 ] . _id ) ;
141
- let canAddToContainer = false ;
142
- while ( ! canAddToContainer && rewards . length > 0 ) {
143
- canAddToContainer = this . inventoryHelper . canPlaceItemsInContainer (
144
- this . cloner . clone ( containerGrid ) , // MUST clone grid before passing in as function modifies grid
145
- rewards ,
146
- ) ;
141
+ const canAddToContainer = this . inventoryHelper . canPlaceItemsInContainer (
142
+ this . cloner . clone ( containerGrid ) , // MUST clone grid before passing in as function modifies grid
143
+ rewards ,
144
+ ) ;
147
145
148
- if ( canAddToContainer ) {
149
- for ( const itemToAdd of rewards ) {
150
- this . inventoryHelper . placeItemInContainer (
151
- containerGrid ,
152
- itemToAdd ,
153
- cultistCircleStashId ,
154
- CircleOfCultistService . circleOfCultistSlotId ,
155
- ) ;
156
- // Add item + mods to output and profile inventory
157
- output . profileChanges [ sessionId ] . items . new . push ( ...itemToAdd ) ;
158
- pmcData . Inventory . items . push ( ...itemToAdd ) ;
159
- }
160
- } else {
161
- rewards . pop ( ) ;
146
+ if ( canAddToContainer ) {
147
+ for ( const itemToAdd of rewards ) {
148
+ this . inventoryHelper . placeItemInContainer (
149
+ containerGrid ,
150
+ itemToAdd ,
151
+ cultistCircleStashId ,
152
+ CircleOfCultistService . circleOfCultistSlotId ,
153
+ ) ;
154
+ // Add item + mods to output and profile inventory
155
+ output . profileChanges [ sessionId ] . items . new . push ( ...itemToAdd ) ;
156
+ pmcData . Inventory . items . push ( ...itemToAdd ) ;
162
157
}
158
+ } else {
159
+ this . logger . error (
160
+ `Unable to fit all: ${ rewards . length } reward items into sacrifice grid, nothing will be returned (rewards so valuable cultists stole it)` ,
161
+ ) ;
163
162
}
164
163
165
164
return output ;
0 commit comments