使Game等变量可以继承和实例化,废除import {Game as game}等写法

This commit is contained in:
nonameShijian 2024-04-11 21:13:50 +08:00
parent 49148da1dc
commit 97babf8f20
76 changed files with 2793 additions and 2615 deletions

View File

@ -1,2 +1,5 @@
import codemirror from 'codemirror/index'; export default CodeMirror;
export = codemirror; /**
* @type { typeof import('codemirror/index') }
*/
declare var CodeMirror: typeof import('codemirror/index');

View File

@ -1,2 +0,0 @@
import * as jszip from 'jszip'
export = jszip;

View File

@ -1,8 +1,8 @@
export { GNC as gnc } from "./noname/gnc/index.js"; export { GNC, gnc, setGNC } from './noname/gnc/index.js';
export { AI as ai } from "./noname/ai/index.js"; export { AI, ai, setAI } from './noname/ai/index.js';
export { Game as game } from "./noname/game/index.js"; export { Game, game, setGame } from './noname/game/index.js';
export { Get as get } from "./noname/get/index.js"; export { Get, get, setGet } from './noname/get/index.js';
export { Library as lib } from "./noname/library/index.js"; export { Library, lib, setLibrary } from './noname/library/index.js';
export { status as _status } from "./noname/status/index.js"; export { status, _status, setStatus } from './noname/status/index.js';
export { UI as ui } from "./noname/ui/index.js"; export { UI, ui, setUI } from './noname/ui/index.js';
export { boot } from "./noname/init/index.js"; export { boot } from './noname/init/index.js';

View File

@ -1,11 +1,11 @@
export class Basic extends Uninstantable { export class Basic {
/** /**
* @param { ( * @param { (
* button: Button, * button: Button,
* buttons?: Button[] * buttons?: Button[]
* ) => number } check * ) => number } check
*/ */
static chooseButton(check: (button: Button, buttons?: Button[]) => number): boolean; chooseButton(check: (button: any, buttons?: Button[]) => number): boolean | undefined;
/** /**
* @param { ( * @param { (
* card?: Card, * card?: Card,
@ -13,13 +13,12 @@ export class Basic extends Uninstantable {
* ) => number } check * ) => number } check
* @returns { boolean | undefined } * @returns { boolean | undefined }
*/ */
static chooseCard(check: (card?: Card, cards?: Card[]) => number): boolean | undefined; chooseCard(check: (card?: any, cards?: Card[]) => number): boolean | undefined;
/** /**
* @param { ( * @param { (
* target?: Player, * target?: Player,
* targets?: Player[] * targets?: Player[]
* ) => number } check * ) => 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";

View File

@ -1,9 +1,8 @@
export class AI extends Uninstantable { export class AI {
static basic: typeof Basic; basic: Basic;
static get: typeof get; get: import("../get/index.js").Get;
} }
export const ai: typeof AI; export let ai: AI;
export function setAI(instance?: AI | undefined): void;
export { Basic }; export { Basic };
import { Uninstantable } from "../util/index.js";
import { Basic } from './basic.js'; import { Basic } from './basic.js';
import { Get as get } from '../get/index.js';

View File

@ -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;
}

View File

@ -37,7 +37,7 @@ export class DynamicStyle {
*/ */
get(name: string): { get(name: string): {
[x: string]: string | number; [x: string]: string | number;
}; } | null;
/** /**
* Callback of `DynamicStyle#find`, getting the rule wanted. * Callback of `DynamicStyle#find`, getting the rule wanted.
* `DynamicStyle#find` * `DynamicStyle#find`

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,18 @@
export class GamePromises extends Uninstantable { export class GamePromises {
/** /**
* 仿h5的prompt * @overload
* * @param { string } title
* : 由于参数列表是随意的 * @returns { Promise<string | false> }
*
* @type {{
* (title: string): Promise<string | false>;
* (title: string, forced: true): Promise<string>;
* (alertOption: 'alert', title: string): Promise<true>;
* }}
*
* @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<string> }
*/ */
static prompt(alertOption: string, title?: string, forced?: boolean): Promise<string>; prompt(title: string): Promise<string | false>;
/**
* @overload
* @param { string } title
* @param { boolean } [forced]
* @returns { Promise<string> }
*
*/
prompt(title: string, forced?: boolean | undefined): Promise<string>;
/** /**
* 仿h5的alert * 仿h5的alert
* *
@ -33,14 +23,13 @@ export class GamePromises extends Uninstantable {
* ``` * ```
* @returns { Promise<true> } * @returns { Promise<true> }
*/ */
static alert(title: string): Promise<true>; alert(title: string): Promise<true>;
static download(url: any, folder: any, dev: any, onprogress: any): Promise<any>; download(url: any, folder: any, dev: any, onprogress: any): Promise<any>;
static readFile(filename: any): Promise<any>; readFile(filename: any): Promise<any>;
static readFileAsText(filename: any): Promise<any>; readFileAsText(filename: any): Promise<any>;
static writeFile(data: any, path: any, name: any): Promise<any>; writeFile(data: any, path: any, name: any): Promise<any>;
static ensureDirectory(list: any, callback: any, file: any): Promise<any>; ensureDirectory(list: any, callback: any, file: any): Promise<any>;
static createDir(directory: any): Promise<any>; createDir(directory: any): Promise<any>;
static removeFile(filename: any): Promise<void>; removeFile(filename: any): Promise<void>;
static removeDir(directory: any): Promise<void>; removeDir(directory: any): Promise<void>;
} }
import { Uninstantable } from "../util/index.js";

View File

@ -1,5 +1,6 @@
export class Get extends Uninstantable { export class Get {
static is: typeof Is; is: Is;
promises: Promises;
/** /**
* *
* *
@ -9,59 +10,59 @@ export class Get extends Uninstantable {
* *
* @returns {["firefox" | "chrome" | "safari" | "other", number, number, number]} * @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[] * VCard[]
* @param {Function} filter * @param {Function} filter
* @returns {string[][]} * @returns {string[][]}
*/ */
static inpileVCardList(filter: Function): string[][]; inpileVCardList(filter: Function): string[][];
/** /**
* (Player的)n1n号位 * (Player的)n1n号位
* @param {number | Player} seat * @param {number | Player} seat
*/ */
static seatTranslation(seat: number | Player): string; seatTranslation(seat: number | Player): string;
/** /**
* @param {number} numberOfPlayers * @param {number} numberOfPlayers
* @returns {string[]} * @returns {string[]}
*/ */
static identityList(numberOfPlayers: number): string[]; identityList(numberOfPlayers: number): string[];
/** /**
* Generate an object URL from the Base64-encoded octet stream * Generate an object URL from the Base64-encoded octet stream
* *
* Base64编码的八位字节流生成对象URL * Base64编码的八位字节流生成对象URL
*/ */
static objectURL(octetStream: any): any; objectURL(octetStream: any): any;
/** /**
* Get the card name length * 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) * Get the Yingbian conditions (of the card)
* *
* *
*/ */
static yingbianConditions(card: any): string[]; yingbianConditions(card: any): string[];
static complexYingbianConditions(card: any): string[]; complexYingbianConditions(card: any): string[];
static simpleYingbianConditions(card: any): string[]; simpleYingbianConditions(card: any): string[];
/** /**
* Get the Yingbian effects (of the card) * Get the Yingbian effects (of the card)
* *
* *
*/ */
static yingbianEffects(card: any): string[]; yingbianEffects(card: any): string[];
/** /**
* Get the default Yingbian effect of the card * 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] * @param { false | Player } [player]
* @returns { string[] } * @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[] } * @returns { string[] }
*/ */
static pinyin(chinese: any, withTone: any): string[]; pinyin(chinese: any, withTone: any): string[];
static yunmu(str: any): any; yunmu(str: any): any;
/** /**
* key * key
*/ */
static paramToCacheKey(...args: any[]): string; paramToCacheKey(...args: any[]): string;
static yunjiao(str: any): string; yunjiao(str: any): string | null;
/** /**
* @param { string } skill * @param { string } skill
* @param { Player } player * @param { Player } player
* @returns { string[] } * @returns { string[] }
*/ */
static skillCategoriesOf(skill: string, player: Player): string[]; skillCategoriesOf(skill: string, player: any): string[];
static numOf(obj: any, item: any): any; numOf(obj: any, item: any): any;
static connectNickname(): any; connectNickname(): any;
static zhinangs(filter: any): any; zhinangs(filter: any): any;
static sourceCharacter(str: any): any; sourceCharacter(str: any): any;
static isLuckyStar(player: any): boolean; isLuckyStar(player: any): any;
static infoHp(hp: any): number; infoHp(hp: any): number;
static infoMaxHp(hp: any): number; infoMaxHp(hp: any): number;
static infoHujia(hp: any): number; infoHujia(hp: any): number;
static bottomCards(num: any, putBack: any): any; bottomCards(num: any, putBack: any): any;
static discarded(): any; discarded(): any;
static cardOffset(): number; cardOffset(): number;
static colorspan(str: any): any; colorspan(str: any): any;
static evtprompt(next: any, str: any): void; evtprompt(next: any, str: any): void;
static autoViewAs(card: any, cards: any): import("../library/element/vcard.js").VCard; autoViewAs(card: any, cards: any): import("../library/element/vcard.js").VCard;
/** /**
* @deprecated * @deprecated
*/ */
static _autoViewAs(card: any, cards: any): any; _autoViewAs(card: any, cards: any): any;
static max(list: any, func: any, type: any): any; max(list: any, func: any, type: any): any;
static min(list: any, func: any, type: any): any; min(list: any, func: any, type: any): any;
/** /**
* @overload * @overload
* @param { string } name * @param { string } name
* @returns { Character } * @returns { Character }
*/ */
static character(name: string): Character; character(name: string): Character;
/** /**
* @template { 0 | 1 | 2 | 3 | 4 } T * @template { 0 | 1 | 2 | 3 | 4 } T
* @overload * @overload
@ -123,24 +124,30 @@ export class Get extends Uninstantable {
* @param { T } num * @param { T } num
* @returns { Character[T] } * @returns { Character[T] }
*/ */
static character<T extends 0 | 1 | 2 | 3 | 4>(name: string, num: T): Character[T]; character<T extends 0 | 1 | 2 | 3 | 4>(name: string, num: T): Character[T];
static characterInitFilter(name: any): string[]; characterInitFilter(name: any): string[];
static characterIntro(name: any): any; characterIntro(name: any): any;
static bordergroup(info: any, raw: any): any; bordergroup(info: any, raw: any): any;
static groupnature(group: any, method: any): any; groupnature(group: any, method: any): any;
static sgn(num: any): 0 | 1 | -1; sgn(num: any): 0 | 1 | -1;
static rand(num: any, num2: any): any; rand(num: any, num2: any): any;
static sort(arr: any, method: any, arg: any): any; sort(arr: any, method: any, arg: any): any;
static sortSeat(arr: any, target: any): any; sortSeat(arr: any, target: any): any;
static zip(callback: any): void; /**
static delayx(num: any, max: any): number; * @param { (zip: JSZip) => any } callback
static prompt(skill: any, target: any, player: any): string; */
static prompt2(skill: any, target: any, player: any, ...args: any[]): any; zip(callback: (zip: JSZip) => any): void;
static url(master: any): string; delayx(num: any, max: any): number;
static round(num: any, f: any): number; prompt(skill: any, target: any, player: any): string;
static playerNumber(): number; prompt2(skill: any, target: any, player: any, ...args: any[]): string;
static benchmark(func1: any, func2: any, iteration: any, arg: any): number; url(master: any): string;
static stringify(obj: any, level: any): any; 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<object, unknown>} [map] - * @param {WeakMap<object, unknown>} [map] -
* @returns {T} - * @returns {T} -
*/ */
static copy<T_1>(obj: T_1, copyKeyDeep?: boolean, map?: WeakMap<object, unknown>): T_1; copy<T_1>(obj: T_1, copyKeyDeep?: boolean | undefined, map?: WeakMap<any, unknown> | undefined): T_1;
static inpilefull(type: any): { inpilefull(type: any): {
name: any; name: any;
suit: any; suit: any;
number: any; number: any;
nature: any; nature: any;
}[]; }[];
static inpile(type: any, filter: any): any[]; inpile(type: any, filter: any): any[];
static inpile2(type: any): any[]; inpile2(type: any): any[];
static typeCard(type: any, filter: any): string[]; typeCard(type: any, filter: any): string[];
static libCard(filter: any): string[]; libCard(filter: any): string[];
static ip(): string; ip(): any;
static modetrans(config: any, server: any): string; modetrans(config: any, server: any): string;
static charactersOL(func: any): number[]; charactersOL(func: any): number[];
static trimip(str: any): any; trimip(str: any): any;
static mode(): any; mode(): any;
static idDialog(id: any): import("../library/element/dialog.js").Dialog; idDialog(id: any): any;
static arenaState(): { arenaState(): {
number: string; number: string | undefined;
players: {}; players: {};
mode: any; mode: any;
dying: any[]; dying: any[];
@ -181,312 +188,313 @@ export class Get extends Uninstantable {
inpile_nature: any[]; inpile_nature: any[];
renku: any[]; renku: any[];
}; };
static skillState(player: any): { skillState(player: any): {
global: string[]; global: string[];
}; };
static id(): string; id(): string;
static zhu(player: any, skill: any, group: any): any; zhu(player: any, skill: any, group: any): any;
static config(item: any, mode: any): any; config(item: any, mode: any): any;
static coinCoeff(list: any): number; coinCoeff(list: any): number;
static rank(name: any, num: any): number | "x" | "s" | "b" | "c" | "d" | "a" | "ap" | "am" | "bp" | "bm" | "sp"; rank(name: any, num: any): number | "x" | "s" | "c" | "d" | "b" | "a" | "ap" | "am" | "bp" | "bm" | "sp";
static skillRank(skill: any, type: any, grouped: any): number; skillRank(skill: any, type: any, grouped: any): number;
static targetsInfo(targets: any): any[]; targetsInfo(targets: any): any[];
static infoTargets(infos: any): import("../library/element/player.js").Player[]; infoTargets(infos: any): any[];
static cardInfo(card: any): any[]; cardInfo(card: any): any[];
static cardsInfo(cards?: any[]): any[][]; cardsInfo(cards?: any[]): any[][];
static infoCard(info: any): import("../library/element/card.js").Card; infoCard(info: any): import("../library/element/card.js").Card;
static infoCards(infos: any): import("../library/element/card.js").Card[]; infoCards(infos: any): import("../library/element/card.js").Card[];
static cardInfoOL(card: any): string; cardInfoOL(card: any): string;
static infoCardOL(info: any): any; infoCardOL(info: any): any;
static cardsInfoOL(cards: any): string[]; cardsInfoOL(cards: any): string[];
static infoCardsOL(infos: any): any[]; infoCardsOL(infos: any): any[];
static playerInfoOL(player: any): string; playerInfoOL(player: any): string;
static infoPlayerOL(info: any): any; infoPlayerOL(info: any): any;
static playersInfoOL(players: any): string[]; playersInfoOL(players: any): string[];
static infoPlayersOL(infos: any): any[]; infoPlayersOL(infos: any): any[];
static funcInfoOL(func: any): any; funcInfoOL(func: any): any;
static infoFuncOL(info: any): any; infoFuncOL(info: any): any;
static eventInfoOL(item: any, level: any, noMore: any): string; eventInfoOL(item: any, level: any, noMore: any): string;
/** /**
* @param {string} item * @param {string} item
*/ */
static infoEventOL(item: string): string | import("../library/element/gameEvent.js").GameEvent; infoEventOL(item: string): import("../library/element/gameEvent.js").GameEvent;
static stringifiedResult(item: any, level: any, nomore: any): any; stringifiedResult(item: any, level: any, nomore: any): any;
static parsedResult(item: any): any; parsedResult(item: any): any;
static verticalStr(str: any, sp: any): string; verticalStr(str: any, sp: any): string;
static numStr(num: any, method: any): any; numStr(num: any, method: any): any;
static rawName(str: any): any; rawName(str: any): any;
/** /**
* _ab * _ab
*/ */
static rawName2(str: any): any; rawName2(str: any): any;
static slimNameHorizontal(str: any): any; slimNameHorizontal(str: any): any;
/** /**
* @param {string} prefix * @param {string} prefix
* @param {string} name * @param {string} name
* @returns {string} * @returns {string}
*/ */
static prefixSpan(prefix: string, name: string): string; prefixSpan(prefix: string, name: string): string;
static slimName(str: any): string; slimName(str: any): string;
static time(): number; time(): number;
static utc(): number; utc(): number;
static evtDistance(e1: any, e2: any): number; evtDistance(e1: any, e2: any): number;
static xyDistance(from: any, to: any): number; xyDistance(from: any, to: any): number;
/** /**
* @overload * @overload
* @returns { void } * @returns { void }
*/ */
static itemtype(): void; itemtype(): void;
/** /**
* @overload * @overload
* @param { string } obj * @param { string } obj
* @returns { 'position' | 'natures' | 'nature' } * @returns { 'position' | 'natures' | 'nature' }
*/ */
static itemtype(obj: string): 'position' | 'natures' | 'nature'; itemtype(obj: string): 'position' | 'natures' | 'nature';
/** /**
* @overload * @overload
* @param { Player[] } obj * @param { Player[] } obj
* @returns { 'players' } * @returns { 'players' }
*/ */
static itemtype(obj: Player[]): 'players'; itemtype(obj: Player[]): 'players';
/** /**
* @overload * @overload
* @param { Card[] } obj * @param { Card[] } obj
* @returns { 'cards' } * @returns { 'cards' }
*/ */
static itemtype(obj: Card[]): 'cards'; itemtype(obj: Card[]): 'cards';
/** /**
* @overload * @overload
* @param { [number, number] } obj * @param { [number, number] } obj
* @returns { 'select' } * @returns { 'select' }
*/ */
static itemtype(obj: [number, number]): 'select'; itemtype(obj: [number, number]): 'select';
/** /**
* @overload * @overload
* @param { [number, number, number, number] } obj * @param { [number, number, number, number] } obj
* @returns { 'divposition' } * @returns { 'divposition' }
*/ */
static itemtype(obj: [number, number, number, number]): 'divposition'; itemtype(obj: [number, number, number, number]): 'divposition';
/** /**
* @overload * @overload
* @param { Button } obj * @param { Button } obj
* @returns { 'button' } * @returns { 'button' }
*/ */
static itemtype(obj: Button): 'button'; itemtype(obj: any): 'button';
/** /**
* @overload * @overload
* @param { Card } obj * @param { Card } obj
* @returns { 'card' } * @returns { 'card' }
*/ */
static itemtype(obj: Card): 'card'; itemtype(obj: any): 'card';
/** /**
* @overload * @overload
* @param { Player } obj * @param { Player } obj
* @returns { 'player' } * @returns { 'player' }
*/ */
static itemtype(obj: Player): 'player'; itemtype(obj: any): 'player';
/** /**
* @overload * @overload
* @param { Dialog } obj * @param { Dialog } obj
* @returns { 'dialog' } * @returns { 'dialog' }
*/ */
static itemtype(obj: Dialog): 'dialog'; itemtype(obj: any): 'dialog';
/** /**
* @overload * @overload
* @param { GameEvent | GameEventPromise } obj * @param { GameEvent | GameEventPromise } obj
* @returns { 'event' } * @returns { 'event' }
*/ */
static itemtype(obj: GameEvent | GameEventPromise): 'event'; itemtype(obj: GameEvent | GameEventPromise): 'event';
static equipNum(card: any): number; equipNum(card: any): number;
static objtype(obj: any): "object" | "div" | "array" | "table" | "tr" | "td" | "fragment"; objtype(obj: any): "div" | "object" | "array" | "table" | "tr" | "td" | "fragment" | undefined;
static type(obj: any, method: any, player: any): any; type(obj: any, method: any, player: any): any;
static type2(card: any, player: any): any; type2(card: any, player: any): any;
/** /**
* *
* @param { string | Card | VCard | CardBaseUIData } obj * @param { string | Card | VCard | CardBaseUIData } obj
* @param { false | Player } [player] * @param { false | Player } [player]
* @returns { string } * @returns { string }
*/ */
static subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string; subtype(obj: string | Card | VCard | CardBaseUIData, player?: false | Player): string;
static equiptype(card: any, player: any): number; equiptype(card: any, player: any): number;
/** /**
* *
* @param { Card | VCard | CardBaseUIData } card * @param { Card | VCard | CardBaseUIData } card
* @param { false | Player } [player] * @param { false | Player } [player]
* @returns { string } * @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 {Card | VCard | Card[] | VCard[]} card
* @param {false | Player} [player] * @param {false | Player} [player]
* @returns {string} * @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 {Card | VCard | Card[] | VCard[]} card
* @param {false | Player} [player] * @param {false | Player} [player]
* @returns {string} * @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 {Card | VCard} card
* @param {false | Player} [player] * @param {false | Player} [player]
* @returns {number} * @returns {number}
*/ */
static number(card: Card | VCard, player?: false | Player): number; number(card: Card | VCard, player?: false | Player): number;
/** /**
* `lib.natureSeparator``fire|thunder` * `lib.natureSeparator``fire|thunder`
* @param {string | string[] | Card | VCard} card * @param {string | string[] | Card | VCard} card
* @param {false | Player} [player] * @param {false | Player} [player]
* @returns {string} * @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 {string[] | string} card
* @param {false | Player} [player] * @param {false | Player} [player]
* @returns {string[]} * @returns {string[]}
*/ */
static natureList(card: string[] | string, player?: false | Player): string[]; natureList(card: string[] | string, player?: false | Player): string[];
static cards(num: any, putBack: any): any; cards(num: any, putBack: any): any;
static judge(card: any): any; judge(card: any): any;
static judge2(card: any): any; judge2(card: any): any;
static distance(from: any, to: any, method: any): number; distance(from: any, to: any, method: any): number;
/** /**
* @overload * @overload
* @param { string } item * @param { string } item
* @returns { Skill } * @returns { Skill }
*/ */
static info(item: string): Skill; info(item: string): Skill;
/** /**
* @overload * @overload
* @param { Card | VCard | CardBaseUIData } item * @param { Card | VCard | CardBaseUIData } item
* @param { Player | false } [player] * @param { Player | false } [player]
* @returns { any } * @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] * @param { number | Select | (()=>Select) } [select]
* @returns { Select } * @returns { Select }
*/ */
static select(select?: number | Select | (() => Select)): Select; select(select?: number | Select | (() => Select) | undefined): Select;
static card(original: any): any; card(original: any): any;
/** /**
* @overload * @overload
* @returns {GameEvent} * @returns {GameEvent}
*/ */
static event(): GameEvent; event(): any;
/** /**
* @template { keyof GameEvent } T * @template { keyof GameEvent } T
* @overload * @overload
* @param {T} key * @param {T} key
* @returns {GameEvent[T]} * @returns {GameEvent[T]}
*/ */
static event<T_2 extends keyof import("../library/element/gameEvent.js").GameEvent>(key: T_2): import("../library/element/gameEvent.js").GameEvent[T_2]; event<T_2 extends string | number | symbol>(key: T_2): any;
static player(): import("../library/element/player.js").Player; player(): any;
static players(sort: any, dead: any, out: any): import("../library/element/player.js").Player[]; players(sort: any, dead: any, out: any): any[];
static position(card: any, ordering: any): number | "x" | "s" | "e" | "j" | "h" | "c" | "d" | "o"; position(card: any, ordering: any): number | "e" | "j" | "x" | "s" | "h" | "c" | "d" | "o" | null | undefined;
static skillTranslation(str: any, player: any): string; skillTranslation(str: any, player: any): string;
static skillInfoTranslation(name: any, player: any): any; skillInfoTranslation(name: any, player: any): any;
/** /**
* @returns {string} * @returns {string}
*/ */
static translation(str: any, arg: any): string; translation(str: any, arg: any): string;
static menuZoom(): any; menuZoom(): any;
static strNumber(num: any): any; strNumber(num: any): any;
static cnNumber(num: any, ordinal: any): any; cnNumber(num: any, ordinal: any): any;
/** /**
* *
* @param {HTMLElement} node * @param {HTMLElement} node
* @returns {Iterable<HTMLElement>} * @returns {Iterable<HTMLElement>}
*/ */
static iterableChildNodes(node: HTMLElement, ...args: any[]): Iterable<HTMLElement>; iterableChildNodes(node: HTMLElement, ...args: any[]): Iterable<HTMLElement>;
/** /**
* @param {((a: Button, b: Button) => number)} [sort] * @param {((a: Button, b: Button) => number)} [sort]
* @returns { Button[] } * @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] * @param {((a: Card, b: Card) => number)} [sort]
* @returns { Card[] } * @returns { Card[] }
*/ */
static selectableCards(sort?: (a: Card, b: Card) => number): Card[]; selectableCards(sort?: ((a: any, b: any) => number) | undefined): Card[];
/** /**
* @returns { string[] } * @returns { string[] }
*/ */
static skills(): string[]; skills(): string[];
static gainableSkills(func: any, player: any): any[]; gainableSkills(func: any, player: any): any[];
static gainableSkillsName(name: any, func: any): any[]; gainableSkillsName(name: any, func: any): any[];
static gainableCharacters(func: any): string[]; gainableCharacters(func: any): string[];
/** /**
* @param {((a: Player, b: Player) => number)} [sort] * @param {((a: Player, b: Player) => number)} [sort]
* @returns { Player[] } * @returns { Player[] }
*/ */
static selectableTargets(sort?: (a: Player, b: Player) => number): Player[]; selectableTargets(sort?: ((a: any, b: any) => number) | undefined): Player[];
static filter(filter: any, i: any): any; filter(filter: any, i: any): any;
static cardCount(card: any, player: any): any; cardCount(card: any, player: any): any;
static skillCount(skill: any, player: any): any; skillCount(skill: any, player: any): any;
static owner(card: any, method: any): import("../library/element/player.js").Player; owner(card: any, method: any): any;
static noSelected(): boolean; noSelected(): boolean;
static population(identity: any): number; population(identity: any): number;
static totalPopulation(identity: any): number; totalPopulation(identity: any): number;
/** /**
* @param { Card | VCard } item * @param { Card | VCard } item
*/ */
static cardtag(item: Card | VCard, tag: any): any; cardtag(item: Card | VCard, tag: any): any;
static tag(item: any, tag: any, item2: any, bool: any): any; tag(item: any, tag: any, item2: any, bool: any): any;
static sortCard(sort: any): (card: any) => any; sortCard(sort: any): ((card: any) => any) | undefined;
static difficulty(): 2 | 1 | 3; difficulty(): 2 | 1 | 3;
static cardPile(name: any, create: any): any; cardPile(name: any, create: any): any;
static cardPile2(name: any): any; cardPile2(name: any): any;
static discardPile(name: any): any; discardPile(name: any): any;
static aiStrategy(): 2 | 1 | 3 | 4 | 5 | 6; aiStrategy(): 2 | 1 | 3 | 4 | 5 | 6;
static skillintro(name: any, learn: any, learn2: any): string; skillintro(name: any, learn: any, learn2: any): string;
static intro(name: any): string; intro(name: any): string;
static storageintro(type: any, content: any, player: any, dialog: any, skill: any): any; 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; nodeintro(node: any, simple: any, evt: any): import("../library/element/dialog.js").Dialog | undefined;
static linkintro(dialog: any, content: any, player: any): void; linkintro(dialog: any, content: any, player: any): void;
static groups(): string[]; groups(): string[];
static types(): any[]; types(): any[];
static links(buttons: any): any[]; links(buttons: any): any[];
static threaten(target: any, player: any, hp: any): number; threaten(target: any, player: any, hp: any): number;
static condition(player: any): any; condition(player: any): any;
static attitude(from: any, to: any, ...args: any[]): any; attitude(from: any, to: any, ...args: any[]): any;
static sgnAttitude(...args: any[]): 0 | 1 | -1; sgnAttitude(...args: any[]): 0 | 1 | -1;
static useful_raw(card: any, player: any): any; useful_raw(card: any, player: any): any;
static useful(card: any, player: any): any; useful(card: any, player: any): any;
static unuseful(card: any): number; unuseful(card: any): number;
static unuseful2(card: any): number; unuseful2(card: any): number;
static unuseful3(card: any): number; unuseful3(card: any): number;
static value(card: any, player: any, method: any): any; value(card: any, player: any, method: any): any;
static equipResult(player: any, target: any, name: any): number; equipResult(player: any, target: any, name: any): number;
static equipValue(card: any, player: any): number; equipValue(card: any, player: any): any;
static equipValueNumber(card: any): number; equipValueNumber(card: any): any;
static disvalue(card: any, player: any): number; disvalue(card: any, player: any): number;
static disvalue2(card: any, player: any): number; disvalue2(card: any, player: any): number;
static skillthreaten(skill: any, player: any, target: any): number | void; skillthreaten(skill: any, player: any, target: any): number | void;
static cacheOrder(item: any): number; cacheOrder(item: any): number;
/** /**
* @returns { number } * @returns { number }
*/ */
static order(item: any, player?: import("../library/element/player.js").Player): number; order(item: any, player?: any): number;
static result(item: any, skill: any): any; result(item: any, skill: any): any;
static cacheEffectUse(target: any, card: any, player: any, player2: any, isLink: any): number; 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; 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; 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; effect(target: any, card: any, player: any, player2: any, isLink: any): number;
static damageEffect(target: any, player: any, viewer: any, nature: any): any; damageEffect(target: any, player: any, viewer: any, nature: any): any;
/** /**
* *
* @param {any} source functionfunction * @param {any} source functionfunction
* @returns * @returns
*/ */
static dynamicVariable(source: any, ...args: any[]): any; dynamicVariable(source: any, ...args: any[]): any;
static recoverEffect(target: any, player: any, viewer: any): number; recoverEffect(target: any, player: any, viewer: any): number;
static buttonValue(button: any): number; buttonValue(button: any): number;
static attitude2(to: any): any; attitude2(to: any): any;
} }
export const get: typeof Get; export let get: Get;
export { Is }; export function setGet(instance?: Get | undefined): void;
import { Uninstantable } from "../util/index.js";
import { Is } from "./is.js"; import { Is } from "./is.js";
import { Promises } from "./promises.js";
export { Is, Promises };

View File

@ -1,89 +1,89 @@
export class Is extends Uninstantable { export class Is {
/** /**
* *
* @param { Card | VCard } card * @param { Card | VCard } card
* @param { false | Player } [player] * @param { false | Player } [player]
* @returns { boolean } * @returns { boolean }
*/ */
static attackingMount(card: Card | VCard, player?: false | Player): boolean; attackingMount(card: Card | VCard, player?: false | Player): boolean;
/** /**
* *
* @param { Card | VCard } card * @param { Card | VCard } card
* @param { false | Player } [player] * @param { false | Player } [player]
* @returns { boolean } * @returns { boolean }
*/ */
static defendingMount(card: Card | VCard, player?: false | Player): boolean; defendingMount(card: Card | VCard, player?: false | Player): boolean;
/** /**
* *
* @returns { boolean } * @returns { boolean }
*/ */
static mountCombined(): boolean; mountCombined(): boolean;
/** /**
* *
* @param {...} infos * @param {...} infos
* @param {boolean} every * @param {boolean} every
*/ */
static sameNature(...args: any[]): boolean; sameNature(...args: any[]): boolean;
/** /**
* *
* @param ...infos * @param ...infos
* @param every {boolean} * @param every {boolean}
*/ */
static differentNature(...args: any[]): boolean; differentNature(...args: any[]): boolean;
/** /**
* *
* @param { Card } card * @param { Card } card
*/ */
static shownCard(card: Card): boolean; shownCard(card: any): boolean;
/** /**
* *
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static virtualCard(card: Card | VCard): boolean; virtualCard(card: Card | VCard): boolean;
/** /**
* *
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static convertedCard(card: Card | VCard): boolean; convertedCard(card: Card | VCard): boolean;
/** /**
* *
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static ordinaryCard(card: Card | VCard): boolean; ordinaryCard(card: Card | VCard): any;
/** /**
* *
* @param { string } str1 * @param { string } str1
* @param { string } str2 * @param { string } str2
*/ */
static yayun(str1: string, str2: string): boolean; yayun(str1: string, str2: string): boolean;
/** /**
* @param { string } skill id * @param { string } skill id
* @param { Player } player * @param { Player } player
* @returns * @returns
*/ */
static blocked(skill: string, player: Player): boolean; blocked(skill: string, player: any): boolean;
/** /**
* *
* @param { string } name * @param { string } name
* @param { string[] } array * @param { string[] } array
* @returns { boolean | string[] } * @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 * Check if the card has a Yingbian condition
* *
* *
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static yingbianConditional(card: Card | VCard): boolean; yingbianConditional(card: Card | VCard): boolean;
/** /**
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static complexlyYingbianConditional(card: Card | VCard): boolean; complexlyYingbianConditional(card: Card | VCard): boolean;
/** /**
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static simplyYingbianConditional(card: Card | VCard): boolean; simplyYingbianConditional(card: Card | VCard): boolean;
/** /**
* Check if the card has a Yingbian effect * Check if the card has a Yingbian effect
* *
@ -91,104 +91,103 @@ export class Is extends Uninstantable {
* *
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static yingbianEffective(card: Card | VCard): boolean; yingbianEffective(card: Card | VCard): boolean;
/** /**
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static yingbian(card: Card | VCard): boolean; yingbian(card: Card | VCard): boolean;
/** /**
* @param { string } [substring] * @param { string } [substring]
*/ */
static emoji(substring?: string): boolean; emoji(substring?: string | undefined): boolean;
/** /**
* @param { string } str * @param { string } str
*/ */
static banWords(str: string): boolean; banWords(str: string): boolean;
/** /**
* @param { GameEventPromise } event * @param { GameEventPromise } event
*/ */
static converted(event: GameEventPromise): boolean; converted(event: any): boolean;
static safari(): boolean; safari(): boolean;
/** /**
* @param { (Card | VCard)[]} cards * @param { (Card | VCard)[]} cards
*/ */
static freePosition(cards: (Card | VCard)[]): boolean; freePosition(cards: (Card | VCard)[]): boolean;
/** /**
* @param { string } name * @param { string } name
* @param { boolean } item * @param { boolean } item
*/ */
static nomenu(name: string, item: boolean): boolean; nomenu(name: string, item: boolean): boolean;
static altered(skillName: any): boolean; altered(skillName: any): boolean;
/** /**
* @param { any } obj * @param { any } obj
* @returns { boolean } * @returns { boolean }
*/ */
static node(obj: any): boolean; node(obj: any): boolean;
/** /**
* @param { any } obj * @param { any } obj
*/ */
static div(obj: any): boolean; div(obj: any): boolean;
/** /**
* @param { any } obj * @param { any } obj
*/ */
static map(obj: any): boolean; map(obj: any): boolean;
/** /**
* @param { any } obj * @param { any } obj
*/ */
static set(obj: any): boolean; set(obj: any): boolean;
/** /**
* @param { any } obj * @param { any } obj
*/ */
static object(obj: any): boolean; object(obj: any): boolean;
/** /**
* @overload * @overload
* @param { Function } func * @param { Function } func
* @returns { false } * @returns { false }
*/ */
static singleSelect(func: Function): false; singleSelect(func: Function): false;
/** /**
* @overload * @overload
* @param { number | [number, number] } func * @param { number | [number, number] } func
* @returns { boolean } * @returns { boolean }
*/ */
static singleSelect(func: number | [number, number]): boolean; singleSelect(func: number | [number, number]): boolean;
/** /**
* @param { string | Player } name * @param { string | Player } name
*/ */
static jun(name: string | Player): boolean; jun(name: string | Player): boolean;
static versus(): boolean; versus(): boolean;
static changban(): boolean; changban(): boolean;
static single(): boolean; single(): boolean;
/** /**
* @param { Player } [player] * @param { Player } [player]
*/ */
static mobileMe(player?: Player): boolean; mobileMe(player?: any): any;
static newLayout(): boolean; newLayout(): boolean;
static phoneLayout(): boolean; phoneLayout(): boolean;
static singleHandcard(): any; singleHandcard(): any;
/** /**
* @param { Player } player * @param { Player } player
*/ */
static linked2(player: Player): boolean; linked2(player: any): boolean;
/** /**
* @param { {} } obj * @param { {} } obj
*/ */
static empty(obj: {}): boolean; empty(obj: {}): boolean;
/** /**
* @param { string } str * @param { string } str
*/ */
static pos(str: string): boolean; pos(str: string): boolean;
/** /**
* @param { string } skill * @param { string } skill
* @param { Player } player * @param { Player } player
* @returns * @returns
*/ */
static locked(skill: string, player: Player): any; locked(skill: string, player: any): any;
/** /**
* @param { string } skill * @param { string } skill
* @param { Player } player * @param { Player } player
* @returns * @returns
*/ */
static zhuanhuanji(skill: string, player: Player): boolean; zhuanhuanji(skill: string, player: any): boolean;
} }
import { Uninstantable } from "../util/index.js";

View File

@ -0,0 +1,6 @@
export class Promises {
/**
* @returns { Promise<JSZip> }
*/
zip(): Promise<JSZip>;
}

View File

@ -1,12 +1,12 @@
export class GNC extends Uninstantable { export class GNC {
/** /**
* @param {GeneratorFunction} fn * @param {GeneratorFunction} fn
* @returns * @returns
*/ */
static of(fn: GeneratorFunction): (...args: any[]) => Promise<Generator<unknown, any, unknown>>; of(fn: GeneratorFunction): (...args: any[]) => Promise<Generator<unknown, any, unknown>>;
static is: typeof Is; is: Is;
} }
export const gnc: typeof GNC; export let gnc: GNC;
import { Uninstantable } from "../util/index.js"; export function setGNC(instance?: GNC | undefined): void;
import { GeneratorFunction } from "../util/index.js"; import { GeneratorFunction } from "../util/index.js";
import { Is } from "./is.js"; import { Is } from "./is.js";

View File

@ -1,18 +1,17 @@
export class Is extends Uninstantable { export class Is {
/** /**
* @param {*} item * @param {*} item
* @returns {boolean} * @returns {boolean}
*/ */
static coroutine(item: any): boolean; coroutine(item: any): boolean;
/** /**
* @param {*} item * @param {*} item
* @returns {boolean} * @returns {boolean}
*/ */
static generatorFunc(item: any): boolean; generatorFunc(item: any): boolean;
/** /**
* @param {*} item * @param {*} item
* @returns {boolean} * @returns {boolean}
*/ */
static generator(item: any): boolean; generator(item: any): boolean;
} }
import { Uninstantable } from "../util/index.js";

View File

@ -1,4 +1,4 @@
export function canUseHttpProtocol(): boolean; export function canUseHttpProtocol(): any;
/** /**
* *
* @returns { string | void } * @returns { string | void }

View File

@ -1,53 +1,78 @@
import { NonameAnnounceType } from "./interface.d.ts" /**
* @template T
export interface IAnnounceSubscriber { * @typedef {import("./index").AnnounceSubscriberType<T>} AnnounceSubscriberType
subscribe(name: string): void; */
unsubscribe(name: string): void; /**
* @typedef {import("./index").IAnnounceSubscriber} IAnnounceSubscriber
get isEmpty(): boolean */
} /**
*
export type AnnounceSubscriberType<T> = new ( */
content: (value: T, name: string) => void,
target: EventTarget
) => IAnnounceSubscriber;
export class Announce { export class Announce {
constructor(eventTarget: EventTarget, records: WeakMap<((arg0: any) => void), IAnnounceSubscriber>, SubscriberType: AnnounceSubscriberType<any> = AnnounceSubscriber) /**
*
/** * @param {EventTarget} eventTarget
* * @param {WeakMap<function(any): void, IAnnounceSubscriber>} records
* * @param {AnnounceSubscriberType<any>} [SubscriberType]
* */
* constructor(eventTarget: EventTarget, records: WeakMap<(arg0: any) => void, IAnnounceSubscriber>, SubscriberType?: AnnounceSubscriberType<any> | undefined);
* @param name - /**
* @param values - *
*/ *
publish<Type extends NonameAnnounceType, Name extends keyof Type>(name: Name, values: Parameters<Type[Name]>[0]): Parameters<Type[Name]>[0] *
*
/** * @template T
* * @param {string} name -
* * @param {T} values -
* * @returns {T}
* */
* publish<T>(name: string, values: T): T;
* /**
* @param name - *
* @param method - *
*/ *
subscribe<Type extends NonameAnnounceType, Name extends keyof Type>(name: Name, method: Type[Name]): Type[Name] *
*
/** *
* * @template T
* * @param {string} name -
* * @param {(values: T) => void} method -
* * @returns {(values: T) => void}
* @param name - */
* @param method - subscribe<T_1>(name: string, method: (values: T_1) => void): (values: T_1) => void;
*/ /**
unsubscribe<Type extends NonameAnnounceType, Name extends keyof Type>(name: Name, method: Type[Name]): Type[Name] *
*
*
*
* @template T
* @param {string} name -
* @param {(values: T) => void} method -
* @returns {(values: T) => void}
*/
unsubscribe<T_2>(name: string, method: (values: T_2) => void): (values: T_2) => void;
#private;
} }
/**
export class AnnounceSubscriber<T> implements IAnnounceSubscriber { * @template T
constructor(content: (value: T, name: string) => void, target: EventTarget) */
export class AnnounceSubscriber<T> {
/**
*
* @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<T> = import("./index").AnnounceSubscriberType<T>;
export type IAnnounceSubscriber = import("./index").IAnnounceSubscriber;

View File

@ -1,54 +0,0 @@
export interface NonameAnnounceType {
// Apperaence 外观区域
// 用于关于无名杀外观方面的通知
// Apperaence.Theme 无名杀主题区域
/**
*
*
* @param values -
*/
"Noname.Apperaence.Theme.onChanging": AnnounceFunction<string>
/**
*
*
* @param values -
*/
"Noname.Apperaence.Theme.onChanged": AnnounceFunction<string>
/**
*
*
* @param values -
*/
"Noname.Apperaence.Theme.onChangeFinished": AnnounceFunction<string>
// Game 游戏区域
// 包含游戏对局下的通知
// Game.Event 事件区域
/**
*
*
* @param values -
*/
"Noname.Game.Event.GameStart": AnnounceFunction<{}>
// Init 初始化区域
// 用于关于初始化方面的通知
// Init.Extension 扩展初始化区域
/**
*
*
* @param values -
*/
"Noname.Init.Extension.onLoad": AnnounceFunction<string>
}
export type AnnounceFunction<T> = (values: T) => void

View File

@ -33,14 +33,14 @@ export class CacheContext {
* @param {Array<string>} methods * @param {Array<string>} methods
* @returns * @returns
*/ */
static inject(source: any, methods: Array<string>): any; static inject(source: any, methods: Array<string>): null | undefined;
static _getCacheValueFromObject(storage: any, key: any, params: any, source: any, func: any): any; static _getCacheValueFromObject(storage: any, key: any, params: any, source: any, func: any): any;
static _ensureMember(obj: any, key: any): any; static _ensureMember(obj: any, key: any): any;
static _wrapParametersToCacheKey(params: any): string; static _wrapParametersToCacheKey(params: any): string;
static _wrapParameterToCacheKey(param: any): any; static _wrapParameterToCacheKey(param: any): any;
lib: typeof Library; lib: import("../index.js").Library;
game: typeof Game; game: import("../../game/index.js").Game;
get: typeof Get; get: import("../../get/index.js").Get;
sourceMap: Map<any, any>; sourceMap: Map<any, any>;
storageMap: Map<any, any>; storageMap: Map<any, any>;
/** /**
@ -59,6 +59,3 @@ export class CacheContext {
*/ */
_createCacheProxy<T>(delegateObject: T): T; _createCacheProxy<T>(delegateObject: T): T;
} }
import { Library } from "../index.js";
import { Game } from "../../game/index.js";
import { Get } from "../../get/index.js";

View File

@ -9,7 +9,7 @@ export class Channel<T> {
/** /**
* @type {PromiseResolve<T> | [T, PromiseResolve<void>] | null} * @type {PromiseResolve<T> | [T, PromiseResolve<void>] | null}
*/ */
_buffer: ((value?: T | PromiseLike<T>) => void) | [T, (value?: void | PromiseLike<void>) => void]; _buffer: ((value?: T | PromiseLike<T> | undefined) => void) | [T, (value?: void | PromiseLike<void> | undefined) => void] | null;
/** /**
* *
* *

View File

@ -6,8 +6,12 @@ export class Button extends HTMLDivElement {
* @param {true} [noClick] * @param {true} [noClick]
* @param { Button } [button] * @param { Button } [button]
*/ */
constructor(item: {}, type: "character" | "tdnodes" | "blank" | "card" | "vcard" | "characterx" | "player" | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button); constructor(item: {}, type: "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; exclude(): void;
get updateTransform(): (bool: any, delay: any) => void; get updateTransform(): (bool: any, delay: any) => void;
} }
import { UI as ui } from '../../ui/index.js'; import { ui } from '../../ui/index.js';

View File

