isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
91 lines • 4.69 kB
TypeScript
import type { CacheFlag } from "isaac-typescript-definitions";
import { TrinketType } from "isaac-typescript-definitions";
import { MysteriousPaperEffect } from "../enums/MysteriousPaperEffect";
/**
* 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.
*/
export declare function getGoldenTrinketType(trinketType: TrinketType): TrinketType;
/**
* 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.)
*
* @param player The player to look at.
* @param frameCount Optional. The frame count that corresponds to time the effect will be active.
* Default is the current frame.
*/
export declare function getMysteriousPaperEffectForFrame(player: EntityPlayer, frameCount?: int): MysteriousPaperEffect | undefined;
/**
* 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.
*/
export declare function getNormalTrinketType(trinketType: TrinketType): TrinketType;
/**
* 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.
*/
export declare function getTrinketDescription(trinketType: 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.
*/
export declare function getTrinketGfxFilename(trinketType: 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".
*/
export declare function getTrinketName(trinketType: TrinketType): string;
export declare function isGoldenTrinketType(trinketType: TrinketType): boolean;
export declare function isModdedTrinketType(trinketType: TrinketType): boolean;
export declare function isValidTrinketType(trinketType: int): trinketType is TrinketType;
export declare function isVanillaTrinketType(trinketType: TrinketType): boolean;
/**
* 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.
*/
export declare function newTrinketSprite(trinketType: TrinketType): Sprite;
/**
* 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.
*
* @param trinket The trinket whose sprite you want to modify.
* @param pngPath 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).
*/
export declare function setTrinketSprite(trinket: EntityPickup, pngPath: string | undefined): void;
/** Helper function to check in the item config if a given trinket has a given cache flag. */
export declare function trinketHasCacheFlag(trinketType: TrinketType, cacheFlag: CacheFlag): boolean;
//# sourceMappingURL=trinkets.d.ts.map