Fix slots based background logic

This commit is contained in:
Platinum 2023-02-16 20:58:11 +11:00
parent 948f63c111
commit 5b68c471e9
3 changed files with 9 additions and 8 deletions

View File

@ -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",

View File

@ -105,7 +105,7 @@
{
"minValue": 40,
"maxValue": 999,
"colour": "purple"
"colour": "violet"
}
]
}

View File

@ -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));
}