Skip to main content
The Deno 2 Release Candidate is here
Learn more
class ItemBaseClassService
Re-export
import { ItemBaseClassService } from "https://deno.land/x/sptaki@1.2.0/services/mod.ts";

Cache the baseids for each item in the tiems db inside a dictionary

Constructors

new
ItemBaseClassService(
logger: ILogger,
localisationService: LocalisationService,
databaseServer: DatabaseServer,
)

Properties

private
cachedItemIsOfItemType

Check if cached item template is of type Item

protected
cacheGenerated: boolean
protected
databaseServer: DatabaseServer
protected
itemBaseClassesCache: Record<string, string[]>
protected
items: Record<string, ITemplateItem>
protected
localisationService: LocalisationService
protected
logger: ILogger

Methods

protected
addBaseItems(itemIdToUpdate: string, item: ITemplateItem): void

Helper method, recursivly iterate through items parent items, finding and adding ids to dictionary

getItemBaseClasses(itemTpl: string): string[]

Get base classes item inherits from

Create cache and store inside ItemBaseClassService Store a dict of an items tpl to the base classes it and its parents have

itemHasBaseClass(itemTpl: string, baseClasses: string[]): boolean

Does item tpl inherit from the requested base class