From 3d09fd78983baf4200495b01c9a4000cc432fc77 Mon Sep 17 00:00:00 2001 From: "Kyle J. Kemp" Date: Wed, 2 Oct 2024 12:08:11 -0500 Subject: [PATCH] fix autogenerated content to start at the first level for the trait, rather than 5 --- src/app/helpers/autocontent/traitscrolls.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/helpers/autocontent/traitscrolls.ts b/src/app/helpers/autocontent/traitscrolls.ts index 3efb4ec..c885ae3 100644 --- a/src/app/helpers/autocontent/traitscrolls.ts +++ b/src/app/helpers/autocontent/traitscrolls.ts @@ -25,6 +25,8 @@ export function generateTraitScrolls(mod: IModKit): IItemDefinition[] { const banned = ['Unimbued']; + const firstLevelFound: Record = {}; + mod.stems.forEach((stem) => { if (!stem._hasTrait) return; @@ -49,7 +51,7 @@ export function generateTraitScrolls(mod: IModKit): IItemDefinition[] { const tree = classTree.data.trees[treeName].tree; - tree.forEach(({ traits }: any) => { + tree.forEach(({ traits }: any, row: number) => { traits.forEach(({ name, maxLevel }: any) => { if (!name) return; if (maxLevel <= 1) { @@ -61,6 +63,11 @@ export function generateTraitScrolls(mod: IModKit): IItemDefinition[] { allRuneScrolls.add(name as string); + const levelRequirement = row * 10; + firstLevelFound[name] = firstLevelFound[name] + ? Math.min(levelRequirement, firstLevelFound[name]) + : levelRequirement; + if (classTree.name !== 'Core' && treeName !== 'Core') { scrollToClass[name].push(classTree.name); } @@ -86,7 +93,7 @@ export function generateTraitScrolls(mod: IModKit): IItemDefinition[] { restrict: scrollToClass[scrollName], }, requirements: { - level: 5 + (i - 1) * 10, + level: (firstLevelFound[scrollName] ?? 0) + i * 5, }, value: 1, itemClass: ItemClass.Scroll,