Constructs a PItem instance from an optional IPItem object, at a specified level.
If obj, or any of its required fields are undefined, the default value of each property's type
will be used to construct the object.
if upgradeLevel is undefined, the constructed instance will have a currentUpgradeLevel of 0.
Optionalobj: Partial<IPItem>
Data to construct the object from.
OptionalupgradeLevel: number
The upgrade level to set for the constructed instance.
// Default instance
new PItem()
// From partial data
new PItem({ name: { ja: "Hello" } })
// From JSON data returned by an API
const res = await fetch(...)
const data = new PItem(await res.json())
// From JSON data returned by an API, at a specified level
const res = await fetch(...)
const data = new PItem(await res.json(), 1)
StaticfromConstructs a PItem instance from a DBPItem object by rehydrating missing fields using populate methods, at a specified training & potential level.
if upgradeLevel is undefined, the constructed instance will have a currentUpgradeLevel of 0.
Data to construct the object from.
Methods used to rehydrate fields overridden by DBPItem.
OptionalupgradeLevel: number
The upgrade level to set for the constructed instance.
// From JSON data returned by a document store repository
const res = await collection.findOne({ ... })
const data = await PItem.fromDB(res, { ... })
// From JSON data returned by a document store repository, at a specified level
const res = await collection.findOne({ ... })
const data = await PItem.fromDB(res, { ... }, 1)
Returns a deep copy of this instance.
StaticdecodeStaticencodeSet the upgrade level of this P-Idol instance, up to its maximum upgrade level.
Returns the document-store representation of this object.
Unlike toJSON(), the resulting document-store representation may be in a significantly different
shape to that of its implementing class, and it cannot be passed back into the constructor to
reconstruct an equivalent instance.
Use fromDB() instead, which reconstructs the instance and rehydrates any fields truncated by the conversion.
Returns the JSON-serializable representation of this object.
The result can be passed back into the constructor to reconstruct an equivalent instance.
ProtectedtoSerializes the properties of this base class to an object.
Concrete subclasses should spread the result into their own toDB() implementations.
ProtectedtoSerializes the properties of this base class to an object.
Concrete subclasses should spread the result into their own toJSON() implementations.
The unique reference to this object in persistent storage.
The name of the P-Item, suffixed with one '+' per upgrade level.
The URL to the main visual asset (image) of the P-Item.
The time the object was created, as an ISO 8601 (RFC 3339) timestamp.
The effects this P-Item instance has (including any level upgrades).
The current upgrade level of this P-Item instance.
An ID associated with the object.
Protected StaticindexAn auto-incremented index to keep object IDs unique during runtime.
The effects of the P-Item, at upgrade level 0 (unupgraded). Use PItem.currentEffect for the effects including any level upgrades.
The name of the P-Item.
The produce plan(s) the P-Item can be used on.
The rarity of the P-Item.
Static ReadonlysortableThe source of the P-Item.
The produce level at which the P-Item is unlocked at.
This field exists to match the in-game data format, however as of update v3.3.0 of the game, all P-Items
have an unlock level of 0.
The time the object was last updated, as an ISO 8601 (RFC 3339) timestamp.
A list of upgrade level effects for the P-Item. Use upgradeLevels.length for its maximum upgrade level.
A P-Item / produce item (Pアイテム).
These are items that can be obtained throughout the duration of a produce run that provide effects to both the produce run itself, as well as during lesson/audition gameplay sectors (e.g. "あの日の約束" / "The promise of that day", "ピッグドリーム貯金箱" / "Piggybank of Big Dreams", "「Pっち」" / "'P-cchi'", etc.).
See PItemFilter for the list of filtering options.
See IPItem for the list of fields that can be used for sorting.