Comment improvement
This commit is contained in:
parent
a26ff26a4a
commit
ded7142774
@ -407,18 +407,24 @@ export class BotLootGenerator
|
|||||||
const addCurrency = this.randomUtil.getChance100(25);
|
const addCurrency = this.randomUtil.getChance100(25);
|
||||||
if (addCurrency)
|
if (addCurrency)
|
||||||
{
|
{
|
||||||
|
// Create the currency items we want to add to wallet
|
||||||
const itemsToAdd = this.createWalletLoot(newRootItemId);
|
const itemsToAdd = this.createWalletLoot(newRootItemId);
|
||||||
const stashFS2D = this.inventoryHelper.getContainerSlotMap(weightedItemTpl);
|
|
||||||
|
// Get the container grid for the wallet
|
||||||
|
const containerGrid = this.inventoryHelper.getContainerSlotMap(weightedItemTpl);
|
||||||
|
|
||||||
|
// Check if all the chosen currency items fit into wallet
|
||||||
const canAddToContainer = this.inventoryHelper.canPlaceItemsInContainer(
|
const canAddToContainer = this.inventoryHelper.canPlaceItemsInContainer(
|
||||||
this.jsonUtil.clone(stashFS2D),
|
this.jsonUtil.clone(containerGrid), // MUST clone grid before passing in as function modifies grid
|
||||||
itemsToAdd,
|
itemsToAdd,
|
||||||
);
|
);
|
||||||
if (canAddToContainer)
|
if (canAddToContainer)
|
||||||
{
|
{
|
||||||
|
// Add each currency to wallet
|
||||||
for (const itemToAdd of itemsToAdd)
|
for (const itemToAdd of itemsToAdd)
|
||||||
{
|
{
|
||||||
this.inventoryHelper.placeItemInContainer(
|
this.inventoryHelper.placeItemInContainer(
|
||||||
stashFS2D,
|
containerGrid,
|
||||||
itemToAdd,
|
itemToAdd,
|
||||||
itemWithChildrenToAdd[0]._id,
|
itemWithChildrenToAdd[0]._id,
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user