From 5b68c471e9c3afc22424d4e653eec9cfa21dda95 Mon Sep 17 00:00:00 2001 From: Platinum Date: Thu, 16 Feb 2023 20:58:11 +1100 Subject: [PATCH] Fix slots based background logic --- categories.json | 5 +++-- config.json | 2 +- src/mod.ts | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/categories.json b/categories.json index bbd3f2c..5df5cc5 100644 --- a/categories.json +++ b/categories.json @@ -46,7 +46,7 @@ "description": "Backpacks", "id": "5b5f6f6c86f774093f2ecf0b", "forceCustomBackgroundColours": true, - "useSlotsBasedBackgroundColours": false + "useSlotsBasedBackgroundColours": true }, { "description": "Facecovers", @@ -66,7 +66,8 @@ }, { "description": "Tactical rigs", - "id": "5b5f6f8786f77447ed563642" + "id": "5b5f6f8786f77447ed563642", + "useSlotsBasedBackgroundColours": false }, { "description": "Visors", diff --git a/config.json b/config.json index 1268f5e..2abf386 100644 --- a/config.json +++ b/config.json @@ -105,7 +105,7 @@ { "minValue": 40, "maxValue": 999, - "colour": "purple" + "colour": "violet" } ] } \ No newline at end of file diff --git a/src/mod.ts b/src/mod.ts index 711ffb2..323559b 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -37,7 +37,7 @@ class EyesOfATraderMod implements IPostDBLoadMod { private modName = "[Eyes of a Trader]"; // We want to cache all (sub)categories of the Handbook that we have enabled our mod for otherwise we'll recursively search thousands of times. - private enabledCategories: CategoryConfig[] = []; + private categoryConfigs: CategoryConfig[] = []; public postDBLoad(container: DependencyContainer): void { this.container = container; @@ -67,7 +67,7 @@ class EyesOfATraderMod implements IPostDBLoadMod { const isValidItem = itemProps.Name && itemProps.Name !== "Dog tag" && !itemProps.QuestItem; // If a categoryConfig exists for this handbook item, it means we want to display prices for this item! - const categoryConfig = this.enabledCategories.find(category => category.id === handbookItem.ParentId); + const categoryConfig = this.categoryConfigs.find(category => category.id === handbookItem.ParentId); if (categoryConfig && isValidItem) { const pricing = new Pricing( @@ -102,10 +102,10 @@ class EyesOfATraderMod implements IPostDBLoadMod { } private cacheEnabledCategories(handbookCategories: Category[]): void { - if (this.enabledCategories.length === 0) { + if (this.categoryConfigs.length === 0) { categoryConfig.enabledCategories.forEach((categoryConfig: CategoryConfig) => { // We gotta add the parent categories first - this.enabledCategories.push(categoryConfig); + this.categoryConfigs.push(categoryConfig); this.addSubCategoriesRecursively(handbookCategories, categoryConfig) }); @@ -121,7 +121,7 @@ class EyesOfATraderMod implements IPostDBLoadMod { forceCustomBackgroundColours: categoryConfig.forceCustomBackgroundColours, useSlotsBasedBackgroundColours: categoryConfig.useSlotsBasedBackgroundColours })); - this.enabledCategories = this.enabledCategories.concat(subCategoryConfigs); + this.categoryConfigs = this.categoryConfigs.concat(subCategoryConfigs); subCategoryConfigs.forEach(categoryConfig => this.addSubCategoriesRecursively(allCategories, categoryConfig)); }