ScavXpCounts/types/services/ItemBaseClassService.d.ts

47 lines
2.0 KiB
TypeScript
Raw Normal View History

2024-11-12 11:51:30 -07:00
import { ITemplateItem } from "@spt/models/eft/common/tables/ITemplateItem";
import { ILogger } from "@spt/models/spt/utils/ILogger";
import { DatabaseService } from "@spt/services/DatabaseService";
import { LocalisationService } from "@spt/services/LocalisationService";
2023-08-17 19:49:16 -06:00
/**
* Cache the baseids for each item in the tiems db inside a dictionary
*/
export declare class ItemBaseClassService {
protected logger: ILogger;
protected localisationService: LocalisationService;
2024-11-12 11:51:30 -07:00
protected databaseService: DatabaseService;
2023-08-17 19:49:16 -06:00
protected itemBaseClassesCache: Record<string, string[]>;
2024-11-12 11:51:30 -07:00
protected items: Record<string, ITemplateItem>;
2023-08-17 19:49:16 -06:00
protected cacheGenerated: boolean;
2024-11-12 11:51:30 -07:00
constructor(logger: ILogger, localisationService: LocalisationService, databaseService: DatabaseService);
2023-08-17 19:49:16 -06:00
/**
* Create cache and store inside ItemBaseClassService
* Store a dict of an items tpl to the base classes it and its parents have
*/
hydrateItemBaseClassCache(): void;
/**
* Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary
* @param itemIdToUpdate item tpl to store base ids against in dictionary
* @param item item being checked
*/
2024-11-12 11:51:30 -07:00
protected addBaseItems(itemIdToUpdate: string, item: ITemplateItem): void;
2023-08-17 19:49:16 -06:00
/**
* Does item tpl inherit from the requested base class
* @param itemTpl item to check base classes of
* @param baseClass base class to check for
* @returns true if item inherits from base class passed in
*/
itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean;
2024-11-12 11:51:30 -07:00
/**
* Check if cached item template is of type Item
* @param itemTemplateId item to check
* @returns true if item is of type Item
*/
private cachedItemIsOfItemType;
2023-08-17 19:49:16 -06:00
/**
* Get base classes item inherits from
* @param itemTpl item to get base classes for
* @returns array of base classes
*/
getItemBaseClasses(itemTpl: string): string[];
}