fix: ensure guild advertisments vendor always has its 5 offers
All checks were successful
Build / build (pull_request) Successful in 56s
Build / build (push) Successful in 1m56s

Because the per-bin limits are not respected right now, it's possible that some clan tiers simply don't have an offer some weeks.
This commit is contained in:
Sainan 2025-05-16 11:01:48 +02:00
parent 52c8802d57
commit e9dee4e09d

View File

@ -207,7 +207,12 @@ const generateVendorManifest = (vendorInfo: IGeneratableVendorInfo): IVendorMani
const rng = new SRng(mixSeeds(vendorSeed, cycleIndex)); const rng = new SRng(mixSeeds(vendorSeed, cycleIndex));
const manifest = ExportVendors[vendorInfo.TypeName]; const manifest = ExportVendors[vendorInfo.TypeName];
const offersToAdd = []; const offersToAdd = [];
if (manifest.numItems && !manifest.isOneBinPerCycle) { if (
manifest.numItems &&
(manifest.numItems.minValue != manifest.numItems.maxValue ||
manifest.items.length != manifest.numItems.minValue) &&
!manifest.isOneBinPerCycle
) {
const numItemsTarget = rng.randomInt(manifest.numItems.minValue, manifest.numItems.maxValue); const numItemsTarget = rng.randomInt(manifest.numItems.minValue, manifest.numItems.maxValue);
while (processed.ItemManifest.length + offersToAdd.length < numItemsTarget) { while (processed.ItemManifest.length + offersToAdd.length < numItemsTarget) {
// TODO: Consider per-bin item limits // TODO: Consider per-bin item limits