Skip to content

Trinkets

getGoldenTrinketType(trinketType): TrinketType

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:42

Helper function to get the corresponding golden trinket type from a normal trinket type.

If the provided trinket type is already a golden trinket type, then the trinket type will be returned unmodified.

For example, passing TrinketType.SWALLOWED_PENNY would result in 32769, which is the value that corresponds to the golden trinket sub-type for Swallowed Penny.

TrinketType

TrinketType


getMysteriousPaperEffectForFrame(player, frameCount?): MysteriousPaperEffect | undefined

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:68

Helper function to get the current effect that the Mysterious Paper trinket is providing to the player. Returns undefined if the player does not have the Mysterious Paper trinket.

The Mysterious Paper trinket has four different effects:

  • The Polaroid (collectible)
  • The Negative (collectible)
  • A Missing Page (trinket)
  • Missing Poster (trinket)

It rotates between these four effects on every frame. Note that Mysterious Paper will cause the EntityPlayer.HasCollectible and EntityPlayer.HasTrinket methods to return true for the respective items on the particular frame, with the exception of the Missing Poster. (The player will never “have” the Missing Poster, even on the correct corresponding frame.)

EntityPlayer

The player to look at.

int

Optional. The frame count that corresponds to time the effect will be active. Default is the current frame.

MysteriousPaperEffect | undefined


getNormalTrinketType(trinketType): TrinketType

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:87

Helper function to get the corresponding normal trinket type from a golden trinket type.

If the provided trinket type is already a normal trinket type, then the trinket type will be returned unmodified.

TrinketType

TrinketType


getTrinketDescription(trinketType): string

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:99

Helper function to get the in-game description for a trinket. Returns “Unknown” if the provided trinket type was not valid.

This function works for both vanilla and modded trinkets.

TrinketType

string


getTrinketGfxFilename(trinketType): string

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:124

Helper function to get the path to a trinket PNG file. Returns the path to the question mark sprite (i.e. from Curse of the Blind) if the provided trinket type was not valid.

Note that this does not return the file name, but the full path to the trinket’s PNG file. The function is named “GfxFilename” to correspond to the associated ItemConfigItem.GfxFileName field.

TrinketType

string


getTrinketName(trinketType): string

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:141

Helper function to get the name of a trinket. Returns “Unknown” if the provided trinket type is not valid.

This function works for both vanilla and modded trinkets.

For example, getTrinketName(TrinketType.SWALLOWED_PENNY) would return “Swallowed Penny”.

TrinketType

string


isGoldenTrinketType(trinketType): boolean

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:157

TrinketType

boolean


isModdedTrinketType(trinketType): boolean

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:161

TrinketType

boolean


isValidTrinketType(trinketType): trinketType is TrinketType

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:165

int

trinketType is TrinketType


isVanillaTrinketType(trinketType): boolean

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:173

TrinketType

boolean


newTrinketSprite(trinketType): Sprite

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:181

Helper function to generate a new sprite based on a collectible. If the provided collectible type is invalid, a sprite with a Curse of the Blind question mark will be returned.

TrinketType

Sprite


setTrinketSprite(trinket, pngPath): void

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:207

Helper function to change the sprite of a trinket entity.

For more information about removing the trinket sprite, see the documentation for the “clearSprite” helper function.

EntityPickup

The trinket whose sprite you want to modify.

string | undefined

Equal to either the spritesheet path to load (e.g. “gfx/items/trinkets/trinket_001_swallowedpenny.png”) or undefined. If undefined, the sprite will be removed, making the trinket effectively invisible (except for the shadow underneath it).

void


trinketHasCacheFlag(trinketType, cacheFlag): boolean

Defined in: packages/isaacscript-common/src/functions/trinkets.ts:230

Helper function to check in the item config if a given trinket has a given cache flag.

TrinketType

CacheFlagValue

boolean