Skip to main content
Deno 2 is finally here 🎉️
Learn more
class CustomItemService
import { CustomItemService } from "https://deno.land/x/sptaki@1.2.0/services/mod/mod.ts";

Constructors

new
CustomItemService(
logger: ILogger,
hashUtil: HashUtil,
jsonUtil: JsonUtil,
databaseServer: DatabaseServer,
itemHelper: ItemHelper,
itemBaseClassService: ItemBaseClassService,
)

Properties

protected
databaseServer: DatabaseServer
protected
hashUtil: HashUtil
protected
itemBaseClassService: ItemBaseClassService
protected
itemHelper: ItemHelper
protected
jsonUtil: JsonUtil
protected
logger: ILogger
protected
tables: IDatabaseTables

Methods

protected
addToFleaPriceDb(newItemId: string, fleaPriceRoubles: number): void

Add a price to the in-memory representation of prices.json, used to inform the flea of an items price on the market

protected
addToHandbookDb(
newItemId: string,
parentId: string,
priceRoubles: number,
): void

Add a handbook price for an item

protected
addToItemsDb(newItemId: string, itemToAdd: ITemplateItem): void

Addd a new item object to the in-memory representation of items.json

protected
addToLocaleDbs(localeDetails: Record<string, LocaleDetails>, newItemId: string): void

Iterate through the passed in locale data and add to each locale in turn If data is not provided for each langauge eft uses, the first object will be used in its place e.g. en[0] fr[1]

No jp provided, so english will be used as a substitute

protected
addToWeaponShelf(newItemId: string): void

Add a weapon to the hideout weapon shelf whitelist

protected
getOrGenerateIdForItem(newId: string): string

If the id provided is an empty string, return a randomly generated guid, otherwise return the newId parameter

protected
updateBaseItemPropertiesWithOverrides(overrideProperties: Props, itemClone: ITemplateItem): void

Iterates through supplied properties and updates the cloned items properties with them Complex objects cannot have overrides, they must be fully hydrated with values if they are to be used

addCustomWeaponToPMCs(
weaponTpl: string,
weaponWeight: number,
weaponSlot: string,
): void

Add a custom weapon to PMCs loadout

Create a new item without using an existing item as a template Add to the items db Add to the flea market Add to the handbook Add to the locales

Create a new item from a cloned item base WARNING - If no item id is supplied, an id will be generated, this id will be random every time you add an item and will not be the same on each subsequent server start Add to the items db Add to the flea market Add to the handbook Add to the locales