Creates a new item.
The initialization data for the item.
The pointer to the data of the item.
The pointer to the currency static class that the item is being run on.
The cost of items at a certain level.
Protected
currencyThe currency static class that the item is being run on.
The effect of the item. This runs when the item is bought, and instantly if runEffectInstantly
is true.
The ID of the item. Used to retrieve the item later.
The name of the item. Defaults to the ID.
The description of the item. Can be a string or a function that returns a string.
// A dynamic description that returns a string
const description = (a, b) => `This is a ${a} that returns a ${b}`;
// ... create item here (see currencyStatic.addUpgrade)
const item = currencyStatic.getUpgrade("itemID");
// Getter property
console.log(item.description); // "This is a undefined that returns a undefined"
// Getter function
console.log(item.descriptionFn("dynamic", "string")); // "This is a dynamic that returns a string"
The description of the item. Can be a string or a function that returns a string.
// A dynamic description that returns a string
const description = (a, b) => `This is a ${a} that returns a ${b}`;
// ... create item here (see currencyStatic.addUpgrade)
const item = currencyStatic.getUpgrade("itemID");
// Getter property
console.log(item.description); // "This is a undefined that returns a undefined"
// Getter function
console.log(item.descriptionFn("dynamic", "string")); // "This is a dynamic that returns a string"
Represents an item.