Skip to main content

Trinkets

Functions

getGoldenTrinketType

getGoldenTrinketType(trinketType): TrinketType

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.

Parameters

NameType
trinketTypeTrinketType

Returns

TrinketType

Defined in

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


getMysteriousPaperEffectForFrame

getMysteriousPaperEffectForFrame(player, frameCount?): MysteriousPaperEffect | undefined

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.)

Parameters

NameTypeDescription
playerEntityPlayerThe player to look at.
frameCount?intOptional. The frame count that corresponds to time the effect will be active. Default is the current frame.

Returns

MysteriousPaperEffect | undefined

Defined in

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


getNormalTrinketType

getNormalTrinketType(trinketType): TrinketType

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.

Parameters

NameType
trinketTypeTrinketType

Returns

TrinketType

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:89


getTrinketDescription

getTrinketDescription(trinketType): string

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.

Parameters

NameType
trinketTypeTrinketType

Returns

string

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:101


getTrinketGfxFilename

getTrinketGfxFilename(trinketType): string

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.

Parameters

NameType
trinketTypeTrinketType

Returns

string

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:127


getTrinketName

getTrinketName(trinketType): string

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".

Parameters

NameType
trinketTypeTrinketType

Returns

string

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:144


isGoldenTrinketType

isGoldenTrinketType(trinketType): boolean

Parameters

NameType
trinketTypeTrinketType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:160


isModdedTrinketType

isModdedTrinketType(trinketType): boolean

Parameters

NameType
trinketTypeTrinketType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:164


isValidTrinketType

isValidTrinketType(trinketType): trinketType is TrinketType

Parameters

NameType
trinketTypeint

Returns

trinketType is TrinketType

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:168


isVanillaTrinketType

isVanillaTrinketType(trinketType): boolean

Parameters

NameType
trinketTypeTrinketType

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:176


newTrinketSprite

newTrinketSprite(trinketType): Sprite

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.

Parameters

NameType
trinketTypeTrinketType

Returns

Sprite

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:184


setTrinketSprite

setTrinketSprite(trinket, pngPath): void

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.

Parameters

NameTypeDescription
trinketEntityPickupThe trinket whose sprite you want to modify.
pngPathundefined | stringEqual 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).

Returns

void

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:210


trinketHasCacheFlag

trinketHasCacheFlag(trinketType, cacheFlag): boolean

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

Parameters

NameType
trinketTypeTrinketType
cacheFlagCacheFlagValue

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/trinkets.ts:233