打断async function, event.forceFinish
This commit is contained in:
parent
91edb35780
commit
7a88752da4
|
@ -15,7 +15,7 @@ export class Game {
|
||||||
* @type { { [key: string]: Player } }
|
* @type { { [key: string]: Player } }
|
||||||
*/
|
*/
|
||||||
playerMap: {
|
playerMap: {
|
||||||
[key: string]: import("noname-typings/nonameModules/noname/library/element/player.js").Player;
|
[key: string]: Player;
|
||||||
};
|
};
|
||||||
phaseNumber: number;
|
phaseNumber: number;
|
||||||
roundNumber: number;
|
roundNumber: number;
|
||||||
|
@ -354,7 +354,7 @@ export class Game {
|
||||||
* @param { ...Parameters<typeof lib.message.client[T]> } args
|
* @param { ...Parameters<typeof lib.message.client[T]> } args
|
||||||
* @returns { void }
|
* @returns { void }
|
||||||
*/
|
*/
|
||||||
broadcast<T_6 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_6, ...args: Parameters<{
|
broadcast<T_6 extends "cancel" | "onclose" | "init" | "log" | "reinit" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_6, ...args: Parameters<{
|
||||||
log: (arr: any) => void;
|
log: (arr: any) => void;
|
||||||
opened: () => void;
|
opened: () => void;
|
||||||
onconnection: (id: any) => void;
|
onconnection: (id: any) => void;
|
||||||
|
@ -386,7 +386,7 @@ export class Game {
|
||||||
* @param { ...T } args
|
* @param { ...T } args
|
||||||
* @returns { void }
|
* @returns { void }
|
||||||
*/
|
*/
|
||||||
broadcast<T_6 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_6) => void, ...args: T_6): void;
|
broadcast<T_6 extends "cancel" | "onclose" | "init" | "log" | "reinit" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_6) => void, ...args: T_6): void;
|
||||||
/**
|
/**
|
||||||
* @template { keyof typeof lib.message.client } T
|
* @template { keyof typeof lib.message.client } T
|
||||||
* @overload
|
* @overload
|
||||||
|
@ -394,7 +394,7 @@ export class Game {
|
||||||
* @param { ...Parameters<typeof lib.message.client[T]> } args
|
* @param { ...Parameters<typeof lib.message.client[T]> } args
|
||||||
* @returns { void }
|
* @returns { void }
|
||||||
*/
|
*/
|
||||||
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_7, ...args: Parameters<{
|
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "log" | "reinit" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: T_7, ...args: Parameters<{
|
||||||
log: (arr: any) => void;
|
log: (arr: any) => void;
|
||||||
opened: () => void;
|
opened: () => void;
|
||||||
onconnection: (id: any) => void;
|
onconnection: (id: any) => void;
|
||||||
|
@ -426,7 +426,7 @@ export class Game {
|
||||||
* @param { ...T } args
|
* @param { ...T } args
|
||||||
* @returns { void }
|
* @returns { void }
|
||||||
*/
|
*/
|
||||||
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "reinit" | "log" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_7) => void, ...args: T_7): void;
|
broadcastAll<T_7 extends "cancel" | "onclose" | "init" | "log" | "reinit" | "opened" | "onconnection" | "onmessage" | "selfclose" | "reloadroom" | "createroom" | "enterroomfailed" | "roomlist" | "updaterooms" | "updateclients" | "updateevents" | "eventsdenied" | "exec" | "denied" | "closeDialog" | "createDialog" | "gameStart" | "updateWaiting">(func: (...args: T_7) => void, ...args: T_7): void;
|
||||||
syncState(): void;
|
syncState(): void;
|
||||||
updateWaiting(): void;
|
updateWaiting(): void;
|
||||||
/**
|
/**
|
||||||
|
@ -652,47 +652,47 @@ export class Game {
|
||||||
* 下载文件
|
* 下载文件
|
||||||
* @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void) }
|
* @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void) }
|
||||||
*/
|
*/
|
||||||
download: (url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void;
|
download: undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void);
|
||||||
/**
|
/**
|
||||||
* 读取文件为arraybuffer
|
* 读取文件为arraybuffer
|
||||||
* @type { undefined | ((filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void) }
|
* @type { undefined | ((filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void) }
|
||||||
*/
|
*/
|
||||||
readFile: (filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void;
|
readFile: undefined | ((filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void);
|
||||||
/**
|
/**
|
||||||
* 读取文件为文本
|
* 读取文件为文本
|
||||||
* @type { undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void) }
|
* @type { undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void) }
|
||||||
*/
|
*/
|
||||||
readFileAsText: (filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void;
|
readFileAsText: undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void);
|
||||||
/**
|
/**
|
||||||
* 将数据写入文件
|
* 将数据写入文件
|
||||||
* @type { undefined | ((data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void) }
|
* @type { undefined | ((data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void) }
|
||||||
*/
|
*/
|
||||||
writeFile: (data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void;
|
writeFile: undefined | ((data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void);
|
||||||
/**
|
/**
|
||||||
* 移除文件
|
* 移除文件
|
||||||
* @type { undefined | ((filename: string, callback?: (e: Error) => void) => void) }
|
* @type { undefined | ((filename: string, callback?: (e: Error) => void) => void) }
|
||||||
*/
|
*/
|
||||||
removeFile: (filename: string, callback?: (e: Error) => void) => void;
|
removeFile: undefined | ((filename: string, callback?: (e: Error) => void) => void);
|
||||||
/**
|
/**
|
||||||
* 获取文件列表
|
* 获取文件列表
|
||||||
* @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void) }
|
* @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void) }
|
||||||
*/
|
*/
|
||||||
getFileList: (dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void;
|
getFileList: undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure?: (e: Error) => void) => void);
|
||||||
/**
|
/**
|
||||||
* 按路径依次创建文件夹
|
* 按路径依次创建文件夹
|
||||||
* @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) }
|
* @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) }
|
||||||
*/
|
*/
|
||||||
ensureDirectory: (list: string | string[], callback: Function, file?: boolean) => void;
|
ensureDirectory: undefined | ((list: string | string[], callback: Function, file?: boolean) => void);
|
||||||
/**
|
/**
|
||||||
* 创建文件夹
|
* 创建文件夹
|
||||||
* @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) }
|
* @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) }
|
||||||
*/
|
*/
|
||||||
createDir: (directory: string, successCallback?: Function, errorCallback?: Function) => void;
|
createDir: undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void);
|
||||||
/**
|
/**
|
||||||
* 删除文件夹
|
* 删除文件夹
|
||||||
* @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) }
|
* @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) }
|
||||||
*/
|
*/
|
||||||
removeDir: (directory: string, successCallback?: Function, errorCallback?: Function) => void;
|
removeDir: undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void);
|
||||||
/**
|
/**
|
||||||
* @type { (forcecheck?: boolean | null, dev?: boolean) => Promise<any> }
|
* @type { (forcecheck?: boolean | null, dev?: boolean) => Promise<any> }
|
||||||
*/
|
*/
|
||||||
|
@ -908,21 +908,21 @@ export class Game {
|
||||||
/**
|
/**
|
||||||
* @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path
|
* @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path
|
||||||
*/
|
*/
|
||||||
linexy(path: [number, string | number | {
|
linexy(path: [number, number | {
|
||||||
opacity: any;
|
opacity: any;
|
||||||
color: any;
|
color: any;
|
||||||
dashed: any;
|
dashed: any;
|
||||||
duration: any;
|
duration: any;
|
||||||
}, number, number], ...args: any[]): any;
|
} | string, number, number], ...args: any[]): any;
|
||||||
/**
|
/**
|
||||||
* @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path
|
* @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path
|
||||||
*/
|
*/
|
||||||
_linexy(path: [number, string | number | {
|
_linexy(path: [number, number | {
|
||||||
opacity: any;
|
opacity: any;
|
||||||
color: any;
|
color: any;
|
||||||
dashed: any;
|
dashed: any;
|
||||||
duration: any;
|
duration: any;
|
||||||
}, number, number], ...args: any[]): void;
|
} | string, number, number], ...args: any[]): void;
|
||||||
/**
|
/**
|
||||||
* @param { string } name
|
* @param { string } name
|
||||||
* @param { string } skill
|
* @param { string } skill
|
||||||
|
@ -957,15 +957,15 @@ export class Game {
|
||||||
* @param { string } [packagename]
|
* @param { string } [packagename]
|
||||||
*/
|
*/
|
||||||
addCharacterPack(pack: {
|
addCharacterPack(pack: {
|
||||||
[key: string]: any;
|
|
||||||
mode?: string;
|
mode?: string;
|
||||||
forbid?: any;
|
forbid?: any;
|
||||||
character: {
|
character: {
|
||||||
[key: string]: Character;
|
[key: string]: Character;
|
||||||
};
|
};
|
||||||
skill: {
|
skill: {
|
||||||
[key: string]: any;
|
[key: string]: object;
|
||||||
};
|
};
|
||||||
|
[key: string]: any;
|
||||||
}, packagename?: string): void;
|
}, packagename?: string): void;
|
||||||
/**
|
/**
|
||||||
* @param { string } name
|
* @param { string } name
|
||||||
|
@ -989,10 +989,10 @@ export class Game {
|
||||||
forbid?: string[];
|
forbid?: string[];
|
||||||
list: any[];
|
list: any[];
|
||||||
card: {
|
card: {
|
||||||
[key: string]: import("noname-typings/nonameModules/noname/library/element/card.js").Card;
|
[key: string]: Card;
|
||||||
};
|
};
|
||||||
skill: {
|
skill: {
|
||||||
[key: string]: any;
|
[key: string]: object;
|
||||||
};
|
};
|
||||||
}, packagename?: string): void;
|
}, packagename?: string): void;
|
||||||
/**
|
/**
|
||||||
|
@ -1004,7 +1004,7 @@ export class Game {
|
||||||
* @param { string } [abInfo]
|
* @param { string } [abInfo]
|
||||||
*/
|
*/
|
||||||
addSkill(name: string, info: {
|
addSkill(name: string, info: {
|
||||||
[key: string]: any;
|
[key: string]: object;
|
||||||
}, translate?: string, description?: string, appendInfo?: string, abInfo?: string): boolean;
|
}, translate?: string, description?: string, appendInfo?: string, abInfo?: string): boolean;
|
||||||
/**
|
/**
|
||||||
* @param { string } name
|
* @param { string } name
|
||||||
|
@ -1014,7 +1014,7 @@ export class Game {
|
||||||
addMode(name: string, info: any, info2: {
|
addMode(name: string, info: any, info2: {
|
||||||
translate: string;
|
translate: string;
|
||||||
config: {
|
config: {
|
||||||
[key: string]: any;
|
[key: string]: object;
|
||||||
};
|
};
|
||||||
}): void;
|
}): void;
|
||||||
/**
|
/**
|
||||||
|
@ -1456,4 +1456,3 @@ import { GamePromises } from "./promises.js";
|
||||||
import { DynamicStyle } from "./dynamic-style/index.js";
|
import { DynamicStyle } from "./dynamic-style/index.js";
|
||||||
import { lib } from "../library/index.js";
|
import { lib } from "../library/index.js";
|
||||||
import { Check } from "./check.js";
|
import { Check } from "./check.js";
|
||||||
import { delay } from "../util/index.js";
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ export class Get {
|
||||||
zhu(player: any, skill: any, group: any): any;
|
zhu(player: any, skill: any, group: any): any;
|
||||||
config(item: any, mode: any): any;
|
config(item: any, mode: any): any;
|
||||||
coinCoeff(list: any): number;
|
coinCoeff(list: any): number;
|
||||||
rank(name: any, num: any): number | "x" | "s" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
|
rank(name: any, num: any): number | "s" | "x" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
|
||||||
skillRank(skill: any, type: any, grouped: any): number;
|
skillRank(skill: any, type: any, grouped: any): number;
|
||||||
targetsInfo(targets: any): any[];
|
targetsInfo(targets: any): any[];
|
||||||
infoTargets(infos: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[];
|
infoTargets(infos: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[];
|
||||||
|
@ -408,7 +408,7 @@ export class Get {
|
||||||
event<T_2 extends keyof import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent>(key: T_2): import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent[T_2];
|
event<T_2 extends keyof import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent>(key: T_2): import("noname-typings/nonameModules/noname/library/element/gameEvent.js").GameEvent[T_2];
|
||||||
player(): import("noname-typings/nonameModules/noname/library/element/player.js").Player;
|
player(): import("noname-typings/nonameModules/noname/library/element/player.js").Player;
|
||||||
players(sort: any, dead: any, out: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[];
|
players(sort: any, dead: any, out: any): import("noname-typings/nonameModules/noname/library/element/player.js").Player[];
|
||||||
position(card: any, ordering: any): number | "x" | "s" | "e" | "j" | "h" | "c" | "d" | "o";
|
position(card: any, ordering: any): number | "h" | "e" | "j" | "s" | "x" | "c" | "d" | "o";
|
||||||
skillTranslation(str: any, player: any): string;
|
skillTranslation(str: any, player: any): string;
|
||||||
skillInfoTranslation(name: any, player: any): any;
|
skillInfoTranslation(name: any, player: any): any;
|
||||||
/**
|
/**
|
||||||
|
@ -428,12 +428,12 @@ export class Get {
|
||||||
* @param {((a: Button, b: Button) => number)} [sort] 排序函数
|
* @param {((a: Button, b: Button) => number)} [sort] 排序函数
|
||||||
* @returns { Button[] }
|
* @returns { Button[] }
|
||||||
*/
|
*/
|
||||||
selectableButtons(sort?: (a: Button, b: Button) => number): Button[];
|
selectableButtons(sort?: ((a: Button, b: Button) => number)): Button[];
|
||||||
/**
|
/**
|
||||||
* @param {((a: Card, b: Card) => number)} [sort] 排序函数
|
* @param {((a: Card, b: Card) => number)} [sort] 排序函数
|
||||||
* @returns { Card[] }
|
* @returns { Card[] }
|
||||||
*/
|
*/
|
||||||
selectableCards(sort?: (a: Card, b: Card) => number): Card[];
|
selectableCards(sort?: ((a: Card, b: Card) => number)): Card[];
|
||||||
/**
|
/**
|
||||||
* @returns { string[] } 技能名数组
|
* @returns { string[] } 技能名数组
|
||||||
*/
|
*/
|
||||||
|
@ -445,7 +445,7 @@ export class Get {
|
||||||
* @param {((a: Player, b: Player) => number)} [sort] 排序函数
|
* @param {((a: Player, b: Player) => number)} [sort] 排序函数
|
||||||
* @returns { Player[] }
|
* @returns { Player[] }
|
||||||
*/
|
*/
|
||||||
selectableTargets(sort?: (a: Player, b: Player) => number): Player[];
|
selectableTargets(sort?: ((a: Player, b: Player) => number)): Player[];
|
||||||
filter(filter: any, i: any): any;
|
filter(filter: any, i: any): any;
|
||||||
cardCount(card: any, player: any): any;
|
cardCount(card: any, player: any): any;
|
||||||
skillCount(skill: any, player: any): any;
|
skillCount(skill: any, player: any): any;
|
||||||
|
|
|
@ -8,5 +8,4 @@ export class GNC {
|
||||||
}
|
}
|
||||||
export let gnc: GNC;
|
export let gnc: GNC;
|
||||||
export function setGNC(instance?: InstanceType<typeof GNC>): void;
|
export function setGNC(instance?: InstanceType<typeof GNC>): void;
|
||||||
import { GeneratorFunction } from "../util/index.js";
|
|
||||||
import { Is } from "./is.js";
|
import { Is } from "./is.js";
|
||||||
|
|
2
node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts
generated
vendored
2
node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts
generated
vendored
|
@ -6,7 +6,7 @@ export class Button extends HTMLDivElement {
|
||||||
* @param {true} [noClick]
|
* @param {true} [noClick]
|
||||||
* @param { Button } [button]
|
* @param { Button } [button]
|
||||||
*/
|
*/
|
||||||
constructor(item: {}, type: "character" | "tdnodes" | "blank" | "card" | "vcard" | "characterx" | "player" | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button);
|
constructor(item: {}, type: keyof typeof ui.create.buttonPresets | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button);
|
||||||
/**
|
/**
|
||||||
* @type { string | undefined }
|
* @type { string | undefined }
|
||||||
*/
|
*/
|
||||||
|
|
13
node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts
generated
vendored
13
node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts
generated
vendored
|
@ -37,7 +37,11 @@ export class GameEvent {
|
||||||
/**
|
/**
|
||||||
* @type {null|((event: GameEvent | PromiseLike<GameEvent>)=>void)} 这个异步事件对应Promise的resolve函数
|
* @type {null|((event: GameEvent | PromiseLike<GameEvent>)=>void)} 这个异步事件对应Promise的resolve函数
|
||||||
**/
|
**/
|
||||||
resolve: (event: GameEvent | PromiseLike<GameEvent>) => void;
|
resolve: null | ((event: GameEvent | PromiseLike<GameEvent>) => void);
|
||||||
|
/**
|
||||||
|
* @type {null|((value: any) => void)} 另一种结束event.content的resolve形式
|
||||||
|
**/
|
||||||
|
resolveContent: null | ((value?: any) => void);
|
||||||
_triggered: number;
|
_triggered: number;
|
||||||
__args: any;
|
__args: any;
|
||||||
/**
|
/**
|
||||||
|
@ -212,7 +216,7 @@ export class GameEvent {
|
||||||
*/
|
*/
|
||||||
pushHandler(...handlers: ((event: GameEvent, option: {
|
pushHandler(...handlers: ((event: GameEvent, option: {
|
||||||
state?: 'begin' | 'end';
|
state?: 'begin' | 'end';
|
||||||
}) => void)[]): number;
|
}) => void)[][]): number;
|
||||||
/**
|
/**
|
||||||
* @overload
|
* @overload
|
||||||
* @param {Parameters<typeof this.hasHandler>[0]} type
|
* @param {Parameters<typeof this.hasHandler>[0]} type
|
||||||
|
@ -223,9 +227,10 @@ export class GameEvent {
|
||||||
*/
|
*/
|
||||||
pushHandler(type: Parameters<typeof this.hasHandler>[0], ...handlers: ((event: GameEvent, option: {
|
pushHandler(type: Parameters<typeof this.hasHandler>[0], ...handlers: ((event: GameEvent, option: {
|
||||||
state?: 'begin' | 'end';
|
state?: 'begin' | 'end';
|
||||||
}) => void)[]): number;
|
}) => void)[][]): number;
|
||||||
changeToZero(): this;
|
changeToZero(): this;
|
||||||
numFixed: boolean;
|
numFixed: boolean;
|
||||||
|
forceFinish(): this;
|
||||||
finish(): this;
|
finish(): this;
|
||||||
putStepCache(key: any, value: any): this;
|
putStepCache(key: any, value: any): this;
|
||||||
_stepCache: {};
|
_stepCache: {};
|
||||||
|
@ -269,7 +274,7 @@ export class GameEvent {
|
||||||
* @param {boolean} [includeSelf] 若level不是数字,指定搜索时是否包含事件本身
|
* @param {boolean} [includeSelf] 若level不是数字,指定搜索时是否包含事件本身
|
||||||
* @returns {GameEvent|{}|null}
|
* @returns {GameEvent|{}|null}
|
||||||
*/
|
*/
|
||||||
getParent(level?: string | number | ((evt: GameEvent) => boolean), forced?: boolean, includeSelf?: boolean): GameEvent | {} | null;
|
getParent(level?: number | string | ((evt: GameEvent) => boolean), forced?: boolean, includeSelf?: boolean): GameEvent | {} | null;
|
||||||
getTrigger(): any;
|
getTrigger(): any;
|
||||||
getRand(name: any): any;
|
getRand(name: any): any;
|
||||||
_rand_map: {};
|
_rand_map: {};
|
||||||
|
|
8
node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts
generated
vendored
8
node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts
generated
vendored
|
@ -330,7 +330,7 @@ export class Player extends HTMLDivElement {
|
||||||
* 检测此牌是否不计入手牌上限
|
* 检测此牌是否不计入手牌上限
|
||||||
* @param { Card } card
|
* @param { Card } card
|
||||||
*/
|
*/
|
||||||
canIgnoreHandcard(card: Card): boolean;
|
canIgnoreHandcard(card: Card): any;
|
||||||
/**
|
/**
|
||||||
* Gift
|
* Gift
|
||||||
*
|
*
|
||||||
|
@ -347,7 +347,7 @@ export class Player extends HTMLDivElement {
|
||||||
* @param { Player } target
|
* @param { Player } target
|
||||||
* @param { boolean } [strict]
|
* @param { boolean } [strict]
|
||||||
*/
|
*/
|
||||||
canGift(card: Card, target: Player, strict?: boolean): boolean;
|
canGift(card: Card, target: Player, strict?: boolean): any;
|
||||||
/**
|
/**
|
||||||
* Check if the player refuses gifts
|
* Check if the player refuses gifts
|
||||||
*
|
*
|
||||||
|
@ -384,7 +384,7 @@ export class Player extends HTMLDivElement {
|
||||||
* @param { Player } [source]
|
* @param { Player } [source]
|
||||||
* @param { boolean } [strict]
|
* @param { boolean } [strict]
|
||||||
*/
|
*/
|
||||||
canRecast(card: Card, source?: Player, strict?: boolean): boolean;
|
canRecast(card: Card, source?: Player, strict?: boolean): any;
|
||||||
/**
|
/**
|
||||||
* 判断一名角色的某个区域是否被废除
|
* 判断一名角色的某个区域是否被废除
|
||||||
*
|
*
|
||||||
|
@ -833,7 +833,7 @@ export class Player extends HTMLDivElement {
|
||||||
* @param {Parameters<this['iterableGetCards']>[0]} arg1
|
* @param {Parameters<this['iterableGetCards']>[0]} arg1
|
||||||
* @param {Parameters<this['iterableGetCards']>[1]} arg2
|
* @param {Parameters<this['iterableGetCards']>[1]} arg2
|
||||||
*/
|
*/
|
||||||
iterableGetGainableCards(player: [card?: any, player?: any, target?: any, event?: any][1], arg1: Parameters<this['iterableGetCards']>[0], arg2: Parameters<this['iterableGetCards']>[1]): Generator<any, void, unknown>;
|
iterableGetGainableCards(player: Parameters<import("../index.js").Library['filter']['canBeGained']>[1], arg1: Parameters<this['iterableGetCards']>[0], arg2: Parameters<this['iterableGetCards']>[1]): Generator<any, void, unknown>;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {Parameters<this['iterableGetGainableCards']>[0]} player
|
* @param {Parameters<this['iterableGetGainableCards']>[0]} player
|
||||||
|
|
|
@ -4185,94 +4185,7 @@ export class Library {
|
||||||
fullimage: boolean;
|
fullimage: boolean;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
filter: {
|
filter: any;
|
||||||
all: () => boolean;
|
|
||||||
none: () => boolean;
|
|
||||||
/**
|
|
||||||
* Check if the card does not count toward the player's hand limit
|
|
||||||
*
|
|
||||||
* 检测此牌是否不计入此角色的手牌上限
|
|
||||||
* @param { Card } card
|
|
||||||
* @param { Player } player
|
|
||||||
* @returns { boolean }
|
|
||||||
*/
|
|
||||||
ignoredHandcard: (card: Card, player: Player) => boolean;
|
|
||||||
/**
|
|
||||||
* Check if the card is giftable
|
|
||||||
*
|
|
||||||
* 检测此牌是否可赠予
|
|
||||||
* @param { Card } card
|
|
||||||
* @param { Player } player
|
|
||||||
* @param { Player } target
|
|
||||||
* @param { boolean } [strict]
|
|
||||||
*/
|
|
||||||
cardGiftable: (card: Card, player: Player, target: Player, strict?: boolean) => boolean;
|
|
||||||
/**
|
|
||||||
* Check if the card is recastable
|
|
||||||
*
|
|
||||||
* 检查此牌是否可重铸
|
|
||||||
* @param { Card } card
|
|
||||||
* @param { Player } player
|
|
||||||
* @param { Player } [source]
|
|
||||||
* @param { boolean } [strict]
|
|
||||||
*/
|
|
||||||
cardRecastable: (card: Card, player?: Player, source?: Player, strict?: boolean) => boolean;
|
|
||||||
/**
|
|
||||||
* @param { Card } card
|
|
||||||
* @param { Player } player
|
|
||||||
* @returns { boolean }
|
|
||||||
*/
|
|
||||||
canBeReplaced: (card: Card, player: Player) => boolean;
|
|
||||||
buttonIncluded: (button: any) => boolean;
|
|
||||||
filterButton: (button: any) => boolean;
|
|
||||||
cardSavable: (card: any, player: any, target: any) => any;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {GameEvent} event
|
|
||||||
* @param {Player} player
|
|
||||||
* @param {string} triggername
|
|
||||||
* @param {string} skill
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
filterTrigger: (event: GameEvent, player: Player, triggername: string, skill: string, indexedData: any) => boolean;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {GameEvent} event
|
|
||||||
* @param {Player} player
|
|
||||||
* @param {string} skill
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
filterEnable: (event: GameEvent, player: Player, skill: string) => boolean;
|
|
||||||
characterDisabled: (i: any, libCharacter: any) => boolean;
|
|
||||||
characterDisabled2: (i: any) => boolean;
|
|
||||||
skillDisabled: (skill: any) => boolean;
|
|
||||||
cardEnabled: (card: any, player: any, event: any) => any;
|
|
||||||
cardRespondable: (card: any, player: any, event: any) => any;
|
|
||||||
cardUsable2: (card: any, player: any, event: any) => boolean;
|
|
||||||
cardUsable: (card: any, player: any, event: any) => boolean;
|
|
||||||
cardDiscardable: (card: any, player: any, event: any) => any;
|
|
||||||
canBeDiscarded: (card: any, player: any, target: any, event: any) => any;
|
|
||||||
canBeGained: (card: any, player: any, target: any, event: any) => any;
|
|
||||||
cardAiIncluded: (card: any) => boolean;
|
|
||||||
filterCard: (card: any, player: any, event: any) => boolean;
|
|
||||||
targetEnabledx: (card: any, player: any, target: any, ...args: any[]) => any;
|
|
||||||
targetEnabled: (card: any, player: any, target: any) => any;
|
|
||||||
targetEnabled2: (card: any, player: any, target: any) => boolean;
|
|
||||||
targetEnabled3: (card: any, player: any, target: any) => boolean;
|
|
||||||
targetInRange: (card: any, player: any, target: any) => any;
|
|
||||||
filterTarget: (card: any, player: any, target: any) => any;
|
|
||||||
filterTarget2: (card: any, player: any, target: any) => any;
|
|
||||||
notMe: (card: any, player: any, target: any) => boolean;
|
|
||||||
isMe: (card: any, player: any, target: any) => boolean;
|
|
||||||
attackFrom: (card: any, player: any, target: any) => boolean;
|
|
||||||
globalFrom: (card: any, player: any, target: any) => boolean;
|
|
||||||
selectCard: () => number[];
|
|
||||||
selectTarget: (card: any, player: any) => number | number[] | (() => number | Select);
|
|
||||||
judge: (card: any, player: any, target: any) => any;
|
|
||||||
autoRespondSha: () => boolean;
|
|
||||||
autoRespondShan: () => boolean;
|
|
||||||
wuxieSwap: (event: any) => boolean;
|
|
||||||
};
|
|
||||||
sort: {
|
sort: {
|
||||||
nature: (a: any, b: any) => number;
|
nature: (a: any, b: any) => number;
|
||||||
group: (a: any, b: any) => number;
|
group: (a: any, b: any) => number;
|
||||||
|
@ -4301,7 +4214,6 @@ export class Library {
|
||||||
* }}
|
* }}
|
||||||
*/
|
*/
|
||||||
skill: {
|
skill: {
|
||||||
[key: string]: Skill;
|
|
||||||
global: string[];
|
global: string[];
|
||||||
globalmap: SMap<Player[]>;
|
globalmap: SMap<Player[]>;
|
||||||
storage: SMap<any>;
|
storage: SMap<any>;
|
||||||
|
@ -4310,6 +4222,7 @@ export class Library {
|
||||||
zhu: SMap<any>;
|
zhu: SMap<any>;
|
||||||
zhuSkill: SMap<any>;
|
zhuSkill: SMap<any>;
|
||||||
land_used: SMap<any>;
|
land_used: SMap<any>;
|
||||||
|
[key: string]: Skill;
|
||||||
};
|
};
|
||||||
character: {};
|
character: {};
|
||||||
perfectPair: {};
|
perfectPair: {};
|
||||||
|
|
2
node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts
generated
vendored
2
node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts
generated
vendored
|
@ -55,6 +55,6 @@ export class LibInit {
|
||||||
* @param {boolean} [dbNow] - 此刻是否在解析数据库中的内容,请勿直接使用
|
* @param {boolean} [dbNow] - 此刻是否在解析数据库中的内容,请勿直接使用
|
||||||
* @returns {URL}
|
* @returns {URL}
|
||||||
*/
|
*/
|
||||||
parseResourceAddress(link: string | URL, defaultHandle?: (item: string) => string, loadAsDataUrlCallback?: (item: URL) => unknown, dbNow?: boolean): URL;
|
parseResourceAddress(link: string | URL, defaultHandle?: ((item: string) => string) | null, loadAsDataUrlCallback?: ((item: URL) => unknown) | null, dbNow?: boolean): URL;
|
||||||
}
|
}
|
||||||
import { LibInitPromises } from "./promises.js";
|
import { LibInitPromises } from "./promises.js";
|
||||||
|
|
4
node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts
generated
vendored
4
node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts
generated
vendored
|
@ -45,12 +45,12 @@ export class LibInitPromises {
|
||||||
* @param {boolean} [forceLoadAsDataUrl] - 是否将资源加载为[Data URL](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/Data_URLs),默认为`false`
|
* @param {boolean} [forceLoadAsDataUrl] - 是否将资源加载为[Data URL](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Basics_of_HTTP/Data_URLs),默认为`false`
|
||||||
* @returns {Promise<URL>}
|
* @returns {Promise<URL>}
|
||||||
*/
|
*/
|
||||||
parseResourceAddress(link: string | URL, defaultHandle?: (item: string) => string, forceLoadAsDataUrl?: boolean): Promise<URL>;
|
parseResourceAddress(link: string | URL, defaultHandle?: ((item: string) => string) | null, forceLoadAsDataUrl?: boolean): Promise<URL>;
|
||||||
/**
|
/**
|
||||||
* @async
|
* @async
|
||||||
* @param {string | URL} link - 需要解析的路径
|
* @param {string | URL} link - 需要解析的路径
|
||||||
* @param {((item: string) => string) | null} [defaultHandle] - 在给定路径不符合可用情况(或基于无名杀相关默认情况)时,处理路径的函数,返回的路径应是相对于根目录的相对路径,默认为`null`,当且仅当无法解析成`URL`时会调用该回调
|
* @param {((item: string) => string) | null} [defaultHandle] - 在给定路径不符合可用情况(或基于无名杀相关默认情况)时,处理路径的函数,返回的路径应是相对于根目录的相对路径,默认为`null`,当且仅当无法解析成`URL`时会调用该回调
|
||||||
* @returns {Promise<[origin: URL, data: URL]>}
|
* @returns {Promise<[origin: URL, data: URL]>}
|
||||||
*/
|
*/
|
||||||
parseResourceAddressExt(link: string | URL, defaultHandle?: (item: string) => string): Promise<[origin: URL, data: URL]>;
|
parseResourceAddressExt(link: string | URL, defaultHandle?: ((item: string) => string) | null): Promise<[origin: URL, data: URL]>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ export class status {
|
||||||
*/
|
*/
|
||||||
importing: {
|
importing: {
|
||||||
[key: string]: Promise<any>[];
|
[key: string]: Promise<any>[];
|
||||||
};
|
} | undefined;
|
||||||
/**
|
/**
|
||||||
* @type { Function | boolean | undefined }
|
* @type { Function | boolean | undefined }
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,4 +7,3 @@
|
||||||
*/
|
*/
|
||||||
export const promiseErrorHandlerMap: Record<"firefox" | "chrome" | "safari" | "other", new () => PromiseErrorHandler>;
|
export const promiseErrorHandlerMap: Record<"firefox" | "chrome" | "safari" | "other", new () => PromiseErrorHandler>;
|
||||||
export type PromiseErrorHandler = import('./struct/interface/promise-error-handler.js').PromiseErrorHandler;
|
export type PromiseErrorHandler = import('./struct/interface/promise-error-handler.js').PromiseErrorHandler;
|
||||||
import { PromiseErrorHandler } from "./struct/index.js";
|
|
||||||
|
|
|
@ -5996,14 +5996,15 @@ export class Game {
|
||||||
resolve();
|
resolve();
|
||||||
} else if (event.content instanceof AsyncFunction) {
|
} else if (event.content instanceof AsyncFunction) {
|
||||||
// _status,lib,game,ui,get,ai六个变量由game.import提供
|
// _status,lib,game,ui,get,ai六个变量由game.import提供
|
||||||
event.content(event, trigger, player).then(() => {
|
// 使用另一种方式来停止event.content
|
||||||
|
const { promise, resolve: resolveContent } = Promise.withResolvers();
|
||||||
|
promise.then(() => {
|
||||||
// 其实这个if几乎一定执行了
|
// 其实这个if几乎一定执行了
|
||||||
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
||||||
if (!game.executingAsyncEventMap.get(_status.event.toEvent())) {
|
if (!game.executingAsyncEventMap.get(_status.event.toEvent())) {
|
||||||
console.warn(`game.executingAsyncEventMap中包括了event,但不包括_status.event!`);
|
console.warn(`game.executingAsyncEventMap中包括了event,但不包括_status.event!`);
|
||||||
console.log("event :>> ", event.toEvent());
|
console.log("event :>> ", event.toEvent());
|
||||||
console.log("_status.event :>> ", _status.event.toEvent());
|
console.log("_status.event :>> ", _status.event.toEvent());
|
||||||
// debugger;
|
|
||||||
game.executingAsyncEventMap.set(
|
game.executingAsyncEventMap.set(
|
||||||
event.toEvent(),
|
event.toEvent(),
|
||||||
game.executingAsyncEventMap.get(event.toEvent()).then(() => {
|
game.executingAsyncEventMap.get(event.toEvent()).then(() => {
|
||||||
|
@ -6025,6 +6026,16 @@ export class Game {
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
event.resolveContent = resolveContent;
|
||||||
|
event.content(event, trigger, player)
|
||||||
|
.then(() => resolveContent())
|
||||||
|
.catch((error) => {
|
||||||
|
resolveContent();
|
||||||
|
//再抛出异常
|
||||||
|
if (error !== "event_finish") {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
event.content(event, step, source, player, target, targets, card, cards, skill, forced, num, trigger, result, _status, lib, game, ui, get, ai);
|
event.content(event, step, source, player, target, targets, card, cards, skill, forced, num, trigger, result, _status, lib, game, ui, get, ai);
|
||||||
resolve();
|
resolve();
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { game } from "../game/index.js";
|
||||||
import { _status } from "../status/index.js";
|
import { _status } from "../status/index.js";
|
||||||
import { ui } from "../ui/index.js";
|
import { ui } from "../ui/index.js";
|
||||||
import { gnc } from "../gnc/index.js";
|
import { gnc } from "../gnc/index.js";
|
||||||
import { userAgent, nonameInitialized } from "../util/index.js";
|
import { userAgent, nonameInitialized, AsyncFunction } from "../util/index.js";
|
||||||
import * as config from "../util/config.js";
|
import * as config from "../util/config.js";
|
||||||
import { promiseErrorHandlerMap } from "../util/browser.js";
|
import { promiseErrorHandlerMap } from "../util/browser.js";
|
||||||
import { importCardPack, importCharacterPack, importExtension, importMode } from "./import.js";
|
import { importCardPack, importCharacterPack, importExtension, importMode } from "./import.js";
|
||||||
|
@ -1140,7 +1140,7 @@ async function setOnError() {
|
||||||
game.print(str);
|
game.print(str);
|
||||||
if (promiseErrorHandler.onErrorFinish) promiseErrorHandler.onErrorFinish();
|
if (promiseErrorHandler.onErrorFinish) promiseErrorHandler.onErrorFinish();
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
if (!lib.config.errstop) {
|
if (!lib.config.errstop && (_status && _status.event && !(_status.event.content instanceof AsyncFunction))) {
|
||||||
_status.withError = true;
|
_status.withError = true;
|
||||||
game.loop();
|
game.loop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,10 @@ export class GameEvent {
|
||||||
* @type {null|((event: GameEvent | PromiseLike<GameEvent>)=>void)} 这个异步事件对应Promise的resolve函数
|
* @type {null|((event: GameEvent | PromiseLike<GameEvent>)=>void)} 这个异步事件对应Promise的resolve函数
|
||||||
**/
|
**/
|
||||||
this.resolve = null;
|
this.resolve = null;
|
||||||
|
/**
|
||||||
|
* @type {null|((value?: any) => void)} 另一种结束event.content的resolve形式
|
||||||
|
**/
|
||||||
|
this.resolveContent = null;
|
||||||
if (trigger !== false && !game.online) this._triggered = 0;
|
if (trigger !== false && !game.online) this._triggered = 0;
|
||||||
this.__args = [name, trigger];
|
this.__args = [name, trigger];
|
||||||
}
|
}
|
||||||
|
@ -298,6 +302,15 @@ export class GameEvent {
|
||||||
this.numFixed = true;
|
this.numFixed = true;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
forceFinish() {
|
||||||
|
if (!this.finished) {
|
||||||
|
this.finished = true;
|
||||||
|
if (this.content instanceof AsyncFunction) {
|
||||||
|
throw "event_finish";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
finish() {
|
finish() {
|
||||||
this.finished = true;
|
this.finished = true;
|
||||||
return this;
|
return this;
|
||||||
|
@ -352,7 +365,7 @@ export class GameEvent {
|
||||||
}
|
}
|
||||||
cancel(arg1, arg2, notrigger) {
|
cancel(arg1, arg2, notrigger) {
|
||||||
this.untrigger(arg1, arg2);
|
this.untrigger(arg1, arg2);
|
||||||
this.finish();
|
this.forceFinish();
|
||||||
if (notrigger != "notrigger") {
|
if (notrigger != "notrigger") {
|
||||||
if (this.player && lib.phaseName.includes(this.name))
|
if (this.player && lib.phaseName.includes(this.name))
|
||||||
this.player.getHistory("skipped").add(this.name);
|
this.player.getHistory("skipped").add(this.name);
|
||||||
|
|
|
@ -78,16 +78,39 @@ export class GameEventPromise extends Promise {
|
||||||
resolve();
|
resolve();
|
||||||
return eventPromise;
|
return eventPromise;
|
||||||
}
|
}
|
||||||
|
const oldEvent = _status.event;
|
||||||
if (_status.event != eventPromise) {
|
if (_status.event != eventPromise) {
|
||||||
eventPromise.parent = _status.event;
|
eventPromise.parent = _status.event;
|
||||||
_status.event = eventPromise;
|
_status.event = eventPromise;
|
||||||
game.getGlobalHistory("everything").push(eventPromise);
|
game.getGlobalHistory("everything").push(eventPromise);
|
||||||
}
|
}
|
||||||
return game.loop(eventPromise).then(() => {
|
|
||||||
// 有时候event.finished还是false
|
// 处理eventNeutralized反复横跳
|
||||||
return eventPromise;
|
if (!oldEvent.finished) {
|
||||||
});
|
return game.loop(eventPromise).then(() => {
|
||||||
|
// 有时候event.finished还是false
|
||||||
|
return eventPromise;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (eventPromise.name == "arrangeTrigger" &&
|
||||||
|
eventPromise.triggername == "eventNeutralized") {
|
||||||
|
return game.loop(eventPromise).then(() => {
|
||||||
|
// 有时候event.finished还是false
|
||||||
|
return eventPromise;
|
||||||
|
}).then(() => {
|
||||||
|
// 如果它终于不给我跳了
|
||||||
|
// 就给老子停
|
||||||
|
if (oldEvent.finished === true && oldEvent.resolveContent) {
|
||||||
|
oldEvent.resolveContent();
|
||||||
|
}
|
||||||
|
return eventPromise;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
console.log('不继续执行event', eventPromise.toEvent());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue