diff --git a/project/src/controllers/RagfairController.ts b/project/src/controllers/RagfairController.ts index f2966b62..6b13697b 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -499,7 +499,7 @@ export class RagfairController playerListedPriceInRub, qualityMultiplier, ); - offer.sellResult = this.ragfairSellHelper.rollForSale(sellChancePercent, itemsToListCount); + offer.sellResult = this.ragfairSellHelper.rollForSale(sellChancePercent, stackCountTotal); // Subtract flea market fee from stash if (this.ragfairConfig.sell.fees) @@ -614,7 +614,7 @@ export class RagfairController ); // Create array of sell times for items listed - offer.sellResult = this.ragfairSellHelper.rollForSale(sellChancePercent, itemsToListCount); + offer.sellResult = this.ragfairSellHelper.rollForSale(75, stackCountTotal); // Subtract flea market fee from stash if (this.ragfairConfig.sell.fees) @@ -729,7 +729,7 @@ export class RagfairController ); // Create array of sell times for items listed + sell all at once as its a pack - offer.sellResult = this.ragfairSellHelper.rollForSale(sellChancePercent, itemsToListCount, true); + offer.sellResult = this.ragfairSellHelper.rollForSale(sellChancePercent, stackCountTotal, true); // Subtract flea market fee from stash if (this.ragfairConfig.sell.fees) diff --git a/project/src/helpers/RagfairOfferHelper.ts b/project/src/helpers/RagfairOfferHelper.ts index 54ce71dc..7805d506 100644 --- a/project/src/helpers/RagfairOfferHelper.ts +++ b/project/src/helpers/RagfairOfferHelper.ts @@ -334,7 +334,7 @@ export class RagfairOfferHelper for (const offer of profileOffers.values()) { if (offer.sellResult?.length > 0 - && timestamp >= offer.sellResult[0].sellTime) + && timestamp >= offer.sellResult[0].sellTime) // Checks first item, first is spliced out of array after being processed { // Item sold let totalItemsCount = 1; @@ -353,7 +353,7 @@ export class RagfairOfferHelper ); this.completeOffer(sessionID, offer, boughtAmount); - offer.sellResult.splice(0, 1); + offer.sellResult.splice(0, 1); // Remove the sell result object now its been processed } } diff --git a/project/src/helpers/RagfairSellHelper.ts b/project/src/helpers/RagfairSellHelper.ts index c0870ae1..0364df32 100644 --- a/project/src/helpers/RagfairSellHelper.ts +++ b/project/src/helpers/RagfairSellHelper.ts @@ -119,15 +119,21 @@ export class RagfairSellHelper maximumTime = minimumTime + 5; } // Sell time will be random between min/max - sellTime += Math.floor(Math.random() * (maximumTime - minimumTime) + minimumTime); + let newSellTime = Math.floor(Math.random() * (maximumTime - minimumTime) + minimumTime); + if (newSellTime === 0) + { + // Ensure all sales dont occur the same exact time + newSellTime += 1; + } + sellTime += newSellTime; result.push({ sellTime: sellTime, amount: boughtAmount }); - this.logger.debug(`Offer will sell at: ${new Date(sellTime * 1000).toLocaleTimeString("en-US")}`); + this.logger.debug(`Offer will sell at: ${new Date(sellTime * 1000).toLocaleTimeString("en-US")}, bought: ${boughtAmount}`); } else { - this.logger.debug("Offer will not sell"); + this.logger.debug(`Offer rolled not to sell, item count: ${boughtAmount}`); } remainingCount -= boughtAmount;