类型提示

This commit is contained in:
nonameShijian 2024-05-21 11:15:04 +08:00
parent 0a72799c87
commit c1e496918c
9 changed files with 157 additions and 14 deletions

View File

@ -354,7 +354,7 @@ export class Game {
* @param { ...Parameters<typeof lib.message.client[T]> } args
* @returns { 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: T_6, ...args: Parameters<{
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<{
log: (arr: any) => void;
opened: () => void;
onconnection: (id: any) => void;
@ -386,7 +386,7 @@ export class Game {
* @param { ...T } args
* @returns { 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;
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;
/**
* @template { keyof typeof lib.message.client } T
* @overload
@ -394,7 +394,7 @@ export class Game {
* @param { ...Parameters<typeof lib.message.client[T]> } args
* @returns { 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: T_7, ...args: Parameters<{
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<{
log: (arr: any) => void;
opened: () => void;
onconnection: (id: any) => void;
@ -426,7 +426,7 @@ export class Game {
* @param { ...T } args
* @returns { 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;
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;
syncState(): void;
updateWaiting(): void;
/**

View File

@ -211,7 +211,7 @@ export class Get {
zhu(player: any, skill: any, group: any): any;
config(item: any, mode: any): any;
coinCoeff(list: any): number;
rank(name: any, num: any): number | "s" | "x" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
rank(name: any, num: any): number | "x" | "s" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
skillRank(skill: any, type: any, grouped: any): number;
targetsInfo(targets: any): any[];
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];
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[];
position(card: any, ordering: any): number | "h" | "e" | "j" | "s" | "x" | "c" | "d" | "o";
position(card: any, ordering: any): number | "x" | "s" | "e" | "j" | "h" | "c" | "d" | "o";
skillTranslation(str: any, player: any): string;
skillInfoTranslation(name: any, player: any): any;
/**

View File

@ -164,6 +164,22 @@ export class GameEvent {
* @type { string }
*/
triggername: string;
/**
* @type { ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll }
*/
content: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
/**
* @type { boolean }
*/
forceDie: boolean;
/**
* @type { Function | undefined }
*/
_oncancel: Function | undefined;
/**
* @type { boolean }
*/
includeOut: boolean;
/**
* @param {keyof this} key
* @param {number} [value]
@ -234,7 +250,6 @@ export class GameEvent {
}) => void)[][]): number;
changeToZero(): this;
numFixed: boolean;
forceFinish(): this;
finish(): this;
putStepCache(key: any, value: any): this;
_stepCache: {};
@ -258,7 +273,6 @@ export class GameEvent {
* @param {ArrayLike<Function> | Function | keyof typeof lib.element.content} item
*/
setContent(item: ArrayLike<Function> | Function | keyof typeof lib.element.content): this;
content: ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll;
/**
*
* @param {Function | keyof typeof lib.element.contents} contents

View File

@ -202,6 +202,10 @@ export class Player extends HTMLDivElement {
* @type { boolean | undefined }
*/
identityShown: boolean | undefined;
/**
* @type { boolean }
*/
removed: boolean;
/**
*
* @param { number } amount
@ -330,7 +334,7 @@ export class Player extends HTMLDivElement {
*
* @param { Card } card
*/
canIgnoreHandcard(card: Card): any;
canIgnoreHandcard(card: Card): boolean;
/**
* Gift
*
@ -347,7 +351,7 @@ export class Player extends HTMLDivElement {
* @param { Player } target
* @param { boolean } [strict]
*/
canGift(card: Card, target: Player, strict?: boolean): any;
canGift(card: Card, target: Player, strict?: boolean): boolean;
/**
* Check if the player refuses gifts
*
@ -384,7 +388,7 @@ export class Player extends HTMLDivElement {
* @param { Player } [source]
* @param { boolean } [strict]
*/
canRecast(card: Card, source?: Player, strict?: boolean): any;
canRecast(card: Card, source?: Player, strict?: boolean): boolean;
/**
*
*
@ -826,14 +830,20 @@ export class Player extends HTMLDivElement {
* @returns { Card[] }
*/
getCards(arg1?: string, arg2?: string | Record<string, any> | ((card: Card) => boolean)): Card[];
/**
* @param { Player } player
* @param { string } [arg1]
* @param { string } [arg2]
* @returns { Generator<Card, void, unknown> }
*/
iterableGetDiscardableCards(player: Player, arg1?: string, arg2?: string): Generator<Card, void, unknown>;
getDiscardableCards(player: any, arg1: any, arg2: any): any[];
getDiscardableCards(player: any, arg1: any, arg2: any): import("noname-typings/nonameModules/noname/library/element/card.js").Card[];
/**
* @param {Parameters<lib['filter']['canBeGained']>[1]} player
* @param {Parameters<this['iterableGetCards']>[0]} arg1
* @param {Parameters<this['iterableGetCards']>[1]} arg2
*/
iterableGetGainableCards(player: Parameters<import("../index.js").Library['filter']['canBeGained']>[1], arg1: Parameters<this['iterableGetCards']>[0], arg2: Parameters<this['iterableGetCards']>[1]): Generator<any, void, unknown>;
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>;
/**
*
* @param {Parameters<this['iterableGetGainableCards']>[0]} player

View File

@ -4185,7 +4185,94 @@ export class Library {
fullimage: boolean;
};
};
filter: any;
filter: {
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: {
nature: (a: any, b: any) => number;
group: (a: any, b: any) => number;

View File

@ -67,6 +67,14 @@ export class status {
* @type { Function | boolean | undefined }
*/
new_tutorial: Function | boolean | undefined;
/**
* @type { Player | undefined }
*/
roundStart: Player | undefined;
/**
* @type { boolean }
*/
roundSkipped: boolean;
}
export let _status: status;
export function setStatus(instance?: InstanceType<typeof status>): void;

View File

@ -200,6 +200,18 @@ export class GameEvent {
* @type { ContentFuncByAll | GeneratorContentFuncByAll | OldContentFuncByAll }
*/
content;
/**
* @type { boolean }
*/
forceDie;
/**
* @type { Function | undefined }
*/
_oncancel;
/**
* @type { boolean }
*/
includeOut;
/**
* @param {keyof this} key
* @param {number} [value]

View File

@ -357,6 +357,10 @@ export class Player extends HTMLDivElement {
* @type { boolean | undefined }
*/
identityShown;
/**
* @type { boolean }
*/
removed;
//新函数
/**
* 怒气

View File

@ -76,6 +76,14 @@ export class status {
* @type { Function | boolean | undefined }
*/
new_tutorial = undefined;
/**
* @type { Player | undefined }
*/
roundStart = undefined;
/**
* @type { boolean }
*/
roundSkipped;
}
export let _status = new status();