diff --git a/node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts b/node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts index 83b5c8a9a..5caf2e315 100644 --- a/node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/game/codemirror.d.ts @@ -1,2 +1,5 @@ -import codemirror from 'codemirror/index'; -export = codemirror; +export default CodeMirror; +/** + * @type { typeof import('codemirror/index') } + */ +declare var CodeMirror: typeof import('codemirror/index'); diff --git a/node_modules/@types/noname-typings/nonameModules/game/jszip.d.ts b/node_modules/@types/noname-typings/nonameModules/game/jszip.d.ts deleted file mode 100644 index cd478141f..000000000 --- a/node_modules/@types/noname-typings/nonameModules/game/jszip.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import * as jszip from 'jszip' -export = jszip; \ No newline at end of file diff --git a/node_modules/@types/noname-typings/nonameModules/noname.d.ts b/node_modules/@types/noname-typings/nonameModules/noname.d.ts index b13e2d614..24d68dcae 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname.d.ts @@ -1,8 +1,8 @@ -export { GNC as gnc } from "./noname/gnc/index.js"; -export { AI as ai } from "./noname/ai/index.js"; -export { Game as game } from "./noname/game/index.js"; -export { Get as get } from "./noname/get/index.js"; -export { Library as lib } from "./noname/library/index.js"; -export { status as _status } from "./noname/status/index.js"; -export { UI as ui } from "./noname/ui/index.js"; -export { boot } from "./noname/init/index.js"; +export { GNC, gnc, setGNC } from './noname/gnc/index.js'; +export { AI, ai, setAI } from './noname/ai/index.js'; +export { Game, game, setGame } from './noname/game/index.js'; +export { Get, get, setGet } from './noname/get/index.js'; +export { Library, lib, setLibrary } from './noname/library/index.js'; +export { status, _status, setStatus } from './noname/status/index.js'; +export { UI, ui, setUI } from './noname/ui/index.js'; +export { boot } from './noname/init/index.js'; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts index 40dc8f424..3195ed436 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ai/basic.d.ts @@ -1,11 +1,11 @@ -export class Basic extends Uninstantable { +export class Basic { /** * @param { ( * button: Button, * buttons?: Button[] * ) => number } check */ - static chooseButton(check: (button: Button, buttons?: Button[]) => number): boolean; + chooseButton(check: (button: any, buttons?: Button[]) => number): boolean | undefined; /** * @param { ( * card?: Card, @@ -13,13 +13,12 @@ export class Basic extends Uninstantable { * ) => number } check * @returns { boolean | undefined } */ - static chooseCard(check: (card?: Card, cards?: Card[]) => number): boolean | undefined; + chooseCard(check: (card?: any, cards?: Card[]) => number): boolean | undefined; /** * @param { ( * target?: Player, * targets?: Player[] * ) => number } check */ - static chooseTarget(check: (target?: Player, targets?: Player[]) => number): boolean; + chooseTarget(check: (target?: any, targets?: Player[]) => number): boolean | undefined; } -import { Uninstantable } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts index 038a291c6..a5e8109d6 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ai/index.d.ts @@ -1,9 +1,8 @@ -export class AI extends Uninstantable { - static basic: typeof Basic; - static get: typeof get; +export class AI { + basic: Basic; + get: import("../get/index.js").Get; } -export const ai: typeof AI; +export let ai: AI; +export function setAI(instance?: AI | undefined): void; export { Basic }; -import { Uninstantable } from "../util/index.js"; import { Basic } from './basic.js'; -import { Get as get } from '../get/index.js'; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/check.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/check.d.ts new file mode 100644 index 000000000..cf0668041 --- /dev/null +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/check.d.ts @@ -0,0 +1,26 @@ +export class Check { + processSelection({ type, items, event, useCache, isSelectable }: { + type: any; + items: any; + event: any; + useCache: any; + isSelectable: any; + }): { + ok: boolean; + auto: boolean | undefined; + }; + button(event: any, useCache: any): { + ok: boolean; + auto: boolean | undefined; + }; + card(event: any, useCache: any): { + ok: boolean; + auto: boolean | undefined; + }; + target(event: any, useCache: any): { + ok: boolean; + auto: boolean | undefined; + }; + skill(event: any): void; + confirm(event: any, confirm: any): void; +} diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts index 64e1ceb64..46cb93dc8 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/dynamic-style/index.d.ts @@ -37,7 +37,7 @@ export class DynamicStyle { */ get(name: string): { [x: string]: string | number; - }; + } | null; /** * Callback of `DynamicStyle#find`, getting the rule wanted. * `DynamicStyle#find`的回调函数,用于获取符合要求的规则 diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts index f1902d74d..1b1d03e9b 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/index.d.ts @@ -1,39 +1,39 @@ -export class Game extends Uninstantable { - static online: boolean; - static onlineID: any; - static onlineKey: any; +export class Game { + online: boolean; + onlineID: null; + onlineKey: null; /** * @type {Player[]} */ - static players: Player[]; + players: Player[]; /** * @type {Player[]} */ - static dead: Player[]; - static imported: any[]; + dead: Player[]; + imported: any[]; /** * @type { { [key: string]: Player } } */ - static playerMap: { - [key: string]: import("../library/element/player.js").Player; + playerMap: { + [key: string]: any; }; - static phaseNumber: number; - static roundNumber: number; - static shuffleNumber: number; - static promises: typeof GamePromises; + phaseNumber: number; + roundNumber: number; + shuffleNumber: number; + promises: GamePromises; /** * @type { string } */ - static layout: string; + layout: string; /** * @type { Player } */ - static me: Player; + me: any; /** * @type { boolean } */ - static chess: boolean; - static globalEventHandlers: { + chess: boolean; + globalEventHandlers: { _handlers: {}; getHandler(name: any, type: any): any; ensureHandlerList(name: any, type: any): any; @@ -42,29 +42,29 @@ export class Game extends Uninstantable { getDefaultHandlerType(name: any): string; addHandlerToEvent(event: any): void; }; - static setStratagemBuffCost(cardName: any, cost: any): void; - static setStratagemBuffEffect(cardName: any, effect: any): void; - static setStratagemBuffPrompt(cardName: any, prompt: any): void; + setStratagemBuffCost(cardName: any, cost: any): void; + setStratagemBuffEffect(cardName: any, effect: any): void; + setStratagemBuffPrompt(cardName: any, prompt: any): void; /** * 添加新的属性杀 */ - static addNature(nature: any, translation: any, config: any): any; + addNature(nature: any, translation: any, config: any): any; /** * 判断卡牌信息/事件是否有某个属性 */ - static hasNature(item: any, nature: any, player: any): boolean; + hasNature(item: any, nature: any, player: any): boolean; /** * 设置卡牌信息/事件的属性 */ - static setNature(item: any, nature: any, addNature: any): any; + setNature(item: any, nature: any, addNature: any): any; /** * 洗牌 */ - static washCard(): false | any[] | import("../library/index.js").GameEventPromise; + washCard(): any; /** * 基于钩子的添加势力方法 */ - static addGroup(id: any, short: any, name: any, config: any): any; + addGroup(id: any, short: any, name: any, config: any): any; /** * @typedef {import("../library/hooks/interface.js").NonameHookType} NonameHookType */ @@ -76,13 +76,13 @@ export class Game extends Uninstantable { * @param {Name} name * @param {Parameters} args */ - static callHook(name: Name, args: Parameters): void; - static yingbianEffect(event: any, content: any, ...args: any[]): import("../library/index.js").GameEventPromise; - static setYingbianConditionColor(yingbianCondition: any, color: any): void; - static setComplexYingbianCondition(yingbianCondition: any, condition: any): void; - static setSimpleYingbianCondition(yingbianCondition: any, condition: any): void; - static setYingbianEffect(yingbianEffect: any, effect: any): void; - static setYingbianPrompt(yingbian: any, prompt: any): void; + callHook(name: Name, args: Parameters): void; + yingbianEffect(event: any, content: any, ...args: any[]): any; + setYingbianConditionColor(yingbianCondition: any, color: any): void; + setComplexYingbianCondition(yingbianCondition: any, condition: any): void; + setSimpleYingbianCondition(yingbianCondition: any, condition: any): void; + setYingbianEffect(yingbianEffect: any, effect: any): void; + setYingbianPrompt(yingbian: any, prompt: any): void; /** * Dynamic Style Manager * 动态CSS管理对象 @@ -127,49 +127,49 @@ export class Game extends Uninstantable { * textAlign: "center" * }); */ - static dynamicStyle: DynamicStyle; + dynamicStyle: DynamicStyle; /** * Add a background music to the config option * * 在设置选项中添加一首背景音乐 */ - static addBackgroundMusic(link: any, musicName: any, aozhan: any): void; + addBackgroundMusic(link: any, musicName: any, aozhan: any): void; /** * Remove a background music from the config option * * 从设置选项中移除一首背景音乐 */ - static removeBackgroundMusic(link: any, aozhan: any): void; - static updateBackground(): void; + removeBackgroundMusic(link: any, aozhan: any): void; + updateBackground(): void; /** * Generate a beatmap using the given BPM, beats, and offset * * 用给定的BPM、节拍和偏移生成谱面 */ - static generateBeatmapTimeleap(bpm: any, beats: any, offset: any): any; - static updateRenku(): void; + generateBeatmapTimeleap(bpm: any, beats: any, offset: any): any; + updateRenku(): void; /** * 为牌添加知情者 * @param { Card[] | Card } cards * @param { Player[] } players */ - static addCardKnower(cards: Card[] | Card, players: Player[]): void; + addCardKnower(cards: Card[] | Card, players: Player[]): void; /** * 移除牌的所有知情者。 * @param { Card[] | Card } cards */ - static clearCardKnowers(cards: Card[] | Card): void; + clearCardKnowers(cards: Card[] | Card): void; /** * @param { { [key: string]: any } } [arg] */ - static loseAsync(arg?: { + loseAsync(arg?: { [key: string]: any; - }): import("../library/index.js").GameEventPromise; - static callFuncUseStepCache(prefix: any, func: any, params: any): any; + } | undefined): any; + callFuncUseStepCache(prefix: any, func: any, params: any): any; /** * @param {string} name */ - static getRarity(name: string): "legend" | "epic" | "rare" | "junk" | "common"; + getRarity(name: string): "legend" | "epic" | "rare" | "junk" | "common"; /** * @template { keyof GameHistory } T * @param { T } key @@ -177,7 +177,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { boolean } */ - static hasGlobalHistory(key: T, filter: (event: GameEventPromise) => boolean, last?: GameEventPromise): boolean; + hasGlobalHistory(key: T, filter: (event: any) => boolean, last?: any): boolean; /** * @template { keyof GameHistory } T * @param { T } key @@ -185,12 +185,12 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { void } */ - static checkGlobalHistory(key: T_1, filter: (event: GameEventPromise) => boolean, last?: GameEventPromise): void; + checkGlobalHistory(key: T_1, filter: (event: any) => boolean, last?: any): void; /** * @overload * @returns { GameHistory } */ - static getGlobalHistory(): GameHistory; + getGlobalHistory(): GameHistory; /** * @template { keyof GameHistory } T * @overload @@ -199,7 +199,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - static getGlobalHistory(key: T_2, filter?: (event: GameEventPromise) => boolean, last?: GameEventPromise): GameHistory[T_2]; + getGlobalHistory(key: T_2, filter?: ((event: any) => boolean) | undefined, last?: any): GameHistory[T_2]; /** * @template { keyof GameHistory } T * @param { T } key @@ -207,7 +207,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { boolean } */ - static hasAllGlobalHistory(key: T_3, filter: (event: GameEventPromise) => boolean, last?: GameEventPromise): boolean; + hasAllGlobalHistory(key: T_3, filter: (event: any) => boolean, last?: any): boolean; /** * @template { keyof GameHistory } T * @param { T } key @@ -215,12 +215,12 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { void } */ - static checkAllGlobalHistory(key: T_4, filter: (event: GameEventPromise) => boolean, last?: GameEventPromise): void; + checkAllGlobalHistory(key: T_4, filter: (event: any) => boolean, last?: any): void; /** * @overload * @returns { GameHistory[] } */ - static getAllGlobalHistory(): GameHistory[]; + getAllGlobalHistory(): GameHistory[]; /** * @template { keyof GameHistory } T * @overload @@ -229,60 +229,60 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - static getAllGlobalHistory(key: T_5, filter?: (event: GameEventPromise) => boolean, last?: GameEventPromise): GameHistory[T_5]; + getAllGlobalHistory(key: T_5, filter?: ((event: any) => boolean) | undefined, last?: any): GameHistory[T_5]; /** * @overload * @returns { void } */ - static cardsDiscard(): void; + cardsDiscard(): void; /** * @overload * @param { Card } cards * @returns { GameEventPromise } */ - static cardsDiscard(cards: Card): GameEventPromise; + cardsDiscard(cards: any): any; /** * @overload * @param {Card[]} cards * @returns { GameEventPromise } */ - static cardsDiscard(cards: Card[]): GameEventPromise; + cardsDiscard(cards: Card[]): any; /** * @overload * @returns { void } */ - static cardsGotoOrdering(): void; + cardsGotoOrdering(): void; /** * @overload * @param { Card } cards * @returns { GameEventPromise } */ - static cardsGotoOrdering(cards: Card): GameEventPromise; + cardsGotoOrdering(cards: any): any; /** * @overload * @param {Card[]} cards * @returns { GameEventPromise } */ - static cardsGotoOrdering(cards: Card[]): GameEventPromise; + cardsGotoOrdering(cards: Card[]): any; /** * @overload * @returns { void } */ - static cardsGotoSpecial(): void; + cardsGotoSpecial(): void; /** * @overload * @param { Card } cards * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 * @returns { GameEventPromise } */ - static cardsGotoSpecial(cards: Card, bool?: 'toRenku' | false): GameEventPromise; + cardsGotoSpecial(cards: any, bool?: false | "toRenku" | undefined): any; /** * @overload * @param {Card[]} cards * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 * @returns { GameEventPromise } */ - static cardsGotoSpecial(cards: Card[], bool?: 'toRenku' | false): GameEventPromise; + cardsGotoSpecial(cards: Card[], bool?: false | "toRenku" | undefined): any; /** * * @param {...( @@ -294,49 +294,49 @@ export class Game extends Uninstantable { * )} args * @returns */ - static cardsGotoPile(...args: (Card[] | Card | Function | 'insert' | 'washCard' | 'triggeronly' | [ + cardsGotoPile(...args: (Card[] | Card | Function | 'insert' | 'washCard' | 'triggeronly' | [ string, any - ])[]): import("../library/index.js").GameEventPromise; + ])[]): any; /** * @param { GameEventPromise } event */ - static $cardsGotoPile(event: GameEventPromise): void; + $cardsGotoPile(event: any): void; /** * @param { false } [pause] */ - static showHistory(pause?: false): void; + showHistory(pause?: false | undefined): void; /** * @param { string } src * @param { true } [blur] */ - static createBackground(src: string, blur?: true): HTMLDivElement; + createBackground(src: string, blur?: true | undefined): HTMLDivElement; /** * * @param { string } url * @param { Player } [player] */ - static changeLand(url: string, player?: Player): void; + changeLand(url: string, player?: any): void; /** * @param { string[] } updates * @param { Function } proceed */ - static checkFileList(updates: string[], proceed: Function): void; + checkFileList(updates: string[], proceed: Function): void; /** * @param {...(Player[] | Player)} args */ - static replaceHandcards(...args: (Player[] | Player)[]): void; + replaceHandcards(...args: (Player[] | Player)[]): void; /** * @param { string } name */ - static removeCard(name: string): void; + removeCard(name: string): void; /** * @param { 'hidden' } [type] */ - static randomMapOL(type?: 'hidden'): void; - static closeMenu(): void; - static closeConnectMenu(): void; - static closePopped(): void; + randomMapOL(type?: "hidden" | undefined): void; + closeMenu(): void; + closeConnectMenu(): void; + closePopped(): void; /** * @template { keyof typeof lib.message.client } T * @overload @@ -344,7 +344,7 @@ export class Game extends Uninstantable { * @param { ...Parameters } args * @returns { void } */ - static broadcast(func: T_6, ...args: Parameters<{ + broadcast(func: T_6, ...args: Parameters<{ log: (arr: any) => void; opened: () => void; onconnection: (id: any) => void; @@ -368,7 +368,7 @@ export class Game extends Uninstantable { createDialog: (id: any, ...args: any[]) => void; gameStart: () => void; updateWaiting: (map: any) => void; - }[T_6]>): void; + }[T_6]> | undefined): void; /** * @template { any[] } T * @overload @@ -376,7 +376,7 @@ export class Game extends Uninstantable { * @param { ...T } args * @returns { void } */ - static broadcast(func: (...args: T_6) => void, ...args: T_6): void; + broadcast(func: (...args: T_6) => void, ...args: T_6 | undefined): void; /** * @template { keyof typeof lib.message.client } T * @overload @@ -384,7 +384,7 @@ export class Game extends Uninstantable { * @param { ...Parameters } args * @returns { void } */ - static broadcastAll(func: T_7, ...args: Parameters<{ + broadcastAll(func: T_7, ...args: Parameters<{ log: (arr: any) => void; opened: () => void; onconnection: (id: any) => void; @@ -408,7 +408,7 @@ export class Game extends Uninstantable { createDialog: (id: any, ...args: any[]) => void; gameStart: () => void; updateWaiting: (map: any) => void; - }[T_7]>): void; + }[T_7]> | undefined): void; /** * @template { any[] } T * @overload @@ -416,36 +416,36 @@ export class Game extends Uninstantable { * @param { ...T } args * @returns { void } */ - static broadcastAll(func: (...args: T_7) => void, ...args: T_7): void; - static syncState(): void; - static updateWaiting(): void; + broadcastAll(func: (...args: T_7) => void, ...args: T_7 | undefined): void; + syncState(): void; + updateWaiting(): void; /** * @param { Function } func */ - static waitForPlayer(func: Function): void; + waitForPlayer(func: Function): void; /** * @param { number } time * @param { Function } [onEnd] */ - static countDown(time: number, onEnd?: Function): void; - static countChoose(clear: any): void; - static stopCountChoose(): void; + countDown(time: number, onEnd?: Function | undefined): void; + countChoose(clear: any): void; + stopCountChoose(): void; /** * @param { string } ip * @param { (result: boolean) => any } callback */ - static connect(ip: string, callback: (result: boolean) => any): void; - static send(...args: any[]): void; + connect(ip: string, callback: (result: boolean) => any): void; + send(...args: any[]): void; /** * @param { string } id * @param {*} message */ - static sendTo(id: string, message: any): import("../library/element/client.js").Client; - static createServer(): void; + sendTo(id: string, message: any): import("../library/element/client.js").Client; + createServer(): void; /** * @returns { HTMLAudioElement } */ - static playAudio(...args: any[]): HTMLAudioElement; + playAudio(...args: any[]): HTMLAudioElement; /** * 根据skill中的audio,audioname,audioname2和player来获取音频地址列表 * @typedef {[string,number]|string|number|boolean} audioInfo @@ -484,13 +484,13 @@ export class Game extends Uninstantable { * //如果key中包含发动技能的角色名player,则直接改用info.audioname2[player]来播放语音 * ``` */ - static parseSkillAudio(skill: string, player?: Player | string, skillInfo?: { + parseSkillAudio(skill: string, player?: Player | string, skillInfo?: { audio: string | number | boolean | [string, number]; - audioname?: string[]; + audioname?: string[] | undefined; audioname2?: { [playerName: string]: string | number | boolean | [string, number]; - }; - } | (string | number | boolean | [string, number])): string[]; + } | undefined; + } | (string | number | boolean | [string, number]) | undefined): string[]; /** * * @param { string } skill @@ -500,19 +500,19 @@ export class Game extends Uninstantable { * @param { ['lib']['skill'] } [skillInfo] * @returns */ - static trySkillAudio(skill: string, player: Player | string, directaudio?: boolean, nobroadcast?: boolean, skillInfo?: any): HTMLAudioElement; + trySkillAudio(skill: string, player: Player | string, directaudio?: boolean | undefined, nobroadcast?: boolean | undefined, skillInfo?: any): HTMLAudioElement | undefined; /** * @param { string } name * @param { number } [index] * @returns */ - static playSkillAudio(name: string, index?: number, ...args: any[]): void; + playSkillAudio(name: string, index?: number | undefined, ...args: any[]): void; /** * @param { string | Card } card * @param { Player | Sex } sex */ - static playCardAudio(card: string | Card, sex: Player | Sex): void; - static playBackgroundMusic(): void; + playCardAudio(card: string | Card, sex: Player | Sex): void; + playBackgroundMusic(): void; /** * @overload * @param { 'character' } type @@ -526,7 +526,7 @@ export class Game extends Uninstantable { * ) => importCharacterConfig } content * @param {*} [url] */ - static import(type: 'character', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importCharacterConfig, url?: any): any; + import(type: 'character', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importCharacterConfig, url?: any): any; /** * @overload * @param { 'card' } type @@ -540,7 +540,7 @@ export class Game extends Uninstantable { * ) => importCardConfig } content * @param {*} [url] */ - static import(type: 'card', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importCardConfig, url?: any): any; + import(type: 'card', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importCardConfig, url?: any): any; /** * @overload * @param { 'mode' } type @@ -554,7 +554,7 @@ export class Game extends Uninstantable { * ) => importModeConfig } content * @param {*} [url] */ - static import(type: 'mode', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importModeConfig, url?: any): any; + import(type: 'mode', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importModeConfig, url?: any): any; /** * @overload * @param { 'player' } type @@ -568,7 +568,7 @@ export class Game extends Uninstantable { * ) => importPlayerConfig } content * @param {*} [url] */ - static import(type: 'player', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importPlayerConfig, url?: any): any; + import(type: 'player', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importPlayerConfig, url?: any): any; /** * @overload * @param { 'extension' } type @@ -582,59 +582,67 @@ export class Game extends Uninstantable { * ) => importExtensionConfig } content * @param {*} [url] */ - static import(type: 'extension', content: (lib: Library, game: typeof Game, ui: UI, get: Get, ai: AI, _status: Status) => importExtensionConfig, url?: any): any; - static loadExtension(object: any): Promise; + import(type: 'extension', content: (lib: any, game: typeof Game, ui: any, get: any, ai: any, _status: any) => importExtensionConfig, url?: any): any; + loadExtension(object: any): Promise; /** * 下载文件 - * @type { (url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void) => void, dev?: 'nodev', onprogress?: Function) => void } + * @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void) } */ - static download: (url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void) => void; + download: ((url: string, folder: string, onsuccess?: Function, onerror?: ((e: Error) => void) | undefined, dev?: 'nodev', onprogress?: Function) => void) | undefined; /** * 读取文件为arraybuffer - * @type { (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) } */ - static readFile: (filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void; + readFile: ((filename: string, callback?: ((data: Buffer | ArrayBuffer) => any) | undefined, onerror?: ((e: Error) => void) | undefined) => void) | undefined; /** * 读取文件为文本 - * @type { (filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void } + * @type { undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void) } */ - static readFileAsText: (filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void; + readFileAsText: ((filename: string, callback?: ((data: string) => any) | undefined, onerror?: ((e: Error) => void) | undefined) => void) | undefined; /** * 将数据写入文件 - * @type { (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) } */ - static writeFile: (data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void; + writeFile: ((data: File | ArrayBuffer, path: string, name: string, callback?: ((e: Error) => void) | undefined) => void) | undefined; /** * 移除文件 - * @type { (filename: string, callback?: (e: Error) => void) => void } + * @type { undefined | ((filename: string, callback?: (e: Error) => void) => void) } */ - static removeFile: (filename: string, callback?: (e: Error) => void) => void; + removeFile: ((filename: string, callback?: ((e: Error) => void) | undefined) => void) | undefined; /** * 获取文件列表 - * @type { (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) } */ - static getFileList: (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) | undefined; /** * 按路径依次创建文件夹 - * @type { (list: string | string[], callback: Function, file?: boolean) => void } + * @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) } */ - static ensureDirectory: (list: string | string[], callback: Function, file?: boolean) => void; + ensureDirectory: ((list: string | string[], callback: Function, file?: boolean) => void) | undefined; /** * 创建文件夹 - * @type { (directory: string, successCallback?: Function, errorCallback?: Function) => void } + * @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) } */ - static createDir: (directory: string, successCallback?: Function, errorCallback?: Function) => void; + createDir: ((directory: string, successCallback?: Function, errorCallback?: Function) => void) | undefined; /** * 删除文件夹 - * @type { (directory: string, successCallback?: Function, errorCallback?: Function) => void } + * @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) } */ - static removeDir: (directory: string, successCallback?: Function, errorCallback?: Function) => void; - static importExtension(data: any, finishLoad: any, exportExtension: any, extensionPackage: any): Promise; + removeDir: ((directory: string, successCallback?: Function, errorCallback?: Function) => void) | undefined; + /** + * @type { (forcecheck?: boolean | null, dev?: boolean) => Promise } + */ + checkForUpdate: (forcecheck?: boolean | null, dev?: boolean) => Promise; + /** + * @type { () => Promise } + */ + checkForAssetUpdate: () => Promise; + importExtension(data: any, finishLoad: any, exportExtension: any, extensionPackage: any): Promise; /** * @param { string } textToWrite * @param { string } [name] */ - static export(textToWrite: string, name?: string): void; + export(textToWrite: string, name?: string | undefined): void; /** * @param { string[] } list * @param { Function } [onsuccess] @@ -643,7 +651,7 @@ export class Game extends Uninstantable { * @param { Function } [process] * @param {*} [dev] */ - static multiDownload2(list: string[], onsuccess?: Function, onerror?: Function, onfinish?: Function, process?: Function, dev?: any): void; + multiDownload2(list: string[], onsuccess?: Function | undefined, onerror?: Function | undefined, onfinish?: Function | undefined, process?: Function | undefined, dev?: any): void; /** * @param { string[] } list * @param { Function } onsuccess @@ -652,24 +660,24 @@ export class Game extends Uninstantable { * @param { Function } [process] * @param {*} [dev] */ - static multiDownload(list: string[], onsuccess: Function, onerror: Function, onfinish: Function, process?: Function, dev?: any, ...args: any[]): void; + multiDownload(list: string[], onsuccess: Function, onerror: Function, onfinish: Function, process?: Function | undefined, dev?: any, ...args: any[]): void; /** * @param { string } url * @param { Function } onload * @param { Function } [onerror] * @param { Function } [onprogress] */ - static fetch(url: string, onload: Function, onerror?: Function, onprogress?: Function): void; + fetch(url: string, onload: Function, onerror?: Function | undefined, onprogress?: Function | undefined): void; /** * @param { string } time * @param { string } mode */ - static playVideo(time: string, mode: string): void; + playVideo(time: string, mode: string): void; /** * @param { Videos } video */ - static playVideoContent(video: Videos): void; - static videoContent: { + playVideoContent(video: Videos): void; + videoContent: { arrangeLib: (content: any) => void; $syncDisable: (player: any, map: any) => void; $syncExpand: (player: any, map: any) => void; @@ -792,50 +800,50 @@ export class Game extends Uninstantable { swapPlayer: (player: any, hs: any) => void; over: (str: any) => void; }; - static reload(): void; - static reload2(): void; - static exit(): void; + reload(): void; + reload2(): void; + exit(): void; /** * @param { string } url */ - static open(url: string): void; - static reloadCurrent(): void; + open(url: string): void; + reloadCurrent(): void; /** * @param { Function } func */ - static update(func: Function): Function; + update(func: Function): Function; /** * @param { Function } func */ - static unupdate(func: Function): void; - static stop(): void; - static run(): void; + unupdate(func: Function): void; + stop(): void; + run(): void; /** * @param { string } type * @param { Player } player * @param { any } [content] * @returns */ - static addVideo(type: string, player: Player, content?: any): void; + addVideo(type: string, player: any, content?: any): void; /** * @param { Function } func */ - static draw(func: Function): void; + draw(func: Function): void; /** * @param { number } [time] */ - static vibrate(time?: number): void; - static prompt(...args: any[]): void; - static alert(str: any): void; - static print(...args: any[]): void; - static animate: { + vibrate(time?: number | undefined): void; + prompt(...args: any[]): void; + alert(str: any): void; + print(...args: any[]): void; + animate: { window: (num: any) => void; flame: (x: any, y: any, duration: any, type: any) => void; }; /** * @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path */ - static linexy(path: [number, string | number | { + linexy(path: [number, string | number | { opacity: any; color: any; dashed: any; @@ -844,7 +852,7 @@ export class Game extends Uninstantable { /** * @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path */ - static _linexy(path: [number, string | number | { + _linexy(path: [number, string | number | { opacity: any; color: any; dashed: any; @@ -857,7 +865,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } event * @returns { GameEventPromise } */ - static createTrigger(name: string, skill: string, player: Player, event: GameEventPromise, indexedData: any): GameEventPromise; + createTrigger(name: string, skill: string, player: any, event: any, indexedData: any): any; /** * @legacy Use {@link lib.element.GameEvent.constructor} instead. * @@ -865,12 +873,12 @@ export class Game extends Uninstantable { * @param { false } [trigger] * @param { GameEventPromise } [triggerEvent] */ - static createEvent(name: string, trigger?: false, triggerEvent?: GameEventPromise): import("../library/index.js").GameEventPromise; + createEvent(name: string, trigger?: false | undefined, triggerEvent?: any): any; /** * @param { string } name * @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information */ - static addCharacter(name: string, information: { + addCharacter(name: string, information: { extension: string; sex: Sex; group: string; @@ -883,9 +891,9 @@ export class Game extends Uninstantable { * @param { { mode?: string, forbid?: any, character: { [key: string]: Character }, skill: { [key: string]: object }, [key: string]: any } } pack * @param { string } [packagename] */ - static addCharacterPack(pack: { + addCharacterPack(pack: { [key: string]: any; - mode?: string; + mode?: string | undefined; forbid?: any; character: { [key: string]: Character; @@ -893,13 +901,13 @@ export class Game extends Uninstantable { skill: { [key: string]: any; }; - }, packagename?: string): void; + }, packagename?: string | undefined): void; /** * @param { string } name * @param { Card } info * @param { { extension: string, translate: string, description: string, number?: number, color?: string } } info2 */ - static addCard(name: string, info: Card, info2: { + addCard(name: string, info: any, info2: { extension: string; translate: string; description: string; @@ -910,18 +918,18 @@ export class Game extends Uninstantable { * @param { { extension: string, mode?: string[], forbid?: string[], list: any[], card: {[key: string]: Card}, skill: { [key: string]: object } } } pack * @param { string } [packagename] */ - static addCardPack(pack: { + addCardPack(pack: { extension: string; - mode?: string[]; - forbid?: string[]; + mode?: string[] | undefined; + forbid?: string[] | undefined; list: any[]; card: { - [key: string]: import("../library/element/card.js").Card; + [key: string]: any; }; skill: { [key: string]: any; }; - }, packagename?: string): void; + }, packagename?: string | undefined): void; /** * @param { string } name * @param { { [key: string]: object } } info @@ -930,15 +938,15 @@ export class Game extends Uninstantable { * @param { string } [appendInfo] * @param { string } [abInfo] */ - static addSkill(name: string, info: { + addSkill(name: string, info: { [key: string]: any; - }, translate?: string, description?: string, appendInfo?: string, abInfo?: string): boolean; + }, translate?: string | undefined, description?: string | undefined, appendInfo?: string | undefined, abInfo?: string | undefined): boolean; /** * @param { string } name * @param {*} info * @param { { translate: string, config: { [key: string]: object } } } info2 */ - static addMode(name: string, info: any, info2: { + addMode(name: string, info: any, info2: { translate: string; config: { [key: string]: any; @@ -948,40 +956,40 @@ export class Game extends Uninstantable { * @param { string } skill * @param { Player } [player] */ - static addGlobalSkill(skill: string, player?: Player): boolean; + addGlobalSkill(skill: string, player?: any): boolean; /** * @param { string } skill */ - static removeGlobalSkill(skill: string): void; - static resetSkills(): void; + removeGlobalSkill(skill: string): void; + resetSkills(): void; /** * @param { string } extensionName */ - static hasExtension(extensionName: string): any; + hasExtension(extensionName: string): any; /** * @param { string } extensionName */ - static hasExtensionInstalled(extensionName: string): any; + hasExtensionInstalled(extensionName: string): any; /** * @param { string } extensionName */ - static hasExtensionLoaded(extensionName: string): any; + hasExtensionLoaded(extensionName: string): any; /** * @param { string } extensionName * @param { Function } runnable */ - static runAfterExtensionLoaded(extensionName: string, runnable: Function): void; + runAfterExtensionLoaded(extensionName: string, runnable: Function): void; /** * @param { string } extensionName * @param { boolean } [keepFile] */ - static removeExtension(extensionName: string, keepFile?: boolean): void; - static addRecentCharacter(...args: any[]): void; + removeExtension(extensionName: string, keepFile?: boolean | undefined): void; + addRecentCharacter(...args: any[]): void; /** * @overload * @returns { Card } */ - static createCard(): Card; + createCard(): any; /** * @overload * @param { Card | string } name @@ -989,12 +997,12 @@ export class Game extends Uninstantable { * @param { number | string } [number] * @param { string } [nature] */ - static createCard(name: Card | string, suit?: string, number?: number | string, nature?: string): any; + createCard(name: Card | string, suit?: string | undefined, number?: string | number | undefined, nature?: string | undefined): any; /** * @overload * @returns { Card } */ - static createCard2(): Card; + createCard2(): any; /** * @overload * @param { Card | string } name @@ -1002,18 +1010,18 @@ export class Game extends Uninstantable { * @param { number } number * @param { string } nature */ - static createCard2(name: Card | string, suit: string, number: number, nature: string): any; + createCard2(name: Card | string, suit: string, number: number, nature: string): any; /** * @param { boolean } bool * @param { Function } callback */ - static forceOver(bool: boolean, callback: Function): void; + forceOver(bool: boolean, callback: Function): void; /** * @param { boolean | string } [result] * @param { boolean } [bool] * @returns */ - static over(result?: boolean | string, bool?: boolean, ...args: any[]): void; + over(result?: string | boolean | undefined, bool?: boolean | undefined, ...args: any[]): void; /** * @type { Map> } * @@ -1021,35 +1029,35 @@ export class Game extends Uninstantable { * * 但是需要事件结果的除外 */ - static executingAsyncEventMap: Map>; + executingAsyncEventMap: Map>; /** * @type { GameEventPromise[] } */ - static belongAsyncEventList: GameEventPromise[]; + belongAsyncEventList: GameEventPromise[]; /** * @param { GameEventPromise } [belongAsyncEvent] */ - static loop(belongAsyncEvent?: GameEventPromise): Promise; + loop(belongAsyncEvent?: any): Promise; /** * @param { GameEventPromise } [belongAsyncEvent] */ - static runContent(belongAsyncEvent?: GameEventPromise): Promise; - static pause(): void; - static pause2(): void; - static resume(): void; - static resume2(): void; - static delaye(...args: any[]): import("../library/index.js").GameEventPromise; - static delayex(...args: any[]): import("../library/index.js").GameEventPromise; + runContent(belongAsyncEvent?: any): Promise; + pause(): void; + pause2(): void; + resume(): void; + resume2(): void; + delaye(...args: any[]): any; + delayex(...args: any[]): any; /** * @param { number } [time] * @param { number } [time2] */ - static delay(time?: number, time2?: number): void; + delay(time?: number | undefined, time2?: number | undefined): void; /** * @param { number } [time] * @param { number } [time2] */ - static delayx(time?: number, time2?: number): void; + delayx(time?: number | undefined, time2?: number | undefined): void; /** * 在async content中对game.delay的代替使用方法 * @@ -1058,7 +1066,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static asyncDelay(time?: number, time2?: number): Promise; + asyncDelay(time?: number | undefined, time2?: number | undefined): Promise; /** * 在async content中对game.delayx的代替使用方法 * @@ -1067,39 +1075,13 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static asyncDelayx(time?: number, time2?: number): Promise; + asyncDelayx(time?: number | undefined, time2?: number | undefined): Promise; /** * @param { GameEventPromise } [event] */ - static check(event?: GameEventPromise): boolean; - static Check: { - new (): {}; - processSelection({ type, items, event, useCache, isSelectable }: { - type: any; - items: any; - event: any; - useCache: any; - isSelectable: any; - }): { - ok: boolean; - auto: boolean; - }; - button(event: any, useCache: any): { - ok: boolean; - auto: boolean; - }; - card(event: any, useCache: any): { - ok: boolean; - auto: boolean; - }; - target(event: any, useCache: any): { - ok: boolean; - auto: boolean; - }; - skill(event: any): void; - confirm(event: any, confirm: any): void; - }; - static uncheck(...args: any[]): void; + check(event?: any): boolean; + Check: Check; + uncheck(...args: any[]): void; /** * @param { Player } player1 * @param { Player } player2 @@ -1107,79 +1089,79 @@ export class Game extends Uninstantable { * @param { boolean } [behind] * @param { boolean } [noanimate] */ - static swapSeat(player1: Player, player2: Player, prompt?: boolean, behind?: boolean, noanimate?: boolean): void; + swapSeat(player1: any, player2: any, prompt?: boolean | undefined, behind?: boolean | undefined, noanimate?: boolean | undefined): void; /** * @param { Player } player1 * @param { Player } [player2] */ - static swapPlayer(player: any, player2?: Player): void; + swapPlayer(player: any, player2?: any): void; /** * @param { Player } player */ - static swapControl(player: Player): void; - static swapPlayerAuto(player: any): void; + swapControl(player: any): void; + swapPlayerAuto(player: any): void; /** * @param { Player } player */ - static findNext(player: Player): import("../library/element/player.js").Player; + findNext(player: any): any; /** * @param { string } name * @param { Function } callback */ - static loadModeAsync(name: string, callback: Function): void; + loadModeAsync(name: string, callback: Function): void; /** * @param { string } name * @param {*} configx */ - static switchMode(name: string, configx: any): void; + switchMode(name: string, configx: any): void; /** * @param { string } mode */ - static loadMode(mode: string): void; + loadMode(mode: string): void; /** * @param {...string} args */ - static loadPackage(...args: string[]): void; + loadPackage(...args: string[]): void; /** * @param { Player } player */ - static phaseLoop(player: Player): void; + phaseLoop(player: any): void; /** * @param { Player } [player] */ - static gameDraw(player?: Player, num?: number): import("../library/index.js").GameEventPromise; - static chooseCharacterDouble(...args: any[]): void; - static updateRoundNumber(): void; + gameDraw(player?: any, num?: number): any; + chooseCharacterDouble(...args: any[]): void; + updateRoundNumber(): void; /** * @param { Player[] } players * @param { number | number[] | (player: Player) => number } num * @param { { drawDeck: boolean } } [drawDeck] * @param { boolean } [bottom] */ - static asyncDraw(players: Player[], num: number | number[] | ((player: Player) => number), drawDeck?: { + asyncDraw(players: Player[], num: number | number[] | ((player: any) => number), drawDeck?: { drawDeck: boolean; - }, bottom?: boolean): void; + } | undefined, bottom?: boolean | undefined): void; /** * @param { Player[] } players * @param { number | number[] | (player: Player) => number } num * @param { { drawDeck: boolean } } [drawDeck] */ - static asyncDrawAuto(players: Player[], num: number | number[] | ((player: Player) => number), drawDeck?: { + asyncDrawAuto(players: Player[], num: number | number[] | ((player: any) => number), drawDeck?: { drawDeck: boolean; - }, ...args: any[]): void; - static finishSkill(i: any, sub: any): void; - static finishCards(): void; + } | undefined, ...args: any[]): void; + finishSkill(i: any, sub: any): void; + finishCards(): void; /** * 这玩意至少19种重载了吧 */ - static checkMod(...args: any[]): any; + checkMod(...args: any[]): any; /** * @param { number } num */ - static prepareArena(num: number): void; - static clearArena(): void; - static clearConnect(): void; - static log(...args: any[]): void; + prepareArena(num: number): void; + clearArena(): void; + clearConnect(): void; + log(...args: any[]): void; /** * @param { Player } player * @param { string | Card[] } card @@ -1188,7 +1170,7 @@ export class Game extends Uninstantable { * @param { boolean } [forced] * @param { string } [logvid] */ - static logv(player: Player, card: string | Card[], targets?: Player[], event?: GameEventPromise, forced?: boolean, logvid?: string): HTMLDivElement; + logv(player: any, card: string | Card[], targets?: any[] | undefined, event?: any, forced?: boolean | undefined, logvid?: string | undefined): HTMLDivElement | undefined; /** * @param { string } storeName * @param { string } idbValidKey @@ -1196,7 +1178,7 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static putDB(storeName: string, idbValidKey: string, value: any, onSuccess?: Function, onError?: Function): Promise; + putDB(storeName: string, idbValidKey: string, value: any, onSuccess?: Function | undefined, onError?: Function | undefined): Promise; /** * * @param { string } storeName @@ -1204,129 +1186,129 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static getDB(storeName: string, query?: string | null, onSuccess?: Function, onError?: Function): Promise; + getDB(storeName: string, query?: string | null | undefined, onSuccess?: Function | undefined, onError?: Function | undefined): Promise; /** * @param { string } storeName * @param { string } [query] * @param { Function } [onSuccess] * @param { Function } [onError] */ - static deleteDB(storeName: string, query?: string, onSuccess?: Function, onError?: Function): Promise; + deleteDB(storeName: string, query?: string | undefined, onSuccess?: Function | undefined, onError?: Function | undefined): Promise; /** * @param { string } key * @param { * } [value] * @param { string } [mode] */ - static save(key: string, value?: any, mode?: string): void; - static showChangeLog(): void; + save(key: string, value?: any, mode?: string | undefined): void; + showChangeLog(): void; /** * @param { string } str * @param { string } [extname] */ - static showExtensionChangeLog(str: string, extname?: string): void; + showExtensionChangeLog(str: string, extname?: string | undefined): void; /** * @param { string } key * @param { * } [value] * @param { string | boolean } [local] * @param { Function } [callback] */ - static saveConfig(key: string, value?: any, local?: string | boolean, callback?: Function): void; + saveConfig(key: string, value?: any, local?: string | boolean | undefined, callback?: Function | undefined): void; /** * @param { string } key */ - static saveConfigValue(key: string): void; + saveConfigValue(key: string): void; /** * @param { string } extension * @param { string } key * @param { * } [value] */ - static saveExtensionConfig(extension: string, key: string, value?: any): void; + saveExtensionConfig(extension: string, key: string, value?: any): void; /** * @param { string } extension * @param { string } key */ - static saveExtensionConfigValue(extension: string, key: string): void; + saveExtensionConfigValue(extension: string, key: string): void; /** * @param { string } extension * @param { string } key */ - static getExtensionConfig(extension: string, key: string): any; + getExtensionConfig(extension: string, key: string): any; /** * @param { string } mode */ - static clearModeConfig(mode: string): void; + clearModeConfig(mode: string): void; /** * @param { number } position * @param { string } [character] * @param { string } [character2] */ - static addPlayer(position: number, character?: string, character2?: string): import("../library/element/player.js").Player; + addPlayer(position: number, character?: string | undefined, character2?: string | undefined): import("../library/element/player.js").Player; /** * @param { number } position * @param { string } [character] * @param { string } [animation] */ - static addFellow(position: number, character?: string, animation?: string): import("../library/element/player.js").Player; + addFellow(position: number, character?: string | undefined, animation?: string | undefined): import("../library/element/player.js").Player; /** * @param { Player } player */ - static triggerEnter(player: Player): import("../library/index.js").GameEventPromise; + triggerEnter(player: any): any; /** * @param { Player } player */ - static restorePlayer(player: Player): import("../library/element/player.js").Player; + restorePlayer(player: any): any; /** * @param { Player } player */ - static removePlayer(player: Player): import("../library/element/player.js").Player; + removePlayer(player: any): any; /** * @param { Player } player * @param { string } [character] * @param { string } [character2] */ - static replacePlayer(player: Player, character?: string, character2?: string): import("../library/element/player.js").Player; - static arrangePlayers(): void; + replacePlayer(player: any, character?: string | undefined, character2?: string | undefined): import("../library/element/player.js").Player; + arrangePlayers(): void; /** * @param { string[] } skills * @param { Player } player * @param { string[] } exclude */ - static filterSkills(skills: string[], player: Player, exclude: string[]): string[]; + filterSkills(skills: string[], player: any, exclude: string[]): string[]; /** * @param { string[] } skills */ - static expandSkills(skills: string[]): string[]; + expandSkills(skills: string[]): string[]; /** * @param { { [key:string]: any } } style */ - static css(style: { + css(style: { [key: string]: any; }): void; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static hasPlayer(func: (player: Player) => boolean, includeOut?: boolean): boolean; + hasPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): boolean; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static hasPlayer2(func: (player: Player) => boolean, includeOut?: boolean): boolean; + hasPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): boolean; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static countPlayer(func: (player: Player) => boolean, includeOut?: boolean): number; + countPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): any; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static countPlayer2(func: (player: Player) => boolean, includeOut?: boolean): number; + countPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): any; /** * @overload * @returns { Player[] } */ - static filterPlayer(): Player[]; + filterPlayer(): Player[]; /** * @overload * @param { (player: Player) => boolean } func @@ -1334,12 +1316,12 @@ export class Game extends Uninstantable { * @param { boolean } [includeOut] * @returns { Player[] } */ - static filterPlayer(func: (player: Player) => boolean, list?: Player[], includeOut?: boolean): Player[]; + filterPlayer(func: (player: any) => boolean, list?: any[] | undefined, includeOut?: boolean | undefined): Player[]; /** * @overload * @returns { Player[] } */ - static filterPlayer2(): Player[]; + filterPlayer2(): Player[]; /** * @overload * @param { (player: Player) => boolean } func @@ -1347,29 +1329,29 @@ export class Game extends Uninstantable { * @param { boolean } [includeOut] * @returns { Player[] } */ - static filterPlayer2(func: (player: Player) => boolean, list?: Player[], includeOut?: boolean): Player[]; + filterPlayer2(func: (player: any) => boolean, list?: any[] | undefined, includeOut?: boolean | undefined): Player[]; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static findPlayer(func: (player: Player) => boolean, includeOut?: boolean): import("../library/element/player.js").Player; + findPlayer(func: (player: any) => boolean, includeOut?: boolean | undefined): any; /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static findPlayer2(func: (player: Player) => boolean, includeOut?: boolean): import("../library/element/player.js").Player; + findPlayer2(func: (player: any) => boolean, includeOut?: boolean | undefined): any; /** * @param { (player: Player) => boolean } func * @param { boolean } [all] */ - static findCards(func: (player: Player) => boolean, all?: boolean): string[]; - static countGroup(): number; + findCards(func: (player: any) => boolean, all?: boolean | undefined): string[]; + countGroup(): any; /** * 此函数用于计算函数的时间消耗。 * @param {function} 测试的函数 * @returns {number} 消耗的时间 */ - static testRunCost(func: any): number; + testRunCost(func: any): number; /** * 此方法用于对所有targets按顺序执行一个async函数。 * @@ -1377,9 +1359,10 @@ export class Game extends Uninstantable { * @param { (player: Player, i: number) => Promise } asyncFunc 需要执行的async方法 * @param { (a: Player, b: Player) => number } sort 排序器,默认为lib.sort.seat */ - static doAsyncInOrder(targets: Player[], asyncFunc: (player: Player, i: number) => Promise, sort: (a: Player, b: Player) => number): Promise; + doAsyncInOrder(targets: Player[], asyncFunc: (player: any, i: number) => Promise, sort: (a: any, b: any) => number): Promise; } -export const game: typeof Game; +export let game: Game; +export function setGame(instance?: Game | undefined): void; export type GameHistory = { cardMove: GameEventPromise[]; custom: GameEventPromise[]; @@ -1402,8 +1385,8 @@ export type Videos = { video: Video; win: boolean; }; -import { Uninstantable } from "../util/index.js"; import { GamePromises } from "./promises.js"; import { DynamicStyle } from "./dynamic-style/index.js"; -import { Library as lib } from '../library/index.js'; +import { lib } from '../library/index.js'; +import { Check } from "./check.js"; import { delay } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts index ea25d45cb..2f4e24fbc 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/game/promises.d.ts @@ -1,28 +1,18 @@ -export class GamePromises extends Uninstantable { +export class GamePromises { /** - * 模仿h5的prompt,用于显示可提示用户进行输入的对话框 - * - * 注: 由于参数列表是随意的,在这里我准备限制一下这个函数的参数顺序 - * - * @type {{ - * (title: string): Promise; - * (title: string, forced: true): Promise; - * (alertOption: 'alert', title: string): Promise; - * }} - * - * @param { string } [title] 设置prompt标题与input内容 - * @param { boolean } [forced] 为true的话将没有"取消按钮" - * @param { string } alertOption 设置prompt是否模拟alert - * @example - * ```js - * // 只设置标题(但是input的初始值就变成了undefined) - * game.promises.prompt('###prompt标题').then(value => console.log(value)); - * // 设置标题和input初始内容 - * game.promises.prompt('###prompt标题###input初始内容').then(value => console.log(value)); - * ``` - * @returns { Promise } + * @overload + * @param { string } title + * @returns { Promise } */ - static prompt(alertOption: string, title?: string, forced?: boolean): Promise; + prompt(title: string): Promise; + /** + * @overload + * @param { string } title + * @param { boolean } [forced] + * @returns { Promise } + * + */ + prompt(title: string, forced?: boolean | undefined): Promise; /** * 模仿h5的alert,用于显示信息的对话框 * @@ -33,14 +23,13 @@ export class GamePromises extends Uninstantable { * ``` * @returns { Promise } */ - static alert(title: string): Promise; - static download(url: any, folder: any, dev: any, onprogress: any): Promise; - static readFile(filename: any): Promise; - static readFileAsText(filename: any): Promise; - static writeFile(data: any, path: any, name: any): Promise; - static ensureDirectory(list: any, callback: any, file: any): Promise; - static createDir(directory: any): Promise; - static removeFile(filename: any): Promise; - static removeDir(directory: any): Promise; + alert(title: string): Promise; + download(url: any, folder: any, dev: any, onprogress: any): Promise; + readFile(filename: any): Promise; + readFileAsText(filename: any): Promise; + writeFile(data: any, path: any, name: any): Promise; + ensureDirectory(list: any, callback: any, file: any): Promise; + createDir(directory: any): Promise; + removeFile(filename: any): Promise; + removeDir(directory: any): Promise; } -import { Uninstantable } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts index 57e9de1ae..e2aaa5672 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/get/index.d.ts @@ -1,5 +1,6 @@ -export class Get extends Uninstantable { - static is: typeof Is; +export class Get { + is: Is; + promises: Promises; /** * 获取当前内核版本信息 * @@ -9,59 +10,59 @@ export class Get extends Uninstantable { * * @returns {["firefox" | "chrome" | "safari" | "other", number, number, number]} */ - static coreInfo(): ["firefox" | "chrome" | "safari" | "other", number, number, number]; + coreInfo(): ["firefox" | "chrome" | "safari" | "other", number, number, number]; /** * 返回 VCard[] 形式的所有牌,用于印卡将遍历 * @param {Function} filter * @returns {string[][]} */ - static inpileVCardList(filter: Function): string[][]; + inpileVCardList(filter: Function): string[][]; /** * 根据(Player的)座次数n(从1开始)获取对应的“n号位”翻译 * @param {number | Player} seat */ - static seatTranslation(seat: number | Player): string; + seatTranslation(seat: number | Player): string; /** * @param {number} numberOfPlayers * @returns {string[]} */ - static identityList(numberOfPlayers: number): string[]; + identityList(numberOfPlayers: number): string[]; /** * Generate an object URL from the Base64-encoded octet stream * * 从Base64编码的八位字节流生成对象URL */ - static objectURL(octetStream: any): any; + objectURL(octetStream: any): any; /** * Get the card name length * * 获取此牌的字数 */ - static cardNameLength(card: any, player: any): number; + cardNameLength(card: any, player: any): number; /** * Get the Yingbian conditions (of the card) * * 获取(此牌的)应变条件 */ - static yingbianConditions(card: any): string[]; - static complexYingbianConditions(card: any): string[]; - static simpleYingbianConditions(card: any): string[]; + yingbianConditions(card: any): string[]; + complexYingbianConditions(card: any): string[]; + simpleYingbianConditions(card: any): string[]; /** * Get the Yingbian effects (of the card) * * 获取(此牌的)应变效果 */ - static yingbianEffects(card: any): string[]; + yingbianEffects(card: any): string[]; /** * Get the default Yingbian effect of the card * * 获取此牌的默认应变效果 */ - static defaultYingbianEffect(card: any): any; + defaultYingbianEffect(card: any): any; /** * 优先度判断 */ - static priority(skill: any): any; + priority(skill: any): any; /** * 新装备栏相关 * @@ -73,49 +74,49 @@ export class Get extends Uninstantable { * @param { false | Player } [player] * @returns { string[] } */ - static subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string[]; + subtypes(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string[]; /** * @returns { string[] } */ - static pinyin(chinese: any, withTone: any): string[]; - static yunmu(str: any): any; + pinyin(chinese: any, withTone: any): string[]; + yunmu(str: any): any; /** * 用于将参数转换为字符串,作为缓存的key。 */ - static paramToCacheKey(...args: any[]): string; - static yunjiao(str: any): string; + paramToCacheKey(...args: any[]): string; + yunjiao(str: any): string | null; /** * @param { string } skill * @param { Player } player * @returns { string[] } */ - static skillCategoriesOf(skill: string, player: Player): string[]; - static numOf(obj: any, item: any): any; - static connectNickname(): any; - static zhinangs(filter: any): any; - static sourceCharacter(str: any): any; - static isLuckyStar(player: any): boolean; - static infoHp(hp: any): number; - static infoMaxHp(hp: any): number; - static infoHujia(hp: any): number; - static bottomCards(num: any, putBack: any): any; - static discarded(): any; - static cardOffset(): number; - static colorspan(str: any): any; - static evtprompt(next: any, str: any): void; - static autoViewAs(card: any, cards: any): import("../library/element/vcard.js").VCard; + skillCategoriesOf(skill: string, player: any): string[]; + numOf(obj: any, item: any): any; + connectNickname(): any; + zhinangs(filter: any): any; + sourceCharacter(str: any): any; + isLuckyStar(player: any): any; + infoHp(hp: any): number; + infoMaxHp(hp: any): number; + infoHujia(hp: any): number; + bottomCards(num: any, putBack: any): any; + discarded(): any; + cardOffset(): number; + colorspan(str: any): any; + evtprompt(next: any, str: any): void; + autoViewAs(card: any, cards: any): import("../library/element/vcard.js").VCard; /** * @deprecated */ - static _autoViewAs(card: any, cards: any): any; - static max(list: any, func: any, type: any): any; - static min(list: any, func: any, type: any): any; + _autoViewAs(card: any, cards: any): any; + max(list: any, func: any, type: any): any; + min(list: any, func: any, type: any): any; /** * @overload * @param { string } name * @returns { Character } */ - static character(name: string): Character; + character(name: string): Character; /** * @template { 0 | 1 | 2 | 3 | 4 } T * @overload @@ -123,24 +124,30 @@ export class Get extends Uninstantable { * @param { T } num * @returns { Character[T] } */ - static character(name: string, num: T): Character[T]; - static characterInitFilter(name: any): string[]; - static characterIntro(name: any): any; - static bordergroup(info: any, raw: any): any; - static groupnature(group: any, method: any): any; - static sgn(num: any): 0 | 1 | -1; - static rand(num: any, num2: any): any; - static sort(arr: any, method: any, arg: any): any; - static sortSeat(arr: any, target: any): any; - static zip(callback: any): void; - static delayx(num: any, max: any): number; - static prompt(skill: any, target: any, player: any): string; - static prompt2(skill: any, target: any, player: any, ...args: any[]): any; - static url(master: any): string; - static round(num: any, f: any): number; - static playerNumber(): number; - static benchmark(func1: any, func2: any, iteration: any, arg: any): number; - static stringify(obj: any, level: any): any; + character(name: string, num: T): Character[T]; + characterInitFilter(name: any): string[]; + characterIntro(name: any): any; + bordergroup(info: any, raw: any): any; + groupnature(group: any, method: any): any; + sgn(num: any): 0 | 1 | -1; + rand(num: any, num2: any): any; + sort(arr: any, method: any, arg: any): any; + sortSeat(arr: any, target: any): any; + /** + * @param { (zip: JSZip) => any } callback + */ + zip(callback: (zip: JSZip) => any): void; + delayx(num: any, max: any): number; + prompt(skill: any, target: any, player: any): string; + prompt2(skill: any, target: any, player: any, ...args: any[]): string; + url(master: any): string; + round(num: any, f: any): number; + playerNumber(): number; + benchmark(func1: any, func2: any, iteration: any, arg: any): number | undefined; + /** + * @param {any} obj + */ + stringify(obj: any, level?: number): any; /** * 深拷贝函数(虽然只处理了部分情况) * @@ -152,25 +159,25 @@ export class Get extends Uninstantable { * @param {WeakMap} [map] - 拷贝用的临时存储,用于处理循环引用(请勿自行赋值) * @returns {T} - 深拷贝后的对象,若传入值不是对象则为传入值 */ - static copy(obj: T_1, copyKeyDeep?: boolean, map?: WeakMap): T_1; - static inpilefull(type: any): { + copy(obj: T_1, copyKeyDeep?: boolean | undefined, map?: WeakMap | undefined): T_1; + inpilefull(type: any): { name: any; suit: any; number: any; nature: any; }[]; - static inpile(type: any, filter: any): any[]; - static inpile2(type: any): any[]; - static typeCard(type: any, filter: any): string[]; - static libCard(filter: any): string[]; - static ip(): string; - static modetrans(config: any, server: any): string; - static charactersOL(func: any): number[]; - static trimip(str: any): any; - static mode(): any; - static idDialog(id: any): import("../library/element/dialog.js").Dialog; - static arenaState(): { - number: string; + inpile(type: any, filter: any): any[]; + inpile2(type: any): any[]; + typeCard(type: any, filter: any): string[]; + libCard(filter: any): string[]; + ip(): any; + modetrans(config: any, server: any): string; + charactersOL(func: any): number[]; + trimip(str: any): any; + mode(): any; + idDialog(id: any): any; + arenaState(): { + number: string | undefined; players: {}; mode: any; dying: any[]; @@ -181,312 +188,313 @@ export class Get extends Uninstantable { inpile_nature: any[]; renku: any[]; }; - static skillState(player: any): { + skillState(player: any): { global: string[]; }; - static id(): string; - static zhu(player: any, skill: any, group: any): any; - static config(item: any, mode: any): any; - static coinCoeff(list: any): number; - static rank(name: any, num: any): number | "x" | "s" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp"; - static skillRank(skill: any, type: any, grouped: any): number; - static targetsInfo(targets: any): any[]; - static infoTargets(infos: any): import("../library/element/player.js").Player[]; - static cardInfo(card: any): any[]; - static cardsInfo(cards?: any[]): any[][]; - static infoCard(info: any): import("../library/element/card.js").Card; - static infoCards(infos: any): import("../library/element/card.js").Card[]; - static cardInfoOL(card: any): string; - static infoCardOL(info: any): any; - static cardsInfoOL(cards: any): string[]; - static infoCardsOL(infos: any): any[]; - static playerInfoOL(player: any): string; - static infoPlayerOL(info: any): any; - static playersInfoOL(players: any): string[]; - static infoPlayersOL(infos: any): any[]; - static funcInfoOL(func: any): any; - static infoFuncOL(info: any): any; - static eventInfoOL(item: any, level: any, noMore: any): string; + id(): string; + zhu(player: any, skill: any, group: any): any; + config(item: any, mode: any): any; + coinCoeff(list: any): number; + rank(name: any, num: any): number | "x" | "s" | "c" | "d" | "b" | "a" | "ap" | "am" | "bp" | "bm" | "sp"; + skillRank(skill: any, type: any, grouped: any): number; + targetsInfo(targets: any): any[]; + infoTargets(infos: any): any[]; + cardInfo(card: any): any[]; + cardsInfo(cards?: any[]): any[][]; + infoCard(info: any): import("../library/element/card.js").Card; + infoCards(infos: any): import("../library/element/card.js").Card[]; + cardInfoOL(card: any): string; + infoCardOL(info: any): any; + cardsInfoOL(cards: any): string[]; + infoCardsOL(infos: any): any[]; + playerInfoOL(player: any): string; + infoPlayerOL(info: any): any; + playersInfoOL(players: any): string[]; + infoPlayersOL(infos: any): any[]; + funcInfoOL(func: any): any; + infoFuncOL(info: any): any; + eventInfoOL(item: any, level: any, noMore: any): string; /** * @param {string} item */ - static infoEventOL(item: string): string | import("../library/element/gameEvent.js").GameEvent; - static stringifiedResult(item: any, level: any, nomore: any): any; - static parsedResult(item: any): any; - static verticalStr(str: any, sp: any): string; - static numStr(num: any, method: any): any; - static rawName(str: any): any; + infoEventOL(item: string): import("../library/element/gameEvent.js").GameEvent; + stringifiedResult(item: any, level: any, nomore: any): any; + parsedResult(item: any): any; + verticalStr(str: any, sp: any): string; + numStr(num: any, method: any): any; + rawName(str: any): any; /** * 作用修改:只读前缀 不读_ab */ - static rawName2(str: any): any; - static slimNameHorizontal(str: any): any; + rawName2(str: any): any; + slimNameHorizontal(str: any): any; /** * @param {string} prefix * @param {string} name * @returns {string} */ - static prefixSpan(prefix: string, name: string): string; - static slimName(str: any): string; - static time(): number; - static utc(): number; - static evtDistance(e1: any, e2: any): number; - static xyDistance(from: any, to: any): number; + prefixSpan(prefix: string, name: string): string; + slimName(str: any): string; + time(): number; + utc(): number; + evtDistance(e1: any, e2: any): number; + xyDistance(from: any, to: any): number; /** * @overload * @returns { void } */ - static itemtype(): void; + itemtype(): void; /** * @overload * @param { string } obj * @returns { 'position' | 'natures' | 'nature' } */ - static itemtype(obj: string): 'position' | 'natures' | 'nature'; + itemtype(obj: string): 'position' | 'natures' | 'nature'; /** * @overload * @param { Player[] } obj * @returns { 'players' } */ - static itemtype(obj: Player[]): 'players'; + itemtype(obj: Player[]): 'players'; /** * @overload * @param { Card[] } obj * @returns { 'cards' } */ - static itemtype(obj: Card[]): 'cards'; + itemtype(obj: Card[]): 'cards'; /** * @overload * @param { [number, number] } obj * @returns { 'select' } */ - static itemtype(obj: [number, number]): 'select'; + itemtype(obj: [number, number]): 'select'; /** * @overload * @param { [number, number, number, number] } obj * @returns { 'divposition' } */ - static itemtype(obj: [number, number, number, number]): 'divposition'; + itemtype(obj: [number, number, number, number]): 'divposition'; /** * @overload * @param { Button } obj * @returns { 'button' } */ - static itemtype(obj: Button): 'button'; + itemtype(obj: any): 'button'; /** * @overload * @param { Card } obj * @returns { 'card' } */ - static itemtype(obj: Card): 'card'; + itemtype(obj: any): 'card'; /** * @overload * @param { Player } obj * @returns { 'player' } */ - static itemtype(obj: Player): 'player'; + itemtype(obj: any): 'player'; /** * @overload * @param { Dialog } obj * @returns { 'dialog' } */ - static itemtype(obj: Dialog): 'dialog'; + itemtype(obj: any): 'dialog'; /** * @overload * @param { GameEvent | GameEventPromise } obj * @returns { 'event' } */ - static itemtype(obj: GameEvent | GameEventPromise): 'event'; - static equipNum(card: any): number; - static objtype(obj: any): "object" | "div" | "array" | "table" | "tr" | "td" | "fragment"; - static type(obj: any, method: any, player: any): any; - static type2(card: any, player: any): any; + itemtype(obj: GameEvent | GameEventPromise): 'event'; + equipNum(card: any): number; + objtype(obj: any): "div" | "object" | "array" | "table" | "tr" | "td" | "fragment" | undefined; + type(obj: any, method: any, player: any): any; + type2(card: any, player: any): any; /** * * @param { string | Card | VCard | CardBaseUIData } obj * @param { false | Player } [player] * @returns { string } */ - static subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string; - static equiptype(card: any, player: any): number; + subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string; + equiptype(card: any, player: any): number; /** * * @param { Card | VCard | CardBaseUIData } card * @param { false | Player } [player] * @returns { string } */ - static name(card: Card | VCard | CardBaseUIData, player?: false | Player): string; + name(card: Card | VCard | CardBaseUIData, player?: false | Player): string; /** * @param {Card | VCard | Card[] | VCard[]} card * @param {false | Player} [player] * @returns {string} */ - static suit(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; + suit(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; /** * @param {Card | VCard | Card[] | VCard[]} card * @param {false | Player} [player] * @returns {string} */ - static color(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; + color(card: Card | VCard | Card[] | VCard[], player?: false | Player): string; /** * @param {Card | VCard} card * @param {false | Player} [player] * @returns {number} */ - static number(card: Card | VCard, player?: false | Player): number; + number(card: Card | VCard, player?: false | Player): number; /** * 返回一张杀的属性。如有多种属性则用`lib.natureSeparator`分割开来。例:火雷【杀】的返回值为`fire|thunder` * @param {string | string[] | Card | VCard} card * @param {false | Player} [player] * @returns {string} */ - static nature(card: string | string[] | Card | VCard, player?: false | Player): string; + nature(card: string | string[] | Card | VCard, player?: false | Player): string; /** * 返回包含所有属性的数组 * @param {string[] | string} card * @param {false | Player} [player] * @returns {string[]} */ - static natureList(card: string[] | string, player?: false | Player): string[]; - static cards(num: any, putBack: any): any; - static judge(card: any): any; - static judge2(card: any): any; - static distance(from: any, to: any, method: any): number; + natureList(card: string[] | string, player?: false | Player): string[]; + cards(num: any, putBack: any): any; + judge(card: any): any; + judge2(card: any): any; + distance(from: any, to: any, method: any): number; /** * @overload * @param { string } item * @returns { Skill } */ - static info(item: string): Skill; + info(item: string): Skill; /** * @overload * @param { Card | VCard | CardBaseUIData } item * @param { Player | false } [player] * @returns { any } */ - static info(item: Card | VCard | CardBaseUIData, player?: Player | false): any; + info(item: Card | VCard | CardBaseUIData, player?: Player | false): any; /** * @param { number | Select | (()=>Select) } [select] * @returns { Select } */ - static select(select?: number | Select | (() => Select)): Select; - static card(original: any): any; + select(select?: number | Select | (() => Select) | undefined): Select; + card(original: any): any; /** * @overload * @returns {GameEvent} */ - static event(): GameEvent; + event(): any; /** * @template { keyof GameEvent } T * @overload * @param {T} key * @returns {GameEvent[T]} */ - static event(key: T_2): import("../library/element/gameEvent.js").GameEvent[T_2]; - static player(): import("../library/element/player.js").Player; - static players(sort: any, dead: any, out: any): import("../library/element/player.js").Player[]; - static position(card: any, ordering: any): number | "x" | "s" | "e" | "j" | "h" | "c" | "d" | "o"; - static skillTranslation(str: any, player: any): string; - static skillInfoTranslation(name: any, player: any): any; + event(key: T_2): any; + player(): any; + players(sort: any, dead: any, out: any): any[]; + position(card: any, ordering: any): number | "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o" | null | undefined; + skillTranslation(str: any, player: any): string; + skillInfoTranslation(name: any, player: any): any; /** * @returns {string} */ - static translation(str: any, arg: any): string; - static menuZoom(): any; - static strNumber(num: any): any; - static cnNumber(num: any, ordinal: any): any; + translation(str: any, arg: any): string; + menuZoom(): any; + strNumber(num: any): any; + cnNumber(num: any, ordinal: any): any; /** * 遍历子元素 * @param {HTMLElement} node * @returns {Iterable} 迭代器 */ - static iterableChildNodes(node: HTMLElement, ...args: any[]): Iterable; + iterableChildNodes(node: HTMLElement, ...args: any[]): Iterable; /** * @param {((a: Button, b: Button) => number)} [sort] 排序函数 * @returns { Button[] } */ - static selectableButtons(sort?: (a: Button, b: Button) => number): Button[]; + selectableButtons(sort?: ((a: any, b: any) => number) | undefined): Button[]; /** * @param {((a: Card, b: Card) => number)} [sort] 排序函数 * @returns { Card[] } */ - static selectableCards(sort?: (a: Card, b: Card) => number): Card[]; + selectableCards(sort?: ((a: any, b: any) => number) | undefined): Card[]; /** * @returns { string[] } 技能名数组 */ - static skills(): string[]; - static gainableSkills(func: any, player: any): any[]; - static gainableSkillsName(name: any, func: any): any[]; - static gainableCharacters(func: any): string[]; + skills(): string[]; + gainableSkills(func: any, player: any): any[]; + gainableSkillsName(name: any, func: any): any[]; + gainableCharacters(func: any): string[]; /** * @param {((a: Player, b: Player) => number)} [sort] 排序函数 * @returns { Player[] } */ - static selectableTargets(sort?: (a: Player, b: Player) => number): Player[]; - static filter(filter: any, i: any): any; - static cardCount(card: any, player: any): any; - static skillCount(skill: any, player: any): any; - static owner(card: any, method: any): import("../library/element/player.js").Player; - static noSelected(): boolean; - static population(identity: any): number; - static totalPopulation(identity: any): number; + selectableTargets(sort?: ((a: any, b: any) => number) | undefined): Player[]; + filter(filter: any, i: any): any; + cardCount(card: any, player: any): any; + skillCount(skill: any, player: any): any; + owner(card: any, method: any): any; + noSelected(): boolean; + population(identity: any): number; + totalPopulation(identity: any): number; /** * @param { Card | VCard } item */ - static cardtag(item: Card | VCard, tag: any): any; - static tag(item: any, tag: any, item2: any, bool: any): any; - static sortCard(sort: any): (card: any) => any; - static difficulty(): 2 | 1 | 3; - static cardPile(name: any, create: any): any; - static cardPile2(name: any): any; - static discardPile(name: any): any; - static aiStrategy(): 2 | 1 | 3 | 4 | 5 | 6; - static skillintro(name: any, learn: any, learn2: any): string; - static intro(name: any): string; - static storageintro(type: any, content: any, player: any, dialog: any, skill: any): any; - static nodeintro(node: any, simple: any, evt: any): import("../library/element/dialog.js").Dialog; - static linkintro(dialog: any, content: any, player: any): void; - static groups(): string[]; - static types(): any[]; - static links(buttons: any): any[]; - static threaten(target: any, player: any, hp: any): number; - static condition(player: any): any; - static attitude(from: any, to: any, ...args: any[]): any; - static sgnAttitude(...args: any[]): 0 | 1 | -1; - static useful_raw(card: any, player: any): any; - static useful(card: any, player: any): any; - static unuseful(card: any): number; - static unuseful2(card: any): number; - static unuseful3(card: any): number; - static value(card: any, player: any, method: any): any; - static equipResult(player: any, target: any, name: any): number; - static equipValue(card: any, player: any): number; - static equipValueNumber(card: any): number; - static disvalue(card: any, player: any): number; - static disvalue2(card: any, player: any): number; - static skillthreaten(skill: any, player: any, target: any): number | void; - static cacheOrder(item: any): number; + cardtag(item: Card | VCard, tag: any): any; + tag(item: any, tag: any, item2: any, bool: any): any; + sortCard(sort: any): ((card: any) => any) | undefined; + difficulty(): 2 | 1 | 3; + cardPile(name: any, create: any): any; + cardPile2(name: any): any; + discardPile(name: any): any; + aiStrategy(): 2 | 1 | 3 | 4 | 5 | 6; + skillintro(name: any, learn: any, learn2: any): string; + intro(name: any): string; + storageintro(type: any, content: any, player: any, dialog: any, skill: any): any; + nodeintro(node: any, simple: any, evt: any): import("../library/element/dialog.js").Dialog | undefined; + linkintro(dialog: any, content: any, player: any): void; + groups(): string[]; + types(): any[]; + links(buttons: any): any[]; + threaten(target: any, player: any, hp: any): number; + condition(player: any): any; + attitude(from: any, to: any, ...args: any[]): any; + sgnAttitude(...args: any[]): 0 | 1 | -1; + useful_raw(card: any, player: any): any; + useful(card: any, player: any): any; + unuseful(card: any): number; + unuseful2(card: any): number; + unuseful3(card: any): number; + value(card: any, player: any, method: any): any; + equipResult(player: any, target: any, name: any): number; + equipValue(card: any, player: any): any; + equipValueNumber(card: any): any; + disvalue(card: any, player: any): number; + disvalue2(card: any, player: any): number; + skillthreaten(skill: any, player: any, target: any): number | void; + cacheOrder(item: any): number; /** * @returns { number } */ - static order(item: any, player?: import("../library/element/player.js").Player): number; - static result(item: any, skill: any): any; - static cacheEffectUse(target: any, card: any, player: any, player2: any, isLink: any): number; - static effect_use(target: any, card: any, player: any, player2: any, isLink: any): number; - static cacheEffect(target: any, card: any, player: any, player2: any, isLink: any): number; - static effect(target: any, card: any, player: any, player2: any, isLink: any): number; - static damageEffect(target: any, player: any, viewer: any, nature: any): any; + order(item: any, player?: any): number; + result(item: any, skill: any): any; + cacheEffectUse(target: any, card: any, player: any, player2: any, isLink: any): number; + effect_use(target: any, card: any, player: any, player2: any, isLink: any): number; + cacheEffect(target: any, card: any, player: any, player2: any, isLink: any): number; + effect(target: any, card: any, player: any, player2: any, isLink: any): number; + damageEffect(target: any, player: any, viewer: any, nature: any): any; /** * * @param {any} source 如果参数是function,执行此函数并返回结果,传参为此方法剩余的参数。如果参数不是function,直接返回结果。 * @returns 返回的结果 */ - static dynamicVariable(source: any, ...args: any[]): any; - static recoverEffect(target: any, player: any, viewer: any): number; - static buttonValue(button: any): number; - static attitude2(to: any): any; + dynamicVariable(source: any, ...args: any[]): any; + recoverEffect(target: any, player: any, viewer: any): number; + buttonValue(button: any): number; + attitude2(to: any): any; } -export const get: typeof Get; -export { Is }; -import { Uninstantable } from "../util/index.js"; +export let get: Get; +export function setGet(instance?: Get | undefined): void; import { Is } from "./is.js"; +import { Promises } from "./promises.js"; +export { Is, Promises }; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts index 59caba09a..45add36bd 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/get/is.d.ts @@ -1,89 +1,89 @@ -export class Is extends Uninstantable { +export class Is { /** * 判断是否为进攻坐骑 * @param { Card | VCard } card * @param { false | Player } [player] * @returns { boolean } */ - static attackingMount(card: Card | VCard, player?: false | Player): boolean; + attackingMount(card: Card | VCard, player?: false | Player): boolean; /** * 判断是否为防御坐骑 * @param { Card | VCard } card * @param { false | Player } [player] * @returns { boolean } */ - static defendingMount(card: Card | VCard, player?: false | Player): boolean; + defendingMount(card: Card | VCard, player?: false | Player): boolean; /** * 判断坐骑栏是否被合并 * @returns { boolean } */ - static mountCombined(): boolean; + mountCombined(): boolean; /** * 判断传入的参数的属性是否相同(参数可以为卡牌、卡牌信息、属性等) * @param {...} infos 要判断的属性列表 * @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同 */ - static sameNature(...args: any[]): boolean; + sameNature(...args: any[]): boolean; /** * 判断传入的参数的属性是否不同(参数可以为卡牌、卡牌信息、属性等) * @param ...infos 要判断的属性列表 * @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同 */ - static differentNature(...args: any[]): boolean; + differentNature(...args: any[]): boolean; /** * 判断一张牌是否为明置手牌 * @param { Card } card */ - static shownCard(card: Card): boolean; + shownCard(card: any): boolean; /** * 是否是虚拟牌 * @param { Card | VCard } card */ - static virtualCard(card: Card | VCard): boolean; + virtualCard(card: Card | VCard): boolean; /** * 是否是转化牌 * @param { Card | VCard } card */ - static convertedCard(card: Card | VCard): boolean; + convertedCard(card: Card | VCard): boolean; /** * 是否是实体牌 * @param { Card | VCard } card */ - static ordinaryCard(card: Card | VCard): boolean; + ordinaryCard(card: Card | VCard): any; /** * 押韵判断 * @param { string } str1 * @param { string } str2 */ - static yayun(str1: string, str2: string): boolean; + yayun(str1: string, str2: string): boolean; /** * @param { string } skill 技能id * @param { Player } player 玩家 * @returns */ - static blocked(skill: string, player: Player): boolean; + blocked(skill: string, player: any): boolean; /** * 是否是双势力武将 * @param { string } name * @param { string[] } array * @returns { boolean | string[] } */ - static double(name: string, array: string[]): boolean | string[]; + double(name: string, array: string[]): boolean | string[]; /** * Check if the card has a Yingbian condition * * 检测此牌是否具有应变条件 * @param { Card | VCard } card */ - static yingbianConditional(card: Card | VCard): boolean; + yingbianConditional(card: Card | VCard): boolean; /** * @param { Card | VCard } card */ - static complexlyYingbianConditional(card: Card | VCard): boolean; + complexlyYingbianConditional(card: Card | VCard): boolean; /** * @param { Card | VCard } card */ - static simplyYingbianConditional(card: Card | VCard): boolean; + simplyYingbianConditional(card: Card | VCard): boolean; /** * Check if the card has a Yingbian effect * @@ -91,104 +91,103 @@ export class Is extends Uninstantable { * * @param { Card | VCard } card */ - static yingbianEffective(card: Card | VCard): boolean; + yingbianEffective(card: Card | VCard): boolean; /** * @param { Card | VCard } card */ - static yingbian(card: Card | VCard): boolean; + yingbian(card: Card | VCard): boolean; /** * @param { string } [substring] */ - static emoji(substring?: string): boolean; + emoji(substring?: string | undefined): boolean; /** * @param { string } str */ - static banWords(str: string): boolean; + banWords(str: string): boolean; /** * @param { GameEventPromise } event */ - static converted(event: GameEventPromise): boolean; - static safari(): boolean; + converted(event: any): boolean; + safari(): boolean; /** * @param { (Card | VCard)[]} cards */ - static freePosition(cards: (Card | VCard)[]): boolean; + freePosition(cards: (Card | VCard)[]): boolean; /** * @param { string } name * @param { boolean } item */ - static nomenu(name: string, item: boolean): boolean; - static altered(skillName: any): boolean; + nomenu(name: string, item: boolean): boolean; + altered(skillName: any): boolean; /** * @param { any } obj * @returns { boolean } */ - static node(obj: any): boolean; + node(obj: any): boolean; /** * @param { any } obj */ - static div(obj: any): boolean; + div(obj: any): boolean; /** * @param { any } obj */ - static map(obj: any): boolean; + map(obj: any): boolean; /** * @param { any } obj */ - static set(obj: any): boolean; + set(obj: any): boolean; /** * @param { any } obj */ - static object(obj: any): boolean; + object(obj: any): boolean; /** * @overload * @param { Function } func * @returns { false } */ - static singleSelect(func: Function): false; + singleSelect(func: Function): false; /** * @overload * @param { number | [number, number] } func * @returns { boolean } */ - static singleSelect(func: number | [number, number]): boolean; + singleSelect(func: number | [number, number]): boolean; /** * @param { string | Player } name */ - static jun(name: string | Player): boolean; - static versus(): boolean; - static changban(): boolean; - static single(): boolean; + jun(name: string | Player): boolean; + versus(): boolean; + changban(): boolean; + single(): boolean; /** * @param { Player } [player] */ - static mobileMe(player?: Player): boolean; - static newLayout(): boolean; - static phoneLayout(): boolean; - static singleHandcard(): any; + mobileMe(player?: any): any; + newLayout(): boolean; + phoneLayout(): boolean; + singleHandcard(): any; /** * @param { Player } player */ - static linked2(player: Player): boolean; + linked2(player: any): boolean; /** * @param { {} } obj */ - static empty(obj: {}): boolean; + empty(obj: {}): boolean; /** * @param { string } str */ - static pos(str: string): boolean; + pos(str: string): boolean; /** * @param { string } skill * @param { Player } player * @returns */ - static locked(skill: string, player: Player): any; + locked(skill: string, player: any): any; /** * @param { string } skill * @param { Player } player * @returns */ - static zhuanhuanji(skill: string, player: Player): boolean; + zhuanhuanji(skill: string, player: any): boolean; } -import { Uninstantable } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/get/promises.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/get/promises.d.ts new file mode 100644 index 000000000..ac2e2754e --- /dev/null +++ b/node_modules/@types/noname-typings/nonameModules/noname/get/promises.d.ts @@ -0,0 +1,6 @@ +export class Promises { + /** + * @returns { Promise } + */ + zip(): Promise; +} diff --git a/node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts index 1a367b43b..b2143da90 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/gnc/index.d.ts @@ -1,12 +1,12 @@ -export class GNC extends Uninstantable { +export class GNC { /** * @param {GeneratorFunction} fn * @returns */ - static of(fn: GeneratorFunction): (...args: any[]) => Promise>; - static is: typeof Is; + of(fn: GeneratorFunction): (...args: any[]) => Promise>; + is: Is; } -export const gnc: typeof GNC; -import { Uninstantable } from "../util/index.js"; +export let gnc: GNC; +export function setGNC(instance?: GNC | undefined): void; import { GeneratorFunction } from "../util/index.js"; import { Is } from "./is.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts index eacd29580..146f217fa 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/gnc/is.d.ts @@ -1,18 +1,17 @@ -export class Is extends Uninstantable { +export class Is { /** * @param {*} item * @returns {boolean} */ - static coroutine(item: any): boolean; + coroutine(item: any): boolean; /** * @param {*} item * @returns {boolean} */ - static generatorFunc(item: any): boolean; + generatorFunc(item: any): boolean; /** * @param {*} item * @returns {boolean} */ - static generator(item: any): boolean; + generator(item: any): boolean; } -import { Uninstantable } from "../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts index 51456cf8c..eed360421 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/init/index.d.ts @@ -1,4 +1,4 @@ -export function canUseHttpProtocol(): boolean; +export function canUseHttpProtocol(): any; /** * 传递升级完成的信息 * @returns { string | void } 返回一个网址 diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts index 8e4af684b..34bc22c4b 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/announce/index.d.ts @@ -1,53 +1,78 @@ -import { NonameAnnounceType } from "./interface.d.ts" - -export interface IAnnounceSubscriber { - subscribe(name: string): void; - unsubscribe(name: string): void; - - get isEmpty(): boolean -} - -export type AnnounceSubscriberType = new ( - content: (value: T, name: string) => void, - target: EventTarget -) => IAnnounceSubscriber; - +/** + * @template T + * @typedef {import("./index").AnnounceSubscriberType} AnnounceSubscriberType + */ +/** + * @typedef {import("./index").IAnnounceSubscriber} IAnnounceSubscriber + */ +/** + * + */ export class Announce { - constructor(eventTarget: EventTarget, records: WeakMap<((arg0: any) => void), IAnnounceSubscriber>, SubscriberType: AnnounceSubscriberType = AnnounceSubscriber) - - /** - * 推送任意数据给所有监听了指定事件的订阅者,并返回给定的数据 - * - * 若不存在订阅指定事件的订阅者,则推送的数据将无意义 - * - * @param name - 要推送事件的名称 - * @param values - 要推送的数据 - */ - publish(name: Name, values: Parameters[0]): Parameters[0] - - /** - * 订阅给定名字的事件,并返回给定的函数 - * - * 在事件触发时执行给定的函数 - * - * 给定的函数将被存储至当前实例中,用于取消订阅时获取 - * - * @param name - 要订阅事件的名称 - * @param method - 事件触发时执行的函数 - */ - subscribe(name: Name, method: Type[Name]): Type[Name] - - /** - * 取消指定事件某一个函数的订阅,并返回该函数 - * - * 给定的函数将不再于事件触发时执行,其余同事件需触发的函数不受限制 - * - * @param name - 要取消订阅事件的名称 - * @param method - 订阅指定事件的函数 - */ - unsubscribe(name: Name, method: Type[Name]): Type[Name] + /** + * + * @param {EventTarget} eventTarget + * @param {WeakMap} records + * @param {AnnounceSubscriberType} [SubscriberType] + */ + constructor(eventTarget: EventTarget, records: WeakMap<(arg0: any) => void, IAnnounceSubscriber>, SubscriberType?: AnnounceSubscriberType | undefined); + /** + * 推送任意数据给所有监听了指定事件的订阅者,并返回给定的数据 + * + * 若不存在订阅指定事件的订阅者,则推送的数据将无意义 + * + * @template T + * @param {string} name - 要推送事件的名称 + * @param {T} values - 要推送的数据 + * @returns {T} + */ + publish(name: string, values: T): T; + /** + * 订阅给定名字的事件,并返回给定的函数 + * + * 在事件触发时执行给定的函数 + * + * 给定的函数将被存储至当前实例中,用于取消订阅时获取 + * + * @template T + * @param {string} name - 要订阅事件的名称 + * @param {(values: T) => void} method - 事件触发时执行的函数 + * @returns {(values: T) => void} + */ + subscribe(name: string, method: (values: T_1) => void): (values: T_1) => void; + /** + * 取消指定事件某一个函数的订阅,并返回该函数 + * + * 给定的函数将不再于事件触发时执行,其余同事件需触发的函数不受限制 + * + * @template T + * @param {string} name - 要取消订阅事件的名称 + * @param {(values: T) => void} method - 订阅指定事件的函数 + * @returns {(values: T) => void} + */ + unsubscribe(name: string, method: (values: T_2) => void): (values: T_2) => void; + #private; } - -export class AnnounceSubscriber implements IAnnounceSubscriber { - constructor(content: (value: T, name: string) => void, target: EventTarget) +/** + * @template T + */ +export class AnnounceSubscriber { + /** + * + * @param {function(T, string): void} content + * @param {EventTarget} target + */ + constructor(content: (arg0: T, arg1: string) => void, target: EventTarget); + get isEmpty(): boolean; + /** + * @param {string} name + */ + subscribe(name: string): void; + /** + * @param {string} name + */ + unsubscribe(name: string): void; + #private; } +export type AnnounceSubscriberType = import("./index").AnnounceSubscriberType; +export type IAnnounceSubscriber = import("./index").IAnnounceSubscriber; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/announce/interface.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/announce/interface.d.ts deleted file mode 100644 index 329a6be84..000000000 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/announce/interface.d.ts +++ /dev/null @@ -1,54 +0,0 @@ - -export interface NonameAnnounceType { - // Apperaence 外观区域 - // 用于关于无名杀外观方面的通知 - - // Apperaence.Theme 无名杀主题区域 - /** - * 主题正在被切换时通知 - * - * @param values - 主题名称 - */ - "Noname.Apperaence.Theme.onChanging": AnnounceFunction - - /** - * 主题被切换时通知 - * - * @param values - 主题名称 - */ - "Noname.Apperaence.Theme.onChanged": AnnounceFunction - - /** - * 主题被切换时,已经显示完毕后通知 - * - * @param values - 主题名称 - */ - "Noname.Apperaence.Theme.onChangeFinished": AnnounceFunction - - // Game 游戏区域 - // 包含游戏对局下的通知 - - // Game.Event 事件区域 - /** - * 当游戏对局开始时进行通知 - * - * @param values - 空对象 - */ - "Noname.Game.Event.GameStart": AnnounceFunction<{}> - - - // Init 初始化区域 - // 用于关于初始化方面的通知 - - // Init.Extension 扩展初始化区域 - /** - * 当扩展初始化完成时通知 - * - * @param values - 扩展名称 - */ - "Noname.Init.Extension.onLoad": AnnounceFunction - - -} - -export type AnnounceFunction = (values: T) => void diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts index 14c9cd09a..1e90c9af0 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/cache/cacheContext.d.ts @@ -33,14 +33,14 @@ export class CacheContext { * @param {Array} methods * @returns */ - static inject(source: any, methods: Array): any; + static inject(source: any, methods: Array): null | undefined; static _getCacheValueFromObject(storage: any, key: any, params: any, source: any, func: any): any; static _ensureMember(obj: any, key: any): any; static _wrapParametersToCacheKey(params: any): string; static _wrapParameterToCacheKey(param: any): any; - lib: typeof Library; - game: typeof Game; - get: typeof Get; + lib: import("../index.js").Library; + game: import("../../game/index.js").Game; + get: import("../../get/index.js").Get; sourceMap: Map; storageMap: Map; /** @@ -59,6 +59,3 @@ export class CacheContext { */ _createCacheProxy(delegateObject: T): T; } -import { Library } from "../index.js"; -import { Game } from "../../game/index.js"; -import { Get } from "../../get/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts index a929b8a42..2631e4630 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/channel/index.d.ts @@ -9,7 +9,7 @@ export class Channel { /** * @type {PromiseResolve | [T, PromiseResolve] | null} */ - _buffer: ((value?: T | PromiseLike) => void) | [T, (value?: void | PromiseLike) => void]; + _buffer: ((value?: T | PromiseLike | undefined) => void) | [T, (value?: void | PromiseLike | undefined) => void] | null; /** * 向该频道发送消息,在消息未被接受前将等待 * diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts index 7e360e942..58f5afd4d 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/button.d.ts @@ -6,8 +6,12 @@ export class Button extends HTMLDivElement { * @param {true} [noClick] * @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: "character" | "tdnodes" | "blank" | "card" | "vcard" | "characterx" | "player" | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment | undefined, noClick?: true | undefined, button?: Button | undefined); + /** + * @type { string | undefined } + */ + buttonid: string | undefined; exclude(): void; get updateTransform(): (bool: any, delay: any) => void; } -import { UI as ui } from '../../ui/index.js'; +import { ui } from '../../ui/index.js'; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts index 649da9a72..cce666e53 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/card.d.ts @@ -2,12 +2,12 @@ export class Card extends HTMLDivElement { /** * @param {HTMLDivElement|DocumentFragment} [position] */ - constructor(position?: HTMLDivElement | DocumentFragment); + constructor(position?: HTMLDivElement | DocumentFragment | undefined); /** * @param {'noclick'} [info] * @param {true} [noclick] */ - build(info?: 'noclick', noclick?: true): this; + build(info?: "noclick" | undefined, noclick?: true | undefined): this; buildEventListener(info: any): void; buildProperty(): void; /** @@ -38,8 +38,8 @@ export class Card extends HTMLDivElement { willBeDestroyed(targetPosition: any, player: any, event: any): any; hasNature(nature: any, player: any): boolean; addNature(nature: any): string; - nature: string; - removeNature(nature: any): string; + nature: string | undefined; + removeNature(nature: any): string | undefined; addGaintag(gaintag: any): void; removeGaintag(tag: any): void; hasGaintag(tag: any): boolean; @@ -57,10 +57,10 @@ export class Card extends HTMLDivElement { name: string; nature: string; }): this; - suit: string; - number: number; + suit: string | undefined; + number: number | undefined; destroyed: any; - cardid: string; + cardid: string | undefined; /** * @param {[string, number, string, string]} card */ @@ -68,17 +68,17 @@ export class Card extends HTMLDivElement { updateTransform(bool: any, delay: any): void; aiexclude(): void; addKnower(player: any): void; - _knowers: any[]; + _knowers: any[] | undefined; removeKnower(player: any): void; clearKnowers(): void; isKnownBy(player: any): boolean; getSource(name: any): any; moveDelete(player: any): void; - fixed: boolean; + fixed: boolean | undefined; _onEndMoveDelete: any; moveTo(player: any): this; copy(...args: any[]): Card; - clone: Card; + clone: Card | undefined; uncheck(skill: any): void; recheck(skill: any): void; /** diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts index 64d9acd0f..3d3de19f4 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/contents.d.ts @@ -1,4 +1,4 @@ /** * @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise)[]> } */ -export const Contents: SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise)[]>; +export const Contents: SMap<((event: any, trigger: any, player: any) => Promise)[]>; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts index 9f47f32f2..388b39ecc 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/dialog.d.ts @@ -22,16 +22,16 @@ export class Dialog extends HTMLDivElement { * @param {*} [noclick] * @param { boolean } [zoom] */ - add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean): string | HTMLDivElement | import("./player.js").Player[] | import("./card.js").Card[]; - forcebutton: boolean; + add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean | undefined): string | any[] | HTMLDivElement; + forcebutton: boolean | undefined; /** * @param { string } str * @param { boolean } [center] */ - addText(str: string, center?: boolean): this; - addSmall(item: any, noclick: any): string | HTMLDivElement | import("./player.js").Player[] | import("./card.js").Card[]; + addText(str: string, center?: boolean | undefined): this; + addSmall(item: any, noclick: any): string | any[] | HTMLDivElement; addAuto(content: any): void; - open(): this; + open(): this | undefined; _dragtransform: any; close(): this; /** diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts index f075e95cc..7e08ad170 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEvent.d.ts @@ -1,10 +1,10 @@ export class GameEvent { - static initialGameEvent(): import("../index.js").GameEventPromise; + static initialGameEvent(): any; /** * @param {string | GameEvent} [name] * @param {false} [trigger] */ - constructor(name?: string | GameEvent, trigger?: false); + constructor(name?: string | GameEvent | undefined, trigger?: false | undefined); /** * @type { string } */ @@ -37,21 +37,21 @@ export class GameEvent { /** * @type {null|(event: GameEvent)=>any} 这个异步事件对应Promise的resolve函数 **/ - resolve: (event: GameEvent) => any; - _triggered: number; + resolve: ((event: GameEvent) => any) | null; + _triggered: number | undefined; __args: any; /** * @type { Player } */ - source: Player; + source: any; /** * @type { Player } */ - player: Player; + player: any; /** * @type { Player } */ - target: Player; + target: any; /** * @type { Player[] } */ @@ -59,7 +59,7 @@ export class GameEvent { /** * @type { Card } */ - card: Card; + card: any; /** * @type { Card[] } */ @@ -87,7 +87,7 @@ export class GameEvent { /** * @type { Player } */ - customSource: Player; + customSource: any; /** * @type { number } */ @@ -129,23 +129,23 @@ export class GameEvent { * @param {number} [value] * @param {number} [baseValue] */ - addNumber(key: keyof this, value?: number, baseValue?: number): this; + addNumber(key: keyof this, value?: number | undefined, baseValue?: number | undefined): this; /** * @param {keyof this} key * @param {number} [baseValue] */ - decrease(key: keyof this, baseValue?: number): this; + decrease(key: keyof this, baseValue?: number | undefined): this; /** * @param {keyof this} key * @param {number} [baseValue] */ - increase(key: keyof this, baseValue?: number): this; + increase(key: keyof this, baseValue?: number | undefined): this; /** * @param {keyof this} key * @param {number} [value] * @param {number} [baseValue] */ - subtractNumber(key: keyof this, value?: number, baseValue?: number): this; + subtractNumber(key: keyof this, value?: number | undefined, baseValue?: number | undefined): this; /** * @param {Parameters[0]} type * @param {GameEvent} event @@ -157,7 +157,7 @@ export class GameEvent { callHandler(type: Parameters[0], event: GameEvent, option: { state?: 'begin' | 'end'; }): this; - getDefaultHandlerType(): string; + getDefaultHandlerType(): string | undefined; /** * @param {Parameters[0]} [type] * @returns {((event: GameEvent, option: { @@ -170,7 +170,7 @@ export class GameEvent { /** * @param {`on${Capitalize}`} [type] */ - hasHandler(type?: `on${Capitalize}`): any; + hasHandler(type?: `on${Capitalize}` | undefined): any; /** * @overload * @param {...((event: GameEvent, option: { @@ -180,7 +180,7 @@ export class GameEvent { */ pushHandler(...handlers: ((event: GameEvent, option: { state?: 'begin' | 'end'; - }) => void)[]): number; + }) => void)[] | undefined): number; /** * @overload * @param {Parameters[0]} type @@ -191,24 +191,24 @@ export class GameEvent { */ pushHandler(type: Parameters[0], ...handlers: ((event: GameEvent, option: { state?: 'begin' | 'end'; - }) => void)[]): number; + }) => void)[] | undefined): number; changeToZero(): this; - numFixed: boolean; + numFixed: boolean | undefined; finish(): this; putStepCache(key: any, value: any): this; - _stepCache: {}; + _stepCache: {} | undefined; getStepCache(key: any): any; clearStepCache(key: any): this; callFuncUseStepCache(prefix: any, func: any, params: any): any; putTempCache(key1: any, key2: any, value: any): any; - _tempCache: {}; + _tempCache: {} | undefined; getTempCache(key1: any, key2: any): any; - cancel(arg1: any, arg2: any, notrigger: any): import("../index.js").GameEventPromise; + cancel(arg1: any, arg2: any, notrigger: any): any; neutralize(event: any): this; - _neutralized: boolean; + _neutralized: boolean | undefined; _neutralize_event: any; unneutralize(): this; - directHit: boolean; + directHit: boolean | undefined; goto(step: any): this; redo(): this; setHiddenSkill(skill: any): this; @@ -224,7 +224,7 @@ export class GameEvent { * @returns {GameEvent} */ setContents(contents: Function | keyof typeof lib.element.contents): GameEvent; - contents: (string | number | Function) & any[]; + contents: ((string | number | Function) & any[]) | undefined; getLogv(): any; send(): this; resume(): this; @@ -237,20 +237,20 @@ export class GameEvent { * @param {boolean} [includeSelf] 若level不是数字,指定搜索时是否包含事件本身 * @returns {GameEvent|{}|null} */ - getParent(level?: string | number | ((evt: gameEvent) => boolean), forced?: boolean, includeSelf?: boolean): GameEvent | {} | null; + getParent(level?: string | number | ((evt: gameEvent) => boolean) | undefined, forced?: boolean | undefined, includeSelf?: boolean | undefined): GameEvent | {} | null; getTrigger(): any; getRand(name: any): any; - _rand_map: {}; - _rand: number; - insert(content: any, map: any): import("../index.js").GameEventPromise; - insertAfter(content: any, map: any): import("../index.js").GameEventPromise; + _rand_map: {} | undefined; + _rand: number | undefined; + insert(content: any, map: any): any; + insertAfter(content: any, map: any): any; backup(skill: any): this; _backup: any; filterButton: any; selectButton: any; filterTarget: any; selectTarget: any; - ignoreMod: boolean; + ignoreMod: boolean | undefined; filterCard2: any; filterCard: any; filterOk: any; @@ -267,20 +267,20 @@ export class GameEvent { _cardChoice: any; _targetChoice: any; _skillChoice: any; - isMine(): boolean; - isOnline(): boolean; + isMine(): any; + isOnline(): any; notLink(): boolean; isPhaseUsing(player: any): boolean; addTrigger(skills: any, player: any): this; removeTrigger(skills: any, player: any): this; - trigger(name: any): import("../index.js").GameEventPromise; - untrigger(all: boolean, player: any): this; + trigger(name: any): any; + untrigger(all: boolean | undefined, player: any): this; /** * 事件转为Promise化 * * @returns { GameEventPromise } */ - toPromise(): GameEventPromise; + toPromise(): any; #private; } -import { Library as lib } from "../index.js"; +import { lib } from "../index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts index e2d98f1f2..1283b9270 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/gameEventPromise.d.ts @@ -21,13 +21,13 @@ * game.log('等待', player, '摸牌完成执行log'); * ``` */ -export class GameEventPromise extends Promise { +export class GameEventPromise extends Promise { /** * @param { GameEvent | GameEventPromise } arg */ constructor(arg: GameEvent | GameEventPromise); /** 获取原事件对象 */ - toEvent(): import("./gameEvent.js").GameEvent; + toEvent(): any; /** * 在某个异步事件中调试变量信息 * diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts index 1e7572241..3a7c6e9ff 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/nodeWS.d.ts @@ -3,7 +3,7 @@ export class NodeWS { * @param {string | NodeWS} id */ constructor(id: string | NodeWS); - wsid: string; + wsid: string | undefined; send(message: any): void; on(type: any, func: any): void; close(): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts index 71495b209..3564435b7 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/player.d.ts @@ -2,7 +2,7 @@ export class Player extends HTMLDivElement { /** * @param {HTMLDivElement|DocumentFragment} [position] */ - constructor(position?: HTMLDivElement | DocumentFragment); + constructor(position?: HTMLDivElement | DocumentFragment | undefined); build(noclick: any): this; buildNode(): void; /** @type { SMap } */ @@ -143,7 +143,7 @@ export class Player extends HTMLDivElement { */ outCount: number; buildEventListener(noclick: any): void; - noclick: boolean; + noclick: boolean | undefined; /** * @type { number } */ @@ -213,7 +213,7 @@ export class Player extends HTMLDivElement { * @param { number } amount * @param { boolean } [limit] */ - changeFury(amount: number, limit?: boolean): void; + changeFury(amount: number, limit?: boolean | undefined): void; /** * version 1.7 * @@ -290,35 +290,35 @@ export class Player extends HTMLDivElement { /** * 让一名角色明置一些手牌 */ - addShownCards(...args: any[]): import("../index.js").GameEventPromise; - hideShownCards(...args: any[]): import("../index.js").GameEventPromise; + addShownCards(...args: any[]): any; + hideShownCards(...args: any[]): any; /** * 获取角色所有的明置手牌 */ - getShownCards(): import("./card.js").Card[]; + getShownCards(): any[]; /** * 获取该角色被other所知的牌 * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - getKnownCards(other?: Player, filter?: (card: Card) => boolean): import("./card.js").Card[]; + getKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): any[]; /** * 判断此角色的手牌是否已经被看光了 * @param { Player } [other] */ - isAllCardsKnown(other?: Player): boolean; + isAllCardsKnown(other?: Player | undefined): boolean; /** * 判断此角色是否有被知的牌。 * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - hasKnownCards(other?: Player, filter?: (card: Card) => boolean): boolean; + hasKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): boolean; /** * 数此角色被知道的牌 * @param { Player } [other] * @param { (card: Card) => boolean } [filter] */ - countKnownCards(other?: Player, filter?: (card: Card) => boolean): number; + countKnownCards(other?: Player | undefined, filter?: ((card: any) => boolean) | undefined): number; /** * Execute the delay card effect * @@ -329,14 +329,14 @@ export class Player extends HTMLDivElement { * @param {*} judge2 * @returns */ - executeDelayCardEffect(card: Card | string, target: Player, judge: any, judge2: any, ...args: any[]): import("../index.js").GameEventPromise; + executeDelayCardEffect(card: Card | string, target: Player, judge: any, judge2: any, ...args: any[]): any; /** * Check if the card does not count toward hand limit * * 检测此牌是否不计入手牌上限 * @param { Card } card */ - canIgnoreHandcard(card: Card): boolean; + canIgnoreHandcard(card: any): boolean; /** * Gift * @@ -344,7 +344,7 @@ export class Player extends HTMLDivElement { * @param { Card | Card[] } cards * @param { Player } target */ - gift(cards: Card | Card[], target: Player, ...args: any[]): import("../index.js").GameEventPromise; + gift(cards: Card | Card[], target: Player, ...args: any[]): any; /** * Check if the player can gift the card * @@ -353,7 +353,7 @@ export class Player extends HTMLDivElement { * @param { Player } target * @param { boolean } [strict] */ - canGift(card: Card, target: Player, strict?: boolean): boolean; + canGift(card: any, target: Player, strict?: boolean | undefined): boolean; /** * Check if the player refuses gifts * @@ -361,7 +361,7 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } player */ - refuseGifts(card: Card, player: Player): boolean; + refuseGifts(card: any, player: Player): boolean; /** * Gift AI related * @@ -369,19 +369,19 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } target */ - getGiftAIResultTarget(card: Card, target: Player): number; + getGiftAIResultTarget(card: any, target: Player): number; /** * @param { Card } card * @param { Player } target */ - getGiftEffect(card: Card, target: Player): number; + getGiftEffect(card: any, target: Player): number; /** * 重铸 * @param { Card | Card[] } cards * @param { (player: Player, cards: Card[]) => any } [recastingLose] * @param { (player: Player, cards: Card[]) => any } [recastingGain] */ - recast(cards: Card | Card[], recastingLose?: (player: Player, cards: Card[]) => any, recastingGain?: (player: Player, cards: Card[]) => any, ...args: any[]): import("../index.js").GameEventPromise; + recast(cards: Card | Card[], recastingLose?: ((player: Player, cards: Card[]) => any) | undefined, recastingGain?: ((player: Player, cards: Card[]) => any) | undefined, ...args: any[]): any; /** * Check if the player can recast the card * @@ -390,7 +390,7 @@ export class Player extends HTMLDivElement { * @param { Player } [source] * @param { boolean } [strict] */ - canRecast(card: Card, source?: Player, strict?: boolean): boolean; + canRecast(card: any, source?: Player | undefined, strict?: boolean | undefined): boolean; /** * 判断一名角色的某个区域是否被废除 * @@ -398,39 +398,39 @@ export class Player extends HTMLDivElement { * @param { string | number } [type] * @returns { boolean } */ - hasDisabledSlot(type?: string | number): boolean; + hasDisabledSlot(type?: string | number | undefined): boolean; /** * 判断一名角色的某个区域被废除的数量 * * 用法同 {@link hasDisabledSlot} * @param { string | number } [type] */ - countDisabledSlot(type?: string | number): number; + countDisabledSlot(type?: string | number | undefined): number; /** * 判断一名角色是否有某个装备栏空着 * @param { string | number } [type] * @returns { boolean } */ - hasEmptySlot(type?: string | number): boolean; + hasEmptySlot(type?: string | number | undefined): boolean; /** * 判断一名角色的某个装备栏空位的数量 * @param { string | number } [type] */ - countEmptySlot(type?: string | number): number; + countEmptySlot(type?: string | number | undefined): number; /** * 判断一名角色是否有可以用于装备新装备牌的区域(排除金箍棒和六龙等“不可被替换装备”) * * 用法同 {@link hasEnabledSlot} * @param { string | number } [type] */ - hasEquipableSlot(type?: string | number): boolean; + hasEquipableSlot(type?: string | number | undefined): boolean; /** * 统计一名角色有多少个可以用于装备新的装备牌的区域 * * 用法同 {@link hasEnabledSlot} * @param { string | number } [type] */ - countEquipableSlot(type?: string | number): number; + countEquipableSlot(type?: string | number | undefined): number; /** * 判断一名角色是否拥有未被废除的某个区域 * @@ -438,14 +438,14 @@ export class Player extends HTMLDivElement { * @param { string | number } [type] * @returns { boolean } */ - hasEnabledSlot(type?: string | number): boolean; + hasEnabledSlot(type?: string | number | undefined): boolean; /** * 判断一名角色的某个区域未被废除的数量 * * 用法同 {@link hasEnabledSlot} * @param { string | number } [type] */ - countEnabledSlot(type?: string | number): number; + countEnabledSlot(type?: string | number | undefined): number; /** * 获取一名角色装备区内某种类型的装备牌 * @@ -459,19 +459,19 @@ export class Player extends HTMLDivElement { * * 参数:废除来源角色(不写默认当前事件角色),废除区域(数字/区域字符串/数组,可以写多个,重复废除) */ - disableEquip(...args: any[]): import("../index.js").GameEventPromise; + disableEquip(...args: any[]): any; /** * 新的恢复装备区 * * 参数:恢复来源角色(不写默认当前事件角色),恢复区域(数字/区域字符串/数组,可以写多个,重复恢复) */ - enableEquip(...args: any[]): import("../index.js").GameEventPromise; + enableEquip(...args: any[]): any; /** * 新的扩展装备区 * * 参数:扩展来源角色(不写默认当前事件角色),扩展区域(数字/区域字符串/数组,可以写多个,重复扩展) */ - expandEquip(...args: any[]): import("../index.js").GameEventPromise; + expandEquip(...args: any[]): any; /** * 判断判定区是否被废除 */ @@ -480,18 +480,18 @@ export class Player extends HTMLDivElement { * 同步显示扩展装备区状态 * @param { SMap } [map] */ - $syncExpand(map?: SMap): void; + $syncExpand(map?: SMap | undefined): void; /** * 同步装备区废除牌显示状态 * @param { SMap } [map] */ - $syncDisable(map?: SMap): void; + $syncDisable(map?: SMap | undefined): void; /** * @param { string | Card | VCard | CardBaseUIData } name * @param { boolean } [replace] * @returns */ - canEquip(name: string | Card | VCard | CardBaseUIData, replace?: boolean): boolean; + canEquip(name: string | Card | VCard | CardBaseUIData, replace?: boolean | undefined): boolean; /** * @deprecated */ @@ -512,7 +512,7 @@ export class Player extends HTMLDivElement { * @deprecated */ $enableEquip(): void; - chooseToDebate(...args: any[]): import("../index.js").GameEventPromise; + chooseToDebate(...args: any[]): any; /** * 向target发起协力 * @param { Player } target @@ -520,7 +520,7 @@ export class Player extends HTMLDivElement { * @param {*} reason */ cooperationWith(target: Player, type: any, reason: any): void; - chooseCooperationFor(...args: any[]): import("../index.js").GameEventPromise; + chooseCooperationFor(...args: any[]): any; checkCooperationStatus(target: any, reason: any): boolean; removeCooperation(info: any): void; /** @@ -564,7 +564,7 @@ export class Player extends HTMLDivElement { * @param { string } skill */ removeSkillBlocker(skill: string): void; - loseToSpecial(cards: any, tag: any, target: any): import("../index.js").GameEventPromise; + loseToSpecial(cards: any, tag: any, target: any): any; /** * @param { Card | Card[] } cards * @param { string } tag @@ -574,7 +574,7 @@ export class Player extends HTMLDivElement { * @param { string } tag * @param { Card[] } [cards] */ - removeGaintag(tag: string, cards?: Card[]): void; + removeGaintag(tag: string, cards?: any[] | undefined): void; /** * @param { Player } target */ @@ -583,31 +583,31 @@ export class Player extends HTMLDivElement { * @param { Card } card * @param { Player } target */ - canSaveCard(card: Card, target: Player): any; + canSaveCard(card: any, target: Player): any; /** * @param { String } from * @param { String } to * @returns { GameEventPromise } */ - reinitCharacter(from: string, to: string, log?: boolean): GameEventPromise; + reinitCharacter(from: string, to: string, log?: boolean): any; /** * @param { String[] } newPairs * @returns { GameEventPromise } */ - changeCharacter(newPairs: string[], log?: boolean): GameEventPromise; + changeCharacter(newPairs: string[], log?: boolean): any; /** * @param { 0 | 1 | 2 } num * @param { false } [log] */ - showCharacter(num: 0 | 1 | 2, log?: false, ...args: any[]): import("../index.js").GameEventPromise; + showCharacter(num: 0 | 1 | 2, log?: false | undefined, ...args: any[]): any; /** * @param { 0 | 1 | 2 } num * @param { false } [log] */ - $showCharacter(num: 0 | 1 | 2, log?: false): void; - chooseToPlayBeatmap(beatmap: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseToMove(...args: any[]): import("../index.js").GameEventPromise; - chooseToGuanxing(num: any): import("../index.js").GameEventPromise; + $showCharacter(num: 0 | 1 | 2, log?: false | undefined): void; + chooseToPlayBeatmap(beatmap: any, ...args: any[]): any; + chooseToMove(...args: any[]): any; + chooseToGuanxing(num: any): any; /** * @param { Player } target * @param { string } name @@ -630,12 +630,12 @@ export class Player extends HTMLDivElement { * @param { string } [nature] * @param { string } [popname] */ - tryCardAnimate(card: Card, name: string, nature?: string, popname?: string, ...args: any[]): void; + tryCardAnimate(card: any, name: string, nature?: string | undefined, popname?: string | undefined, ...args: any[]): void; /** * @param { string } name * @param { string } type */ - hasUsableCard(name: string, type: string): boolean; + hasUsableCard(name: string, type: string): true | undefined; /** * @param { Player } to * @returns { boolean } @@ -652,7 +652,7 @@ export class Player extends HTMLDivElement { * * @param { boolean } [raw] */ - getHp(raw?: boolean): number; + getHp(raw?: boolean | undefined): number; /** * Set “raw” to true to get the player's raw damaged HP instead. * @@ -660,45 +660,45 @@ export class Player extends HTMLDivElement { * * @param { boolean } [raw] */ - getDamagedHp(raw?: boolean): number; + getDamagedHp(raw?: boolean | undefined): number; /** * @param { string } group */ - changeGroup(group: string, log: any, broadcast: any, ...args: any[]): import("../index.js").GameEventPromise; + changeGroup(group: string, log: any, broadcast: any, ...args: any[]): any; /** * @param { Player } target */ - chooseToDuiben(target: Player): import("../index.js").GameEventPromise; + chooseToDuiben(target: Player): any; /** * @param { Player } target */ - chooseToPSS(target: Player): import("../index.js").GameEventPromise; - chooseToEnable(...args: any[]): import("../index.js").GameEventPromise; - chooseToDisable(...args: any[]): import("../index.js").GameEventPromise; + chooseToPSS(target: Player): any; + chooseToEnable(...args: any[]): any; + chooseToDisable(...args: any[]): any; /** * @param { boolean } [notmeisok] */ - isPhaseUsing(notmeisok?: boolean): boolean; + isPhaseUsing(notmeisok?: boolean | undefined): boolean; /** * @param { Player } target */ - swapEquip(target: Player): import("../index.js").GameEventPromise; + swapEquip(target: Player): any; /** * @param { Player } target * @param { boolean } [goon] * @param { boolean} [bool] */ - canCompare(target: Player, goon?: boolean, bool?: boolean): boolean; + canCompare(target: Player, goon?: boolean | undefined, bool?: boolean | undefined): boolean; $disableJudge(): void; $enableJudge(): void; - disableJudge(): import("../index.js").GameEventPromise; - enableJudge(): import("../index.js").GameEventPromise; - init(character: any, character2: any, skill: any, update: any): this; + disableJudge(): any; + enableJudge(): any; + init(character: any, character2: any, skill: any, update: any): this | undefined; skin: { name: any; name2: any; - }; - singleHp: boolean; + } | undefined; + singleHp: boolean | undefined; $init(character: any, character2: any): this; /** * 换肤换音:想要支持某个武将更换皮肤,必须在lib.character.characterSubstitute中存在该武将的id(以下以name代指武将id,character代指换肤图片名) @@ -717,17 +717,17 @@ export class Player extends HTMLDivElement { avatar: any; uninitOL(): void; initRoom(info: any, info2: any): this; - serving: boolean; - roomempty: boolean; - roomfull: boolean; - roomgaming: boolean; + serving: boolean | undefined; + roomempty: boolean | undefined; + roomfull: boolean | undefined; + roomgaming: boolean | undefined; version: any; key: any; config: any; reinit2(newPairs: any): void; $reinit12(newPairs: any): void; $reinit21(newPairs: any): void; - reinit(from: any, to: any, maxHp: any, online: any): this; + reinit(from: any, to: any, maxHp: any, online: any): this | undefined; $reinit(from: any, to: any, maxHp: any, online: any): void; uninit(): this; $uninit(): void; @@ -737,13 +737,13 @@ export class Player extends HTMLDivElement { changeSeat(position: any, video: any): void; send(...args: any[]): this; getId(): this; - playerid: string; + playerid: string | undefined; throwEmotion(target: any, emotion: any, rotate: any): void; emotion(pack: any, id: any): void; chat(str: any): void; say(str: any): void; showGiveup(): void; - _giveUp: boolean; + _giveUp: boolean | undefined; applySkills(skills: any): void; getState(): { hp: number; @@ -754,22 +754,22 @@ export class Player extends HTMLDivElement { name: string; name1: string; name2: string; - handcards: import("./card.js").Card[]; - gaintag: any[]; - equips: import("./card.js").Card[]; - judges: import("./card.js").Card[]; - specials: import("./card.js").Card[]; - expansions: import("./card.js").Card[]; - expansion_gaintag: any[]; + handcards: any[]; + gaintag: never[]; + equips: any[]; + judges: any[]; + specials: any[]; + expansions: any[]; + expansion_gaintag: never[]; disableJudge: boolean; disabledSlots: SMap; expandedSlots: SMap; - views: any[]; + views: never[]; position: number; hujia: number; side: any; identityShown: any; - identityNode: string[]; + identityNode: (string | undefined)[]; identity: any; dead: boolean; linked: boolean; @@ -801,8 +801,8 @@ export class Player extends HTMLDivElement { num(arg1: any, arg2: any, arg3: any): any; line(target: any, config: any): void; line2(targets: any, config: any): void; - getNext(): this; - getPrevious(): this; + getNext(): this | null; + getPrevious(): this | null; countUsed(card: any, type: any): number; getCacheKey(): string; countSkill(skill: any): any; @@ -812,13 +812,13 @@ export class Player extends HTMLDivElement { * @param { string | Record | ((card: Card) => boolean) } [arg2] * @returns { Iterable } */ - iterableGetCards(arg1?: string, arg2?: string | Record | ((card: Card) => boolean)): Iterable; + iterableGetCards(arg1?: string | undefined, arg2?: string | Record | ((card: any) => boolean) | undefined): Iterable; /** * @param { string } [arg1='h'] * @param { string | Record | ((card: Card) => boolean) } [arg2] * @returns { Card[] } */ - getCards(arg1?: string, arg2?: string | Record | ((card: Card) => boolean)): Card[]; + getCards(arg1?: string | undefined, arg2?: string | Record | ((card: any) => boolean) | undefined): Card[]; iterableGetDiscardableCards(player: any, arg1: any, arg2: any): Generator; getDiscardableCards(player: any, arg1: any, arg2: any): any[]; iterableGetGainableCards(player: any, arg1: any, arg2: any): Generator; @@ -831,100 +831,100 @@ export class Player extends HTMLDivElement { getOriginalSkills(): any[]; getModableSkills(): any[]; getSkills(arg2: any, arg3: any, arg4: any): any[]; - get(arg1: any, arg2: any, arg3: any, arg4: any, ...args: any[]): any[] | ChildNode; + get(arg1: any, arg2: any, arg3: any, arg4: any, ...args: any[]): any[] | ChildNode | undefined; syncStorage(skill: any): void; syncSkills(): void; playerfocus(time: any): this; setIdentity(identity: any, nature: any): this; - insertPhase(skill: any, insert: any): import("../index.js").GameEventPromise; - insertEvent(name: any, content: any, arg: any): import("../index.js").GameEventPromise; - phase(skill: any): import("../index.js").GameEventPromise; - phaseZhunbei(): import("../index.js").GameEventPromise; - phaseJudge(): import("../index.js").GameEventPromise; - phaseDraw(): import("../index.js").GameEventPromise; - phaseUse(): import("../index.js").GameEventPromise; - phaseDiscard(): import("../index.js").GameEventPromise; - phaseJieshu(): import("../index.js").GameEventPromise; - chooseToUse(use: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseToRespond(...args: any[]): import("../index.js").GameEventPromise; - chooseToGive(...args: any[]): import("../index.js").GameEventPromise; - chooseToDiscard(...args: any[]): import("../index.js").GameEventPromise; - chooseToCompare(target: any, check: any, ...args: any[]): import("../index.js").GameEventPromise; + insertPhase(skill: any, insert: any): any; + insertEvent(name: any, content: any, arg: any): any; + phase(skill: any): any; + phaseZhunbei(): any; + phaseJudge(): any; + phaseDraw(): any; + phaseUse(): any; + phaseDiscard(): any; + phaseJieshu(): any; + chooseToUse(use: any, ...args: any[]): any; + chooseToRespond(...args: any[]): any; + chooseToGive(...args: any[]): any; + chooseToDiscard(...args: any[]): any; + chooseToCompare(target: any, check: any, ...args: any[]): any; chooseSkill(target: any, ...args: any[]): void; - discoverCard(list: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseCardButton(...args: any[]): import("../index.js").GameEventPromise; - chooseVCardButton(...args: any[]): import("../index.js").GameEventPromise; - chooseButton(...args: any[]): import("../index.js").GameEventPromise; - chooseButtonOL(list: any, callback: any, ai: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseCardOL(...args: any[]): import("../index.js").GameEventPromise; - chooseCard(choose: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseUseTarget(...args: any[]): import("../index.js").GameEventPromise; - chooseTarget(...args: any[]): import("../index.js").GameEventPromise; - chooseCardTarget(choose: any, ...args: any[]): import("../index.js").GameEventPromise; - chooseControlList(...args: any[]): import("../index.js").GameEventPromise; - chooseControl(...args: any[]): import("../index.js").GameEventPromise; - chooseBool(...args: any[]): import("../index.js").GameEventPromise; - chooseDrawRecover(...args: any[]): import("../index.js").GameEventPromise; - choosePlayerCard(...args: any[]): import("../index.js").GameEventPromise; - discardPlayerCard(...args: any[]): import("../index.js").GameEventPromise; - gainPlayerCard(...args: any[]): import("../index.js").GameEventPromise; - showHandcards(str: any, ...args: any[]): import("../index.js").GameEventPromise; - showCards(cards: any, str: any, ...args: any[]): import("../index.js").GameEventPromise; - viewCards(str: any, cards: any, ...args: any[]): import("../index.js").GameEventPromise; - viewHandcards(target: any): false | import("../index.js").GameEventPromise; + discoverCard(list: any, ...args: any[]): any; + chooseCardButton(...args: any[]): any; + chooseVCardButton(...args: any[]): any; + chooseButton(...args: any[]): any; + chooseButtonOL(list: any, callback: any, ai: any, ...args: any[]): any; + chooseCardOL(...args: any[]): any; + chooseCard(choose: any, ...args: any[]): any; + chooseUseTarget(...args: any[]): any; + chooseTarget(...args: any[]): any; + chooseCardTarget(choose: any, ...args: any[]): any; + chooseControlList(...args: any[]): any; + chooseControl(...args: any[]): any; + chooseBool(...args: any[]): any; + chooseDrawRecover(...args: any[]): any; + choosePlayerCard(...args: any[]): any; + discardPlayerCard(...args: any[]): any; + gainPlayerCard(...args: any[]): any; + showHandcards(str: any, ...args: any[]): any; + showCards(cards: any, str: any, ...args: any[]): any; + viewCards(str: any, cards: any, ...args: any[]): any; + viewHandcards(target: any): any; canMoveCard(withatt: any, nojudge: any, ...args: any[]): boolean; - moveCard(...args: any[]): import("../index.js").GameEventPromise; - useResult(result: any, event: any): import("../index.js").GameEventPromise; - useCard(...args: any[]): import("../index.js").GameEventPromise; - useSkill(...args: any[]): import("../index.js").GameEventPromise; - drawTo(num: any, args: any): import("../index.js").GameEventPromise; - draw(...args: any[]): import("../index.js").GameEventPromise; - randomDiscard(...args: any[]): import("./card.js").Card[]; + moveCard(...args: any[]): any; + useResult(result: any, event: any): any; + useCard(...args: any[]): any; + useSkill(...args: any[]): any; + drawTo(num: any, args: any): any; + draw(...args: any[]): any; + randomDiscard(...args: any[]): any[]; randomGain(...args: any[]): any; - discard(...args: any[]): import("../index.js").GameEventPromise; - loseToDiscardpile(...args: any[]): import("../index.js").GameEventPromise; - respond(...args: any[]): import("../index.js").GameEventPromise; - swapHandcards(target: any, cards1: any, cards2: any): import("../index.js").GameEventPromise; + discard(...args: any[]): any; + loseToDiscardpile(...args: any[]): any; + respond(...args: any[]): any; + swapHandcards(target: any, cards1: any, cards2: any): any; directequip(cards: any): void; $addToExpansion(cards: any, broadcast: any, gaintag: any): this; directgain(cards: any, broadcast: any, gaintag: any): this; directgains(cards: any, broadcast: any, gaintag: any): this; - gainMultiple(targets: any, position: any): import("../index.js").GameEventPromise; - gain(...args: any[]): import("../index.js").GameEventPromise; - addToExpansion(...args: any[]): import("../index.js").GameEventPromise; + gainMultiple(targets: any, position: any): any; + gain(...args: any[]): any; + addToExpansion(...args: any[]): any; give(cards: any, target: any, visible: any): any; - lose(...args: any[]): import("../index.js").GameEventPromise; - damage(...args: any[]): import("../index.js").GameEventPromise; - recover(...args: any[]): import("../index.js").GameEventPromise; - doubleDraw(): import("../index.js").GameEventPromise; - loseHp(num: any): import("../index.js").GameEventPromise; - loseMaxHp(...args: any[]): import("../index.js").GameEventPromise; - gainMaxHp(...args: any[]): import("../index.js").GameEventPromise; - changeHp(num: any, popup: any): import("../index.js").GameEventPromise; - changeHujia(num: any, type: any, limit: any): import("../index.js").GameEventPromise; + lose(...args: any[]): any; + damage(...args: any[]): any; + recover(...args: any[]): any; + doubleDraw(): any; + loseHp(num: any): any; + loseMaxHp(...args: any[]): any; + gainMaxHp(...args: any[]): any; + changeHp(num: any, popup: any): any; + changeHujia(num: any, type: any, limit: any): any; getBuff(...args: any[]): this; getDebuff(...args: any[]): this; - dying(reason: any): import("../index.js").GameEventPromise; - die(reason: any): import("../index.js").GameEventPromise; + dying(reason: any): any; + die(reason: any): any; revive(hp: any, log: any): void; isMad(): boolean; goMad(end: any): void; unMad(): void; tempHide(): void; addExpose(num: any): this; - equip(card: any, draw: any): import("../index.js").GameEventPromise; - addJudge(card: any, cards: any): import("../index.js").GameEventPromise; + equip(card: any, draw: any): any; + addJudge(card: any, cards: any): any; /** * @returns { boolean } */ canAddJudge(card: any): boolean; addJudgeNext(card: any, unlimited: any): void; - judge(...args: any[]): import("../index.js").GameEventPromise; - turnOver(bool: any): import("../index.js").GameEventPromise; + judge(...args: any[]): any; + turnOver(bool: any): any; out(skill: any): void; - outSkills: any[]; + outSkills: any[] | undefined; in(skill: any): void; - link(bool: any): import("../index.js").GameEventPromise; + link(bool: any): any; skip(name: any): void; wait(callback: any): void; unwait(result: any): void; @@ -940,7 +940,7 @@ export class Player extends HTMLDivElement { hideTimer(): void; markAuto(name: any, info: any): void; unmarkAuto(name: any, info: any): void; - getExpansions(tag: any): import("./card.js").Card[]; + getExpansions(tag: any): any[]; countExpansions(tag: any): number; hasExpansions(tag: any): boolean; setStorage(name: any, value: any, mark: any): any; @@ -955,7 +955,7 @@ export class Player extends HTMLDivElement { markSkill(name: any, info: any, card: any, nobroadcast: any): this; unmarkSkill(name: any, nobroadcast: any): this; markSkillCharacter(id: any, target: any, name: any, content: any, nobroadcast: any): this; - markCharacter(name: any, info: any, learn: any, learn2: any): HTMLDivElement; + markCharacter(name: any, info: any, learn: any, learn2: any): HTMLDivElement | undefined; mark(name: any, info: any, skill: any): any; unmark(name: any, info: any): void; addLink(): void; @@ -966,26 +966,26 @@ export class Player extends HTMLDivElement { getUseValue(card: any, distance: any, includecard: any): number; addSubPlayer(cfg: any): string; removeSubPlayer(name: any): void; - callSubPlayer(...args: any[]): import("../index.js").GameEventPromise; - toggleSubPlayer(...args: any[]): import("../index.js").GameEventPromise; - exitSubPlayer(remove: any): import("../index.js").GameEventPromise; + callSubPlayer(...args: any[]): any; + toggleSubPlayer(...args: any[]): any; + exitSubPlayer(remove: any): any; getSubPlayers(tag: any): any[]; addSkillTrigger(skills: any, hidden: any, triggeronly: any): this; - _hookTrigger: any[]; - addSkillLog(skill: any): this; - removeSkillLog(skill: any, popup: any): this; + _hookTrigger: any[] | undefined; + addSkillLog(skill: any): this | undefined; + removeSkillLog(skill: any, popup: any): this | undefined; addInvisibleSkill(skill: any): void; removeInvisibleSkill(skill: any, ...args: any[]): any; - addSkills(skill: any): import("../index.js").GameEventPromise; - removeSkills(skill: any): import("../index.js").GameEventPromise; - changeSkills(addSkill?: any[], removeSkill?: any[]): import("../index.js").GameEventPromise; + addSkills(skill: any): any; + removeSkills(skill: any): any; + changeSkills(addSkill?: any[], removeSkill?: any[]): any; addSkill(skill: any, checkConflict: any, nobroadcast: any, addToSkills: any): any; - addAdditionalSkills(skill: any, skillsToAdd: any, keep: any): import("../index.js").GameEventPromise; + addAdditionalSkills(skill: any, skillsToAdd: any, keep: any): any; addAdditionalSkill(skill: any, skillsToAdd: any, keep: any): this; $removeAdditionalSkills(skill: any, target: any): void; getRemovableAdditionalSkills(skill: any, target: any): string[]; removeAdditionalSkill(skill: any, target: any): this; - removeAdditionalSkills(skill: any, target: any): import("../index.js").GameEventPromise; + removeAdditionalSkills(skill: any, target: any): any; awakenSkill(skill: any, nounmark: any): this; restoreSkill(skill: any, nomark: any): this; disableSkill(skill: any, skills: any): this; @@ -995,13 +995,29 @@ export class Player extends HTMLDivElement { removeEquipTrigger(card: any): this; removeSkillTrigger(skills: any, triggeronly: any): this; removeSkill(skill: any, ...args: any[]): any; - addTempSkills(skillsToAdd: any, expire: any): import("../index.js").GameEventPromise; + addTempSkills(skillsToAdd: any, expire: any): any; addTempSkill(skill: any, expire: any, checkConflict: any): any; tempBanSkill(skill: any, expire: any, log: any): any; isTempBanned(skill: any): boolean; attitudeTo(target: any): any; clearSkills(all: any, ...args: any[]): string[]; checkConflict(skill: any): void; + /** + * 快速获取一名角色当前轮次/前X轮次的历史 + * + * 第一个参数填写获取的动作 + * + * 第二个参数填写获取历史的筛选条件 + * + * 第三个参数填写数字(不填默认为0),获取上X轮的历史(X为0则为本轮历史),第四个参数若为true,则获取从上X轮开始至现在 + * + * 第四个参数若为true,则获取从上X轮开始至现在所有符合条件的历史 + * + * 第五个参数填写event,获取此event之前所有符合条件的历史 + * + * @param { string | function | number | boolean | object } map + */ + getRoundHistory(key: any, filter: any, num: any, keep: any, last: any): any[]; getHistory(key: any, filter: any, last: any): any; checkHistory(key: any, filter: any, last: any): void; hasHistory(key: any, filter: any, last: any): any; @@ -1013,14 +1029,14 @@ export class Player extends HTMLDivElement { getStat(key: any): any; getLastStat(key: any): any; queue(time: any): void; - queueTimeout: NodeJS.Timeout; + queueTimeout: NodeJS.Timeout | undefined; getCardUsable(card: any, pure: any): number; getAttackRange(raw: any): number; getEquipRange(cards: any): number; getGlobalFrom(): number; getGlobalTo(): number; getHandcardLimit(): number; - getEnemies(func: any): Player[]; + getEnemies(func: any): any[] | undefined; getFriends(func: any): any[]; isEnemyOf(...args: any[]): boolean; isFriendOf(player: any): boolean; @@ -1065,13 +1081,13 @@ export class Player extends HTMLDivElement { hasUnknown(num: any): boolean; isUnknown(player: any): boolean; hasWuxie(info: any): boolean; - hasSha(respond: any, noauto: any): boolean; - hasShan(respond: any): boolean; + hasSha(respond: any, noauto: any): true | undefined; + hasShan(respond: any): true | undefined; mayHaveSha(viewer: any, type: any, ignore: any, rvt: any): number | boolean; mayHaveShan(viewer: any, type: any, ignore: any, rvt: any): number | boolean; hasCard(name: any, position: any): boolean; - getEquip(name: any): import("./card.js").Card; - getJudge(name: any): ChildNode; + getEquip(name: any): any; + getJudge(name: any): ChildNode | null; $drawAuto(cards: any, target: any): void; $draw(num: any, init: any, config: any): void; $compareMultiple(card1: any, targets: any, cards: any): void; @@ -1083,12 +1099,12 @@ export class Player extends HTMLDivElement { $throwxy(card: any, left: any, top: any): any; $throwxy2(card: any, left: any, top: any, trans: any, flipx: any, flipy: any, ...args: any[]): any; throwDice(num: any): void; - $giveAuto(card: any, player: any, ...args: any[]): any; + $giveAuto(card: any, player: any, ...args: any[]): void; $give(card: any, player: any, log: any, init: any): void; $handleEquipChange(): void; $equip(card: any): this; $gain(card: any, log: any, init: any): void; - $gain2(cards: any, log: any): boolean; + $gain2(cards: any, log: any): true | undefined; $skill(name: any, type: any, color: any, avatar: any): void; $fire(): void; $thunder(): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts index fb220de8c..d4dd547d9 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/element/vcard.d.ts @@ -5,7 +5,7 @@ export class VCard { * @param { string } [name] * @param { string } [nature] */ - constructor(suitOrCard?: any, numberOrCards?: number | Card[], name?: string, nature?: string); + constructor(suitOrCard?: any, numberOrCards?: number | any[] | undefined, name?: string | undefined, nature?: string | undefined); /** * @type {string} */ @@ -22,7 +22,7 @@ export class VCard { * @type {string} */ nature: string; - color: string; + color: string | undefined; /** * @type { boolean } */ @@ -43,7 +43,7 @@ export class VCard { /** * @param { Player } player */ - hasNature(nature: any, player: Player): boolean; + hasNature(nature: any, player: any): boolean; getCacheKey(): string; hasGaintag(tag: any): any; } diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts index 225927a56..c78f21927 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/index.d.ts @@ -1,51 +1,51 @@ /// -export class Library extends Uninstantable { - static configprefix: string; - static versionOL: number; - static updateURLS: { +export class Library { + configprefix: string; + versionOL: number; + updateURLS: { coding: string; github: string; }; - static updateURL: string; - static mirrorURL: string; - static hallURL: string; - static assetURL: string; - static userAgent: string; - static characterDefaultPicturePath: string; - static compatibleEdition: boolean; - static changeLog: any[]; - static updates: any[]; - static canvasUpdates: any[]; + updateURL: string; + mirrorURL: string; + hallURL: string; + assetURL: string; + userAgent: string; + characterDefaultPicturePath: string; + compatibleEdition: boolean; + changeLog: any[]; + updates: any[]; + canvasUpdates: any[]; /** * @type { Video[] } */ - static video: Video[]; - static skilllist: any[]; - static connectBanned: any[]; - static characterIntro: {}; - static characterTitle: {}; - static characterPack: {}; - static characterFilter: {}; - static characterSort: {}; - static characterReplace: {}; - static characterSubstitute: {}; - static characterInitFilter: {}; - static characterGuozhanFilter: string[]; - static dynamicTranslate: {}; - static cardPack: {}; - static cardPackInfo: {}; + video: Video[]; + skilllist: any[]; + connectBanned: any[]; + characterIntro: {}; + characterTitle: {}; + characterPack: {}; + characterFilter: {}; + characterSort: {}; + characterReplace: {}; + characterSubstitute: {}; + characterInitFilter: {}; + characterGuozhanFilter: string[]; + dynamicTranslate: {}; + cardPack: {}; + cardPackInfo: {}; /** * @type { SMap } */ - static skin: SMap; - static onresize: any[]; - static onphase: any[]; - static onwash: any[]; - static onover: any[]; - static ondb: any[]; - static ondb2: any[]; - static chatHistory: any[]; - static emotionList: { + skin: SMap; + onresize: any[]; + onphase: any[]; + onwash: any[]; + onover: any[]; + ondb: any[]; + ondb2: any[]; + chatHistory: any[]; + emotionList: { xiaowu_emotion: number; xiaokuo_emotion: number; shibing_emotion: number; @@ -55,37 +55,77 @@ export class Library extends Uninstantable { xiaotao_emotion: number; xiaojiu_emotion: number; }; - static animate: { + animate: { skill: {}; card: {}; }; - static onload: any[]; - static onload2: any[]; - static onprepare: any[]; - static arenaReady: any[]; - static onfree: any[]; - static inpile: any[]; - static inpile_nature: any[]; - static extensions: any[]; - static extensionPack: {}; - static cardType: {}; - static hook: { + onload: any[]; + onload2: any[]; + onprepare: any[]; + arenaReady: any[]; + onfree: any[]; + inpile: any[]; + inpile_nature: any[]; + extensions: any[]; + extensionPack: {}; + cardType: {}; + hook: { globalskill: {}; }; /** * @type { Player | undefined } */ - static tempSortSeat: Player | undefined; + tempSortSeat: Player | undefined; /** - * @returns { never } - */ - static typeAnnotation(): never; + * @type { 'android' | 'ios' | undefined } + */ + device: 'android' | 'ios' | undefined; + /** + * @type { string } + */ + version: string; + /** + * @type { Videos[] } + */ + videos: Videos[]; + /** + * @type { { + * fs: typeof import("fs"), + * path: typeof import("path"), + * debug: () => void, + * clients: Element.Client[], + * banned:[], + * observing:[], + * torespond:{}, + * torespondtimeout:{}, + * } } + */ + node: { + fs: typeof import("fs"); + path: typeof import("path"); + debug: () => void; + clients: Element.Client[]; + banned: []; + observing: []; + torespond: {}; + torespondtimeout: {}; + }; + /** + * @type { { [key: string]: string } } + */ + playerOL: { + [key: string]: string; + }; + /** + * @type { IDBRequest } + */ + db: IDBRequest; /** * 你可以往这里加入{钩子名:函数数组},并在数组里增加你的自定义函数 * 这样当某个地方调用game.callHook(钩子名,[...函数参数])时,就会按顺序将对应数组中的每个函数运行一遍(传参为callHook的第二个参数)。 * 你可以将hook机制类比为event.trigger(),但是这里只能放同步代码 */ - static hooks: Readonly<{ + hooks: Readonly<{ checkBegin: import("./assembly/index.js").NonameAssembly; checkCard: import("./assembly/index.js").NonameAssembly; checkTarget: import("./assembly/index.js").NonameAssembly; @@ -120,7 +160,7 @@ export class Library extends Uninstantable { * // 从某个角落向channel发消息,若无消息接收则等待 * await channel.send(item); */ - static channel: typeof Channel; + channel: typeof Channel; /** * **无名杀消息推送库** * @@ -146,12 +186,12 @@ export class Library extends Uninstantable { * // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅 * lib.announce.unsubscribe("skinChange", method); */ - static announce: Announce; - static objectURL: Map; - static hookmap: {}; - static imported: {}; - static layoutfixed: string[]; - static pinyins: { + announce: Announce; + objectURL: Map; + hookmap: {}; + imported: {}; + layoutfixed: string[]; + pinyins: { _metadata: { shengmu: string[]; special_shengmu: string[]; @@ -184,10 +224,10 @@ export class Library extends Uninstantable { * * 应变 */ - static yingbian: { + yingbian: { condition: { color: Map; - complex: Map GameEventPromise>; + complex: Map any>; simple: Map any>; }; effect: Map void>; @@ -198,7 +238,7 @@ export class Library extends Uninstantable { * * 谋攻强化 */ - static stratagemBuff: { + stratagemBuff: { cost: Map; effect: Map void>; prompt: Map string>; @@ -208,13 +248,13 @@ export class Library extends Uninstantable { * * 实际的卡牌名称 */ - static actualCardName: Map; - static characterDialogGroup: { + actualCardName: Map; + characterDialogGroup: { 收藏: (name: any, capt: any) => any; 最近: (name: any, capt: any) => any; }; - static listenEnd(node: any): void; - static configMenu: { + listenEnd(node: any): void; + configMenu: { general: { name: string; config: { @@ -303,7 +343,7 @@ export class Library extends Uninstantable { restart: boolean; unfrequent: boolean; intro: string; - onclick(bool: any): boolean; + onclick(bool: any): false | undefined; }; swipe: { name: string; @@ -324,7 +364,7 @@ export class Library extends Uninstantable { chat: string; off: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; swipe_up: { name: string; @@ -339,7 +379,7 @@ export class Library extends Uninstantable { chat: string; off: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; swipe_left: { name: string; @@ -354,7 +394,7 @@ export class Library extends Uninstantable { chat: string; off: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; swipe_right: { name: string; @@ -369,7 +409,7 @@ export class Library extends Uninstantable { chat: string; off: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; round_menu_func: { name: string; @@ -382,7 +422,7 @@ export class Library extends Uninstantable { pause: string; auto: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; show_splash: { name: string; @@ -428,7 +468,7 @@ export class Library extends Uninstantable { config: string; auto: string; }; - onclick(item: any): boolean; + onclick(item: any): false | undefined; }; longpress_info: { name: string; @@ -667,7 +707,7 @@ export class Library extends Uninstantable { phonelayout: { name: string; init: boolean; - onclick(bool: any): boolean; + onclick(bool: any): false | undefined; }; change_skin: { name: string; @@ -1295,7 +1335,7 @@ export class Library extends Uninstantable { name: string; init: boolean; unfrequent: boolean; - onclick(bool: any): boolean; + onclick(bool: any): false | undefined; }; remember_round_button: { name: string; @@ -1666,7 +1706,7 @@ export class Library extends Uninstantable { }; }; }; - static extensionMenu: { + extensionMenu: { cardpile: { enable: { name: string; @@ -1874,7 +1914,7 @@ export class Library extends Uninstantable { }; }; }; - static mode: { + mode: { identity: { name: string; connect: { @@ -3259,7 +3299,7 @@ export class Library extends Uninstantable { }; }; }; - static status: { + status: { running: boolean; canvas: boolean; time: number; @@ -3269,7 +3309,7 @@ export class Library extends Uninstantable { videoId: number; globalId: number; }; - static help: { + help: { 关于游戏: string; 游戏操作: string; 游戏命令: string; @@ -3278,23 +3318,23 @@ export class Library extends Uninstantable { /** * @type {import('path')} */ - static path: import("path").PlatformPath; - static getErrorTip(msg: any): any; - static codeMirrorReady(node: any, editor: any): void; - static setIntro(node: any, func: any, left: any): void; - static setPopped(node: any, func: any, width: any, height: any, forceclick: any, paused2: any): void; - static placePoppedDialog(dialog: any, e: any): void; - static setHover(node: any, func: any, hoveration: any, width: any): any; - static setScroll(node: any): any; - static setMousewheel(node: any): void; - static setLongPress(node: any, func: any): any; - static updateCanvas(time: any): boolean; - static run(time: any): void; - static getUTC(date: any): any; - static saveVideo(): void; - static genAsync(fn: any): (...args: any[]) => Promise>; - static genAwait(item: any): Promise; - static gnc: { + path: import("path").PlatformPath; + getErrorTip(msg: any): any; + codeMirrorReady(node: any, editor: any): void; + setIntro(node: any, func: any, left: any): void; + setPopped(node: any, func: any, width: any, height: any, forceclick: any, paused2: any): void; + placePoppedDialog(dialog: any, e: any): void; + setHover(node: any, func: any, hoveration: any, width: any): any; + setScroll(node: any): any; + setMousewheel(node: any): void; + setLongPress(node: any, func: any): any; + updateCanvas(time: any): false | undefined; + run(time: any): void; + getUTC(date: any): any; + saveVideo(): void; + genAsync(fn: any): (...args: any[]) => Promise>; + genAwait(item: any): Promise; + gnc: { of: (fn: any) => (...args: any[]) => Promise>; is: { coroutine: (item: any) => boolean; @@ -3302,20 +3342,20 @@ export class Library extends Uninstantable { generator: (item: any) => boolean; }; }; - static comparator: { + comparator: { equals: (...args: any[]) => boolean; equalAny: (...args: any[]) => boolean; notEquals: (...args: any[]) => boolean; notEqualAny: (...args: any[]) => boolean; typeEquals: (...args: any[]) => boolean; }; - static creation: { - readonly array: any[]; + creation: { + readonly array: never[]; readonly object: {}; readonly nullObject: any; readonly string: string; }; - static linq: { + linq: { cselector: { hasAttr: (name: any) => string; isAttr: (name: any, item: any) => string; @@ -3348,8 +3388,8 @@ export class Library extends Uninstantable { div(...args: any[]): any; }; }; - static init: typeof LibInit; - static cheat: { + init: LibInit; + cheat: { /** * 将游戏内部的对象暴露到全局中 * @@ -3395,7 +3435,7 @@ export class Library extends Uninstantable { * @param { number | true } [i] 指定game.players的第几个元素,不填指定为自己的下家。为true时切换玩家布局 * @param { string } [skin] 皮肤id */ - p(name: string, i?: number | true, skin?: string): void; + p(name: string, i?: number | true | undefined, skin?: string | undefined): void; /** * @overload * @description 不传参数默认装备麒麟弓,八卦阵,的卢,赤兔,木牛 @@ -3452,24 +3492,24 @@ export class Library extends Uninstantable { * 炉石模式可用,使用'spell_yexinglanghun'卡牌 * @param { boolean } [me] 决定是自己还是对手使用'spell_yexinglanghun'卡牌 */ - uy(me?: boolean): void; + uy(me?: boolean | undefined): void; /** * 炉石模式可用,使用`spell_${name}`卡牌 * @param { string } [name] * @param { boolean } [act] */ - gs(name?: string, act?: boolean): void; + gs(name?: string | undefined, act?: boolean | undefined): void; /** * 炉石模式可用,获得`stone_${name}_stonecharacter`卡牌 * @param { string } [name] * @param { boolean } [act] */ - gc(name?: string, act?: boolean): void; + gc(name?: string | undefined, act?: boolean | undefined): void; /** * 进入/关闭快速自动测试模式(游戏速度最快),只有游戏记录界面 * @param { boolean | string } [bool] */ - a(bool?: boolean | string): void; + a(bool?: string | boolean | undefined): void; /** * 临时去掉“自动测试模式”带来的css效果, * @@ -3498,7 +3538,7 @@ export class Library extends Uninstantable { * 输出每个强度的武将数量、每个武将包的每个强度的武将数量、每个武将对应的id和翻译 * @param { boolean } [bool] 为false不输出无名杀自带的武将id和翻译 */ - r(bool?: boolean): void; + r(bool?: boolean | undefined): void; /** * 打印目标玩家的手牌 * @param { Player } player @@ -3565,7 +3605,7 @@ export class Library extends Uninstantable { * 指定的玩家或自己立即获得诸葛连弩,青龙刀,八卦阵,的卢,赤兔,木牛 * @param { Player } [target] */ - ge(target?: Player): void; + ge(target?: Element.Player | undefined): void; /** * 自己立即获得闪电,火山,洪水,乐不思蜀,鬼幽结 */ @@ -3579,7 +3619,7 @@ export class Library extends Uninstantable { * @param { number } [num] * @param { Player } [target] */ - d(num?: number, target?: Player): void; + d(num?: number | undefined, target?: Element.Player | undefined): void; /** * 给自己立刻添加一个或多个技能 * @param {...string} args 技能名 @@ -3592,7 +3632,7 @@ export class Library extends Uninstantable { * * @param { number | Player } [num] */ - t(num?: number | Player): void; + t(num?: number | Element.Player | undefined): void; /** * 自己以外的其他玩家弃置所有牌 */ @@ -3612,7 +3652,7 @@ export class Library extends Uninstantable { */ z(name: string): void; }; - static translate: { + translate: { flower: string; egg: string; wine: string; @@ -3832,8 +3872,8 @@ export class Library extends Uninstantable { phaseDiscard: string; phaseJieshu: string; }; - static experimental: typeof Experimental; - static element: { + experimental: typeof Experimental; + element: { content: { emptyEvent: () => void; changeCharacter(event: any, trigger: any, player: any): Promise; @@ -3952,7 +3992,7 @@ export class Library extends Uninstantable { link: () => void; chooseToGuanxing: () => void; }; - contents: SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Element.Player) => Promise)[]>; + contents: SMap<((event: any, trigger: any, player: any) => Promise)[]>; Player: typeof Element.Player; Card: typeof Element.Card; VCard: typeof Element.VCard; @@ -4002,8 +4042,8 @@ export class Library extends Uninstantable { */ readonly nodews: Element.NodeWS; }; - static card: { - list: any[]; + card: { + list: never[]; cooperation_damage: { fullskin: boolean; }; @@ -4118,7 +4158,7 @@ export class Library extends Uninstantable { fullimage: boolean; }; }; - static filter: { + filter: { all: () => boolean; none: () => boolean; /** @@ -4139,7 +4179,7 @@ export class Library extends Uninstantable { * @param { Player } target * @param { boolean } [strict] */ - cardGiftable: (card: Card, player: Player, target: Player, strict?: boolean) => boolean; + cardGiftable: (card: Card, player: Player, target: Player, strict?: boolean | undefined) => boolean; /** * Check if the card is recastable * @@ -4149,7 +4189,7 @@ export class Library extends Uninstantable { * @param { Player } [source] * @param { boolean } [strict] */ - cardRecastable: (card: Card, player?: Player, source?: Player, strict?: boolean) => boolean; + cardRecastable: (card: Card, player?: Player, source?: Element.Player | undefined, strict?: boolean | undefined) => boolean; /** * @param { Card } card * @param { Player } player @@ -4176,7 +4216,7 @@ export class Library extends Uninstantable { * @returns {boolean} */ filterEnable: (event: GameEvent, player: Player, skill: string) => boolean; - characterDisabled: (i: any, libCharacter: any) => boolean; + characterDisabled: (i: any, libCharacter: any) => true | undefined; characterDisabled2: (i: any) => boolean; skillDisabled: (skill: any) => boolean; cardEnabled: (card: any, player: any, event: any) => any; @@ -4200,13 +4240,13 @@ export class Library extends Uninstantable { 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); + selectTarget: (card: any, player: any) => any; judge: (card: any, player: any, target: any) => any; autoRespondSha: () => boolean; autoRespondShan: () => boolean; - wuxieSwap: (event: any) => boolean; + wuxieSwap: (event: any) => true | undefined; }; - static sort: { + sort: { nature: (a: any, b: any) => number; group: (a: any, b: any) => number; character: (a: any, b: any) => number; @@ -4233,7 +4273,7 @@ export class Library extends Uninstantable { * [key: string]: Skill; * }} */ - static skill: { + skill: { [key: string]: Skill; global: string[]; globalmap: SMap; @@ -4244,10 +4284,10 @@ export class Library extends Uninstantable { zhuSkill: SMap; land_used: SMap; }; - static character: {}; - static perfectPair: {}; - static cardPile: {}; - static message: { + character: {}; + perfectPair: {}; + cardPile: {}; + message: { server: { /** @this { any } */ init(this: any, version: any, config: any, banned_info: any): void; @@ -4295,16 +4335,16 @@ export class Library extends Uninstantable { updateWaiting: (map: any) => void; }; }; - static suit: string[]; - static suits: string[]; - static color: { + suit: string[]; + suits: string[]; + color: { black: string[]; red: string[]; none: string[]; }; - static group: string[]; - static nature: Map; - static natureAudio: { + group: string[]; + nature: Map; + natureAudio: { damage: { fire: string; thunder: string; @@ -4325,10 +4365,10 @@ export class Library extends Uninstantable { kami: string; }; }; - static linked: string[]; - static natureBg: Map; - static natureSeparator: string; - static namePrefix: Map; + natureSeparator: string; + namePrefix: Map; - static groupnature: { + groupnature: { shen: string; wei: string; shu: string; @@ -4377,36 +4417,21 @@ export class Library extends Uninstantable { jin: string; ye: string; }; - static lineColor: Map; - static phaseName: string[]; - static quickVoice: string[]; - static other: { - ignore: () => any; + lineColor: Map; + phaseName: string[]; + quickVoice: string[]; + other: { + ignore: () => undefined; }; - static InitFilter: { + InitFilter: { noZhuHp: string; noZhuSkill: string; }; + config: any; + configOL: any; } -export namespace Library { - let videos: Videos[]; - let node: { - fs: typeof import("fs"); - path: typeof import("path"); - debug: () => void; - clients: Element.Client[]; - banned: []; - observing: []; - torespond: {}; - torespondtimeout: {}; - }; - let playerOL: { - [key: string]: string; - }; - let config: any; - let configOL: any; -} -export const lib: typeof Library; +export let lib: Library; +export function setLibrary(instance?: Library | undefined): void; export type Player = InstanceType; export type Card = InstanceType; export type VCard = InstanceType; @@ -4416,9 +4441,8 @@ export type GameEvent = InstanceType; export type GameEventPromise = InstanceType & InstanceType; export type NodeWS = InstanceType; export type Control = InstanceType; -import { Uninstantable } from "../util/index.js"; +import * as Element from "./element/index.js"; import { Channel } from "./channel/index.js"; import { Announce } from "./announce/index.js"; import { LibInit } from "./init/index.js"; import { Experimental } from "./experimental/index.js"; -import * as Element from "./element/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts index 50b48f53b..8b04c7075 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/init/index.d.ts @@ -1,53 +1,52 @@ -export class LibInit extends Uninstantable { +export class LibInit { /** * 部分函数的Promise版本 */ - static promises: typeof LibInitPromises; - static init(): void; - static reset(): void; - static onload(): Promise; - static startOnline(): void; - static onfree(): void; - static connection(ws: any): void; - static sheet(...args: any[]): HTMLStyleElement; - static css(path: any, file: any, before: any): HTMLLinkElement; - static jsForExtension(path: any, file: any, onLoad: any, onError: any): void; - static js(path: any, file: any, onLoad: any, onError: any): HTMLScriptElement; + promises: LibInitPromises; + init(): void; + reset(): void; + onload(): Promise; + startOnline(): void; + onfree(): void; + connection(ws: any): void; + sheet(...args: any[]): HTMLStyleElement; + css(path: any, file: any, before: any): HTMLLinkElement; + jsForExtension(path: any, file: any, onLoad: any, onError: any): void; + js(path: any, file: any, onLoad: any, onError: any): HTMLScriptElement | undefined; /** * 同步lib.init.js * @returns { void } */ - static jsSync(path: any, file: any, onLoad: any, onError: any): void; - static req(str: any, onload: any, onerror: any, master: any): void; + jsSync(path: any, file: any, onLoad: any, onError: any): void; + req(str: any, onload: any, onerror: any, master: any): void; /** * 同步lib.init.req */ - static reqSync(str: any, onload: any, onerror: any, master: any): string; - static json(url: any, onload: any, onerror: any): void; + reqSync(str: any, onload: any, onerror: any, master: any): string | undefined; + json(url: any, onload: any, onerror: any): void; /** * 同步lib.init.json */ - static jsonSync(url: any, onload: any, onerror: any): void; - static cssstyles(): void; - static layout(layout: any, nosave: any): void; - static background(): void; + jsonSync(url: any, onload: any, onerror: any): void; + cssstyles(): void; + layout(layout: any, nosave: any): void; + background(): void; /** * * @param {*} item * @param {Function} [scope] 作用域 * @returns */ - static parsex(item: any, scope?: Function): any; - static eval(func: any): any; - static encode(strUni: any): string; - static decode(str: any): string; - static stringify(obj: any): string; - static stringifySkill(obj: any): string; + parsex(item: any, scope?: Function | undefined): any; + eval(func: any): any; + encode(strUni: any): string; + decode(str: any): string; + stringify(obj: any): string; + stringifySkill(obj: any): string; /** * 在返回当前加载的esm模块相对位置。 * @param {*} url 传入import.meta.url */ - static getCurrentFileLocation(url: any): string; + getCurrentFileLocation(url: any): string; } -import { Uninstantable } from "../../util/index.js"; import { LibInitPromises } from "./promises.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts index 67f155fdd..385fdfb28 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/init/promises.d.ts @@ -1,4 +1,4 @@ -export class LibInitPromises extends Uninstantable { +export class LibInitPromises { /** * Promise版的`lib.init.js` * @@ -6,7 +6,7 @@ export class LibInitPromises extends Uninstantable { * @param {string | string[]} [file] - 文件名或文件名组,忽略则直接读取`path`的内容 * @returns {Promise} */ - static js(path: string, file?: string | string[]): Promise; + js(path: string, file?: string | string[] | undefined): Promise; /** * Promise版的`lib.init.css` * @@ -16,7 +16,7 @@ export class LibInitPromises extends Uninstantable { * @param {boolean} [noerror = false] - 是否忽略报错 * @returns {Promise} */ - static css(path: string, file?: string | string[], before?: Element, noerror?: boolean): Promise; + css(path: string, file?: string | string[] | undefined, before?: Element | undefined, noerror?: boolean | undefined): Promise; /** * Promise版的`lib.init.req` * @@ -24,19 +24,18 @@ export class LibInitPromises extends Uninstantable { * @param {string} [master] * @returns {Promise} */ - static req(str: string, master?: string): Promise; + req(str: string, master?: string | undefined): Promise; /** * Promise版的`lib.init.json` * * @param {string} url - 要读取的地址 * @returns {Promise} */ - static json(url: string): Promise; + json(url: string): Promise; /** * Promise版的`lib.init.sheet` * * @returns {Promise} */ - static sheet(): Promise; + sheet(): Promise; } -import { Uninstantable } from "../../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts index b39ff334c..f52662f1a 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/library/update.d.ts @@ -1,3 +1,4 @@ +export function gainAuthorization(): Promise; /** * 字节转换 * @param { number } limit @@ -30,9 +31,9 @@ export function checkVersion(ver1: string, ver2: string): -1 | 0 | 1; * ``` */ export function getRepoTags(options?: { - username?: string; - repository?: string; - accessToken?: string; + username?: string | undefined; + repository?: string | undefined; + accessToken?: string | undefined; }): Promise<{ commit: { sha: string; @@ -58,9 +59,9 @@ export function getRepoTags(options?: { * ``` */ export function getRepoTagDescription(tagName: string, options?: { - username?: string; - repository?: string; - accessToken?: string; + username?: string | undefined; + repository?: string | undefined; + accessToken?: string | undefined; }): Promise<{ /** @type { { browser_download_url: string, content_type: string, name: string, size: number }[] } tag额外上传的素材包 */ assets: { @@ -97,7 +98,7 @@ export function getRepoTagDescription(tagName: string, options?: { * @param { string } [options.username = 'libccy'] 仓库拥有者 * @param { string } [options.repository = 'noname'] 仓库名称 * @param { string } [options.accessToken] 身份令牌 - * @returns { Promise<{ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' } | { download_url: null, name: string, path: string, sha: string, size: 0, type: 'dir' }> } + * @returns { Promise<({ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' } | { download_url: null, name: string, path: string, sha: string, size: 0, type: 'dir' })[]> } * @example * ```js * getRepoFilesList() @@ -105,11 +106,11 @@ export function getRepoTagDescription(tagName: string, options?: { * .catch(error => console.error('Failed to fetch files:', error)); * ``` */ -export function getRepoFilesList(path?: string, branch?: string, options?: { - username?: string; - repository?: string; - accessToken?: string; -}): Promise<{ +export function getRepoFilesList(path?: string | undefined, branch?: string | undefined, options?: { + username?: string | undefined; + repository?: string | undefined; + accessToken?: string | undefined; +}): Promise<({ download_url: string; name: string; path: string; @@ -123,17 +124,47 @@ export function getRepoFilesList(path?: string, branch?: string, options?: { sha: string; size: 0; type: 'dir'; -}>; +})[]>; +/** + * + * 获取仓库指定分支和指定目录内的所有文件(包含子目录的文件) + * @param { string } [path = ''] 路径名称(可放参数) + * @param { string } [branch = ''] 仓库分支名称 + * @param { Object } options + * @param { string } [options.username = 'libccy'] 仓库拥有者 + * @param { string } [options.repository = 'noname'] 仓库名称 + * @param { string } [options.accessToken] 身份令牌 + * @returns { Promise<{ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' }[]> } + * @example + * ```js + * flattenRepositoryFiles() + * .then(files => console.log(files)) + * .catch(error => console.error('Failed to fetch files:', error)); + * ``` + */ +export function flattenRepositoryFiles(path?: string | undefined, branch?: string | undefined, options?: { + username?: string | undefined; + repository?: string | undefined; + accessToken?: string | undefined; +}): Promise<{ + download_url: string; + name: string; + path: string; + sha: string; + size: number; + type: 'file'; +}[]>; /** * 请求一个文件而不是直接储存为文件 * @param { string } url * @param { (receivedBytes: number, total?:number, filename?: string) => void } [onProgress] + * @param { RequestInit } [options={}] * @example * ```js * await getRepoTagDescription('v1.10.10').then(({ zipball_url }) => request(zipball_url)); * ``` */ -export function request(url: string, onProgress?: (receivedBytes: number, total?: number, filename?: string) => void): Promise; +export function request(url: string, onProgress?: ((receivedBytes: number, total?: number, filename?: string) => void) | undefined, options?: RequestInit | undefined): Promise; /** * * @param { string } [title] @@ -142,4 +173,4 @@ export function request(url: string, onProgress?: (receivedBytes: number, total? * @param { string | number } [value] * @returns { progress } */ -export function createProgress(title?: string, max?: string | number, fileName?: string, value?: string | number): progress; +export function createProgress(title?: string | undefined, max?: string | number | undefined, fileName?: string | undefined, value?: string | number | undefined): progress; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts index 59d72745e..37bbedeb7 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/status/index.d.ts @@ -1,30 +1,50 @@ -export namespace status { - let paused: boolean; - let paused2: boolean; - let paused3: boolean; - let over: boolean; - let clicked: boolean; - let auto: boolean; - let event: GameEventPromise; - let ai: {}; - let lastdragchange: any[]; - let skillaudio: any[]; - let dieClose: any[]; - let dragline: any[]; - let dying: any[]; - let globalHistory: GameHistory[]; - namespace cardtag { - let yingbian_zhuzhan: any[]; - let yingbian_kongchao: any[]; - let yingbian_fujia: any[]; - let yingbian_canqu: any[]; - let yingbian_force: any[]; - } - let renku: any[]; - let prehidden_skills: any[]; - let postReconnect: {}; - let extension: string | void; - let dragged: boolean | void; - let touchconfirmed: boolean | void; +export class status { + paused: boolean; + paused2: boolean; + paused3: boolean; + over: boolean; + clicked: boolean; + auto: boolean; + /** + * @type { GameEventPromise } + */ + event: any; + ai: {}; + lastdragchange: any[]; + skillaudio: any[]; + dieClose: any[]; + dragline: any[]; + dying: any[]; + /** + * @type { GameHistory[] } + */ + globalHistory: GameHistory[]; + cardtag: { + yingbian_zhuzhan: never[]; + yingbian_kongchao: never[]; + yingbian_fujia: never[]; + yingbian_canqu: never[]; + yingbian_force: never[]; + }; + renku: any[]; + prehidden_skills: any[]; + postReconnect: {}; + /** + * @type { string | void } + */ + extension: string | void; + /** + * @type { boolean | void } + */ + dragged: boolean | void; + /** + * @type { boolean | void } + */ + touchconfirmed: boolean | void; + /** + * @type { boolean | void } + */ + connectMode: boolean | void; } -export namespace _status { } +export let _status: status; +export function setStatus(instance?: status | undefined): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts index 5f767cc2f..35b3b467c 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/click/index.d.ts @@ -1,93 +1,122 @@ -export class Click extends Uninstantable { - static identitycircle(): void; - static connectEvents(): void; - static connectClients(): void; - static autoskin(): void; - static skin(avatar: any, name: any, callback: any): void; - static touchpop(forced: any): void; - static exit(): void; - static shortcut(show: any): void; - static favouriteCharacter(e: any): void; - static buttonnameenter(): void; - static buttonnameleave(): void; - static dragtouchdialog(e: any): void; - static identity(e: any): void; - static identity2(): void; - static roundmenu(): void; - static pausehistory(): import("../../library/element/dialog.js").Dialog; - static pauseconfig(): import("../../library/element/dialog.js").Dialog; - static cardPileButton(): import("../../library/element/dialog.js").Dialog; - static chat(): import("../../library/element/dialog.js").Dialog; - static volumn(): import("../../library/element/dialog.js").Dialog; - static volumn_background(e: any): void; - static volumn_audio(e: any): void; - static hoverpopped(): void; - static hoverpopped_leave(): void; - static leavehoverpopped(): void; - static dierevive(): void; - static dieswap(): void; - static dieswap2(): void; - static touchconfirm(): void; - static windowtouchstart(e: any): void; - static windowtouchmove(e: any): void; - static windowtouchend(e: any): void; - static checkroundtranslate(translate: any): void; - static checkdialogtranslate(translate: any, dialog: any): void; - static windowmousewheel(e: any): void; - static windowmousemove(e: any): void; - static windowmousedown(e: any): void; - static cardtouchstart(e: any): void; - static cardtouchmove(e: any): void; - static windowmouseup(e: any): void; - static mousemove(): void; - static mouseenter(): void; - static mouseleave(): void; - static mousedown(): void; - static mouseentercancel(): void; - static hoverplayer(e: any): import("../../library/element/dialog.js").Dialog; - static longpressdown(e: any): void; - static longpresscallback(): void; - static longpresscancel(): void; - static window(): void; - static toggle(): void; - static editor(): void; - static switcher(): void; - static choice(): void; - static button(): void; - static touchintro(): void; - static card(...args: any[]): void; - static avatar(): void; - static avatar2(): void; - static connectroom(e: any): void; - static player(...args: any[]): any; - static target(e: any): void; - static control2(): void; - static control(): void; - static dialogcontrol(): void; - static skill(skill: any): void; - static ok(node: any): void; - static cancel(node: any): void; - static logv(e: any): void; - static logvleave(): void; - static charactercard(name: any, sourcenode: any, noedit: any, resume: any, avatar: any): void; - static intro(e: any): import("../../library/element/dialog.js").Dialog; - static intro2(): void; - static auto(...args: any[]): void; - static wuxie(): void; - static tempnowuxie(): void; - static pause(): void; - static resume(e: any): boolean; - static config(): void; - static swap(): void; - static mousewheel(evt: any): void; - static touchStart(e: any): void; - static dialogtouchStart(e: any): void; - static touchScroll(e: any): void; - static autoskill(bool: any, node: any): void; - static skillbutton(): void; - static autoskill2(e: any): void; - static hiddenskill(e: any): void; - static rightplayer(e: any): boolean; - static right(e: any): boolean; +export class Click { + /** + * @type {() => void} + */ + consoleMenu: () => void; + /** + * @type {(arg0: string) => void} + */ + menuTab: (arg0: string) => void; + identitycircle(): void; + connectEvents(): void; + connectClients(): void; + autoskin(): void; + skin(avatar: any, name: any, callback: any): void; + touchpop(forced: any): void; + exit(): void; + shortcut(show: any): void; + favouriteCharacter(e: any): void; + innerHTML: string | undefined; + buttonnameenter(): void; + buttonnameleave(): void; + dragtouchdialog(e: any): void; + _dragorigin: { + clientX: any; + clientY: any; + } | undefined; + _dragtransform: number[] | undefined; + _dragorigintransform: number[] | undefined; + identity(e: any): void; + _customintro: ((uiintro: any) => void) | undefined; + identity2(): void; + roundmenu(): void; + pausehistory(): import("../../library/element/dialog.js").Dialog | undefined; + pauseconfig(): import("../../library/element/dialog.js").Dialog | undefined; + cardPileButton(): import("../../library/element/dialog.js").Dialog; + chat(): import("../../library/element/dialog.js").Dialog; + volumn(): import("../../library/element/dialog.js").Dialog; + volumn_background(e: any): void; + volumn_audio(e: any): void; + hoverpopped(): void; + _uiintro: any; + hoverpopped_leave(): void; + _poppedalready: boolean | undefined; + leavehoverpopped(): void; + dierevive(): void; + dieswap(): void; + dieswap2(): void; + touchconfirm(): void; + windowtouchstart(e: any): void; + windowtouchmove(e: any): void; + windowtouchend(e: any): void; + checkroundtranslate(translate: any): void; + checkdialogtranslate(translate: any, dialog: any): void; + windowmousewheel(e: any): void; + windowmousemove(e: any): void; + windowmousedown(e: any): void; + cardtouchstart(e: any): void; + _waitingfordrag: { + clientX: any; + clientY: any; + } | undefined; + cardtouchmove(e: any): void; + windowmouseup(e: any): void; + mousemove(): void; + mouseenter(): void; + mouseleave(): void; + _mouseentercreated: boolean | undefined; + mousedown(): void; + mouseentercancel(): void; + hoverplayer(e: any): import("../../library/element/dialog.js").Dialog | undefined; + longpressdown(e: any): void; + _longpresstimeout: NodeJS.Timeout | undefined; + _longpressevent: any; + longpresscallback(): void; + longpresscancel(): void; + window(): void; + toggle(): void; + link: boolean | undefined; + editor(): void; + switcher(): void; + choice(): void; + button(): void; + touchintro(): void; + card(...args: any[]): void; + avatar(): void; + _doubleClicking: boolean | undefined; + avatar2(): void; + connectroom(e: any): void; + player(...args: any[]): void; + target(e: any): void; + control2(): void; + control(): void; + dialogcontrol(): void; + skill(skill: any): void; + ok(node: any): void; + cancel(node: any): void; + logv(e: any): void; + logvtimeout: any; + logvleave(): void; + charactercard(name: any, sourcenode: any, noedit: any, resume: any, avatar: any): void; + intro(e: any): import("../../library/element/dialog.js").Dialog | undefined; + intro2(): void; + auto(...args: any[]): void; + wuxie(): void; + tempnowuxie(): void; + pause(): void; + resume(e: any): false | undefined; + config(): void; + swap(): void; + mousewheel(evt: any): void; + touchStart(e: any): void; + startX: number | undefined; + startY: number | undefined; + dialogtouchStart(e: any): void; + touchScroll(e: any): void; + autoskill(bool: any, node: any): void; + skillbutton(): void; + autoskill2(e: any): void; + hiddenskill(e: any): void; + rightplayer(e: any): boolean; + right(e: any): false | undefined; } -import { Uninstantable } from "../../util/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts index a4ee18e8d..ad87669c0 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/index.d.ts @@ -1,71 +1,75 @@ -export class Create extends Uninstantable { +export class Create { + /** + * @type {(video: Videos, before: boolean) => void} + */ + videoNode: (video: any, before: boolean) => void; /** * 创建身份牌实例 */ - static identityCard(identity: any, position: any, noclick: any): import("../../library/element/card.js").Card; + identityCard(identity: any, position: any, noclick: any): import("../../library/element/card.js").Card; /** * 让卡牌旋转 */ - static cardSpinning(card: any): void; + cardSpinning(card: any): void; /** * 旋转的身份牌! */ - static spinningIdentityCard(identity: any, dialog: any): void; + spinningIdentityCard(identity: any, dialog: any): void; /** * 创建codemirror编辑器 * @param {HTMLDivElement} container * @param {Function} saveInput */ - static editor(container: HTMLDivElement, saveInput: Function): HTMLDivElement; - static cardTempName(card: any, applyNode: any): any; - static connectRooms(list: any): void; - static rarity(button: any): void; - static div(...args: any[]): HTMLDivElement; - static filediv(...args: any[]): any; - static node(...args: any[]): any; - static iframe(src: any): void; - static identitycircle(list: any, target: any): void; - static chat(): void; - static exit(): void; - static connecting(bool: any): void; - static roomInfo(): void; - static templayer(time: any): void; - static selectlist(list: any, init: any, position: any, onchange: any): HTMLSelectElement; + editor(container: HTMLDivElement, saveInput: Function): HTMLDivElement; + cardTempName(card: any, applyNode: any): any; + connectRooms(list: any): void; + rarity(button: any): void; + div(...args: any[]): HTMLDivElement; + filediv(...args: any[]): HTMLDivElement; + node(...args: any[]): any; + iframe(src: any): void; + identitycircle(list: any, target: any): void; + chat(): void; + exit(): void; + connecting(bool: any): void; + roomInfo(): void; + templayer(time: any): void; + selectlist(list: any, init: any, position: any, onchange: any): HTMLSelectElement; /** 创建菜单 */ - static menu: typeof menu; + menu: typeof menu; /** 创建“开始”菜单 */ - static startMenu: (connectMenu: any) => HTMLDivElement; + startMenu: (connectMenu: any) => HTMLDivElement; /** 创建“选项”菜单 */ - static optionsMenu: (connectMenu: any) => void; + optionsMenu: (connectMenu: any) => void; /** 创建“武将”菜单 */ - static characterPackMenu: (connectMenu: any) => (packName: string) => void; + characterPackMenu: (connectMenu: any) => (packName: string) => void; /** 创建“卡牌”菜单 */ - static cardPackMenu: (connectMenu: any) => (packName: string) => void; + cardPackMenu: (connectMenu: any) => (packName: string) => void; /** 创建“扩展”菜单 */ - static extensionMenu: (connectMenu: any) => void; + extensionMenu: (connectMenu: any) => void; /** 创建“其他”菜单 */ - static otherMenu: (connectMenu: any) => void; - static statictable(...args: any[]): HTMLTableElement; - static giveup(): void; - static groupControl(dialog: any): import("../../library/element/control.js").Control; - static cardDialog(...args: any[]): any; - static characterDialog2(filter: any): import("../../library/element/dialog.js").Dialog; - static characterDialog(...args: any[]): import("../../library/element/dialog.js").Dialog; - static dialog(...args: any[]): import("../../library/element/dialog.js").Dialog; - static line2(...args: any[]): any; - static line(...args: any[]): HTMLDivElement; - static switcher(name: any, current: any, current2: any, ...args: any[]): HTMLDivElement; - static caption(str: any, position: any): HTMLDivElement; - static control(...args: any[]): import("../../library/element/control.js").Control; - static confirm(str: any, func: any): void; - static skills(skills: any): import("../../library/element/control.js").Control; - static skills2(skills: any): import("../../library/element/control.js").Control; - static skills3(skills: any): import("../../library/element/control.js").Control; - static arena(): void; - static system(str: any, func: any, right: any, before: any): HTMLDivElement; - static pause(): HTMLDivElement; - static prebutton(item: any, type: any, position: any, noclick: any): HTMLDivElement; - static buttonPresets: { + otherMenu: (connectMenu: boolean | undefined) => void; + statictable(...args: any[]): HTMLTableElement; + giveup(): void; + groupControl(dialog: any): import("../../library/element/control.js").Control; + cardDialog(...args: any[]): import("../../library/element/dialog.js").Dialog; + characterDialog2(filter: any): import("../../library/element/dialog.js").Dialog; + characterDialog(...args: any[]): import("../../library/element/dialog.js").Dialog; + dialog(...args: any[]): import("../../library/element/dialog.js").Dialog; + line2(...args: any[]): HTMLDivElement; + line(...args: any[]): HTMLDivElement; + switcher(name: any, current: any, current2: any, ...args: any[]): HTMLDivElement; + caption(str: any, position: any): HTMLDivElement; + control(...args: any[]): import("../../library/element/control.js").Control; + confirm(str: any, func: any): void; + skills(skills: any): any; + skills2(skills: any): any; + skills3(skills: any): any; + arena(): void; + system(str: any, func: any, right: any, before: any): HTMLDivElement; + pause(): HTMLDivElement | undefined; + prebutton(item: any, type: any, position: any, noclick: any): HTMLDivElement; + buttonPresets: { /** * @returns { import("../library/index.js").Button } */ @@ -95,16 +99,15 @@ export class Create extends Uninstantable { */ player: (item: any, type: any, position: any, noclick: any, node: any) => any; }; - static button(item: any, type: any, position: any, noClick: any, button: any): import("../../library/element/button.js").Button; - static buttons(list: any, type: any, position: any, noclick: any, zoom: any): HTMLDivElement[]; - static textbuttons(list: any, dialog: any, noclick: any): void; - static player(position: any, noclick: any): import("../../library/element/player.js").Player; - static connectPlayers(ip: any): void; - static players(numberOfPlayers: any): import("../../library/element/player.js").Player[]; - static me(hasme: any): void; - static card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card; - static cardsAsync(...args: any[]): void; - static cards(ordered: any): void; + button(item: any, type: any, position: any, noClick: any, button: any): import("../../library/element/button.js").Button; + buttons(list: any, type: any, position: any, noclick: any, zoom: any): HTMLDivElement[]; + textbuttons(list: any, dialog: any, noclick: any): void; + player(position: any, noclick: any): import("../../library/element/player.js").Player; + connectPlayers(ip: any): void; + players(numberOfPlayers: any): any[] | undefined; + me(hasme: any): void; + card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card; + cardsAsync(...args: any[]): void; + cards(ordered: any): void; } -import { Uninstantable } from "../../util/index.js"; import { menu } from "./menu/index.js"; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts index 685a8393e..a4ca5efb3 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/index.d.ts @@ -22,7 +22,7 @@ export function setUpdateActiveCard(fun: Function): void; /** * @param { boolean } [connectMenu] */ -export function menu(connectMenu?: boolean): void; +export function menu(connectMenu?: boolean | undefined): void; /** * @type { HTMLDivElement } * diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts index 2b80a6971..4e260cd23 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/create/menu/pages/otherMenu.d.ts @@ -1 +1 @@ -export function otherMenu(connectMenu: any): void; +export function otherMenu(connectMenu: boolean | undefined): void; diff --git a/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts b/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts index 8d57192bc..b99c9fecf 100644 --- a/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts +++ b/node_modules/@types/noname-typings/nonameModules/noname/ui/index.d.ts @@ -1,15 +1,15 @@ -export class UI extends Uninstantable { - static updates: any[]; - static thrown: any[]; - static touchlines: any[]; - static todiscard: {}; +export class UI { + updates: any[]; + thrown: any[]; + touchlines: any[]; + todiscard: {}; /** * @type { HTMLStyleElement[] } */ - static playerPositions: HTMLStyleElement[]; - static create: typeof Create; - static click: typeof Click; - static selected: { + playerPositions: HTMLStyleElement[]; + create: Create; + click: Click; + selected: { /** * @type { Button[] } */ @@ -26,111 +26,139 @@ export class UI extends Uninstantable { /** * @type { Dialog[] } */ - static dialogs: Dialog[]; + dialogs: Dialog[]; /** * @type { Dialog } */ - static dialog: Dialog; + dialog: any; /** * @type { HTMLDivElement } */ - static arena: HTMLDivElement; + arena: HTMLDivElement; /** * @type { Control[] } */ - static controls: Control[]; + controls: Control[]; /** * @type { Control } */ - static control: Control; + control: any; /** * @type { Control | undefined } */ - static confirm: Control | undefined; + confirm: Control | undefined; /** * @type { Control | undefined } */ - static skills: Control | undefined; + skills: Control | undefined; /** * @type { Control | undefined } */ - static skills1: Control | undefined; + skills1: Control | undefined; /** * @type { Control | undefined } */ - static skills2: Control | undefined; + skills2: Control | undefined; /** * @type { Control | undefined } */ - static skills3: Control | undefined; + skills3: Control | undefined; /** * @type { HTMLDivElement } */ - static window: HTMLDivElement; + window: HTMLDivElement; /** * @type { HTMLDivElement } */ - static pause: HTMLDivElement; + pause: HTMLDivElement; /** * @type { HTMLAudioElement } */ - static backgroundMusic: HTMLAudioElement; + backgroundMusic: HTMLAudioElement; /** * @type { HTMLDivElement } */ - static special: HTMLDivElement; + special: HTMLDivElement; /** * @type { HTMLDivElement } */ - static fakeme: HTMLDivElement; + fakeme: HTMLDivElement; /** * @type { HTMLDivElement } */ - static chess: HTMLDivElement; + chess: HTMLDivElement; /** * 手动在菜单栏中添加一个武将包的ui * @type { ((packName: string) => void)[] } */ - static updateCharacterPackMenu: ((packName: string) => void)[]; + updateCharacterPackMenu: ((packName: string) => void)[]; /** * 手动在菜单栏中添加一个卡牌包的ui * @type { ((packName: string) => void)[] } */ - static updateCardPackMenu: ((packName: string) => void)[]; + updateCardPackMenu: ((packName: string) => void)[]; /** * @type { HTMLDivElement } 挑战模式下正在操作的角色 */ - static mebg: HTMLDivElement; - static refresh(node: any): void; - static clear(): void; - static updatec(): void; - static updatex(...args: any[]): void; - static updatexr(): void; - static updatejm(player: any, nodes: any, start: any, inv: any): void; - static updatem(player: any): void; - static updatej(player: any): void; - static updatehl(): void; - static updateh(compute: any): void; - static updatehx(node: any): void; - static updated(): void; - static updatez(): void; - static update(): void; - static recycle(node: any, key: any): any; + mebg: HTMLDivElement; + /** + * @type { Function | undefined } + */ + updateUpdate: Function | undefined; + /** + * @type {HTMLDivElement} + */ + commandnode: HTMLDivElement; + /** + * @type {() => void} + */ + updateVideoMenu: () => void; + /** + * @type {HTMLDivElement} + */ + menuContainer: HTMLDivElement; + /** + * @type {HTMLDivElement} + */ + auto: HTMLDivElement; + /** + * @type {HTMLDivElement} + */ + wuxie: HTMLDivElement; + /** + * @type {HTMLDivElement} + */ + tempnowuxie: HTMLDivElement; + refresh(node: any): void; + clear(): void; + updatec(): void; + updatex(...args: any[]): void; + updatexr(): void; + updatejm(player: any, nodes: any, start: any, inv: any): void; + updatem(player: any): void; + updatej(player: any): void; + updatehl(): void; + updateh(compute: any): void; + updatehx(node: any): void; + updated(): void; + updatez(): void; + update(): void; + recycle(node: any, key: any): any; /** * @author curpond * @author Tipx-L * @param {number} [numberOfPlayers] */ - static updateConnectPlayerPositions(numberOfPlayers?: number): void; + updateConnectPlayerPositions(numberOfPlayers?: number | undefined): void; /** * @author curpond * @author Tipx-L * @param {number} [numberOfPlayers] */ - static updatePlayerPositions(numberOfPlayers?: number): void; - static updateRoundNumber(roundNumber: any, cardPileNumber: any): void; + updatePlayerPositions(numberOfPlayers?: number | undefined): void; + updateRoundNumber(roundNumber: any, cardPileNumber: any): void; } -export const ui: typeof UI; -import { Uninstantable } from "../util/index.js"; +export let ui: UI; +export function setUI(instance?: UI | undefined): void; import { Create } from "./create/index.js"; import { Click } from "./click/index.js"; diff --git a/node_modules/@types/noname-typings/package.json b/node_modules/@types/noname-typings/package.json index 80981fd24..5c9f66ff6 100644 --- a/node_modules/@types/noname-typings/package.json +++ b/node_modules/@types/noname-typings/package.json @@ -1,6 +1,6 @@ { "name": "noname-typings", - "version": "2024.04.06", + "version": "2024.04.11", "description": "Noname typings, mainly for showing type hints when creating extensions of the Sanguosha-like game Noname.", "repository": { "type": "git", diff --git a/noname.js b/noname.js index 45db36bc4..24d68dcae 100644 --- a/noname.js +++ b/noname.js @@ -1,8 +1,8 @@ -export { GNC as gnc } from './noname/gnc/index.js'; -export { AI as ai } from './noname/ai/index.js'; -export { Game as game } from './noname/game/index.js'; -export { Get as get } from './noname/get/index.js'; -export { Library as lib } from './noname/library/index.js'; -export { status as _status } from './noname/status/index.js'; -export { UI as ui } from './noname/ui/index.js'; +export { GNC, gnc, setGNC } from './noname/gnc/index.js'; +export { AI, ai, setAI } from './noname/ai/index.js'; +export { Game, game, setGame } from './noname/game/index.js'; +export { Get, get, setGet } from './noname/get/index.js'; +export { Library, lib, setLibrary } from './noname/library/index.js'; +export { status, _status, setStatus } from './noname/status/index.js'; +export { UI, ui, setUI } from './noname/ui/index.js'; export { boot } from './noname/init/index.js'; diff --git a/noname/ai/basic.js b/noname/ai/basic.js index 0d03bb8c1..a9cef5c28 100644 --- a/noname/ai/basic.js +++ b/noname/ai/basic.js @@ -1,20 +1,16 @@ -import { Get as get } from '../get/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { Library as lib } from '../library/index.js'; -import { GNC as gnc } from '../gnc/index.js'; -import { Uninstantable } from "../util/index.js"; +import { get } from '../get/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { CacheContext } from '../library/cache/cacheContext.js'; - -export class Basic extends Uninstantable { +export class Basic { /** * @param { ( * button: Button, * buttons?: Button[] * ) => number } check */ - static chooseButton(check) { + chooseButton(check) { const event = _status.event; let i, j, range, buttons, buttons2; let ok = false, forced = event.forced; @@ -81,7 +77,7 @@ export class Basic extends Uninstantable { * ) => number } check * @returns { boolean | undefined } */ - static chooseCard(check) { + chooseCard(check) { const event = _status.event; if (event.filterCard == undefined) return (check() > 0); let i, j, range, cards, cards2, skills, effect; @@ -144,7 +140,7 @@ export class Basic extends Uninstantable { var info = get.info(event.skill); if (info.filterCard) { check = info.check || get.unuseful2; - return (Basic.chooseCard(check)); + return (this.chooseCard(check)); } else { return true; @@ -169,7 +165,7 @@ export class Basic extends Uninstantable { * targets?: Player[] * ) => number } check */ - static chooseTarget(check) { + chooseTarget(check) { const event = _status.event; if (event.filterTarget == undefined) return (check() > 0); let i, j, range, targets, targets2, effect; diff --git a/noname/ai/index.js b/noname/ai/index.js index 6452195ef..922a59433 100644 --- a/noname/ai/index.js +++ b/noname/ai/index.js @@ -1,19 +1,23 @@ -import { Get as get } from '../get/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { Library as lib } from '../library/index.js'; -import { GNC as gnc } from '../gnc/index.js'; -import { Uninstantable } from "../util/index.js"; - +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; import { Basic } from './basic.js'; -export class AI extends Uninstantable { - static basic = Basic; - static get = get; +export class AI { + basic = new Basic(); + get = get; }; -export const ai = AI; +export let ai = new AI(); + +/** + * @param { InstanceType } [instance] + */ +export let setAI = (instance) => { + ai = instance || new AI(); + if (lib.config.dev) { + window.ai = ai; + } +}; export { Basic diff --git a/noname/game/check.js b/noname/game/check.js new file mode 100644 index 000000000..d5476c12a --- /dev/null +++ b/noname/game/check.js @@ -0,0 +1,139 @@ +import { get } from '../get/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { lib } from '../library/index.js'; + +export class Check { + processSelection({ type, items, event, useCache, isSelectable }) { + let ok = true, auto; + let selectableItems = false; + const uppercaseType = (type) => type[0].toUpperCase() + type.slice(1); + const uiSelected = ui.selected[`${type}s`]; + const range = get.select(event[`select${uppercaseType(type)}`]); + + if (event.forceAuto && uiSelected.length === range[1]) auto = true; + else if (range[0] !== range[1] || range[0] > 1) auto = false; + + let cache; + let firstCheck = false; + + if (useCache) { + if (!event[`_${type}Choice`]) event[`_${type}Choice`] = {}; + let cacheId = 0; + for (let Type of ['button', 'card', 'target']) { + if (type === Type) break; + if (Type === "target") Type = "player"; + ui.selected[`${Type}s`].forEach(i => cacheId ^= i[`${Type}id`]); + } + if (!event[`_${type}Choice`][cacheId]) { + event[`_${type}Choice`][cacheId] = []; + firstCheck = true; + } + cache = event[`_${type}Choice`][cacheId]; + } + + items.forEach(item => { + let selectable; + if (!lib.filter.cardAiIncluded(item)) selectable = false; + else if (useCache && !firstCheck) selectable = cache.includes(item); + else selectable = isSelectable(item, event); + + if (range[1] <= -1) { + if (selectable) { + item.classList.add('selected'); + uiSelected.add(item); + } else { + item.classList.remove('selected'); + uiSelected.remove(item); + } + if (item.updateTransform) item.updateTransform(selectable); + } else { + if (selectable && uiSelected.length < range[1]) { + item.classList.add('selectable'); + if (firstCheck) cache.push(item); + } + else item.classList.remove('selectable'); + } + + if (item.classList.contains('selectable')) selectableItems = true; + else if (item.classList.contains('selected')) item.classList.add('selectable'); + + game.callHook(`check${uppercaseType(type)}`, [item, event]); + }); + + if (event[`${type}Required`] && uiSelected.length === 0) ok = false; + else if (uiSelected.length < range[0] && (!event.forced || selectableItems || event.complexSelect)) ok = false; + + if (event.custom && event.custom.add[type]) event.custom.add[type](); + + return { ok, auto }; + } + button(event, useCache) { + const player = event.player; + const buttons = event.dialog.buttons; + const isSelectable = (button, event) => { + if (!lib.filter.buttonIncluded(button)) return false; + if (button.classList.contains('unselectable')) return false; + return event.filterButton(button, player); + } + return game.Check.processSelection({ type: 'button', items: buttons, event, useCache, isSelectable }); + } + card(event, useCache) { + const player = event.player; + const cards = player.getCards(event.position); + const isSelectable = (card, event) => { + if (card.classList.contains('uncheck')) return false; + if (player.isOut()) return false; + if (!lib.filter.cardRespondable(card, player)) return false; + return event.filterCard(card, player); + } + return game.Check.processSelection({ type: 'card', items: cards, event, useCache, isSelectable }); + } + target(event, useCache) { + const player = event.player; + const card = get.card(); + const targets = game.players.slice(); + if (event.deadTarget) targets.addArray(game.dead); + const isSelectable = (target, event) => { + if (game.chess && !event.chessForceAll && player && get.distance(player, target, 'pure') > 7) return false; + if (target.isOut()) return false; + return event.filterTarget(card, player, target); + } + return game.Check.processSelection({ type: 'target', items: targets, event, useCache, isSelectable }); + } + skill(event) { + if (ui.skills) ui.skills.close(); + if (ui.skills2) ui.skills2.close(); + if (ui.skills3) ui.skills3.close(); + if (event.skill || !get.noSelected() || _status.noconfirm) return; + + const player = event.player; + if (!event._skillChoice) event._skillChoice = game.expandSkills(player.getSkills('invisible').concat(lib.skill.global)).filter(skill => lib.filter.filterEnable(event, player, skill)); + + const skills = event._skillChoice.filter(i => event.isMine() || !event._aiexclude.includes(i)); + const globallist = game.expandSkills(lib.skill.global.slice()); + const ownedlist = game.expandSkills(player.getSkills('invisible', false)); + + const ownedSkills = [], globalSkills = [], equipSkills = []; + skills.forEach(skill => { + if (globallist.includes(skill)) globalSkills.push(skill); + else if (!ownedlist.includes(skill)) equipSkills.push(skill); + else ownedSkills.push(skill); + }); + + if (ownedSkills.length) ui.create.skills(ownedSkills); + if (globalSkills.length) ui.create.skills2(globalSkills); + if (equipSkills.length) ui.create.skills3(equipSkills); + } + confirm(event, confirm) { + ui.arena.classList.add('selecting'); + if (event.filterTarget && (!event.filterCard || !event.position || (typeof event.position == 'string' && !event.position.includes('e')))) { + ui.arena.classList.add('tempnoe'); + } + game.countChoose(); + if (!_status.noconfirm && !_status.event.noconfirm && (_status.mouseleft || !_status.mousedown)) { + ui.create.confirm(confirm); + } + } +} \ No newline at end of file diff --git a/noname/game/index.js b/noname/game/index.js index 1cfe8d9ec..e0b77255c 100644 --- a/noname/game/index.js +++ b/noname/game/index.js @@ -10,51 +10,55 @@ * @typedef { { mode: string, name: string[], name1: string, name2?: string, time: number, video: Video, win: boolean } } Videos */ -import { AI as ai } from '../ai/index.js'; -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { GNC as gnc } from '../gnc/index.js'; +import { ai } from '../ai/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { gnc } from '../gnc/index.js'; import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction, delay, nonameInitialized } from "../util/index.js"; import { DynamicStyle } from "./dynamic-style/index.js"; import { GamePromises } from "./promises.js"; +import { Check } from "./check.js"; -export class Game extends Uninstantable { - static online = false; - static onlineID = null; - static onlineKey = null; +export class Game { + online = false; + onlineID = null; + onlineKey = null; /** * @type {Player[]} */ - static players = []; + players = []; /** * @type {Player[]} */ - static dead = []; - static imported = []; + dead = []; + imported = []; /** * @type { { [key: string]: Player } } */ - static playerMap = {}; - static phaseNumber = 0; - static roundNumber = 0; - static shuffleNumber = 0; - static promises = GamePromises; + playerMap = {}; + phaseNumber = 0; + roundNumber = 0; + shuffleNumber = 0; + promises = new GamePromises(); /** * @type { string } */ - static layout; + // @ts-ignore + layout; /** * @type { Player } */ - static me; + // @ts-ignore + me; /** * @type { boolean } */ - static chess; - static globalEventHandlers = new class { + // @ts-ignore + chess; + globalEventHandlers = new class { constructor() { this._handlers = {}; } @@ -116,13 +120,13 @@ export class Game extends Uninstantable { } //Stratagem //谋攻 - static setStratagemBuffCost(cardName, cost) { return game.broadcastAll((clientCardName, clientCost) => lib.stratagemBuff.cost.set(clientCardName, clientCost), cardName, cost) } - static setStratagemBuffEffect(cardName, effect) { return game.broadcastAll((clientCardName, clientEffect) => lib.stratagemBuff.cost.set(clientCardName, clientEffect), cardName, effect) } - static setStratagemBuffPrompt(cardName, prompt) { return game.broadcastAll((clientCardName, clientPrompt) => lib.stratagemBuff.cost.set(clientCardName, clientPrompt), cardName, prompt) } + setStratagemBuffCost(cardName, cost) { return game.broadcastAll((clientCardName, clientCost) => lib.stratagemBuff.cost.set(clientCardName, clientCost), cardName, cost) } + setStratagemBuffEffect(cardName, effect) { return game.broadcastAll((clientCardName, clientEffect) => lib.stratagemBuff.cost.set(clientCardName, clientEffect), cardName, effect) } + setStratagemBuffPrompt(cardName, prompt) { return game.broadcastAll((clientCardName, clientPrompt) => lib.stratagemBuff.cost.set(clientCardName, clientPrompt), cardName, prompt) } /** * 添加新的属性杀 */ - static addNature(nature, translation, config) { + addNature(nature, translation, config) { if (!nature) throw new TypeError(); if (translation && translation.length) lib.translate['nature_' + nature] = translation; game.callHook("addNature", [nature, translation, config]); @@ -131,7 +135,7 @@ export class Game extends Uninstantable { /** * 判断卡牌信息/事件是否有某个属性 */ - static hasNature(item, nature, player) { + hasNature(item, nature, player) { var natures = get.natureList(item, player); if (!nature) return natures.length > 0; if (nature == 'linked') return natures.some(n => lib.linked.includes(n)); @@ -140,7 +144,7 @@ export class Game extends Uninstantable { /** * 设置卡牌信息/事件的属性 */ - static setNature(item, nature, addNature) { + setNature(item, nature, addNature) { if (!nature) nature = []; if (!addNature) { item.nature = get.nature(nature); @@ -157,7 +161,7 @@ export class Game extends Uninstantable { /** * 洗牌 */ - static washCard() { + washCard() { if (!ui.cardPile.hasChildNodes() && !ui.discardPile.hasChildNodes()) return false; if (_status.maxShuffle != undefined) { if (_status.maxShuffle == 0) { @@ -192,7 +196,7 @@ export class Game extends Uninstantable { /** * 基于钩子的添加势力方法 */ - static addGroup(id, short, name, config) { + addGroup(id, short, name, config) { if (!id) throw new TypeError(); if (lib.comparator.typeEquals(short, "object")) { config = short; @@ -222,7 +226,7 @@ export class Game extends Uninstantable { * @param {Name} name * @param {Parameters} args */ - static callHook(name, args) { + callHook(name, args) { const callHook = () => { for (const hook of lib.hooks[name]) { if (hook != null && typeof hook == "function") { @@ -235,7 +239,7 @@ export class Game extends Uninstantable { } //Yingbian //应变 - static yingbianEffect(event, content) { + yingbianEffect(event, content) { const yingbianEffect = game.createEvent('yingbianEffect'); yingbianEffect.player = event.player; yingbianEffect.card = event.card; @@ -244,11 +248,11 @@ export class Game extends Uninstantable { yingbianEffect._args = Array.from(arguments); return yingbianEffect; } - static setYingbianConditionColor(yingbianCondition, color) { return game.broadcastAll((yingbianCondition, color) => lib.yingbian.condition.color.set(yingbianCondition, color), yingbianCondition, color) } - static setComplexYingbianCondition(yingbianCondition, condition) { return game.broadcastAll((yingbianCondition, condition) => lib.yingbian.condition.complex.set(yingbianCondition, condition), yingbianCondition, condition) } - static setSimpleYingbianCondition(yingbianCondition, condition) { return game.broadcastAll((yingbianCondition, condition) => lib.yingbian.condition.simple.set(yingbianCondition, condition), yingbianCondition, condition) } - static setYingbianEffect(yingbianEffect, effect) { return game.broadcastAll((yingbianEffect, effect) => lib.yingbian.effect.set(yingbianEffect, effect), yingbianEffect, effect) } - static setYingbianPrompt(yingbian, prompt) { return game.broadcastAll((yingbian, prompt) => lib.yingbian.prompt.set(yingbian, prompt), yingbian, prompt) } + setYingbianConditionColor(yingbianCondition, color) { return game.broadcastAll((yingbianCondition, color) => lib.yingbian.condition.color.set(yingbianCondition, color), yingbianCondition, color) } + setComplexYingbianCondition(yingbianCondition, condition) { return game.broadcastAll((yingbianCondition, condition) => lib.yingbian.condition.complex.set(yingbianCondition, condition), yingbianCondition, condition) } + setSimpleYingbianCondition(yingbianCondition, condition) { return game.broadcastAll((yingbianCondition, condition) => lib.yingbian.condition.simple.set(yingbianCondition, condition), yingbianCondition, condition) } + setYingbianEffect(yingbianEffect, effect) { return game.broadcastAll((yingbianEffect, effect) => lib.yingbian.effect.set(yingbianEffect, effect), yingbianEffect, effect) } + setYingbianPrompt(yingbian, prompt) { return game.broadcastAll((yingbian, prompt) => lib.yingbian.prompt.set(yingbian, prompt), yingbian, prompt) } /** * Dynamic Style Manager * 动态CSS管理对象 @@ -293,13 +297,13 @@ export class Game extends Uninstantable { * textAlign: "center" * }); */ - static dynamicStyle = new DynamicStyle() + dynamicStyle = new DynamicStyle() /** * Add a background music to the config option * * 在设置选项中添加一首背景音乐 */ - static addBackgroundMusic(link, musicName, aozhan) { + addBackgroundMusic(link, musicName, aozhan) { const backgroundMusicSetting = ui[aozhan ? 'aozhan_bgm' : 'background_music_setting'], menu = backgroundMusicSetting._link.menu, config = backgroundMusicSetting._link.config; if (typeof musicName != 'string') musicName = link; if (aozhan) lib.mode.guozhan.config.aozhan_bgm.item[link] = musicName; @@ -321,7 +325,7 @@ export class Game extends Uninstantable { * * 从设置选项中移除一首背景音乐 */ - static removeBackgroundMusic(link, aozhan) { + removeBackgroundMusic(link, aozhan) { if (aozhan) { if (['disabled', 'random'].includes(link)) return; delete lib.mode.guozhan.config.aozhan_bgm.item[link]; @@ -335,7 +339,7 @@ export class Game extends Uninstantable { const backgroundMusicSetting = ui[aozhan ? 'aozhan_bgm' : 'background_music_setting'], config = backgroundMusicSetting._link.config; config.updatex.call(backgroundMusicSetting, []); } - static updateBackground() { + updateBackground() { const background = _status.tempBackground || lib.config.image_background; ui.background.delete(); const uiBackground = ui.background = ui.create.div('.background'), style = uiBackground.style; @@ -369,8 +373,8 @@ export class Game extends Uninstantable { * * 用给定的BPM、节拍和偏移生成谱面 */ - static generateBeatmapTimeleap(bpm, beats, offset) { return beats.map(value => Math.round(value * 60000 / bpm + (offset || 0))) } - static updateRenku() { + generateBeatmapTimeleap(bpm, beats, offset) { return beats.map(value => Math.round(value * 60000 / bpm + (offset || 0))) } + updateRenku() { game.broadcast(function (renku) { _status.renku = renku; }, _status.renku); @@ -383,7 +387,7 @@ export class Game extends Uninstantable { * @param { Card[] | Card } cards * @param { Player[] } players */ - static addCardKnower(cards, players) { + addCardKnower(cards, players) { if (get.itemtype(cards) == 'card') { // @ts-ignore cards = [cards]; @@ -395,7 +399,7 @@ export class Game extends Uninstantable { * 移除牌的所有知情者。 * @param { Card[] | Card } cards */ - static clearCardKnowers(cards) { + clearCardKnowers(cards) { // @ts-ignore if (get.itemtype(cards) == 'card') { // @ts-ignore @@ -407,7 +411,7 @@ export class Game extends Uninstantable { /** * @param { { [key: string]: any } } [arg] */ - static loseAsync(arg) { + loseAsync(arg) { var next = game.createEvent('loseAsync'); next.forceDie = true; next.getd = function (player, key, position) { @@ -466,7 +470,7 @@ export class Game extends Uninstantable { } return next; } - static callFuncUseStepCache(prefix, func, params) { + callFuncUseStepCache(prefix, func, params) { if (typeof func != 'function') return; if (_status.closeStepCache || !_status.event) return func.apply(null, params); var cacheKey = "[" + prefix + "]" + get.paramToCacheKey.apply(null, params); @@ -480,7 +484,7 @@ export class Game extends Uninstantable { /** * @param {string} name */ - static getRarity(name) { + getRarity(name) { var rank = lib.rank.rarity; if (rank.legend.includes(name)) return 'legend'; if (rank.epic.includes(name)) return 'epic'; @@ -495,7 +499,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { boolean } */ - static hasGlobalHistory(key, filter, last) { + hasGlobalHistory(key, filter, last) { // md谁写的和getGlobalHistory一样?害人! if (!key || !filter) return false; else { @@ -519,7 +523,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { void } */ - static checkGlobalHistory(key, filter, last) { + checkGlobalHistory(key, filter, last) { // md谁写的和getGlobalHistory一样?害人! if (!key || !filter) return; else { @@ -548,7 +552,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - static getGlobalHistory(key, filter, last) { + getGlobalHistory(key, filter, last) { if (!key) return _status.globalHistory[_status.globalHistory.length - 1]; if (!filter) return _status.globalHistory[_status.globalHistory.length - 1][key]; else { @@ -570,7 +574,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { boolean } */ - static hasAllGlobalHistory(key, filter, last) { + hasAllGlobalHistory(key, filter, last) { if (!key || !filter) return false; return _status.globalHistory.some(value => { if (value[key]) { @@ -594,7 +598,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { void } */ - static checkAllGlobalHistory(key, filter, last) { + checkAllGlobalHistory(key, filter, last) { if (!key || !filter) return; let stopped = false; _status.globalHistory.forEach(value => { @@ -625,7 +629,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } [last] * @returns { GameHistory[T] } */ - static getAllGlobalHistory(key, filter, last) { + getAllGlobalHistory(key, filter, last) { const history = []; _status.globalHistory.forEach(value => { if (!key || !value[key]) { @@ -661,7 +665,7 @@ export class Game extends Uninstantable { * @param {Card[]} cards * @returns { GameEventPromise } */ - static cardsDiscard(cards) { + cardsDiscard(cards) { /** @type { 'cards' | 'card' | void } */ // @ts-ignore var type = get.itemtype(cards); @@ -689,7 +693,7 @@ export class Game extends Uninstantable { * @param {Card[]} cards * @returns { GameEventPromise } */ - static cardsGotoOrdering(cards) { + cardsGotoOrdering(cards) { /** @type { 'cards' | 'card' | void } */ // @ts-ignore var type = get.itemtype(cards); @@ -715,7 +719,7 @@ export class Game extends Uninstantable { * @param { 'toRenku' | false } [bool] 为false时不触发trigger,为'toRenku'时牌放到仁库 * @returns { GameEventPromise } */ - static cardsGotoSpecial(cards, bool) { + cardsGotoSpecial(cards, bool) { /** @type { 'cards' | 'card' | void } */ // @ts-ignore var type = get.itemtype(cards); @@ -738,7 +742,7 @@ export class Game extends Uninstantable { * )} args * @returns */ - static cardsGotoPile(...args) { + cardsGotoPile(...args) { /** * @type { Card[] } */ @@ -778,7 +782,7 @@ export class Game extends Uninstantable { /** * @param { GameEventPromise } event */ - static $cardsGotoPile(event) { + $cardsGotoPile(event) { const cards = event.cards; const pile = ui.cardPile; for (let i = 0; i < cards.length; i++) { @@ -804,7 +808,7 @@ export class Game extends Uninstantable { /** * @param { false } [pause] */ - static showHistory(pause) { + showHistory(pause) { if (lib.config.show_history == 'left') { ui.window.classList.add('leftbar'); } @@ -819,7 +823,7 @@ export class Game extends Uninstantable { * @param { string } src * @param { true } [blur] */ - static createBackground(src, blur) { + createBackground(src, blur) { const current = document.body.querySelector('.background.upper'); if (current) current.delete(); const node = ui.create.div('.background.blurbg', document.body); @@ -833,7 +837,7 @@ export class Game extends Uninstantable { * @param { string } url * @param { Player } [player] */ - static changeLand(url, player) { + changeLand(url, player) { game.addVideo('changeLand', player, url); const parsedPath = lib.path.parse(url); // @ts-ignore @@ -885,7 +889,7 @@ export class Game extends Uninstantable { * @param { string[] } updates * @param { Function } proceed */ - static checkFileList(updates, proceed) { + checkFileList(updates, proceed) { let n = updates.length; if (!n) { proceed(n); @@ -937,7 +941,7 @@ export class Game extends Uninstantable { /** * @param {...(Player[] | Player)} args */ - static replaceHandcards(...args) { + replaceHandcards(...args) { var next = game.createEvent('replaceHandcards'); if (Array.isArray(args[0])) { next.players = args[0]; @@ -961,7 +965,7 @@ export class Game extends Uninstantable { /** * @param { string } name */ - static removeCard(name) { + removeCard(name) { for (var i = 0; i < lib.card.list.length; i++) { if (lib.card.list[i][2] == name) { lib.card.list.splice(i--, 1); @@ -980,7 +984,7 @@ export class Game extends Uninstantable { /** * @param { 'hidden' } [type] */ - static randomMapOL(type) { + randomMapOL(type) { if (type == 'hidden') { ui.arena.classList.add('playerhidden'); } @@ -1041,17 +1045,17 @@ export class Game extends Uninstantable { _status.mode = lib.configOL[lib.configOL.mode + '_mode']; game.chooseCharacterOL(); } - static closeMenu() { + closeMenu() { if (ui.menuContainer && !ui.menuContainer.classList.contains('hidden')) { ui.click.configMenu(); } } - static closeConnectMenu() { + closeConnectMenu() { if (ui.connectMenuContainer && !ui.connectMenuContainer.classList.contains('hidden')) { ui.click.connectMenu(); } } - static closePopped() { + closePopped() { if (ui.currentpopped) { if (ui.currentpopped._uiintro) { ui.currentpopped._uiintro.delete(); @@ -1074,7 +1078,7 @@ export class Game extends Uninstantable { * @param { ...T } args * @returns { void } */ - static broadcast(func, ...args) { + broadcast(func, ...args) { if (!lib.node || !lib.node.clients || game.online) return; for (var i = 0; i < lib.node.clients.length; i++) { if (lib.node.clients[i].inited) { @@ -1096,7 +1100,7 @@ export class Game extends Uninstantable { * @param { ...T } args * @returns { void } */ - static broadcastAll(func, ...args) { + broadcastAll(func, ...args) { if (game.online) return; game.broadcast.apply(this, arguments); if (typeof func == 'string') { @@ -1106,7 +1110,7 @@ export class Game extends Uninstantable { func.apply(this, args); } } - static syncState() { + syncState() { let state = null; if (game.getState) { state = game.getState(); @@ -1117,7 +1121,7 @@ export class Game extends Uninstantable { game.phaseNumber = number; }, state, _status.currentPhase, game.phaseNumber); } - static updateWaiting() { + updateWaiting() { const map = []; for (let i = 0; i < game.connectPlayers.length; i++) { const player = game.connectPlayers[i]; @@ -1145,7 +1149,7 @@ export class Game extends Uninstantable { /** * @param { Function } func */ - static waitForPlayer(func) { + waitForPlayer(func) { var next = game.createEvent('waitForPlayer', false); next.func = func; next.setContent('waitForPlayer'); @@ -1154,7 +1158,7 @@ export class Game extends Uninstantable { * @param { number } time * @param { Function } [onEnd] */ - static countDown(time, onEnd) { + countDown(time, onEnd) { // @ts-ignore time = parseInt(time); if (!time) return; @@ -1173,7 +1177,7 @@ export class Game extends Uninstantable { } }, 1000); } - static countChoose(clear) { + countChoose(clear) { if (_status.imchoosing) return; _status.imchoosing = true; if (_status.connectMode && !_status.countDown) { @@ -1260,7 +1264,7 @@ export class Game extends Uninstantable { } } } - static stopCountChoose() { + stopCountChoose() { if (_status.countDown) { clearInterval(_status.countDown); delete _status.countDown; @@ -1282,7 +1286,7 @@ export class Game extends Uninstantable { * @param { string } ip * @param { (result: boolean) => any } callback */ - static connect(ip, callback) { + connect(ip, callback) { if (game.online) return; let withport = false; let index = ip.lastIndexOf(':'); @@ -1316,7 +1320,7 @@ export class Game extends Uninstantable { game.ws.onclose = lib.element.ws.onclose; _status.ip = ip; } - static send() { + send() { if (game.observe && arguments[0] != 'reinited') return; if (game.ws) { const args = Array.from(arguments); @@ -1330,10 +1334,10 @@ export class Game extends Uninstantable { * @param { string } id * @param {*} message */ - static sendTo(id, message) { + sendTo(id, message) { return new lib.element.Client(new lib.element.NodeWS(id)).send(message); } - static createServer() { + createServer() { lib.node.clients = []; lib.node.banned = []; lib.node.observing = []; @@ -1357,7 +1361,7 @@ export class Game extends Uninstantable { /** * @returns { HTMLAudioElement } */ - static playAudio() { + playAudio() { let path = '', emptyPath = true, notCheckDBPath = true, onError = null; if (_status.video) { // 为了能更美观的写代码,默认返回audio而不额外加一个void类型 @@ -1447,7 +1451,7 @@ export class Game extends Uninstantable { * //如果key中包含发动技能的角色名player,则直接改用info.audioname2[player]来播放语音 * ``` */ - static parseSkillAudio(skill, player, skillInfo) { + parseSkillAudio(skill, player, skillInfo) { if (typeof player === 'string') player = { name: player }; else if (typeof player !== 'object' || player === null) player = {}; @@ -1553,7 +1557,7 @@ export class Game extends Uninstantable { * @param { ['lib']['skill'] } [skillInfo] * @returns */ - static trySkillAudio(skill, player, directaudio, nobroadcast, skillInfo) { + trySkillAudio(skill, player, directaudio, nobroadcast, skillInfo) { if (!nobroadcast) game.broadcast(game.trySkillAudio, skill, player, directaudio, nobroadcast, skillInfo); const info = skillInfo || lib.skill[skill]; if (!info) return; @@ -1573,7 +1577,7 @@ export class Game extends Uninstantable { * @param { number } [index] * @returns */ - static playSkillAudio(name, index) { + playSkillAudio(name, index) { if (_status.video && arguments[1] != 'video') return; if (!lib.config.repeat_audio && _status.skillaudio.includes(name)) return; game.addVideo('playSkillAudio', null, name); @@ -1628,7 +1632,7 @@ export class Game extends Uninstantable { * @param { string | Card } card * @param { Player | Sex } sex */ - static playCardAudio(card, sex) { + playCardAudio(card, sex) { if (typeof card === 'string') { // @ts-ignore card = { name: card }; @@ -1661,7 +1665,7 @@ export class Game extends Uninstantable { } else game.playAudio('card', sex, card.name); } - static playBackgroundMusic() { + playBackgroundMusic() { if (lib.config.background_music == 'music_off') { ui.backgroundMusic.src = ''; return; @@ -1758,7 +1762,7 @@ export class Game extends Uninstantable { * ) => importExtensionConfig } content * @param {*} [url] */ - static import(type, content, url) { + import(type, content, url) { if (type == 'extension') { const promise = game.loadExtension(content).then((name) => { if (typeof _status.extensionLoaded == "undefined") _status.extensionLoaded = []; @@ -1783,7 +1787,7 @@ export class Game extends Uninstantable { return promise; } } - static async loadExtension(object) { + async loadExtension(object) { let noEval = false; if (typeof object == 'function') { object = await (gnc.is.generatorFunc(object) ? gnc.of(object) : object)(lib, game, ui, get, ai, _status); @@ -1910,58 +1914,58 @@ export class Game extends Uninstantable { } /** * 下载文件 - * @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void) => void, dev?: 'nodev', onprogress?: Function) => void) } + * @type { undefined | ((url: string, folder: string, onsuccess?: Function, onerror?: (e: Error) => void, dev?: 'nodev', onprogress?: Function) => void) } */ - static download; + download; /** * 读取文件为arraybuffer * @type { undefined | ((filename: string, callback?: (data: Buffer | ArrayBuffer) => any, onerror?: (e: Error) => void) => void) } */ - static readFile; + readFile; /** * 读取文件为文本 * @type { undefined | ((filename: string, callback?: (data: string) => any, onerror?: (e: Error) => void) => void) } */ - static readFileAsText; + readFileAsText; /** * 将数据写入文件 * @type { undefined | ((data: File | ArrayBuffer, path: string, name: string, callback?: (e: Error) => void) => void) } */ - static writeFile; + writeFile; /** * 移除文件 * @type { undefined | ((filename: string, callback?: (e: Error) => void) => void) } */ - static removeFile; + removeFile; /** * 获取文件列表 * @type { undefined | ((dir: string, success: (folders: string[], files: string[]) => any, failure: (e: Error) => void) => void) } */ - static getFileList; + getFileList; /** * 按路径依次创建文件夹 * @type { undefined | ((list: string | string[], callback: Function, file?: boolean) => void) } */ - static ensureDirectory; + ensureDirectory; /** * 创建文件夹 * @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) } */ - static createDir; + createDir; /** * 删除文件夹 * @type { undefined | ((directory: string, successCallback?: Function, errorCallback?: Function) => void) } */ - static removeDir; + removeDir; /** * @type { (forcecheck?: boolean | null, dev?: boolean) => Promise } */ - static checkForUpdate; + checkForUpdate; /** * @type { () => Promise } */ - static checkForAssetUpdate; - static async importExtension(data, finishLoad, exportExtension, extensionPackage) { + checkForAssetUpdate; + async importExtension(data, finishLoad, exportExtension, extensionPackage) { //by 来瓶可乐加冰、Rintim、Tipx-L、诗笺 const zip = await get.promises.zip(); if (get.objtype(data) == 'object') { @@ -2114,7 +2118,7 @@ export class Game extends Uninstantable { * @param { string } textToWrite * @param { string } [name] */ - static export(textToWrite, name) { + export(textToWrite, name) { let textFileAsBlob = new Blob([textToWrite], { type: 'text/plain' }); let fileNameToSaveAs = name || 'noname'; fileNameToSaveAs = fileNameToSaveAs.replace(/\\|\/|:|\?|"|\*|<|>|\|/g, '.'); @@ -2154,7 +2158,7 @@ export class Game extends Uninstantable { * @param { Function } [process] * @param {*} [dev] */ - static multiDownload2(list, onsuccess, onerror, onfinish, process, dev) { + multiDownload2(list, onsuccess, onerror, onfinish, process, dev) { list = list.slice(0); let download = function () { if (list.length) { @@ -2197,7 +2201,7 @@ export class Game extends Uninstantable { * @param { Function } [process] * @param {*} [dev] */ - static multiDownload(list, onsuccess, onerror, onfinish, process, dev) { + multiDownload(list, onsuccess, onerror, onfinish, process, dev) { if (lib.config.dev) game.print(get.url()); const args = Array.from(arguments); if (list.length <= 3) { @@ -2229,7 +2233,7 @@ export class Game extends Uninstantable { * @param { Function } [onerror] * @param { Function } [onprogress] */ - static fetch(url, onload, onerror, onprogress) { + fetch(url, onload, onerror, onprogress) { var tmpName = '~tmp' + get.id(); game.download(encodeURI(url), tmpName, function () { game.readFile(tmpName, function (data) { @@ -2242,7 +2246,7 @@ export class Game extends Uninstantable { * @param { string } time * @param { string } mode */ - static playVideo(time, mode) { + playVideo(time, mode) { if (!_status.replayvideo) { localStorage.setItem(lib.configprefix + 'playbackmode', lib.config.mode); } @@ -2253,7 +2257,7 @@ export class Game extends Uninstantable { /** * @param { Videos } video */ - static playVideoContent(video) { + playVideoContent(video) { const next = game.createEvent('video', false); next.video = video; ui.system.style.display = 'none'; @@ -2277,7 +2281,7 @@ export class Game extends Uninstantable { next.setContent('playVideoContent'); game.loop(); } - static videoContent = { + videoContent = { arrangeLib: function (content) { for (var i in content) { for (var j in content[i]) { @@ -3631,7 +3635,7 @@ export class Game extends Uninstantable { } } } - static reload() { + reload() { if (_status) { if (_status.reloading) return; _status.reloading = true; @@ -3647,7 +3651,7 @@ export class Game extends Uninstantable { window.location.reload(); } } - static reload2() { + reload2() { lib.status.reload--; if (lib.status.reload == 0 && lib.ondb2.length) { const command = lib.ondb2.shift(); @@ -3661,7 +3665,7 @@ export class Game extends Uninstantable { window.location.reload(); delete _status.waitingToReload; } - static exit() { + exit() { var ua = userAgent; var ios = ua.includes('iphone') || ua.includes('ipad') || ua.includes('macintosh'); //electron @@ -3705,7 +3709,7 @@ export class Game extends Uninstantable { /** * @param { string } url */ - static open(url) { + open(url) { if (lib.device) { if (cordova.InAppBrowser) { cordova.InAppBrowser.open(url, '_system'); @@ -3718,7 +3722,7 @@ export class Game extends Uninstantable { window.open(url); } } - static reloadCurrent() { + reloadCurrent() { game.saveConfig('continue_name', [game.me.name1 || game.me.name, game.me.name2]); game.saveConfig('mode', lib.config.mode); localStorage.setItem(lib.configprefix + 'directstart', true); @@ -3727,7 +3731,7 @@ export class Game extends Uninstantable { /** * @param { Function } func */ - static update(func) { + update(func) { lib.updates.push(func); if (lib.updates.length === 1) { game.run(); @@ -3737,13 +3741,13 @@ export class Game extends Uninstantable { /** * @param { Function } func */ - static unupdate(func) { + unupdate(func) { lib.updates.remove(func); } - static stop() { + stop() { cancelAnimationFrame(lib.status.frameId); } - static run() { + run() { if (lib.updates.length) { cancelAnimationFrame(lib.status.frameId); lib.status.frameId = requestAnimationFrame(function (time) { @@ -3760,7 +3764,7 @@ export class Game extends Uninstantable { * @param { any } [content] * @returns */ - static addVideo(type, player, content) { + addVideo(type, player, content) { if (_status.video || game.online) return; if (!_status.videoInited) { if (type == 'arrangeLib') { @@ -3796,7 +3800,7 @@ export class Game extends Uninstantable { /** * @param { Function } func */ - static draw(func) { + draw(func) { lib.canvasUpdates.push(func); if (!lib.status.canvas) { lib.status.canvas = true; @@ -3806,12 +3810,12 @@ export class Game extends Uninstantable { /** * @param { number } [time] */ - static vibrate(time) { + vibrate(time) { if ('vibrate' in navigator) { navigator.vibrate(time || 500); } } - static prompt() { + prompt() { let str, forced, callback, noinput = false, str2 = ''; for (let i = 0; i < arguments.length; i++) { if (arguments[i] == 'alert') { @@ -3910,16 +3914,16 @@ export class Game extends Uninstantable { } //} } - static alert(str) { + alert(str) { game.prompt(str, 'alert'); } - static print() { + print() { if (!_status.toprint) { _status.toprint = []; } _status.toprint.push(Array.from(arguments)); } - static animate = { + animate = { window: function (num) { switch (num) { case 1: { @@ -4180,7 +4184,7 @@ export class Game extends Uninstantable { /** * @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path */ - static linexy(path) { + linexy(path) { const from = [path[0], path[1]], to = [path[2], path[3]]; let total = typeof arguments[1] === 'number' ? arguments[1] : lib.config.duration * 2, opacity = 1, @@ -4253,7 +4257,7 @@ export class Game extends Uninstantable { /** * @param { [number, number | {opacity:any, color:any, dashed:any, duration:any} | string, number, number] } path */ - static _linexy(path) { + _linexy(path) { let from = [path[0], path[1]]; let to = [path[2], path[3]]; let total = typeof arguments[1] === 'number' ? arguments[1] : lib.config.duration * 2; @@ -4327,7 +4331,7 @@ export class Game extends Uninstantable { * @param { GameEventPromise } event * @returns { GameEventPromise } */ - static createTrigger(name, skill, player, event, indexedData) { + createTrigger(name, skill, player, event, indexedData) { let info = get.info(skill); if (!info) return false; if ((player.isOut() || player.removed) && !info.forceOut) return; @@ -4350,7 +4354,7 @@ export class Game extends Uninstantable { * @param { false } [trigger] * @param { GameEventPromise } [triggerEvent] */ - static createEvent(name, trigger, triggerEvent) { + createEvent(name, trigger, triggerEvent) { const next = (new lib.element.GameEvent(name, trigger)).toPromise(); (triggerEvent || _status.event).next.push(next); return next; @@ -4359,7 +4363,7 @@ export class Game extends Uninstantable { * @param { string } name * @param { { extension: string, sex: Sex, group: string, hp: string | number, skills?: string[], tags?: any[], translate: string } } information */ - static addCharacter(name, information) { + addCharacter(name, information) { const extensionName = _status.extension || information.extension, character = [ information.sex, information.group, @@ -4382,7 +4386,7 @@ export class Game extends Uninstantable { * @param { { mode?: string, forbid?: any, character: { [key: string]: Character }, skill: { [key: string]: object }, [key: string]: any } } pack * @param { string } [packagename] */ - static addCharacterPack(pack, packagename) { + addCharacterPack(pack, packagename) { let extname = _status.extension || '扩展'; let gzFlag = false; packagename = packagename || extname; @@ -4447,7 +4451,7 @@ export class Game extends Uninstantable { * @param { Card } info * @param { { extension: string, translate: string, description: string, number?: number, color?: string } } info2 */ - static addCard(name, info, info2) { + addCard(name, info, info2) { var extname = (_status.extension || info2.extension); if (info.audio == true) { info.audio = 'ext:' + extname; @@ -4494,7 +4498,7 @@ export class Game extends Uninstantable { * @param { { extension: string, mode?: string[], forbid?: string[], list: any[], card: {[key: string]: Card}, skill: { [key: string]: object } } } pack * @param { string } [packagename] */ - static addCardPack(pack, packagename) { + addCardPack(pack, packagename) { let extname = _status.extension || '扩展'; packagename = packagename || extname; let packname = 'mode_extension_' + packagename; @@ -4562,7 +4566,7 @@ export class Game extends Uninstantable { * @param { string } [appendInfo] * @param { string } [abInfo] */ - static addSkill(name, info, translate, description, appendInfo, abInfo) { + addSkill(name, info, translate, description, appendInfo, abInfo) { if (lib.skill[name]) { return false; } @@ -4581,7 +4585,7 @@ export class Game extends Uninstantable { * @param {*} info * @param { { translate: string, config: { [key: string]: object } } } info2 */ - static addMode(name, info, info2) { + addMode(name, info, info2) { lib.config.all.mode.push(name); lib.translate[name] = info2.translate; let imgsrc; @@ -4619,7 +4623,7 @@ export class Game extends Uninstantable { * @param { string } skill * @param { Player } [player] */ - static addGlobalSkill(skill, player) { + addGlobalSkill(skill, player) { let info = lib.skill[skill]; if (!info) return false; lib.skill.global.add(skill); @@ -4655,7 +4659,7 @@ export class Game extends Uninstantable { * @param { string } skill * @param { lib.element.Player } player */ - static removeGlobalSkill(skill, player) { + removeGlobalSkill(skill, player) { const players = lib.skill.globalmap[skill]; if(player && Array.isArray(players)) { lib.skill.globalmap[skill].remove(player); @@ -4667,7 +4671,7 @@ export class Game extends Uninstantable { lib.hook.globalskill[i].remove(skill); } } - static resetSkills() { + resetSkills() { for (let i = 0; i < game.players.length; i++) { for (let j in game.players[i].tempSkills) { game.players[i].removeSkill(j); @@ -4685,7 +4689,7 @@ export class Game extends Uninstantable { /** * @param { string } extensionName */ - static hasExtension(extensionName) { + hasExtension(extensionName) { if (typeof lib.config[`extension_${extensionName}_enable`] != 'boolean') { game.saveExtensionConfig(extensionName, 'enable', true); } @@ -4694,20 +4698,20 @@ export class Game extends Uninstantable { /** * @param { string } extensionName */ - static hasExtensionInstalled(extensionName) { + hasExtensionInstalled(extensionName) { return lib.config.extensions.includes(extensionName); } /** * @param { string } extensionName */ - static hasExtensionLoaded(extensionName) { + hasExtensionLoaded(extensionName) { return extensionName !== void 0 && _status.extensionLoaded.includes(extensionName); } /** * @param { string } extensionName * @param { Function } runnable */ - static runAfterExtensionLoaded(extensionName, runnable) { + runAfterExtensionLoaded(extensionName, runnable) { if (game.hasExtensionLoaded(extensionName)) { runnable(); } else { @@ -4723,7 +4727,7 @@ export class Game extends Uninstantable { * @param { string } extensionName * @param { boolean } [keepFile] */ - static removeExtension(extensionName, keepFile) { + removeExtension(extensionName, keepFile) { const prefix = `extension_${extensionName}`; Object.keys(lib.config).forEach(key => { if (key.startsWith(prefix)) game.saveConfig(key); @@ -4742,7 +4746,7 @@ export class Game extends Uninstantable { if (!game.download || keepFile) return; game.promises.removeDir(`${nonameInitialized}extension/${extensionName}`).catch(console.error); } - static addRecentCharacter() { + addRecentCharacter() { let list = get.config('recentCharacter') || []; for (let i = 0; i < arguments.length; i++) { if (lib.character[arguments[i]]) { @@ -4767,7 +4771,7 @@ export class Game extends Uninstantable { * @param { number | string } [number] * @param { string } [nature] */ - static createCard(name, suit, number, nature) { + createCard(name, suit, number, nature) { if (typeof name == 'object') { nature = name.nature; number = name.number; @@ -4821,7 +4825,7 @@ export class Game extends Uninstantable { * @param { number } number * @param { string } nature */ - static createCard2() { + createCard2() { let card = game.createCard.apply(this, arguments); delete card.storage.vanish; return card; @@ -4830,7 +4834,7 @@ export class Game extends Uninstantable { * @param { boolean } bool * @param { Function } callback */ - static forceOver(bool, callback) { + forceOver(bool, callback) { _status.event.next.length = 0; let next = game.createEvent('finish_game'); next.bool = bool; @@ -4846,7 +4850,7 @@ export class Game extends Uninstantable { * @param { boolean } [bool] * @returns */ - static over(result, bool) { + over(result, bool) { if (_status.over) return; if (game.me._trueMe) game.swapPlayer(game.me._trueMe); let i, j, k, num, table, tr, td, dialog; @@ -5489,15 +5493,15 @@ export class Game extends Uninstantable { * * 但是需要事件结果的除外 */ - static executingAsyncEventMap = new Map(); + executingAsyncEventMap = new Map(); /** * @type { GameEventPromise[] } */ - static belongAsyncEventList = []; + belongAsyncEventList = []; /** * @param { GameEventPromise } [belongAsyncEvent] */ - static async loop(belongAsyncEvent) { + async loop(belongAsyncEvent) { if (belongAsyncEvent) { game.belongAsyncEventList.push(belongAsyncEvent); } else if (game.belongAsyncEventList.length) { @@ -5663,7 +5667,7 @@ export class Game extends Uninstantable { /** * @param { GameEventPromise } [belongAsyncEvent] */ - static runContent(belongAsyncEvent) { + runContent(belongAsyncEvent) { return new Promise(resolve => { let event = (belongAsyncEvent && belongAsyncEvent.parent == _status.event) ? belongAsyncEvent : _status.event; let { step, source, player, target, targets, card, cards, skill, forced, num, _trigger: trigger, _result: result, _storeEvent } = event; @@ -5785,15 +5789,15 @@ export class Game extends Uninstantable { } }); } - static pause() { + pause() { clearTimeout(_status.timeout); _status.paused = true; } - static pause2() { + pause2() { if (_status.connectMode) return; _status.paused2 = true; } - static resume() { + resume() { if (_status.paused) { if (!_status.noclearcountdown) { game.stopCountChoose(); @@ -5803,20 +5807,20 @@ export class Game extends Uninstantable { game.loop(); } } - static resume2() { + resume2() { if (_status.connectMode) return; if (_status.paused2) { _status.paused2 = false; game.loop(); } } - static delaye() { + delaye() { let next = game.createEvent('delay', false); next.setContent('delay'); next._args = Array.from(arguments); return next; } - static delayex() { + delayex() { let next = game.createEvent('delayx', false); next.setContent('delay'); next._args = Array.from(arguments); @@ -5826,7 +5830,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static delay(time, time2) { + delay(time, time2) { if (_status.paused) return; game.pause(); if (typeof time != 'number') time = 1; @@ -5839,7 +5843,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static delayx(time, time2) { + delayx(time, time2) { if (typeof time != 'number') time = 1; switch (lib.config.game_speed) { case 'vslow': time *= 2.5; break; @@ -5858,7 +5862,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static asyncDelay(time, time2) { + asyncDelay(time, time2) { // if(_status.paused) return; // game.pause(); if (typeof time != 'number') time = 1; @@ -5876,7 +5880,7 @@ export class Game extends Uninstantable { * @param { number } [time] * @param { number } [time2] */ - static asyncDelayx(time, time2) { + asyncDelayx(time, time2) { if (typeof time != 'number') time = 1; switch (lib.config.game_speed) { case 'vslow': time *= 2.5; break; @@ -5890,7 +5894,7 @@ export class Game extends Uninstantable { /** * @param { GameEventPromise } [event] */ - static check(event = _status.event) { + check(event = _status.event) { game.callHook("checkBegin", [event]); event._checked = true; @@ -5975,140 +5979,8 @@ export class Game extends Uninstantable { // } return ok; } - static Check = class extends Uninstantable { - static processSelection({ type, items, event, useCache, isSelectable }) { - let ok = true, auto; - let selectableItems = false; - const uppercaseType = (type) => type[0].toUpperCase() + type.slice(1); - const uiSelected = ui.selected[`${type}s`]; - const range = get.select(event[`select${uppercaseType(type)}`]); - - if (event.forceAuto && uiSelected.length === range[1]) auto = true; - else if (range[0] !== range[1] || range[0] > 1) auto = false; - - let cache; - let firstCheck = false; - - if (useCache) { - if (!event[`_${type}Choice`]) event[`_${type}Choice`] = {}; - let cacheId = 0; - for (let Type of ['button', 'card', 'target']) { - if (type === Type) break; - if (Type === "target") Type = "player"; - ui.selected[`${Type}s`].forEach(i => cacheId ^= i[`${Type}id`]); - } - if (!event[`_${type}Choice`][cacheId]) { - event[`_${type}Choice`][cacheId] = []; - firstCheck = true; - } - cache = event[`_${type}Choice`][cacheId]; - } - - items.forEach(item => { - let selectable; - if (!lib.filter.cardAiIncluded(item)) selectable = false; - else if (useCache && !firstCheck) selectable = cache.includes(item); - else selectable = isSelectable(item, event); - - if (range[1] <= -1) { - if (selectable) { - item.classList.add('selected'); - uiSelected.add(item); - } else { - item.classList.remove('selected'); - uiSelected.remove(item); - } - if (item.updateTransform) item.updateTransform(selectable); - } else { - if (selectable && uiSelected.length < range[1]) { - item.classList.add('selectable'); - if (firstCheck) cache.push(item); - } - else item.classList.remove('selectable'); - } - - if (item.classList.contains('selectable')) selectableItems = true; - else if (item.classList.contains('selected')) item.classList.add('selectable'); - - game.callHook(`check${uppercaseType(type)}`, [item, event]); - }); - - if (event[`${type}Required`] && uiSelected.length === 0) ok = false; - else if (uiSelected.length < range[0] && (!event.forced || selectableItems || event.complexSelect)) ok = false; - - if (event.custom && event.custom.add[type]) event.custom.add[type](); - - return { ok, auto }; - } - static button(event, useCache) { - const player = event.player; - const buttons = event.dialog.buttons; - const isSelectable = (button, event) => { - if (!lib.filter.buttonIncluded(button)) return false; - if (button.classList.contains('unselectable')) return false; - return event.filterButton(button, player); - } - return game.Check.processSelection({ type: 'button', items: buttons, event, useCache, isSelectable }); - } - static card(event, useCache) { - const player = event.player; - const cards = player.getCards(event.position); - const isSelectable = (card, event) => { - if (card.classList.contains('uncheck')) return false; - if (player.isOut()) return false; - if (!lib.filter.cardRespondable(card, player)) return false; - return event.filterCard(card, player); - } - return game.Check.processSelection({ type: 'card', items: cards, event, useCache, isSelectable }); - } - static target(event, useCache) { - const player = event.player; - const card = get.card(); - const targets = game.players.slice(); - if (event.deadTarget) targets.addArray(game.dead); - const isSelectable = (target, event) => { - if (game.chess && !event.chessForceAll && player && get.distance(player, target, 'pure') > 7) return false; - if (target.isOut()) return false; - return event.filterTarget(card, player, target); - } - return game.Check.processSelection({ type: 'target', items: targets, event, useCache, isSelectable }); - } - static skill(event) { - if (ui.skills) ui.skills.close(); - if (ui.skills2) ui.skills2.close(); - if (ui.skills3) ui.skills3.close(); - if (event.skill || !get.noSelected() || _status.noconfirm) return; - - const player = event.player; - if (!event._skillChoice) event._skillChoice = game.expandSkills(player.getSkills('invisible').concat(lib.skill.global)).filter(skill => lib.filter.filterEnable(event, player, skill)); - - const skills = event._skillChoice.filter(i => event.isMine() || !event._aiexclude.includes(i)); - const globallist = game.expandSkills(lib.skill.global.slice()); - const ownedlist = game.expandSkills(player.getSkills('invisible', false)); - - const ownedSkills = [], globalSkills = [], equipSkills = []; - skills.forEach(skill => { - if (globallist.includes(skill)) globalSkills.push(skill); - else if (!ownedlist.includes(skill)) equipSkills.push(skill); - else ownedSkills.push(skill); - }); - - if (ownedSkills.length) ui.create.skills(ownedSkills); - if (globalSkills.length) ui.create.skills2(globalSkills); - if (equipSkills.length) ui.create.skills3(equipSkills); - } - static confirm(event, confirm) { - ui.arena.classList.add('selecting'); - if (event.filterTarget && (!event.filterCard || !event.position || (typeof event.position == 'string' && !event.position.includes('e')))) { - ui.arena.classList.add('tempnoe'); - } - game.countChoose(); - if (!_status.noconfirm && !_status.event.noconfirm && (_status.mouseleft || !_status.mousedown)) { - ui.create.confirm(confirm); - } - } - } - static uncheck(...args) { + Check = new Check() + uncheck(...args) { if (args.length === 0) args = ['button', 'card', 'target']; const event = _status.event; const players = game.players.slice(); @@ -6175,7 +6047,7 @@ export class Game extends Uninstantable { * @param { boolean } [behind] * @param { boolean } [noanimate] */ - static swapSeat(player1, player2, prompt, behind, noanimate) { + swapSeat(player1, player2, prompt, behind, noanimate) { if (noanimate) { player1.style.transition = 'all 0s'; player2.style.transition = 'all 0s'; @@ -6237,7 +6109,7 @@ export class Game extends Uninstantable { * @param { Player } player1 * @param { Player } [player2] */ - static swapPlayer(player, player2) { + swapPlayer(player, player2) { let players = game.players.concat(game.dead) if (player2) { if (player == game.me) game.swapPlayer(player2); @@ -6306,7 +6178,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static swapControl(player) { + swapControl(player) { if (player == game.me) return; game.me.node.handcards1.remove(); @@ -6341,7 +6213,7 @@ export class Game extends Uninstantable { } } } - static swapPlayerAuto(player) { + swapPlayerAuto(player) { if (game.modeSwapPlayer) { game.modeSwapPlayer(player); } @@ -6352,7 +6224,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static findNext(player) { + findNext(player) { let players = get.players(lib.sort.position); let position = parseInt(player.dataset.position); for (let i = 0; i < players.length; i++) { @@ -6366,7 +6238,7 @@ export class Game extends Uninstantable { * @param { string } name * @param { Function } callback */ - static loadModeAsync(name, callback) { + loadModeAsync(name, callback) { window.game = game; let script = lib.init.js(lib.assetURL + 'mode', name, async () => { await Promise.allSettled(_status.importing.mode); @@ -6384,7 +6256,7 @@ export class Game extends Uninstantable { * @param { string } name * @param {*} configx */ - static switchMode(name, configx) { + switchMode(name, configx) { if (!lib.layoutfixed.includes(name)) { if (lib.config.layout != game.layout) { lib.init.layout(lib.config.layout); @@ -6573,7 +6445,7 @@ export class Game extends Uninstantable { /** * @param { string } mode */ - static loadMode(mode) { + loadMode(mode) { let next = game.createEvent('loadMode', false); next.mode = mode; next.setContent('loadMode'); @@ -6581,7 +6453,7 @@ export class Game extends Uninstantable { /** * @param {...string} args */ - static loadPackage(...args) { + loadPackage(...args) { let next = game.createEvent('loadPackage'); next.packages = []; for (let i = 0; i < arguments.length; i++) { @@ -6594,7 +6466,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static phaseLoop(player) { + phaseLoop(player) { let next = game.createEvent('phaseLoop'); next.player = player; next._isStandardLoop = true; @@ -6603,14 +6475,14 @@ export class Game extends Uninstantable { /** * @param { Player } [player] */ - static gameDraw(player, num = 4) { + gameDraw(player, num = 4) { let next = game.createEvent('gameDraw'); next.player = player || game.me; next.num = num; next.setContent('gameDraw'); return next; } - static chooseCharacterDouble() { + chooseCharacterDouble() { let next = game.createEvent('chooseCharacter'); let config, width, num, ratio, func, update, list, first; for (let i = 0; i < arguments.length; i++) { @@ -7129,7 +7001,7 @@ export class Game extends Uninstantable { } }); } - static updateRoundNumber() { + updateRoundNumber() { game.broadcastAll((roundNumber, pileTop, pileNumber) => { if (game.roundNumber != roundNumber) game.roundNumber = roundNumber; if (_status.pileTop != pileTop) _status.pileTop = pileTop; @@ -7142,7 +7014,7 @@ export class Game extends Uninstantable { * @param { { drawDeck: boolean } } [drawDeck] * @param { boolean } [bottom] */ - static asyncDraw(players, num, drawDeck, bottom) { + asyncDraw(players, num, drawDeck, bottom) { return players.forEach((value, index) => { let num2 = 1; if (typeof num == 'number') num2 = num; @@ -7158,7 +7030,7 @@ export class Game extends Uninstantable { * @param { number | number[] | (player: Player) => number } num * @param { { drawDeck: boolean } } [drawDeck] */ - static asyncDrawAuto(players, num, drawDeck) { + asyncDrawAuto(players, num, drawDeck) { if (players.length > 1) { game.asyncDraw.apply(this, arguments); return; @@ -7170,7 +7042,7 @@ export class Game extends Uninstantable { if (drawDeck && drawDeck.drawDeck) players[0].draw(num2, drawDeck); else players[0].draw(num2); } - static finishSkill(i, sub) { + finishSkill(i, sub) { const mode = get.mode(), info = lib.skill[i], iInfo = `${i}_info`; if (info.alter) { lib.translate[`${iInfo}_origin`] = lib.translate[iInfo]; @@ -7292,7 +7164,7 @@ export class Game extends Uninstantable { } if (i[0] == '_') game.addGlobalSkill(i); } - static finishCards() { + finishCards() { _status.cardsFinished = true; const mode = get.mode(), filterTarget = (card, player, target) => player == target && target.canEquip(card, true), aiBasicOrder = (card, player) => { const equipValue = get.equipValue(card, player) / 20; @@ -7364,7 +7236,7 @@ export class Game extends Uninstantable { /** * 这玩意至少19种重载了吧 */ - static checkMod() { + checkMod() { const argumentArray = Array.from(arguments), name = argumentArray[argumentArray.length - 2]; let skills = argumentArray[argumentArray.length - 1]; if (typeof skills.getModableSkills == 'function') { @@ -7390,7 +7262,7 @@ export class Game extends Uninstantable { /** * @param { number } num */ - static prepareArena(num) { + prepareArena(num) { _status.prepareArena = true; game.showHistory(false); ui.create.players(num); @@ -7398,7 +7270,7 @@ export class Game extends Uninstantable { ui.create.cardsAsync(); game.finishCards(); } - static clearArena() { + clearArena() { ui.control.innerHTML = ''; ui.arenalog.innerHTML = ''; Array.from(ui.arena.childNodes).forEach(value => { @@ -7420,7 +7292,7 @@ export class Game extends Uninstantable { game.dead.length = 0; game.me = null; } - static clearConnect() { + clearConnect() { if (ui.ipnode) { ui.ipnode.remove(); delete ui.ipnode; @@ -7465,7 +7337,7 @@ export class Game extends Uninstantable { delete ui.connectClientsCount; delete ui.createRoomButton; } - static log() { + log() { let str = '', str2 = '', logvid = null; const color = new Map([ ['r', 'fire'], @@ -7545,7 +7417,7 @@ export class Game extends Uninstantable { * @param { boolean } [forced] * @param { string } [logvid] */ - static logv(player, card, targets, event, forced, logvid) { + logv(player, card, targets, event, forced, logvid) { if (!player) { player = _status.event.getParent().logvid; if (!player) return; @@ -7692,7 +7564,7 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static putDB(storeName, idbValidKey, value, onSuccess, onError) { + putDB(storeName, idbValidKey, value, onSuccess, onError) { if (!lib.db) return Promise.resolve(value); if (lib.status.reload) return new Promise((resolve, reject) => lib[_status.dburgent ? 'ondb2' : 'ondb'].push(['putDB', [storeName, idbValidKey, value, event => { if (typeof onSuccess == 'function') onSuccess(event); @@ -7736,7 +7608,7 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static getDB(storeName, query, onSuccess, onError) { + getDB(storeName, query, onSuccess, onError) { if (!lib.db) return new Promise(resolve => { if (typeof onSuccess == 'function') onSuccess(null); resolve(null); @@ -7812,7 +7684,7 @@ export class Game extends Uninstantable { * @param { Function } [onSuccess] * @param { Function } [onError] */ - static deleteDB(storeName, query, onSuccess, onError) { + deleteDB(storeName, query, onSuccess, onError) { if (!lib.db) return new Promise(resolve => { if (typeof onSuccess == 'function') onSuccess(false); resolve(false); @@ -7868,7 +7740,7 @@ export class Game extends Uninstantable { * @param { * } [value] * @param { string } [mode] */ - static save(key, value, mode) { + save(key, value, mode) { if (_status.reloading) return; mode = mode || lib.config.mode; if (lib.db) { @@ -7914,7 +7786,7 @@ export class Game extends Uninstantable { config.version = lib.version; localStorage.setItem(`${lib.configprefix}${mode}`, JSON.stringify(config)); } - static showChangeLog() { + showChangeLog() { if (lib.version == lib.config.version && !_status.extensionChangeLog) return; const ul = document.createElement('ul'); ul.style.textAlign = 'left'; @@ -7979,7 +7851,7 @@ export class Game extends Uninstantable { * @param { string } str * @param { string } [extname] */ - static showExtensionChangeLog(str, extname) { + showExtensionChangeLog(str, extname) { extname = extname || _status.extension; const cfg = `extension_${extname}_changelog`; if (!lib.extensionPack[extname] || lib.extensionPack[extname].version == lib.config[cfg]) return; @@ -7994,7 +7866,7 @@ export class Game extends Uninstantable { * @param { string | boolean } [local] * @param { Function } [callback] */ - static saveConfig(key, value, local, callback) { + saveConfig(key, value, local, callback) { if (_status.reloading) return; if (local) { const localmode = typeof local == 'string' ? local : lib.config.mode; @@ -8026,27 +7898,27 @@ export class Game extends Uninstantable { /** * @param { string } key */ - static saveConfigValue(key) { return game.saveConfig(key, lib.config[key]) } + saveConfigValue(key) { return game.saveConfig(key, lib.config[key]) } /** * @param { string } extension * @param { string } key * @param { * } [value] */ - static saveExtensionConfig(extension, key, value) { return game.saveConfig(`extension_${extension}_${key}`, value) } + saveExtensionConfig(extension, key, value) { return game.saveConfig(`extension_${extension}_${key}`, value) } /** * @param { string } extension * @param { string } key */ - static saveExtensionConfigValue(extension, key) { return game.saveExtensionConfig(extension, key, game.getExtensionConfig(extension, key)) } + saveExtensionConfigValue(extension, key) { return game.saveExtensionConfig(extension, key, game.getExtensionConfig(extension, key)) } /** * @param { string } extension * @param { string } key */ - static getExtensionConfig(extension, key) { return lib.config[`extension_${extension}_${key}`] } + getExtensionConfig(extension, key) { return lib.config[`extension_${extension}_${key}`] } /** * @param { string } mode */ - static clearModeConfig(mode) { + clearModeConfig(mode) { if (_status.reloading) return; if (lib.db) { game.getDB('config', null, config => Object.keys(config).forEach(value => { @@ -8073,7 +7945,7 @@ export class Game extends Uninstantable { * @param { string } [character] * @param { string } [character2] */ - static addPlayer(position, character, character2) { + addPlayer(position, character, character2) { if (position < 0 || position > game.players.length + game.dead.length || position == undefined) position = Math.ceil(Math.random() * (game.players.length + game.dead.length)); const players = game.players.concat(game.dead); ui.arena.setNumber(players.length + 1); @@ -8092,7 +7964,7 @@ export class Game extends Uninstantable { * @param { string } [character] * @param { string } [animation] */ - static addFellow(position, character, animation) { + addFellow(position, character, animation) { game.addVideo('addFellow', null, [position, character, animation]); const player = ui.create.player(ui.arena).addTempClass(animation || 'start'); player.dataset.position = position || game.players.length + game.dead.length; @@ -8105,7 +7977,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static triggerEnter(player) { + triggerEnter(player) { const next = game.createEvent('enterGame', false); next.player = player; next.setContent(() => { @@ -8116,7 +7988,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static restorePlayer(player) { + restorePlayer(player) { if (game.players.includes(player) || game.dead.includes(player)) return; let position = parseInt(player.dataset.position); if (position < 0 || position > game.players.length + game.dead.length || position == undefined) position = Math.ceil(Math.random() * (game.players.length + game.dead.length)); @@ -8136,7 +8008,7 @@ export class Game extends Uninstantable { /** * @param { Player } player */ - static removePlayer(player) { + removePlayer(player) { if (_status.roundStart == player) _status.roundStart = player.next || player.getNext() || game.players[0]; const players = game.players.concat(game.dead); player.style.left = `${player.getLeft()}px`; @@ -8170,7 +8042,7 @@ export class Game extends Uninstantable { * @param { string } [character] * @param { string } [character2] */ - static replacePlayer(player, character, character2) { + replacePlayer(player, character, character2) { player.removed = true; const position = parseInt(player.dataset.position); game.players.remove(player); @@ -8199,7 +8071,7 @@ export class Game extends Uninstantable { if (_status.roundStart == player) _status.roundStart = player2; return player2; } - static arrangePlayers() { + arrangePlayers() { if (game.chess && game.me) { let friendCount = 0, enemyCount = 0; const rand = Math.random() < 0.5, sortCount = new Map(); @@ -8239,7 +8111,7 @@ export class Game extends Uninstantable { * @param { Player } player * @param { string[] } exclude */ - static filterSkills(skills, player, exclude) { + filterSkills(skills, player, exclude) { const out = skills.slice().removeArray(Object.keys(player.disabledSkills)); if (!player.storage.skill_blocker || !player.storage.skill_blocker.length) return out; return out.filter(value => exclude && exclude.includes(value) || !get.is.blocked(value, player)); @@ -8247,7 +8119,7 @@ export class Game extends Uninstantable { /** * @param { string[] } skills */ - static expandSkills(skills) { + expandSkills(skills) { return skills.addArray(skills.reduce((previousValue, currentValue) => { const info = get.info(currentValue); if (info) { @@ -8263,7 +8135,7 @@ export class Game extends Uninstantable { /** * @param { { [key:string]: any } } style */ - static css(style) { + css(style) { return Object.keys(style).forEach(value => { let uiStyle = ui.style[value]; if (!uiStyle) { @@ -8277,17 +8149,17 @@ export class Game extends Uninstantable { * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static hasPlayer(func, includeOut) { return game.players.some(value => (includeOut || !value.isOut()) && func(value)) } + hasPlayer(func, includeOut) { return game.players.some(value => (includeOut || !value.isOut()) && func(value)) } /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static hasPlayer2(func, includeOut) { return game.players.concat(game.dead).some(value => (includeOut || !value.isOut()) && func(value)) } + hasPlayer2(func, includeOut) { return game.players.concat(game.dead).some(value => (includeOut || !value.isOut()) && func(value)) } /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static countPlayer(func, includeOut) { + countPlayer(func, includeOut) { if (typeof func != 'function') func = lib.filter.all; return game.players.reduce((previousValue, currentValue) => { if (!includeOut && currentValue.isOut()) return previousValue; @@ -8301,7 +8173,7 @@ export class Game extends Uninstantable { * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static countPlayer2(func, includeOut) { + countPlayer2(func, includeOut) { if (typeof func != 'function') func = lib.filter.all; return game.players.concat(game.dead).reduce((previousValue, currentValue) => { if (!includeOut && currentValue.isOut()) return previousValue; @@ -8322,7 +8194,7 @@ export class Game extends Uninstantable { * @param { boolean } [includeOut] * @returns { Player[] } */ - static filterPlayer(func, list, includeOut) { + filterPlayer(func, list, includeOut) { if (!Array.isArray(list)) list = []; if (typeof func != 'function') func = lib.filter.all; return list.addArray(game.players.filter(value => (includeOut || !value.isOut()) && func(value))); @@ -8338,7 +8210,7 @@ export class Game extends Uninstantable { * @param { boolean } [includeOut] * @returns { Player[] } */ - static filterPlayer2(func, list, includeOut) { + filterPlayer2(func, list, includeOut) { if (!Array.isArray(list)) list = []; if (typeof func != 'function') func = lib.filter.all; return list.addArray(game.players.concat(game.dead).filter(value => (includeOut || !value.isOut()) && func(value))); @@ -8347,17 +8219,17 @@ export class Game extends Uninstantable { * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static findPlayer(func, includeOut) { return game.players.find(value => (includeOut || !value.isOut()) && func(value)) || null } + findPlayer(func, includeOut) { return game.players.find(value => (includeOut || !value.isOut()) && func(value)) || null } /** * @param { (player: Player) => boolean } func * @param { boolean } [includeOut] */ - static findPlayer2(func, includeOut) { return game.players.concat(game.dead).find(value => (includeOut || !value.isOut()) && func(value)) || null } + findPlayer2(func, includeOut) { return game.players.concat(game.dead).find(value => (includeOut || !value.isOut()) && func(value)) || null } /** * @param { (player: Player) => boolean } func * @param { boolean } [all] */ - static findCards(func, all) { + findCards(func, all) { return Object.keys(lib.card).filter(value => { if (!lib.translate[`${value}_info`]) return false; if (lib.card[value].mode && lib.card[value].mode.includes(lib.config.mode) == false) return false; @@ -8365,7 +8237,7 @@ export class Game extends Uninstantable { return func(value, lib.card[value]); }) } - static countGroup() { + countGroup() { const list = lib.group.slice(0); return game.countPlayer(current => { if (!list.includes(current.group)) return false; @@ -8378,7 +8250,7 @@ export class Game extends Uninstantable { * @param {function} 测试的函数 * @returns {number} 消耗的时间 */ - static testRunCost(func){ + testRunCost(func){ let time = Date.now(); func(); let past = Date.now() - time; @@ -8392,7 +8264,7 @@ export class Game extends Uninstantable { * @param { (player: Player, i: number) => Promise } asyncFunc 需要执行的async方法 * @param { (a: Player, b: Player) => number } sort 排序器,默认为lib.sort.seat */ - static async doAsyncInOrder(targets,asyncFunc,sort){ + async doAsyncInOrder(targets,asyncFunc,sort){ if(!sort) sort = lib.sort.seat; let sortedTargets = targets.sort(sort); for(let i=0;i } [instance] + */ +export let setGame = (instance) => { + game = instance || new Game(); + if (lib.config.dev) { + window.game = game; + } +}; diff --git a/noname/game/promises.js b/noname/game/promises.js index 0fe76dd33..ecbfadc37 100644 --- a/noname/game/promises.js +++ b/noname/game/promises.js @@ -1,7 +1,6 @@ -import { Uninstantable } from "../util/index.js"; -import { game, Game } from "./index.js"; +import { game } from "../../noname.js"; -export class GamePromises extends Uninstantable { +export class GamePromises { /** * 模仿h5的prompt,用于显示可提示用户进行输入的对话框 * @@ -32,7 +31,7 @@ export class GamePromises extends Uninstantable { * */ // @ts-ignore - static prompt(alertOption, title, forced) { + prompt(alertOption, title, forced) { return new Promise((resolve, reject) => { if (alertOption !== 'alert') { // @ts-ignore @@ -54,29 +53,33 @@ export class GamePromises extends Uninstantable { * ``` * @returns { Promise } */ - static alert(title) { + alert(title) { return new Promise((resolve, reject) => { game.prompt(title, 'alert', resolve); }); } // 读写函数promises化(不用考虑其对应函数是否存在) - static download(url, folder, dev, onprogress) { + download(url, folder, dev, onprogress) { return new Promise((resolve, reject) => { + // @ts-ignore game.download(url, folder, resolve, reject, dev, onprogress); }); } - static readFile(filename) { + readFile(filename) { return new Promise((resolve, reject) => { + // @ts-ignore game.readFile(filename, resolve, reject); }); } - static readFileAsText(filename) { + readFileAsText(filename) { return new Promise((resolve, reject) => { + // @ts-ignore game.readFileAsText(filename, resolve, reject); }); } - static writeFile(data, path, name) { + writeFile(data, path, name) { return (new Promise((resolve, reject) => { + // @ts-ignore game.writeFile(data, path, name, resolve); })).then(result => { return new Promise((resolve, reject) => { @@ -88,26 +91,30 @@ export class GamePromises extends Uninstantable { }); }); } - static ensureDirectory(list, callback, file) { + ensureDirectory(list, callback, file) { return new Promise((resolve, reject) => { - game.ensureDirectory(list, callback, file).then(resolve).catch(reject); + // @ts-ignore + game.ensureDirectory(list, resolve, file); }); } - static createDir(directory) { + createDir(directory) { return new Promise((resolve, reject) => { + // @ts-ignore game.createDir(directory, resolve, reject); }); } - static removeFile(filename) { + removeFile(filename) { return /** @type {Promise} */(new Promise((resolve, reject) => { + // @ts-ignore game.removeFile(filename, err => { if (err) reject(err); else resolve(); }); })); } - static removeDir(directory) { + removeDir(directory) { return /** @type {Promise} */(new Promise((resolve, reject) => { + // @ts-ignore game.removeDir(directory, resolve, reject); })); } diff --git a/noname/get/index.js b/noname/get/index.js index e7fb4f235..e9ad4de4a 100644 --- a/noname/get/index.js +++ b/noname/get/index.js @@ -1,17 +1,15 @@ -import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js"; -import { AI as ai } from '../ai/index.js'; -import { Game as game } from '../game/index.js'; -import { Library as lib } from '../library/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { GNC as gnc } from '../gnc/index.js'; +import { userAgent, GeneratorFunction, AsyncFunction } from "../util/index.js"; +import { game } from '../game/index.js'; +import { lib } from '../library/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { CacheContext } from "../library/cache/cacheContext.js"; import { Is } from "./is.js"; import { Promises } from "./promises.js"; -export class Get extends Uninstantable { - static is = Is; - static promises = Promises; +export class Get { + is = new Is() + promises = new Promises() /** * 获取当前内核版本信息 * @@ -21,7 +19,7 @@ export class Get extends Uninstantable { * * @returns {["firefox" | "chrome" | "safari" | "other", number, number, number]} */ - static coreInfo() { + coreInfo() { const regex = /(firefox|chrome|safari)\/(\d+(?:\.\d+)+)/ let result if (!(result = userAgent.match(regex))) return ["other", NaN, NaN, NaN] @@ -38,7 +36,7 @@ export class Get extends Uninstantable { * @param {Function} filter * @returns {string[][]} */ - static inpileVCardList(filter) { + inpileVCardList(filter) { let list = []; for (const name of lib.inpile) { const type = get.type(name); @@ -57,7 +55,7 @@ export class Get extends Uninstantable { * 根据(Player的)座次数n(从1开始)获取对应的“n号位”翻译 * @param {number | Player} seat */ - static seatTranslation(seat) { + seatTranslation(seat) { if (get.itemtype(seat) === 'player') seat = seat.getSeatNum() - 1; return `${get.cnNumber(seat + 1, true)}号位`; } @@ -65,7 +63,7 @@ export class Get extends Uninstantable { * @param {number} numberOfPlayers * @returns {string[]} */ - static identityList(numberOfPlayers) { + identityList(numberOfPlayers) { const modeConfig = lib.config.mode_config; if (modeConfig) { const identityConfig = modeConfig.identity; @@ -91,7 +89,7 @@ export class Get extends Uninstantable { * * 从Base64编码的八位字节流生成对象URL */ - static objectURL(octetStream) { + objectURL(octetStream) { const objectURLMap = lib.objectURL; if (objectURLMap.has(octetStream)) return objectURLMap.get(octetStream); const objectURL = URL.createObjectURL(new Blob([Uint8Array.from(atob(octetStream.replace(/^data:[\s\S]*\/[\s\S]*;base64,/, '')), character => character.charCodeAt())])); @@ -103,7 +101,7 @@ export class Get extends Uninstantable { * * 获取此牌的字数 */ - static cardNameLength(card, player) { + cardNameLength(card, player) { const actualCardName = lib.actualCardName, name = get.translation(typeof card == 'string' ? card : get.name(card, player)); return (actualCardName.has(name) ? actualCardName.get(name) : name).length; } @@ -114,12 +112,12 @@ export class Get extends Uninstantable { * * 获取(此牌的)应变条件 */ - static yingbianConditions(card) { return get.complexYingbianConditions(card).concat(get.simpleYingbianConditions(card)); } - static complexYingbianConditions(card) { + yingbianConditions(card) { return get.complexYingbianConditions(card).concat(get.simpleYingbianConditions(card)); } + complexYingbianConditions(card) { const complexYingbianConditions = Array.from(lib.yingbian.condition.complex.keys()); return card ? complexYingbianConditions.filter(value => get.cardtag(card, `yingbian_${value}`)) : complexYingbianConditions; } - static simpleYingbianConditions(card) { + simpleYingbianConditions(card) { const simpleYingbianConditions = Array.from(lib.yingbian.condition.simple.keys()); return card ? simpleYingbianConditions.filter(value => get.cardtag(card, `yingbian_${value}`)) : simpleYingbianConditions; } @@ -128,7 +126,7 @@ export class Get extends Uninstantable { * * 获取(此牌的)应变效果 */ - static yingbianEffects(card) { + yingbianEffects(card) { const yingbianEffects = Array.from(lib.yingbian.effect.keys()); return card ? yingbianEffects.filter(value => get.cardtag(card, `yingbian_${value}`)) : yingbianEffects; } @@ -137,14 +135,14 @@ export class Get extends Uninstantable { * * 获取此牌的默认应变效果 */ - static defaultYingbianEffect(card) { + defaultYingbianEffect(card) { const info = get.info(card); return info && info.defaultYingbianEffect || null; } /** * 优先度判断 */ - static priority(skill) { + priority(skill) { const info = get.info(skill); if (!info) return 0; if ('_priority' in info) return info._priority; @@ -172,7 +170,7 @@ export class Get extends Uninstantable { * @param { false | Player } [player] * @returns { string[] } */ - static subtypes(obj, player) { + subtypes(obj, player) { if (typeof obj == 'string') obj = { name: obj }; if (typeof obj != 'object') return; var name = get.name(obj, player); @@ -191,7 +189,7 @@ export class Get extends Uninstantable { /** * @returns { string[] } */ - static pinyin(chinese, withTone) { + pinyin(chinese, withTone) { const pinyinUtilx = window.pinyinUtilx; if (!pinyinUtilx) return []; const pinyins = lib.pinyins; @@ -201,7 +199,7 @@ export class Get extends Uninstantable { } return pinyinUtilx.getPinyin(chinese, null, withTone, true); } - static yunmu(str) { + yunmu(str) { //部分整体认读音节特化处理 const util = window.pinyinUtilx; if (util && lib.pinyins._metadata.zhengtirendu.includes(util.removeTone(str))) { @@ -233,7 +231,7 @@ export class Get extends Uninstantable { /** * 用于将参数转换为字符串,作为缓存的key。 */ - static paramToCacheKey() { + paramToCacheKey() { var str = ""; for (var arg of arguments) { if (arg === null || arg === undefined) { @@ -253,7 +251,7 @@ export class Get extends Uninstantable { } return str; } - static yunjiao(str) { + yunjiao(str) { const util = window.pinyinUtilx; if (util) str = util.removeTone(str); if (lib.pinyins._metadata.zhengtirendu.includes(str)) { @@ -278,7 +276,7 @@ export class Get extends Uninstantable { * @param { Player } player * @returns { string[] } */ - static skillCategoriesOf(skill, player) { + skillCategoriesOf(skill, player) { const list = [], info = get.info(skill); if (!info) return list; if (get.is.locked(skill, player)) list.add('锁定技'); @@ -301,9 +299,9 @@ export class Get extends Uninstantable { if (info.categories) list.addArray(info.categories(skill, player)); return list; } - static numOf(obj, item) { return obj.filter(element => element == item).length; } - static connectNickname() { return typeof lib.config.connect_nickname == 'string' ? (lib.config.connect_nickname.slice(0, 12)) : "无名玩家"; } - static zhinangs(filter) { + numOf(obj, item) { return obj.filter(element => element == item).length; } + connectNickname() { return typeof lib.config.connect_nickname == 'string' ? (lib.config.connect_nickname.slice(0, 12)) : "无名玩家"; } + zhinangs(filter) { var list = (_status.connectMode ? lib.configOL : lib.config).zhinang_tricks; if (!list || !list.filter || !list.length) return get.inpile('trick', 'trick').randomGets(3); if (filter === false) return list.slice(0); @@ -311,7 +309,7 @@ export class Get extends Uninstantable { if (list.length) return list; return get.inpile('trick', 'trick').randomGets(3); } - static sourceCharacter(str) { + sourceCharacter(str) { if (str) { for (var i in lib.characterReplace) { if (lib.characterReplace[i].includes(str)) return i; @@ -319,12 +317,12 @@ export class Get extends Uninstantable { } return str; } - static isLuckyStar(player) { + isLuckyStar(player) { if (player && player.hasSkillTag('luckyStar')) return true; if (_status.connectMode) return false; return (!player || player == game.me || player.isUnderControl()) && lib.config.lucky_star == true; } - static infoHp(hp) { + infoHp(hp) { if (typeof hp == 'number') return hp; else if (typeof hp == 'string') { if (hp.includes('/')) { @@ -340,7 +338,7 @@ export class Get extends Uninstantable { } return 0; } - static infoMaxHp(hp) { + infoMaxHp(hp) { if (typeof hp == 'number') return hp; else if (typeof hp == 'string') { if (hp.includes('/')) { @@ -356,7 +354,7 @@ export class Get extends Uninstantable { } return 0; } - static infoHujia(hp) { + infoHujia(hp) { if (typeof hp == 'string' && hp.includes('/')) { const num = hp.split('/')[2]; if (num) { @@ -369,7 +367,7 @@ export class Get extends Uninstantable { } return 0; } - static bottomCards(num, putBack) { + bottomCards(num, putBack) { if (_status.waitingForCards) { ui.create.cards.apply(ui.create, _status.waitingForCards); delete _status.waitingForCards; @@ -400,13 +398,13 @@ export class Get extends Uninstantable { if (card) return list[0]; return list; } - static discarded() { return _status.discarded.filter(item => item.parentNode == ui.discardPile); } - static cardOffset() { + discarded() { return _status.discarded.filter(item => item.parentNode == ui.discardPile); } + cardOffset() { var x = ui.arena.getBoundingClientRect(); var y = ui.window.getBoundingClientRect(); return -y.width / 2 + (x.left + x.width / 2); } - static colorspan(str) { + colorspan(str) { if (str[0] == '#') { var color; switch (str[1]) { @@ -420,7 +418,7 @@ export class Get extends Uninstantable { } return str; } - static evtprompt(next, str) { + evtprompt(next, str) { if (next.prompt) { next.set('prompt2', str); } @@ -435,11 +433,11 @@ export class Get extends Uninstantable { } } } - static autoViewAs(card, cards) { return new lib.element.VCard(card, cards); } + autoViewAs(card, cards) { return new lib.element.VCard(card, cards); } /** * @deprecated */ - static _autoViewAs(card, cards) { + _autoViewAs(card, cards) { var info = get.info(card); if (info.autoViewAs) { if (cards === false) { @@ -492,7 +490,7 @@ export class Get extends Uninstantable { return card; } } - static max(list, func, type) { + max(list, func, type) { list = list.slice(0); if (typeof func == 'string') { var key = func; @@ -519,7 +517,7 @@ export class Get extends Uninstantable { return func(list[0]); } } - static min(list, func, type) { + min(list, func, type) { list = list.slice(0); if (typeof func == 'string') { var key = func; @@ -558,7 +556,7 @@ export class Get extends Uninstantable { * @param { T } num * @returns { Character[T] } */ - static character(name, num) { + character(name, num) { let info = lib.character[name]; if (!info) { const pack = Object.keys(lib.characterPack).find(pack => name in lib.characterPack[pack]); @@ -572,14 +570,14 @@ export class Get extends Uninstantable { } return info; } - static characterInitFilter(name) { + characterInitFilter(name) { const info = get.character(name); if (!info || !info[4]) return []; const filter = info[4].find(tag => tag.startsWith('InitFilter')); if (!filter) return []; return filter.split(':').slice(1); } - static characterIntro(name) { + characterIntro(name) { if (lib.characterIntro[name]) return lib.characterIntro[name]; var tags = get.character(name, 4); if (tags) { @@ -595,7 +593,7 @@ export class Get extends Uninstantable { if (lib.characterIntro[name]) return lib.characterIntro[name]; return '暂无武将介绍'; } - static bordergroup(info, raw) { + bordergroup(info, raw) { if (!Array.isArray(info)) { info = lib.character[info]; if (!info) return ''; @@ -605,7 +603,7 @@ export class Get extends Uninstantable { } return raw ? '' : info[1] || ''; } - static groupnature(group, method) { + groupnature(group, method) { var nature = lib.groupnature[group]; if (!nature) return ''; if (method == 'raw') { @@ -613,12 +611,12 @@ export class Get extends Uninstantable { } return nature + 'mm'; } - static sgn(num) { + sgn(num) { if (num > 0) return 1; if (num < 0) return -1; return 0; } - static rand(num, num2) { + rand(num, num2) { if (typeof num2 == 'number') { return num + Math.floor(Math.random() * (num2 - num + 1)); } @@ -626,12 +624,12 @@ export class Get extends Uninstantable { return Math.floor(Math.random() * num); } } - static sort(arr, method, arg) { return method == "seat" ? arr.sortBySeat(arg) : void 0; } - static sortSeat(arr, target) { return arr.sortBySeat(target); } + sort(arr, method, arg) { return method == "seat" ? arr.sortBySeat(arg) : void 0; } + sortSeat(arr, target) { return arr.sortBySeat(target); } /** * @param { (zip: JSZip) => any } callback */ - static zip(callback) { + zip(callback) { if (!window.JSZip) { lib.init.js(lib.assetURL + 'game', 'jszip', function () { callback(new JSZip()); @@ -641,7 +639,7 @@ export class Get extends Uninstantable { callback(new JSZip()); } } - static delayx(num, max) { + delayx(num, max) { if (typeof num != 'number') num = 1; if (typeof max != 'number') max = Infinity; switch (lib.config.game_speed) { @@ -653,7 +651,7 @@ export class Get extends Uninstantable { default: return Math.min(max, num); } } - static prompt(skill, target, player) { + prompt(skill, target, player) { player = player || _status.event.player; if (target) { var str = get.translation(target); @@ -666,12 +664,12 @@ export class Get extends Uninstantable { return '是否发动【' + get.skillTranslation(skill, player) + '】?'; } } - static prompt2(skill, target, player) { + prompt2(skill, target, player) { var str = get.prompt.apply(this, arguments); if (!lib.translate[skill + '_info']) return str; return '###' + str + '###' + lib.translate[skill + '_info']; } - static url(master) { + url(master) { var url = lib.config.updateURL || lib.updateURL; if (url[url.length - 1] != '/') { url += '/'; @@ -683,11 +681,11 @@ export class Get extends Uninstantable { return url + 'v' + lib.version + '/'; } } - static round(num, f) { + round(num, f) { var round = Math.pow(10, f); return Math.round(num * round) / round; } - static playerNumber() { + playerNumber() { var num; if (_status.brawl && _status.brawl.playerNumber) { num = _status.brawl.playerNumber; @@ -697,7 +695,7 @@ export class Get extends Uninstantable { } return parseInt(num) || 2; } - static benchmark(func1, func2, iteration, arg) { + benchmark(func1, func2, iteration, arg) { var tic, toc; var key1, key2; if (!arg) arg = []; @@ -742,7 +740,7 @@ export class Get extends Uninstantable { /** * @param {any} obj */ - static stringify(obj, level = 0) { + stringify(obj, level = 0) { level = level || 0; let indent = ''; let str; @@ -862,7 +860,7 @@ export class Get extends Uninstantable { * @param {WeakMap} [map] - 拷贝用的临时存储,用于处理循环引用(请勿自行赋值) * @returns {T} - 深拷贝后的对象,若传入值不是对象则为传入值 */ - static copy(obj, copyKeyDeep = false, map = new WeakMap()) { + copy(obj, copyKeyDeep = false, map = new WeakMap()) { // 参考[这里](https://juejin.cn/post/7315612852890026021)实现深拷贝 // 不再判断是否能structuredClone是因为structuredClone会把Symbol给毙了 const getType = (obj) => Object.prototype.toString.call(obj); @@ -941,7 +939,7 @@ export class Get extends Uninstantable { return target; } - static inpilefull(type) { + inpilefull(type) { var list = []; for (var i in lib.cardPile) { for (var j = 0; j < lib.cardPile[i].length; j++) { @@ -958,7 +956,7 @@ export class Get extends Uninstantable { } return list; } - static inpile(type, filter) { + inpile(type, filter) { var list = []; if (filter == 'trick') { for (var i = 0; i < lib.inpile.length; i++) { @@ -985,8 +983,8 @@ export class Get extends Uninstantable { } return list; } - static inpile2(type) { return get.inpile(type, 'trick'); } - static typeCard(type, filter) { + inpile2(type) { return get.inpile(type, 'trick'); } + typeCard(type, filter) { var list = []; for (var i in lib.card) { if (lib.card[i].mode && lib.card[i].mode.includes(get.mode()) == false) continue; @@ -1006,7 +1004,7 @@ export class Get extends Uninstantable { } return list; } - static libCard(filter) { + libCard(filter) { var list = []; for (var i in lib.card) { if (lib.card[i].mode && lib.card[i].mode.includes(get.mode()) == false) continue; @@ -1020,7 +1018,7 @@ export class Get extends Uninstantable { } return list; } - static ip() { + ip() { if (!require) return ''; var interfaces = require('os').networkInterfaces(); for (var devName in interfaces) { @@ -1033,7 +1031,7 @@ export class Get extends Uninstantable { } } } - static modetrans(config, server) { + modetrans(config, server) { if (config.mode == 'doudizhu') { switch (config.doudizhu_mode) { case 'kaihei': return '开黑斗地主'; @@ -1082,7 +1080,7 @@ export class Get extends Uninstantable { return get.cnNumber(parseInt(config.number)) + '人' + get.translation(config.mode); } } - static charactersOL(func) { + charactersOL(func) { var list = []; var libCharacter = {}; for (var i = 0; i < lib.configOL.characterPack.length; i++) { @@ -1099,16 +1097,16 @@ export class Get extends Uninstantable { } return list; } - static trimip(str) { + trimip(str) { var len = str.length - 5; if (str.lastIndexOf(':8080') == len) { str = str.slice(0, len); } return str; } - static mode() { return lib[_status.connectMode ? 'configOL' : 'config'].mode; } - static idDialog(id) { return ui.dialogs.find(dialog => dialog.videoId == id) || null; } - static arenaState() { + mode() { return lib[_status.connectMode ? 'configOL' : 'config'].mode; } + idDialog(id) { return ui.dialogs.find(dialog => dialog.videoId == id) || null; } + arenaState() { var state = { number: ui.arena.dataset.number, players: {}, @@ -1126,7 +1124,7 @@ export class Get extends Uninstantable { } return state; } - static skillState(player) { + skillState(player) { var skills = { global: lib.skill.global }; @@ -1153,8 +1151,8 @@ export class Get extends Uninstantable { } return skills; } - static id() { return (Math.floor(1000000 + 9000000 * Math.random())).toString() + (10 + lib.status.globalId++); } - static zhu(player, skill, group) { + id() { return (Math.floor(1000000 + 9000000 * Math.random())).toString() + (10 + lib.status.globalId++); } + zhu(player, skill, group) { if (typeof player == 'string') { skill = player; player = null; @@ -1199,12 +1197,12 @@ export class Get extends Uninstantable { } return null; } - static config(item, mode) { + config(item, mode) { mode = mode || lib.config.mode; if (!lib.config.mode_config[mode]) return; return lib.config.mode_config[mode][item]; } - static coinCoeff(list) { + coinCoeff(list) { var num = 0; for (var i = 0; i < list.length; i++) { var rank = get.rank(list[i]); @@ -1223,7 +1221,7 @@ export class Get extends Uninstantable { } return num / list.length; } - static rank(name, num) { + rank(name, num) { if (typeof name == 'object' && name.name) { name = name.name; } @@ -1269,7 +1267,7 @@ export class Get extends Uninstantable { } return num ? Math.round(9 * (num - 1) / 8 + 1) : 'x'; } - static skillRank(skill, type, grouped) { + skillRank(skill, type, grouped) { var info = lib.skill[skill]; var player = _status.event.skillRankPlayer || _status.event.player; if (!info) return 0; @@ -1363,26 +1361,26 @@ export class Get extends Uninstantable { } return num; } - static targetsInfo(targets) { + targetsInfo(targets) { var info = []; for (var i = 0; i < targets.length; i++) { info.push(targets[i].dataset.position); } return info; } - static infoTargets(infos) { return Array.from(infos || []).map(info => game.playerMap[info]); } - static cardInfo(card) { return [card.suit, card.number, card.name, card.nature]; } - static cardsInfo(cards = []) { return Array.from(cards).map(get.cardInfo); } - static infoCard(info) { + infoTargets(infos) { return Array.from(infos || []).map(info => game.playerMap[info]); } + cardInfo(card) { return [card.suit, card.number, card.name, card.nature]; } + cardsInfo(cards = []) { return Array.from(cards).map(get.cardInfo); } + infoCard(info) { var card = ui.create.card(); if (info[0]) { card.init(info); } return card; } - static infoCards(infos) { return Array.from(infos || []).map(get.infoCard); } - static cardInfoOL(card) { return '_noname_card:' + JSON.stringify([card.cardid, card.suit, card.number, card.name, card.nature]); } - static infoCardOL(info) { + infoCards(infos) { return Array.from(infos || []).map(get.infoCard); } + cardInfoOL(card) { return '_noname_card:' + JSON.stringify([card.cardid, card.suit, card.number, card.name, card.nature]); } + infoCardOL(info) { if (!lib.cardOL) return info; var card; try { @@ -1410,13 +1408,13 @@ export class Get extends Uninstantable { } return card || info; } - static cardsInfoOL(cards) { return Array.from(cards || []).map(get.cardInfoOL); } - static infoCardsOL(infos) { return Array.from(infos || []).map(get.infoCardOL); } - static playerInfoOL(player) { return '_noname_player:' + player.playerid; } - static infoPlayerOL(info) { return lib.playerOL ? (lib.playerOL[info.slice(15)] || info) : info; } - static playersInfoOL(players) { return Array.from(players || []).map(get.playerInfoOL); } - static infoPlayersOL(infos) { return Array.from(infos || []).map(get.infoPlayerOL); } - static funcInfoOL(func) { + cardsInfoOL(cards) { return Array.from(cards || []).map(get.cardInfoOL); } + infoCardsOL(infos) { return Array.from(infos || []).map(get.infoCardOL); } + playerInfoOL(player) { return '_noname_player:' + player.playerid; } + infoPlayerOL(info) { return lib.playerOL ? (lib.playerOL[info.slice(15)] || info) : info; } + playersInfoOL(players) { return Array.from(players || []).map(get.playerInfoOL); } + infoPlayersOL(infos) { return Array.from(infos || []).map(get.infoPlayerOL); } + funcInfoOL(func) { if (typeof func == 'function') { if (func._filter_args) { return '_noname_func:' + JSON.stringify(get.stringifiedResult(func._filter_args, 3)); @@ -1428,7 +1426,7 @@ export class Get extends Uninstantable { } return ''; } - static infoFuncOL(info) { + infoFuncOL(info) { let func; const str = info.slice(13).trim(); try { @@ -1453,7 +1451,7 @@ export class Get extends Uninstantable { } return func; } - static eventInfoOL(item, level, noMore) { + eventInfoOL(item, level, noMore) { return get.itemtype(item) == 'event' ? `_noname_event:${JSON.stringify(Object.entries(item).reduce((stringifying, entry) => { const key = entry[0]; if (key == '_trigger') { @@ -1466,7 +1464,7 @@ export class Get extends Uninstantable { /** * @param {string} item */ - static infoEventOL(item) { + infoEventOL(item) { const evt = new lib.element.GameEvent(); try { Object.entries(JSON.parse(item.slice(14))).forEach(entry => { @@ -1479,7 +1477,7 @@ export class Get extends Uninstantable { } return evt || item; } - static stringifiedResult(item, level, nomore) { + stringifiedResult(item, level, nomore) { if (!item) return item; if (typeof item == 'function') { return get.funcInfoOL(item); @@ -1529,7 +1527,7 @@ export class Get extends Uninstantable { return item; } } - static parsedResult(item) { + parsedResult(item) { if (!item) return item; if (typeof item == 'string') { if (item.startsWith('_noname_func:')) { @@ -1569,11 +1567,11 @@ export class Get extends Uninstantable { return item; } } - static verticalStr(str, sp) { + verticalStr(str, sp) { if (typeof str != 'string') return ''; return Array.from(str).filter(value => value != '`').join(''); } - static numStr(num, method) { + numStr(num, method) { if (num == Infinity) { if (method == 'card') return get.selectableCards().length + ui.selected.cards.length; if (method == 'target') return get.selectableTargets().length + ui.selected.targets.length; @@ -1581,7 +1579,7 @@ export class Get extends Uninstantable { } return num.toString(); } - static rawName(str) { + rawName(str) { let str2 = lib.translate[str]; if (lib.translate[str + '_ab']) str2 = lib.translate[str + '_ab']; if (!str2) return ''; @@ -1593,7 +1591,7 @@ export class Get extends Uninstantable { /** * 作用修改:只读前缀 不读_ab */ - static rawName2(str) { + rawName2(str) { let str2 = lib.translate[str]; if (!str2) return ''; if (lib.translate[str + '_prefix'] && str2.startsWith(lib.translate[str + '_prefix'])) { @@ -1601,7 +1599,7 @@ export class Get extends Uninstantable { } return str2; } - static slimNameHorizontal(str) { + slimNameHorizontal(str) { const slimName = lib.translate[`${str}_ab`] || lib.translate[str]; if (!slimName) return ''; const prefix = lib.translate[`${str}_prefix`]; @@ -1617,7 +1615,7 @@ export class Get extends Uninstantable { * @param {string} name * @returns {string} */ - static prefixSpan(prefix, name) { + prefixSpan(prefix, name) { const config = lib.config.buttoncharacter_prefix; if (config == 'off') return ''; if (config == 'simple') { @@ -1637,8 +1635,8 @@ export class Get extends Uninstantable { span.innerHTML = prefix; return span.outerHTML; } - static slimName(str) { return get.verticalStr(get.slimNameHorizontal(str), true); } - static time() { + slimName(str) { return get.verticalStr(get.slimNameHorizontal(str), true); } + time() { if (lib.status.dateDelaying) { return lib.getUTC(lib.status.dateDelaying) - lib.getUTC(lib.status.date) - lib.status.dateDelayed; } @@ -1646,13 +1644,13 @@ export class Get extends Uninstantable { return lib.getUTC(new Date()) - lib.getUTC(lib.status.date) - lib.status.dateDelayed; } } - static utc() { return (new Date()).getTime(); } - static evtDistance(e1, e2) { + utc() { return (new Date()).getTime(); } + evtDistance(e1, e2) { var dx = (e1.clientX - e2.clientX) / game.documentZoom; var dy = (e1.clientY - e2.clientY) / game.documentZoom; return Math.sqrt(dx * dx + dy * dy); } - static xyDistance(from, to) { return Math.sqrt((from[0] - to[0]) * (from[0] - to[0]) + (from[1] - to[1]) * (from[1] - to[1])); } + xyDistance(from, to) { return Math.sqrt((from[0] - to[0]) * (from[0] - to[0]) + (from[1] - to[1]) * (from[1] - to[1])); } /** * @overload * @returns { void } @@ -1707,7 +1705,7 @@ export class Get extends Uninstantable { * @param { GameEvent | GameEventPromise } obj * @returns { 'event' } */ - static itemtype(obj) { + itemtype(obj) { if (typeof obj == 'string') { if (obj.length <= 5) { let bool = true; @@ -1747,13 +1745,13 @@ export class Get extends Uninstantable { if (lib.experimental.symbol.itemType in obj) return obj[lib.experimental.symbol.itemType]; } - static equipNum(card) { + equipNum(card) { if (get.type(card) == 'equip') { return parseInt(get.subtype(card)[5]); } return 0; } - static objtype(obj) { + objtype(obj) { if (Object.prototype.toString.call(obj) === '[object Array]') return 'array'; if (Object.prototype.toString.call(obj) === '[object Object]') return 'object'; if (Object.prototype.toString.call(obj) === '[object HTMLDivElement]') return 'div'; @@ -1763,7 +1761,7 @@ export class Get extends Uninstantable { if (Object.prototype.toString.call(obj) === '[object HTMLBodyElement]') return 'td'; if (Object.prototype.toString.call(obj) === '[object DocumentFragment]') return 'fragment'; } - static type(obj, method, player) { + type(obj, method, player) { if (typeof obj == 'string') obj = { name: obj }; if (typeof obj != 'object') return; var name = get.name(obj, player); @@ -1774,14 +1772,14 @@ export class Get extends Uninstantable { if (method == 'trick' && lib.card[name].type == 'delay') return 'trick'; return lib.card[name].type; } - static type2(card, player) { return get.type(card, 'trick', player); } + type2(card, player) { return get.type(card, 'trick', player); } /** * * @param { string | Card | VCard | CardBaseUIData } obj * @param { false | Player } [player] * @returns { string } */ - static subtype(obj, player) { + subtype(obj, player) { if (typeof obj == 'string') obj = { name: obj }; if (typeof obj != 'object') return; const name = get.name(obj, player); @@ -1789,7 +1787,7 @@ export class Get extends Uninstantable { let subtype = lib.card[name].subtype; return subtype; } - static equiptype(card, player) { + equiptype(card, player) { var subtype = get.subtype(card, player); if (subtype.startsWith('equip')) return parseInt(subtype[5]); return 0; @@ -1800,7 +1798,7 @@ export class Get extends Uninstantable { * @param { false | Player } [player] * @returns { string } */ - static name(card, player) { + name(card, player) { if (get.itemtype(player) == 'player' || (player !== false && get.position(card) == 'h')) { var owner = player || get.owner(card); if (owner) { @@ -1814,7 +1812,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {string} */ - static suit(card, player) { + suit(card, player) { if (typeof card !== 'object') return; if (Array.isArray(card)) { if (card.length == 1) return get.suit(card[0], player); @@ -1839,7 +1837,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {string} */ - static color(card, player) { + color(card, player) { if (typeof card !== 'object') return; if (Array.isArray(card)) { if (!card.length) return 'none'; @@ -1868,7 +1866,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {number} */ - static number(card, player) { + number(card, player) { if (typeof card !== 'object') return; //狗卡你是真敢出啊 var number = null; @@ -1894,7 +1892,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {string} */ - static nature(card, player) { + nature(card, player) { if (typeof card == 'string') return card.split(lib.natureSeparator).sort(lib.sort.nature).join(lib.natureSeparator); if (Array.isArray(card)) return card.sort(lib.sort.nature).join(lib.natureSeparator); var nature = card.nature; @@ -1912,7 +1910,7 @@ export class Get extends Uninstantable { * @param {false | Player} [player] * @returns {string[]} */ - static natureList(card, player) { + natureList(card, player) { if (!card) return []; if (get.itemtype(card) == 'natures') return card.split(lib.natureSeparator); if (get.itemtype(card) == 'nature') return [card]; @@ -1920,7 +1918,7 @@ export class Get extends Uninstantable { if (typeof natures != 'string') return []; return natures.split(lib.natureSeparator); } - static cards(num, putBack) { + cards(num, putBack) { if (_status.waitingForCards) { ui.create.cards.apply(ui.create, _status.waitingForCards); delete _status.waitingForCards; @@ -1951,12 +1949,12 @@ export class Get extends Uninstantable { if (card) return list[0]; return list; } - static judge(card) { + judge(card) { const cardInfo = (card.viewAs ? lib.card[card.viewAs] : get.info(card)); return (cardInfo && cardInfo.judge) ? cardInfo.judge : ()=>0; } - static judge2(card) { return card.viewAs ? lib.card[card.viewAs].judge2 : get.info(card).judge2; } - static distance(from, to, method) { + judge2(card) { return card.viewAs ? lib.card[card.viewAs].judge2 : get.info(card).judge2; } + distance(from, to, method) { if (from == to) return 0; if (!game.players.includes(from) && !game.dead.includes(from)) return Infinity; if (!game.players.includes(to) && !game.dead.includes(to)) return Infinity; @@ -2046,7 +2044,7 @@ export class Get extends Uninstantable { * @param { Player | false } [player] * @returns { any } */ - static info(item, player) { + info(item, player) { if (typeof item == 'string') { return lib.skill[item]; } @@ -2060,13 +2058,13 @@ export class Get extends Uninstantable { * @param { number | Select | (()=>Select) } [select] * @returns { Select } */ - static select(select) { + select(select) { if (typeof select == 'function') return get.select(select()); else if (typeof select == 'number') return [select, select]; else if (select && get.itemtype(select) == 'select') return select; return [1, 1]; } - static card(original) { + card(original) { if (_status.event.skill) { var card = get.info(_status.event.skill).viewAs; if (typeof card == 'function') card = card(ui.selected.cards, _status.event.player); @@ -2094,9 +2092,9 @@ export class Get extends Uninstantable { * @param {T} key * @returns {GameEvent[T]} */ - static event(key) { return key ? _status.event[key] : _status.event; } - static player() { return _status.event.player; } - static players(sort, dead, out) { + event(key) { return key ? _status.event[key] : _status.event; } + player() { return _status.event.player; } + players(sort, dead, out) { var players = game.players.slice(0); if (sort != false) { if (typeof sort == 'function') players.sort(sort); @@ -2106,7 +2104,7 @@ export class Get extends Uninstantable { if (!out) players = players.filter(current => !current.isOut()); return players; } - static position(card, ordering) { + position(card, ordering) { if (get.itemtype(card) == 'player') return parseInt(card.dataset.position); if (card.timeout && card.destiny && card.destiny.classList) { if (card.destiny.classList.contains('equips')) return 'e'; @@ -2130,7 +2128,7 @@ export class Get extends Uninstantable { if (card.parentNode.id == 'ordering') return ordering ? 'o' : 'd'; return null; } - static skillTranslation(str, player) { + skillTranslation(str, player) { var str2; if (str.startsWith('re')) { str2 = str.slice(2); @@ -2154,7 +2152,7 @@ export class Get extends Uninstantable { } return get.translation(str); } - static skillInfoTranslation(name, player) { + skillInfoTranslation(name, player) { if (player && lib.dynamicTranslate[name]) return lib.dynamicTranslate[name](player, name); var str = lib.translate[name + '_info']; if (!str) return ''; @@ -2170,7 +2168,7 @@ export class Get extends Uninstantable { /** * @returns {string} */ - static translation(str, arg) { + translation(str, arg) { if (str && typeof str == 'object' && (str.name || str._tempTranslate)) { if (str._tempTranslate) return str._tempTranslate; var str2; @@ -2266,13 +2264,13 @@ export class Get extends Uninstantable { } return ''; } - static menuZoom(){ + menuZoom(){ if(game.menuZoom === undefined || game.menuZoom === null){ return game.documentZoom; } return game.menuZoom; } - static strNumber(num) { + strNumber(num) { switch (num) { case 1: return 'A'; case 11: return 'J'; @@ -2281,7 +2279,7 @@ export class Get extends Uninstantable { default: return num.toString(); } } - static cnNumber(num, ordinal) { + cnNumber(num, ordinal) { if (isNaN(num)) return ''; let numStr = num.toString(); if (numStr === 'Infinity') return '∞'; @@ -2340,7 +2338,7 @@ export class Get extends Uninstantable { * @param {HTMLElement} node * @returns {Iterable} 迭代器 */ - static *iterableChildNodes(node){ + *iterableChildNodes(node){ for(let i=0;i number)} [sort] 排序函数 * @returns { Button[] } */ - static selectableButtons(sort) { + selectableButtons(sort) { if (!_status.event.player) return []; var buttons = _status.event.dialog.buttons; var selectable = []; @@ -2371,7 +2369,7 @@ export class Get extends Uninstantable { * @param {((a: Card, b: Card) => number)} [sort] 排序函数 * @returns { Card[] } */ - static selectableCards(sort) { + selectableCards(sort) { if (!_status.event.player) return []; var cards = _status.event.player.getCards('hes'); var selectable = []; @@ -2389,7 +2387,7 @@ export class Get extends Uninstantable { /** * @returns { string[] } 技能名数组 */ - static skills() { + skills() { var skills = []; if (ui.skills) { skills = skills.concat(ui.skills.skills); @@ -2402,7 +2400,7 @@ export class Get extends Uninstantable { } return skills; } - static gainableSkills(func, player) { + gainableSkills(func, player) { var list = []; for (var i in lib.character) { if (lib.filter.characterDisabled(i)) continue; @@ -2424,7 +2422,7 @@ export class Get extends Uninstantable { } return list; } - static gainableSkillsName(name, func) { + gainableSkillsName(name, func) { var list = []; if (name && lib.character[name]) { if (lib.character[name][4]) { @@ -2443,7 +2441,7 @@ export class Get extends Uninstantable { } return list; } - static gainableCharacters(func) { + gainableCharacters(func) { var list = []; for (var i in lib.character) { var info = lib.character[i]; @@ -2467,7 +2465,7 @@ export class Get extends Uninstantable { * @param {((a: Player, b: Player) => number)} [sort] 排序函数 * @returns { Player[] } */ - static selectableTargets(sort) { + selectableTargets(sort) { var selectable = []; var players = game.players.slice(0); if (_status.event.deadTarget) players.addArray(game.dead); @@ -2483,7 +2481,7 @@ export class Get extends Uninstantable { } return selectable; } - static filter(filter, i) { + filter(filter, i) { if (typeof filter == 'function') return filter; if (i == undefined) i = 0; var result = function () { @@ -2556,7 +2554,7 @@ export class Get extends Uninstantable { result._filter_args = [filter, i]; return result; } - static cardCount(card, player) { + cardCount(card, player) { var num; if (player == undefined) player = _status.event.player; if (card == true) { @@ -2574,13 +2572,13 @@ export class Get extends Uninstantable { if (num == undefined) return 0; return num; } - static skillCount(skill, player) { + skillCount(skill, player) { if (player == undefined) player = _status.event.player; var num = player.getStat('skill')[skill]; if (num == undefined) return 0; return num; } - static owner(card, method) { + owner(card, method) { return game.players.concat(game.dead).find(current=>{ if(current.judging[0] == card && method != "judge")return true; let parent = card.parentNode; @@ -2598,13 +2596,13 @@ export class Get extends Uninstantable { //return game.players.concat(game.dead).find(current => // current.getCards("hejsx").includes(card) || (current.judging[0] == card && method != "judge")); } - static noSelected() { return ui.selected.buttons.length + ui.selected.cards.length + ui.selected.targets.length == 0; } - static population(identity) { + noSelected() { return ui.selected.buttons.length + ui.selected.cards.length + ui.selected.targets.length == 0; } + population(identity) { return identity == undefined ? game.players.length + game.dead.length : game.players.filter(current => current.identity == identity).length; } - static totalPopulation(identity) { + totalPopulation(identity) { return identity == undefined ? game.players.length + game.dead.length : game.players.concat(game.dead).filter(current => current.identity == identity).length; @@ -2612,11 +2610,11 @@ export class Get extends Uninstantable { /** * @param { Card | VCard } item */ - static cardtag(item, tag) { + cardtag(item, tag) { return (item.cardid && (get.itemtype(item) == 'card' || !item.cards || !item.cards.length || item.name == item.cards[0].name) && _status.cardtag && _status.cardtag[tag] && _status.cardtag[tag].includes(item.cardid)) || (item.cardtags && item.cardtags.includes(tag)); } - static tag(item, tag, item2, bool) { + tag(item, tag, item2, bool) { var result; if (get.info(item, bool) && get.info(item, bool).ai && get.info(item, bool).ai.tag) { result = get.info(item, bool).ai.tag[tag]; @@ -2624,7 +2622,7 @@ export class Get extends Uninstantable { if (typeof result == 'function') return result(item, item2); return result; } - static sortCard(sort) { + sortCard(sort) { var func; if (sort == 'type_sort') { func = function (card) { @@ -2661,7 +2659,7 @@ export class Get extends Uninstantable { } return func; } - static difficulty() { + difficulty() { switch (get.config('difficulty')) { case 'easy': return 1; case 'normal': return 2; @@ -2669,7 +2667,7 @@ export class Get extends Uninstantable { default: return 1; } } - static cardPile(name, create) { + cardPile(name, create) { var filter = function (card) { if (typeof name == 'string') { if (card.name == name) { @@ -2720,9 +2718,9 @@ export class Get extends Uninstantable { } return null; } - static cardPile2(name) { return get.cardPile(name, 'cardPile'); } - static discardPile(name) { return get.cardPile(name, 'discardPile'); } - static aiStrategy() { + cardPile2(name) { return get.cardPile(name, 'cardPile'); } + discardPile(name) { return get.cardPile(name, 'discardPile'); } + aiStrategy() { switch (get.config('ai_strategy')) { case 'ai_strategy_1': return 1; case 'ai_strategy_2': return 2; @@ -2733,7 +2731,7 @@ export class Get extends Uninstantable { default: return 1; } } - static skillintro(name, learn, learn2) { + skillintro(name, learn, learn2) { var str = ''; var infoitem = lib.character[name]; if (!infoitem) { @@ -2761,7 +2759,7 @@ export class Get extends Uninstantable { } return str; } - static intro(name) { + intro(name) { var info = lib.character[name]; var str = '性别:' + get.translation(info[0]) + '
'; str += '势力:' + get.translation(info[1]) + '
'; @@ -2775,7 +2773,7 @@ export class Get extends Uninstantable { } return str; } - static storageintro(type, content, player, dialog, skill) { + storageintro(type, content, player, dialog, skill) { switch (type) { case 'mark': { if (content > 0) { @@ -2883,7 +2881,7 @@ export class Get extends Uninstantable { } } } - static nodeintro(node, simple, evt) { + nodeintro(node, simple, evt) { var uiintro = ui.create.dialog('hidden', 'notouchscroll'); if (node.classList.contains('player') && !node.name) { return uiintro; @@ -3998,7 +3996,7 @@ export class Get extends Uninstantable { } return uiintro; } - static linkintro(dialog, content, player) { + linkintro(dialog, content, player) { dialog.content.firstChild.remove(); dialog.add('
已横置
'); var list = []; @@ -4011,8 +4009,8 @@ export class Get extends Uninstantable { dialog.add(list, true, true); } } - static groups() { return ['wei', 'shu', 'wu', 'qun', 'jin', 'western', 'key']; } - static types() { + groups() { return ['wei', 'shu', 'wu', 'qun', 'jin', 'western', 'key']; } + types() { var types = []; for (var i in lib.card) { if (lib.card[i].mode && lib.card[i].mode.includes(lib.config.mode) == false) continue; @@ -4024,14 +4022,14 @@ export class Get extends Uninstantable { } return types; } - static links(buttons) { + links(buttons) { var links = []; for (var i = 0; i < buttons.length; i++) { if (buttons[i].link != undefined) links.push(buttons[i].link); } return links; } - static threaten(target, player, hp) { + threaten(target, player, hp) { var threaten = 1; var skills = target.getSkills(); if (!player && player !== false) { @@ -4063,7 +4061,7 @@ export class Get extends Uninstantable { } return threaten; } - static condition(player) { + condition(player) { var num = player.hp; if (num > 4) { num = 4 + Math.sqrt(num - 4); @@ -4088,7 +4086,7 @@ export class Get extends Uninstantable { } return num; } - static attitude(from, to) { + attitude(from, to) { if (!from || !to) return 0; from = from._trueMe || from; arguments[0] = from; @@ -4114,10 +4112,10 @@ export class Get extends Uninstantable { } return att; } - static sgnAttitude() { + sgnAttitude() { return get.sgn(get.attitude.apply(this, arguments)); } - static useful_raw(card, player) { + useful_raw(card, player) { if (get.position(card) == 'j') return -1; if (get.position(card) == 'e') return get.equipValue(card); if (card._modUseful) { @@ -4152,19 +4150,19 @@ export class Get extends Uninstantable { result = game.checkMod(player, card, result, 'aiUseful', player); return result; } - static useful(card, player) { + useful(card, player) { if (_status.event.useCache) { return game.callFuncUseStepCache("get.useful_raw", get.useful_raw, [card, player]); } return get.useful_raw(card, player); } - static unuseful(card) { return -get.useful(card); } - static unuseful2(card) { return 10 - get.useful(card); } - static unuseful3(card) { + unuseful(card) { return -get.useful(card); } + unuseful2(card) { return 10 - get.useful(card); } + unuseful3(card) { if (card.name == 'du') return 20; return 10 - get.useful(card); } - static value(card, player, method) { + value(card, player, method) { var result = 0; var value; if (Array.isArray(card)) { @@ -4198,7 +4196,7 @@ export class Get extends Uninstantable { result = game.checkMod(player, card, result, 'aiValue', player); return result; } - static equipResult(player, target, name) { + equipResult(player, target, name) { var card = get.card(); if (!card || card.name != name) { card = { name: name }; @@ -4217,7 +4215,7 @@ export class Get extends Uninstantable { } return Math.max(0, value1 - value2) / 5; } - static equipValue(card, player) { + equipValue(card, player) { if (player == undefined || get.itemtype(player) != 'player') player = get.owner(card); if (player == undefined || get.itemtype(player) != 'player') player = _status.event.player; var info = get.info(card); @@ -4233,7 +4231,7 @@ export class Get extends Uninstantable { if (typeof value == 'function') return value(card, player, null, 'raw2'); return 0; } - static equipValueNumber(card) { + equipValueNumber(card) { var info = get.info(card); if (info.ai) { if (typeof info.ai.equipValue == 'number') return info.ai.equipValue; @@ -4241,9 +4239,9 @@ export class Get extends Uninstantable { } return 0; } - static disvalue(card, player) { return -get.value(card, player); } - static disvalue2(card, player) { return -get.value(card, player, 'raw'); } - static skillthreaten(skill, player, target) { + disvalue(card, player) { return -get.value(card, player); } + disvalue2(card, player) { return -get.value(card, player, 'raw'); } + skillthreaten(skill, player, target) { if (!lib.skill[skill]) return 1; if (!lib.skill[skill].ai) return 1; var threaten = lib.skill[skill].ai.threaten; @@ -4255,14 +4253,14 @@ export class Get extends Uninstantable { } return 1; } - static cacheOrder(item){ + cacheOrder(item){ let cache = CacheContext.requireCacheContext(); return cache.get.order(item); } /** * @returns { number } */ - static order(item, player = get.player() || game.me) { + order(item, player = get.player() || game.me) { let cache = CacheContext.requireCacheContext(); var info = get.info(item); if (!info) return -1; @@ -4280,7 +4278,7 @@ export class Get extends Uninstantable { } return num; } - static result(item, skill) { + result(item, skill) { var result; var info = get.info(item); if (info.ai) result = get.copy(info.ai.result); @@ -4297,11 +4295,11 @@ export class Get extends Uninstantable { } return result; } - static cacheEffectUse(target, card, player, player2, isLink){ + cacheEffectUse(target, card, player, player2, isLink){ let cache = CacheContext.requireCacheContext(); return cache.get.effect_use(target,card,player,player2,isLink); } - static effect_use(target, card, player, player2, isLink) { + effect_use(target, card, player, player2, isLink) { let cache = CacheContext.requireCacheContext(); var event = _status.event; var eventskill = null; @@ -4493,11 +4491,11 @@ export class Get extends Uninstantable { } return final; } - static cacheEffect(target, card, player, player2, isLink){ + cacheEffect(target, card, player, player2, isLink){ let cache = CacheContext.requireCacheContext(); return cache.get.effect(target,card,player,player2,isLink); } - static effect(target, card, player, player2, isLink) { + effect(target, card, player, player2, isLink) { let cache = CacheContext.requireCacheContext(); var event = _status.event; var eventskill = null; @@ -4673,7 +4671,7 @@ export class Get extends Uninstantable { } return final; } - static damageEffect(target, player, viewer, nature) { + damageEffect(target, player, viewer, nature) { if (get.itemtype(nature) == 'natures') { var natures = get.natureList(nature); return natures.map(n => get.damageEffect(target, player, viewer, n)).reduce((p, c) => p + c, 0) / (natures.length || 1); @@ -4703,13 +4701,13 @@ export class Get extends Uninstantable { * @param {any} source 如果参数是function,执行此函数并返回结果,传参为此方法剩余的参数。如果参数不是function,直接返回结果。 * @returns 返回的结果 */ - static dynamicVariable(source){ + dynamicVariable(source){ if(typeof source == 'function'){ return source.call(null,...(Array.from(arguments).slice(1))); } return source; } - static recoverEffect(target, player, viewer) { + recoverEffect(target, player, viewer) { if (target.hp == target.maxHp) return 0; if (!player) { player = target; @@ -4719,7 +4717,7 @@ export class Get extends Uninstantable { } return get.effect(target, { name: 'recover' }, player, viewer); } - static buttonValue(button) { + buttonValue(button) { var card = button.link; var player = get.owner(card); if (!player) player = _status.event.player; @@ -4753,10 +4751,19 @@ export class Get extends Uninstantable { default: return 0.4; } } - static attitude2(to) { return get.attitude(_status.event.player, to); } + attitude2(to) { return get.attitude(_status.event.player, to); } } -export const get = Get; +export let get = new Get(); +/** + * @param { InstanceType } [instance] + */ +export let setGet = (instance) => { + get = instance || new Get(); + if (lib.config.dev) { + window.get = get; + } +}; export { Is, diff --git a/noname/get/is.js b/noname/get/is.js index f94ba5539..dfe584a6e 100644 --- a/noname/get/is.js +++ b/noname/get/is.js @@ -1,20 +1,18 @@ -import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js"; -import { AI as ai } from '../ai/index.js'; -import { Game as game } from '../game/index.js'; -import { Library as lib } from '../library/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { GNC as gnc } from '../gnc/index.js'; -import { Get as get } from "./index.js"; +import { userAgent } from "../util/index.js"; +import { game } from '../game/index.js'; +import { lib } from '../library/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { get } from "./index.js"; -export class Is extends Uninstantable { +export class Is { /** * 判断是否为进攻坐骑 * @param { Card | VCard } card * @param { false | Player } [player] * @returns { boolean } */ - static attackingMount(card, player) { + attackingMount(card, player) { const subtype = get.subtype(card, player); if (subtype == 'equip4') return true; else if (subtype == 'equip6') { @@ -30,7 +28,7 @@ export class Is extends Uninstantable { * @param { false | Player } [player] * @returns { boolean } */ - static defendingMount(card, player) { + defendingMount(card, player) { const subtype = get.subtype(card, player); if (subtype == 'equip3') return true; else if (subtype == 'equip6') { @@ -44,7 +42,7 @@ export class Is extends Uninstantable { * 判断坐骑栏是否被合并 * @returns { boolean } */ - static mountCombined() { + mountCombined() { if (lib.configOL.mount_combine) { return lib.configOL.mount_combine; } @@ -58,7 +56,7 @@ export class Is extends Uninstantable { * @param {...} infos 要判断的属性列表 * @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同 */ - static sameNature() { + sameNature() { let processedArguments = [], every = false; Array.from(arguments).forEach(argument => { if (typeof argument == 'boolean') every = argument; @@ -90,7 +88,7 @@ export class Is extends Uninstantable { * @param ...infos 要判断的属性列表 * @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同 */ - static differentNature() { + differentNature() { let processedArguments = [], every = false; Array.from(arguments).forEach(argument => { if (typeof argument == 'boolean') every = argument; @@ -121,7 +119,7 @@ export class Is extends Uninstantable { * 判断一张牌是否为明置手牌 * @param { Card } card */ - static shownCard(card) { + shownCard(card) { if (!card) return false; const gaintag = card.gaintag; return Array.isArray(gaintag) && gaintag.some(tag => tag.startsWith('visible_')); @@ -131,7 +129,7 @@ export class Is extends Uninstantable { * @param { Card | VCard } card */ // @ts-ignore - static virtualCard(card) { + virtualCard(card) { return (!("cards" in card) || !Array.isArray(card.cards) || card.cards.length === 0); } /** @@ -139,7 +137,7 @@ export class Is extends Uninstantable { * @param { Card | VCard } card */ // @ts-ignore - static convertedCard(card) { + convertedCard(card) { return !card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length > 0; } /** @@ -147,7 +145,7 @@ export class Is extends Uninstantable { * @param { Card | VCard } card */ // @ts-ignore - static ordinaryCard(card) { + ordinaryCard(card) { return card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length === 1 } /** @@ -155,7 +153,7 @@ export class Is extends Uninstantable { * @param { string } str1 * @param { string } str2 */ - static yayun(str1, str2) { + yayun(str1, str2) { if (str1 == str2) return true; let pinyin1 = get.pinyin(str1, false), pinyin2 = get.pinyin(str2, false); if (!pinyin1.length || !pinyin2.length) return false; @@ -168,7 +166,7 @@ export class Is extends Uninstantable { * @param { Player } player 玩家 * @returns */ - static blocked(skill, player) { + blocked(skill, player) { if (!player.storage.skill_blocker || !player.storage.skill_blocker.length) return false; for (let i of player.storage.skill_blocker) { if (lib.skill[i] && lib.skill[i].skillBlocker && lib.skill[i].skillBlocker(skill, player)) return true; @@ -181,7 +179,7 @@ export class Is extends Uninstantable { * @param { string[] } array * @returns { boolean | string[] } */ - static double(name, array) { + double(name, array) { const extraInformations = get.character(name, 4); if (!extraInformations) return false; for (const extraInformation of extraInformations) { @@ -196,11 +194,11 @@ export class Is extends Uninstantable { * 检测此牌是否具有应变条件 * @param { Card | VCard } card */ - static yingbianConditional(card) { return get.is.complexlyYingbianConditional(card) || get.is.simplyYingbianConditional(card) } + yingbianConditional(card) { return get.is.complexlyYingbianConditional(card) || get.is.simplyYingbianConditional(card) } /** * @param { Card | VCard } card */ - static complexlyYingbianConditional(card) { + complexlyYingbianConditional(card) { for (const key of lib.yingbian.condition.complex.keys()) { if (get.cardtag(card, `yingbian_${key}`)) return true; } @@ -209,7 +207,7 @@ export class Is extends Uninstantable { /** * @param { Card | VCard } card */ - static simplyYingbianConditional(card) { + simplyYingbianConditional(card) { for (const key of lib.yingbian.condition.simple.keys()) { if (get.cardtag(card, `yingbian_${key}`)) return true; } @@ -222,7 +220,7 @@ export class Is extends Uninstantable { * * @param { Card | VCard } card */ - static yingbianEffective(card) { + yingbianEffective(card) { for (const key of lib.yingbian.effect.keys()) { if (get.cardtag(card, `yingbian_${key}`)) return true; } @@ -231,11 +229,11 @@ export class Is extends Uninstantable { /** * @param { Card | VCard } card */ - static yingbian(card) { return get.is.yingbianConditional(card) || get.is.yingbianEffective(card) } + yingbian(card) { return get.is.yingbianConditional(card) || get.is.yingbianEffective(card) } /** * @param { string } [substring] */ - static emoji(substring) { + emoji(substring) { if (substring) { const reg = new RegExp("[~#^$@%&!?%*]", 'g'); if (substring.match(reg)) { @@ -284,23 +282,23 @@ export class Is extends Uninstantable { /** * @param { string } str */ - static banWords(str) { return get.is.emoji(str) || window.bannedKeyWords.some(item => str.includes(item)) } + banWords(str) { return get.is.emoji(str) || window.bannedKeyWords.some(item => str.includes(item)) } /** * @param { GameEventPromise } event */ // @ts-ignore - static converted(event) { return !(event.card && event.card.isCard) } - static safari() { return userAgent.indexOf('safari') != -1 && userAgent.indexOf('chrome') == -1 } + converted(event) { return !(event.card && event.card.isCard) } + safari() { return userAgent.indexOf('safari') != -1 && userAgent.indexOf('chrome') == -1 } /** * @param { (Card | VCard)[]} cards */ // @ts-ignore - static freePosition(cards) { return !cards.some(card => !card.hasPosition || card.hasPosition()) } + freePosition(cards) { return !cards.some(card => !card.hasPosition || card.hasPosition()) } /** * @param { string } name * @param { boolean } item */ - static nomenu(name, item) { + nomenu(name, item) { const menus = ['system', 'menu']; const configs = { show_round_menu: lib.config.show_round_menu, @@ -334,7 +332,7 @@ export class Is extends Uninstantable { } return true; } - static altered(skillName) { return false; } + altered(skillName) { return false; } /* skill=>{ return false; @@ -346,25 +344,25 @@ export class Is extends Uninstantable { * @param { any } obj * @returns { boolean } */ - static node(obj) { + node(obj) { return Object.prototype.toString.call(obj).startsWith('[object HTML'); } /** * @param { any } obj */ - static div(obj) { return Object.prototype.toString.call(obj) === '[object HTMLDivElement]' } + div(obj) { return Object.prototype.toString.call(obj) === '[object HTMLDivElement]' } /** * @param { any } obj */ - static map(obj) { return Object.prototype.toString.call(obj) === '[object Map]' } + map(obj) { return Object.prototype.toString.call(obj) === '[object Map]' } /** * @param { any } obj */ - static set(obj) { return Object.prototype.toString.call(obj) === '[object Set]' } + set(obj) { return Object.prototype.toString.call(obj) === '[object Set]' } /** * @param { any } obj */ - static object(obj) { return Object.prototype.toString.call(obj) === '[object Object]' } + object(obj) { return Object.prototype.toString.call(obj) === '[object Object]' } /** * @overload * @param { Function } func @@ -375,7 +373,7 @@ export class Is extends Uninstantable { * @param { number | [number, number] } func * @returns { boolean } */ - static singleSelect(func) { + singleSelect(func) { if (typeof func == 'function') return false; const select = get.select(func); return select[0] == 1 && select[1] == 1; @@ -383,7 +381,7 @@ export class Is extends Uninstantable { /** * @param { string | Player } name */ - static jun(name) { + jun(name) { if (get.mode() == 'guozhan') { if (name instanceof lib.element.Player) { if (name.isUnseen && name.isUnseen(0)) return false; @@ -395,23 +393,23 @@ export class Is extends Uninstantable { } return false; } - static versus() { return !_status.connectMode && get.mode() == 'versus' && _status.mode == 'three' } - static changban() { return get.mode() == 'single' && _status.mode == 'changban' } - static single() { return get.mode() == 'single' && _status.mode == 'normal' } + versus() { return !_status.connectMode && get.mode() == 'versus' && _status.mode == 'three' } + changban() { return get.mode() == 'single' && _status.mode == 'changban' } + single() { return get.mode() == 'single' && _status.mode == 'normal' } /** * @param { Player } [player] */ - static mobileMe(player) { return (game.layout == 'mobile' || game.layout == 'long') && !game.chess && player && player.dataset.position == '0' } - static newLayout() { return game.layout != 'default' } - static phoneLayout() { + mobileMe(player) { return (game.layout == 'mobile' || game.layout == 'long') && !game.chess && player && player.dataset.position == '0' } + newLayout() { return game.layout != 'default' } + phoneLayout() { if (!lib.config.phonelayout) return false; return (game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova'); } - static singleHandcard() { return game.singleHandcard || game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova' } + singleHandcard() { return game.singleHandcard || game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova' } /** * @param { Player } player */ - static linked2(player) { + linked2(player) { if (game.chess) return true; if (lib.config.link_style2 != 'rotate') return true; // if(game.chess) return false; @@ -424,17 +422,17 @@ export class Is extends Uninstantable { /** * @param { {} } obj */ - static empty(obj) { return Object.keys(obj).length == 0 } + empty(obj) { return Object.keys(obj).length == 0 } /** * @param { string } str */ - static pos(str) { return str == 'h' || str == 'e' || str == 'j' || str == 'he' || str == 'hj' || str == 'ej' || str == 'hej' } + pos(str) { return str == 'h' || str == 'e' || str == 'j' || str == 'he' || str == 'hj' || str == 'ej' || str == 'hej' } /** * @param { string } skill * @param { Player } player * @returns */ - static locked(skill, player) { + locked(skill, player) { const info = lib.skill[skill]; if (typeof info.locked == 'function') return info.locked(skill, player); if (info.locked == false) return false; @@ -448,7 +446,7 @@ export class Is extends Uninstantable { * @param { Player } player * @returns */ - static zhuanhuanji(skill, player) { + zhuanhuanji(skill, player) { const info = lib.skill[skill], { zhuanhuanji } = info; if ('zhuanhuanji2' in info) { const { zhuanhuanji2 } = info; diff --git a/noname/get/promises.js b/noname/get/promises.js index 5c417f95b..daa544485 100644 --- a/noname/get/promises.js +++ b/noname/get/promises.js @@ -1,11 +1,10 @@ import { get } from "./index.js"; -import { Uninstantable } from "../util/index.js"; -export class Promises extends Uninstantable { +export class Promises { /** * @returns { Promise } */ - static zip() { + zip() { return new Promise(resolve => get.zip(resolve)); } } \ No newline at end of file diff --git a/noname/gnc/index.js b/noname/gnc/index.js index df5a6d83b..c569456d4 100644 --- a/noname/gnc/index.js +++ b/noname/gnc/index.js @@ -1,14 +1,14 @@ -import { GeneratorFunction, Uninstantable } from "../util/index.js"; +import { GeneratorFunction } from "../util/index.js"; import { Is } from "./is.js"; // gnc: GeNCoroutine -export class GNC extends Uninstantable { +export class GNC { /** * @param {GeneratorFunction} fn * @returns */ - static of(fn) { - return Is.generatorFunc(fn) ? + of(fn) { + return this.is.generatorFunc(fn) ? /** * @param {Parameters} args * @returns {Promise>} @@ -45,7 +45,14 @@ export class GNC extends Uninstantable { return new Promise(callback); } : (() => { throw new TypeError("gnc.of needs a GeneratorFunction."); })(); } - static is = Is; + is = new Is(); }; -export const gnc = GNC; +export let gnc = new GNC(); + +/** + * @param { InstanceType } [instance] + */ +export let setGNC = (instance) => { + gnc = instance || new GNC(); +}; diff --git a/noname/gnc/is.js b/noname/gnc/is.js index 7089fa988..31d9c84be 100644 --- a/noname/gnc/is.js +++ b/noname/gnc/is.js @@ -1,11 +1,11 @@ -import { GeneratorFunction, Uninstantable } from "../util/index.js"; +import { GeneratorFunction } from "../util/index.js"; -export class Is extends Uninstantable { +export class Is { /** * @param {*} item * @returns {boolean} */ - static coroutine(item) { + coroutine(item) { return typeof item == "function" && item.name == "genCoroutine"; } @@ -13,7 +13,7 @@ export class Is extends Uninstantable { * @param {*} item * @returns {boolean} */ - static generatorFunc(item) { + generatorFunc(item) { return item instanceof GeneratorFunction; } @@ -21,7 +21,7 @@ export class Is extends Uninstantable { * @param {*} item * @returns {boolean} */ - static generator(item) { + generator(item) { return (typeof item == "object") && ("constructor" in item) && item.constructor && ("constructor" in item.constructor) && item.constructor.constructor === GeneratorFunction; } }; diff --git a/noname/init/cordova.js b/noname/init/cordova.js index a1d00eb59..2253a6abd 100644 --- a/noname/init/cordova.js +++ b/noname/init/cordova.js @@ -1,9 +1,9 @@ // @ts-nocheck -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { nonameInitialized } from '../util/index.js'; export async function cordovaReady() { diff --git a/noname/init/import.js b/noname/init/import.js index 2b7f302b5..f7a1b1e97 100644 --- a/noname/init/import.js +++ b/noname/init/import.js @@ -1,4 +1,4 @@ -import { Game as game } from '../game/index.js'; +import { game } from '../game/index.js'; import { lib } from '../library/index.js'; /** diff --git a/noname/init/index.js b/noname/init/index.js index e1af73d4e..baf9b23f5 100644 --- a/noname/init/index.js +++ b/noname/init/index.js @@ -1,16 +1,14 @@ -import { AI as ai } from '../ai/index.js'; -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; - +import { ai } from '../ai/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { gnc } from '../gnc/index.js'; import { userAgent, nonameInitialized } from '../util/index.js'; import * as config from '../util/config.js'; import { promiseErrorHandlerMap } from '../util/browser.js'; -import { gnc } from '../gnc/index.js'; - import { importCardPack, importCharacterPack, importExtension, importMode } from './import.js'; import { onload } from './onload.js'; diff --git a/noname/init/node.js b/noname/init/node.js index f4be1c7d0..90d63c3ce 100644 --- a/noname/init/node.js +++ b/noname/init/node.js @@ -1,9 +1,9 @@ // @ts-nocheck -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { checkVersion } from '../library/update.js'; export function nodeReady() { diff --git a/noname/init/onload.js b/noname/init/onload.js index a58a207fa..fa674cc22 100644 --- a/noname/init/onload.js +++ b/noname/init/onload.js @@ -1,13 +1,10 @@ // @ts-nocheck -import { AI as ai } from '../ai/index.js'; -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; - -import { userAgent } from '../util/index.js'; -import * as config from '../util/config.js'; +import { ai } from '../ai/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; import { gnc } from '../gnc/index.js'; import { Mutex } from '../util/index.js'; diff --git a/noname/init/polyfill.js b/noname/init/polyfill.js index 3dfab6e43..bbe5ce8a4 100644 --- a/noname/init/polyfill.js +++ b/noname/init/polyfill.js @@ -1,8 +1,8 @@ -import { Get as get } from '../get/index.js'; -import { Library as lib } from '../library/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; +import { get } from '../get/index.js'; +import { lib } from '../library/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; // 废弃覆盖原型的HTMLDivElement.prototype.animate // 改为HTMLDivElement.prototype.addTempClass diff --git a/noname/library/cache/cacheContext.js b/noname/library/cache/cacheContext.js index 18d6b3e81..3c4b00b65 100644 --- a/noname/library/cache/cacheContext.js +++ b/noname/library/cache/cacheContext.js @@ -1,17 +1,17 @@ -import { Library } from "../index.js"; -import { Game } from "../../game/index.js"; -import { Get } from "../../get/index.js"; -import { status as _status } from "../../status/index.js"; +import { lib } from "../index.js"; +import { game } from "../../game/index.js"; +import { get } from "../../get/index.js"; +import { _status } from "../../status/index.js"; import { hex_md5 } from "../crypt/md5.js"; /** * 缓存上下文,用于在各种方法中暂时缓存值,以第一次获取的缓存值为准。 */ -export class CacheContext{ +export class CacheContext { constructor(){ - this.lib = this._createCacheProxy(Library); - this.game = this._createCacheProxy(Game); - this.get = this._createCacheProxy(Get); + this.lib = this._createCacheProxy(lib); + this.game = this._createCacheProxy(game); + this.get = this._createCacheProxy(get); this.sourceMap = new Map(); this.storageMap = new Map(); } diff --git a/noname/library/element/button.js b/noname/library/element/button.js index 4785b1648..0c1a428a1 100644 --- a/noname/library/element/button.js +++ b/noname/library/element/button.js @@ -1,11 +1,12 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; - +import { get } from '../../get/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Button extends HTMLDivElement { + /** + * @type { string | undefined } + */ + buttonid; /** * @param {{}} item * @param {keyof typeof ui.create.buttonPresets | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button)} type @@ -37,7 +38,7 @@ export class Button extends HTMLDivElement { } else { console.error([item, type, position, noClick, button]); throw 'button不合法'; - } + }; } exclude() { if (_status.event.excludeButton == undefined) { diff --git a/noname/library/element/card.js b/noname/library/element/card.js index a53f089d1..e164efa8a 100644 --- a/noname/library/element/card.js +++ b/noname/library/element/card.js @@ -1,9 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Card extends HTMLDivElement { /** diff --git a/noname/library/element/client.js b/noname/library/element/client.js index fba45ff6c..607378b0d 100644 --- a/noname/library/element/client.js +++ b/noname/library/element/client.js @@ -1,10 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Client { /** diff --git a/noname/library/element/content.js b/noname/library/element/content.js index f02c00d27..c6d8a179f 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -1,10 +1,10 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { ai } from '../../ai/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; +import { gnc } from '../../gnc/index.js'; // 未来再改 export const Content = { diff --git a/noname/library/element/contents.js b/noname/library/element/contents.js index 163a9869b..bb199ed10 100644 --- a/noname/library/element/contents.js +++ b/noname/library/element/contents.js @@ -1,10 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; /** * @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise)[]> } diff --git a/noname/library/element/control.js b/noname/library/element/control.js index 0b9545620..78d0d3522 100644 --- a/noname/library/element/control.js +++ b/noname/library/element/control.js @@ -1,10 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Control extends HTMLDivElement { // @ts-ignore diff --git a/noname/library/element/dialog.js b/noname/library/element/dialog.js index 5d8bcc999..44c207638 100644 --- a/noname/library/element/dialog.js +++ b/noname/library/element/dialog.js @@ -1,9 +1,7 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { get } from '../../get/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; export class Dialog extends HTMLDivElement { /** @type { HTMLDivElement } */ diff --git a/noname/library/element/gameEvent.js b/noname/library/element/gameEvent.js index 9fbd5bfa6..c0100ca19 100644 --- a/noname/library/element/gameEvent.js +++ b/noname/library/element/gameEvent.js @@ -1,9 +1,8 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; import { AsyncFunction } from '../../util/index.js'; export class GameEvent { diff --git a/noname/library/element/gameEventPromise.js b/noname/library/element/gameEventPromise.js index 7aeecc31d..4b9523fa8 100644 --- a/noname/library/element/gameEventPromise.js +++ b/noname/library/element/gameEventPromise.js @@ -1,7 +1,7 @@ -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; import { AsyncFunction } from '../../util/index.js'; /** diff --git a/noname/library/element/nodeWS.js b/noname/library/element/nodeWS.js index 91e9da267..acbf67d77 100644 --- a/noname/library/element/nodeWS.js +++ b/noname/library/element/nodeWS.js @@ -1,10 +1,5 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; -import { GNC as gnc } from '../../gnc/index.js'; +import { game } from '../../game/index.js'; +import { _status } from '../../status/index.js'; export class NodeWS { /** diff --git a/noname/library/element/player.js b/noname/library/element/player.js index 9ffa67bb0..4ec6f8526 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -1,9 +1,9 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { ai } from '../../ai/index.js'; +import { get } from '../../get/index.js'; +import { game } from '../../game/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; +import { ui } from '../../ui/index.js'; import { CacheContext } from '../cache/cacheContext.js'; import { ChildNodesWatcher } from '../cache/childNodesWatcher.js'; diff --git a/noname/library/element/vcard.js b/noname/library/element/vcard.js index 4cd565e83..af8651b9f 100644 --- a/noname/library/element/vcard.js +++ b/noname/library/element/vcard.js @@ -1,9 +1,6 @@ -import { AI as ai } from '../../ai/index.js'; -import { Get as get } from '../../get/index.js'; -import { Game as game } from '../../game/index.js'; -import { Library as lib } from "../index.js"; -import { status as _status } from '../../status/index.js'; -import { UI as ui } from '../../ui/index.js'; +import { get } from '../../get/index.js'; +import { lib } from "../index.js"; +import { _status } from '../../status/index.js'; export class VCard { /** diff --git a/noname/library/index.js b/noname/library/index.js index f5aac07b3..0222efe53 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -9,14 +9,13 @@ * @typedef { InstanceType } NodeWS * @typedef { InstanceType } Control */ -import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction, characterDefaultPicturePath } from "../util/index.js"; -import { AI as ai } from '../ai/index.js'; -import { Get as get } from '../get/index.js'; -import { Game as game } from '../game/index.js'; -import { status as _status } from '../status/index.js'; -import { UI as ui } from '../ui/index.js'; -import { GNC as gnc } from '../gnc/index.js'; - +import { nonameInitialized, assetURL, userAgent, GeneratorFunction, AsyncFunction, characterDefaultPicturePath } from "../util/index.js"; +import { ai } from '../ai/index.js'; +import { get } from '../get/index.js'; +import { game } from '../game/index.js'; +import { _status } from '../status/index.js'; +import { ui } from '../ui/index.js'; +import { gnc } from '../gnc/index.js'; import { LibInit } from "./init/index.js"; import { Announce } from "./announce/index.js"; import { Channel } from "./channel/index.js"; @@ -27,29 +26,29 @@ import { defaultHooks } from "./hooks/index.js" import { freezeButExtensible } from "../util/index.js" -export class Library extends Uninstantable { - static configprefix = 'noname_0.9_'; - static versionOL = 27; - static updateURLS = updateURLs; - static updateURL = updateURLs.github; - static mirrorURL = updateURLs.coding; - static hallURL = '47.99.105.222'; - static assetURL = assetURL; - static userAgent = userAgent; - static characterDefaultPicturePath = characterDefaultPicturePath; - static compatibleEdition = Boolean(typeof nonameInitialized == 'string' && nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)); - static changeLog = []; - static updates = []; - static canvasUpdates = []; +export class Library { + configprefix = 'noname_0.9_'; + versionOL = 27; + updateURLS = updateURLs; + updateURL = updateURLs.github; + mirrorURL = updateURLs.coding; + hallURL = '47.99.105.222'; + assetURL = assetURL; + userAgent = userAgent; + characterDefaultPicturePath = characterDefaultPicturePath; + compatibleEdition = Boolean(typeof nonameInitialized == 'string' && nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)); + changeLog = []; + updates = []; + canvasUpdates = []; /** * @type { Video[] } */ - static video = []; - static skilllist = []; - static connectBanned = []; - static characterIntro = {}; - static characterTitle = {}; - static characterPack = new Proxy({}, { + video = []; + skilllist = []; + connectBanned = []; + characterIntro = {}; + characterTitle = {}; + characterPack = new Proxy({}, { set(target, prop, newValue) { if (typeof prop == 'string') { // 新增武将包,且不是“收藏”和“禁用” @@ -62,14 +61,14 @@ export class Library extends Uninstantable { return Reflect.set(target, prop, newValue); } }); - static characterFilter = {}; - static characterSort = {}; - static characterReplace = {}; - static characterSubstitute = {}; - static characterInitFilter = {}; - static characterGuozhanFilter = ["mode_guozhan"]; - static dynamicTranslate = {}; - static cardPack = new Proxy({}, { + characterFilter = {}; + characterSort = {}; + characterReplace = {}; + characterSubstitute = {}; + characterInitFilter = {}; + characterGuozhanFilter = ["mode_guozhan"]; + dynamicTranslate = {}; + cardPack = new Proxy({}, { set(target, prop, newValue) { if (typeof prop == 'string') { if (!Reflect.has(target, prop)) { @@ -81,19 +80,19 @@ export class Library extends Uninstantable { return Reflect.set(target, prop, newValue); } }); - static cardPackInfo = {}; + cardPackInfo = {}; /** * @type { SMap } */ - static skin = {}; - static onresize = []; - static onphase = []; - static onwash = []; - static onover = []; - static ondb = []; - static ondb2 = []; - static chatHistory = []; - static emotionList = { + skin = {}; + onresize = []; + onphase = []; + onwash = []; + onover = []; + ondb = []; + ondb2 = []; + chatHistory = []; + emotionList = { xiaowu_emotion: 14, xiaokuo_emotion: 8, shibing_emotion: 15, @@ -103,37 +102,37 @@ export class Library extends Uninstantable { xiaotao_emotion: 20, xiaojiu_emotion: 20, }; - static animate = { + animate = { skill: {}, card: {}, }; - static onload = []; - static onload2 = []; - static onprepare = []; - static arenaReady = []; - static onfree = []; - static inpile = []; - static inpile_nature = []; - static extensions = []; - static extensionPack = {}; - static cardType = {}; - static hook = { globalskill: {} }; + onload = []; + onload2 = []; + onprepare = []; + arenaReady = []; + onfree = []; + inpile = []; + inpile_nature = []; + extensions = []; + extensionPack = {}; + cardType = {}; + hook = { globalskill: {} }; /** * @type { Player | undefined } */ - static tempSortSeat; + tempSortSeat; /** * @type { 'android' | 'ios' | undefined } */ - static device; + device; /** * @type { string } */ - static version; + version; /** * @type { Videos[] } */ - static videos; + videos; /** * @type { { * fs: typeof import("fs"), @@ -146,22 +145,22 @@ export class Library extends Uninstantable { * torespondtimeout:{}, * } } */ - static node; + node; /** * @type { { [key: string]: string } } */ - static playerOL; + playerOL; /** * @type { IDBRequest } */ - static db; + db; //函数钩子 /** * 你可以往这里加入{钩子名:函数数组},并在数组里增加你的自定义函数 * 这样当某个地方调用game.callHook(钩子名,[...函数参数])时,就会按顺序将对应数组中的每个函数运行一遍(传参为callHook的第二个参数)。 * 你可以将hook机制类比为event.trigger(),但是这里只能放同步代码 */ - static hooks = freezeButExtensible({ ...defaultHooks }); + hooks = freezeButExtensible({ ...defaultHooks }); /** * **无名杀频道推送机制** @@ -184,7 +183,7 @@ export class Library extends Uninstantable { * // 从某个角落向channel发消息,若无消息接收则等待 * await channel.send(item); */ - static channel = Channel; + channel = Channel; /** * **无名杀消息推送库** @@ -211,13 +210,13 @@ export class Library extends Uninstantable { * // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅 * lib.announce.unsubscribe("skinChange", method); */ - static announce = new Announce(new EventTarget(), new WeakMap()); + announce = new Announce(new EventTarget(), new WeakMap()); - static objectURL = new Map(); - static hookmap = {}; - static imported = {}; - static layoutfixed = ['chess', 'tafang', 'stone']; - static pinyins = { + objectURL = new Map(); + hookmap = {}; + imported = {}; + layoutfixed = ['chess', 'tafang', 'stone']; + pinyins = { _metadata: { shengmu: ['zh', 'ch', 'sh', 'b', 'p', 'm', 'f', 'd', 't', 'l', 'n', 'g', 'k', 'h', 'j', 'q', 'x', 'r', 'z', 'c', 's', 'y', 'w'], special_shengmu: ['j', 'q', 'x', 'y'], @@ -250,7 +249,7 @@ export class Library extends Uninstantable { * * 应变 */ - static yingbian = { + yingbian = { condition: { color: new Map([ ['zhuzhan', 'wood'], @@ -426,7 +425,7 @@ export class Library extends Uninstantable { * * 谋攻强化 */ - static stratagemBuff = { + stratagemBuff = { cost: new Map([ ['sha', 1], ['shan', 1], @@ -516,11 +515,11 @@ export class Library extends Uninstantable { * * 实际的卡牌名称 */ - static actualCardName = new Map([ + actualCardName = new Map([ ['挟令', '挟天子以令诸侯'], ['霹雳投石车', '霹雳车'] ]); - static characterDialogGroup = { + characterDialogGroup = { '收藏': function (name, capt) { return lib.config.favouriteCharacter.includes(name) ? capt : null; }, @@ -529,7 +528,7 @@ export class Library extends Uninstantable { return list.includes(name) ? capt : null; } }; - static listenEnd(node) { + listenEnd(node) { if (!node._listeningEnd) { node._listeningEnd = true; node.listenTransition(function () { @@ -544,7 +543,7 @@ export class Library extends Uninstantable { }); } } - static configMenu = { + configMenu = { general: { name: '通用', config: { @@ -4480,7 +4479,7 @@ export class Library extends Uninstantable { } } }; - static extensionMenu = { + extensionMenu = { cardpile: { enable: { name: '开启', @@ -4794,7 +4793,7 @@ export class Library extends Uninstantable { }, }, }; - static mode = { + mode = { identity: { name: '身份', connect: { @@ -7482,7 +7481,7 @@ export class Library extends Uninstantable { } }, }; - static status = { + status = { running: false, canvas: false, time: 0, @@ -7492,7 +7491,7 @@ export class Library extends Uninstantable { videoId: 0, globalId: 0, }; - static help = { + help = { '关于游戏': '
关于无名杀
  • 无名杀官方发布地址仅有GitHub仓库!
    点击前往Github仓库
  • 无名杀基于GPLv3开源协议。
    点击查看GPLv3协议
  • 其他所有的所谓“无名杀”社群(包括但不限于绝大多数“官方”QQ群、QQ频道等)均为玩家自发组织,与无名杀官方无关!', '游戏操作': '
    • 长按/鼠标悬停/右键单击显示信息。
    • 触屏模式中,双指点击切换暂停;下划显示菜单,上划切换托管。
    • 键盘快捷键
      ' + '
      A切换托管
      W切换不询问无懈
      空格暂停
    • 编辑牌堆
      在卡牌包中修改牌堆后,将自动创建一个临时牌堆,在所有模式中共用,当保存当前牌堆后,临时牌堆被清除。每个模式可设置不同的已保存牌堆,设置的牌堆优先级大于临时牌堆。
    ', @@ -7529,8 +7528,8 @@ export class Library extends Uninstantable { * @type {import('path')} */ // @ts-ignore - static path = {}; - static getErrorTip(msg) { + path = {}; + getErrorTip(msg) { if (typeof msg != 'string') { try { msg = msg.toString(); @@ -7672,7 +7671,7 @@ export class Library extends Uninstantable { return newMessage; } } - static codeMirrorReady(node, editor) { + codeMirrorReady(node, editor) { ui.window.appendChild(node); node.style.fontSize = 20 / game.documentZoom + 'px'; const mirror = window.CodeMirror(editor, { @@ -7893,7 +7892,7 @@ export class Library extends Uninstantable { return found.sort((a, b) => (a + '').localeCompare(b + '')); } } - static setIntro(node, func, left) { + setIntro(node, func, left) { if (lib.config.touchscreen) { if (left) { node.listen(ui.click.touchintro); @@ -7920,7 +7919,7 @@ export class Library extends Uninstantable { node._customintro = func; } } - static setPopped(node, func, width, height, forceclick, paused2) { + setPopped(node, func, width, height, forceclick, paused2) { node._poppedfunc = func; node._poppedwidth = width; node._poppedheight = height; @@ -7938,7 +7937,7 @@ export class Library extends Uninstantable { node._paused2 = true; } } - static placePoppedDialog(dialog, e) { + placePoppedDialog(dialog, e) { if (dialog._place_text) { if (dialog._place_text.firstChild.offsetWidth >= 190 || dialog._place_text.firstChild.offsetHeight >= 30) { dialog._place_text.style.marginLeft = '14px'; @@ -7970,7 +7969,7 @@ export class Library extends Uninstantable { } dialog.style.top = idealtop + 'px'; } - static setHover(node, func, hoveration, width) { + setHover(node, func, hoveration, width) { node._hoverfunc = func; if (typeof hoveration == 'number') { node._hoveration = hoveration; @@ -7984,22 +7983,22 @@ export class Library extends Uninstantable { node.addEventListener('mousemove', ui.click.mousemove); return node; } - static setScroll(node) { + setScroll(node) { node.ontouchstart = ui.click.touchStart; node.ontouchmove = ui.click.touchScroll; node.style.webkitOverflowScrolling = 'touch'; return node; } - static setMousewheel(node) { + setMousewheel(node) { if (lib.config.mousewheel) node.onmousewheel = ui.click.mousewheel; } - static setLongPress(node, func) { + setLongPress(node, func) { node.addEventListener('touchstart', ui.click.longpressdown); node.addEventListener('touchend', ui.click.longpresscancel); node._longpresscallback = func; return node; } - static updateCanvas(time) { + updateCanvas(time) { if (lib.canvasUpdates.length === 0) { lib.status.canvas = false; return false; @@ -8025,7 +8024,7 @@ export class Library extends Uninstantable { } } } - static run(time) { + run(time) { lib.status.time = time; for (var i = 0; i < lib.updates.length; i++) { if (!('_time' in lib.updates[i])) { @@ -8043,18 +8042,18 @@ export class Library extends Uninstantable { lib.status.delayed = 0; } } - static getUTC(date) { + getUTC(date) { return date.getTime(); } - static saveVideo() { + saveVideo() { if (_status.videoToSave) { game.export(lib.init.encode(JSON.stringify(_status.videoToSave)), '无名杀 - 录像 - ' + _status.videoToSave.name[0] + ' - ' + _status.videoToSave.name[1]); } } - static genAsync(fn) { return gnc.of(fn); } - static genAwait(item) { return gnc.is.generator(item) ? gnc.of(function* () { for (const content of item) { yield content; } })() : Promise.resolve(item); } - static gnc = { + genAsync(fn) { return gnc.of(fn); } + genAwait(item) { return gnc.is.generator(item) ? gnc.of(function* () { for (const content of item) { yield content; } })() : Promise.resolve(item); } + gnc = { of: fn => gnc.of(fn), is: { coroutine: item => gnc.is.coroutine(item), @@ -8062,7 +8061,7 @@ export class Library extends Uninstantable { generator: item => gnc.is.generator(item) } }; - static comparator = { + comparator = { equals: function () { if (arguments.length == 0) return false; if (arguments.length == 1) return true; @@ -8095,7 +8094,7 @@ export class Library extends Uninstantable { return true; } }; - static creation = { + creation = { get array() { return []; }, @@ -8109,7 +8108,7 @@ export class Library extends Uninstantable { return ""; } }; - static linq = { + linq = { cselector: { hasAttr: name => `[${name}]`, isAttr: (name, item) => `[${name}=${item}]`, @@ -8214,8 +8213,8 @@ export class Library extends Uninstantable { } } }; - static init = LibInit; - static cheat = { + init = new LibInit(); + cheat = { /** * 将游戏内部的对象暴露到全局中 * @@ -9096,7 +9095,7 @@ export class Library extends Uninstantable { game.zhu.update(); }, }; - static translate = { + translate = { flower: '鲜花', egg: '鸡蛋', wine: '酒杯', @@ -9322,9 +9321,9 @@ export class Library extends Uninstantable { phaseJieshu: '结束阶段', }; - static experimental = Experimental + experimental = Experimental - static element = { + element = { content: Element.Content, contents: Element.Contents, Player: Element.Player, @@ -9448,7 +9447,7 @@ export class Library extends Uninstantable { return this.NodeWS.prototype; } }; - static card = { + card = { list: [], cooperation_damage: { fullskin: true, @@ -9553,7 +9552,7 @@ export class Library extends Uninstantable { fullimage: true, }, }; - static filter = { + filter = { all: () => true, none: () => false, /** @@ -10100,7 +10099,7 @@ export class Library extends Uninstantable { } } }; - static sort = { + sort = { nature: function (a, b) { return (lib.nature.get(b) || 0) - (lib.nature.get(a) || 0); }, @@ -10276,7 +10275,7 @@ export class Library extends Uninstantable { * [key: string]: Skill; * }} */ - static skill = { + skill = { stratagem_fury: { marktext: '🔥', intro: { @@ -11678,10 +11677,10 @@ export class Library extends Uninstantable { } } }; - static character = {}; - static perfectPair = {}; - static cardPile = {}; - static message = { + character = {}; + perfectPair = {}; + cardPile = {}; + message = { server: { /** @this { any } */ init(version, config, banned_info) { @@ -12776,16 +12775,16 @@ export class Library extends Uninstantable { } } }; - static suit = ['club', 'spade', 'diamond', 'heart']; - static suits = ['club', 'spade', 'diamond', 'heart', 'none']; - static color = { + suit = ['club', 'spade', 'diamond', 'heart']; + suits = ['club', 'spade', 'diamond', 'heart', 'none']; + color = { black: ['club', 'spade'], red: ['diamond', 'heart'], none: ['none'], }; - static group = ['wei', 'shu', 'wu', 'qun', 'jin', 'shen']; + group = ['wei', 'shu', 'wu', 'qun', 'jin', 'shen']; //数值代表各元素在名称中排列的先后顺序 - static nature = new Map([ + nature = new Map([ ['fire', 20], ['thunder', 30], ['kami', 60], @@ -12793,7 +12792,7 @@ export class Library extends Uninstantable { ['stab', 10], ['poison', 50] ]); - static natureAudio = { + natureAudio = { damage: { 'fire': 'default',//默认,即语音放置在audio/effect下,以damage_fire.mp3 damage_fire2.mp3命名。 'thunder': 'default', @@ -12832,12 +12831,12 @@ export class Library extends Uninstantable { */ } }; - static linked = ['fire', 'thunder', 'kami', 'ice']; - static natureBg = new Map([ + linked = ['fire', 'thunder', 'kami', 'ice']; + natureBg = new Map([ ['stab', 'image/card/cisha.png'] ]); - static natureSeparator = '|'; - static namePrefix = new Map([ + natureSeparator = '|'; + namePrefix = new Map([ ['界', { color: '#fdd559', nature: 'soilmm', @@ -13122,7 +13121,7 @@ export class Library extends Uninstantable { getSpan: () => `${get.prefixSpan('旧')}${get.prefixSpan('谋')}` }] ]); - static groupnature = { + groupnature = { shen: 'shen', wei: 'water', shu: 'soil', @@ -13133,7 +13132,7 @@ export class Library extends Uninstantable { jin: 'thunder', ye: 'thunder', }; - static lineColor = new Map([ + lineColor = new Map([ ['fire', [255, 146, 68]], ['yellow', [255, 255, 122]], ['blue', [150, 202, 255]], @@ -13146,8 +13145,8 @@ export class Library extends Uninstantable { ['brown', [195, 161, 223]], ['legend', [233, 131, 255]] ]); - static phaseName = ['phaseZhunbei', 'phaseJudge', 'phaseDraw', 'phaseUse', 'phaseDiscard', 'phaseJieshu']; - static quickVoice = [ + phaseName = ['phaseZhunbei', 'phaseJudge', 'phaseDraw', 'phaseUse', 'phaseDiscard', 'phaseJieshu']; + quickVoice = [ '我从未见过如此厚颜无耻之人!', '这波不亏', '请收下我的膝盖', @@ -13172,19 +13171,29 @@ export class Library extends Uninstantable { '哥哥,交个朋友吧', '妹子,交个朋友吧', ]; - static other = { + other = { ignore: () => void 0 }; - static InitFilter = { + InitFilter = { 'noZhuHp': '不享受主公的额外体力上限', 'noZhuSkill': '不享受地主的额外技能', }; } -Library.config = undefined; -Library.configOL = undefined; +Library.prototype.config = undefined; +Library.prototype.configOL = undefined; -export const lib = Library; +export let lib = new Library(); + +/** + * @param { InstanceType } [instance] + */ +export let setLibrary = (instance) => { + lib = instance || new Library(); + if (lib.config.dev) { + window.lib = lib; + } +}; /** * @template T diff --git a/noname/library/init/index.js b/noname/library/init/index.js index fc597e389..43aaf6c8e 100644 --- a/noname/library/init/index.js +++ b/noname/library/init/index.js @@ -1,27 +1,26 @@ -import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../../util/index.js"; -import { AI as ai } from '../../ai/index.js' -import { Get as get } from '../../get/index.js' -import { Game, Game as game } from '../../game/index.js' -import { Library as lib } from "../index.js" -import { status as _status } from '../../status/index.js' -import { UI as ui } from '../../ui/index.js' -import { GNC as gnc } from '../../gnc/index.js' +import { GeneratorFunction } from "../../util/index.js"; +import { get } from '../../get/index.js' +import { game } from '../../game/index.js' +import { lib } from "../index.js" +import { _status } from '../../status/index.js' +import { ui } from '../../ui/index.js' +import { gnc } from '../../gnc/index.js' import { LibInitPromises } from "./promises.js" import { GameEvent } from "../element/gameEvent.js" import { GameEventPromise } from "../element/gameEventPromise.js" -export class LibInit extends Uninstantable { +export class LibInit { /** * 部分函数的Promise版本 */ - static promises = LibInitPromises + promises = new LibInitPromises() - static init() { + init() { throw new Error('lib.init.init is moved to noname/init') } - static reset() { + reset() { if (window.inSplash) return; if (window.resetExtension) { if (confirm('游戏似乎未正常载入,有可能因为部分扩展未正常载入,或者因为部分扩展未载入完毕。\n是否禁用扩展并重新打开?')) { @@ -83,11 +82,11 @@ export class LibInit extends Uninstantable { } // 现在改lib.init.onload的都给我无报错被创 - static async onload() { + async onload() { throw new Error('lib.init.onload is moved to noname/init/onload') } - static startOnline() { + startOnline() { 'step 0' event._resultid = null; event._result = null; @@ -102,7 +101,7 @@ export class LibInit extends Uninstantable { event.goto(0); } - static onfree() { + onfree() { if (lib.onfree) { clearTimeout(window.resetGameTimeout); delete window.resetGameTimeout; @@ -131,7 +130,7 @@ export class LibInit extends Uninstantable { } } - static connection(ws) { + connection(ws) { const client = new lib.element.Client(ws); lib.node.clients.push(client); if (window.isNonameServer) { @@ -162,7 +161,7 @@ export class LibInit extends Uninstantable { client.send('opened'); } - static sheet() { + sheet() { var style = document.createElement('style'); document.head.appendChild(style); for (var i = 0; i < arguments.length; i++) { @@ -173,7 +172,7 @@ export class LibInit extends Uninstantable { return style; } - static css(path, file, before) { + css(path, file, before) { const style = document.createElement("link"); style.rel = "stylesheet"; if (path) { @@ -195,7 +194,7 @@ export class LibInit extends Uninstantable { //在扩展的precontent中调用,用于加载扩展必需的JS文件。 //If any of the parameters is an Array, corresponding files will be loaded in order //如果任意参数为数组,则按顺序加载加载相应的文件 - static jsForExtension(path, file, onLoad, onError) { + jsForExtension(path, file, onLoad, onError) { if (!_status.javaScriptExtensions) _status.javaScriptExtensions = []; _status.javaScriptExtensions.push({ path: path, @@ -205,7 +204,7 @@ export class LibInit extends Uninstantable { }); } - static js(path, file, onLoad, onError) { + js(path, file, onLoad, onError) { if (path[path.length - 1] == '/') path = path.slice(0, path.length - 1); if (path == `${lib.assetURL}mode` && lib.config.all.stockmode.indexOf(file) == -1) { lib.genAwait(lib.init[`setMode_${file}`]()).then(onLoad); @@ -243,7 +242,7 @@ export class LibInit extends Uninstantable { * 同步lib.init.js * @returns { void } */ - static jsSync(path, file, onLoad, onError) { + jsSync(path, file, onLoad, onError) { if (lib.assetURL.length == 0 && location.origin == 'file://' && typeof game.readFile == 'undefined') { const e = new Error('浏览器file协议下无法使用此api,请在http/https协议下使用此api'); if (typeof onError == 'function') onError(e); @@ -292,7 +291,7 @@ export class LibInit extends Uninstantable { xmlHttpRequest.send(); } - static req(str, onload, onerror, master) { + req(str, onload, onerror, master) { let sScriptURL; if (str.startsWith('http')) sScriptURL = str; else if (str.startsWith('local:')) { @@ -326,7 +325,7 @@ export class LibInit extends Uninstantable { /** * 同步lib.init.req */ - static reqSync(str, onload, onerror, master) { + reqSync(str, onload, onerror, master) { let sScriptURL; if (str.startsWith('http')) sScriptURL = str; else if (str.startsWith('local:')) { @@ -358,7 +357,7 @@ export class LibInit extends Uninstantable { if (typeof onload !== 'function') return oReq.responseText; } - static json(url, onload, onerror) { + json(url, onload, onerror) { const oReq = new XMLHttpRequest(); if (typeof onload == 'function') oReq.addEventListener("load", () => { if (![0, 200].includes(oReq.status)) { @@ -385,7 +384,7 @@ export class LibInit extends Uninstantable { /** * 同步lib.init.json */ - static jsonSync(url, onload, onerror) { + jsonSync(url, onload, onerror) { if (lib.assetURL.length == 0 && location.origin == 'file://' && typeof game.readFile == 'undefined') { const e = new Error('浏览器file协议下无法使用此api,请在http/https协议下使用此api'); if (typeof onerror == 'function') onerror(e); @@ -415,7 +414,7 @@ export class LibInit extends Uninstantable { oReq.send(); } - static cssstyles() { + cssstyles() { if (ui.css.styles) { ui.css.styles.remove(); } @@ -438,7 +437,7 @@ export class LibInit extends Uninstantable { } } - static layout(layout, nosave) { + layout(layout, nosave) { const loadingScreen = ui.create.div('.loading-screen', document.body), loadingScreenStyle = loadingScreen.style; loadingScreenStyle.animationDuration = '1s'; loadingScreenStyle.animationFillMode = 'forwards'; @@ -558,7 +557,7 @@ export class LibInit extends Uninstantable { }); } - static background() { + background() { if (lib.config.image_background_random) { var list = []; for (var i in lib.configMenu.appearence.config.image_background.item) { @@ -585,7 +584,7 @@ export class LibInit extends Uninstantable { * @param {Function} [scope] 作用域 * @returns */ - static parsex(item, scope) { + parsex(item, scope) { //by 诗笺、Tipx-L /** * @param {Function} func @@ -748,7 +747,7 @@ export class LibInit extends Uninstantable { } } - static eval(func) { + eval(func) { if (typeof func == 'function') { return eval('(' + func.toString() + ')'); } @@ -768,7 +767,7 @@ export class LibInit extends Uninstantable { return func; } - static encode(strUni) { + encode(strUni) { var strUtf = strUni.replace( /[\u0080-\u07ff]/g, function (c) { var cc = c.charCodeAt(0); @@ -782,7 +781,7 @@ export class LibInit extends Uninstantable { return btoa(strUtf); } - static decode(str) { + decode(str) { var strUtf = atob(str); var strUni = strUtf.replace( /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, function (c) { @@ -797,7 +796,7 @@ export class LibInit extends Uninstantable { return strUni; } - static stringify(obj) { + stringify(obj) { var str = '{' for (var i in obj) { str += '"' + i + '":' @@ -816,7 +815,7 @@ export class LibInit extends Uninstantable { return str; } - static stringifySkill(obj) { + stringifySkill(obj) { var str = ''; for (var i in obj) { str += i + ':' @@ -838,7 +837,7 @@ export class LibInit extends Uninstantable { * 在返回当前加载的esm模块相对位置。 * @param {*} url 传入import.meta.url */ - static getCurrentFileLocation(url){ + getCurrentFileLocation(url){ let head = window.location.href.slice(0,window.location.href.lastIndexOf('/')+1); let ret = url.replace(head,''); return decodeURIComponent(ret); diff --git a/noname/library/init/promises.js b/noname/library/init/promises.js index 170248d1b..b4c54f158 100644 --- a/noname/library/init/promises.js +++ b/noname/library/init/promises.js @@ -1,7 +1,6 @@ -import { Uninstantable } from "../../util/index.js"; -import { Library as lib } from "../index.js"; +import { lib } from '../../../noname.js'; -export class LibInitPromises extends Uninstantable { +export class LibInitPromises { /** * Promise版的`lib.init.js` * @@ -9,7 +8,7 @@ export class LibInitPromises extends Uninstantable { * @param {string | string[]} [file] - 文件名或文件名组,忽略则直接读取`path`的内容 * @returns {Promise} */ - static js(path, file) { + js(path, file) { return new Promise((resolve, reject) => lib.init.js(path, file, resolve, reject)) } @@ -22,7 +21,7 @@ export class LibInitPromises extends Uninstantable { * @param {boolean} [noerror = false] - 是否忽略报错 * @returns {Promise} */ - static css(path, file, before, noerror = false) { + css(path, file, before, noerror = false) { return new Promise((resolve, reject) => { const style = lib.init.css(path, file, before); const success = () => resolve(style); @@ -38,7 +37,7 @@ export class LibInitPromises extends Uninstantable { * @param {string} [master] * @returns {Promise} */ - static req(str, master) { + req(str, master) { return new Promise((resolve, reject) => lib.init.req(str, resolve, reject, master)) } @@ -48,7 +47,7 @@ export class LibInitPromises extends Uninstantable { * @param {string} url - 要读取的地址 * @returns {Promise} */ - static json(url) { + json(url) { return new Promise((resolve, reject) => lib.init.json(url, resolve, reject)) } @@ -57,7 +56,7 @@ export class LibInitPromises extends Uninstantable { * * @returns {Promise} */ - static sheet() { + sheet() { return new Promise((resolve, reject) => { const style = lib.init.sheet.apply(lib.init, arguments); style.addEventListener("load", () => resolve(style)); diff --git a/noname/status/index.js b/noname/status/index.js index eba68cd36..e874627a7 100644 --- a/noname/status/index.js +++ b/noname/status/index.js @@ -1,58 +1,69 @@ -export const status = { - paused: false, - paused2: false, - paused3: false, - over: false, - clicked: false, - auto: false, +import { lib } from "../library/index.js" + +export class status { + paused = false + paused2 = false + paused3 = false + over = false + clicked = false + auto = false /** * @type { GameEventPromise } */ // @ts-ignore - event: null, - ai: {}, - lastdragchange: [], - skillaudio: [], - dieClose: [], - dragline: [], - dying: [], + event = null + ai = {} + lastdragchange = [] + skillaudio = [] + dieClose = [] + dragline = [] + dying = [] /** * @type { GameHistory[] } */ - globalHistory: [{ - // @ts-ignore + globalHistory = [{ cardMove: [], custom: [], useCard: [], changeHp: [], everything: [], - }], - cardtag: { + }] + cardtag = { yingbian_zhuzhan: [], yingbian_kongchao: [], yingbian_fujia: [], yingbian_canqu: [], yingbian_force: [] - }, - renku: [], - prehidden_skills: [], - postReconnect: {}, + } + renku = [] + prehidden_skills = [] + postReconnect = {} /** * @type { string | void } */ - extension: undefined, + extension = undefined /** * @type { boolean | void } */ - dragged: undefined, + dragged = undefined /** * @type { boolean | void } */ - touchconfirmed: undefined, + touchconfirmed = undefined /** * @type { boolean | void } */ - connectMode: undefined, + connectMode = undefined }; -export const _status = status; \ No newline at end of file +export let _status = new status(); + +/** + * @param { InstanceType } [instance] + */ +export let setStatus = (instance) => { + _status = instance || new status(); + if (lib.config.dev) { + window._status = _status; + } +}; \ No newline at end of file diff --git a/noname/ui/click/index.js b/noname/ui/click/index.js index 6f69b66f6..e47441dd6 100644 --- a/noname/ui/click/index.js +++ b/noname/ui/click/index.js @@ -1,16 +1,19 @@ -import { ui, game, get, lib, _status } from "../../../noname.js"; -import { Uninstantable } from "../../util/index.js"; +import { ui } from '../index.js'; +import { lib } from '../../library/index.js'; +import { game } from "../../game/index.js"; +import { get } from "../../get/index.js"; +import { _status } from "../../status/index.js"; -export class Click extends Uninstantable { +export class Click { /** * @type {() => void} */ - static consoleMenu; + consoleMenu; /** * @type {(arg0: string) => void} */ - static menuTab; - static identitycircle() { + menuTab; + identitycircle() { var list = []; this.classList.toggle('transparent'); for (var i = 0; i < this.parentNode.childNodes.length; i++) { @@ -35,7 +38,7 @@ export class Click extends Uninstantable { } this._source._guozhanguess = list; } - static connectEvents() { + connectEvents() { if (this.info) { var button = this; var layer = ui.create.div('.poplayer', ui.window); @@ -317,7 +320,7 @@ export class Click extends Uninstantable { }; } } - static connectClients() { + connectClients() { if (this.info) { var button = this; var layer = ui.create.div('.poplayer', ui.window); @@ -432,7 +435,7 @@ export class Click extends Uninstantable { }; } } - static autoskin() { + autoskin() { if (!lib.config.change_skin) return; var players = game.filterPlayer(); var change = function (player, num, callback) { @@ -485,7 +488,7 @@ export class Click extends Uninstantable { }; autoskin(); } - static skin(avatar, name, callback) { + skin(avatar, name, callback) { var num = 1; if (name.startsWith('gz_')) { name = name.slice(3); @@ -530,7 +533,7 @@ export class Click extends Uninstantable { }; img.src = lib.assetURL + 'image/skin/' + name + '/' + num + '.jpg'; } - static touchpop(forced) { + touchpop(forced) { if (lib.config.touchscreen || forced) { _status.touchpopping = true; clearTimeout(_status.touchpoppingtimeout); @@ -539,7 +542,7 @@ export class Click extends Uninstantable { }, 600); } } - static exit() { + exit() { if (game.servermode && lib.config.reconnect_info && _status.over) { if (!_status.roomtimeout) { lib.config.reconnect_info[2] = game.roomId; @@ -566,7 +569,7 @@ export class Click extends Uninstantable { game.reload(); } } - static shortcut(show) { + shortcut(show) { if (show === false) { ui.shortcut.classList.add('hidden'); } @@ -600,7 +603,7 @@ export class Click extends Uninstantable { ui.window.classList.add('shortcutpaused'); } } - static favouriteCharacter(e) { + favouriteCharacter(e) { if (typeof this.link == 'string') { if (this.innerHTML == '添加收藏') { this.innerHTML = '移除收藏'; @@ -653,7 +656,7 @@ export class Click extends Uninstantable { } e.stopPropagation(); } - static buttonnameenter() { + buttonnameenter() { if (this.buttonscrollinterval) { clearInterval(this.buttonscrollinterval); } @@ -677,7 +680,7 @@ export class Click extends Uninstantable { }, 16); } } - static buttonnameleave() { + buttonnameleave() { if (this.buttonscrollinterval) { clearInterval(this.buttonscrollinterval); } @@ -695,7 +698,7 @@ export class Click extends Uninstantable { }, 16); } } - static dragtouchdialog(e) { + dragtouchdialog(e) { if (e.touches.length > 1 && !this.classList.contains('popped') && !this.classList.contains('fixed')) { @@ -712,7 +715,7 @@ export class Click extends Uninstantable { e.stopPropagation(); } } - static identity(e) { + identity(e) { if (_status.dragged) return; _status.clicked = true; if (!game.getIdentityList) return; @@ -835,7 +838,7 @@ export class Click extends Uninstantable { // } } } - static identity2() { + identity2() { if (_status.clickingidentity) { _status.clicked = true; var player = _status.clickingidentity[0]; @@ -849,7 +852,7 @@ export class Click extends Uninstantable { delete _status.clickingidentity; } } - static roundmenu() { + roundmenu() { game.closeConnectMenu(); switch (lib.config.round_menu_func) { case 'system': @@ -877,7 +880,7 @@ export class Click extends Uninstantable { } _status.clicked = true; } - static pausehistory() { + pausehistory() { if (!lib.config.auto_popped_history) return; if (!ui.sidebar.childNodes.length) return; var uiintro = ui.create.dialog('hidden'); @@ -885,7 +888,7 @@ export class Click extends Uninstantable { uiintro.add(ui.sidebar); return uiintro; } - static pauseconfig() { + pauseconfig() { if (!lib.config.auto_popped_config) return; if (get.is.phoneLayout()) return; var uiintro = ui.create.dialog('hidden'); @@ -919,7 +922,7 @@ export class Click extends Uninstantable { return uiintro; } - static cardPileButton() { + cardPileButton() { var uiintro = ui.create.dialog('hidden'); uiintro.listen(function (e) { e.stopPropagation(); @@ -948,7 +951,7 @@ export class Click extends Uninstantable { } return uiintro; } - static chat() { + chat() { ui.system1.classList.add('shown'); ui.system2.classList.add('shown'); @@ -1170,7 +1173,7 @@ export class Click extends Uninstantable { list3.scrollTop = list1.scrollHeight; return uiintro; } - static volumn() { + volumn() { var uiintro = ui.create.dialog('hidden'); uiintro.listen(function (e) { e.stopPropagation(); @@ -1209,7 +1212,7 @@ export class Click extends Uninstantable { uiintro.add(ui.create.div('.placeholder')); return uiintro; } - static volumn_background(e) { + volumn_background(e) { if (_status.dragged) return; var volume = this.link; if (volume === 1 && lib.config.volumn_background === 1) { @@ -1227,7 +1230,7 @@ export class Click extends Uninstantable { } e.stopPropagation(); } - static volumn_audio(e) { + volumn_audio(e) { if (_status.dragged) return; var volume = this.link; if (volume === 1 && lib.config.volumn_audio === 1) { @@ -1244,7 +1247,7 @@ export class Click extends Uninstantable { } e.stopPropagation(); } - static hoverpopped() { + hoverpopped() { if (this._uiintro) { return; } @@ -1322,10 +1325,10 @@ export class Click extends Uninstantable { uiintro.addEventListener('click', clicklayer); } } - static hoverpopped_leave() { + hoverpopped_leave() { this._poppedalready = false; } - static leavehoverpopped() { + leavehoverpopped() { if (_status.dragged) return; if (this.classList.contains('noleave')) return; this.delete(); @@ -1339,7 +1342,7 @@ export class Click extends Uninstantable { }, 500); } - static dierevive() { + dierevive() { if (game.me.isDead()) { game.me.revive(Math.max(1, game.me.maxHp)); game.me.draw(2); @@ -1351,7 +1354,7 @@ export class Click extends Uninstantable { } } } - static dieswap() { + dieswap() { if (game.me.isDead()) { _status.clicked = true; var i, translation, intro, str; @@ -1388,15 +1391,15 @@ export class Click extends Uninstantable { } } } - static dieswap2() { + dieswap2() { if (_status.dragged) return; game.swapPlayer(this.link); } - static touchconfirm() { + touchconfirm() { _status.touchconfirmed = true; document.removeEventListener('touchstart', ui.click.touchconfirm); } - static windowtouchstart(e) { + windowtouchstart(e) { if (window.inSplash) return; if (e.touches[0] && lib.config.swipe && e.touches.length < 2) { _status._swipeorigin = { @@ -1409,7 +1412,7 @@ export class Click extends Uninstantable { // _status.forcetouchinterval=setInterval(ui.click.forcetouch,30); // } } - static windowtouchmove(e) { + windowtouchmove(e) { e.preventDefault(); if (window.inSplash) return; if (_status.draggingroundmenu) { @@ -1618,7 +1621,7 @@ export class Click extends Uninstantable { _status.dragstatuschanged = null; } } - static windowtouchend(e) { + windowtouchend(e) { delete _status.force; // if(_status.forcetouchinterval){ // clearInterval(_status.forcetouchinterval); @@ -1770,7 +1773,7 @@ export class Click extends Uninstantable { _status.dragged = false; _status.clicked = false; } - static checkroundtranslate(translate) { + checkroundtranslate(translate) { var translate = translate || ui.roundmenu._dragtransform; if (translate[1] + ui.roundmenu._position[1] + 50 + ui.arena.offsetTop > ui.window.offsetHeight) { translate[1] = ui.window.offsetHeight - (ui.roundmenu._position[1] + 50) - ui.arena.offsetTop; @@ -1786,7 +1789,7 @@ export class Click extends Uninstantable { } ui.roundmenu.style.transform = 'translate(' + translate[0] + 'px,' + translate[1] + 'px)'; } - static checkdialogtranslate(translate, dialog) { + checkdialogtranslate(translate, dialog) { var translate = translate || dialog._dragtransform; if (Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]) < 10) { translate[0] = 0; @@ -1794,10 +1797,10 @@ export class Click extends Uninstantable { } dialog.style.transform = 'translate(' + translate[0] + 'px,' + translate[1] + 'px)'; } - static windowmousewheel(e) { + windowmousewheel(e) { _status.tempunpopup = e; } - static windowmousemove(e) { + windowmousemove(e) { if (window.inSplash) return; if (_status.tempunpopup) { if (get.evtDistance(_status.tempunpopup, e) > 5) { @@ -2030,7 +2033,7 @@ export class Click extends Uninstantable { } } } - static windowmousedown(e) { + windowmousedown(e) { if (window.inSplash) return; if (!ui.window) return; if (e.button == 2) return; @@ -2095,7 +2098,7 @@ export class Click extends Uninstantable { item = item.parentNode; } } - static cardtouchstart(e) { + cardtouchstart(e) { if (e.touches.length != 1) return; if (!lib.config.enable_drag) return; if (!this.parentNode) return; @@ -2111,7 +2114,7 @@ export class Click extends Uninstantable { }; } } - static cardtouchmove(e) { + cardtouchmove(e) { ui.click.longpresscancel.call(this); if (this._waitingfordrag) { var drag = this._waitingfordrag; @@ -2129,7 +2132,7 @@ export class Click extends Uninstantable { delete this._waitingfordrag; } } - static windowmouseup(e) { + windowmouseup(e) { delete _status.force; // if(_status.forcetouchinterval){ // clearInterval(_status.forcetouchinterval); @@ -2218,7 +2221,7 @@ export class Click extends Uninstantable { ui.arena.classList.remove('dragging'); } } - static mousemove() { + mousemove() { if (!lib.config.hover_handcard && this.parentNode && this.parentNode.parentNode == ui.me) { return; } @@ -2226,38 +2229,38 @@ export class Click extends Uninstantable { _status.currentmouseenter = this; } } - static mouseenter() { + mouseenter() { if (!lib.config.hover_handcard && this.parentNode && this.parentNode.parentNode == ui.me) { return; } _status.currentmouseenter = this; } - static mouseleave() { + mouseleave() { ui.click.mouseentercancel(); if (_status.currentmouseenter == this) { _status.currentmouseenter = null; } this._mouseentercreated = false; } - static mousedown() { + mousedown() { ui.click.mouseentercancel(); if (_status.currentmouseenter == this) { _status.currentmouseenter = null; } this._mouseentercreated = true; } - static mouseentercancel() { + mouseentercancel() { if (_status._mouseentertimeout) { clearTimeout(_status._mouseentertimeout); delete _status._mouseentertimeout; } } - static hoverplayer(e) { + hoverplayer(e) { var node = get.nodeintro(this, true); if (node) node.style.zIndex = 21; return node; } - static longpressdown(e) { + longpressdown(e) { if (_status.longpressed) return; if (this._longpresstimeout) { clearTimeout(this._longpresstimeout); @@ -2274,7 +2277,7 @@ export class Click extends Uninstantable { // } _status.longpressing = this; } - static longpresscallback() { + longpresscallback() { if (!_status.longpressing) return; var node = _status.longpressing; var func = node._longpresscallback; @@ -2304,7 +2307,7 @@ export class Click extends Uninstantable { ui.click.touchpop(); } } - static longpresscancel() { + longpresscancel() { if (this._longpresstimeout) { clearTimeout(this._longpresstimeout); delete this._longpresstimeout; @@ -2314,7 +2317,7 @@ export class Click extends Uninstantable { delete _status.longpressing; } } - static window() { + window() { var clicked = _status.clicked; var dialogtouched = false; if (_status.dialogtouched) { @@ -2403,7 +2406,7 @@ export class Click extends Uninstantable { _status.event.custom.add.window(clicked); } } - static toggle() { + toggle() { if (_status.dragged) return; if (this.parentNode.classList.contains('disabled')) return; _status.tempunpop = true; @@ -2418,7 +2421,7 @@ export class Click extends Uninstantable { if (this.additionalCommand) this.additionalCommand(true, this.parentNode); } } - static editor() { + editor() { if (_status.dragged) return; if (_status.editing) return; _status.clicked = true; @@ -2426,7 +2429,7 @@ export class Click extends Uninstantable { _status.editing = this; if (this.additionalCommand) this.additionalCommand(this); } - static switcher() { + switcher() { if (_status.dragged) return; if (this.parentNode.classList.contains('disabled')) return; if (_status.choosing) return; @@ -2449,7 +2452,7 @@ export class Click extends Uninstantable { }, 500); } } - static choice() { + choice() { if (_status.dragged) return; if (!_status.choosing) return; _status.choosing.link = this.link; @@ -2462,7 +2465,7 @@ export class Click extends Uninstantable { this.parentNode.parentNode.querySelector('.toggle').additionalCommand(this.link, this.parentNode.parentNode); } } - static button() { + button() { if (_status.dragged) return; if (_status.clicked) return; if (_status.tempNoButton) return; @@ -2494,7 +2497,7 @@ export class Click extends Uninstantable { } game.check(); } - static touchintro() { + touchintro() { var rect = this.getBoundingClientRect(); ui.click.touchpop(); ui.click.intro.call(this, { @@ -2503,7 +2506,7 @@ export class Click extends Uninstantable { }); _status.clicked = false; } - static card() { + card() { delete this._waitingfordrag; if (_status.dragged) return; if (_status.clicked) return; @@ -2570,7 +2573,7 @@ export class Click extends Uninstantable { }); } } - static avatar() { + avatar() { if (!lib.config.doubleclick_intro) return; if (this.parentNode.isUnseen(0)) return; if (!lib.character[this.parentNode.name]) return; @@ -2589,7 +2592,7 @@ export class Click extends Uninstantable { game.pause2(); ui.click.charactercard(player.name1 || player.name, null, null, true, this); } - static avatar2() { + avatar2() { if (!lib.config.doubleclick_intro) return; if (this.parentNode.classList.contains('unseen2')) return; if (!lib.character[this.parentNode.name2]) return; @@ -2608,7 +2611,7 @@ export class Click extends Uninstantable { game.pause2(); ui.click.charactercard(player.name2, null, null, true, this); } - static connectroom(e) { + connectroom(e) { if (_status.dragged) return; if (_status.clicked) return; if (ui.intro) return; @@ -2639,10 +2642,10 @@ export class Click extends Uninstantable { } } } - static player() { + player() { return ui.click.target.apply(this, arguments); } - static target(e) { + target(e) { if (_status.dragged) return; if (_status.clicked) return; if (ui.intro) return; @@ -2750,12 +2753,12 @@ export class Click extends Uninstantable { } game.check(); } - static control2() { + control2() { if (this.childNodes.length == 1 && !this._doubleclick) { ui.click.control.call(this.firstChild); } } - static control() { + control() { if (_status.dragged) return; if (ui.control.classList.contains('hidden')) return; var node = this.parentNode; @@ -2803,7 +2806,7 @@ export class Click extends Uninstantable { game.resume(); } } - static dialogcontrol() { + dialogcontrol() { _status.event.result = { buttons: ui.selected.buttons.slice(0), cards: ui.selected.cards.slice(0), @@ -2813,7 +2816,7 @@ export class Click extends Uninstantable { }; game.resume(); } - static skill(skill) { + skill(skill) { var info = get.info(skill); var event = _status.event; event.backup(skill); @@ -2860,7 +2863,7 @@ export class Click extends Uninstantable { } } } - static ok(node) { + ok(node) { const gameEvent = get.event(), custom = gameEvent.custom, replaceConfirm = custom.replace.confirm; if (replaceConfirm) { replaceConfirm(true); @@ -2911,7 +2914,7 @@ export class Click extends Uninstantable { if (addConfirm) addConfirm(true); game.resume(); } - static cancel(node) { + cancel(node) { var event = _status.event; if (event.custom.replace.confirm) { event.custom.replace.confirm(false); return; @@ -2952,7 +2955,7 @@ export class Click extends Uninstantable { } game.resume(); } - static logv(e) { + logv(e) { if (_status.currentlogv) { if (_status.currentlogv == this) return; if (_status.logvtimeout) { @@ -2972,7 +2975,7 @@ export class Click extends Uninstantable { ui.click.intro.call(this, e); } } - static logvleave() { + logvleave() { if (_status.currentlogv == this) { setTimeout(function () { delete _status.currentlogv; @@ -2986,7 +2989,7 @@ export class Click extends Uninstantable { delete this.logvtimeout; } } - static charactercard(name, sourcenode, noedit, resume, avatar) { + charactercard(name, sourcenode, noedit, resume, avatar) { if (_status.dragged) return; if (lib.config.theme != 'simple') { ui.window.classList.add('shortcutpaused'); @@ -3518,7 +3521,7 @@ export class Click extends Uninstantable { layer.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', clicklayer); ui.window.appendChild(layer); } - static intro(e) { + intro(e) { if (_status.dragged) return; _status.clicked = true; if (this.classList.contains('player') && !this.name) { @@ -3616,7 +3619,7 @@ export class Click extends Uninstantable { game.pause2(); return uiintro; } - static intro2() { + intro2() { if (ui.intro) { ui.intro.close(); if (ui.intro.source == this) { @@ -3627,7 +3630,7 @@ export class Click extends Uninstantable { } } } - static auto() { + auto() { if (!ui || !ui.auto || ui.auto.classList.contains('hidden') && arguments[0] !== 'forced') return; if (_status.paused2) return; ui.click.shortcut(false); @@ -3679,7 +3682,7 @@ export class Click extends Uninstantable { } } } - static wuxie() { + wuxie() { if (this.classList.contains('hidden')) return; this.classList.toggle('glow'); if (this.classList.contains('glow') && _status.event.type == 'wuxie' && @@ -3687,7 +3690,7 @@ export class Click extends Uninstantable { ui.click.cancel(ui.confirm.lastChild); } } - static tempnowuxie() { + tempnowuxie() { if (this.classList.contains('hidden')) return; this.classList.toggle('glow'); if (this.classList.contains('glow') && _status.event.type == 'wuxie' && @@ -3701,7 +3704,7 @@ export class Click extends Uninstantable { ui.click.cancel(ui.confirm.lastChild); } } - static pause() { + pause() { if (_status.paused2 || _status.pausing || _status.nopause || !ui.pause) return; if (!_status.video) { if (ui.pause.classList.contains('hidden')) return; @@ -3730,7 +3733,7 @@ export class Click extends Uninstantable { game.onpause(); } } - static resume(e) { + resume(e) { if (_status.pausing) return; if (_status.dragged) return; if (_status.clicked) return; @@ -3747,7 +3750,7 @@ export class Click extends Uninstantable { } return false; } - static config() { + config() { if (!ui.click.configMenu) return; if (_status.paused2) _status.config2 = false; else _status.config2 = true; @@ -3758,7 +3761,7 @@ export class Click extends Uninstantable { ui.system1.classList.remove('shown'); ui.system2.classList.remove('shown'); } - static swap() { + swap() { if (_status.dragged) return; if (this.classList.contains('dead')) return; if (_status.over) return; @@ -3766,7 +3769,7 @@ export class Click extends Uninstantable { if (ui.wuxie) ui.wuxie.show(); game.swapPlayer(this); } - static mousewheel(evt) { + mousewheel(evt) { if (this.firstChild && this.firstChild.classList.contains('handcards') && !this.classList.contains('scrollh')) return; var node = this; @@ -3794,16 +3797,16 @@ export class Click extends Uninstantable { }, 16); } } - static touchStart(e) { + touchStart(e) { this.startX = e.touches[0].clientX / game.documentZoom; this.startY = e.touches[0].clientY / game.documentZoom; _status.dragged = false; } - static dialogtouchStart(e) { + dialogtouchStart(e) { ui.click.touchStart.call(this, e); _status.dialogtouched = true; } - static touchScroll(e) { + touchScroll(e) { if (_status.mousedragging) return; if (_status.draggingtouchdialog) return; if (!_status.dragged) { @@ -3823,7 +3826,7 @@ export class Click extends Uninstantable { e.stopPropagation(); } } - static autoskill(bool, node) { + autoskill(bool, node) { var list = lib.config.autoskilllist; if (bool) { list.remove(node.link); @@ -3833,10 +3836,10 @@ export class Click extends Uninstantable { } game.saveConfig('autoskilllist', list); } - static skillbutton() { + skillbutton() { this.func(this.link); } - static autoskill2(e) { + autoskill2(e) { this.classList.toggle('on'); var list = []; if (lib.skill[this.link].frequent) { @@ -3859,7 +3862,7 @@ export class Click extends Uninstantable { ui.click.touchpop(); e.stopPropagation(); } - static hiddenskill(e) { + hiddenskill(e) { this.classList.toggle('on'); var hidden = lib.skill[this.link].preHidden; if (Array.isArray(hidden)) { @@ -3879,7 +3882,7 @@ export class Click extends Uninstantable { ui.click.touchpop(); e.stopPropagation(); } - static rightplayer(e) { + rightplayer(e) { if (this._nopup) return false; if (_status.clickedplayer) { return false; @@ -3896,7 +3899,7 @@ export class Click extends Uninstantable { ui.click.longpresscancel.call(this); return false; } - static right(e) { + right(e) { if (window.inSplash) return false; if (lib.config.touchscreen) return; if (_status.noright) { diff --git a/noname/ui/create/index.js b/noname/ui/create/index.js index 61d228821..e2e5249d7 100644 --- a/noname/ui/create/index.js +++ b/noname/ui/create/index.js @@ -1,5 +1,8 @@ -import { ui, game, get, lib, _status } from "../../../noname.js"; -import { Uninstantable } from "../../util/index.js"; +import { ui } from '../index.js'; +import { lib } from '../../library/index.js'; +import { game } from "../../game/index.js"; +import { get } from "../../get/index.js"; +import { _status } from "../../status/index.js"; import { menu } from "./menu/index.js"; import { cardPackMenu } from "./menu/pages/cardPackMenu.js"; import { characterPackMenu } from "./menu/pages/characterPackMenu.js"; @@ -8,15 +11,15 @@ import { optionsMenu } from "./menu/pages/optionsMenu.js"; import { otherMenu } from "./menu/pages/otherMenu.js"; import { startMenu } from "./menu/pages/startMenu.js"; -export class Create extends Uninstantable { +export class Create { /** * @type {(video: Videos, before: boolean) => void} */ - static videoNode; + videoNode; /** * 创建身份牌实例 */ - static identityCard(identity, position, noclick) { + identityCard(identity, position, noclick) { const card = ui.create.card(position, 'noclick', noclick); card.removeEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.card); card.classList.add('button'); @@ -36,7 +39,7 @@ export class Create extends Uninstantable { /** * 让卡牌旋转 */ - static cardSpinning(card) { + cardSpinning(card) { if (lib.config.cardback_style != 'default') { card.style.transitionProperty = 'none'; ui.refresh(card); @@ -71,7 +74,7 @@ export class Create extends Uninstantable { /** * 旋转的身份牌! */ - static spinningIdentityCard(identity, dialog) { + spinningIdentityCard(identity, dialog) { const card = ui.create.identityCard(identity); const buttons = ui.create.div('.buttons', dialog.content); setTimeout(() => { @@ -85,7 +88,7 @@ export class Create extends Uninstantable { * @param {HTMLDivElement} container * @param {Function} saveInput */ - static editor(container, saveInput) { + editor(container, saveInput) { const createList = []; const containerDelete = container.delete; const editorpage = ui.create.div(container); @@ -269,7 +272,7 @@ export class Create extends Uninstantable { const editor = ui.create.div(editorpage); return editor; } - static cardTempName(card, applyNode) { + cardTempName(card, applyNode) { let getApplyNode = applyNode || card; let cardName = get.name(card); let cardNature = get.nature(card); @@ -408,7 +411,7 @@ export class Create extends Uninstantable { node.tempname = tempname; return node; } - static connectRooms(list) { + connectRooms(list) { ui.rooms = []; ui.roombase = ui.create.dialog(); ui.roombase.classList.add('fullwidth'); @@ -426,7 +429,7 @@ export class Create extends Uninstantable { ui.rooms.push(player); } } - static rarity(button) { + rarity(button) { var rarity = game.getRarity(button.link); if (rarity != 'common' && lib.config.show_rarity) { var intro = button.node.intro; @@ -451,7 +454,7 @@ export class Create extends Uninstantable { else button.node.group.style.backgroundColor=get.translation('weiColor'); }*/ } - static div() { + div() { var str, innerHTML, position, position2, style, divposition, listen; for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == 'string') { @@ -501,7 +504,7 @@ export class Create extends Uninstantable { if (listen) node.listen(listen); return node; } - static filediv() { + filediv() { var args = Array.from(arguments); var func = null; for (var i = 0; i < args.length; i++) { @@ -521,7 +524,7 @@ export class Create extends Uninstantable { div.inputNode = input; return div; } - static node() { + node() { var tagName, str, innerHTML, position, position2, style, divposition, listen; for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == 'string') { @@ -586,7 +589,7 @@ export class Create extends Uninstantable { if (listen) node.onclick = listen; return node; } - static iframe(src) { + iframe(src) { var layer = document.createElement('div'); layer.classList.add('poplayer'); layer.style.zIndex = '100'; @@ -618,7 +621,7 @@ export class Create extends Uninstantable { ui.window.appendChild(layer); } - static identitycircle(list, target) { + identitycircle(list, target) { var container = ui.create.div('.identitycircle.menubg', target); var circle = ui.create.div(container); container.dataset.num = list.length; @@ -639,17 +642,17 @@ export class Create extends Uninstantable { sec2.style.transform = 'rotate(' + (deg1 + deg2) + 'deg)'; } } - static chat() { + chat() { var chat = ui.create.system('聊天', null, true); ui.chatButton = chat; lib.setPopped(chat, ui.click.chat, 220); } - static exit() { + exit() { if (!ui.exit) { ui.exit = ui.create.control('退出房间', ui.click.exit); } } - static connecting(bool) { + connecting(bool) { if (bool) { ui.window.classList.remove('connecting'); if (ui.connecting) { @@ -674,7 +677,7 @@ export class Create extends Uninstantable { // },1000); } } - static roomInfo() { + roomInfo() { var chat = ui.create.system(game.online ? '房间信息' : '房间设置', function () { if (!game.online || game.onlinezhu) { ui.click.connectMenu(); @@ -689,7 +692,7 @@ export class Create extends Uninstantable { } }, 180); } - static templayer(time) { + templayer(time) { if (typeof time != 'number' || isNaN(time) || time == Infinity) { time = 500; } @@ -698,7 +701,7 @@ export class Create extends Uninstantable { templayer.remove(); }, time); } - static selectlist(list, init, position, onchange) { + selectlist(list, init, position, onchange) { var select = document.createElement('select'); for (var i = 0; i < list.length; i++) { var option = document.createElement('option'); @@ -724,20 +727,20 @@ export class Create extends Uninstantable { return select; } /** 创建菜单 */ - static menu = menu; + menu = menu; /** 创建“开始”菜单 */ - static startMenu = startMenu; + startMenu = startMenu; /** 创建“选项”菜单 */ - static optionsMenu = optionsMenu; + optionsMenu = optionsMenu; /** 创建“武将”菜单 */ - static characterPackMenu = characterPackMenu; + characterPackMenu = characterPackMenu; /** 创建“卡牌”菜单 */ - static cardPackMenu = cardPackMenu; + cardPackMenu = cardPackMenu; /** 创建“扩展”菜单 */ - static extensionMenu = extensionMenu; + extensionMenu = extensionMenu; /** 创建“其他”菜单 */ - static otherMenu = otherMenu; - static statictable() { + otherMenu = otherMenu; + statictable() { var str, row, col, position, position2, fixed, style, divposition; for (var i = 0; i < arguments.length; i++) { if (typeof arguments[i] == 'string') str = arguments[i]; @@ -792,7 +795,7 @@ export class Create extends Uninstantable { } return node; } - static giveup() { + giveup() { if (ui.giveup) return; if (!lib.config.show_giveup) return; ui.giveup = ui.create.system('投降', function () { @@ -814,7 +817,7 @@ export class Create extends Uninstantable { } }, true, true); } - static groupControl(dialog) { + groupControl(dialog) { return ui.create.control('wei', 'shu', 'wu', 'qun', 'jin', 'western', 'key', function (link, node) { if (link == '全部') { dialog.currentcapt = ''; @@ -857,14 +860,14 @@ export class Create extends Uninstantable { } }); } - static cardDialog() { + cardDialog() { var args = ['thisiscard']; for (var i = 0; i < arguments.length; i++) { args.push(arguments[i]); } return ui.create.characterDialog.apply(this, args); } - static characterDialog2(filter) { + characterDialog2(filter) { var list = []; for (var i in lib.character) { if (lib.character[i][4].includes('minskin')) continue; @@ -953,7 +956,7 @@ export class Create extends Uninstantable { var node = ui.create.div('.dialogbutton.menubutton.large', '筛选', packnode); return dialog; } - static characterDialog() { + characterDialog() { // if(lib.config.character_dialog_style=='newstyle'){ // for(var i=0;i ui.arena.appendChild(player)); return players; } - static me(hasme) { + me(hasme) { ui.mebg = ui.create.div('#mebg', ui.arena); ui.me = ui.create.div('#me', ui.arena).addTempClass('start'); ui.handcards1Container = ui.create.div('#handcards1', ui.me); @@ -3034,8 +3037,8 @@ export class Create extends Uninstantable { // ui.updatehl(); } } - static card(position, info, noclick) { return new lib.element.Card(position).build(info, noclick); } - static cardsAsync() { + card(position, info, noclick) { return new lib.element.Card(position).build(info, noclick); } + cardsAsync() { if (lib.onfree) { _status.waitingForCards = Array.from(arguments); lib.onfree.push(function () { @@ -3049,7 +3052,7 @@ export class Create extends Uninstantable { ui.create.cards.apply(ui.create, arguments); } } - static cards(ordered) { + cards(ordered) { if (_status.brawl) { if (_status.brawl.cardPile) { lib.card.list = _status.brawl.cardPile(lib.card.list); diff --git a/noname/ui/index.js b/noname/ui/index.js index 345da2432..265185b9c 100644 --- a/noname/ui/index.js +++ b/noname/ui/index.js @@ -1,25 +1,22 @@ -import { Uninstantable, nonameInitialized } from "../util/index.js"; -import { Library as lib } from '../library/index.js'; -import { Game as game } from "../game/index.js"; -import { Get as get } from "../get/index.js"; +import { lib } from '../library/index.js'; +import { game } from "../game/index.js"; +import { get } from "../get/index.js"; import { _status } from "../status/index.js"; -import { GNC as gnc } from '../gnc/index.js'; -import { AI as ai } from "../ai/index.js"; import { Click } from "./click/index.js"; import { Create } from "./create/index.js"; -export class UI extends Uninstantable { - static updates = []; - static thrown = []; - static touchlines = []; - static todiscard = {}; +export class UI { + updates = []; + thrown = []; + touchlines = []; + todiscard = {}; /** * @type { HTMLStyleElement[] } */ - static playerPositions = []; - static create = Create; - static click = Click; - static selected = { + playerPositions = []; + create = new Create(); + click = new Click(); + selected = { /** * @type { Button[] } */ @@ -36,113 +33,113 @@ export class UI extends Uninstantable { /** * @type { Dialog[] } */ - static dialogs; + dialogs; /** * @type { Dialog } */ - static dialog; + dialog; /** * @type { HTMLDivElement } */ - static arena; + arena; /** * @type { Control[] } */ - static controls; + controls; /** * @type { Control } */ - static control; + control; /** * @type { Control | undefined } */ - static confirm; + confirm; /** * @type { Control | undefined } */ - static skills; + skills; /** * @type { Control | undefined } */ - static skills1; + skills1; /** * @type { Control | undefined } */ - static skills2; + skills2; /** * @type { Control | undefined } */ - static skills3; + skills3; /** * @type { HTMLDivElement } */ - static window; + window; /** * @type { HTMLDivElement } */ - static pause; + pause; /** * @type { HTMLAudioElement } */ - static backgroundMusic; + backgroundMusic; /** * @type { HTMLDivElement } */ - static special; + special; /** * @type { HTMLDivElement } */ - static fakeme; + fakeme; /** * @type { HTMLDivElement } */ - static chess; + chess; /** * 手动在菜单栏中添加一个武将包的ui * @type { ((packName: string) => void)[] } */ - static updateCharacterPackMenu = []; + updateCharacterPackMenu = []; /** * 手动在菜单栏中添加一个卡牌包的ui * @type { ((packName: string) => void)[] } */ - static updateCardPackMenu = []; + updateCardPackMenu = []; /** * @type { HTMLDivElement } 挑战模式下正在操作的角色 */ - static mebg; + mebg; /** * @type { Function | undefined } */ - static updateUpdate; + updateUpdate; /** * @type {HTMLDivElement} */ - static commandnode; + commandnode; /** * @type {() => void} */ - static updateVideoMenu; + updateVideoMenu; /** * @type {HTMLDivElement} */ - static menuContainer; + menuContainer; /** * @type {HTMLDivElement} */ - static auto; + auto; /** * @type {HTMLDivElement} */ - static wuxie; + wuxie; /** * @type {HTMLDivElement} */ - static tempnowuxie; - static refresh(node) { + tempnowuxie; + refresh(node) { void window.getComputedStyle(node, null).getPropertyValue("opacity"); } - static clear() { + clear() { game.addVideo('uiClear'); var thrown = document.getElementsByClassName('thrown'); var nodes = []; @@ -154,7 +151,7 @@ export class UI extends Uninstantable { if (!nodes[i].fixed) nodes[i].delete(); } } - static updatec() { + updatec() { if (_status.noupdatec) return; var length = 0, minoffset = -Infinity; var controls = []; @@ -281,7 +278,7 @@ export class UI extends Uninstantable { } } } - static updatex() { + updatex() { ui.update.apply(this, arguments); ui.updatehl(); for (var i = 0; i < lib.onresize.length; i++) { @@ -293,13 +290,13 @@ export class UI extends Uninstantable { ui.updatez(); delete ui._updatexr; } - static updatexr() { + updatexr() { if (ui._updatexr) { clearTimeout(ui._updatexr); } ui._updatexr = setTimeout(ui.updatex, 500); } - static updatejm(player, nodes, start, inv) { + updatejm(player, nodes, start, inv) { if (typeof start != 'number') { start = 0; } @@ -330,7 +327,7 @@ export class UI extends Uninstantable { } } } - static updatem(player) { + updatem(player) { if (player) { var start = 0; if (!player.classList.contains('linked2') || !ui.arena.classList.contains('nolink')) { @@ -344,7 +341,7 @@ export class UI extends Uninstantable { } } } - static updatej(player) { + updatej(player) { if (player) { ui.updatejm(player, player.node.judges); } @@ -354,7 +351,7 @@ export class UI extends Uninstantable { } } } - static updatehl() { + updatehl() { if (!game.me) return; if (!ui.handcards1Container || !ui.handcards2Container) return; if (!ui.handcards1Container.childNodes.length) return; @@ -457,7 +454,7 @@ export class UI extends Uninstantable { } ui.handcards2Container.firstChild.style.width = (offset2 * (hs2.length - 1) + 118) + 'px'; } - static updateh(compute) { + updateh(compute) { if (!game.me) return; if (!ui.handcards1Container) return; if (lib.config.low_performance) { @@ -474,7 +471,7 @@ export class UI extends Uninstantable { ui.updatehx(game.me.node.handcards1); ui.updatehx(game.me.node.handcards2); } - static updatehx(node) { + updatehx(node) { var width = node.parentNode._handcardsWidth; var num = node.childElementCount - node.getElementsByClassName('removing').length; node.classList.remove('fold0'); @@ -498,7 +495,7 @@ export class UI extends Uninstantable { node.classList.add('fold0'); } } - static updated() { + updated() { if (document.documentElement.offsetWidth < 900 || document.documentElement.offsetHeight < 500) { game.deviceZoom = Math.min( Math.round(document.documentElement.offsetWidth / 98) / 10, @@ -509,7 +506,7 @@ export class UI extends Uninstantable { game.deviceZoom = 1; } } - static updatez() { + updatez() { var width = document.documentElement.offsetWidth; var height = document.documentElement.offsetHeight; var zoom = game.documentZoom; @@ -524,7 +521,7 @@ export class UI extends Uninstantable { document.body.style.transform = ''; } } - static update() { + update() { for (var i = 0; i < ui.updates.length; i++) { ui.updates[i](); } @@ -605,7 +602,7 @@ export class UI extends Uninstantable { } } } - static recycle(node, key) { + recycle(node, key) { if (!ui._recycle) ui._recycle = {}; if (typeof node == 'string') { return ui._recycle[node]; @@ -617,7 +614,7 @@ export class UI extends Uninstantable { * @author Tipx-L * @param {number} [numberOfPlayers] */ - static updateConnectPlayerPositions(numberOfPlayers) { + updateConnectPlayerPositions(numberOfPlayers) { if (typeof numberOfPlayers != 'number') { const configOL = lib.configOL; numberOfPlayers = parseInt(configOL.player_number) || configOL.number; @@ -667,7 +664,7 @@ export class UI extends Uninstantable { * @author Tipx-L * @param {number} [numberOfPlayers] */ - static updatePlayerPositions(numberOfPlayers) { + updatePlayerPositions(numberOfPlayers) { if (typeof numberOfPlayers != 'number') numberOfPlayers = ui.arena.dataset.number; //当人数不超过8人时,还是用以前的布局 if (!numberOfPlayers || numberOfPlayers <= 8) return; @@ -701,9 +698,19 @@ export class UI extends Uninstantable { playerPositions.push(selector); } } - static updateRoundNumber(roundNumber, cardPileNumber) { + updateRoundNumber(roundNumber, cardPileNumber) { if (ui.cardPileNumber) ui.cardPileNumber.innerHTML = `${roundNumber}轮 剩余牌: ${cardPileNumber}`; } } -export const ui = UI; +export let ui = new UI(); + +/** + * @param { InstanceType } [instance] + */ +export let setUI = (instance) => { + ui = instance || new UI(); + if (lib.config.dev) { + window.ui = ui; + } +}; \ No newline at end of file diff --git a/noname/util/config.js b/noname/util/config.js index 84e2ba7c1..2274c212f 100644 --- a/noname/util/config.js +++ b/noname/util/config.js @@ -1,4 +1,4 @@ -import { Library as lib } from "../library/index.js"; +import { lib } from "../library/index.js"; /** * @param {string} name diff --git a/tsconfig.json b/tsconfig.json index 649199216..297fdb201 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -77,7 +77,7 @@ "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ /* Type Checking */ "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ + "noImplicitAny": false, /* Enable error reporting for expressions and declarations with an implied `any` type.. */ // "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */ // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */