Fix slots based background logic
This commit is contained in:
parent
948f63c111
commit
5b68c471e9
@ -46,7 +46,7 @@
|
|||||||
"description": "Backpacks",
|
"description": "Backpacks",
|
||||||
"id": "5b5f6f6c86f774093f2ecf0b",
|
"id": "5b5f6f6c86f774093f2ecf0b",
|
||||||
"forceCustomBackgroundColours": true,
|
"forceCustomBackgroundColours": true,
|
||||||
"useSlotsBasedBackgroundColours": false
|
"useSlotsBasedBackgroundColours": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Facecovers",
|
"description": "Facecovers",
|
||||||
@ -66,7 +66,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Tactical rigs",
|
"description": "Tactical rigs",
|
||||||
"id": "5b5f6f8786f77447ed563642"
|
"id": "5b5f6f8786f77447ed563642",
|
||||||
|
"useSlotsBasedBackgroundColours": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "Visors",
|
"description": "Visors",
|
||||||
|
@ -105,7 +105,7 @@
|
|||||||
{
|
{
|
||||||
"minValue": 40,
|
"minValue": 40,
|
||||||
"maxValue": 999,
|
"maxValue": 999,
|
||||||
"colour": "purple"
|
"colour": "violet"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
10
src/mod.ts
10
src/mod.ts
@ -37,7 +37,7 @@ class EyesOfATraderMod implements IPostDBLoadMod {
|
|||||||
private modName = "[Eyes of a Trader]";
|
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.
|
// 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 {
|
public postDBLoad(container: DependencyContainer): void {
|
||||||
this.container = container;
|
this.container = container;
|
||||||
@ -67,7 +67,7 @@ class EyesOfATraderMod implements IPostDBLoadMod {
|
|||||||
const isValidItem = itemProps.Name && itemProps.Name !== "Dog tag" && !itemProps.QuestItem;
|
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!
|
// 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) {
|
if (categoryConfig && isValidItem) {
|
||||||
const pricing = new Pricing(
|
const pricing = new Pricing(
|
||||||
@ -102,10 +102,10 @@ class EyesOfATraderMod implements IPostDBLoadMod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private cacheEnabledCategories(handbookCategories: Category[]): void {
|
private cacheEnabledCategories(handbookCategories: Category[]): void {
|
||||||
if (this.enabledCategories.length === 0) {
|
if (this.categoryConfigs.length === 0) {
|
||||||
categoryConfig.enabledCategories.forEach((categoryConfig: CategoryConfig) => {
|
categoryConfig.enabledCategories.forEach((categoryConfig: CategoryConfig) => {
|
||||||
// We gotta add the parent categories first
|
// We gotta add the parent categories first
|
||||||
this.enabledCategories.push(categoryConfig);
|
this.categoryConfigs.push(categoryConfig);
|
||||||
|
|
||||||
this.addSubCategoriesRecursively(handbookCategories, categoryConfig)
|
this.addSubCategoriesRecursively(handbookCategories, categoryConfig)
|
||||||
});
|
});
|
||||||
@ -121,7 +121,7 @@ class EyesOfATraderMod implements IPostDBLoadMod {
|
|||||||
forceCustomBackgroundColours: categoryConfig.forceCustomBackgroundColours,
|
forceCustomBackgroundColours: categoryConfig.forceCustomBackgroundColours,
|
||||||
useSlotsBasedBackgroundColours: categoryConfig.useSlotsBasedBackgroundColours
|
useSlotsBasedBackgroundColours: categoryConfig.useSlotsBasedBackgroundColours
|
||||||
}));
|
}));
|
||||||
this.enabledCategories = this.enabledCategories.concat(subCategoryConfigs);
|
this.categoryConfigs = this.categoryConfigs.concat(subCategoryConfigs);
|
||||||
|
|
||||||
subCategoryConfigs.forEach(categoryConfig => this.addSubCategoriesRecursively(allCategories, categoryConfig));
|
subCategoryConfigs.forEach(categoryConfig => this.addSubCategoriesRecursively(allCategories, categoryConfig));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user