@ -2,12 +2,12 @@ export class Card extends HTMLDivElement {
/** /**
* @param {HTMLDivElement|DocumentFragment} [position] * @param {HTMLDivElement|DocumentFragment} [position]
*/ */
constructor(position?: HTMLDivElement | DocumentFragment); constructor(position?: HTMLDivElement | DocumentFragment | undefined);
/** /**
* @param {'noclick'} [info] * @param {'noclick'} [info]
* @param {true} [noclick] * @param {true} [noclick]
*/ */
build(info?: 'noclick', noclick?: true): this; build(info?: "noclick" | undefined, noclick?: true | undefined): this;
buildEventListener(info: any): void; buildEventListener(info: any): void;
buildProperty(): void; buildProperty(): void;
/** /**
@ -38,8 +38,8 @@ export class Card extends HTMLDivElement {
willBeDestroyed(targetPosition: any, player: any, event: any): any; willBeDestroyed(targetPosition: any, player: any, event: any): any;
hasNature(nature: any, player: any): boolean; hasNature(nature: any, player: any): boolean;
addNature(nature: any): string; addNature(nature: any): string;
nature: string; nature: string | undefined;
removeNature(nature: any): string; removeNature(nature: any): string | undefined;
addGaintag(gaintag: any): void; addGaintag(gaintag: any): void;
removeGaintag(tag: any): void; removeGaintag(tag: any): void;
hasGaintag(tag: any): boolean; hasGaintag(tag: any): boolean;
@ -57,10 +57,10 @@ export class Card extends HTMLDivElement {
name: string; name: string;
nature: string; nature: string;
}): this; }): this;
suit: string; suit: string | undefined;
number: number; number: number | undefined;
destroyed: any; destroyed: any;
cardid: string; cardid: string | undefined;
/** /**
* @param {[string, number, string, string]} card * @param {[string, number, string, string]} card
*/ */
@ -68,17 +68,17 @@ export class Card extends HTMLDivElement {
updateTransform(bool: any, delay: any): void; updateTransform(bool: any, delay: any): void;
aiexclude(): void; aiexclude(): void;
addKnower(player: any): void; addKnower(player: any): void;
_knowers: any[]; _knowers: any[] | undefined;
removeKnower(player: any): void; removeKnower(player: any): void;
clearKnowers(): void; clearKnowers(): void;
isKnownBy(player: any): boolean; isKnownBy(player: any): boolean;
getSource(name: any): any; getSource(name: any): any;
moveDelete(player: any): void; moveDelete(player: any): void;
fixed: boolean; fixed: boolean | undefined;
_onEndMoveDelete: any; _onEndMoveDelete: any;
moveTo(player: any): this; moveTo(player: any): this;
copy(...args: any[]): Card; copy(...args: any[]): Card;
clone: Card; clone: Card | undefined;
uncheck(skill: any): void; uncheck(skill: any): void;
recheck(skill: any): void; recheck(skill: any): void;
/** /**

View File

@ -1,4 +1,4 @@
/** /**
* @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]> } * @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]> }
*/ */
export const Contents: SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]>; export const Contents: SMap<((event: any, trigger: any, player: any) => Promise<any>)[]>;

View File

@ -22,16 +22,16 @@ export class Dialog extends HTMLDivElement {
* @param {*} [noclick] * @param {*} [noclick]
* @param { boolean } [zoom] * @param { boolean } [zoom]
*/ */
add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean): string | HTMLDivElement | import("./player.js").Player[] | import("./card.js").Card[]; add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean | undefined): string | any[] | HTMLDivElement;
forcebutton: boolean; forcebutton: boolean | undefined;
/** /**
* @param { string } str * @param { string } str
* @param { boolean } [center] * @param { boolean } [center]
*/ */
addText(str: string, center?: boolean): this; addText(str: string, center?: boolean | undefined): this;
addSmall(item: any, noclick: any): string | HTMLDivElement | import("./player.js").Player[] | import("./card.js").Card[]; addSmall(item: any, noclick: any): string | any[] | HTMLDivElement;
addAuto(content: any): void; addAuto(content: any): void;
open(): this; open(): this | undefined;
_dragtransform: any; _dragtransform: any;
close(): this; close(): this;
/** /**

View File

@ -1,10 +1,10 @@
export class GameEvent { export class GameEvent {
static initialGameEvent(): import("../index.js").GameEventPromise; static initialGameEvent(): any;
/** /**
* @param {string | GameEvent} [name] * @param {string | GameEvent} [name]
* @param {false} [trigger] * @param {false} [trigger]
*/ */
constructor(name?: string | GameEvent, trigger?: false); constructor(name?: string | GameEvent | undefined, trigger?: false | undefined);
/** /**
* @type { string } * @type { string }
*/ */
@ -37,21 +37,21 @@ export class GameEvent {
/** /**
* @type {null|(event: GameEvent)=>any} Promise的resolve函数 * @type {null|(event: GameEvent)=>any} Promise的resolve函数
**/ **/
resolve: (event: GameEvent) => any; resolve: ((event: GameEvent) => any) | null;
_triggered: number; _triggered: number | undefined;
__args: any; __args: any;
/** /**
* @type { Player } * @type { Player }
*/ */
source: Player; source: any;
/** /**
* @type { Player } * @type { Player }
*/ */
player: Player; player: any;
/** /**
* @type { Player } * @type { Player }
*/ */
target: Player; target: any;
/** /**
* @type { Player[] } * @type { Player[] }
*/ */
@ -59,7 +59,7 @@ export class GameEvent {
/** /**
* @type { Card } * @type { Card }
*/ */
card: Card; card: any;
/** /**
* @type { Card[] } * @type { Card[] }
*/ */
@ -87,7 +87,7 @@ export class GameEvent {
/** /**
* @type { Player } * @type { Player }
*/ */
customSource: Player; customSource: any;
/** /**
* @type { number } * @type { number }
*/ */
@ -129,23 +129,23 @@ export class GameEvent {
* @param {number} [value] * @param {number} [value]
* @param {number} [baseValue] * @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 {keyof this} key
* @param {number} [baseValue] * @param {number} [baseValue]
*/ */
decrease(key: keyof this, baseValue?: number): this; decrease(key: keyof this, baseValue?: number | undefined): this;
/** /**
* @param {keyof this} key * @param {keyof this} key
* @param {number} [baseValue] * @param {number} [baseValue]
*/ */
increase(key: keyof this, baseValue?: number): this; increase(key: keyof this, baseValue?: number | undefined): this;
/** /**
* @param {keyof this} key * @param {keyof this} key
* @param {number} [value] * @param {number} [value]
* @param {number} [baseValue] * @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<typeof this.hasHandler>[0]} type * @param {Parameters<typeof this.hasHandler>[0]} type
* @param {GameEvent} event * @param {GameEvent} event
@ -157,7 +157,7 @@ export class GameEvent {
callHandler(type: Parameters<typeof this.hasHandler>[0], event: GameEvent, option: { callHandler(type: Parameters<typeof this.hasHandler>[0], event: GameEvent, option: {
state?: 'begin' | 'end'; state?: 'begin' | 'end';
}): this; }): this;
getDefaultHandlerType(): string; getDefaultHandlerType(): string | undefined;
/** /**
* @param {Parameters<typeof this.hasHandler>[0]} [type] * @param {Parameters<typeof this.hasHandler>[0]} [type]
* @returns {((event: GameEvent, option: { * @returns {((event: GameEvent, option: {
@ -170,7 +170,7 @@ export class GameEvent {
/** /**
* @param {`on${Capitalize<string>}`} [type] * @param {`on${Capitalize<string>}`} [type]
*/ */
hasHandler(type?: `on${Capitalize<string>}`): any; hasHandler(type?: `on${Capitalize<string>}` | undefined): any;
/** /**
* @overload * @overload
* @param {...((event: GameEvent, option: { * @param {...((event: GameEvent, option: {
@ -180,7 +180,7 @@ export class GameEvent {
*/ */
pushHandler(...handlers: ((event: GameEvent, option: { pushHandler(...handlers: ((event: GameEvent, option: {
state?: 'begin' | 'end'; state?: 'begin' | 'end';
}) => void)[]): number; }) => void)[] | undefined): number;
/** /**
* @overload * @overload
* @param {Parameters<typeof this.hasHandler>[0]} type * @param {Parameters<typeof this.hasHandler>[0]} type
@ -191,24 +191,24 @@ export class GameEvent {
*/ */
pushHandler(type: Parameters<typeof this.hasHandler>[0], ...handlers: ((event: GameEvent, option: { pushHandler(type: Parameters<typeof this.hasHandler>[0], ...handlers: ((event: GameEvent, option: {
state?: 'begin' | 'end'; state?: 'begin' | 'end';
}) => void)[]): number; }) => void)[] | undefined): number;
changeToZero(): this; changeToZero(): this;
numFixed: boolean; numFixed: boolean | undefined;
finish(): this; finish(): this;
putStepCache(key: any, value: any): this; putStepCache(key: any, value: any): this;
_stepCache: {}; _stepCache: {} | undefined;
getStepCache(key: any): any; getStepCache(key: any): any;
clearStepCache(key: any): this; clearStepCache(key: any): this;
callFuncUseStepCache(prefix: any, func: any, params: any): any; callFuncUseStepCache(prefix: any, func: any, params: any): any;
putTempCache(key1: any, key2: any, value: any): any; putTempCache(key1: any, key2: any, value: any): any;
_tempCache: {}; _tempCache: {} | undefined;
getTempCache(key1: any, key2: any): any; 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; neutralize(event: any): this;
_neutralized: boolean; _neutralized: boolean | undefined;
_neutralize_event: any; _neutralize_event: any;
unneutralize(): this; unneutralize(): this;
directHit: boolean; directHit: boolean | undefined;
goto(step: any): this; goto(step: any): this;
redo(): this; redo(): this;
setHiddenSkill(skill: any): this; setHiddenSkill(skill: any): this;
@ -224,7 +224,7 @@ export class GameEvent {
* @returns {GameEvent} * @returns {GameEvent}
*/ */
setContents(contents: Function | keyof typeof lib.element.contents): GameEvent; setContents(contents: Function | keyof typeof lib.element.contents): GameEvent;
contents: (string | number | Function) & any[]; contents: ((string | number | Function) & any[]) | undefined;
getLogv(): any; getLogv(): any;
send(): this; send(): this;
resume(): this; resume(): this;
@ -237,20 +237,20 @@ export class GameEvent {
* @param {boolean} [includeSelf] level不是数字 * @param {boolean} [includeSelf] level不是数字
* @returns {GameEvent|{}|null} * @returns {GameEvent|{}|null}
*/ */
getParent(level?: string | number | ((evt: gameEvent) => boolean), forced?: boolean, includeSelf?: boolean): GameEvent | {} | null; getParent(level?: string | number | ((evt: gameEvent) => boolean) | undefined, forced?: boolean | undefined, includeSelf?: boolean | undefined): GameEvent | {} | null;
getTrigger(): any; getTrigger(): any;
getRand(name: any): any; getRand(name: any): any;
_rand_map: {}; _rand_map: {} | undefined;
_rand: number; _rand: number | undefined;
insert(content: any, map: any): import("../index.js").GameEventPromise; insert(content: any, map: any): any;
insertAfter(content: any, map: any): import("../index.js").GameEventPromise; insertAfter(content: any, map: any): any;
backup(skill: any): this; backup(skill: any): this;
_backup: any; _backup: any;
filterButton: any; filterButton: any;
selectButton: any; selectButton: any;
filterTarget: any; filterTarget: any;
selectTarget: any; selectTarget: any;
ignoreMod: boolean; ignoreMod: boolean | undefined;
filterCard2: any; filterCard2: any;
filterCard: any; filterCard: any;
filterOk: any; filterOk: any;
@ -267,20 +267,20 @@ export class GameEvent {
_cardChoice: any; _cardChoice: any;
_targetChoice: any; _targetChoice: any;
_skillChoice: any; _skillChoice: any;
isMine(): boolean; isMine(): any;
isOnline(): boolean; isOnline(): any;
notLink(): boolean; notLink(): boolean;
isPhaseUsing(player: any): boolean; isPhaseUsing(player: any): boolean;
addTrigger(skills: any, player: any): this; addTrigger(skills: any, player: any): this;
removeTrigger(skills: any, player: any): this; removeTrigger(skills: any, player: any): this;
trigger(name: any): import("../index.js").GameEventPromise; trigger(name: any): any;
untrigger(all: boolean, player: any): this; untrigger(all: boolean | undefined, player: any): this;
/** /**
* Promise化 * Promise化
* *
* @returns { GameEventPromise } * @returns { GameEventPromise }
*/ */
toPromise(): GameEventPromise; toPromise(): any;
#private; #private;
} }
import { Library as lib } from "../index.js"; import { lib } from "../index.js";

View File

@ -21,13 +21,13 @@
* game.log('等待', player, '摸牌完成执行log'); * game.log('等待', player, '摸牌完成执行log');
* ``` * ```
*/ */
export class GameEventPromise extends Promise<import("./gameEvent.js").GameEvent> { export class GameEventPromise extends Promise<any> {
/** /**
* @param { GameEvent | GameEventPromise } arg * @param { GameEvent | GameEventPromise } arg
*/ */
constructor(arg: GameEvent | GameEventPromise); constructor(arg: GameEvent | GameEventPromise);
/** 获取原事件对象 */ /** 获取原事件对象 */
toEvent(): import("./gameEvent.js").GameEvent; toEvent(): any;
/** /**
* *
* *

View File

@ -3,7 +3,7 @@ export class NodeWS {
* @param {string | NodeWS} id * @param {string | NodeWS} id
*/ */
constructor(id: string | NodeWS); constructor(id: string | NodeWS);
wsid: string; wsid: string | undefined;
send(message: any): void; send(message: any): void;
on(type: any, func: any): void; on(type: any, func: any): void;
close(): void; close(): void;

View File

@ -2,7 +2,7 @@ export class Player extends HTMLDivElement {
/** /**
* @param {HTMLDivElement|DocumentFragment} [position] * @param {HTMLDivElement|DocumentFragment} [position]
*/ */
constructor(position?: HTMLDivElement | DocumentFragment); constructor(position?: HTMLDivElement | DocumentFragment | undefined);
build(noclick: any): this; build(noclick: any): this;
buildNode(): void; buildNode(): void;
/** @type { SMap<HTMLDivElement> } */ /** @type { SMap<HTMLDivElement> } */
@ -143,7 +143,7 @@ export class Player extends HTMLDivElement {
*/ */
outCount: number; outCount: number;
buildEventListener(noclick: any): void; buildEventListener(noclick: any): void;
noclick: boolean; noclick: boolean | undefined;
/** /**
* @type { number } * @type { number }
*/ */
@ -213,7 +213,7 @@ export class Player extends HTMLDivElement {
* @param { number } amount * @param { number } amount
* @param { boolean } [limit] * @param { boolean } [limit]
*/ */
changeFury(amount: number, limit?: boolean): void; changeFury(amount: number, limit?: boolean | undefined): void;
/** /**
* version 1.7 * version 1.7
* *
@ -290,35 +290,35 @@ export class Player extends HTMLDivElement {
/** /**
* *
*/ */
addShownCards(...args: any[]): import("../index.js").GameEventPromise; addShownCards(...args: any[]): any;
hideShownCards(...args: any[]): import("../index.js").GameEventPromise; hideShownCards(...args: any[]): any;
/** /**
* *
*/ */
getShownCards(): import("./card.js").Card[]; getShownCards(): any[];
/** /**
* other所知的牌 * other所知的牌
* @param { Player } [other] * @param { Player } [other]
* @param { (card: Card) => boolean } [filter] * @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] * @param { Player } [other]
*/ */
isAllCardsKnown(other?: Player): boolean; isAllCardsKnown(other?: Player | undefined): boolean;
/** /**
* *
* @param { Player } [other] * @param { Player } [other]
* @param { (card: Card) => boolean } [filter] * @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 { Player } [other]
* @param { (card: Card) => boolean } [filter] * @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 * Execute the delay card effect
* *
@ -329,14 +329,14 @@ export class Player extends HTMLDivElement {
* @param {*} judge2 * @param {*} judge2
* @returns * @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 * Check if the card does not count toward hand limit
* *
* *
* @param { Card } card * @param { Card } card
*/ */
canIgnoreHandcard(card: Card): boolean; canIgnoreHandcard(card: any): boolean;
/** /**
* Gift * Gift
* *
@ -344,7 +344,7 @@ export class Player extends HTMLDivElement {
* @param { Card | Card[] } cards * @param { Card | Card[] } cards
* @param { Player } target * @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 * Check if the player can gift the card
* *
@ -353,7 +353,7 @@ export class Player extends HTMLDivElement {
* @param { Player } target * @param { Player } target
* @param { boolean } [strict] * @param { boolean } [strict]
*/ */
canGift(card: Card, target: Player, strict?: boolean): boolean; canGift(card: any, target: Player, strict?: boolean | undefined): boolean;
/** /**
* Check if the player refuses gifts * Check if the player refuses gifts
* *
@ -361,7 +361,7 @@ export class Player extends HTMLDivElement {
* @param { Card } card * @param { Card } card
* @param { Player } player * @param { Player } player
*/ */
refuseGifts(card: Card, player: Player): boolean; refuseGifts(card: any, player: Player): boolean;
/** /**
* Gift AI related * Gift AI related
* *
@ -369,19 +369,19 @@ export class Player extends HTMLDivElement {
* @param { Card } card * @param { Card } card
* @param { Player } target * @param { Player } target
*/ */
getGiftAIResultTarget(card: Card, target: Player): number; getGiftAIResultTarget(card: any, target: Player): number;
/** /**
* @param { Card } card * @param { Card } card
* @param { Player } target * @param { Player } target
*/ */
getGiftEffect(card: Card, target: Player): number; getGiftEffect(card: any, target: Player): number;
/** /**
* *
* @param { Card | Card[] } cards * @param { Card | Card[] } cards
* @param { (player: Player, cards: Card[]) => any } [recastingLose] * @param { (player: Player, cards: Card[]) => any } [recastingLose]
* @param { (player: Player, cards: Card[]) => any } [recastingGain] * @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 * Check if the player can recast the card
* *
@ -390,7 +390,7 @@ export class Player extends HTMLDivElement {
* @param { Player } [source] * @param { Player } [source]
* @param { boolean } [strict] * @param { boolean } [strict]
*/ */
canRecast(card: Card, source?: Player, strict?: boolean): boolean; canRecast(card: any, source?: Player | undefined, strict?: boolean | undefined): boolean;
/** /**
* *
* *
@ -398,39 +398,39 @@ export class Player extends HTMLDivElement {
* @param { string | number } [type] * @param { string | number } [type]
* @returns { boolean } * @returns { boolean }
*/ */
hasDisabledSlot(type?: string | number): boolean; hasDisabledSlot(type?: string | number | undefined): boolean;
/** /**
* *
* *
* {@link hasDisabledSlot} * {@link hasDisabledSlot}
* @param { string | number } [type] * @param { string | number } [type]
*/ */
countDisabledSlot(type?: string | number): number; countDisabledSlot(type?: string | number | undefined): number;
/** /**
* *
* @param { string | number } [type] * @param { string | number } [type]
* @returns { boolean } * @returns { boolean }
*/ */
hasEmptySlot(type?: string | number): boolean; hasEmptySlot(type?: string | number | undefined): boolean;
/** /**
* *
* @param { string | number } [type] * @param { string | number } [type]
*/ */
countEmptySlot(type?: string | number): number; countEmptySlot(type?: string | number | undefined): number;
/** /**
* *
* *
* {@link hasEnabledSlot} * {@link hasEnabledSlot}
* @param { string | number } [type] * @param { string | number } [type]
*/ */
hasEquipableSlot(type?: string | number): boolean; hasEquipableSlot(type?: string | number | undefined): boolean;
/** /**
* *
* *
* {@link hasEnabledSlot} * {@link hasEnabledSlot}
* @param { string | number } [type] * @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] * @param { string | number } [type]
* @returns { boolean } * @returns { boolean }
*/ */
hasEnabledSlot(type?: string | number): boolean; hasEnabledSlot(type?: string | number | undefined): boolean;
/** /**
* *
* *
* {@link hasEnabledSlot} * {@link hasEnabledSlot}
* @param { string | number } [type] * @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<number> } [map] * @param { SMap<number> } [map]
*/ */
$syncExpand(map?: SMap<number>): void; $syncExpand(map?: SMap<number> | undefined): void;
/** /**
* *
* @param { SMap<number> } [map] * @param { SMap<number> } [map]
*/ */
$syncDisable(map?: SMap<number>): void; $syncDisable(map?: SMap<number> | undefined): void;
/** /**
* @param { string | Card | VCard | CardBaseUIData } name * @param { string | Card | VCard | CardBaseUIData } name
* @param { boolean } [replace] * @param { boolean } [replace]
* @returns * @returns
*/ */
canEquip(name: string | Card | VCard | CardBaseUIData, replace?: boolean): boolean; canEquip(name: string | Card | VCard | CardBaseUIData, replace?: boolean | undefined): boolean;
/** /**
* @deprecated * @deprecated
*/ */
@ -512,7 +512,7 @@ export class Player extends HTMLDivElement {
* @deprecated * @deprecated
*/ */
$enableEquip(): void; $enableEquip(): void;
chooseToDebate(...args: any[]): import("../index.js").GameEventPromise; chooseToDebate(...args: any[]): any;
/** /**
* target发起协力 * target发起协力
* @param { Player } target * @param { Player } target
@ -520,7 +520,7 @@ export class Player extends HTMLDivElement {
* @param {*} reason * @param {*} reason
*/ */
cooperationWith(target: Player, type: any, reason: any): void; 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; checkCooperationStatus(target: any, reason: any): boolean;
removeCooperation(info: any): void; removeCooperation(info: any): void;
/** /**
@ -564,7 +564,7 @@ export class Player extends HTMLDivElement {
* @param { string } skill * @param { string } skill
*/ */
removeSkillBlocker(skill: string): void; 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 { Card | Card[] } cards
* @param { string } tag * @param { string } tag
@ -574,7 +574,7 @@ export class Player extends HTMLDivElement {
* @param { string } tag * @param { string } tag
* @param { Card[] } [cards] * @param { Card[] } [cards]
*/ */
removeGaintag(tag: string, cards?: Card[]): void; removeGaintag(tag: string, cards?: any[] | undefined): void;
/** /**
* @param { Player } target * @param { Player } target
*/ */
@ -583,31 +583,31 @@ export class Player extends HTMLDivElement {
* @param { Card } card * @param { Card } card
* @param { Player } target * @param { Player } target
*/ */
canSaveCard(card: Card, target: Player): any; canSaveCard(card: any, target: Player): any;
/** /**
* @param { String } from * @param { String } from
* @param { String } to * @param { String } to
* @returns { GameEventPromise } * @returns { GameEventPromise }
*/ */
reinitCharacter(from: string, to: string, log?: boolean): GameEventPromise; reinitCharacter(from: string, to: string, log?: boolean): any;
/** /**
* @param { String[] } newPairs * @param { String[] } newPairs
* @returns { GameEventPromise } * @returns { GameEventPromise }
*/ */
changeCharacter(newPairs: string[], log?: boolean): GameEventPromise; changeCharacter(newPairs: string[], log?: boolean): any;
/** /**
* @param { 0 | 1 | 2 } num * @param { 0 | 1 | 2 } num
* @param { false } [log] * @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 { 0 | 1 | 2 } num
* @param { false } [log] * @param { false } [log]
*/ */
$showCharacter(num: 0 | 1 | 2, log?: false): void; $showCharacter(num: 0 | 1 | 2, log?: false | undefined): void;
chooseToPlayBeatmap(beatmap: any, ...args: any[]): import("../index.js").GameEventPromise; chooseToPlayBeatmap(beatmap: any, ...args: any[]): any;
chooseToMove(...args: any[]): import("../index.js").GameEventPromise; chooseToMove(...args: any[]): any;
chooseToGuanxing(num: any): import("../index.js").GameEventPromise; chooseToGuanxing(num: any): any;
/** /**
* @param { Player } target * @param { Player } target
* @param { string } name * @param { string } name
@ -630,12 +630,12 @@ export class Player extends HTMLDivElement {
* @param { string } [nature] * @param { string } [nature]
* @param { string } [popname] * @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 } name
* @param { string } type * @param { string } type
*/ */
hasUsableCard(name: string, type: string): boolean; hasUsableCard(name: string, type: string): true | undefined;
/** /**
* @param { Player } to * @param { Player } to
* @returns { boolean } * @returns { boolean }
@ -652,7 +652,7 @@ export class Player extends HTMLDivElement {
* *
* @param { boolean } [raw] * @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. * 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] * @param { boolean } [raw]
*/ */
getDamagedHp(raw?: boolean): number; getDamagedHp(raw?: boolean | undefined): number;
/** /**
* @param { string } group * @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 * @param { Player } target
*/ */
chooseToDuiben(target: Player): import("../index.js").GameEventPromise; chooseToDuiben(target: Player): any;
/** /**
* @param { Player } target * @param { Player } target
*/ */
chooseToPSS(target: Player): import("../index.js").GameEventPromise; chooseToPSS(target: Player): any;
chooseToEnable(...args: any[]): import("../index.js").GameEventPromise; chooseToEnable(...args: any[]): any;
chooseToDisable(...args: any[]): import("../index.js").GameEventPromise; chooseToDisable(...args: any[]): any;
/** /**
* @param { boolean } [notmeisok] * @param { boolean } [notmeisok]
*/ */
isPhaseUsing(notmeisok?: boolean): boolean; isPhaseUsing(notmeisok?: boolean | undefined): boolean;
/** /**
* @param { Player } target * @param { Player } target
*/ */
swapEquip(target: Player): import("../index.js").GameEventPromise; swapEquip(target: Player): any;
/** /**
* @param { Player } target * @param { Player } target
* @param { boolean } [goon] * @param { boolean } [goon]
* @param { boolean} [bool] * @param { boolean} [bool]
*/ */
canCompare(target: Player, goon?: boolean, bool?: boolean): boolean; canCompare(target: Player, goon?: boolean | undefined, bool?: boolean | undefined): boolean;
$disableJudge(): void; $disableJudge(): void;
$enableJudge(): void; $enableJudge(): void;
disableJudge(): import("../index.js").GameEventPromise; disableJudge(): any;
enableJudge(): import("../index.js").GameEventPromise; enableJudge(): any;
init(character: any, character2: any, skill: any, update: any): this; init(character: any, character2: any, skill: any, update: any): this | undefined;
skin: { skin: {
name: any; name: any;
name2: any; name2: any;
}; } | undefined;
singleHp: boolean; singleHp: boolean | undefined;
$init(character: any, character2: any): this; $init(character: any, character2: any): this;
/** /**
* lib.character.characterSubstitute中存在该武将的idname代指武将idcharacter代指换肤图片名 * lib.character.characterSubstitute中存在该武将的idname代指武将idcharacter代指换肤图片名
@ -717,17 +717,17 @@ export class Player extends HTMLDivElement {
avatar: any; avatar: any;
uninitOL(): void; uninitOL(): void;
initRoom(info: any, info2: any): this; initRoom(info: any, info2: any): this;
serving: boolean; serving: boolean | undefined;
roomempty: boolean; roomempty: boolean | undefined;
roomfull: boolean; roomfull: boolean | undefined;
roomgaming: boolean; roomgaming: boolean | undefined;
version: any; version: any;
key: any; key: any;
config: any; config: any;
reinit2(newPairs: any): void; reinit2(newPairs: any): void;
$reinit12(newPairs: any): void; $reinit12(newPairs: any): void;
$reinit21(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; $reinit(from: any, to: any, maxHp: any, online: any): void;
uninit(): this; uninit(): this;
$uninit(): void; $uninit(): void;
@ -737,13 +737,13 @@ export class Player extends HTMLDivElement {
changeSeat(position: any, video: any): void; changeSeat(position: any, video: any): void;
send(...args: any[]): this; send(...args: any[]): this;
getId(): this; getId(): this;
playerid: string; playerid: string | undefined;
throwEmotion(target: any, emotion: any, rotate: any): void; throwEmotion(target: any, emotion: any, rotate: any): void;
emotion(pack: any, id: any): void; emotion(pack: any, id: any): void;
chat(str: any): void; chat(str: any): void;
say(str: any): void; say(str: any): void;
showGiveup(): void; showGiveup(): void;
_giveUp: boolean; _giveUp: boolean | undefined;
applySkills(skills: any): void; applySkills(skills: any): void;
getState(): { getState(): {
hp: number; hp: number;
@ -754,22 +754,22 @@ export class Player extends HTMLDivElement {
name: string; name: string;
name1: string; name1: string;
name2: string; name2: string;
handcards: import("./card.js").Card[]; handcards: any[];
gaintag: any[]; gaintag: never[];
equips: import("./card.js").Card[]; equips: any[];
judges: import("./card.js").Card[]; judges: any[];
specials: import("./card.js").Card[]; specials: any[];
expansions: import("./card.js").Card[]; expansions: any[];
expansion_gaintag: any[]; expansion_gaintag: never[];
disableJudge: boolean; disableJudge: boolean;
disabledSlots: SMap<number>; disabledSlots: SMap<number>;
expandedSlots: SMap<number>; expandedSlots: SMap<number>;
views: any[]; views: never[];
position: number; position: number;
hujia: number; hujia: number;
side: any; side: any;
identityShown: any; identityShown: any;
identityNode: string[]; identityNode: (string | undefined)[];
identity: any; identity: any;
dead: boolean; dead: boolean;
linked: boolean; linked: boolean;
@ -801,8 +801,8 @@ export class Player extends HTMLDivElement {
num(arg1: any, arg2: any, arg3: any): any; num(arg1: any, arg2: any, arg3: any): any;
line(target: any, config: any): void; line(target: any, config: any): void;
line2(targets: any, config: any): void; line2(targets: any, config: any): void;
getNext(): this; getNext(): this | null;
getPrevious(): this; getPrevious(): this | null;
countUsed(card: any, type: any): number; countUsed(card: any, type: any): number;
getCacheKey(): string; getCacheKey(): string;
countSkill(skill: any): any; countSkill(skill: any): any;
@ -812,13 +812,13 @@ export class Player extends HTMLDivElement {
* @param { string | Record<string, any> | ((card: Card) => boolean) } [arg2] * @param { string | Record<string, any> | ((card: Card) => boolean) } [arg2]
* @returns { Iterable<Card> } * @returns { Iterable<Card> }
*/ */
iterableGetCards(arg1?: string, arg2?: string | Record<string, any> | ((card: Card) => boolean)): Iterable<Card>; iterableGetCards(arg1?: string | undefined, arg2?: string | Record<string, any> | ((card: any) => boolean) | undefined): Iterable<Card>;
/** /**
* @param { string } [arg1='h'] * @param { string } [arg1='h']
* @param { string | Record<string, any> | ((card: Card) => boolean) } [arg2] * @param { string | Record<string, any> | ((card: Card) => boolean) } [arg2]
* @returns { Card[] } * @returns { Card[] }
*/ */
getCards(arg1?: string, arg2?: string | Record<string, any> | ((card: Card) => boolean)): Card[]; getCards(arg1?: string | undefined, arg2?: string | Record<string, any> | ((card: any) => boolean) | undefined): Card[];
iterableGetDiscardableCards(player: any, arg1: any, arg2: any): Generator<any, void, unknown>; iterableGetDiscardableCards(player: any, arg1: any, arg2: any): Generator<any, void, unknown>;
getDiscardableCards(player: any, arg1: any, arg2: any): any[]; getDiscardableCards(player: any, arg1: any, arg2: any): any[];
iterableGetGainableCards(player: any, arg1: any, arg2: any): Generator<any, void, unknown>; iterableGetGainableCards(player: any, arg1: any, arg2: any): Generator<any, void, unknown>;
@ -831,100 +831,100 @@ export class Player extends HTMLDivElement {
getOriginalSkills(): any[]; getOriginalSkills(): any[];
getModableSkills(): any[]; getModableSkills(): any[];
getSkills(arg2: any, arg3: any, arg4: any): 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; syncStorage(skill: any): void;
syncSkills(): void; syncSkills(): void;
playerfocus(time: any): this; playerfocus(time: any): this;
setIdentity(identity: any, nature: any): this; setIdentity(identity: any, nature: any): this;
insertPhase(skill: any, insert: any): import("../index.js").GameEventPromise; insertPhase(skill: any, insert: any): any;
insertEvent(name: any, content: any, arg: any): import("../index.js").GameEventPromise; insertEvent(name: any, content: any, arg: any): any;
phase(skill: any): import("../index.js").GameEventPromise; phase(skill: any): any;
phaseZhunbei(): import("../index.js").GameEventPromise; phaseZhunbei(): any;
phaseJudge(): import("../index.js").GameEventPromise; phaseJudge(): any;
phaseDraw(): import("../index.js").GameEventPromise; phaseDraw(): any;
phaseUse(): import("../index.js").GameEventPromise; phaseUse(): any;
phaseDiscard(): import("../index.js").GameEventPromise; phaseDiscard(): any;
phaseJieshu(): import("../index.js").GameEventPromise; phaseJieshu(): any;
chooseToUse(use: any, ...args: any[]): import("../index.js").GameEventPromise; chooseToUse(use: any, ...args: any[]): any;
chooseToRespond(...args: any[]): import("../index.js").GameEventPromise; chooseToRespond(...args: any[]): any;
chooseToGive(...args: any[]): import("../index.js").GameEventPromise; chooseToGive(...args: any[]): any;
chooseToDiscard(...args: any[]): import("../index.js").GameEventPromise; chooseToDiscard(...args: any[]): any;
chooseToCompare(target: any, check: any, ...args: any[]): import("../index.js").GameEventPromise; chooseToCompare(target: any, check: any, ...args: any[]): any;
chooseSkill(target: any, ...args: any[]): void; chooseSkill(target: any, ...args: any[]): void;
discoverCard(list: any, ...args: any[]): import("../index.js").GameEventPromise; discoverCard(list: any, ...args: any[]): any;
chooseCardButton(...args: any[]): import("../index.js").GameEventPromise; chooseCardButton(...args: any[]): any;
chooseVCardButton(...args: any[]): import("../index.js").GameEventPromise; chooseVCardButton(...args: any[]): any;
chooseButton(...args: any[]): import("../index.js").GameEventPromise; chooseButton(...args: any[]): any;
chooseButtonOL(list: any, callback: any, ai: any, ...args: any[]): import("../index.js").GameEventPromise; chooseButtonOL(list: any, callback: any, ai: any, ...args: any[]): any;
chooseCardOL(...args: any[]): import("../index.js").GameEventPromise; chooseCardOL(...args: any[]): any;
chooseCard(choose: any, ...args: any[]): import("../index.js").GameEventPromise; chooseCard(choose: any, ...args: any[]): any;
chooseUseTarget(...args: any[]): import("../index.js").GameEventPromise; chooseUseTarget(...args: any[]): any;
chooseTarget(...args: any[]): import("../index.js").GameEventPromise; chooseTarget(...args: any[]): any;
chooseCardTarget(choose: any, ...args: any[]): import("../index.js").GameEventPromise; chooseCardTarget(choose: any, ...args: any[]): any;
chooseControlList(...args: any[]): import("../index.js").GameEventPromise; chooseControlList(...args: any[]): any;
chooseControl(...args: any[]): import("../index.js").GameEventPromise; chooseControl(...args: any[]): any;
chooseBool(...args: any[]): import("../index.js").GameEventPromise; chooseBool(...args: any[]): any;
chooseDrawRecover(...args: any[]): import("../index.js").GameEventPromise; chooseDrawRecover(...args: any[]): any;
choosePlayerCard(...args: any[]): import("../index.js").GameEventPromise; choosePlayerCard(...args: any[]): any;
discardPlayerCard(...args: any[]): import("../index.js").GameEventPromise; discardPlayerCard(...args: any[]): any;
gainPlayerCard(...args: any[]): import("../index.js").GameEventPromise; gainPlayerCard(...args: any[]): any;
showHandcards(str: any, ...args: any[]): import("../index.js").GameEventPromise; showHandcards(str: any, ...args: any[]): any;
showCards(cards: any, str: any, ...args: any[]): import("../index.js").GameEventPromise; showCards(cards: any, str: any, ...args: any[]): any;
viewCards(str: any, cards: any, ...args: any[]): import("../index.js").GameEventPromise; viewCards(str: any, cards: any, ...args: any[]): any;
viewHandcards(target: any): false | import("../index.js").GameEventPromise; viewHandcards(target: any): any;
canMoveCard(withatt: any, nojudge: any, ...args: any[]): boolean; canMoveCard(withatt: any, nojudge: any, ...args: any[]): boolean;
moveCard(...args: any[]): import("../index.js").GameEventPromise; moveCard(...args: any[]): any;
useResult(result: any, event: any): import("../index.js").GameEventPromise; useResult(result: any, event: any): any;
useCard(...args: any[]): import("../index.js").GameEventPromise; useCard(...args: any[]): any;
useSkill(...args: any[]): import("../index.js").GameEventPromise; useSkill(...args: any[]): any;
drawTo(num: any, args: any): import("../index.js").GameEventPromise; drawTo(num: any, args: any): any;
draw(...args: any[]): import("../index.js").GameEventPromise; draw(...args: any[]): any;
randomDiscard(...args: any[]): import("./card.js").Card[]; randomDiscard(...args: any[]): any[];
randomGain(...args: any[]): any; randomGain(...args: any[]): any;
discard(...args: any[]): import("../index.js").GameEventPromise; discard(...args: any[]): any;
loseToDiscardpile(...args: any[]): import("../index.js").GameEventPromise; loseToDiscardpile(...args: any[]): any;
respond(...args: any[]): import("../index.js").GameEventPromise; respond(...args: any[]): any;
swapHandcards(target: any, cards1: any, cards2: any): import("../index.js").GameEventPromise; swapHandcards(target: any, cards1: any, cards2: any): any;
directequip(cards: any): void; directequip(cards: any): void;
$addToExpansion(cards: any, broadcast: any, gaintag: any): this; $addToExpansion(cards: any, broadcast: any, gaintag: any): this;
directgain(cards: any, broadcast: any, gaintag: any): this; directgain(cards: any, broadcast: any, gaintag: any): this;
directgains(cards: any, broadcast: any, gaintag: any): this; directgains(cards: any, broadcast: any, gaintag: any): this;
gainMultiple(targets: any, position: any): import("../index.js").GameEventPromise; gainMultiple(targets: any, position: any): any;
gain(...args: any[]): import("../index.js").GameEventPromise; gain(...args: any[]): any;
addToExpansion(...args: any[]): import("../index.js").GameEventPromise; addToExpansion(...args: any[]): any;
give(cards: any, target: any, visible: any): any; give(cards: any, target: any, visible: any): any;
lose(...args: any[]): import("../index.js").GameEventPromise; lose(...args: any[]): any;
damage(...args: any[]): import("../index.js").GameEventPromise; damage(...args: any[]): any;
recover(...args: any[]): import("../index.js").GameEventPromise; recover(...args: any[]): any;
doubleDraw(): import("../index.js").GameEventPromise; doubleDraw(): any;
loseHp(num: any): import("../index.js").GameEventPromise; loseHp(num: any): any;
loseMaxHp(...args: any[]): import("../index.js").GameEventPromise; loseMaxHp(...args: any[]): any;
gainMaxHp(...args: any[]): import("../index.js").GameEventPromise; gainMaxHp(...args: any[]): any;
changeHp(num: any, popup: any): import("../index.js").GameEventPromise; changeHp(num: any, popup: any): any;
changeHujia(num: any, type: any, limit: any): import("../index.js").GameEventPromise; changeHujia(num: any, type: any, limit: any): any;
getBuff(...args: any[]): this; getBuff(...args: any[]): this;
getDebuff(...args: any[]): this; getDebuff(...args: any[]): this;
dying(reason: any): import("../index.js").GameEventPromise; dying(reason: any): any;
die(reason: any): import("../index.js").GameEventPromise; die(reason: any): any;
revive(hp: any, log: any): void; revive(hp: any, log: any): void;
isMad(): boolean; isMad(): boolean;
goMad(end: any): void; goMad(end: any): void;
unMad(): void; unMad(): void;
tempHide(): void; tempHide(): void;
addExpose(num: any): this; addExpose(num: any): this;
equip(card: any, draw: any): import("../index.js").GameEventPromise; equip(card: any, draw: any): any;
addJudge(card: any, cards: any): import("../index.js").GameEventPromise; addJudge(card: any, cards: any): any;
/** /**
* @returns { boolean } * @returns { boolean }
*/ */
canAddJudge(card: any): boolean; canAddJudge(card: any): boolean;
addJudgeNext(card: any, unlimited: any): void; addJudgeNext(card: any, unlimited: any): void;
judge(...args: any[]): import("../index.js").GameEventPromise; judge(...args: any[]): any;
turnOver(bool: any): import("../index.js").GameEventPromise; turnOver(bool: any): any;
out(skill: any): void; out(skill: any): void;
outSkills: any[]; outSkills: any[] | undefined;
in(skill: any): void; in(skill: any): void;
link(bool: any): import("../index.js").GameEventPromise; link(bool: any): any;
skip(name: any): void; skip(name: any): void;
wait(callback: any): void; wait(callback: any): void;
unwait(result: any): void; unwait(result: any): void;
@ -940,7 +940,7 @@ export class Player extends HTMLDivElement {
hideTimer(): void; hideTimer(): void;
markAuto(name: any, info: any): void; markAuto(name: any, info: any): void;
unmarkAuto(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; countExpansions(tag: any): number;
hasExpansions(tag: any): boolean; hasExpansions(tag: any): boolean;
setStorage(name: any, value: any, mark: any): any; 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; markSkill(name: any, info: any, card: any, nobroadcast: any): this;
unmarkSkill(name: any, nobroadcast: any): this; unmarkSkill(name: any, nobroadcast: any): this;
markSkillCharacter(id: any, target: any, name: any, content: 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; mark(name: any, info: any, skill: any): any;
unmark(name: any, info: any): void; unmark(name: any, info: any): void;
addLink(): void; addLink(): void;
@ -966,26 +966,26 @@ export class Player extends HTMLDivElement {
getUseValue(card: any, distance: any, includecard: any): number; getUseValue(card: any, distance: any, includecard: any): number;
addSubPlayer(cfg: any): string; addSubPlayer(cfg: any): string;
removeSubPlayer(name: any): void; removeSubPlayer(name: any): void;
callSubPlayer(...args: any[]): import("../index.js").GameEventPromise; callSubPlayer(...args: any[]): any;
toggleSubPlayer(...args: any[]): import("../index.js").GameEventPromise; toggleSubPlayer(...args: any[]): any;
exitSubPlayer(remove: any): import("../index.js").GameEventPromise; exitSubPlayer(remove: any): any;
getSubPlayers(tag: any): any[]; getSubPlayers(tag: any): any[];
addSkillTrigger(skills: any, hidden: any, triggeronly: any): this; addSkillTrigger(skills: any, hidden: any, triggeronly: any): this;
_hookTrigger: any[]; _hookTrigger: any[] | undefined;
addSkillLog(skill: any): this; addSkillLog(skill: any): this | undefined;
removeSkillLog(skill: any, popup: any): this; removeSkillLog(skill: any, popup: any): this | undefined;
addInvisibleSkill(skill: any): void; addInvisibleSkill(skill: any): void;
removeInvisibleSkill(skill: any, ...args: any[]): any; removeInvisibleSkill(skill: any, ...args: any[]): any;
addSkills(skill: any): import("../index.js").GameEventPromise; addSkills(skill: any): any;
removeSkills(skill: any): import("../index.js").GameEventPromise; removeSkills(skill: any): any;
changeSkills(addSkill?: any[], removeSkill?: any[]): import("../index.js").GameEventPromise; changeSkills(addSkill?: any[], removeSkill?: any[]): any;
addSkill(skill: any, checkConflict: any, nobroadcast: any, addToSkills: 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; addAdditionalSkill(skill: any, skillsToAdd: any, keep: any): this;
$removeAdditionalSkills(skill: any, target: any): void; $removeAdditionalSkills(skill: any, target: any): void;
getRemovableAdditionalSkills(skill: any, target: any): string[]; getRemovableAdditionalSkills(skill: any, target: any): string[];
removeAdditionalSkill(skill: any, target: any): this; 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; awakenSkill(skill: any, nounmark: any): this;
restoreSkill(skill: any, nomark: any): this; restoreSkill(skill: any, nomark: any): this;
disableSkill(skill: any, skills: any): this; disableSkill(skill: any, skills: any): this;
@ -995,13 +995,29 @@ export class Player extends HTMLDivElement {
removeEquipTrigger(card: any): this; removeEquipTrigger(card: any): this;
removeSkillTrigger(skills: any, triggeronly: any): this; removeSkillTrigger(skills: any, triggeronly: any): this;
removeSkill(skill: any, ...args: any[]): any; 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; addTempSkill(skill: any, expire: any, checkConflict: any): any;
tempBanSkill(skill: any, expire: any, log: any): any; tempBanSkill(skill: any, expire: any, log: any): any;
isTempBanned(skill: any): boolean; isTempBanned(skill: any): boolean;
attitudeTo(target: any): any; attitudeTo(target: any): any;
clearSkills(all: any, ...args: any[]): string[]; clearSkills(all: any, ...args: any[]): string[];
checkConflict(skill: any): void; checkConflict(skill: any): void;
/**
* /X轮次的历史
*
*
*
*
*
* 0X轮的历史X为0则为本轮历史trueX轮开始至现在
*
* trueX轮开始至现在所有符合条件的历史
*
* eventevent之前所有符合条件的历史
*
* @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; getHistory(key: any, filter: any, last: any): any;
checkHistory(key: any, filter: any, last: any): void; checkHistory(key: any, filter: any, last: any): void;
hasHistory(key: any, filter: any, last: any): any; hasHistory(key: any, filter: any, last: any): any;
@ -1013,14 +1029,14 @@ export class Player extends HTMLDivElement {
getStat(key: any): any; getStat(key: any): any;
getLastStat(key: any): any; getLastStat(key: any): any;
queue(time: any): void; queue(time: any): void;
queueTimeout: NodeJS.Timeout; queueTimeout: NodeJS.Timeout | undefined;
getCardUsable(card: any, pure: any): number; getCardUsable(card: any, pure: any): number;
getAttackRange(raw: any): number; getAttackRange(raw: any): number;
getEquipRange(cards: any): number; getEquipRange(cards: any): number;
getGlobalFrom(): number; getGlobalFrom(): number;
getGlobalTo(): number; getGlobalTo(): number;
getHandcardLimit(): number; getHandcardLimit(): number;
getEnemies(func: any): Player[]; getEnemies(func: any): any[] | undefined;
getFriends(func: any): any[]; getFriends(func: any): any[];
isEnemyOf(...args: any[]): boolean; isEnemyOf(...args: any[]): boolean;
isFriendOf(player: any): boolean; isFriendOf(player: any): boolean;
@ -1065,13 +1081,13 @@ export class Player extends HTMLDivElement {
hasUnknown(num: any): boolean; hasUnknown(num: any): boolean;
isUnknown(player: any): boolean; isUnknown(player: any): boolean;
hasWuxie(info: any): boolean; hasWuxie(info: any): boolean;
hasSha(respond: any, noauto: any): boolean; hasSha(respond: any, noauto: any): true | undefined;
hasShan(respond: any): boolean; hasShan(respond: any): true | undefined;
mayHaveSha(viewer: any, type: any, ignore: any, rvt: any): number | boolean; mayHaveSha(viewer: any, type: any, ignore: any, rvt: any): number | boolean;
mayHaveShan(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; hasCard(name: any, position: any): boolean;
getEquip(name: any): import("./card.js").Card; getEquip(name: any): any;
getJudge(name: any): ChildNode; getJudge(name: any): ChildNode | null;
$drawAuto(cards: any, target: any): void; $drawAuto(cards: any, target: any): void;
$draw(num: any, init: any, config: any): void; $draw(num: any, init: any, config: any): void;
$compareMultiple(card1: any, targets: any, cards: 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; $throwxy(card: any, left: any, top: any): any;
$throwxy2(card: any, left: any, top: any, trans: any, flipx: any, flipy: any, ...args: any[]): any; $throwxy2(card: any, left: any, top: any, trans: any, flipx: any, flipy: any, ...args: any[]): any;
throwDice(num: any): void; 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; $give(card: any, player: any, log: any, init: any): void;
$handleEquipChange(): void; $handleEquipChange(): void;
$equip(card: any): this; $equip(card: any): this;
$gain(card: any, log: any, init: any): void; $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; $skill(name: any, type: any, color: any, avatar: any): void;
$fire(): void; $fire(): void;
$thunder(): void; $thunder(): void;

View File

@ -5,7 +5,7 @@ export class VCard {
* @param { string } [name] * @param { string } [name]
* @param { string } [nature] * @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} * @type {string}
*/ */
@ -22,7 +22,7 @@ export class VCard {
* @type {string} * @type {string}
*/ */
nature: string; nature: string;
color: string; color: string | undefined;
/** /**
* @type { boolean } * @type { boolean }
*/ */
@ -43,7 +43,7 @@ export class VCard {
/** /**
* @param { Player } player * @param { Player } player
*/ */
hasNature(nature: any, player: Player): boolean; hasNature(nature: any, player: any): boolean;
getCacheKey(): string; getCacheKey(): string;
hasGaintag(tag: any): any; hasGaintag(tag: any): any;
} }

View File

@ -1,51 +1,51 @@
/// <reference types="node" /> /// <reference types="node" />
export class Library extends Uninstantable { export class Library {
static configprefix: string; configprefix: string;
static versionOL: number; versionOL: number;
static updateURLS: { updateURLS: {
coding: string; coding: string;
github: string; github: string;
}; };
static updateURL: string; updateURL: string;
static mirrorURL: string; mirrorURL: string;
static hallURL: string; hallURL: string;
static assetURL: string; assetURL: string;
static userAgent: string; userAgent: string;
static characterDefaultPicturePath: string; characterDefaultPicturePath: string;
static compatibleEdition: boolean; compatibleEdition: boolean;
static changeLog: any[]; changeLog: any[];
static updates: any[]; updates: any[];
static canvasUpdates: any[]; canvasUpdates: any[];
/** /**
* @type { Video[] } * @type { Video[] }
*/ */
static video: Video[]; video: Video[];
static skilllist: any[]; skilllist: any[];
static connectBanned: any[]; connectBanned: any[];
static characterIntro: {}; characterIntro: {};
static characterTitle: {}; characterTitle: {};
static characterPack: {}; characterPack: {};
static characterFilter: {}; characterFilter: {};
static characterSort: {}; characterSort: {};
static characterReplace: {}; characterReplace: {};
static characterSubstitute: {}; characterSubstitute: {};
static characterInitFilter: {}; characterInitFilter: {};
static characterGuozhanFilter: string[]; characterGuozhanFilter: string[];
static dynamicTranslate: {}; dynamicTranslate: {};
static cardPack: {}; cardPack: {};
static cardPackInfo: {}; cardPackInfo: {};
/** /**
* @type { SMap<number> } * @type { SMap<number> }
*/ */
static skin: SMap<number>; skin: SMap<number>;
static onresize: any[]; onresize: any[];
static onphase: any[]; onphase: any[];
static onwash: any[]; onwash: any[];
static onover: any[]; onover: any[];
static ondb: any[]; ondb: any[];
static ondb2: any[]; ondb2: any[];
static chatHistory: any[]; chatHistory: any[];
static emotionList: { emotionList: {
xiaowu_emotion: number; xiaowu_emotion: number;
xiaokuo_emotion: number; xiaokuo_emotion: number;
shibing_emotion: number; shibing_emotion: number;
@ -55,37 +55,77 @@ export class Library extends Uninstantable {
xiaotao_emotion: number; xiaotao_emotion: number;
xiaojiu_emotion: number; xiaojiu_emotion: number;
}; };
static animate: { animate: {
skill: {}; skill: {};
card: {}; card: {};
}; };
static onload: any[]; onload: any[];
static onload2: any[]; onload2: any[];
static onprepare: any[]; onprepare: any[];
static arenaReady: any[]; arenaReady: any[];
static onfree: any[]; onfree: any[];
static inpile: any[]; inpile: any[];
static inpile_nature: any[]; inpile_nature: any[];
static extensions: any[]; extensions: any[];
static extensionPack: {}; extensionPack: {};
static cardType: {}; cardType: {};
static hook: { hook: {
globalskill: {}; globalskill: {};
}; };
/** /**
* @type { Player | undefined } * @type { Player | undefined }
*/ */
static tempSortSeat: Player | undefined; tempSortSeat: Player | undefined;
/** /**
* @returns { never } * @type { 'android' | 'ios' | undefined }
*/ */
static typeAnnotation(): never; 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<IDBDatabase> }
*/
db: IDBRequest<IDBDatabase>;
/** /**
* {钩子名:函数数组} * {钩子名:函数数组}
* game.callHook(,[...])callHook的第二个参数 * game.callHook(,[...])callHook的第二个参数
* hook机制类比为event.trigger() * hook机制类比为event.trigger()
*/ */
static hooks: Readonly<{ hooks: Readonly<{
checkBegin: import("./assembly/index.js").NonameAssembly<import("./assembly/interface.js").NonameAssemblyType, "checkBegin">; checkBegin: import("./assembly/index.js").NonameAssembly<import("./assembly/interface.js").NonameAssemblyType, "checkBegin">;
checkCard: import("./assembly/index.js").NonameAssembly<import("./assembly/interface.js").NonameAssemblyType, "checkCard">; checkCard: import("./assembly/index.js").NonameAssembly<import("./assembly/interface.js").NonameAssemblyType, "checkCard">;
checkTarget: import("./assembly/index.js").NonameAssembly<import("./assembly/interface.js").NonameAssemblyType, "checkTarget">; checkTarget: import("./assembly/index.js").NonameAssembly<import("./assembly/interface.js").NonameAssemblyType, "checkTarget">;
@ -120,7 +160,7 @@ export class Library extends Uninstantable {
* // 从某个角落向channel发消息若无消息接收则等待 * // 从某个角落向channel发消息若无消息接收则等待
* await channel.send(item); * await channel.send(item);
*/ */
static channel: typeof Channel; channel: typeof Channel;
/** /**
* **** * ****
* *
@ -146,12 +186,12 @@ export class Library extends Uninstantable {
* // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅 * // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅
* lib.announce.unsubscribe("skinChange", method); * lib.announce.unsubscribe("skinChange", method);
*/ */
static announce: Announce; announce: Announce;
static objectURL: Map<any, any>; objectURL: Map<any, any>;
static hookmap: {}; hookmap: {};
static imported: {}; imported: {};
static layoutfixed: string[]; layoutfixed: string[];
static pinyins: { pinyins: {
_metadata: { _metadata: {
shengmu: string[]; shengmu: string[];
special_shengmu: string[]; special_shengmu: string[];
@ -184,10 +224,10 @@ export class Library extends Uninstantable {
* *
* *
*/ */
static yingbian: { yingbian: {
condition: { condition: {
color: Map<string, string>; color: Map<string, string>;
complex: Map<string, (event: any, ...args: any[]) => GameEventPromise>; complex: Map<string, (event: any, ...args: any[]) => any>;
simple: Map<string, (event: any) => any>; simple: Map<string, (event: any) => any>;
}; };
effect: Map<string, () => void>; effect: Map<string, () => void>;
@ -198,7 +238,7 @@ export class Library extends Uninstantable {
* *
* *
*/ */
static stratagemBuff: { stratagemBuff: {
cost: Map<string, number>; cost: Map<string, number>;
effect: Map<string, (event: any, option: any) => void>; effect: Map<string, (event: any, option: any) => void>;
prompt: Map<string, () => string>; prompt: Map<string, () => string>;
@ -208,13 +248,13 @@ export class Library extends Uninstantable {
* *
* *
*/ */
static actualCardName: Map<string, string>; actualCardName: Map<string, string>;
static characterDialogGroup: { characterDialogGroup: {
: (name: any, capt: any) => any; : (name: any, capt: any) => any;
: (name: any, capt: any) => any; : (name: any, capt: any) => any;
}; };
static listenEnd(node: any): void; listenEnd(node: any): void;
static configMenu: { configMenu: {
general: { general: {
name: string; name: string;
config: { config: {
@ -303,7 +343,7 @@ export class Library extends Uninstantable {
restart: boolean; restart: boolean;
unfrequent: boolean; unfrequent: boolean;
intro: string; intro: string;
onclick(bool: any): boolean; onclick(bool: any): false | undefined;
}; };
swipe: { swipe: {
name: string; name: string;
@ -324,7 +364,7 @@ export class Library extends Uninstantable {
chat: string; chat: string;
off: string; off: string;
}; };
onclick(item: any): boolean; onclick(item: any): false | undefined;
}; };
swipe_up: { swipe_up: {
name: string; name: string;
@ -339,7 +379,7 @@ export class Library extends Uninstantable {
chat: string; chat: string;
off: string; off: string;
}; };
onclick(item: any): boolean; onclick(item: any): false | undefined;
}; };
swipe_left: { swipe_left: {
name: string; name: string;
@ -354,7 +394,7 @@ export class Library extends Uninstantable {
chat: string; chat: string;
off: string; off: string;
}; };
onclick(item: any): boolean; onclick(item: any): false | undefined;
}; };
swipe_right: { swipe_right: {
name: string; name: string;
@ -369,7 +409,7 @@ export class Library extends Uninstantable {
chat: string; chat: string;
off: string; off: string;
}; };
onclick(item: any): boolean; onclick(item: any): false | undefined;
}; };
round_menu_func: { round_menu_func: {
name: string; name: string;
@ -382,7 +422,7 @@ export class Library extends Uninstantable {
pause: string; pause: string;
auto: string; auto: string;
}; };
onclick(item: any): boolean; onclick(item: any): false | undefined;
}; };
show_splash: { show_splash: {
name: string; name: string;
@ -428,7 +468,7 @@ export class Library extends Uninstantable {
config: string; config: string;
auto: string; auto: string;
}; };
onclick(item: any): boolean; onclick(item: any): false | undefined;
}; };
longpress_info: { longpress_info: {
name: string; name: string;
@ -667,7 +707,7 @@ export class Library extends Uninstantable {
phonelayout: { phonelayout: {
name: string; name: string;
init: boolean; init: boolean;
onclick(bool: any): boolean; onclick(bool: any): false | undefined;
}; };
change_skin: { change_skin: {
name: string; name: string;
@ -1295,7 +1335,7 @@ export class Library extends Uninstantable {
name: string; name: string;
init: boolean; init: boolean;
unfrequent: boolean; unfrequent: boolean;
onclick(bool: any): boolean; onclick(bool: any): false | undefined;
}; };
remember_round_button: { remember_round_button: {
name: string; name: string;
@ -1666,7 +1706,7 @@ export class Library extends Uninstantable {
}; };
}; };
}; };
static extensionMenu: { extensionMenu: {
cardpile: { cardpile: {
enable: { enable: {
name: string; name: string;
@ -1874,7 +1914,7 @@ export class Library extends Uninstantable {
}; };
}; };
}; };
static mode: { mode: {
identity: { identity: {
name: string; name: string;
connect: { connect: {
@ -3259,7 +3299,7 @@ export class Library extends Uninstantable {
}; };
}; };
}; };
static status: { status: {
running: boolean; running: boolean;
canvas: boolean; canvas: boolean;
time: number; time: number;
@ -3269,7 +3309,7 @@ export class Library extends Uninstantable {
videoId: number; videoId: number;
globalId: number; globalId: number;
}; };
static help: { help: {
关于游戏: string; 关于游戏: string;
游戏操作: string; 游戏操作: string;
游戏命令: string; 游戏命令: string;
@ -3278,23 +3318,23 @@ export class Library extends Uninstantable {
/** /**
* @type {import('path')} * @type {import('path')}
*/ */
static path: import("path").PlatformPath; path: import("path").PlatformPath;
static getErrorTip(msg: any): any; getErrorTip(msg: any): any;
static codeMirrorReady(node: any, editor: any): void; codeMirrorReady(node: any, editor: any): void;
static setIntro(node: any, func: any, left: any): void; setIntro(node: any, func: any, left: any): void;
static setPopped(node: any, func: any, width: any, height: any, forceclick: any, paused2: any): void; setPopped(node: any, func: any, width: any, height: any, forceclick: any, paused2: any): void;
static placePoppedDialog(dialog: any, e: any): void; placePoppedDialog(dialog: any, e: any): void;
static setHover(node: any, func: any, hoveration: any, width: any): any; setHover(node: any, func: any, hoveration: any, width: any): any;
static setScroll(node: any): any; setScroll(node: any): any;
static setMousewheel(node: any): void; setMousewheel(node: any): void;
static setLongPress(node: any, func: any): any; setLongPress(node: any, func: any): any;
static updateCanvas(time: any): boolean; updateCanvas(time: any): false | undefined;
static run(time: any): void; run(time: any): void;
static getUTC(date: any): any; getUTC(date: any): any;
static saveVideo(): void; saveVideo(): void;
static genAsync(fn: any): (...args: any[]) => Promise<Generator<unknown, any, unknown>>; genAsync(fn: any): (...args: any[]) => Promise<Generator<unknown, any, unknown>>;
static genAwait(item: any): Promise<any>; genAwait(item: any): Promise<any>;
static gnc: { gnc: {
of: (fn: any) => (...args: any[]) => Promise<Generator<unknown, any, unknown>>; of: (fn: any) => (...args: any[]) => Promise<Generator<unknown, any, unknown>>;
is: { is: {
coroutine: (item: any) => boolean; coroutine: (item: any) => boolean;
@ -3302,20 +3342,20 @@ export class Library extends Uninstantable {
generator: (item: any) => boolean; generator: (item: any) => boolean;
}; };
}; };
static comparator: { comparator: {
equals: (...args: any[]) => boolean; equals: (...args: any[]) => boolean;
equalAny: (...args: any[]) => boolean; equalAny: (...args: any[]) => boolean;
notEquals: (...args: any[]) => boolean; notEquals: (...args: any[]) => boolean;
notEqualAny: (...args: any[]) => boolean; notEqualAny: (...args: any[]) => boolean;
typeEquals: (...args: any[]) => boolean; typeEquals: (...args: any[]) => boolean;
}; };
static creation: { creation: {
readonly array: any[]; readonly array: never[];
readonly object: {}; readonly object: {};
readonly nullObject: any; readonly nullObject: any;
readonly string: string; readonly string: string;
}; };
static linq: { linq: {
cselector: { cselector: {
hasAttr: (name: any) => string; hasAttr: (name: any) => string;
isAttr: (name: any, item: any) => string; isAttr: (name: any, item: any) => string;
@ -3348,8 +3388,8 @@ export class Library extends Uninstantable {
div(...args: any[]): any; div(...args: any[]): any;
}; };
}; };
static init: typeof LibInit; init: LibInit;
static cheat: { cheat: {
/** /**
* *
* *
@ -3395,7 +3435,7 @@ export class Library extends Uninstantable {
* @param { number | true } [i] game.players的第几个元素true时切换玩家布局 * @param { number | true } [i] game.players的第几个元素true时切换玩家布局
* @param { string } [skin] id * @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 * @overload
* @description * @description
@ -3452,24 +3492,24 @@ export class Library extends Uninstantable {
* 使'spell_yexinglanghun' * 使'spell_yexinglanghun'
* @param { boolean } [me] 使'spell_yexinglanghun' * @param { boolean } [me] 使'spell_yexinglanghun'
*/ */
uy(me?: boolean): void; uy(me?: boolean | undefined): void;
/** /**
* 使`spell_${name}` * 使`spell_${name}`
* @param { string } [name] * @param { string } [name]
* @param { boolean } [act] * @param { boolean } [act]
*/ */
gs(name?: string, act?: boolean): void; gs(name?: string | undefined, act?: boolean | undefined): void;
/** /**
* `stone_${name}_stonecharacter` * `stone_${name}_stonecharacter`
* @param { string } [name] * @param { string } [name]
* @param { boolean } [act] * @param { boolean } [act]
*/ */
gc(name?: string, act?: boolean): void; gc(name?: string | undefined, act?: boolean | undefined): void;
/** /**
* /() * /()
* @param { boolean | string } [bool] * @param { boolean | string } [bool]
*/ */
a(bool?: boolean | string): void; a(bool?: string | boolean | undefined): void;
/** /**
* css效果 * css效果
* *
@ -3498,7 +3538,7 @@ export class Library extends Uninstantable {
* id和翻译 * id和翻译
* @param { boolean } [bool] false不输出无名杀自带的武将id和翻译 * @param { boolean } [bool] false不输出无名杀自带的武将id和翻译
*/ */
r(bool?: boolean): void; r(bool?: boolean | undefined): void;
/** /**
* *
* @param { Player } player * @param { Player } player
@ -3565,7 +3605,7 @@ export class Library extends Uninstantable {
* *
* @param { Player } [target] * @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 { number } [num]
* @param { Player } [target] * @param { Player } [target]
*/ */
d(num?: number, target?: Player): void; d(num?: number | undefined, target?: Element.Player | undefined): void;
/** /**
* *
* @param {...string} args * @param {...string} args
@ -3592,7 +3632,7 @@ export class Library extends Uninstantable {
* *
* @param { number | Player } [num] * @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; z(name: string): void;
}; };
static translate: { translate: {
flower: string; flower: string;
egg: string; egg: string;
wine: string; wine: string;
@ -3832,8 +3872,8 @@ export class Library extends Uninstantable {
phaseDiscard: string; phaseDiscard: string;
phaseJieshu: string; phaseJieshu: string;
}; };
static experimental: typeof Experimental; experimental: typeof Experimental;
static element: { element: {
content: { content: {
emptyEvent: () => void; emptyEvent: () => void;
changeCharacter(event: any, trigger: any, player: any): Promise<void>; changeCharacter(event: any, trigger: any, player: any): Promise<void>;
@ -3952,7 +3992,7 @@ export class Library extends Uninstantable {
link: () => void; link: () => void;
chooseToGuanxing: () => void; chooseToGuanxing: () => void;
}; };
contents: SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Element.Player) => Promise<any>)[]>; contents: SMap<((event: any, trigger: any, player: any) => Promise<any>)[]>;
Player: typeof Element.Player; Player: typeof Element.Player;
Card: typeof Element.Card; Card: typeof Element.Card;
VCard: typeof Element.VCard; VCard: typeof Element.VCard;
@ -4002,8 +4042,8 @@ export class Library extends Uninstantable {
*/ */
readonly nodews: Element.NodeWS; readonly nodews: Element.NodeWS;
}; };
static card: { card: {
list: any[]; list: never[];
cooperation_damage: { cooperation_damage: {
fullskin: boolean; fullskin: boolean;
}; };
@ -4118,7 +4158,7 @@ export class Library extends Uninstantable {
fullimage: boolean; fullimage: boolean;
}; };
}; };
static filter: { filter: {
all: () => boolean; all: () => boolean;
none: () => boolean; none: () => boolean;
/** /**
@ -4139,7 +4179,7 @@ export class Library extends Uninstantable {
* @param { Player } target * @param { Player } target
* @param { boolean } [strict] * @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 * Check if the card is recastable
* *
@ -4149,7 +4189,7 @@ export class Library extends Uninstantable {
* @param { Player } [source] * @param { Player } [source]
* @param { boolean } [strict] * @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 { Card } card
* @param { Player } player * @param { Player } player
@ -4176,7 +4216,7 @@ export class Library extends Uninstantable {
* @returns {boolean} * @returns {boolean}
*/ */
filterEnable: (event: GameEvent, player: Player, skill: string) => 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; characterDisabled2: (i: any) => boolean;
skillDisabled: (skill: any) => boolean; skillDisabled: (skill: any) => boolean;
cardEnabled: (card: any, player: any, event: any) => any; 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; attackFrom: (card: any, player: any, target: any) => boolean;
globalFrom: (card: any, player: any, target: any) => boolean; globalFrom: (card: any, player: any, target: any) => boolean;
selectCard: () => number[]; 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; judge: (card: any, player: any, target: any) => any;
autoRespondSha: () => boolean; autoRespondSha: () => boolean;
autoRespondShan: () => boolean; autoRespondShan: () => boolean;
wuxieSwap: (event: any) => boolean; wuxieSwap: (event: any) => true | undefined;
}; };
static sort: { sort: {
nature: (a: any, b: any) => number; nature: (a: any, b: any) => number;
group: (a: any, b: any) => number; group: (a: any, b: any) => number;
character: (a: any, b: any) => number; character: (a: any, b: any) => number;
@ -4233,7 +4273,7 @@ export class Library extends Uninstantable {
* [key: string]: Skill; * [key: string]: Skill;
* }} * }}
*/ */
static skill: { skill: {
[key: string]: Skill; [key: string]: Skill;
global: string[]; global: string[];
globalmap: SMap<Player[]>; globalmap: SMap<Player[]>;
@ -4244,10 +4284,10 @@ export class Library extends Uninstantable {
zhuSkill: SMap<any>; zhuSkill: SMap<any>;
land_used: SMap<any>; land_used: SMap<any>;
}; };
static character: {}; character: {};
static perfectPair: {}; perfectPair: {};
static cardPile: {}; cardPile: {};
static message: { message: {
server: { server: {
/** @this { any } */ /** @this { any } */
init(this: any, version: any, config: any, banned_info: any): void; init(this: any, version: any, config: any, banned_info: any): void;
@ -4295,16 +4335,16 @@ export class Library extends Uninstantable {
updateWaiting: (map: any) => void; updateWaiting: (map: any) => void;
}; };
}; };
static suit: string[]; suit: string[];
static suits: string[]; suits: string[];
static color: { color: {
black: string[]; black: string[];
red: string[]; red: string[];
none: string[]; none: string[];
}; };
static group: string[]; group: string[];
static nature: Map<string, number>; nature: Map<string, number>;
static natureAudio: { natureAudio: {
damage: { damage: {
fire: string; fire: string;
thunder: string; thunder: string;
@ -4325,10 +4365,10 @@ export class Library extends Uninstantable {
kami: string; kami: string;
}; };
}; };
static linked: string[]; linked: string[];
static natureBg: Map<string, string>; natureBg: Map<string, string>;
static natureSeparator: string; natureSeparator: string;
static namePrefix: Map<string, { namePrefix: Map<string, {
color: string; color: string;
nature: string; nature: string;
showName?: undefined; showName?: undefined;
@ -4366,7 +4406,7 @@ export class Library extends Uninstantable {
nature?: undefined; nature?: undefined;
showName?: undefined; showName?: undefined;
}>; }>;
static groupnature: { groupnature: {
shen: string; shen: string;
wei: string; wei: string;
shu: string; shu: string;
@ -4377,36 +4417,21 @@ export class Library extends Uninstantable {
jin: string; jin: string;
ye: string; ye: string;
}; };
static lineColor: Map<string, number[]>; lineColor: Map<string, number[]>;
static phaseName: string[]; phaseName: string[];
static quickVoice: string[]; quickVoice: string[];
static other: { other: {
ignore: () => any; ignore: () => undefined;
}; };
static InitFilter: { InitFilter: {
noZhuHp: string; noZhuHp: string;
noZhuSkill: string; noZhuSkill: string;
}; };
config: any;
configOL: any;
} }
export namespace Library { export let lib: Library;
let videos: Videos[]; export function setLibrary(instance?: Library | undefined): void;
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 type Player = InstanceType<typeof lib.element.Player>; export type Player = InstanceType<typeof lib.element.Player>;
export type Card = InstanceType<typeof lib.element.Card>; export type Card = InstanceType<typeof lib.element.Card>;
export type VCard = InstanceType<typeof lib.element.VCard>; export type VCard = InstanceType<typeof lib.element.VCard>;
@ -4416,9 +4441,8 @@ export type GameEvent = InstanceType<typeof lib.element.GameEvent>;
export type GameEventPromise = InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise>; export type GameEventPromise = InstanceType<typeof lib.element.GameEvent> & InstanceType<typeof lib.element.GameEventPromise>;
export type NodeWS = InstanceType<typeof lib.element.NodeWS>; export type NodeWS = InstanceType<typeof lib.element.NodeWS>;
export type Control = InstanceType<typeof lib.element.Control>; export type Control = InstanceType<typeof lib.element.Control>;
import { Uninstantable } from "../util/index.js"; import * as Element from "./element/index.js";
import { Channel } from "./channel/index.js"; import { Channel } from "./channel/index.js";
import { Announce } from "./announce/index.js"; import { Announce } from "./announce/index.js";
import { LibInit } from "./init/index.js"; import { LibInit } from "./init/index.js";
import { Experimental } from "./experimental/index.js"; import { Experimental } from "./experimental/index.js";
import * as Element from "./element/index.js";

View File

@ -1,53 +1,52 @@
export class LibInit extends Uninstantable { export class LibInit {
/** /**
* Promise版本 * Promise版本
*/ */
static promises: typeof LibInitPromises; promises: LibInitPromises;
static init(): void; init(): void;
static reset(): void; reset(): void;
static onload(): Promise<void>; onload(): Promise<void>;
static startOnline(): void; startOnline(): void;
static onfree(): void; onfree(): void;
static connection(ws: any): void; connection(ws: any): void;
static sheet(...args: any[]): HTMLStyleElement; sheet(...args: any[]): HTMLStyleElement;
static css(path: any, file: any, before: any): HTMLLinkElement; css(path: any, file: any, before: any): HTMLLinkElement;
static jsForExtension(path: any, file: any, onLoad: any, onError: any): void; jsForExtension(path: any, file: any, onLoad: any, onError: any): void;
static js(path: any, file: any, onLoad: any, onError: any): HTMLScriptElement; js(path: any, file: any, onLoad: any, onError: any): HTMLScriptElement | undefined;
/** /**
* lib.init.js * lib.init.js
* @returns { void } * @returns { void }
*/ */
static jsSync(path: any, file: any, onLoad: any, onError: any): void; jsSync(path: any, file: any, onLoad: any, onError: any): void;
static req(str: any, onload: any, onerror: any, master: any): void; req(str: any, onload: any, onerror: any, master: any): void;
/** /**
* lib.init.req * lib.init.req
*/ */
static reqSync(str: any, onload: any, onerror: any, master: any): string; reqSync(str: any, onload: any, onerror: any, master: any): string | undefined;
static json(url: any, onload: any, onerror: any): void; json(url: any, onload: any, onerror: any): void;
/** /**
* lib.init.json * lib.init.json
*/ */
static jsonSync(url: any, onload: any, onerror: any): void; jsonSync(url: any, onload: any, onerror: any): void;
static cssstyles(): void; cssstyles(): void;
static layout(layout: any, nosave: any): void; layout(layout: any, nosave: any): void;
static background(): void; background(): void;
/** /**
* *
* @param {*} item * @param {*} item
* @param {Function} [scope] * @param {Function} [scope]
* @returns * @returns
*/ */
static parsex(item: any, scope?: Function): any; parsex(item: any, scope?: Function | undefined): any;
static eval(func: any): any; eval(func: any): any;
static encode(strUni: any): string; encode(strUni: any): string;
static decode(str: any): string; decode(str: any): string;
static stringify(obj: any): string; stringify(obj: any): string;
static stringifySkill(obj: any): string; stringifySkill(obj: any): string;
/** /**
* esm模块相对位置 * esm模块相对位置
* @param {*} url import.meta.url * @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"; import { LibInitPromises } from "./promises.js";

View File

@ -1,4 +1,4 @@
export class LibInitPromises extends Uninstantable { export class LibInitPromises {
/** /**
* Promise版的`lib.init.js` * Promise版的`lib.init.js`
* *
@ -6,7 +6,7 @@ export class LibInitPromises extends Uninstantable {
* @param {string | string[]} [file] - `path` * @param {string | string[]} [file] - `path`
* @returns {Promise<Event>} * @returns {Promise<Event>}
*/ */
static js(path: string, file?: string | string[]): Promise<Event>; js(path: string, file?: string | string[] | undefined): Promise<Event>;
/** /**
* Promise版的`lib.init.css` * Promise版的`lib.init.css`
* *
@ -16,7 +16,7 @@ export class LibInitPromises extends Uninstantable {
* @param {boolean} [noerror = false] - * @param {boolean} [noerror = false] -
* @returns {Promise<HTMLLinkElement>} * @returns {Promise<HTMLLinkElement>}
*/ */
static css(path: string, file?: string | string[], before?: Element, noerror?: boolean): Promise<HTMLLinkElement>; css(path: string, file?: string | string[] | undefined, before?: Element | undefined, noerror?: boolean | undefined): Promise<HTMLLinkElement>;
/** /**
* Promise版的`lib.init.req` * Promise版的`lib.init.req`
* *
@ -24,19 +24,18 @@ export class LibInitPromises extends Uninstantable {
* @param {string} [master] * @param {string} [master]
* @returns {Promise<ProgressEvent>} * @returns {Promise<ProgressEvent>}
*/ */
static req(str: string, master?: string): Promise<ProgressEvent>; req(str: string, master?: string | undefined): Promise<ProgressEvent>;
/** /**
* Promise版的`lib.init.json` * Promise版的`lib.init.json`
* *
* @param {string} url - * @param {string} url -
* @returns {Promise<object>} * @returns {Promise<object>}
*/ */
static json(url: string): Promise<object>; json(url: string): Promise<object>;
/** /**
* Promise版的`lib.init.sheet` * Promise版的`lib.init.sheet`
* *
* @returns {Promise<HTMLStyleElement>} * @returns {Promise<HTMLStyleElement>}
*/ */
static sheet(): Promise<HTMLStyleElement>; sheet(): Promise<HTMLStyleElement>;
} }
import { Uninstantable } from "../../util/index.js";

View File

@ -1,3 +1,4 @@
export function gainAuthorization(): Promise<void>;
/** /**
* *
* @param { number } limit * @param { number } limit
@ -30,9 +31,9 @@ export function checkVersion(ver1: string, ver2: string): -1 | 0 | 1;
* ``` * ```
*/ */
export function getRepoTags(options?: { export function getRepoTags(options?: {
username?: string; username?: string | undefined;
repository?: string; repository?: string | undefined;
accessToken?: string; accessToken?: string | undefined;
}): Promise<{ }): Promise<{
commit: { commit: {
sha: string; sha: string;
@ -58,9 +59,9 @@ export function getRepoTags(options?: {
* ``` * ```
*/ */
export function getRepoTagDescription(tagName: string, options?: { export function getRepoTagDescription(tagName: string, options?: {
username?: string; username?: string | undefined;
repository?: string; repository?: string | undefined;
accessToken?: string; accessToken?: string | undefined;
}): Promise<{ }): Promise<{
/** @type { { browser_download_url: string, content_type: string, name: string, size: number }[] } tag额外上传的素材包 */ /** @type { { browser_download_url: string, content_type: string, name: string, size: number }[] } tag额外上传的素材包 */
assets: { assets: {
@ -97,7 +98,7 @@ export function getRepoTagDescription(tagName: string, options?: {
* @param { string } [options.username = 'libccy'] * @param { string } [options.username = 'libccy']
* @param { string } [options.repository = 'noname'] * @param { string } [options.repository = 'noname']
* @param { string } [options.accessToken] * @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 * @example
* ```js * ```js
* getRepoFilesList() * getRepoFilesList()
@ -105,11 +106,11 @@ export function getRepoTagDescription(tagName: string, options?: {
* .catch(error => console.error('Failed to fetch files:', error)); * .catch(error => console.error('Failed to fetch files:', error));
* ``` * ```
*/ */
export function getRepoFilesList(path?: string, branch?: string, options?: { export function getRepoFilesList(path?: string | undefined, branch?: string | undefined, options?: {
username?: string; username?: string | undefined;
repository?: string; repository?: string | undefined;
accessToken?: string; accessToken?: string | undefined;
}): Promise<{ }): Promise<({
download_url: string; download_url: string;
name: string; name: string;
path: string; path: string;
@ -123,17 +124,47 @@ export function getRepoFilesList(path?: string, branch?: string, options?: {
sha: string; sha: string;
size: 0; size: 0;
type: 'dir'; 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 { string } url
* @param { (receivedBytes: number, total?:number, filename?: string) => void } [onProgress] * @param { (receivedBytes: number, total?:number, filename?: string) => void } [onProgress]
* @param { RequestInit } [options={}]
* @example * @example
* ```js * ```js
* await getRepoTagDescription('v1.10.10').then(({ zipball_url }) => request(zipball_url)); * 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<Blob>; export function request(url: string, onProgress?: ((receivedBytes: number, total?: number, filename?: string) => void) | undefined, options?: RequestInit | undefined): Promise<Blob>;
/** /**
* *
* @param { string } [title] * @param { string } [title]
@ -142,4 +173,4 @@ export function request(url: string, onProgress?: (receivedBytes: number, total?
* @param { string | number } [value] * @param { string | number } [value]
* @returns { progress } * @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;

View File

@ -1,30 +1,50 @@
export namespace status { export class status {
let paused: boolean; paused: boolean;
let paused2: boolean; paused2: boolean;
let paused3: boolean; paused3: boolean;
let over: boolean; over: boolean;
let clicked: boolean; clicked: boolean;
let auto: boolean; auto: boolean;
let event: GameEventPromise; /**
let ai: {}; * @type { GameEventPromise }
let lastdragchange: any[]; */
let skillaudio: any[]; event: any;
let dieClose: any[]; ai: {};
let dragline: any[]; lastdragchange: any[];
let dying: any[]; skillaudio: any[];
let globalHistory: GameHistory[]; dieClose: any[];
namespace cardtag { dragline: any[];
let yingbian_zhuzhan: any[]; dying: any[];
let yingbian_kongchao: any[]; /**
let yingbian_fujia: any[]; * @type { GameHistory[] }
let yingbian_canqu: any[]; */
let yingbian_force: any[]; globalHistory: GameHistory[];
} cardtag: {
let renku: any[]; yingbian_zhuzhan: never[];
let prehidden_skills: any[]; yingbian_kongchao: never[];
let postReconnect: {}; yingbian_fujia: never[];
let extension: string | void; yingbian_canqu: never[];
let dragged: boolean | void; yingbian_force: never[];
let touchconfirmed: boolean | void; };
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;

View File

@ -1,93 +1,122 @@
export class Click extends Uninstantable { export class Click {
static identitycircle(): void; /**
static connectEvents(): void; * @type {() => void}
static connectClients(): void; */
static autoskin(): void; consoleMenu: () => void;
static skin(avatar: any, name: any, callback: any): void; /**
static touchpop(forced: any): void; * @type {(arg0: string) => void}
static exit(): void; */
static shortcut(show: any): void; menuTab: (arg0: string) => void;
static favouriteCharacter(e: any): void; identitycircle(): void;
static buttonnameenter(): void; connectEvents(): void;
static buttonnameleave(): void; connectClients(): void;
static dragtouchdialog(e: any): void; autoskin(): void;
static identity(e: any): void; skin(avatar: any, name: any, callback: any): void;
static identity2(): void; touchpop(forced: any): void;
static roundmenu(): void; exit(): void;
static pausehistory(): import("../../library/element/dialog.js").Dialog; shortcut(show: any): void;
static pauseconfig(): import("../../library/element/dialog.js").Dialog; favouriteCharacter(e: any): void;
static cardPileButton(): import("../../library/element/dialog.js").Dialog; innerHTML: string | undefined;
static chat(): import("../../library/element/dialog.js").Dialog; buttonnameenter(): void;
static volumn(): import("../../library/element/dialog.js").Dialog; buttonnameleave(): void;
static volumn_background(e: any): void; dragtouchdialog(e: any): void;
static volumn_audio(e: any): void; _dragorigin: {
static hoverpopped(): void; clientX: any;
static hoverpopped_leave(): void; clientY: any;
static leavehoverpopped(): void; } | undefined;
static dierevive(): void; _dragtransform: number[] | undefined;
static dieswap(): void; _dragorigintransform: number[] | undefined;
static dieswap2(): void; identity(e: any): void;
static touchconfirm(): void; _customintro: ((uiintro: any) => void) | undefined;
static windowtouchstart(e: any): void; identity2(): void;
static windowtouchmove(e: any): void; roundmenu(): void;
static windowtouchend(e: any): void; pausehistory(): import("../../library/element/dialog.js").Dialog | undefined;
static checkroundtranslate(translate: any): void; pauseconfig(): import("../../library/element/dialog.js").Dialog | undefined;
static checkdialogtranslate(translate: any, dialog: any): void; cardPileButton(): import("../../library/element/dialog.js").Dialog;
static windowmousewheel(e: any): void; chat(): import("../../library/element/dialog.js").Dialog;
static windowmousemove(e: any): void; volumn(): import("../../library/element/dialog.js").Dialog;
static windowmousedown(e: any): void; volumn_background(e: any): void;
static cardtouchstart(e: any): void; volumn_audio(e: any): void;
static cardtouchmove(e: any): void; hoverpopped(): void;
static windowmouseup(e: any): void; _uiintro: any;
static mousemove(): void; hoverpopped_leave(): void;
static mouseenter(): void; _poppedalready: boolean | undefined;
static mouseleave(): void; leavehoverpopped(): void;
static mousedown(): void; dierevive(): void;
static mouseentercancel(): void; dieswap(): void;
static hoverplayer(e: any): import("../../library/element/dialog.js").Dialog; dieswap2(): void;
static longpressdown(e: any): void; touchconfirm(): void;
static longpresscallback(): void; windowtouchstart(e: any): void;
static longpresscancel(): void; windowtouchmove(e: any): void;
static window(): void; windowtouchend(e: any): void;
static toggle(): void; checkroundtranslate(translate: any): void;
static editor(): void; checkdialogtranslate(translate: any, dialog: any): void;
static switcher(): void; windowmousewheel(e: any): void;
static choice(): void; windowmousemove(e: any): void;
static button(): void; windowmousedown(e: any): void;
static touchintro(): void; cardtouchstart(e: any): void;
static card(...args: any[]): void; _waitingfordrag: {
static avatar(): void; clientX: any;
static avatar2(): void; clientY: any;
static connectroom(e: any): void; } | undefined;
static player(...args: any[]): any; cardtouchmove(e: any): void;
static target(e: any): void; windowmouseup(e: any): void;
static control2(): void; mousemove(): void;
static control(): void; mouseenter(): void;
static dialogcontrol(): void; mouseleave(): void;
static skill(skill: any): void; _mouseentercreated: boolean | undefined;
static ok(node: any): void; mousedown(): void;
static cancel(node: any): void; mouseentercancel(): void;
static logv(e: any): void; hoverplayer(e: any): import("../../library/element/dialog.js").Dialog | undefined;
static logvleave(): void; longpressdown(e: any): void;
static charactercard(name: any, sourcenode: any, noedit: any, resume: any, avatar: any): void; _longpresstimeout: NodeJS.Timeout | undefined;
static intro(e: any): import("../../library/element/dialog.js").Dialog; _longpressevent: any;
static intro2(): void; longpresscallback(): void;
static auto(...args: any[]): void; longpresscancel(): void;
static wuxie(): void; window(): void;
static tempnowuxie(): void; toggle(): void;
static pause(): void; link: boolean | undefined;
static resume(e: any): boolean; editor(): void;
static config(): void; switcher(): void;
static swap(): void; choice(): void;
static mousewheel(evt: any): void; button(): void;
static touchStart(e: any): void; touchintro(): void;
static dialogtouchStart(e: any): void; card(...args: any[]): void;
static touchScroll(e: any): void; avatar(): void;
static autoskill(bool: any, node: any): void; _doubleClicking: boolean | undefined;
static skillbutton(): void; avatar2(): void;
static autoskill2(e: any): void; connectroom(e: any): void;
static hiddenskill(e: any): void; player(...args: any[]): void;
static rightplayer(e: any): boolean; target(e: any): void;
static right(e: any): boolean; 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";

View File

@ -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编辑器 * codemirror编辑器
* @param {HTMLDivElement} container * @param {HTMLDivElement} container
* @param {Function} saveInput * @param {Function} saveInput
*/ */
static editor(container: HTMLDivElement, saveInput: Function): HTMLDivElement; editor(container: HTMLDivElement, saveInput: Function): HTMLDivElement;
static cardTempName(card: any, applyNode: any): any; cardTempName(card: any, applyNode: any): any;
static connectRooms(list: any): void; connectRooms(list: any): void;
static rarity(button: any): void; rarity(button: any): void;
static div(...args: any[]): HTMLDivElement; div(...args: any[]): HTMLDivElement;
static filediv(...args: any[]): any; filediv(...args: any[]): HTMLDivElement;
static node(...args: any[]): any; node(...args: any[]): any;
static iframe(src: any): void; iframe(src: any): void;
static identitycircle(list: any, target: any): void; identitycircle(list: any, target: any): void;
static chat(): void; chat(): void;
static exit(): void; exit(): void;
static connecting(bool: any): void; connecting(bool: any): void;
static roomInfo(): void; roomInfo(): void;
static templayer(time: any): void; templayer(time: any): void;
static selectlist(list: any, init: any, position: any, onchange: any): HTMLSelectElement; 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; otherMenu: (connectMenu: boolean | undefined) => void;
static statictable(...args: any[]): HTMLTableElement; statictable(...args: any[]): HTMLTableElement;
static giveup(): void; giveup(): void;
static groupControl(dialog: any): import("../../library/element/control.js").Control; groupControl(dialog: any): import("../../library/element/control.js").Control;
static cardDialog(...args: any[]): any; cardDialog(...args: any[]): import("../../library/element/dialog.js").Dialog;
static characterDialog2(filter: any): import("../../library/element/dialog.js").Dialog; characterDialog2(filter: any): import("../../library/element/dialog.js").Dialog;
static characterDialog(...args: any[]): import("../../library/element/dialog.js").Dialog; characterDialog(...args: any[]): import("../../library/element/dialog.js").Dialog;
static dialog(...args: any[]): import("../../library/element/dialog.js").Dialog; dialog(...args: any[]): import("../../library/element/dialog.js").Dialog;
static line2(...args: any[]): any; line2(...args: any[]): HTMLDivElement;
static line(...args: any[]): HTMLDivElement; line(...args: any[]): HTMLDivElement;
static switcher(name: any, current: any, current2: any, ...args: any[]): HTMLDivElement; switcher(name: any, current: any, current2: any, ...args: any[]): HTMLDivElement;
static caption(str: any, position: any): HTMLDivElement; caption(str: any, position: any): HTMLDivElement;
static control(...args: any[]): import("../../library/element/control.js").Control; control(...args: any[]): import("../../library/element/control.js").Control;
static confirm(str: any, func: any): void; confirm(str: any, func: any): void;
static skills(skills: any): import("../../library/element/control.js").Control; skills(skills: any): any;
static skills2(skills: any): import("../../library/element/control.js").Control; skills2(skills: any): any;
static skills3(skills: any): import("../../library/element/control.js").Control; skills3(skills: any): any;
static arena(): void; arena(): void;
static system(str: any, func: any, right: any, before: any): HTMLDivElement; system(str: any, func: any, right: any, before: any): HTMLDivElement;
static pause(): HTMLDivElement; pause(): HTMLDivElement | undefined;
static prebutton(item: any, type: any, position: any, noclick: any): HTMLDivElement; prebutton(item: any, type: any, position: any, noclick: any): HTMLDivElement;
static buttonPresets: { buttonPresets: {
/** /**
* @returns { import("../library/index.js").Button } * @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; 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; 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[]; buttons(list: any, type: any, position: any, noclick: any, zoom: any): HTMLDivElement[];
static textbuttons(list: any, dialog: any, noclick: any): void; textbuttons(list: any, dialog: any, noclick: any): void;
static player(position: any, noclick: any): import("../../library/element/player.js").Player; player(position: any, noclick: any): import("../../library/element/player.js").Player;
static connectPlayers(ip: any): void; connectPlayers(ip: any): void;
static players(numberOfPlayers: any): import("../../library/element/player.js").Player[]; players(numberOfPlayers: any): any[] | undefined;
static me(hasme: any): void; me(hasme: any): void;
static card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card; card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card;
static cardsAsync(...args: any[]): void; cardsAsync(...args: any[]): void;
static cards(ordered: any): void; cards(ordered: any): void;
} }
import { Uninstantable } from "../../util/index.js";
import { menu } from "./menu/index.js"; import { menu } from "./menu/index.js";

View File

@ -22,7 +22,7 @@ export function setUpdateActiveCard(fun: Function): void;
/** /**
* @param { boolean } [connectMenu] * @param { boolean } [connectMenu]
*/ */
export function menu(connectMenu?: boolean): void; export function menu(connectMenu?: boolean | undefined): void;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
* *

View File

@ -1 +1 @@
export function otherMenu(connectMenu: any): void; export function otherMenu(connectMenu: boolean | undefined): void;

View File

@ -1,15 +1,15 @@
export class UI extends Uninstantable { export class UI {
static updates: any[]; updates: any[];
static thrown: any[]; thrown: any[];
static touchlines: any[]; touchlines: any[];
static todiscard: {}; todiscard: {};
/** /**
* @type { HTMLStyleElement[] } * @type { HTMLStyleElement[] }
*/ */
static playerPositions: HTMLStyleElement[]; playerPositions: HTMLStyleElement[];
static create: typeof Create; create: Create;
static click: typeof Click; click: Click;
static selected: { selected: {
/** /**
* @type { Button[] } * @type { Button[] }
*/ */
@ -26,111 +26,139 @@ export class UI extends Uninstantable {
/** /**
* @type { Dialog[] } * @type { Dialog[] }
*/ */
static dialogs: Dialog[]; dialogs: Dialog[];
/** /**
* @type { Dialog } * @type { Dialog }
*/ */
static dialog: Dialog; dialog: any;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static arena: HTMLDivElement; arena: HTMLDivElement;
/** /**
* @type { Control[] } * @type { Control[] }
*/ */
static controls: Control[]; controls: Control[];
/** /**
* @type { Control } * @type { Control }
*/ */
static control: Control; control: any;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static confirm: Control | undefined; confirm: Control | undefined;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static skills: Control | undefined; skills: Control | undefined;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static skills1: Control | undefined; skills1: Control | undefined;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static skills2: Control | undefined; skills2: Control | undefined;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static skills3: Control | undefined; skills3: Control | undefined;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static window: HTMLDivElement; window: HTMLDivElement;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static pause: HTMLDivElement; pause: HTMLDivElement;
/** /**
* @type { HTMLAudioElement } * @type { HTMLAudioElement }
*/ */
static backgroundMusic: HTMLAudioElement; backgroundMusic: HTMLAudioElement;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static special: HTMLDivElement; special: HTMLDivElement;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static fakeme: HTMLDivElement; fakeme: HTMLDivElement;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static chess: HTMLDivElement; chess: HTMLDivElement;
/** /**
* ui * ui
* @type { ((packName: string) => void)[] } * @type { ((packName: string) => void)[] }
*/ */
static updateCharacterPackMenu: ((packName: string) => void)[]; updateCharacterPackMenu: ((packName: string) => void)[];
/** /**
* ui * ui
* @type { ((packName: string) => void)[] } * @type { ((packName: string) => void)[] }
*/ */
static updateCardPackMenu: ((packName: string) => void)[]; updateCardPackMenu: ((packName: string) => void)[];
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static mebg: HTMLDivElement; mebg: HTMLDivElement;
static refresh(node: any): void; /**
static clear(): void; * @type { Function | undefined }
static updatec(): void; */
static updatex(...args: any[]): void; updateUpdate: Function | undefined;
static updatexr(): void; /**
static updatejm(player: any, nodes: any, start: any, inv: any): void; * @type {HTMLDivElement}
static updatem(player: any): void; */
static updatej(player: any): void; commandnode: HTMLDivElement;
static updatehl(): void; /**
static updateh(compute: any): void; * @type {() => void}
static updatehx(node: any): void; */
static updated(): void; updateVideoMenu: () => void;
static updatez(): void; /**
static update(): void; * @type {HTMLDivElement}
static recycle(node: any, key: any): any; */
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 curpond
* @author Tipx-L * @author Tipx-L
* @param {number} [numberOfPlayers] * @param {number} [numberOfPlayers]
*/ */
static updateConnectPlayerPositions(numberOfPlayers?: number): void; updateConnectPlayerPositions(numberOfPlayers?: number | undefined): void;
/** /**
* @author curpond * @author curpond
* @author Tipx-L * @author Tipx-L
* @param {number} [numberOfPlayers] * @param {number} [numberOfPlayers]
*/ */
static updatePlayerPositions(numberOfPlayers?: number): void; updatePlayerPositions(numberOfPlayers?: number | undefined): void;
static updateRoundNumber(roundNumber: any, cardPileNumber: any): void; updateRoundNumber(roundNumber: any, cardPileNumber: any): void;
} }
export const ui: typeof UI; export let ui: UI;
import { Uninstantable } from "../util/index.js"; export function setUI(instance?: UI | undefined): void;
import { Create } from "./create/index.js"; import { Create } from "./create/index.js";
import { Click } from "./click/index.js"; import { Click } from "./click/index.js";

View File

@ -1,8 +1,8 @@
export { GNC as gnc } from './noname/gnc/index.js'; export { GNC, gnc, setGNC } from './noname/gnc/index.js';
export { AI as ai } from './noname/ai/index.js'; export { AI, ai, setAI } from './noname/ai/index.js';
export { Game as game } from './noname/game/index.js'; export { Game, game, setGame } from './noname/game/index.js';
export { Get as get } from './noname/get/index.js'; export { Get, get, setGet } from './noname/get/index.js';
export { Library as lib } from './noname/library/index.js'; export { Library, lib, setLibrary } from './noname/library/index.js';
export { status as _status } from './noname/status/index.js'; export { status, _status, setStatus } from './noname/status/index.js';
export { UI as ui } from './noname/ui/index.js'; export { UI, ui, setUI } from './noname/ui/index.js';
export { boot } from './noname/init/index.js'; export { boot } from './noname/init/index.js';

View File

@ -1,20 +1,16 @@
import { Get as get } from '../get/index.js'; import { get } from '../get/index.js';
import { Game as game } from '../game/index.js'; import { game } from '../game/index.js';
import { status as _status } from '../status/index.js'; import { _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js'; import { 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 { CacheContext } from '../library/cache/cacheContext.js'; import { CacheContext } from '../library/cache/cacheContext.js';
export class Basic {
export class Basic extends Uninstantable {
/** /**
* @param { ( * @param { (
* button: Button, * button: Button,
* buttons?: Button[] * buttons?: Button[]
* ) => number } check * ) => number } check
*/ */
static chooseButton(check) { chooseButton(check) {
const event = _status.event; const event = _status.event;
let i, j, range, buttons, buttons2; let i, j, range, buttons, buttons2;
let ok = false, forced = event.forced; let ok = false, forced = event.forced;
@ -81,7 +77,7 @@ export class Basic extends Uninstantable {
* ) => number } check * ) => number } check
* @returns { boolean | undefined } * @returns { boolean | undefined }
*/ */
static chooseCard(check) { chooseCard(check) {
const event = _status.event; const event = _status.event;
if (event.filterCard == undefined) return (check() > 0); if (event.filterCard == undefined) return (check() > 0);
let i, j, range, cards, cards2, skills, effect; let i, j, range, cards, cards2, skills, effect;
@ -144,7 +140,7 @@ export class Basic extends Uninstantable {
var info = get.info(event.skill); var info = get.info(event.skill);
if (info.filterCard) { if (info.filterCard) {
check = info.check || get.unuseful2; check = info.check || get.unuseful2;
return (Basic.chooseCard(check)); return (this.chooseCard(check));
} }
else { else {
return true; return true;
@ -169,7 +165,7 @@ export class Basic extends Uninstantable {
* targets?: Player[] * targets?: Player[]
* ) => number } check * ) => number } check
*/ */
static chooseTarget(check) { chooseTarget(check) {
const event = _status.event; const event = _status.event;
if (event.filterTarget == undefined) return (check() > 0); if (event.filterTarget == undefined) return (check() > 0);
let i, j, range, targets, targets2, effect; let i, j, range, targets, targets2, effect;

View File

@ -1,19 +1,23 @@
import { Get as get } from '../get/index.js'; import { get } from '../get/index.js';
import { Game as game } from '../game/index.js'; import { lib } from '../library/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 { Basic } from './basic.js'; import { Basic } from './basic.js';
export class AI extends Uninstantable { export class AI {
static basic = Basic; basic = new Basic();
static get = get; get = get;
}; };
export const ai = AI; export let ai = new AI();
/**
* @param { InstanceType<typeof AI> } [instance]
*/
export let setAI = (instance) => {
ai = instance || new AI();
if (lib.config.dev) {
window.ai = ai;
}
};
export { export {
Basic Basic

139
noname/game/check.js Normal file
View File

@ -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);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
import { Uninstantable } from "../util/index.js"; import { game } from "../../noname.js";
import { game, Game } from "./index.js";
export class GamePromises extends Uninstantable { export class GamePromises {
/** /**
* 模仿h5的prompt用于显示可提示用户进行输入的对话框 * 模仿h5的prompt用于显示可提示用户进行输入的对话框
* *
@ -32,7 +31,7 @@ export class GamePromises extends Uninstantable {
* *
*/ */
// @ts-ignore // @ts-ignore
static prompt(alertOption, title, forced) { prompt(alertOption, title, forced) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (alertOption !== 'alert') { if (alertOption !== 'alert') {
// @ts-ignore // @ts-ignore
@ -54,29 +53,33 @@ export class GamePromises extends Uninstantable {
* ``` * ```
* @returns { Promise<true> } * @returns { Promise<true> }
*/ */
static alert(title) { alert(title) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
game.prompt(title, 'alert', resolve); game.prompt(title, 'alert', resolve);
}); });
} }
// 读写函数promises化(不用考虑其对应函数是否存在) // 读写函数promises化(不用考虑其对应函数是否存在)
static download(url, folder, dev, onprogress) { download(url, folder, dev, onprogress) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// @ts-ignore
game.download(url, folder, resolve, reject, dev, onprogress); game.download(url, folder, resolve, reject, dev, onprogress);
}); });
} }
static readFile(filename) { readFile(filename) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// @ts-ignore
game.readFile(filename, resolve, reject); game.readFile(filename, resolve, reject);
}); });
} }
static readFileAsText(filename) { readFileAsText(filename) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// @ts-ignore
game.readFileAsText(filename, resolve, reject); game.readFileAsText(filename, resolve, reject);
}); });
} }
static writeFile(data, path, name) { writeFile(data, path, name) {
return (new Promise((resolve, reject) => { return (new Promise((resolve, reject) => {
// @ts-ignore
game.writeFile(data, path, name, resolve); game.writeFile(data, path, name, resolve);
})).then(result => { })).then(result => {
return new Promise((resolve, reject) => { 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) => { 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) => { return new Promise((resolve, reject) => {
// @ts-ignore
game.createDir(directory, resolve, reject); game.createDir(directory, resolve, reject);
}); });
} }
static removeFile(filename) { removeFile(filename) {
return /** @type {Promise<void>} */(new Promise((resolve, reject) => { return /** @type {Promise<void>} */(new Promise((resolve, reject) => {
// @ts-ignore
game.removeFile(filename, err => { game.removeFile(filename, err => {
if (err) reject(err); if (err) reject(err);
else resolve(); else resolve();
}); });
})); }));
} }
static removeDir(directory) { removeDir(directory) {
return /** @type {Promise<void>} */(new Promise((resolve, reject) => { return /** @type {Promise<void>} */(new Promise((resolve, reject) => {
// @ts-ignore
game.removeDir(directory, resolve, reject); game.removeDir(directory, resolve, reject);
})); }));
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,18 @@
import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../util/index.js"; import { userAgent } from "../util/index.js";
import { AI as ai } from '../ai/index.js'; import { game } from '../game/index.js';
import { Game as game } from '../game/index.js'; import { lib } from '../library/index.js';
import { Library as lib } from '../library/index.js'; import { _status } from '../status/index.js';
import { status as _status } from '../status/index.js'; import { ui } from '../ui/index.js';
import { UI as ui } from '../ui/index.js'; import { get } from "./index.js";
import { GNC as gnc } from '../gnc/index.js';
import { Get as get } from "./index.js";
export class Is extends Uninstantable { export class Is {
/** /**
* 判断是否为进攻坐骑 * 判断是否为进攻坐骑
* @param { Card | VCard } card * @param { Card | VCard } card
* @param { false | Player } [player] * @param { false | Player } [player]
* @returns { boolean } * @returns { boolean }
*/ */
static attackingMount(card, player) { attackingMount(card, player) {
const subtype = get.subtype(card, player); const subtype = get.subtype(card, player);
if (subtype == 'equip4') return true; if (subtype == 'equip4') return true;
else if (subtype == 'equip6') { else if (subtype == 'equip6') {
@ -30,7 +28,7 @@ export class Is extends Uninstantable {
* @param { false | Player } [player] * @param { false | Player } [player]
* @returns { boolean } * @returns { boolean }
*/ */
static defendingMount(card, player) { defendingMount(card, player) {
const subtype = get.subtype(card, player); const subtype = get.subtype(card, player);
if (subtype == 'equip3') return true; if (subtype == 'equip3') return true;
else if (subtype == 'equip6') { else if (subtype == 'equip6') {
@ -44,7 +42,7 @@ export class Is extends Uninstantable {
* 判断坐骑栏是否被合并 * 判断坐骑栏是否被合并
* @returns { boolean } * @returns { boolean }
*/ */
static mountCombined() { mountCombined() {
if (lib.configOL.mount_combine) { if (lib.configOL.mount_combine) {
return lib.configOL.mount_combine; return lib.configOL.mount_combine;
} }
@ -58,7 +56,7 @@ export class Is extends Uninstantable {
* @param {...} infos 要判断的属性列表 * @param {...} infos 要判断的属性列表
* @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同 * @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同
*/ */
static sameNature() { sameNature() {
let processedArguments = [], every = false; let processedArguments = [], every = false;
Array.from(arguments).forEach(argument => { Array.from(arguments).forEach(argument => {
if (typeof argument == 'boolean') every = argument; if (typeof argument == 'boolean') every = argument;
@ -90,7 +88,7 @@ export class Is extends Uninstantable {
* @param ...infos 要判断的属性列表 * @param ...infos 要判断的属性列表
* @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同 * @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同
*/ */
static differentNature() { differentNature() {
let processedArguments = [], every = false; let processedArguments = [], every = false;
Array.from(arguments).forEach(argument => { Array.from(arguments).forEach(argument => {
if (typeof argument == 'boolean') every = argument; if (typeof argument == 'boolean') every = argument;
@ -121,7 +119,7 @@ export class Is extends Uninstantable {
* 判断一张牌是否为明置手牌 * 判断一张牌是否为明置手牌
* @param { Card } card * @param { Card } card
*/ */
static shownCard(card) { shownCard(card) {
if (!card) return false; if (!card) return false;
const gaintag = card.gaintag; const gaintag = card.gaintag;
return Array.isArray(gaintag) && gaintag.some(tag => tag.startsWith('visible_')); return Array.isArray(gaintag) && gaintag.some(tag => tag.startsWith('visible_'));
@ -131,7 +129,7 @@ export class Is extends Uninstantable {
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
// @ts-ignore // @ts-ignore
static virtualCard(card) { virtualCard(card) {
return (!("cards" in card) || !Array.isArray(card.cards) || card.cards.length === 0); 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 * @param { Card | VCard } card
*/ */
// @ts-ignore // @ts-ignore
static convertedCard(card) { convertedCard(card) {
return !card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length > 0; 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 * @param { Card | VCard } card
*/ */
// @ts-ignore // @ts-ignore
static ordinaryCard(card) { ordinaryCard(card) {
return card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length === 1 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 } str1
* @param { string } str2 * @param { string } str2
*/ */
static yayun(str1, str2) { yayun(str1, str2) {
if (str1 == str2) return true; if (str1 == str2) return true;
let pinyin1 = get.pinyin(str1, false), pinyin2 = get.pinyin(str2, false); let pinyin1 = get.pinyin(str1, false), pinyin2 = get.pinyin(str2, false);
if (!pinyin1.length || !pinyin2.length) return false; if (!pinyin1.length || !pinyin2.length) return false;
@ -168,7 +166,7 @@ export class Is extends Uninstantable {
* @param { Player } player 玩家 * @param { Player } player 玩家
* @returns * @returns
*/ */
static blocked(skill, player) { blocked(skill, player) {
if (!player.storage.skill_blocker || !player.storage.skill_blocker.length) return false; if (!player.storage.skill_blocker || !player.storage.skill_blocker.length) return false;
for (let i of player.storage.skill_blocker) { for (let i of player.storage.skill_blocker) {
if (lib.skill[i] && lib.skill[i].skillBlocker && lib.skill[i].skillBlocker(skill, player)) return true; 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 * @param { string[] } array
* @returns { boolean | string[] } * @returns { boolean | string[] }
*/ */
static double(name, array) { double(name, array) {
const extraInformations = get.character(name, 4); const extraInformations = get.character(name, 4);
if (!extraInformations) return false; if (!extraInformations) return false;
for (const extraInformation of extraInformations) { for (const extraInformation of extraInformations) {
@ -196,11 +194,11 @@ export class Is extends Uninstantable {
* 检测此牌是否具有应变条件 * 检测此牌是否具有应变条件
* @param { Card | VCard } card * @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 * @param { Card | VCard } card
*/ */
static complexlyYingbianConditional(card) { complexlyYingbianConditional(card) {
for (const key of lib.yingbian.condition.complex.keys()) { for (const key of lib.yingbian.condition.complex.keys()) {
if (get.cardtag(card, `yingbian_${key}`)) return true; if (get.cardtag(card, `yingbian_${key}`)) return true;
} }
@ -209,7 +207,7 @@ export class Is extends Uninstantable {
/** /**
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static simplyYingbianConditional(card) { simplyYingbianConditional(card) {
for (const key of lib.yingbian.condition.simple.keys()) { for (const key of lib.yingbian.condition.simple.keys()) {
if (get.cardtag(card, `yingbian_${key}`)) return true; if (get.cardtag(card, `yingbian_${key}`)) return true;
} }
@ -222,7 +220,7 @@ export class Is extends Uninstantable {
* *
* @param { Card | VCard } card * @param { Card | VCard } card
*/ */
static yingbianEffective(card) { yingbianEffective(card) {
for (const key of lib.yingbian.effect.keys()) { for (const key of lib.yingbian.effect.keys()) {
if (get.cardtag(card, `yingbian_${key}`)) return true; if (get.cardtag(card, `yingbian_${key}`)) return true;
} }
@ -231,11 +229,11 @@ export class Is extends Uninstantable {
/** /**
* @param { Card | VCard } card * @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] * @param { string } [substring]
*/ */
static emoji(substring) { emoji(substring) {
if (substring) { if (substring) {
const reg = new RegExp("[~#^$@%&!?%*]", 'g'); const reg = new RegExp("[~#^$@%&!?%*]", 'g');
if (substring.match(reg)) { if (substring.match(reg)) {
@ -284,23 +282,23 @@ export class Is extends Uninstantable {
/** /**
* @param { string } str * @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 * @param { GameEventPromise } event
*/ */
// @ts-ignore // @ts-ignore
static converted(event) { return !(event.card && event.card.isCard) } converted(event) { return !(event.card && event.card.isCard) }
static safari() { return userAgent.indexOf('safari') != -1 && userAgent.indexOf('chrome') == -1 } safari() { return userAgent.indexOf('safari') != -1 && userAgent.indexOf('chrome') == -1 }
/** /**
* @param { (Card | VCard)[]} cards * @param { (Card | VCard)[]} cards
*/ */
// @ts-ignore // @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 { string } name
* @param { boolean } item * @param { boolean } item
*/ */
static nomenu(name, item) { nomenu(name, item) {
const menus = ['system', 'menu']; const menus = ['system', 'menu'];
const configs = { const configs = {
show_round_menu: lib.config.show_round_menu, show_round_menu: lib.config.show_round_menu,
@ -334,7 +332,7 @@ export class Is extends Uninstantable {
} }
return true; return true;
} }
static altered(skillName) { return false; } altered(skillName) { return false; }
/* /*
skill=>{ skill=>{
return false; return false;
@ -346,25 +344,25 @@ export class Is extends Uninstantable {
* @param { any } obj * @param { any } obj
* @returns { boolean } * @returns { boolean }
*/ */
static node(obj) { node(obj) {
return Object.prototype.toString.call(obj).startsWith('[object HTML'); return Object.prototype.toString.call(obj).startsWith('[object HTML');
} }
/** /**
* @param { any } obj * @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 * @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 * @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 * @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 * @overload
* @param { Function } func * @param { Function } func
@ -375,7 +373,7 @@ export class Is extends Uninstantable {
* @param { number | [number, number] } func * @param { number | [number, number] } func
* @returns { boolean } * @returns { boolean }
*/ */
static singleSelect(func) { singleSelect(func) {
if (typeof func == 'function') return false; if (typeof func == 'function') return false;
const select = get.select(func); const select = get.select(func);
return select[0] == 1 && select[1] == 1; return select[0] == 1 && select[1] == 1;
@ -383,7 +381,7 @@ export class Is extends Uninstantable {
/** /**
* @param { string | Player } name * @param { string | Player } name
*/ */
static jun(name) { jun(name) {
if (get.mode() == 'guozhan') { if (get.mode() == 'guozhan') {
if (name instanceof lib.element.Player) { if (name instanceof lib.element.Player) {
if (name.isUnseen && name.isUnseen(0)) return false; if (name.isUnseen && name.isUnseen(0)) return false;
@ -395,23 +393,23 @@ export class Is extends Uninstantable {
} }
return false; return false;
} }
static versus() { return !_status.connectMode && get.mode() == 'versus' && _status.mode == 'three' } versus() { return !_status.connectMode && get.mode() == 'versus' && _status.mode == 'three' }
static changban() { return get.mode() == 'single' && _status.mode == 'changban' } changban() { return get.mode() == 'single' && _status.mode == 'changban' }
static single() { return get.mode() == 'single' && _status.mode == 'normal' } single() { return get.mode() == 'single' && _status.mode == 'normal' }
/** /**
* @param { Player } [player] * @param { Player } [player]
*/ */
static mobileMe(player) { return (game.layout == 'mobile' || game.layout == 'long') && !game.chess && player && player.dataset.position == '0' } mobileMe(player) { return (game.layout == 'mobile' || game.layout == 'long') && !game.chess && player && player.dataset.position == '0' }
static newLayout() { return game.layout != 'default' } newLayout() { return game.layout != 'default' }
static phoneLayout() { phoneLayout() {
if (!lib.config.phonelayout) return false; if (!lib.config.phonelayout) return false;
return (game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova'); 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 * @param { Player } player
*/ */
static linked2(player) { linked2(player) {
if (game.chess) return true; if (game.chess) return true;
if (lib.config.link_style2 != 'rotate') return true; if (lib.config.link_style2 != 'rotate') return true;
// if(game.chess) return false; // if(game.chess) return false;
@ -424,17 +422,17 @@ export class Is extends Uninstantable {
/** /**
* @param { {} } obj * @param { {} } obj
*/ */
static empty(obj) { return Object.keys(obj).length == 0 } empty(obj) { return Object.keys(obj).length == 0 }
/** /**
* @param { string } str * @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 { string } skill
* @param { Player } player * @param { Player } player
* @returns * @returns
*/ */
static locked(skill, player) { locked(skill, player) {
const info = lib.skill[skill]; const info = lib.skill[skill];
if (typeof info.locked == 'function') return info.locked(skill, player); if (typeof info.locked == 'function') return info.locked(skill, player);
if (info.locked == false) return false; if (info.locked == false) return false;
@ -448,7 +446,7 @@ export class Is extends Uninstantable {
* @param { Player } player * @param { Player } player
* @returns * @returns
*/ */
static zhuanhuanji(skill, player) { zhuanhuanji(skill, player) {
const info = lib.skill[skill], { zhuanhuanji } = info; const info = lib.skill[skill], { zhuanhuanji } = info;
if ('zhuanhuanji2' in info) { if ('zhuanhuanji2' in info) {
const { zhuanhuanji2 } = info; const { zhuanhuanji2 } = info;

View File

@ -1,11 +1,10 @@
import { get } from "./index.js"; import { get } from "./index.js";
import { Uninstantable } from "../util/index.js";
export class Promises extends Uninstantable { export class Promises {
/** /**
* @returns { Promise<JSZip> } * @returns { Promise<JSZip> }
*/ */
static zip() { zip() {
return new Promise(resolve => get.zip(resolve)); return new Promise(resolve => get.zip(resolve));
} }
} }

View File

@ -1,14 +1,14 @@
import { GeneratorFunction, Uninstantable } from "../util/index.js"; import { GeneratorFunction } from "../util/index.js";
import { Is } from "./is.js"; import { Is } from "./is.js";
// gnc: GeNCoroutine // gnc: GeNCoroutine
export class GNC extends Uninstantable { export class GNC {
/** /**
* @param {GeneratorFunction} fn * @param {GeneratorFunction} fn
* @returns * @returns
*/ */
static of(fn) { of(fn) {
return Is.generatorFunc(fn) ? return this.is.generatorFunc(fn) ?
/** /**
* @param {Parameters<typeof fn>} args * @param {Parameters<typeof fn>} args
* @returns {Promise<ReturnType<typeof fn>>} * @returns {Promise<ReturnType<typeof fn>>}
@ -45,7 +45,14 @@ export class GNC extends Uninstantable {
return new Promise(callback); return new Promise(callback);
} : (() => { throw new TypeError("gnc.of needs a GeneratorFunction."); })(); } : (() => { 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<typeof GNC> } [instance]
*/
export let setGNC = (instance) => {
gnc = instance || new GNC();
};

View File

@ -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 * @param {*} item
* @returns {boolean} * @returns {boolean}
*/ */
static coroutine(item) { coroutine(item) {
return typeof item == "function" && item.name == "genCoroutine"; return typeof item == "function" && item.name == "genCoroutine";
} }
@ -13,7 +13,7 @@ export class Is extends Uninstantable {
* @param {*} item * @param {*} item
* @returns {boolean} * @returns {boolean}
*/ */
static generatorFunc(item) { generatorFunc(item) {
return item instanceof GeneratorFunction; return item instanceof GeneratorFunction;
} }
@ -21,7 +21,7 @@ export class Is extends Uninstantable {
* @param {*} item * @param {*} item
* @returns {boolean} * @returns {boolean}
*/ */
static generator(item) { generator(item) {
return (typeof item == "object") && ("constructor" in item) && item.constructor && ("constructor" in item.constructor) && item.constructor.constructor === GeneratorFunction; return (typeof item == "object") && ("constructor" in item) && item.constructor && ("constructor" in item.constructor) && item.constructor.constructor === GeneratorFunction;
} }
}; };

View File

@ -1,9 +1,9 @@
// @ts-nocheck // @ts-nocheck
import { Get as get } from '../get/index.js'; import { get } from '../get/index.js';
import { Library as lib } from '../library/index.js'; import { lib } from '../library/index.js';
import { Game as game } from '../game/index.js'; import { game } from '../game/index.js';
import { status as _status } from '../status/index.js'; import { _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js'; import { ui } from '../ui/index.js';
import { nonameInitialized } from '../util/index.js'; import { nonameInitialized } from '../util/index.js';
export async function cordovaReady() { export async function cordovaReady() {

View File

@ -1,4 +1,4 @@
import { Game as game } from '../game/index.js'; import { game } from '../game/index.js';
import { lib } from '../library/index.js'; import { lib } from '../library/index.js';
/** /**

View File

@ -1,16 +1,14 @@
import { AI as ai } from '../ai/index.js'; import { ai } from '../ai/index.js';
import { Get as get } from '../get/index.js'; import { get } from '../get/index.js';
import { Library as lib } from '../library/index.js'; import { lib } from '../library/index.js';
import { Game as game } from '../game/index.js'; import { game } from '../game/index.js';
import { status as _status } from '../status/index.js'; import { _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js'; import { ui } from '../ui/index.js';
import { gnc } from '../gnc/index.js';
import { userAgent, nonameInitialized } from '../util/index.js'; import { userAgent, nonameInitialized } from '../util/index.js';
import * as config from '../util/config.js'; import * as config from '../util/config.js';
import { promiseErrorHandlerMap } from '../util/browser.js'; import { promiseErrorHandlerMap } from '../util/browser.js';
import { gnc } from '../gnc/index.js';
import { importCardPack, importCharacterPack, importExtension, importMode } from './import.js'; import { importCardPack, importCharacterPack, importExtension, importMode } from './import.js';
import { onload } from './onload.js'; import { onload } from './onload.js';

View File

@ -1,9 +1,9 @@
// @ts-nocheck // @ts-nocheck
import { Get as get } from '../get/index.js'; import { get } from '../get/index.js';
import { Library as lib } from '../library/index.js'; import { lib } from '../library/index.js';
import { Game as game } from '../game/index.js'; import { game } from '../game/index.js';
import { status as _status } from '../status/index.js'; import { _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js'; import { ui } from '../ui/index.js';
import { checkVersion } from '../library/update.js'; import { checkVersion } from '../library/update.js';
export function nodeReady() { export function nodeReady() {

View File

@ -1,13 +1,10 @@
// @ts-nocheck // @ts-nocheck
import { AI as ai } from '../ai/index.js'; import { ai } from '../ai/index.js';
import { Get as get } from '../get/index.js'; import { get } from '../get/index.js';
import { Library as lib } from '../library/index.js'; import { lib } from '../library/index.js';
import { Game as game } from '../game/index.js'; import { game } from '../game/index.js';
import { status as _status } from '../status/index.js'; import { _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js'; import { ui } from '../ui/index.js';
import { userAgent } from '../util/index.js';
import * as config from '../util/config.js';
import { gnc } from '../gnc/index.js'; import { gnc } from '../gnc/index.js';
import { Mutex } from '../util/index.js'; import { Mutex } from '../util/index.js';

View File

@ -1,8 +1,8 @@
import { Get as get } from '../get/index.js'; import { get } from '../get/index.js';
import { Library as lib } from '../library/index.js'; import { lib } from '../library/index.js';
import { Game as game } from '../game/index.js'; import { game } from '../game/index.js';
import { status as _status } from '../status/index.js'; import { _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js'; import { ui } from '../ui/index.js';
// 废弃覆盖原型的HTMLDivElement.prototype.animate // 废弃覆盖原型的HTMLDivElement.prototype.animate
// 改为HTMLDivElement.prototype.addTempClass // 改为HTMLDivElement.prototype.addTempClass

View File

@ -1,17 +1,17 @@
import { Library } from "../index.js"; import { lib } from "../index.js";
import { Game } from "../../game/index.js"; import { game } from "../../game/index.js";
import { Get } from "../../get/index.js"; import { get } from "../../get/index.js";
import { status as _status } from "../../status/index.js"; import { _status } from "../../status/index.js";
import { hex_md5 } from "../crypt/md5.js"; import { hex_md5 } from "../crypt/md5.js";
/** /**
* 缓存上下文用于在各种方法中暂时缓存值以第一次获取的缓存值为准 * 缓存上下文用于在各种方法中暂时缓存值以第一次获取的缓存值为准
*/ */
export class CacheContext{ export class CacheContext {
constructor(){ constructor(){
this.lib = this._createCacheProxy(Library); this.lib = this._createCacheProxy(lib);
this.game = this._createCacheProxy(Game); this.game = this._createCacheProxy(game);
this.get = this._createCacheProxy(Get); this.get = this._createCacheProxy(get);
this.sourceMap = new Map(); this.sourceMap = new Map();
this.storageMap = new Map(); this.storageMap = new Map();
} }

View File

@ -1,11 +1,12 @@
import { AI as ai } from '../../ai/index.js'; import { get } from '../../get/index.js';
import { Get as get } from '../../get/index.js'; import { lib } from "../index.js";
import { Game as game } from '../../game/index.js'; import { _status } from '../../status/index.js';
import { Library as lib } from "../index.js"; import { ui } from '../../ui/index.js';
import { status as _status } from '../../status/index.js';
import { UI as ui } from '../../ui/index.js';
export class Button extends HTMLDivElement { export class Button extends HTMLDivElement {
/**
* @type { string | undefined }
*/
buttonid;
/** /**
* @param {{}} item * @param {{}} item
* @param {keyof typeof ui.create.buttonPresets | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button)} type * @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 { } else {
console.error([item, type, position, noClick, button]); console.error([item, type, position, noClick, button]);
throw 'button不合法'; throw 'button不合法';
} };
} }
exclude() { exclude() {
if (_status.event.excludeButton == undefined) { if (_status.event.excludeButton == undefined) {

View File

@ -1,9 +1,8 @@
import { AI as ai } from '../../ai/index.js'; import { get } from '../../get/index.js';
import { Get as get } from '../../get/index.js'; import { game } from '../../game/index.js';
import { Game as game } from '../../game/index.js'; import { lib } from "../index.js";
import { Library as lib } from "../index.js"; import { _status } from '../../status/index.js';
import { status as _status } from '../../status/index.js'; import { ui } from '../../ui/index.js';
import { UI as ui } from '../../ui/index.js';
export class Card extends HTMLDivElement { export class Card extends HTMLDivElement {
/** /**

View File

@ -1,10 +1,8 @@
import { AI as ai } from '../../ai/index.js'; import { get } from '../../get/index.js';
import { Get as get } from '../../get/index.js'; import { game } from '../../game/index.js';
import { Game as game } from '../../game/index.js'; import { lib } from "../index.js";
import { Library as lib } from "../index.js"; import { _status } from '../../status/index.js';
import { status as _status } from '../../status/index.js'; import { ui } from '../../ui/index.js';
import { UI as ui } from '../../ui/index.js';
import { GNC as gnc } from '../../gnc/index.js';
export class Client { export class Client {
/** /**

View File

@ -1,10 +1,10 @@
import { AI as ai } from '../../ai/index.js'; import { ai } from '../../ai/index.js';
import { Get as get } from '../../get/index.js'; import { get } from '../../get/index.js';
import { Game as game } from '../../game/index.js'; import { game } from '../../game/index.js';
import { Library as lib } from "../index.js"; import { lib } from "../index.js";
import { status as _status } from '../../status/index.js'; import { _status } from '../../status/index.js';
import { UI as ui } from '../../ui/index.js'; import { ui } from '../../ui/index.js';
import { GNC as gnc } from '../../gnc/index.js'; import { gnc } from '../../gnc/index.js';
// 未来再改 // 未来再改
export const Content = { export const Content = {

View File

@ -1,10 +1,8 @@
import { AI as ai } from '../../ai/index.js'; import { get } from '../../get/index.js';
import { Get as get } from '../../get/index.js'; import { game } from '../../game/index.js';
import { Game as game } from '../../game/index.js'; import { lib } from "../index.js";
import { Library as lib } from "../index.js"; import { _status } from '../../status/index.js';
import { status as _status } from '../../status/index.js'; import { ui } from '../../ui/index.js';
import { UI as ui } from '../../ui/index.js';
import { GNC as gnc } from '../../gnc/index.js';
/** /**
* @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]> } * @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]> }

View File

@ -1,10 +1,8 @@
import { AI as ai } from '../../ai/index.js'; import { get } from '../../get/index.js';
import { Get as get } from '../../get/index.js'; import { game } from '../../game/index.js';
import { Game as game } from '../../game/index.js'; import { lib } from "../index.js";
import { Library as lib } from "../index.js"; import { _status } from '../../status/index.js';
import { status as _status } from '../../status/index.js'; import { ui } from '../../ui/index.js';
import { UI as ui } from '../../ui/index.js';
import { GNC as gnc } from '../../gnc/index.js';
export class Control extends HTMLDivElement { export class Control extends HTMLDivElement {
// @ts-ignore // @ts-ignore

View File

@ -1,9 +1,7 @@
import { AI as ai } from '../../ai/index.js'; import { get } from '../../get/index.js';
import { Get as get } from '../../get/index.js'; import { lib } from "../index.js";
import { Game as game } from '../../game/index.js'; import { _status } from '../../status/index.js';
import { Library as lib } from "../index.js"; import { ui } from '../../ui/index.js';
import { status as _status } from '../../status/index.js';
import { UI as ui } from '../../ui/index.js';
export class Dialog extends HTMLDivElement { export class Dialog extends HTMLDivElement {
/** @type { HTMLDivElement } */ /** @type { HTMLDivElement } */

View File

@ -1,9 +1,8 @@
import { AI as ai } from '../../ai/index.js'; import { get } from '../../get/index.js';
import { Get as get } from '../../get/index.js'; import { game } from '../../game/index.js';
import { Game as game } from '../../game/index.js'; import { lib } from "../index.js";
import { Library as lib } from "../index.js"; import { _status } from '../../status/index.js';
import { status as _status } from '../../status/index.js'; import { ui } from '../../ui/index.js';
import { UI as ui } from '../../ui/index.js';
import { AsyncFunction } from '../../util/index.js'; import { AsyncFunction } from '../../util/index.js';
export class GameEvent { export class GameEvent {

View File

@ -1,7 +1,7 @@
import { Get as get } from '../../get/index.js'; import { get } from '../../get/index.js';
import { Game as game } from '../../game/index.js'; import { game } from '../../game/index.js';
import { Library as lib } from "../index.js"; import { lib } from "../index.js";
import { status as _status } from '../../status/index.js'; import { _status } from '../../status/index.js';
import { AsyncFunction } from '../../util/index.js'; import { AsyncFunction } from '../../util/index.js';
/** /**

View File

@ -1,10 +1,5 @@
import { AI as ai } from '../../ai/index.js'; import { game } from '../../game/index.js';
import { Get as get } from '../../get/index.js'; import { _status } from '../../status/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';
export class NodeWS { export class NodeWS {
/** /**

View File

@ -1,9 +1,9 @@
import { AI as ai } from '../../ai/index.js'; import { ai } from '../../ai/index.js';
import { Get as get } from '../../get/index.js'; import { get } from '../../get/index.js';
import { Game as game } from '../../game/index.js'; import { game } from '../../game/index.js';
import { Library as lib } from "../index.js"; import { lib } from "../index.js";
import { status as _status } from '../../status/index.js'; import { _status } from '../../status/index.js';
import { UI as ui } from '../../ui/index.js'; import { ui } from '../../ui/index.js';
import { CacheContext } from '../cache/cacheContext.js'; import { CacheContext } from '../cache/cacheContext.js';
import { ChildNodesWatcher } from '../cache/childNodesWatcher.js'; import { ChildNodesWatcher } from '../cache/childNodesWatcher.js';

View File

@ -1,9 +1,6 @@
import { AI as ai } from '../../ai/index.js'; import { get } from '../../get/index.js';
import { Get as get } from '../../get/index.js'; import { lib } from "../index.js";
import { Game as game } from '../../game/index.js'; import { _status } from '../../status/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';
export class VCard { export class VCard {
/** /**

View File

@ -9,14 +9,13 @@
* @typedef { InstanceType<typeof lib.element.NodeWS> } NodeWS * @typedef { InstanceType<typeof lib.element.NodeWS> } NodeWS
* @typedef { InstanceType<typeof lib.element.Control> } Control * @typedef { InstanceType<typeof lib.element.Control> } Control
*/ */
import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction, characterDefaultPicturePath } from "../util/index.js"; import { nonameInitialized, assetURL, userAgent, GeneratorFunction, AsyncFunction, characterDefaultPicturePath } from "../util/index.js";
import { AI as ai } from '../ai/index.js'; import { ai } from '../ai/index.js';
import { Get as get } from '../get/index.js'; import { get } from '../get/index.js';
import { Game as game } from '../game/index.js'; import { game } from '../game/index.js';
import { status as _status } from '../status/index.js'; import { _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js'; import { ui } from '../ui/index.js';
import { GNC as gnc } from '../gnc/index.js'; import { gnc } from '../gnc/index.js';
import { LibInit } from "./init/index.js"; import { LibInit } from "./init/index.js";
import { Announce } from "./announce/index.js"; import { Announce } from "./announce/index.js";
import { Channel } from "./channel/index.js"; import { Channel } from "./channel/index.js";
@ -27,29 +26,29 @@ import { defaultHooks } from "./hooks/index.js"
import { freezeButExtensible } from "../util/index.js" import { freezeButExtensible } from "../util/index.js"
export class Library extends Uninstantable { export class Library {
static configprefix = 'noname_0.9_'; configprefix = 'noname_0.9_';
static versionOL = 27; versionOL = 27;
static updateURLS = updateURLs; updateURLS = updateURLs;
static updateURL = updateURLs.github; updateURL = updateURLs.github;
static mirrorURL = updateURLs.coding; mirrorURL = updateURLs.coding;
static hallURL = '47.99.105.222'; hallURL = '47.99.105.222';
static assetURL = assetURL; assetURL = assetURL;
static userAgent = userAgent; userAgent = userAgent;
static characterDefaultPicturePath = characterDefaultPicturePath; characterDefaultPicturePath = characterDefaultPicturePath;
static compatibleEdition = Boolean(typeof nonameInitialized == 'string' && nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//)); compatibleEdition = Boolean(typeof nonameInitialized == 'string' && nonameInitialized.match(/\/(?:com\.widget|yuri\.nakamura)\.noname\//));
static changeLog = []; changeLog = [];
static updates = []; updates = [];
static canvasUpdates = []; canvasUpdates = [];
/** /**
* @type { Video[] } * @type { Video[] }
*/ */
static video = []; video = [];
static skilllist = []; skilllist = [];
static connectBanned = []; connectBanned = [];
static characterIntro = {}; characterIntro = {};
static characterTitle = {}; characterTitle = {};
static characterPack = new Proxy({}, { characterPack = new Proxy({}, {
set(target, prop, newValue) { set(target, prop, newValue) {
if (typeof prop == 'string') { if (typeof prop == 'string') {
// 新增武将包,且不是“收藏”和“禁用” // 新增武将包,且不是“收藏”和“禁用”
@ -62,14 +61,14 @@ export class Library extends Uninstantable {
return Reflect.set(target, prop, newValue); return Reflect.set(target, prop, newValue);
} }
}); });
static characterFilter = {}; characterFilter = {};
static characterSort = {}; characterSort = {};
static characterReplace = {}; characterReplace = {};
static characterSubstitute = {}; characterSubstitute = {};
static characterInitFilter = {}; characterInitFilter = {};
static characterGuozhanFilter = ["mode_guozhan"]; characterGuozhanFilter = ["mode_guozhan"];
static dynamicTranslate = {}; dynamicTranslate = {};
static cardPack = new Proxy({}, { cardPack = new Proxy({}, {
set(target, prop, newValue) { set(target, prop, newValue) {
if (typeof prop == 'string') { if (typeof prop == 'string') {
if (!Reflect.has(target, prop)) { if (!Reflect.has(target, prop)) {
@ -81,19 +80,19 @@ export class Library extends Uninstantable {
return Reflect.set(target, prop, newValue); return Reflect.set(target, prop, newValue);
} }
}); });
static cardPackInfo = {}; cardPackInfo = {};
/** /**
* @type { SMap<number> } * @type { SMap<number> }
*/ */
static skin = {}; skin = {};
static onresize = []; onresize = [];
static onphase = []; onphase = [];
static onwash = []; onwash = [];
static onover = []; onover = [];
static ondb = []; ondb = [];
static ondb2 = []; ondb2 = [];
static chatHistory = []; chatHistory = [];
static emotionList = { emotionList = {
xiaowu_emotion: 14, xiaowu_emotion: 14,
xiaokuo_emotion: 8, xiaokuo_emotion: 8,
shibing_emotion: 15, shibing_emotion: 15,
@ -103,37 +102,37 @@ export class Library extends Uninstantable {
xiaotao_emotion: 20, xiaotao_emotion: 20,
xiaojiu_emotion: 20, xiaojiu_emotion: 20,
}; };
static animate = { animate = {
skill: {}, skill: {},
card: {}, card: {},
}; };
static onload = []; onload = [];
static onload2 = []; onload2 = [];
static onprepare = []; onprepare = [];
static arenaReady = []; arenaReady = [];
static onfree = []; onfree = [];
static inpile = []; inpile = [];
static inpile_nature = []; inpile_nature = [];
static extensions = []; extensions = [];
static extensionPack = {}; extensionPack = {};
static cardType = {}; cardType = {};
static hook = { globalskill: {} }; hook = { globalskill: {} };
/** /**
* @type { Player | undefined } * @type { Player | undefined }
*/ */
static tempSortSeat; tempSortSeat;
/** /**
* @type { 'android' | 'ios' | undefined } * @type { 'android' | 'ios' | undefined }
*/ */
static device; device;
/** /**
* @type { string } * @type { string }
*/ */
static version; version;
/** /**
* @type { Videos[] } * @type { Videos[] }
*/ */
static videos; videos;
/** /**
* @type { { * @type { {
* fs: typeof import("fs"), * fs: typeof import("fs"),
@ -146,22 +145,22 @@ export class Library extends Uninstantable {
* torespondtimeout:{}, * torespondtimeout:{},
* } } * } }
*/ */
static node; node;
/** /**
* @type { { [key: string]: string } } * @type { { [key: string]: string } }
*/ */
static playerOL; playerOL;
/** /**
* @type { IDBRequest<IDBDatabase> } * @type { IDBRequest<IDBDatabase> }
*/ */
static db; db;
//函数钩子 //函数钩子
/** /**
* 你可以往这里加入{钩子名:函数数组}并在数组里增加你的自定义函数 * 你可以往这里加入{钩子名:函数数组}并在数组里增加你的自定义函数
* 这样当某个地方调用game.callHook(钩子名,[...函数参数])就会按顺序将对应数组中的每个函数运行一遍传参为callHook的第二个参数 * 这样当某个地方调用game.callHook(钩子名,[...函数参数])就会按顺序将对应数组中的每个函数运行一遍传参为callHook的第二个参数
* 你可以将hook机制类比为event.trigger()但是这里只能放同步代码 * 你可以将hook机制类比为event.trigger()但是这里只能放同步代码
*/ */
static hooks = freezeButExtensible({ ...defaultHooks }); hooks = freezeButExtensible({ ...defaultHooks });
/** /**
* **无名杀频道推送机制** * **无名杀频道推送机制**
@ -184,7 +183,7 @@ export class Library extends Uninstantable {
* // 从某个角落向channel发消息若无消息接收则等待 * // 从某个角落向channel发消息若无消息接收则等待
* await channel.send(item); * await channel.send(item);
*/ */
static channel = Channel; channel = Channel;
/** /**
* **无名杀消息推送库** * **无名杀消息推送库**
@ -211,13 +210,13 @@ export class Library extends Uninstantable {
* // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅 * // 若此时乙扩展不想继续订阅`skinChange`事件,可以通过`unsubscribe`解除订阅
* lib.announce.unsubscribe("skinChange", method); * lib.announce.unsubscribe("skinChange", method);
*/ */
static announce = new Announce(new EventTarget(), new WeakMap()); announce = new Announce(new EventTarget(), new WeakMap());
static objectURL = new Map(); objectURL = new Map();
static hookmap = {}; hookmap = {};
static imported = {}; imported = {};
static layoutfixed = ['chess', 'tafang', 'stone']; layoutfixed = ['chess', 'tafang', 'stone'];
static pinyins = { pinyins = {
_metadata: { _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'], 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'], special_shengmu: ['j', 'q', 'x', 'y'],
@ -250,7 +249,7 @@ export class Library extends Uninstantable {
* *
* 应变 * 应变
*/ */
static yingbian = { yingbian = {
condition: { condition: {
color: new Map([ color: new Map([
['zhuzhan', 'wood'], ['zhuzhan', 'wood'],
@ -426,7 +425,7 @@ export class Library extends Uninstantable {
* *
* 谋攻强化 * 谋攻强化
*/ */
static stratagemBuff = { stratagemBuff = {
cost: new Map([ cost: new Map([
['sha', 1], ['sha', 1],
['shan', 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) { '收藏': function (name, capt) {
return lib.config.favouriteCharacter.includes(name) ? capt : null; return lib.config.favouriteCharacter.includes(name) ? capt : null;
}, },
@ -529,7 +528,7 @@ export class Library extends Uninstantable {
return list.includes(name) ? capt : null; return list.includes(name) ? capt : null;
} }
}; };
static listenEnd(node) { listenEnd(node) {
if (!node._listeningEnd) { if (!node._listeningEnd) {
node._listeningEnd = true; node._listeningEnd = true;
node.listenTransition(function () { node.listenTransition(function () {
@ -544,7 +543,7 @@ export class Library extends Uninstantable {
}); });
} }
} }
static configMenu = { configMenu = {
general: { general: {
name: '通用', name: '通用',
config: { config: {
@ -4480,7 +4479,7 @@ export class Library extends Uninstantable {
} }
} }
}; };
static extensionMenu = { extensionMenu = {
cardpile: { cardpile: {
enable: { enable: {
name: '开启', name: '开启',
@ -4794,7 +4793,7 @@ export class Library extends Uninstantable {
}, },
}, },
}; };
static mode = { mode = {
identity: { identity: {
name: '身份', name: '身份',
connect: { connect: {
@ -7482,7 +7481,7 @@ export class Library extends Uninstantable {
} }
}, },
}; };
static status = { status = {
running: false, running: false,
canvas: false, canvas: false,
time: 0, time: 0,
@ -7492,7 +7491,7 @@ export class Library extends Uninstantable {
videoId: 0, videoId: 0,
globalId: 0, globalId: 0,
}; };
static help = { help = {
'关于游戏': '<div style="margin:10px">关于无名杀</div><ul style="margin-top:0"><li>无名杀官方发布地址仅有GitHub仓库<br><a href="https://github.com/libccy/noname">点击前往Github仓库</a><br><li>无名杀基于GPLv3开源协议。<br><a href="https://www.gnu.org/licenses/gpl-3.0.html">点击查看GPLv3协议</a><br><li>其他所有的所谓“无名杀”社群包括但不限于绝大多数“官方”QQ群、QQ频道等均为玩家自发组织与无名杀官方无关', '关于游戏': '<div style="margin:10px">关于无名杀</div><ul style="margin-top:0"><li>无名杀官方发布地址仅有GitHub仓库<br><a href="https://github.com/libccy/noname">点击前往Github仓库</a><br><li>无名杀基于GPLv3开源协议。<br><a href="https://www.gnu.org/licenses/gpl-3.0.html">点击查看GPLv3协议</a><br><li>其他所有的所谓“无名杀”社群包括但不限于绝大多数“官方”QQ群、QQ频道等均为玩家自发组织与无名杀官方无关',
'游戏操作': '<ul><li>长按/鼠标悬停/右键单击显示信息。<li>触屏模式中,双指点击切换暂停;下划显示菜单,上划切换托管。<li>键盘快捷键<br>' + '游戏操作': '<ul><li>长按/鼠标悬停/右键单击显示信息。<li>触屏模式中,双指点击切换暂停;下划显示菜单,上划切换托管。<li>键盘快捷键<br>' +
'<table><tr><td>A<td>切换托管<tr><td>W<td>切换不询问无懈<tr><td>空格<td>暂停</table><li>编辑牌堆<br>在卡牌包中修改牌堆后,将自动创建一个临时牌堆,在所有模式中共用,当保存当前牌堆后,临时牌堆被清除。每个模式可设置不同的已保存牌堆,设置的牌堆优先级大于临时牌堆。</ul>', '<table><tr><td>A<td>切换托管<tr><td>W<td>切换不询问无懈<tr><td>空格<td>暂停</table><li>编辑牌堆<br>在卡牌包中修改牌堆后,将自动创建一个临时牌堆,在所有模式中共用,当保存当前牌堆后,临时牌堆被清除。每个模式可设置不同的已保存牌堆,设置的牌堆优先级大于临时牌堆。</ul>',
@ -7529,8 +7528,8 @@ export class Library extends Uninstantable {
* @type {import('path')} * @type {import('path')}
*/ */
// @ts-ignore // @ts-ignore
static path = {}; path = {};
static getErrorTip(msg) { getErrorTip(msg) {
if (typeof msg != 'string') { if (typeof msg != 'string') {
try { try {
msg = msg.toString(); msg = msg.toString();
@ -7672,7 +7671,7 @@ export class Library extends Uninstantable {
return newMessage; return newMessage;
} }
} }
static codeMirrorReady(node, editor) { codeMirrorReady(node, editor) {
ui.window.appendChild(node); ui.window.appendChild(node);
node.style.fontSize = 20 / game.documentZoom + 'px'; node.style.fontSize = 20 / game.documentZoom + 'px';
const mirror = window.CodeMirror(editor, { const mirror = window.CodeMirror(editor, {
@ -7893,7 +7892,7 @@ export class Library extends Uninstantable {
return found.sort((a, b) => (a + '').localeCompare(b + '')); return found.sort((a, b) => (a + '').localeCompare(b + ''));
} }
} }
static setIntro(node, func, left) { setIntro(node, func, left) {
if (lib.config.touchscreen) { if (lib.config.touchscreen) {
if (left) { if (left) {
node.listen(ui.click.touchintro); node.listen(ui.click.touchintro);
@ -7920,7 +7919,7 @@ export class Library extends Uninstantable {
node._customintro = func; node._customintro = func;
} }
} }
static setPopped(node, func, width, height, forceclick, paused2) { setPopped(node, func, width, height, forceclick, paused2) {
node._poppedfunc = func; node._poppedfunc = func;
node._poppedwidth = width; node._poppedwidth = width;
node._poppedheight = height; node._poppedheight = height;
@ -7938,7 +7937,7 @@ export class Library extends Uninstantable {
node._paused2 = true; node._paused2 = true;
} }
} }
static placePoppedDialog(dialog, e) { placePoppedDialog(dialog, e) {
if (dialog._place_text) { if (dialog._place_text) {
if (dialog._place_text.firstChild.offsetWidth >= 190 || dialog._place_text.firstChild.offsetHeight >= 30) { if (dialog._place_text.firstChild.offsetWidth >= 190 || dialog._place_text.firstChild.offsetHeight >= 30) {
dialog._place_text.style.marginLeft = '14px'; dialog._place_text.style.marginLeft = '14px';
@ -7970,7 +7969,7 @@ export class Library extends Uninstantable {
} }
dialog.style.top = idealtop + 'px'; dialog.style.top = idealtop + 'px';
} }
static setHover(node, func, hoveration, width) { setHover(node, func, hoveration, width) {
node._hoverfunc = func; node._hoverfunc = func;
if (typeof hoveration == 'number') { if (typeof hoveration == 'number') {
node._hoveration = hoveration; node._hoveration = hoveration;
@ -7984,22 +7983,22 @@ export class Library extends Uninstantable {
node.addEventListener('mousemove', ui.click.mousemove); node.addEventListener('mousemove', ui.click.mousemove);
return node; return node;
} }
static setScroll(node) { setScroll(node) {
node.ontouchstart = ui.click.touchStart; node.ontouchstart = ui.click.touchStart;
node.ontouchmove = ui.click.touchScroll; node.ontouchmove = ui.click.touchScroll;
node.style.webkitOverflowScrolling = 'touch'; node.style.webkitOverflowScrolling = 'touch';
return node; return node;
} }
static setMousewheel(node) { setMousewheel(node) {
if (lib.config.mousewheel) node.onmousewheel = ui.click.mousewheel; if (lib.config.mousewheel) node.onmousewheel = ui.click.mousewheel;
} }
static setLongPress(node, func) { setLongPress(node, func) {
node.addEventListener('touchstart', ui.click.longpressdown); node.addEventListener('touchstart', ui.click.longpressdown);
node.addEventListener('touchend', ui.click.longpresscancel); node.addEventListener('touchend', ui.click.longpresscancel);
node._longpresscallback = func; node._longpresscallback = func;
return node; return node;
} }
static updateCanvas(time) { updateCanvas(time) {
if (lib.canvasUpdates.length === 0) { if (lib.canvasUpdates.length === 0) {
lib.status.canvas = false; lib.status.canvas = false;
return false; return false;
@ -8025,7 +8024,7 @@ export class Library extends Uninstantable {
} }
} }
} }
static run(time) { run(time) {
lib.status.time = time; lib.status.time = time;
for (var i = 0; i < lib.updates.length; i++) { for (var i = 0; i < lib.updates.length; i++) {
if (!('_time' in lib.updates[i])) { if (!('_time' in lib.updates[i])) {
@ -8043,18 +8042,18 @@ export class Library extends Uninstantable {
lib.status.delayed = 0; lib.status.delayed = 0;
} }
} }
static getUTC(date) { getUTC(date) {
return date.getTime(); return date.getTime();
} }
static saveVideo() { saveVideo() {
if (_status.videoToSave) { if (_status.videoToSave) {
game.export(lib.init.encode(JSON.stringify(_status.videoToSave)), game.export(lib.init.encode(JSON.stringify(_status.videoToSave)),
'无名杀 - 录像 - ' + _status.videoToSave.name[0] + ' - ' + _status.videoToSave.name[1]); '无名杀 - 录像 - ' + _status.videoToSave.name[0] + ' - ' + _status.videoToSave.name[1]);
} }
} }
static genAsync(fn) { return gnc.of(fn); } 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); } genAwait(item) { return gnc.is.generator(item) ? gnc.of(function* () { for (const content of item) { yield content; } })() : Promise.resolve(item); }
static gnc = { gnc = {
of: fn => gnc.of(fn), of: fn => gnc.of(fn),
is: { is: {
coroutine: item => gnc.is.coroutine(item), coroutine: item => gnc.is.coroutine(item),
@ -8062,7 +8061,7 @@ export class Library extends Uninstantable {
generator: item => gnc.is.generator(item) generator: item => gnc.is.generator(item)
} }
}; };
static comparator = { comparator = {
equals: function () { equals: function () {
if (arguments.length == 0) return false; if (arguments.length == 0) return false;
if (arguments.length == 1) return true; if (arguments.length == 1) return true;
@ -8095,7 +8094,7 @@ export class Library extends Uninstantable {
return true; return true;
} }
}; };
static creation = { creation = {
get array() { get array() {
return []; return [];
}, },
@ -8109,7 +8108,7 @@ export class Library extends Uninstantable {
return ""; return "";
} }
}; };
static linq = { linq = {
cselector: { cselector: {
hasAttr: name => `[${name}]`, hasAttr: name => `[${name}]`,
isAttr: (name, item) => `[${name}=${item}]`, isAttr: (name, item) => `[${name}=${item}]`,
@ -8214,8 +8213,8 @@ export class Library extends Uninstantable {
} }
} }
}; };
static init = LibInit; init = new LibInit();
static cheat = { cheat = {
/** /**
* 将游戏内部的对象暴露到全局中 * 将游戏内部的对象暴露到全局中
* *
@ -9096,7 +9095,7 @@ export class Library extends Uninstantable {
game.zhu.update(); game.zhu.update();
}, },
}; };
static translate = { translate = {
flower: '鲜花', flower: '鲜花',
egg: '鸡蛋', egg: '鸡蛋',
wine: '酒杯', wine: '酒杯',
@ -9322,9 +9321,9 @@ export class Library extends Uninstantable {
phaseJieshu: '结束阶段', phaseJieshu: '结束阶段',
}; };
static experimental = Experimental experimental = Experimental
static element = { element = {
content: Element.Content, content: Element.Content,
contents: Element.Contents, contents: Element.Contents,
Player: Element.Player, Player: Element.Player,
@ -9448,7 +9447,7 @@ export class Library extends Uninstantable {
return this.NodeWS.prototype; return this.NodeWS.prototype;
} }
}; };
static card = { card = {
list: [], list: [],
cooperation_damage: { cooperation_damage: {
fullskin: true, fullskin: true,
@ -9553,7 +9552,7 @@ export class Library extends Uninstantable {
fullimage: true, fullimage: true,
}, },
}; };
static filter = { filter = {
all: () => true, all: () => true,
none: () => false, none: () => false,
/** /**
@ -10100,7 +10099,7 @@ export class Library extends Uninstantable {
} }
} }
}; };
static sort = { sort = {
nature: function (a, b) { nature: function (a, b) {
return (lib.nature.get(b) || 0) - (lib.nature.get(a) || 0); return (lib.nature.get(b) || 0) - (lib.nature.get(a) || 0);
}, },
@ -10276,7 +10275,7 @@ export class Library extends Uninstantable {
* [key: string]: Skill; * [key: string]: Skill;
* }} * }}
*/ */
static skill = { skill = {
stratagem_fury: { stratagem_fury: {
marktext: '🔥', marktext: '🔥',
intro: { intro: {
@ -11678,10 +11677,10 @@ export class Library extends Uninstantable {
} }
} }
}; };
static character = {}; character = {};
static perfectPair = {}; perfectPair = {};
static cardPile = {}; cardPile = {};
static message = { message = {
server: { server: {
/** @this { any } */ /** @this { any } */
init(version, config, banned_info) { init(version, config, banned_info) {
@ -12776,16 +12775,16 @@ export class Library extends Uninstantable {
} }
} }
}; };
static suit = ['club', 'spade', 'diamond', 'heart']; suit = ['club', 'spade', 'diamond', 'heart'];
static suits = ['club', 'spade', 'diamond', 'heart', 'none']; suits = ['club', 'spade', 'diamond', 'heart', 'none'];
static color = { color = {
black: ['club', 'spade'], black: ['club', 'spade'],
red: ['diamond', 'heart'], red: ['diamond', 'heart'],
none: ['none'], 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], ['fire', 20],
['thunder', 30], ['thunder', 30],
['kami', 60], ['kami', 60],
@ -12793,7 +12792,7 @@ export class Library extends Uninstantable {
['stab', 10], ['stab', 10],
['poison', 50] ['poison', 50]
]); ]);
static natureAudio = { natureAudio = {
damage: { damage: {
'fire': 'default',//默认即语音放置在audio/effect下以damage_fire.mp3 damage_fire2.mp3命名。 'fire': 'default',//默认即语音放置在audio/effect下以damage_fire.mp3 damage_fire2.mp3命名。
'thunder': 'default', 'thunder': 'default',
@ -12832,12 +12831,12 @@ export class Library extends Uninstantable {
*/ */
} }
}; };
static linked = ['fire', 'thunder', 'kami', 'ice']; linked = ['fire', 'thunder', 'kami', 'ice'];
static natureBg = new Map([ natureBg = new Map([
['stab', 'image/card/cisha.png'] ['stab', 'image/card/cisha.png']
]); ]);
static natureSeparator = '|'; natureSeparator = '|';
static namePrefix = new Map([ namePrefix = new Map([
['界', { ['界', {
color: '#fdd559', color: '#fdd559',
nature: 'soilmm', nature: 'soilmm',
@ -13122,7 +13121,7 @@ export class Library extends Uninstantable {
getSpan: () => `${get.prefixSpan('旧')}${get.prefixSpan('谋')}` getSpan: () => `${get.prefixSpan('旧')}${get.prefixSpan('谋')}`
}] }]
]); ]);
static groupnature = { groupnature = {
shen: 'shen', shen: 'shen',
wei: 'water', wei: 'water',
shu: 'soil', shu: 'soil',
@ -13133,7 +13132,7 @@ export class Library extends Uninstantable {
jin: 'thunder', jin: 'thunder',
ye: 'thunder', ye: 'thunder',
}; };
static lineColor = new Map([ lineColor = new Map([
['fire', [255, 146, 68]], ['fire', [255, 146, 68]],
['yellow', [255, 255, 122]], ['yellow', [255, 255, 122]],
['blue', [150, 202, 255]], ['blue', [150, 202, 255]],
@ -13146,8 +13145,8 @@ export class Library extends Uninstantable {
['brown', [195, 161, 223]], ['brown', [195, 161, 223]],
['legend', [233, 131, 255]] ['legend', [233, 131, 255]]
]); ]);
static phaseName = ['phaseZhunbei', 'phaseJudge', 'phaseDraw', 'phaseUse', 'phaseDiscard', 'phaseJieshu']; phaseName = ['phaseZhunbei', 'phaseJudge', 'phaseDraw', 'phaseUse', 'phaseDiscard', 'phaseJieshu'];
static quickVoice = [ quickVoice = [
'我从未见过如此厚颜无耻之人!', '我从未见过如此厚颜无耻之人!',
'这波不亏', '这波不亏',
'请收下我的膝盖', '请收下我的膝盖',
@ -13172,19 +13171,29 @@ export class Library extends Uninstantable {
'哥哥,交个朋友吧', '哥哥,交个朋友吧',
'妹子,交个朋友吧', '妹子,交个朋友吧',
]; ];
static other = { other = {
ignore: () => void 0 ignore: () => void 0
}; };
static InitFilter = { InitFilter = {
'noZhuHp': '不享受主公的额外体力上限', 'noZhuHp': '不享受主公的额外体力上限',
'noZhuSkill': '不享受地主的额外技能', 'noZhuSkill': '不享受地主的额外技能',
}; };
} }
Library.config = undefined; Library.prototype.config = undefined;
Library.configOL = undefined; Library.prototype.configOL = undefined;
export const lib = Library; export let lib = new Library();
/**
* @param { InstanceType<typeof Library> } [instance]
*/
export let setLibrary = (instance) => {
lib = instance || new Library();
if (lib.config.dev) {
window.lib = lib;
}
};
/** /**
* @template T * @template T

View File

@ -1,27 +1,26 @@
import { nonameInitialized, assetURL, userAgent, Uninstantable, GeneratorFunction, AsyncFunction } from "../../util/index.js"; import { GeneratorFunction } from "../../util/index.js";
import { AI as ai } from '../../ai/index.js' import { get } from '../../get/index.js'
import { Get as get } from '../../get/index.js' import { game } from '../../game/index.js'
import { Game, Game as game } from '../../game/index.js' import { lib } from "../index.js"
import { Library as lib } from "../index.js" import { _status } from '../../status/index.js'
import { status as _status } from '../../status/index.js' import { ui } from '../../ui/index.js'
import { UI as ui } from '../../ui/index.js' import { gnc } from '../../gnc/index.js'
import { GNC as gnc } from '../../gnc/index.js'
import { LibInitPromises } from "./promises.js" import { LibInitPromises } from "./promises.js"
import { GameEvent } from "../element/gameEvent.js" import { GameEvent } from "../element/gameEvent.js"
import { GameEventPromise } from "../element/gameEventPromise.js" import { GameEventPromise } from "../element/gameEventPromise.js"
export class LibInit extends Uninstantable { export class LibInit {
/** /**
* 部分函数的Promise版本 * 部分函数的Promise版本
*/ */
static promises = LibInitPromises promises = new LibInitPromises()
static init() { init() {
throw new Error('lib.init.init is moved to noname/init') throw new Error('lib.init.init is moved to noname/init')
} }
static reset() { reset() {
if (window.inSplash) return; if (window.inSplash) return;
if (window.resetExtension) { if (window.resetExtension) {
if (confirm('游戏似乎未正常载入,有可能因为部分扩展未正常载入,或者因为部分扩展未载入完毕。\n是否禁用扩展并重新打开')) { if (confirm('游戏似乎未正常载入,有可能因为部分扩展未正常载入,或者因为部分扩展未载入完毕。\n是否禁用扩展并重新打开')) {
@ -83,11 +82,11 @@ export class LibInit extends Uninstantable {
} }
// 现在改lib.init.onload的都给我无报错被创 // 现在改lib.init.onload的都给我无报错被创
static async onload() { async onload() {
throw new Error('lib.init.onload is moved to noname/init/onload') throw new Error('lib.init.onload is moved to noname/init/onload')
} }
static startOnline() { startOnline() {
'step 0' 'step 0'
event._resultid = null; event._resultid = null;
event._result = null; event._result = null;
@ -102,7 +101,7 @@ export class LibInit extends Uninstantable {
event.goto(0); event.goto(0);
} }
static onfree() { onfree() {
if (lib.onfree) { if (lib.onfree) {
clearTimeout(window.resetGameTimeout); clearTimeout(window.resetGameTimeout);
delete 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); const client = new lib.element.Client(ws);
lib.node.clients.push(client); lib.node.clients.push(client);
if (window.isNonameServer) { if (window.isNonameServer) {
@ -162,7 +161,7 @@ export class LibInit extends Uninstantable {
client.send('opened'); client.send('opened');
} }
static sheet() { sheet() {
var style = document.createElement('style'); var style = document.createElement('style');
document.head.appendChild(style); document.head.appendChild(style);
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
@ -173,7 +172,7 @@ export class LibInit extends Uninstantable {
return style; return style;
} }
static css(path, file, before) { css(path, file, before) {
const style = document.createElement("link"); const style = document.createElement("link");
style.rel = "stylesheet"; style.rel = "stylesheet";
if (path) { if (path) {
@ -195,7 +194,7 @@ export class LibInit extends Uninstantable {
//在扩展的precontent中调用用于加载扩展必需的JS文件。 //在扩展的precontent中调用用于加载扩展必需的JS文件。
//If any of the parameters is an Array, corresponding files will be loaded in order //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 = []; if (!_status.javaScriptExtensions) _status.javaScriptExtensions = [];
_status.javaScriptExtensions.push({ _status.javaScriptExtensions.push({
path: path, 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[path.length - 1] == '/') path = path.slice(0, path.length - 1);
if (path == `${lib.assetURL}mode` && lib.config.all.stockmode.indexOf(file) == -1) { if (path == `${lib.assetURL}mode` && lib.config.all.stockmode.indexOf(file) == -1) {
lib.genAwait(lib.init[`setMode_${file}`]()).then(onLoad); lib.genAwait(lib.init[`setMode_${file}`]()).then(onLoad);
@ -243,7 +242,7 @@ export class LibInit extends Uninstantable {
* 同步lib.init.js * 同步lib.init.js
* @returns { void } * @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') { if (lib.assetURL.length == 0 && location.origin == 'file://' && typeof game.readFile == 'undefined') {
const e = new Error('浏览器file协议下无法使用此api请在http/https协议下使用此api'); const e = new Error('浏览器file协议下无法使用此api请在http/https协议下使用此api');
if (typeof onError == 'function') onError(e); if (typeof onError == 'function') onError(e);
@ -292,7 +291,7 @@ export class LibInit extends Uninstantable {
xmlHttpRequest.send(); xmlHttpRequest.send();
} }
static req(str, onload, onerror, master) { req(str, onload, onerror, master) {
let sScriptURL; let sScriptURL;
if (str.startsWith('http')) sScriptURL = str; if (str.startsWith('http')) sScriptURL = str;
else if (str.startsWith('local:')) { else if (str.startsWith('local:')) {
@ -326,7 +325,7 @@ export class LibInit extends Uninstantable {
/** /**
* 同步lib.init.req * 同步lib.init.req
*/ */
static reqSync(str, onload, onerror, master) { reqSync(str, onload, onerror, master) {
let sScriptURL; let sScriptURL;
if (str.startsWith('http')) sScriptURL = str; if (str.startsWith('http')) sScriptURL = str;
else if (str.startsWith('local:')) { else if (str.startsWith('local:')) {
@ -358,7 +357,7 @@ export class LibInit extends Uninstantable {
if (typeof onload !== 'function') return oReq.responseText; if (typeof onload !== 'function') return oReq.responseText;
} }
static json(url, onload, onerror) { json(url, onload, onerror) {
const oReq = new XMLHttpRequest(); const oReq = new XMLHttpRequest();
if (typeof onload == 'function') oReq.addEventListener("load", () => { if (typeof onload == 'function') oReq.addEventListener("load", () => {
if (![0, 200].includes(oReq.status)) { if (![0, 200].includes(oReq.status)) {
@ -385,7 +384,7 @@ export class LibInit extends Uninstantable {
/** /**
* 同步lib.init.json * 同步lib.init.json
*/ */
static jsonSync(url, onload, onerror) { jsonSync(url, onload, onerror) {
if (lib.assetURL.length == 0 && location.origin == 'file://' && typeof game.readFile == 'undefined') { if (lib.assetURL.length == 0 && location.origin == 'file://' && typeof game.readFile == 'undefined') {
const e = new Error('浏览器file协议下无法使用此api请在http/https协议下使用此api'); const e = new Error('浏览器file协议下无法使用此api请在http/https协议下使用此api');
if (typeof onerror == 'function') onerror(e); if (typeof onerror == 'function') onerror(e);
@ -415,7 +414,7 @@ export class LibInit extends Uninstantable {
oReq.send(); oReq.send();
} }
static cssstyles() { cssstyles() {
if (ui.css.styles) { if (ui.css.styles) {
ui.css.styles.remove(); 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; const loadingScreen = ui.create.div('.loading-screen', document.body), loadingScreenStyle = loadingScreen.style;
loadingScreenStyle.animationDuration = '1s'; loadingScreenStyle.animationDuration = '1s';
loadingScreenStyle.animationFillMode = 'forwards'; loadingScreenStyle.animationFillMode = 'forwards';
@ -558,7 +557,7 @@ export class LibInit extends Uninstantable {
}); });
} }
static background() { background() {
if (lib.config.image_background_random) { if (lib.config.image_background_random) {
var list = []; var list = [];
for (var i in lib.configMenu.appearence.config.image_background.item) { for (var i in lib.configMenu.appearence.config.image_background.item) {
@ -585,7 +584,7 @@ export class LibInit extends Uninstantable {
* @param {Function} [scope] 作用域 * @param {Function} [scope] 作用域
* @returns * @returns
*/ */
static parsex(item, scope) { parsex(item, scope) {
//by 诗笺、Tipx-L //by 诗笺、Tipx-L
/** /**
* @param {Function} func * @param {Function} func
@ -748,7 +747,7 @@ export class LibInit extends Uninstantable {
} }
} }
static eval(func) { eval(func) {
if (typeof func == 'function') { if (typeof func == 'function') {
return eval('(' + func.toString() + ')'); return eval('(' + func.toString() + ')');
} }
@ -768,7 +767,7 @@ export class LibInit extends Uninstantable {
return func; return func;
} }
static encode(strUni) { encode(strUni) {
var strUtf = strUni.replace( var strUtf = strUni.replace(
/[\u0080-\u07ff]/g, function (c) { /[\u0080-\u07ff]/g, function (c) {
var cc = c.charCodeAt(0); var cc = c.charCodeAt(0);
@ -782,7 +781,7 @@ export class LibInit extends Uninstantable {
return btoa(strUtf); return btoa(strUtf);
} }
static decode(str) { decode(str) {
var strUtf = atob(str); var strUtf = atob(str);
var strUni = strUtf.replace( var strUni = strUtf.replace(
/[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, function (c) { /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g, function (c) {
@ -797,7 +796,7 @@ export class LibInit extends Uninstantable {
return strUni; return strUni;
} }
static stringify(obj) { stringify(obj) {
var str = '{' var str = '{'
for (var i in obj) { for (var i in obj) {
str += '"' + i + '":' str += '"' + i + '":'
@ -816,7 +815,7 @@ export class LibInit extends Uninstantable {
return str; return str;
} }
static stringifySkill(obj) { stringifySkill(obj) {
var str = ''; var str = '';
for (var i in obj) { for (var i in obj) {
str += i + ':' str += i + ':'
@ -838,7 +837,7 @@ export class LibInit extends Uninstantable {
* 在返回当前加载的esm模块相对位置 * 在返回当前加载的esm模块相对位置
* @param {*} url 传入import.meta.url * @param {*} url 传入import.meta.url
*/ */
static getCurrentFileLocation(url){ getCurrentFileLocation(url){
let head = window.location.href.slice(0,window.location.href.lastIndexOf('/')+1); let head = window.location.href.slice(0,window.location.href.lastIndexOf('/')+1);
let ret = url.replace(head,''); let ret = url.replace(head,'');
return decodeURIComponent(ret); return decodeURIComponent(ret);

View File

@ -1,7 +1,6 @@
import { Uninstantable } from "../../util/index.js"; import { lib } from '../../../noname.js';
import { Library as lib } from "../index.js";
export class LibInitPromises extends Uninstantable { export class LibInitPromises {
/** /**
* Promise版的`lib.init.js` * Promise版的`lib.init.js`
* *
@ -9,7 +8,7 @@ export class LibInitPromises extends Uninstantable {
* @param {string | string[]} [file] - 文件名或文件名组忽略则直接读取`path`的内容 * @param {string | string[]} [file] - 文件名或文件名组忽略则直接读取`path`的内容
* @returns {Promise<Event>} * @returns {Promise<Event>}
*/ */
static js(path, file) { js(path, file) {
return new Promise((resolve, reject) => lib.init.js(path, file, resolve, reject)) 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] - 是否忽略报错 * @param {boolean} [noerror = false] - 是否忽略报错
* @returns {Promise<HTMLLinkElement>} * @returns {Promise<HTMLLinkElement>}
*/ */
static css(path, file, before, noerror = false) { css(path, file, before, noerror = false) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const style = lib.init.css(path, file, before); const style = lib.init.css(path, file, before);
const success = () => resolve(style); const success = () => resolve(style);
@ -38,7 +37,7 @@ export class LibInitPromises extends Uninstantable {
* @param {string} [master] * @param {string} [master]
* @returns {Promise<ProgressEvent>} * @returns {Promise<ProgressEvent>}
*/ */
static req(str, master) { req(str, master) {
return new Promise((resolve, reject) => lib.init.req(str, resolve, reject, 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 - 要读取的地址 * @param {string} url - 要读取的地址
* @returns {Promise<object>} * @returns {Promise<object>}
*/ */
static json(url) { json(url) {
return new Promise((resolve, reject) => lib.init.json(url, resolve, reject)) return new Promise((resolve, reject) => lib.init.json(url, resolve, reject))
} }
@ -57,7 +56,7 @@ export class LibInitPromises extends Uninstantable {
* *
* @returns {Promise<HTMLStyleElement>} * @returns {Promise<HTMLStyleElement>}
*/ */
static sheet() { sheet() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const style = lib.init.sheet.apply(lib.init, arguments); const style = lib.init.sheet.apply(lib.init, arguments);
style.addEventListener("load", () => resolve(style)); style.addEventListener("load", () => resolve(style));

View File

@ -1,58 +1,69 @@
export const status = { import { lib } from "../library/index.js"
paused: false,
paused2: false, export class status {
paused3: false, paused = false
over: false, paused2 = false
clicked: false, paused3 = false
auto: false, over = false
clicked = false
auto = false
/** /**
* @type { GameEventPromise } * @type { GameEventPromise }
*/ */
// @ts-ignore // @ts-ignore
event: null, event = null
ai: {}, ai = {}
lastdragchange: [], lastdragchange = []
skillaudio: [], skillaudio = []
dieClose: [], dieClose = []
dragline: [], dragline = []
dying: [], dying = []
/** /**
* @type { GameHistory[] } * @type { GameHistory[] }
*/ */
globalHistory: [{ globalHistory = [{
// @ts-ignore
cardMove: [], cardMove: [],
custom: [], custom: [],
useCard: [], useCard: [],
changeHp: [], changeHp: [],
everything: [], everything: [],
}], }]
cardtag: { cardtag = {
yingbian_zhuzhan: [], yingbian_zhuzhan: [],
yingbian_kongchao: [], yingbian_kongchao: [],
yingbian_fujia: [], yingbian_fujia: [],
yingbian_canqu: [], yingbian_canqu: [],
yingbian_force: [] yingbian_force: []
}, }
renku: [], renku = []
prehidden_skills: [], prehidden_skills = []
postReconnect: {}, postReconnect = {}
/** /**
* @type { string | void } * @type { string | void }
*/ */
extension: undefined, extension = undefined
/** /**
* @type { boolean | void } * @type { boolean | void }
*/ */
dragged: undefined, dragged = undefined
/** /**
* @type { boolean | void } * @type { boolean | void }
*/ */
touchconfirmed: undefined, touchconfirmed = undefined
/** /**
* @type { boolean | void } * @type { boolean | void }
*/ */
connectMode: undefined, connectMode = undefined
}; };
export const _status = status; export let _status = new status();
/**
* @param { InstanceType<typeof status> } [instance]
*/
export let setStatus = (instance) => {
_status = instance || new status();
if (lib.config.dev) {
window._status = _status;
}
};

View File

@ -1,16 +1,19 @@
import { ui, game, get, lib, _status } from "../../../noname.js"; import { ui } from '../index.js';
import { Uninstantable } from "../../util/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} * @type {() => void}
*/ */
static consoleMenu; consoleMenu;
/** /**
* @type {(arg0: string) => void} * @type {(arg0: string) => void}
*/ */
static menuTab; menuTab;
static identitycircle() { identitycircle() {
var list = []; var list = [];
this.classList.toggle('transparent'); this.classList.toggle('transparent');
for (var i = 0; i < this.parentNode.childNodes.length; i++) { for (var i = 0; i < this.parentNode.childNodes.length; i++) {
@ -35,7 +38,7 @@ export class Click extends Uninstantable {
} }
this._source._guozhanguess = list; this._source._guozhanguess = list;
} }
static connectEvents() { connectEvents() {
if (this.info) { if (this.info) {
var button = this; var button = this;
var layer = ui.create.div('.poplayer', ui.window); var layer = ui.create.div('.poplayer', ui.window);
@ -317,7 +320,7 @@ export class Click extends Uninstantable {
}; };
} }
} }
static connectClients() { connectClients() {
if (this.info) { if (this.info) {
var button = this; var button = this;
var layer = ui.create.div('.poplayer', ui.window); 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; if (!lib.config.change_skin) return;
var players = game.filterPlayer(); var players = game.filterPlayer();
var change = function (player, num, callback) { var change = function (player, num, callback) {
@ -485,7 +488,7 @@ export class Click extends Uninstantable {
}; };
autoskin(); autoskin();
} }
static skin(avatar, name, callback) { skin(avatar, name, callback) {
var num = 1; var num = 1;
if (name.startsWith('gz_')) { if (name.startsWith('gz_')) {
name = name.slice(3); name = name.slice(3);
@ -530,7 +533,7 @@ export class Click extends Uninstantable {
}; };
img.src = lib.assetURL + 'image/skin/' + name + '/' + num + '.jpg'; img.src = lib.assetURL + 'image/skin/' + name + '/' + num + '.jpg';
} }
static touchpop(forced) { touchpop(forced) {
if (lib.config.touchscreen || forced) { if (lib.config.touchscreen || forced) {
_status.touchpopping = true; _status.touchpopping = true;
clearTimeout(_status.touchpoppingtimeout); clearTimeout(_status.touchpoppingtimeout);
@ -539,7 +542,7 @@ export class Click extends Uninstantable {
}, 600); }, 600);
} }
} }
static exit() { exit() {
if (game.servermode && lib.config.reconnect_info && _status.over) { if (game.servermode && lib.config.reconnect_info && _status.over) {
if (!_status.roomtimeout) { if (!_status.roomtimeout) {
lib.config.reconnect_info[2] = game.roomId; lib.config.reconnect_info[2] = game.roomId;
@ -566,7 +569,7 @@ export class Click extends Uninstantable {
game.reload(); game.reload();
} }
} }
static shortcut(show) { shortcut(show) {
if (show === false) { if (show === false) {
ui.shortcut.classList.add('hidden'); ui.shortcut.classList.add('hidden');
} }
@ -600,7 +603,7 @@ export class Click extends Uninstantable {
ui.window.classList.add('shortcutpaused'); ui.window.classList.add('shortcutpaused');
} }
} }
static favouriteCharacter(e) { favouriteCharacter(e) {
if (typeof this.link == 'string') { if (typeof this.link == 'string') {
if (this.innerHTML == '添加收藏') { if (this.innerHTML == '添加收藏') {
this.innerHTML = '移除收藏'; this.innerHTML = '移除收藏';
@ -653,7 +656,7 @@ export class Click extends Uninstantable {
} }
e.stopPropagation(); e.stopPropagation();
} }
static buttonnameenter() { buttonnameenter() {
if (this.buttonscrollinterval) { if (this.buttonscrollinterval) {
clearInterval(this.buttonscrollinterval); clearInterval(this.buttonscrollinterval);
} }
@ -677,7 +680,7 @@ export class Click extends Uninstantable {
}, 16); }, 16);
} }
} }
static buttonnameleave() { buttonnameleave() {
if (this.buttonscrollinterval) { if (this.buttonscrollinterval) {
clearInterval(this.buttonscrollinterval); clearInterval(this.buttonscrollinterval);
} }
@ -695,7 +698,7 @@ export class Click extends Uninstantable {
}, 16); }, 16);
} }
} }
static dragtouchdialog(e) { dragtouchdialog(e) {
if (e.touches.length > 1 && if (e.touches.length > 1 &&
!this.classList.contains('popped') && !this.classList.contains('popped') &&
!this.classList.contains('fixed')) { !this.classList.contains('fixed')) {
@ -712,7 +715,7 @@ export class Click extends Uninstantable {
e.stopPropagation(); e.stopPropagation();
} }
} }
static identity(e) { identity(e) {
if (_status.dragged) return; if (_status.dragged) return;
_status.clicked = true; _status.clicked = true;
if (!game.getIdentityList) return; if (!game.getIdentityList) return;
@ -835,7 +838,7 @@ export class Click extends Uninstantable {
// } // }
} }
} }
static identity2() { identity2() {
if (_status.clickingidentity) { if (_status.clickingidentity) {
_status.clicked = true; _status.clicked = true;
var player = _status.clickingidentity[0]; var player = _status.clickingidentity[0];
@ -849,7 +852,7 @@ export class Click extends Uninstantable {
delete _status.clickingidentity; delete _status.clickingidentity;
} }
} }
static roundmenu() { roundmenu() {
game.closeConnectMenu(); game.closeConnectMenu();
switch (lib.config.round_menu_func) { switch (lib.config.round_menu_func) {
case 'system': case 'system':
@ -877,7 +880,7 @@ export class Click extends Uninstantable {
} }
_status.clicked = true; _status.clicked = true;
} }
static pausehistory() { pausehistory() {
if (!lib.config.auto_popped_history) return; if (!lib.config.auto_popped_history) return;
if (!ui.sidebar.childNodes.length) return; if (!ui.sidebar.childNodes.length) return;
var uiintro = ui.create.dialog('hidden'); var uiintro = ui.create.dialog('hidden');
@ -885,7 +888,7 @@ export class Click extends Uninstantable {
uiintro.add(ui.sidebar); uiintro.add(ui.sidebar);
return uiintro; return uiintro;
} }
static pauseconfig() { pauseconfig() {
if (!lib.config.auto_popped_config) return; if (!lib.config.auto_popped_config) return;
if (get.is.phoneLayout()) return; if (get.is.phoneLayout()) return;
var uiintro = ui.create.dialog('hidden'); var uiintro = ui.create.dialog('hidden');
@ -919,7 +922,7 @@ export class Click extends Uninstantable {
return uiintro; return uiintro;
} }
static cardPileButton() { cardPileButton() {
var uiintro = ui.create.dialog('hidden'); var uiintro = ui.create.dialog('hidden');
uiintro.listen(function (e) { uiintro.listen(function (e) {
e.stopPropagation(); e.stopPropagation();
@ -948,7 +951,7 @@ export class Click extends Uninstantable {
} }
return uiintro; return uiintro;
} }
static chat() { chat() {
ui.system1.classList.add('shown'); ui.system1.classList.add('shown');
ui.system2.classList.add('shown'); ui.system2.classList.add('shown');
@ -1170,7 +1173,7 @@ export class Click extends Uninstantable {
list3.scrollTop = list1.scrollHeight; list3.scrollTop = list1.scrollHeight;
return uiintro; return uiintro;
} }
static volumn() { volumn() {
var uiintro = ui.create.dialog('hidden'); var uiintro = ui.create.dialog('hidden');
uiintro.listen(function (e) { uiintro.listen(function (e) {
e.stopPropagation(); e.stopPropagation();
@ -1209,7 +1212,7 @@ export class Click extends Uninstantable {
uiintro.add(ui.create.div('.placeholder')); uiintro.add(ui.create.div('.placeholder'));
return uiintro; return uiintro;
} }
static volumn_background(e) { volumn_background(e) {
if (_status.dragged) return; if (_status.dragged) return;
var volume = this.link; var volume = this.link;
if (volume === 1 && lib.config.volumn_background === 1) { if (volume === 1 && lib.config.volumn_background === 1) {
@ -1227,7 +1230,7 @@ export class Click extends Uninstantable {
} }
e.stopPropagation(); e.stopPropagation();
} }
static volumn_audio(e) { volumn_audio(e) {
if (_status.dragged) return; if (_status.dragged) return;
var volume = this.link; var volume = this.link;
if (volume === 1 && lib.config.volumn_audio === 1) { if (volume === 1 && lib.config.volumn_audio === 1) {
@ -1244,7 +1247,7 @@ export class Click extends Uninstantable {
} }
e.stopPropagation(); e.stopPropagation();
} }
static hoverpopped() { hoverpopped() {
if (this._uiintro) { if (this._uiintro) {
return; return;
} }
@ -1322,10 +1325,10 @@ export class Click extends Uninstantable {
uiintro.addEventListener('click', clicklayer); uiintro.addEventListener('click', clicklayer);
} }
} }
static hoverpopped_leave() { hoverpopped_leave() {
this._poppedalready = false; this._poppedalready = false;
} }
static leavehoverpopped() { leavehoverpopped() {
if (_status.dragged) return; if (_status.dragged) return;
if (this.classList.contains('noleave')) return; if (this.classList.contains('noleave')) return;
this.delete(); this.delete();
@ -1339,7 +1342,7 @@ export class Click extends Uninstantable {
}, 500); }, 500);
} }
static dierevive() { dierevive() {
if (game.me.isDead()) { if (game.me.isDead()) {
game.me.revive(Math.max(1, game.me.maxHp)); game.me.revive(Math.max(1, game.me.maxHp));
game.me.draw(2); game.me.draw(2);
@ -1351,7 +1354,7 @@ export class Click extends Uninstantable {
} }
} }
} }
static dieswap() { dieswap() {
if (game.me.isDead()) { if (game.me.isDead()) {
_status.clicked = true; _status.clicked = true;
var i, translation, intro, str; var i, translation, intro, str;
@ -1388,15 +1391,15 @@ export class Click extends Uninstantable {
} }
} }
} }
static dieswap2() { dieswap2() {
if (_status.dragged) return; if (_status.dragged) return;
game.swapPlayer(this.link); game.swapPlayer(this.link);
} }
static touchconfirm() { touchconfirm() {
_status.touchconfirmed = true; _status.touchconfirmed = true;
document.removeEventListener('touchstart', ui.click.touchconfirm); document.removeEventListener('touchstart', ui.click.touchconfirm);
} }
static windowtouchstart(e) { windowtouchstart(e) {
if (window.inSplash) return; if (window.inSplash) return;
if (e.touches[0] && lib.config.swipe && e.touches.length < 2) { if (e.touches[0] && lib.config.swipe && e.touches.length < 2) {
_status._swipeorigin = { _status._swipeorigin = {
@ -1409,7 +1412,7 @@ export class Click extends Uninstantable {
// _status.forcetouchinterval=setInterval(ui.click.forcetouch,30); // _status.forcetouchinterval=setInterval(ui.click.forcetouch,30);
// } // }
} }
static windowtouchmove(e) { windowtouchmove(e) {
e.preventDefault(); e.preventDefault();
if (window.inSplash) return; if (window.inSplash) return;
if (_status.draggingroundmenu) { if (_status.draggingroundmenu) {
@ -1618,7 +1621,7 @@ export class Click extends Uninstantable {
_status.dragstatuschanged = null; _status.dragstatuschanged = null;
} }
} }
static windowtouchend(e) { windowtouchend(e) {
delete _status.force; delete _status.force;
// if(_status.forcetouchinterval){ // if(_status.forcetouchinterval){
// clearInterval(_status.forcetouchinterval); // clearInterval(_status.forcetouchinterval);
@ -1770,7 +1773,7 @@ export class Click extends Uninstantable {
_status.dragged = false; _status.dragged = false;
_status.clicked = false; _status.clicked = false;
} }
static checkroundtranslate(translate) { checkroundtranslate(translate) {
var translate = translate || ui.roundmenu._dragtransform; var translate = translate || ui.roundmenu._dragtransform;
if (translate[1] + ui.roundmenu._position[1] + 50 + ui.arena.offsetTop > ui.window.offsetHeight) { 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; 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)'; ui.roundmenu.style.transform = 'translate(' + translate[0] + 'px,' + translate[1] + 'px)';
} }
static checkdialogtranslate(translate, dialog) { checkdialogtranslate(translate, dialog) {
var translate = translate || dialog._dragtransform; var translate = translate || dialog._dragtransform;
if (Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]) < 10) { if (Math.sqrt(translate[0] * translate[0] + translate[1] * translate[1]) < 10) {
translate[0] = 0; translate[0] = 0;
@ -1794,10 +1797,10 @@ export class Click extends Uninstantable {
} }
dialog.style.transform = 'translate(' + translate[0] + 'px,' + translate[1] + 'px)'; dialog.style.transform = 'translate(' + translate[0] + 'px,' + translate[1] + 'px)';
} }
static windowmousewheel(e) { windowmousewheel(e) {
_status.tempunpopup = e; _status.tempunpopup = e;
} }
static windowmousemove(e) { windowmousemove(e) {
if (window.inSplash) return; if (window.inSplash) return;
if (_status.tempunpopup) { if (_status.tempunpopup) {
if (get.evtDistance(_status.tempunpopup, e) > 5) { 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 (window.inSplash) return;
if (!ui.window) return; if (!ui.window) return;
if (e.button == 2) return; if (e.button == 2) return;
@ -2095,7 +2098,7 @@ export class Click extends Uninstantable {
item = item.parentNode; item = item.parentNode;
} }
} }
static cardtouchstart(e) { cardtouchstart(e) {
if (e.touches.length != 1) return; if (e.touches.length != 1) return;
if (!lib.config.enable_drag) return; if (!lib.config.enable_drag) return;
if (!this.parentNode) return; if (!this.parentNode) return;
@ -2111,7 +2114,7 @@ export class Click extends Uninstantable {
}; };
} }
} }
static cardtouchmove(e) { cardtouchmove(e) {
ui.click.longpresscancel.call(this); ui.click.longpresscancel.call(this);
if (this._waitingfordrag) { if (this._waitingfordrag) {
var drag = this._waitingfordrag; var drag = this._waitingfordrag;
@ -2129,7 +2132,7 @@ export class Click extends Uninstantable {
delete this._waitingfordrag; delete this._waitingfordrag;
} }
} }
static windowmouseup(e) { windowmouseup(e) {
delete _status.force; delete _status.force;
// if(_status.forcetouchinterval){ // if(_status.forcetouchinterval){
// clearInterval(_status.forcetouchinterval); // clearInterval(_status.forcetouchinterval);
@ -2218,7 +2221,7 @@ export class Click extends Uninstantable {
ui.arena.classList.remove('dragging'); ui.arena.classList.remove('dragging');
} }
} }
static mousemove() { mousemove() {
if (!lib.config.hover_handcard && this.parentNode && this.parentNode.parentNode == ui.me) { if (!lib.config.hover_handcard && this.parentNode && this.parentNode.parentNode == ui.me) {
return; return;
} }
@ -2226,38 +2229,38 @@ export class Click extends Uninstantable {
_status.currentmouseenter = this; _status.currentmouseenter = this;
} }
} }
static mouseenter() { mouseenter() {
if (!lib.config.hover_handcard && this.parentNode && this.parentNode.parentNode == ui.me) { if (!lib.config.hover_handcard && this.parentNode && this.parentNode.parentNode == ui.me) {
return; return;
} }
_status.currentmouseenter = this; _status.currentmouseenter = this;
} }
static mouseleave() { mouseleave() {
ui.click.mouseentercancel(); ui.click.mouseentercancel();
if (_status.currentmouseenter == this) { if (_status.currentmouseenter == this) {
_status.currentmouseenter = null; _status.currentmouseenter = null;
} }
this._mouseentercreated = false; this._mouseentercreated = false;
} }
static mousedown() { mousedown() {
ui.click.mouseentercancel(); ui.click.mouseentercancel();
if (_status.currentmouseenter == this) { if (_status.currentmouseenter == this) {
_status.currentmouseenter = null; _status.currentmouseenter = null;
} }
this._mouseentercreated = true; this._mouseentercreated = true;
} }
static mouseentercancel() { mouseentercancel() {
if (_status._mouseentertimeout) { if (_status._mouseentertimeout) {
clearTimeout(_status._mouseentertimeout); clearTimeout(_status._mouseentertimeout);
delete _status._mouseentertimeout; delete _status._mouseentertimeout;
} }
} }
static hoverplayer(e) { hoverplayer(e) {
var node = get.nodeintro(this, true); var node = get.nodeintro(this, true);
if (node) node.style.zIndex = 21; if (node) node.style.zIndex = 21;
return node; return node;
} }
static longpressdown(e) { longpressdown(e) {
if (_status.longpressed) return; if (_status.longpressed) return;
if (this._longpresstimeout) { if (this._longpresstimeout) {
clearTimeout(this._longpresstimeout); clearTimeout(this._longpresstimeout);
@ -2274,7 +2277,7 @@ export class Click extends Uninstantable {
// } // }
_status.longpressing = this; _status.longpressing = this;
} }
static longpresscallback() { longpresscallback() {
if (!_status.longpressing) return; if (!_status.longpressing) return;
var node = _status.longpressing; var node = _status.longpressing;
var func = node._longpresscallback; var func = node._longpresscallback;
@ -2304,7 +2307,7 @@ export class Click extends Uninstantable {
ui.click.touchpop(); ui.click.touchpop();
} }
} }
static longpresscancel() { longpresscancel() {
if (this._longpresstimeout) { if (this._longpresstimeout) {
clearTimeout(this._longpresstimeout); clearTimeout(this._longpresstimeout);
delete this._longpresstimeout; delete this._longpresstimeout;
@ -2314,7 +2317,7 @@ export class Click extends Uninstantable {
delete _status.longpressing; delete _status.longpressing;
} }
} }
static window() { window() {
var clicked = _status.clicked; var clicked = _status.clicked;
var dialogtouched = false; var dialogtouched = false;
if (_status.dialogtouched) { if (_status.dialogtouched) {
@ -2403,7 +2406,7 @@ export class Click extends Uninstantable {
_status.event.custom.add.window(clicked); _status.event.custom.add.window(clicked);
} }
} }
static toggle() { toggle() {
if (_status.dragged) return; if (_status.dragged) return;
if (this.parentNode.classList.contains('disabled')) return; if (this.parentNode.classList.contains('disabled')) return;
_status.tempunpop = true; _status.tempunpop = true;
@ -2418,7 +2421,7 @@ export class Click extends Uninstantable {
if (this.additionalCommand) this.additionalCommand(true, this.parentNode); if (this.additionalCommand) this.additionalCommand(true, this.parentNode);
} }
} }
static editor() { editor() {
if (_status.dragged) return; if (_status.dragged) return;
if (_status.editing) return; if (_status.editing) return;
_status.clicked = true; _status.clicked = true;
@ -2426,7 +2429,7 @@ export class Click extends Uninstantable {
_status.editing = this; _status.editing = this;
if (this.additionalCommand) this.additionalCommand(this); if (this.additionalCommand) this.additionalCommand(this);
} }
static switcher() { switcher() {
if (_status.dragged) return; if (_status.dragged) return;
if (this.parentNode.classList.contains('disabled')) return; if (this.parentNode.classList.contains('disabled')) return;
if (_status.choosing) return; if (_status.choosing) return;
@ -2449,7 +2452,7 @@ export class Click extends Uninstantable {
}, 500); }, 500);
} }
} }
static choice() { choice() {
if (_status.dragged) return; if (_status.dragged) return;
if (!_status.choosing) return; if (!_status.choosing) return;
_status.choosing.link = this.link; _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); this.parentNode.parentNode.querySelector('.toggle').additionalCommand(this.link, this.parentNode.parentNode);
} }
} }
static button() { button() {
if (_status.dragged) return; if (_status.dragged) return;
if (_status.clicked) return; if (_status.clicked) return;
if (_status.tempNoButton) return; if (_status.tempNoButton) return;
@ -2494,7 +2497,7 @@ export class Click extends Uninstantable {
} }
game.check(); game.check();
} }
static touchintro() { touchintro() {
var rect = this.getBoundingClientRect(); var rect = this.getBoundingClientRect();
ui.click.touchpop(); ui.click.touchpop();
ui.click.intro.call(this, { ui.click.intro.call(this, {
@ -2503,7 +2506,7 @@ export class Click extends Uninstantable {
}); });
_status.clicked = false; _status.clicked = false;
} }
static card() { card() {
delete this._waitingfordrag; delete this._waitingfordrag;
if (_status.dragged) return; if (_status.dragged) return;
if (_status.clicked) return; if (_status.clicked) return;
@ -2570,7 +2573,7 @@ export class Click extends Uninstantable {
}); });
} }
} }
static avatar() { avatar() {
if (!lib.config.doubleclick_intro) return; if (!lib.config.doubleclick_intro) return;
if (this.parentNode.isUnseen(0)) return; if (this.parentNode.isUnseen(0)) return;
if (!lib.character[this.parentNode.name]) return; if (!lib.character[this.parentNode.name]) return;
@ -2589,7 +2592,7 @@ export class Click extends Uninstantable {
game.pause2(); game.pause2();
ui.click.charactercard(player.name1 || player.name, null, null, true, this); ui.click.charactercard(player.name1 || player.name, null, null, true, this);
} }
static avatar2() { avatar2() {
if (!lib.config.doubleclick_intro) return; if (!lib.config.doubleclick_intro) return;
if (this.parentNode.classList.contains('unseen2')) return; if (this.parentNode.classList.contains('unseen2')) return;
if (!lib.character[this.parentNode.name2]) return; if (!lib.character[this.parentNode.name2]) return;
@ -2608,7 +2611,7 @@ export class Click extends Uninstantable {
game.pause2(); game.pause2();
ui.click.charactercard(player.name2, null, null, true, this); ui.click.charactercard(player.name2, null, null, true, this);
} }
static connectroom(e) { connectroom(e) {
if (_status.dragged) return; if (_status.dragged) return;
if (_status.clicked) return; if (_status.clicked) return;
if (ui.intro) return; if (ui.intro) return;
@ -2639,10 +2642,10 @@ export class Click extends Uninstantable {
} }
} }
} }
static player() { player() {
return ui.click.target.apply(this, arguments); return ui.click.target.apply(this, arguments);
} }
static target(e) { target(e) {
if (_status.dragged) return; if (_status.dragged) return;
if (_status.clicked) return; if (_status.clicked) return;
if (ui.intro) return; if (ui.intro) return;
@ -2750,12 +2753,12 @@ export class Click extends Uninstantable {
} }
game.check(); game.check();
} }
static control2() { control2() {
if (this.childNodes.length == 1 && !this._doubleclick) { if (this.childNodes.length == 1 && !this._doubleclick) {
ui.click.control.call(this.firstChild); ui.click.control.call(this.firstChild);
} }
} }
static control() { control() {
if (_status.dragged) return; if (_status.dragged) return;
if (ui.control.classList.contains('hidden')) return; if (ui.control.classList.contains('hidden')) return;
var node = this.parentNode; var node = this.parentNode;
@ -2803,7 +2806,7 @@ export class Click extends Uninstantable {
game.resume(); game.resume();
} }
} }
static dialogcontrol() { dialogcontrol() {
_status.event.result = { _status.event.result = {
buttons: ui.selected.buttons.slice(0), buttons: ui.selected.buttons.slice(0),
cards: ui.selected.cards.slice(0), cards: ui.selected.cards.slice(0),
@ -2813,7 +2816,7 @@ export class Click extends Uninstantable {
}; };
game.resume(); game.resume();
} }
static skill(skill) { skill(skill) {
var info = get.info(skill); var info = get.info(skill);
var event = _status.event; var event = _status.event;
event.backup(skill); 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; const gameEvent = get.event(), custom = gameEvent.custom, replaceConfirm = custom.replace.confirm;
if (replaceConfirm) { if (replaceConfirm) {
replaceConfirm(true); replaceConfirm(true);
@ -2911,7 +2914,7 @@ export class Click extends Uninstantable {
if (addConfirm) addConfirm(true); if (addConfirm) addConfirm(true);
game.resume(); game.resume();
} }
static cancel(node) { cancel(node) {
var event = _status.event; var event = _status.event;
if (event.custom.replace.confirm) { if (event.custom.replace.confirm) {
event.custom.replace.confirm(false); return; event.custom.replace.confirm(false); return;
@ -2952,7 +2955,7 @@ export class Click extends Uninstantable {
} }
game.resume(); game.resume();
} }
static logv(e) { logv(e) {
if (_status.currentlogv) { if (_status.currentlogv) {
if (_status.currentlogv == this) return; if (_status.currentlogv == this) return;
if (_status.logvtimeout) { if (_status.logvtimeout) {
@ -2972,7 +2975,7 @@ export class Click extends Uninstantable {
ui.click.intro.call(this, e); ui.click.intro.call(this, e);
} }
} }
static logvleave() { logvleave() {
if (_status.currentlogv == this) { if (_status.currentlogv == this) {
setTimeout(function () { setTimeout(function () {
delete _status.currentlogv; delete _status.currentlogv;
@ -2986,7 +2989,7 @@ export class Click extends Uninstantable {
delete this.logvtimeout; delete this.logvtimeout;
} }
} }
static charactercard(name, sourcenode, noedit, resume, avatar) { charactercard(name, sourcenode, noedit, resume, avatar) {
if (_status.dragged) return; if (_status.dragged) return;
if (lib.config.theme != 'simple') { if (lib.config.theme != 'simple') {
ui.window.classList.add('shortcutpaused'); ui.window.classList.add('shortcutpaused');
@ -3518,7 +3521,7 @@ export class Click extends Uninstantable {
layer.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', clicklayer); layer.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', clicklayer);
ui.window.appendChild(layer); ui.window.appendChild(layer);
} }
static intro(e) { intro(e) {
if (_status.dragged) return; if (_status.dragged) return;
_status.clicked = true; _status.clicked = true;
if (this.classList.contains('player') && !this.name) { if (this.classList.contains('player') && !this.name) {
@ -3616,7 +3619,7 @@ export class Click extends Uninstantable {
game.pause2(); game.pause2();
return uiintro; return uiintro;
} }
static intro2() { intro2() {
if (ui.intro) { if (ui.intro) {
ui.intro.close(); ui.intro.close();
if (ui.intro.source == this) { 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 (!ui || !ui.auto || ui.auto.classList.contains('hidden') && arguments[0] !== 'forced') return;
if (_status.paused2) return; if (_status.paused2) return;
ui.click.shortcut(false); ui.click.shortcut(false);
@ -3679,7 +3682,7 @@ export class Click extends Uninstantable {
} }
} }
} }
static wuxie() { wuxie() {
if (this.classList.contains('hidden')) return; if (this.classList.contains('hidden')) return;
this.classList.toggle('glow'); this.classList.toggle('glow');
if (this.classList.contains('glow') && _status.event.type == 'wuxie' && if (this.classList.contains('glow') && _status.event.type == 'wuxie' &&
@ -3687,7 +3690,7 @@ export class Click extends Uninstantable {
ui.click.cancel(ui.confirm.lastChild); ui.click.cancel(ui.confirm.lastChild);
} }
} }
static tempnowuxie() { tempnowuxie() {
if (this.classList.contains('hidden')) return; if (this.classList.contains('hidden')) return;
this.classList.toggle('glow'); this.classList.toggle('glow');
if (this.classList.contains('glow') && _status.event.type == 'wuxie' && if (this.classList.contains('glow') && _status.event.type == 'wuxie' &&
@ -3701,7 +3704,7 @@ export class Click extends Uninstantable {
ui.click.cancel(ui.confirm.lastChild); ui.click.cancel(ui.confirm.lastChild);
} }
} }
static pause() { pause() {
if (_status.paused2 || _status.pausing || _status.nopause || !ui.pause) return; if (_status.paused2 || _status.pausing || _status.nopause || !ui.pause) return;
if (!_status.video) { if (!_status.video) {
if (ui.pause.classList.contains('hidden')) return; if (ui.pause.classList.contains('hidden')) return;
@ -3730,7 +3733,7 @@ export class Click extends Uninstantable {
game.onpause(); game.onpause();
} }
} }
static resume(e) { resume(e) {
if (_status.pausing) return; if (_status.pausing) return;
if (_status.dragged) return; if (_status.dragged) return;
if (_status.clicked) return; if (_status.clicked) return;
@ -3747,7 +3750,7 @@ export class Click extends Uninstantable {
} }
return false; return false;
} }
static config() { config() {
if (!ui.click.configMenu) return; if (!ui.click.configMenu) return;
if (_status.paused2) _status.config2 = false; if (_status.paused2) _status.config2 = false;
else _status.config2 = true; else _status.config2 = true;
@ -3758,7 +3761,7 @@ export class Click extends Uninstantable {
ui.system1.classList.remove('shown'); ui.system1.classList.remove('shown');
ui.system2.classList.remove('shown'); ui.system2.classList.remove('shown');
} }
static swap() { swap() {
if (_status.dragged) return; if (_status.dragged) return;
if (this.classList.contains('dead')) return; if (this.classList.contains('dead')) return;
if (_status.over) return; if (_status.over) return;
@ -3766,7 +3769,7 @@ export class Click extends Uninstantable {
if (ui.wuxie) ui.wuxie.show(); if (ui.wuxie) ui.wuxie.show();
game.swapPlayer(this); game.swapPlayer(this);
} }
static mousewheel(evt) { mousewheel(evt) {
if (this.firstChild && this.firstChild.classList.contains('handcards') && if (this.firstChild && this.firstChild.classList.contains('handcards') &&
!this.classList.contains('scrollh')) return; !this.classList.contains('scrollh')) return;
var node = this; var node = this;
@ -3794,16 +3797,16 @@ export class Click extends Uninstantable {
}, 16); }, 16);
} }
} }
static touchStart(e) { touchStart(e) {
this.startX = e.touches[0].clientX / game.documentZoom; this.startX = e.touches[0].clientX / game.documentZoom;
this.startY = e.touches[0].clientY / game.documentZoom; this.startY = e.touches[0].clientY / game.documentZoom;
_status.dragged = false; _status.dragged = false;
} }
static dialogtouchStart(e) { dialogtouchStart(e) {
ui.click.touchStart.call(this, e); ui.click.touchStart.call(this, e);
_status.dialogtouched = true; _status.dialogtouched = true;
} }
static touchScroll(e) { touchScroll(e) {
if (_status.mousedragging) return; if (_status.mousedragging) return;
if (_status.draggingtouchdialog) return; if (_status.draggingtouchdialog) return;
if (!_status.dragged) { if (!_status.dragged) {
@ -3823,7 +3826,7 @@ export class Click extends Uninstantable {
e.stopPropagation(); e.stopPropagation();
} }
} }
static autoskill(bool, node) { autoskill(bool, node) {
var list = lib.config.autoskilllist; var list = lib.config.autoskilllist;
if (bool) { if (bool) {
list.remove(node.link); list.remove(node.link);
@ -3833,10 +3836,10 @@ export class Click extends Uninstantable {
} }
game.saveConfig('autoskilllist', list); game.saveConfig('autoskilllist', list);
} }
static skillbutton() { skillbutton() {
this.func(this.link); this.func(this.link);
} }
static autoskill2(e) { autoskill2(e) {
this.classList.toggle('on'); this.classList.toggle('on');
var list = []; var list = [];
if (lib.skill[this.link].frequent) { if (lib.skill[this.link].frequent) {
@ -3859,7 +3862,7 @@ export class Click extends Uninstantable {
ui.click.touchpop(); ui.click.touchpop();
e.stopPropagation(); e.stopPropagation();
} }
static hiddenskill(e) { hiddenskill(e) {
this.classList.toggle('on'); this.classList.toggle('on');
var hidden = lib.skill[this.link].preHidden; var hidden = lib.skill[this.link].preHidden;
if (Array.isArray(hidden)) { if (Array.isArray(hidden)) {
@ -3879,7 +3882,7 @@ export class Click extends Uninstantable {
ui.click.touchpop(); ui.click.touchpop();
e.stopPropagation(); e.stopPropagation();
} }
static rightplayer(e) { rightplayer(e) {
if (this._nopup) return false; if (this._nopup) return false;
if (_status.clickedplayer) { if (_status.clickedplayer) {
return false; return false;
@ -3896,7 +3899,7 @@ export class Click extends Uninstantable {
ui.click.longpresscancel.call(this); ui.click.longpresscancel.call(this);
return false; return false;
} }
static right(e) { right(e) {
if (window.inSplash) return false; if (window.inSplash) return false;
if (lib.config.touchscreen) return; if (lib.config.touchscreen) return;
if (_status.noright) { if (_status.noright) {

View File

@ -1,5 +1,8 @@
import { ui, game, get, lib, _status } from "../../../noname.js"; import { ui } from '../index.js';
import { Uninstantable } from "../../util/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 { menu } from "./menu/index.js";
import { cardPackMenu } from "./menu/pages/cardPackMenu.js"; import { cardPackMenu } from "./menu/pages/cardPackMenu.js";
import { characterPackMenu } from "./menu/pages/characterPackMenu.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 { otherMenu } from "./menu/pages/otherMenu.js";
import { startMenu } from "./menu/pages/startMenu.js"; import { startMenu } from "./menu/pages/startMenu.js";
export class Create extends Uninstantable { export class Create {
/** /**
* @type {(video: Videos, before: boolean) => void} * @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); const card = ui.create.card(position, 'noclick', noclick);
card.removeEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.card); card.removeEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.card);
card.classList.add('button'); card.classList.add('button');
@ -36,7 +39,7 @@ export class Create extends Uninstantable {
/** /**
* 让卡牌旋转 * 让卡牌旋转
*/ */
static cardSpinning(card) { cardSpinning(card) {
if (lib.config.cardback_style != 'default') { if (lib.config.cardback_style != 'default') {
card.style.transitionProperty = 'none'; card.style.transitionProperty = 'none';
ui.refresh(card); 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 card = ui.create.identityCard(identity);
const buttons = ui.create.div('.buttons', dialog.content); const buttons = ui.create.div('.buttons', dialog.content);
setTimeout(() => { setTimeout(() => {
@ -85,7 +88,7 @@ export class Create extends Uninstantable {
* @param {HTMLDivElement} container * @param {HTMLDivElement} container
* @param {Function} saveInput * @param {Function} saveInput
*/ */
static editor(container, saveInput) { editor(container, saveInput) {
const createList = []; const createList = [];
const containerDelete = container.delete; const containerDelete = container.delete;
const editorpage = ui.create.div(container); const editorpage = ui.create.div(container);
@ -269,7 +272,7 @@ export class Create extends Uninstantable {
const editor = ui.create.div(editorpage); const editor = ui.create.div(editorpage);
return editor; return editor;
} }
static cardTempName(card, applyNode) { cardTempName(card, applyNode) {
let getApplyNode = applyNode || card; let getApplyNode = applyNode || card;
let cardName = get.name(card); let cardName = get.name(card);
let cardNature = get.nature(card); let cardNature = get.nature(card);
@ -408,7 +411,7 @@ export class Create extends Uninstantable {
node.tempname = tempname; node.tempname = tempname;
return node; return node;
} }
static connectRooms(list) { connectRooms(list) {
ui.rooms = []; ui.rooms = [];
ui.roombase = ui.create.dialog(); ui.roombase = ui.create.dialog();
ui.roombase.classList.add('fullwidth'); ui.roombase.classList.add('fullwidth');
@ -426,7 +429,7 @@ export class Create extends Uninstantable {
ui.rooms.push(player); ui.rooms.push(player);
} }
} }
static rarity(button) { rarity(button) {
var rarity = game.getRarity(button.link); var rarity = game.getRarity(button.link);
if (rarity != 'common' && lib.config.show_rarity) { if (rarity != 'common' && lib.config.show_rarity) {
var intro = button.node.intro; var intro = button.node.intro;
@ -451,7 +454,7 @@ export class Create extends Uninstantable {
else button.node.group.style.backgroundColor=get.translation('weiColor'); else button.node.group.style.backgroundColor=get.translation('weiColor');
}*/ }*/
} }
static div() { div() {
var str, innerHTML, position, position2, style, divposition, listen; var str, innerHTML, position, position2, style, divposition, listen;
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] == 'string') { if (typeof arguments[i] == 'string') {
@ -501,7 +504,7 @@ export class Create extends Uninstantable {
if (listen) node.listen(listen); if (listen) node.listen(listen);
return node; return node;
} }
static filediv() { filediv() {
var args = Array.from(arguments); var args = Array.from(arguments);
var func = null; var func = null;
for (var i = 0; i < args.length; i++) { for (var i = 0; i < args.length; i++) {
@ -521,7 +524,7 @@ export class Create extends Uninstantable {
div.inputNode = input; div.inputNode = input;
return div; return div;
} }
static node() { node() {
var tagName, str, innerHTML, position, position2, style, divposition, listen; var tagName, str, innerHTML, position, position2, style, divposition, listen;
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] == 'string') { if (typeof arguments[i] == 'string') {
@ -586,7 +589,7 @@ export class Create extends Uninstantable {
if (listen) node.onclick = listen; if (listen) node.onclick = listen;
return node; return node;
} }
static iframe(src) { iframe(src) {
var layer = document.createElement('div'); var layer = document.createElement('div');
layer.classList.add('poplayer'); layer.classList.add('poplayer');
layer.style.zIndex = '100'; layer.style.zIndex = '100';
@ -618,7 +621,7 @@ export class Create extends Uninstantable {
ui.window.appendChild(layer); ui.window.appendChild(layer);
} }
static identitycircle(list, target) { identitycircle(list, target) {
var container = ui.create.div('.identitycircle.menubg', target); var container = ui.create.div('.identitycircle.menubg', target);
var circle = ui.create.div(container); var circle = ui.create.div(container);
container.dataset.num = list.length; container.dataset.num = list.length;
@ -639,17 +642,17 @@ export class Create extends Uninstantable {
sec2.style.transform = 'rotate(' + (deg1 + deg2) + 'deg)'; sec2.style.transform = 'rotate(' + (deg1 + deg2) + 'deg)';
} }
} }
static chat() { chat() {
var chat = ui.create.system('聊天', null, true); var chat = ui.create.system('聊天', null, true);
ui.chatButton = chat; ui.chatButton = chat;
lib.setPopped(chat, ui.click.chat, 220); lib.setPopped(chat, ui.click.chat, 220);
} }
static exit() { exit() {
if (!ui.exit) { if (!ui.exit) {
ui.exit = ui.create.control('退出房间', ui.click.exit); ui.exit = ui.create.control('退出房间', ui.click.exit);
} }
} }
static connecting(bool) { connecting(bool) {
if (bool) { if (bool) {
ui.window.classList.remove('connecting'); ui.window.classList.remove('connecting');
if (ui.connecting) { if (ui.connecting) {
@ -674,7 +677,7 @@ export class Create extends Uninstantable {
// },1000); // },1000);
} }
} }
static roomInfo() { roomInfo() {
var chat = ui.create.system(game.online ? '房间信息' : '房间设置', function () { var chat = ui.create.system(game.online ? '房间信息' : '房间设置', function () {
if (!game.online || game.onlinezhu) { if (!game.online || game.onlinezhu) {
ui.click.connectMenu(); ui.click.connectMenu();
@ -689,7 +692,7 @@ export class Create extends Uninstantable {
} }
}, 180); }, 180);
} }
static templayer(time) { templayer(time) {
if (typeof time != 'number' || isNaN(time) || time == Infinity) { if (typeof time != 'number' || isNaN(time) || time == Infinity) {
time = 500; time = 500;
} }
@ -698,7 +701,7 @@ export class Create extends Uninstantable {
templayer.remove(); templayer.remove();
}, time); }, time);
} }
static selectlist(list, init, position, onchange) { selectlist(list, init, position, onchange) {
var select = document.createElement('select'); var select = document.createElement('select');
for (var i = 0; i < list.length; i++) { for (var i = 0; i < list.length; i++) {
var option = document.createElement('option'); var option = document.createElement('option');
@ -724,20 +727,20 @@ export class Create extends Uninstantable {
return select; 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; otherMenu = otherMenu;
static statictable() { statictable() {
var str, row, col, position, position2, fixed, style, divposition; var str, row, col, position, position2, fixed, style, divposition;
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] == 'string') str = arguments[i]; if (typeof arguments[i] == 'string') str = arguments[i];
@ -792,7 +795,7 @@ export class Create extends Uninstantable {
} }
return node; return node;
} }
static giveup() { giveup() {
if (ui.giveup) return; if (ui.giveup) return;
if (!lib.config.show_giveup) return; if (!lib.config.show_giveup) return;
ui.giveup = ui.create.system('投降', function () { ui.giveup = ui.create.system('投降', function () {
@ -814,7 +817,7 @@ export class Create extends Uninstantable {
} }
}, true, true); }, true, true);
} }
static groupControl(dialog) { groupControl(dialog) {
return ui.create.control('wei', 'shu', 'wu', 'qun', 'jin', 'western', 'key', function (link, node) { return ui.create.control('wei', 'shu', 'wu', 'qun', 'jin', 'western', 'key', function (link, node) {
if (link == '全部') { if (link == '全部') {
dialog.currentcapt = ''; dialog.currentcapt = '';
@ -857,14 +860,14 @@ export class Create extends Uninstantable {
} }
}); });
} }
static cardDialog() { cardDialog() {
var args = ['thisiscard']; var args = ['thisiscard'];
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]); args.push(arguments[i]);
} }
return ui.create.characterDialog.apply(this, args); return ui.create.characterDialog.apply(this, args);
} }
static characterDialog2(filter) { characterDialog2(filter) {
var list = []; var list = [];
for (var i in lib.character) { for (var i in lib.character) {
if (lib.character[i][4].includes('minskin')) continue; 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); var node = ui.create.div('.dialogbutton.menubutton.large', '筛选', packnode);
return dialog; return dialog;
} }
static characterDialog() { characterDialog() {
// if(lib.config.character_dialog_style=='newstyle'){ // if(lib.config.character_dialog_style=='newstyle'){
// for(var i=0;i<arguments.length;i++){ // for(var i=0;i<arguments.length;i++){
// if(arguments[i]=='thisiscard'){ // if(arguments[i]=='thisiscard'){
@ -1631,19 +1634,19 @@ export class Create extends Uninstantable {
return dialog; return dialog;
} }
static dialog() { dialog() {
let dialog = new lib.element.Dialog(...arguments); let dialog = new lib.element.Dialog(...arguments);
if (!Array.from(arguments).includes('hidden')) { if (!Array.from(arguments).includes('hidden')) {
dialog.open(); dialog.open();
} }
return dialog; return dialog;
} }
static line2() { line2() {
var node = ui.create.line.apply(this, arguments); var node = ui.create.line.apply(this, arguments);
node.classList.add('line2'); node.classList.add('line2');
return node; return node;
} }
static line() { line() {
var two = false, func; var two = false, func;
var node = ui.create.div('.config'); var node = ui.create.div('.config');
for (var i = 0; i < arguments.length; i++) { for (var i = 0; i < arguments.length; i++) {
@ -1661,7 +1664,7 @@ export class Create extends Uninstantable {
} }
return node; return node;
} }
static switcher(name, current, current2) { switcher(name, current, current2) {
var func; var func;
var node = ui.create.div('.config'); var node = ui.create.div('.config');
ui.create.div(node).innerHTML = get.translation(name + '_config'); ui.create.div(node).innerHTML = get.translation(name + '_config');
@ -1697,15 +1700,15 @@ export class Create extends Uninstantable {
if (func) switcher.additionalCommand = func; if (func) switcher.additionalCommand = func;
return node; return node;
} }
static caption(str, position) { caption(str, position) {
var caption = ui.create.div('.caption', position); var caption = ui.create.div('.caption', position);
caption.innerHTML = str; caption.innerHTML = str;
return caption; return caption;
} }
static control() { control() {
return new lib.element.Control(...arguments); return new lib.element.Control(...arguments);
} }
static confirm(str, func) { confirm(str, func) {
if (ui.confirm && ui.confirm.str == str) { if (ui.confirm && ui.confirm.str == str) {
return; return;
} }
@ -1743,7 +1746,7 @@ export class Create extends Uninstantable {
else delete ui.confirm.custom; else delete ui.confirm.custom;
} }
} }
static skills(skills) { skills(skills) {
var i, same; var i, same;
if (ui.skills) { if (ui.skills) {
if (ui.skills.skills.length == skills.length && ui.skills.style.display != 'none') { if (ui.skills.skills.length == skills.length && ui.skills.style.display != 'none') {
@ -1777,7 +1780,7 @@ export class Create extends Uninstantable {
ui.skills.skills = skills; ui.skills.skills = skills;
return ui.skills; return ui.skills;
} }
static skills2(skills) { skills2(skills) {
var i, same; var i, same;
if (ui.skills2) { if (ui.skills2) {
if (ui.skills2.skills.length == skills.length && ui.skills2.style.display != 'none') { if (ui.skills2.skills.length == skills.length && ui.skills2.style.display != 'none') {
@ -1811,7 +1814,7 @@ export class Create extends Uninstantable {
ui.skills2.skills = skills; ui.skills2.skills = skills;
return ui.skills2; return ui.skills2;
} }
static skills3(skills) { skills3(skills) {
var i, same; var i, same;
if (ui.skills3) { if (ui.skills3) {
if (ui.skills3.skills.length == skills.length && ui.skills3.style.display != 'none') { if (ui.skills3.skills.length == skills.length && ui.skills3.style.display != 'none') {
@ -1845,7 +1848,7 @@ export class Create extends Uninstantable {
ui.skills3.skills = skills; ui.skills3.skills = skills;
return ui.skills3; return ui.skills3;
} }
static arena() { arena() {
var i, j; var i, j;
ui.window = ui.create.div('#window.hidden', document.body); ui.window = ui.create.div('#window.hidden', document.body);
ui.create.div('#statusbg', document.body); ui.create.div('#statusbg', document.body);
@ -2497,7 +2500,7 @@ export class Create extends Uninstantable {
}, 500); }, 500);
} }
} }
static system(str, func, right, before) { system(str, func, right, before) {
var parent = right ? ui.system2 : ui.system1; var parent = right ? ui.system2 : ui.system1;
var node = ui.create.div(); var node = ui.create.div();
if (before) { if (before) {
@ -2523,7 +2526,7 @@ export class Create extends Uninstantable {
} }
return node; return node;
} }
static pause() { pause() {
if (_status.pausing) return; if (_status.pausing) return;
ui.click.shortcut(false); ui.click.shortcut(false);
var node = ui.create.div(".pausedbg", ui.window); var node = ui.create.div(".pausedbg", ui.window);
@ -2564,7 +2567,7 @@ export class Create extends Uninstantable {
// }); // });
return node; return node;
} }
static prebutton(item, type, position, noclick) { prebutton(item, type, position, noclick) {
var node = ui.create.div(position); var node = ui.create.div(position);
node.style.display = 'none'; node.style.display = 'none';
node.link = item; node.link = item;
@ -2575,7 +2578,7 @@ export class Create extends Uninstantable {
_status.prebutton.push(node); _status.prebutton.push(node);
return node; return node;
} }
static buttonPresets = { buttonPresets = {
/** /**
* @returns { import("../library/index.js").Button } * @returns { import("../library/index.js").Button }
*/ */
@ -2837,8 +2840,8 @@ export class Create extends Uninstantable {
return node; return node;
} }
}; };
static button(item, type, position, noClick, button) { return new lib.element.Button(item, type, position, noClick, button); } button(item, type, position, noClick, button) { return new lib.element.Button(item, type, position, noClick, button); }
static buttons(list, type, position, noclick, zoom) { buttons(list, type, position, noclick, zoom) {
var buttons = []; var buttons = [];
var pre = (typeof type == 'string' && type.slice(0, 3) == 'pre'); var pre = (typeof type == 'string' && type.slice(0, 3) == 'pre');
if (pre) { if (pre) {
@ -2866,7 +2869,7 @@ export class Create extends Uninstantable {
if (position) position.appendChild(fragment); if (position) position.appendChild(fragment);
return buttons; return buttons;
} }
static textbuttons(list, dialog, noclick) { textbuttons(list, dialog, noclick) {
for (var item of list) { for (var item of list) {
var str, link; var str, link;
if (Array.isArray(item)) { if (Array.isArray(item)) {
@ -2885,8 +2888,8 @@ export class Create extends Uninstantable {
dialog.buttons.add(next.firstChild); dialog.buttons.add(next.firstChild);
} }
} }
static player(position, noclick) { return new lib.element.Player(position).build(noclick); } player(position, noclick) { return new lib.element.Player(position).build(noclick); }
static connectPlayers(ip) { connectPlayers(ip) {
ui.updateConnectPlayerPositions(); ui.updateConnectPlayerPositions();
game.connectPlayers = []; game.connectPlayers = [];
const configOL = lib.configOL; const configOL = lib.configOL;
@ -2967,7 +2970,7 @@ export class Create extends Uninstantable {
ui.connectStartBar = bar; ui.connectStartBar = bar;
ui.connectShareButton = shareButton; ui.connectShareButton = shareButton;
} }
static players(numberOfPlayers) { players(numberOfPlayers) {
if (numberOfPlayers === 0) { if (numberOfPlayers === 0) {
return; return;
} }
@ -3001,7 +3004,7 @@ export class Create extends Uninstantable {
players.forEach(player => ui.arena.appendChild(player)); players.forEach(player => ui.arena.appendChild(player));
return players; return players;
} }
static me(hasme) { me(hasme) {
ui.mebg = ui.create.div('#mebg', ui.arena); ui.mebg = ui.create.div('#mebg', ui.arena);
ui.me = ui.create.div('#me', ui.arena).addTempClass('start'); ui.me = ui.create.div('#me', ui.arena).addTempClass('start');
ui.handcards1Container = ui.create.div('#handcards1', ui.me); ui.handcards1Container = ui.create.div('#handcards1', ui.me);
@ -3034,8 +3037,8 @@ export class Create extends Uninstantable {
// ui.updatehl(); // ui.updatehl();
} }
} }
static card(position, info, noclick) { return new lib.element.Card(position).build(info, noclick); } card(position, info, noclick) { return new lib.element.Card(position).build(info, noclick); }
static cardsAsync() { cardsAsync() {
if (lib.onfree) { if (lib.onfree) {
_status.waitingForCards = Array.from(arguments); _status.waitingForCards = Array.from(arguments);
lib.onfree.push(function () { lib.onfree.push(function () {
@ -3049,7 +3052,7 @@ export class Create extends Uninstantable {
ui.create.cards.apply(ui.create, arguments); ui.create.cards.apply(ui.create, arguments);
} }
} }
static cards(ordered) { cards(ordered) {
if (_status.brawl) { if (_status.brawl) {
if (_status.brawl.cardPile) { if (_status.brawl.cardPile) {
lib.card.list = _status.brawl.cardPile(lib.card.list); lib.card.list = _status.brawl.cardPile(lib.card.list);

View File

@ -1,25 +1,22 @@
import { Uninstantable, nonameInitialized } from "../util/index.js"; import { lib } from '../library/index.js';
import { Library as lib } from '../library/index.js'; import { game } from "../game/index.js";
import { Game as game } from "../game/index.js"; import { get } from "../get/index.js";
import { Get as get } from "../get/index.js";
import { _status } from "../status/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 { Click } from "./click/index.js";
import { Create } from "./create/index.js"; import { Create } from "./create/index.js";
export class UI extends Uninstantable { export class UI {
static updates = []; updates = [];
static thrown = []; thrown = [];
static touchlines = []; touchlines = [];
static todiscard = {}; todiscard = {};
/** /**
* @type { HTMLStyleElement[] } * @type { HTMLStyleElement[] }
*/ */
static playerPositions = []; playerPositions = [];
static create = Create; create = new Create();
static click = Click; click = new Click();
static selected = { selected = {
/** /**
* @type { Button[] } * @type { Button[] }
*/ */
@ -36,113 +33,113 @@ export class UI extends Uninstantable {
/** /**
* @type { Dialog[] } * @type { Dialog[] }
*/ */
static dialogs; dialogs;
/** /**
* @type { Dialog } * @type { Dialog }
*/ */
static dialog; dialog;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static arena; arena;
/** /**
* @type { Control[] } * @type { Control[] }
*/ */
static controls; controls;
/** /**
* @type { Control } * @type { Control }
*/ */
static control; control;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static confirm; confirm;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static skills; skills;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static skills1; skills1;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static skills2; skills2;
/** /**
* @type { Control | undefined } * @type { Control | undefined }
*/ */
static skills3; skills3;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static window; window;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static pause; pause;
/** /**
* @type { HTMLAudioElement } * @type { HTMLAudioElement }
*/ */
static backgroundMusic; backgroundMusic;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static special; special;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static fakeme; fakeme;
/** /**
* @type { HTMLDivElement } * @type { HTMLDivElement }
*/ */
static chess; chess;
/** /**
* 手动在菜单栏中添加一个武将包的ui * 手动在菜单栏中添加一个武将包的ui
* @type { ((packName: string) => void)[] } * @type { ((packName: string) => void)[] }
*/ */
static updateCharacterPackMenu = []; updateCharacterPackMenu = [];
/** /**
* 手动在菜单栏中添加一个卡牌包的ui * 手动在菜单栏中添加一个卡牌包的ui
* @type { ((packName: string) => void)[] } * @type { ((packName: string) => void)[] }
*/ */
static updateCardPackMenu = []; updateCardPackMenu = [];
/** /**
* @type { HTMLDivElement } 挑战模式下正在操作的角色 * @type { HTMLDivElement } 挑战模式下正在操作的角色
*/ */
static mebg; mebg;
/** /**
* @type { Function | undefined } * @type { Function | undefined }
*/ */
static updateUpdate; updateUpdate;
/** /**
* @type {HTMLDivElement} * @type {HTMLDivElement}
*/ */
static commandnode; commandnode;
/** /**
* @type {() => void} * @type {() => void}
*/ */
static updateVideoMenu; updateVideoMenu;
/** /**
* @type {HTMLDivElement} * @type {HTMLDivElement}
*/ */
static menuContainer; menuContainer;
/** /**
* @type {HTMLDivElement} * @type {HTMLDivElement}
*/ */
static auto; auto;
/** /**
* @type {HTMLDivElement} * @type {HTMLDivElement}
*/ */
static wuxie; wuxie;
/** /**
* @type {HTMLDivElement} * @type {HTMLDivElement}
*/ */
static tempnowuxie; tempnowuxie;
static refresh(node) { refresh(node) {
void window.getComputedStyle(node, null).getPropertyValue("opacity"); void window.getComputedStyle(node, null).getPropertyValue("opacity");
} }
static clear() { clear() {
game.addVideo('uiClear'); game.addVideo('uiClear');
var thrown = document.getElementsByClassName('thrown'); var thrown = document.getElementsByClassName('thrown');
var nodes = []; var nodes = [];
@ -154,7 +151,7 @@ export class UI extends Uninstantable {
if (!nodes[i].fixed) nodes[i].delete(); if (!nodes[i].fixed) nodes[i].delete();
} }
} }
static updatec() { updatec() {
if (_status.noupdatec) return; if (_status.noupdatec) return;
var length = 0, minoffset = -Infinity; var length = 0, minoffset = -Infinity;
var controls = []; var controls = [];
@ -281,7 +278,7 @@ export class UI extends Uninstantable {
} }
} }
} }
static updatex() { updatex() {
ui.update.apply(this, arguments); ui.update.apply(this, arguments);
ui.updatehl(); ui.updatehl();
for (var i = 0; i < lib.onresize.length; i++) { for (var i = 0; i < lib.onresize.length; i++) {
@ -293,13 +290,13 @@ export class UI extends Uninstantable {
ui.updatez(); ui.updatez();
delete ui._updatexr; delete ui._updatexr;
} }
static updatexr() { updatexr() {
if (ui._updatexr) { if (ui._updatexr) {
clearTimeout(ui._updatexr); clearTimeout(ui._updatexr);
} }
ui._updatexr = setTimeout(ui.updatex, 500); ui._updatexr = setTimeout(ui.updatex, 500);
} }
static updatejm(player, nodes, start, inv) { updatejm(player, nodes, start, inv) {
if (typeof start != 'number') { if (typeof start != 'number') {
start = 0; start = 0;
} }
@ -330,7 +327,7 @@ export class UI extends Uninstantable {
} }
} }
} }
static updatem(player) { updatem(player) {
if (player) { if (player) {
var start = 0; var start = 0;
if (!player.classList.contains('linked2') || !ui.arena.classList.contains('nolink')) { 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) { if (player) {
ui.updatejm(player, player.node.judges); ui.updatejm(player, player.node.judges);
} }
@ -354,7 +351,7 @@ export class UI extends Uninstantable {
} }
} }
} }
static updatehl() { updatehl() {
if (!game.me) return; if (!game.me) return;
if (!ui.handcards1Container || !ui.handcards2Container) return; if (!ui.handcards1Container || !ui.handcards2Container) return;
if (!ui.handcards1Container.childNodes.length) 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'; ui.handcards2Container.firstChild.style.width = (offset2 * (hs2.length - 1) + 118) + 'px';
} }
static updateh(compute) { updateh(compute) {
if (!game.me) return; if (!game.me) return;
if (!ui.handcards1Container) return; if (!ui.handcards1Container) return;
if (lib.config.low_performance) { 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.handcards1);
ui.updatehx(game.me.node.handcards2); ui.updatehx(game.me.node.handcards2);
} }
static updatehx(node) { updatehx(node) {
var width = node.parentNode._handcardsWidth; var width = node.parentNode._handcardsWidth;
var num = node.childElementCount - node.getElementsByClassName('removing').length; var num = node.childElementCount - node.getElementsByClassName('removing').length;
node.classList.remove('fold0'); node.classList.remove('fold0');
@ -498,7 +495,7 @@ export class UI extends Uninstantable {
node.classList.add('fold0'); node.classList.add('fold0');
} }
} }
static updated() { updated() {
if (document.documentElement.offsetWidth < 900 || document.documentElement.offsetHeight < 500) { if (document.documentElement.offsetWidth < 900 || document.documentElement.offsetHeight < 500) {
game.deviceZoom = Math.min( game.deviceZoom = Math.min(
Math.round(document.documentElement.offsetWidth / 98) / 10, Math.round(document.documentElement.offsetWidth / 98) / 10,
@ -509,7 +506,7 @@ export class UI extends Uninstantable {
game.deviceZoom = 1; game.deviceZoom = 1;
} }
} }
static updatez() { updatez() {
var width = document.documentElement.offsetWidth; var width = document.documentElement.offsetWidth;
var height = document.documentElement.offsetHeight; var height = document.documentElement.offsetHeight;
var zoom = game.documentZoom; var zoom = game.documentZoom;
@ -524,7 +521,7 @@ export class UI extends Uninstantable {
document.body.style.transform = ''; document.body.style.transform = '';
} }
} }
static update() { update() {
for (var i = 0; i < ui.updates.length; i++) { for (var i = 0; i < ui.updates.length; i++) {
ui.updates[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 (!ui._recycle) ui._recycle = {};
if (typeof node == 'string') { if (typeof node == 'string') {
return ui._recycle[node]; return ui._recycle[node];
@ -617,7 +614,7 @@ export class UI extends Uninstantable {
* @author Tipx-L * @author Tipx-L
* @param {number} [numberOfPlayers] * @param {number} [numberOfPlayers]
*/ */
static updateConnectPlayerPositions(numberOfPlayers) { updateConnectPlayerPositions(numberOfPlayers) {
if (typeof numberOfPlayers != 'number') { if (typeof numberOfPlayers != 'number') {
const configOL = lib.configOL; const configOL = lib.configOL;
numberOfPlayers = parseInt(configOL.player_number) || configOL.number; numberOfPlayers = parseInt(configOL.player_number) || configOL.number;
@ -667,7 +664,7 @@ export class UI extends Uninstantable {
* @author Tipx-L * @author Tipx-L
* @param {number} [numberOfPlayers] * @param {number} [numberOfPlayers]
*/ */
static updatePlayerPositions(numberOfPlayers) { updatePlayerPositions(numberOfPlayers) {
if (typeof numberOfPlayers != 'number') numberOfPlayers = ui.arena.dataset.number; if (typeof numberOfPlayers != 'number') numberOfPlayers = ui.arena.dataset.number;
//当人数不超过8人时还是用以前的布局 //当人数不超过8人时还是用以前的布局
if (!numberOfPlayers || numberOfPlayers <= 8) return; if (!numberOfPlayers || numberOfPlayers <= 8) return;
@ -701,9 +698,19 @@ export class UI extends Uninstantable {
playerPositions.push(selector); playerPositions.push(selector);
} }
} }
static updateRoundNumber(roundNumber, cardPileNumber) { updateRoundNumber(roundNumber, cardPileNumber) {
if (ui.cardPileNumber) ui.cardPileNumber.innerHTML = `${roundNumber}轮 剩余牌: ${cardPileNumber}`; if (ui.cardPileNumber) ui.cardPileNumber.innerHTML = `${roundNumber}轮 剩余牌: ${cardPileNumber}`;
} }
} }
export const ui = UI; export let ui = new UI();
/**
* @param { InstanceType<typeof UI> } [instance]
*/
export let setUI = (instance) => {
ui = instance || new UI();
if (lib.config.dev) {
window.ui = ui;
}
};

View File

@ -1,4 +1,4 @@
import { Library as lib } from "../library/index.js"; import { lib } from "../library/index.js";
/** /**
* @param {string} name * @param {string} name