taulukko-common-scripts-dnd5ed 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ export declare class CacheReturnControl<K, V> {
2
+ private readonly capacity;
3
+ private readonly _cache;
4
+ private readonly _indexKey;
5
+ private _firstIndex;
6
+ private _nextIndex;
7
+ constructor(capacity?: number);
8
+ add(key: K, value: V): void;
9
+ has(key: K): boolean;
10
+ get(key: K): V;
11
+ private cleanCacheLazy;
12
+ }
@@ -0,0 +1,7 @@
1
+ export { CacheReturnControl } from './cache-returns-control';
2
+ export { Button } from './npc/button';
3
+ export { NPC } from './npc/npc';
4
+ export { NPCDialog } from './npc/npc-dialog';
5
+ export { NPCPortraitDialog } from './npc/npc-portrait-dialog';
6
+ export { SubModuleBase } from './sub-module-base';
7
+ export { ModuleBase } from './module-base';
@@ -0,0 +1,8 @@
1
+ export declare abstract class ModuleBase {
2
+ #private;
3
+ isReady(): boolean;
4
+ init(): Promise<void>;
5
+ protected abstract initHooks(): void;
6
+ protected abstract waitReady(): Promise<void>;
7
+ whaitFor(test: () => boolean, timeout?: number, sleep?: number): Promise<void>;
8
+ }
@@ -0,0 +1,8 @@
1
+ export declare class Button {
2
+ action: string;
3
+ label: string;
4
+ defaultValue: boolean;
5
+ type: string;
6
+ callback: any;
7
+ constructor(action: string, label: string, defaultValue: boolean | undefined, type: string | undefined, callback: any);
8
+ }
@@ -0,0 +1,4 @@
1
+ export { Button } from './button';
2
+ export { NPC } from './npc';
3
+ export { NPCDialog } from './npc-dialog';
4
+ export { NPCPortraitDialog } from './npc-portrait-dialog';
@@ -0,0 +1,15 @@
1
+ import { SubModuleBase } from '../sub-module-base';
2
+ import { NPC } from './npc';
3
+ export declare class NPCDialog extends SubModuleBase {
4
+ #private;
5
+ npcSelected: NPC | any;
6
+ activeNPC: NPC | any;
7
+ npcs: Map<string, NPC>;
8
+ buttonloaded: boolean;
9
+ protected initHooks(): void;
10
+ protected waitReady(): Promise<void>;
11
+ addNPCButtons(controls: any): Promise<void>;
12
+ showNPCChooseDialog(): Promise<void>;
13
+ helpSubmit: string;
14
+ callNPC(npc: NPC): Promise<void>;
15
+ }
@@ -0,0 +1,29 @@
1
+ interface NPCPortraitOptions {
2
+ imageUrl: string;
3
+ npcName: string;
4
+ dialogText: string;
5
+ }
6
+ /**
7
+ * Classe customizada para exibir um retrato de NPC com diálogo
8
+ * Funciona como overlay modal sobre o jogo
9
+ */
10
+ export declare class NPCPortraitDialog extends Application {
11
+ imageUrl: string;
12
+ npcName: string;
13
+ dialogText: string;
14
+ constructor(options?: Partial<NPCPortraitOptions> & any);
15
+ static get defaultOptions(): any;
16
+ get template(): string;
17
+ getData(): Promise<NPCPortraitOptions>;
18
+ activateListeners(html: any): void;
19
+ static renderTalk(data: {
20
+ imageUrl: string;
21
+ npcName: string;
22
+ dialogText: string;
23
+ }): void;
24
+ /**
25
+ * Exibe o diálogo para todos os jogadores
26
+ */
27
+ showToAllPlayers(): Promise<void>;
28
+ }
29
+ export {};
@@ -0,0 +1,23 @@
1
+ export declare abstract class NPC {
2
+ readonly name: string;
3
+ readonly imageUrl: string;
4
+ readonly formatSound: string;
5
+ readonly DEFAULT_STYLE: string;
6
+ actor: any;
7
+ groups: Set<string>;
8
+ screens: any[];
9
+ abstract groupToLines: Map<string, string>;
10
+ abstract lines: any;
11
+ constructor(name: string, imageUrl: string, formatSound?: string);
12
+ whaitFor(test: () => boolean, timeout?: number, sleep?: number): Promise<unknown>;
13
+ init(): Promise<void>;
14
+ decrementGroup(): void;
15
+ getAlias(): string;
16
+ createDialog(title: string, content: string, options: Array<any>, submits: Array<any> | null): Promise<void>;
17
+ abstract startScreen(): Promise<void>;
18
+ getListLinesFromGroup(groupsUnordered: any): Promise<any>;
19
+ getCombinations(numbers: Array<number>, separator?: string): Promise<any[]>;
20
+ speak(lineIndex: number): Promise<void>;
21
+ private playSoundWithNoEffect;
22
+ send(removeLastGroup?: boolean): Promise<void>;
23
+ }
@@ -0,0 +1,9 @@
1
+ declare const FIX_NPCs = false;
2
+ declare const newImgPath = "modules/candlekeep-5ed/images/mobs";
3
+ /**
4
+ * Atualiza a URL base da imagem de todos os NPCs do mundo,
5
+ * mantendo o nome original do arquivo.
6
+ *
7
+ * @param {string} newBaseUrl - A nova base da URL (sem o nome do arquivo).
8
+ * */
9
+ declare function updateNpcImageBaseUrl(newBaseUrl: any): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import { ModuleBase } from './module-base';
2
+ export declare abstract class SubModuleBase extends ModuleBase {
3
+ }
@@ -0,0 +1,19 @@
1
+ import { ModuleBase } from './common/module-base';
2
+ export declare class CommonModule extends ModuleBase {
3
+ #private;
4
+ readonly name: string;
5
+ readonly version: string;
6
+ readonly startVersion: string;
7
+ addInitCommonAssetsChanges(): Promise<void>;
8
+ init(): Promise<void>;
9
+ private loadSubModules;
10
+ protected waitReady(): Promise<void>;
11
+ protected initHooks(): void;
12
+ addReadyCommonAssetsChanges(): Promise<void>;
13
+ registerSetting(key: string, type?: any): Promise<void>;
14
+ setSettings(key: string, value: any): Promise<void>;
15
+ getSettings(key: string): Promise<any>;
16
+ updateVersions(instalatedVersion: string, nextVersionUpdated: string): Promise<void>;
17
+ warnAboutUpdate(previousVersion: string, lastVersion: string): Promise<void>;
18
+ debug(debug: boolean | undefined): boolean;
19
+ }
@@ -0,0 +1,4 @@
1
+ export { DialogUtils, HeroPoints, HideUnidentify, PlayersTools, RegionUtils } from './submodules';
2
+ export { SocketLib, ChatSocket, DummySocket } from './sockets';
3
+ export type { Socket } from './sockets';
4
+ export { Button, NPC, NPCDialog, NPCPortraitDialog } from './common/npc';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function socketTest(): void;
@@ -0,0 +1,10 @@
1
+ export declare const CALLBACK_FUNCTION_EVENT_NAME: string;
2
+ export interface Socket {
3
+ isReady(): boolean;
4
+ executeToGM(eventName: string, ...data: any): Promise<any>;
5
+ executeAsGM(eventName: string, ...data: any): Promise<any>;
6
+ executeForAll(eventName: string, ...data: any): Promise<any>;
7
+ executeIn(eventName: string, users: Array<string>, ...data: any): Promise<any>;
8
+ register(eventName: string, callback: any): Promise<void>;
9
+ isReadyToSendToGM(): boolean;
10
+ }
@@ -0,0 +1,17 @@
1
+ import { Socket } from '../common-socket';
2
+ import { SubModuleBase } from '../../common/sub-module-base';
3
+ export declare class ChatSocket extends SubModuleBase implements Socket {
4
+ #private;
5
+ protected initHooks(): void;
6
+ protected waitReady(): Promise<undefined>;
7
+ private cleanupRealChatMessage;
8
+ private sendMessage;
9
+ executeToGM(eventName: string, ...data: any): Promise<any>;
10
+ executeForAll(eventName: string, ...data: any): Promise<any>;
11
+ executeIn(eventName: string, users: Array<string>, ...data: any): Promise<any>;
12
+ executeAsGM(eventName: string, ...data: any): Promise<any>;
13
+ isReadyToSendToGM(): boolean;
14
+ register(eventName: string, callback: any): Promise<void>;
15
+ get originalSocket(): any;
16
+ }
17
+ export declare const chatSocketImplementation: Socket;
@@ -0,0 +1,12 @@
1
+ import { SubModuleBase } from '../../common/sub-module-base';
2
+ import { Socket } from '../common-socket';
3
+ export declare class DummySocket extends SubModuleBase implements Socket {
4
+ protected initHooks(): void;
5
+ protected waitReady(): Promise<void>;
6
+ executeForAll(eventName: string, ...data: any): Promise<any>;
7
+ executeAsGM(eventName: string, ...data: any): Promise<any>;
8
+ executeToGM(eventName: string, ...data: any): Promise<any>;
9
+ executeIn(eventName: string, users: Array<string>, ...data: any): Promise<any>;
10
+ isReadyToSendToGM(): boolean;
11
+ register(eventName: string, callback: any): Promise<void>;
12
+ }
@@ -0,0 +1,15 @@
1
+ import { Socket } from '../common-socket';
2
+ import { SubModuleBase } from '../../common/sub-module-base';
3
+ export declare class SocketLib extends SubModuleBase implements Socket {
4
+ private _socketOriginal;
5
+ private _requirementModules;
6
+ protected initHooks(): void;
7
+ protected waitReady(): Promise<void>;
8
+ executeForAll(eventName: string, ...data: any): Promise<any>;
9
+ executeAsGM(eventName: string, ...data: any): Promise<any>;
10
+ executeToGM(eventName: string, ...data: any): Promise<any>;
11
+ executeIn(eventName: string, users: Array<string>, ...data: any): Promise<any>;
12
+ isReadyToSendToGM(): boolean;
13
+ register(eventName: string, callback: any): Promise<void>;
14
+ get originalSocket(): any;
15
+ }
@@ -0,0 +1,4 @@
1
+ export type { Socket } from './common-socket';
2
+ export { DummySocket } from './implementations/common-socket-dummy';
3
+ export { ChatSocket } from './implementations/common-socket-chatmessage';
4
+ export { SocketLib } from './implementations/common-socket-socketlib';
@@ -0,0 +1,13 @@
1
+ import { Button } from '../../common/npc/button';
2
+ import { SubModuleBase } from '../../common/sub-module-base';
3
+ import { NPC } from '../../common/npc/npc';
4
+ import { NPCDialog } from '../../common/npc/npc-dialog';
5
+ export declare class DialogUtils extends SubModuleBase {
6
+ #private;
7
+ readonly npctype: typeof NPC;
8
+ readonly NPC_DIALOG: NPCDialog;
9
+ protected waitReady(): Promise<void>;
10
+ protected initHooks(): void;
11
+ createButton(action: string, label: string, defaultValue?: boolean, type?: string, callback?: any): Button;
12
+ createDialog(title: string, style?: string, content?: string, buttons?: Array<any>, submit?: Array<any>, left?: undefined | number, top?: undefined | number, width?: number | "auto", height?: number | "auto"): foundry.applications.api.DialogV2;
13
+ }
@@ -0,0 +1,11 @@
1
+ import { SubModuleBase } from '../../common/sub-module-base';
2
+ export declare class HeroPoints extends SubModuleBase {
3
+ #private;
4
+ protected initHooks(): void;
5
+ protected waitReady(): Promise<void>;
6
+ removeAttribute(sheet: Sheet): void;
7
+ addEditButtonsToHeroPoints(parent: HTMLElement): void;
8
+ createDialog(element: HTMLElement): void;
9
+ changeHabilityHonrrorToHeroPoints(sheet: Sheet): void;
10
+ initializeHabilityHero(): void;
11
+ }
@@ -0,0 +1,8 @@
1
+ import { SubModuleBase } from '../../common/sub-module-base';
2
+ export declare class HideUnidentify extends SubModuleBase {
3
+ #private;
4
+ protected waitReady(): Promise<void>;
5
+ protected initHooks(): void;
6
+ removeButtonsFromItemContext(item: any, buttons: Array<any>): void;
7
+ removeItemSheetIdentifyInformations(sheet: any, option: any | undefined): void;
8
+ }
@@ -0,0 +1,5 @@
1
+ export { DialogUtils } from './dialog-utils/dialog-utils';
2
+ export { HeroPoints } from './hero-points/hero-points';
3
+ export { HideUnidentify } from './hide-unindentify/hide-unidentify';
4
+ export { PlayersTools } from './playertools/players-tool';
5
+ export { RegionUtils } from './region-utils/region-utils';
@@ -0,0 +1,7 @@
1
+ import { SubModuleBase } from '../../common/sub-module-base';
2
+ export declare class PlayersTools extends SubModuleBase {
3
+ #private;
4
+ protected initHooks(): void;
5
+ protected waitReady(): Promise<void>;
6
+ initializeFlyMeasure(): void;
7
+ }
@@ -0,0 +1,10 @@
1
+ import { SubModuleBase } from '../../common/sub-module-base';
2
+ export declare class RegionUtils extends SubModuleBase {
3
+ #private;
4
+ protected initHooks(): void;
5
+ protected waitReady(): Promise<void>;
6
+ sendMessageToChat(senderid: string, message: string): void;
7
+ stop(event: any): void;
8
+ toggleVisibilityRegions(): void;
9
+ registerKeybindings(): void;
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taulukko-common-scripts-dnd5ed",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Taulukko Common Scripts for Foundry dnd5ed",
5
5
  "main": "dist/taulukko-common-scripts-dnd5ed.iife.js",
6
6
  "scripts": {
@@ -8,7 +8,12 @@
8
8
  "build": "tsc && vite build",
9
9
  "vite-version": "vite --version"
10
10
  },
11
- "keywords": ["foundry", "dnd5e", "common-scripts", "utilities"],
11
+ "keywords": [
12
+ "foundry",
13
+ "dnd5e",
14
+ "common-scripts",
15
+ "utilities"
16
+ ],
12
17
  "types": "./dist/index.d.ts",
13
18
  "files": [
14
19
  "dist/**/*"
@@ -20,6 +25,7 @@
20
25
  "vite": "^7.3.0"
21
26
  },
22
27
  "dependencies": {
23
- "taulukko-commons": "^1.3.0"
28
+ "taulukko-commons": "^1.3.0",
29
+ "vite-plugin-dts": "^4.5.4"
24
30
  }
25
31
  }