Skip to content

Instantly share code, notes, and snippets.

@Spice-King
Created July 11, 2021 21:26
Show Gist options
  • Select an option

  • Save Spice-King/64d460ef6f4ef2024291f1d5eed62595 to your computer and use it in GitHub Desktop.

Select an option

Save Spice-King/64d460ef6f4ef2024291f1d5eed62595 to your computer and use it in GitHub Desktop.
Dice So Nice types, half done.
// Dice So Nice types
declare global {
interface Game {
dice3d?: {
/**
* Show the 3D Dice animation for the Roll made by the User.
*
* @param {Roll} roll an instance of Roll class to show 3D dice animation.
* @param {User} user the user who made the roll (game.user by default).
* @param {Boolean} synchronize if the animation needs to be shown to other players. Default: false
* @param {Array} whisper list of users or userId who can see the roll, set it to null if everyone can see. Default: null
* @param {Boolean} blind if the roll is blind for the current user. Default: false
* @param {String} A chatMessage ID to reveal when the roll ends. Default: null
* @param {Object} An object using the same data schema than ChatSpeakerData.
* Needed to hide NPCs roll when the GM enables this setting.
* @returns {Promise<boolean>} when resolved true if the animation was displayed, false if not.
*/
showForRoll(
roll: Roll,
user: User,
synchronize: boolean,
whisper: (User | string)[],
blind: boolean,
chatMessageId: string,
speaker: ChatSpeakerData
): Promise<boolean>;
/**
* Show the 3D Dice animation based on data configuration made by the User.
*
* @param data: data containing the formula and the result to show in the 3D animation.
* @param user: the user who made the roll (game.user by default).
* @param synchronize: if the animation needs to be shown to other players. Default: false
* @param whisper: list of users or userId who can see the roll, leave it empty if everyone can see.
* @param blind if the roll is blind for the current user
* @returns {Promise<boolean>} when resolved true if the animation was displayed, false if not.
*/
show(
data: DiceSoNice.RollNotation,
user: User,
synchronize: boolean,
whisper: (string | User)[],
blind: boolean
): Promise<boolean>;
/** Disable DSN chat hook */
messageHookDisabled: boolean;
};
}
}
declare global {
namespace DiceSoNice {
interface RollNotation {
throws: [];
dsnConfig: unknown;
}
}
namespace RollTerm {
interface Options {
/** Hide the die from animation in DSN */
hidden?: boolean;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment