Skip to content

Commit

Permalink
fix autogenerated content to start at the first level for the trait, …
Browse files Browse the repository at this point in the history
…rather than 5
  • Loading branch information
seiyria committed Oct 2, 2024
1 parent 846691d commit 3d09fd7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/helpers/autocontent/traitscrolls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export function generateTraitScrolls(mod: IModKit): IItemDefinition[] {

const banned = ['Unimbued'];

const firstLevelFound: Record<string, number> = {};

mod.stems.forEach((stem) => {
if (!stem._hasTrait) return;

Expand All @@ -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) {
Expand All @@ -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);
}
Expand All @@ -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,
Expand Down

0 comments on commit 3d09fd7

Please sign in to comment.