Skip to content

Commit ee07bd8

Browse files
author
Chomp
committed
Revert "Better handle cultist rewards not fitting the container (#979)"
This reverts commit 8d05bf0, reversing changes made to d5ce6c4.
1 parent 8d05bf0 commit ee07bd8

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

project/src/services/CircleOfCultistService.ts

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class CircleOfCultistService {
124124
}
125125
}
126126

127-
let rewards = hasDirectReward
127+
const rewards = hasDirectReward
128128
? this.getDirectRewards(sessionId, directRewardSettings, cultistCircleStashId)
129129
: this.getRewardsWithinBudget(
130130
this.getCultistCircleRewardPool(sessionId, pmcData, craftingInfo, this.hideoutConfig.cultistCircle),
@@ -138,28 +138,27 @@ export class CircleOfCultistService {
138138

139139
// Ensure rewards fit into container
140140
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+
);
147145

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);
162157
}
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+
);
163162
}
164163

165164
return output;

0 commit comments

Comments
 (0)