使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 = codemirror;
export default 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 { AI as ai } from "./noname/ai/index.js";
export { Game as game } from "./noname/game/index.js";
export { Get as get } from "./noname/get/index.js";
export { Library as lib } from "./noname/library/index.js";
export { status as _status } from "./noname/status/index.js";
export { UI as ui } from "./noname/ui/index.js";
export { boot } from "./noname/init/index.js";
export { GNC, gnc, setGNC } from './noname/gnc/index.js';
export { AI, ai, setAI } from './noname/ai/index.js';
export { Game, game, setGame } from './noname/game/index.js';
export { Get, get, setGet } from './noname/get/index.js';
export { Library, lib, setLibrary } from './noname/library/index.js';
export { status, _status, setStatus } from './noname/status/index.js';
export { UI, ui, setUI } from './noname/ui/index.js';
export { boot } from './noname/init/index.js';

View File

@ -1,11 +1,11 @@
export class Basic extends Uninstantable {
export class Basic {
/**
* @param { (
* button: Button,
* buttons?: Button[]
* ) => number } check
*/
static chooseButton(check: (button: Button, buttons?: Button[]) => number): boolean;
chooseButton(check: (button: any, buttons?: Button[]) => number): boolean | undefined;
/**
* @param { (
* card?: Card,
@ -13,13 +13,12 @@ export class Basic extends Uninstantable {
* ) => number } check
* @returns { boolean | undefined }
*/
static chooseCard(check: (card?: Card, cards?: Card[]) => number): boolean | undefined;
chooseCard(check: (card?: any, cards?: Card[]) => number): boolean | undefined;
/**
* @param { (
* target?: Player,
* targets?: Player[]
* ) => number } check
*/
static chooseTarget(check: (target?: Player, targets?: Player[]) => number): boolean;
chooseTarget(check: (target?: any, targets?: Player[]) => number): boolean | undefined;
}
import { Uninstantable } from "../util/index.js";

View File

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

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

View File

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

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

View File

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

View File

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

View File

@ -1,30 +1,32 @@
import { NonameAnnounceType } from "./interface.d.ts"
export interface IAnnounceSubscriber {
subscribe(name: string): void;
unsubscribe(name: string): void;
get isEmpty(): boolean
}
export type AnnounceSubscriberType<T> = new (
content: (value: T, name: string) => void,
target: EventTarget
) => IAnnounceSubscriber;
/**
* @template T
* @typedef {import("./index").AnnounceSubscriberType<T>} AnnounceSubscriberType
*/
/**
* @typedef {import("./index").IAnnounceSubscriber} IAnnounceSubscriber
*/
/**
*
*/
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 -
* @template T
* @param {string} name -
* @param {T} values -
* @returns {T}
*/
publish<Type extends NonameAnnounceType, Name extends keyof Type>(name: Name, values: Parameters<Type[Name]>[0]): Parameters<Type[Name]>[0]
publish<T>(name: string, values: T): T;
/**
*
*
@ -32,22 +34,45 @@ export class Announce {
*
*
*
* @param name -
* @param method -
* @template T
* @param {string} name -
* @param {(values: T) => void} method -
* @returns {(values: T) => void}
*/
subscribe<Type extends NonameAnnounceType, Name extends keyof Type>(name: Name, method: Type[Name]): Type[Name]
subscribe<T_1>(name: string, method: (values: T_1) => void): (values: T_1) => void;
/**
*
*
*
*
* @param name -
* @param method -
* @template T
* @param {string} name -
* @param {(values: T) => void} method -
* @returns {(values: T) => void}
*/
unsubscribe<Type extends NonameAnnounceType, Name extends keyof Type>(name: Name, method: Type[Name]): Type[Name]
unsubscribe<T_2>(name: string, method: (values: T_2) => void): (values: T_2) => void;
#private;
}
export class AnnounceSubscriber<T> implements IAnnounceSubscriber {
constructor(content: (value: T, name: string) => void, target: EventTarget)
/**
* @template T
*/
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
* @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 _ensureMember(obj: any, key: any): any;
static _wrapParametersToCacheKey(params: any): string;
static _wrapParameterToCacheKey(param: any): any;
lib: typeof Library;
game: typeof Game;
get: typeof Get;
lib: import("../index.js").Library;
game: import("../../game/index.js").Game;
get: import("../../get/index.js").Get;
sourceMap: Map<any, any>;
storageMap: Map<any, any>;
/**
@ -59,6 +59,3 @@ export class CacheContext {
*/
_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}
*/
_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 { Button } [button]
*/
constructor(item: {}, type: "character" | "tdnodes" | "blank" | "card" | "vcard" | "characterx" | "player" | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button);
constructor(item: {}, type: "character" | "tdnodes" | "blank" | "card" | "vcard" | "characterx" | "player" | ((item: {}, type: Function, position?: HTMLDivElement | DocumentFragment, noClick?: true, button?: Button) => Button), position?: HTMLDivElement | DocumentFragment | undefined, noClick?: true | undefined, button?: Button | undefined);
/**
* @type { string | undefined }
*/
buttonid: string | undefined;
exclude(): void;
get updateTransform(): (bool: any, delay: any) => void;
}
import { UI as ui } from '../../ui/index.js';
import { ui } from '../../ui/index.js';

View File

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

View File

@ -1,4 +1,4 @@
/**
* @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 { boolean } [zoom]
*/
add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean): string | HTMLDivElement | import("./player.js").Player[] | import("./card.js").Card[];
forcebutton: boolean;
add(item: string | HTMLDivElement | Card[] | Player[], noclick?: any, zoom?: boolean | undefined): string | any[] | HTMLDivElement;
forcebutton: boolean | undefined;
/**
* @param { string } str
* @param { boolean } [center]
*/
addText(str: string, center?: boolean): this;
addSmall(item: any, noclick: any): string | HTMLDivElement | import("./player.js").Player[] | import("./card.js").Card[];
addText(str: string, center?: boolean | undefined): this;
addSmall(item: any, noclick: any): string | any[] | HTMLDivElement;
addAuto(content: any): void;
open(): this;
open(): this | undefined;
_dragtransform: any;
close(): this;
/**

View File

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

View File

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

View File

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

View File

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

View File

@ -5,7 +5,7 @@ export class VCard {
* @param { string } [name]
* @param { string } [nature]
*/
constructor(suitOrCard?: any, numberOrCards?: number | Card[], name?: string, nature?: string);
constructor(suitOrCard?: any, numberOrCards?: number | any[] | undefined, name?: string | undefined, nature?: string | undefined);
/**
* @type {string}
*/
@ -22,7 +22,7 @@ export class VCard {
* @type {string}
*/
nature: string;
color: string;
color: string | undefined;
/**
* @type { boolean }
*/
@ -43,7 +43,7 @@ export class VCard {
/**
* @param { Player } player
*/
hasNature(nature: any, player: Player): boolean;
hasNature(nature: any, player: any): boolean;
getCacheKey(): string;
hasGaintag(tag: any): any;
}

View File

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

View File

@ -1,4 +1,4 @@
export class LibInitPromises extends Uninstantable {
export class LibInitPromises {
/**
* Promise版的`lib.init.js`
*
@ -6,7 +6,7 @@ export class LibInitPromises extends Uninstantable {
* @param {string | string[]} [file] - `path`
* @returns {Promise<Event>}
*/
static js(path: string, file?: string | string[]): Promise<Event>;
js(path: string, file?: string | string[] | undefined): Promise<Event>;
/**
* Promise版的`lib.init.css`
*
@ -16,7 +16,7 @@ export class LibInitPromises extends Uninstantable {
* @param {boolean} [noerror = false] -
* @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`
*
@ -24,19 +24,18 @@ export class LibInitPromises extends Uninstantable {
* @param {string} [master]
* @returns {Promise<ProgressEvent>}
*/
static req(str: string, master?: string): Promise<ProgressEvent>;
req(str: string, master?: string | undefined): Promise<ProgressEvent>;
/**
* Promise版的`lib.init.json`
*
* @param {string} url -
* @returns {Promise<object>}
*/
static json(url: string): Promise<object>;
json(url: string): Promise<object>;
/**
* Promise版的`lib.init.sheet`
*
* @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
@ -30,9 +31,9 @@ export function checkVersion(ver1: string, ver2: string): -1 | 0 | 1;
* ```
*/
export function getRepoTags(options?: {
username?: string;
repository?: string;
accessToken?: string;
username?: string | undefined;
repository?: string | undefined;
accessToken?: string | undefined;
}): Promise<{
commit: {
sha: string;
@ -58,9 +59,9 @@ export function getRepoTags(options?: {
* ```
*/
export function getRepoTagDescription(tagName: string, options?: {
username?: string;
repository?: string;
accessToken?: string;
username?: string | undefined;
repository?: string | undefined;
accessToken?: string | undefined;
}): Promise<{
/** @type { { browser_download_url: string, content_type: string, name: string, size: number }[] } tag额外上传的素材包 */
assets: {
@ -97,7 +98,7 @@ export function getRepoTagDescription(tagName: string, options?: {
* @param { string } [options.username = 'libccy']
* @param { string } [options.repository = 'noname']
* @param { string } [options.accessToken]
* @returns { Promise<{ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' } | { download_url: null, name: string, path: string, sha: string, size: 0, type: 'dir' }> }
* @returns { Promise<({ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' } | { download_url: null, name: string, path: string, sha: string, size: 0, type: 'dir' })[]> }
* @example
* ```js
* getRepoFilesList()
@ -105,11 +106,11 @@ export function getRepoTagDescription(tagName: string, options?: {
* .catch(error => console.error('Failed to fetch files:', error));
* ```
*/
export function getRepoFilesList(path?: string, branch?: string, options?: {
username?: string;
repository?: string;
accessToken?: string;
}): Promise<{
export function getRepoFilesList(path?: string | undefined, branch?: string | undefined, options?: {
username?: string | undefined;
repository?: string | undefined;
accessToken?: string | undefined;
}): Promise<({
download_url: string;
name: string;
path: string;
@ -123,17 +124,47 @@ export function getRepoFilesList(path?: string, branch?: string, options?: {
sha: string;
size: 0;
type: 'dir';
}>;
})[]>;
/**
*
* ()
* @param { string } [path = ''] ()
* @param { string } [branch = '']
* @param { Object } options
* @param { string } [options.username = 'libccy']
* @param { string } [options.repository = 'noname']
* @param { string } [options.accessToken]
* @returns { Promise<{ download_url: string, name: string, path: string, sha: string, size: number, type: 'file' }[]> }
* @example
* ```js
* flattenRepositoryFiles()
* .then(files => console.log(files))
* .catch(error => console.error('Failed to fetch files:', error));
* ```
*/
export function flattenRepositoryFiles(path?: string | undefined, branch?: string | undefined, options?: {
username?: string | undefined;
repository?: string | undefined;
accessToken?: string | undefined;
}): Promise<{
download_url: string;
name: string;
path: string;
sha: string;
size: number;
type: 'file';
}[]>;
/**
*
* @param { string } url
* @param { (receivedBytes: number, total?:number, filename?: string) => void } [onProgress]
* @param { RequestInit } [options={}]
* @example
* ```js
* await getRepoTagDescription('v1.10.10').then(({ zipball_url }) => request(zipball_url));
* ```
*/
export function request(url: string, onProgress?: (receivedBytes: number, total?: number, filename?: string) => void): Promise<Blob>;
export function request(url: string, onProgress?: ((receivedBytes: number, total?: number, filename?: string) => void) | undefined, options?: RequestInit | undefined): Promise<Blob>;
/**
*
* @param { string } [title]
@ -142,4 +173,4 @@ export function request(url: string, onProgress?: (receivedBytes: number, total?
* @param { string | number } [value]
* @returns { progress }
*/
export function createProgress(title?: string, max?: string | number, fileName?: string, value?: string | number): progress;
export function createProgress(title?: string | undefined, max?: string | number | undefined, fileName?: string | undefined, value?: string | number | undefined): progress;

View File

@ -1,30 +1,50 @@
export namespace status {
let paused: boolean;
let paused2: boolean;
let paused3: boolean;
let over: boolean;
let clicked: boolean;
let auto: boolean;
let event: GameEventPromise;
let ai: {};
let lastdragchange: any[];
let skillaudio: any[];
let dieClose: any[];
let dragline: any[];
let dying: any[];
let globalHistory: GameHistory[];
namespace cardtag {
let yingbian_zhuzhan: any[];
let yingbian_kongchao: any[];
let yingbian_fujia: any[];
let yingbian_canqu: any[];
let yingbian_force: any[];
export class status {
paused: boolean;
paused2: boolean;
paused3: boolean;
over: boolean;
clicked: boolean;
auto: boolean;
/**
* @type { GameEventPromise }
*/
event: any;
ai: {};
lastdragchange: any[];
skillaudio: any[];
dieClose: any[];
dragline: any[];
dying: any[];
/**
* @type { GameHistory[] }
*/
globalHistory: GameHistory[];
cardtag: {
yingbian_zhuzhan: never[];
yingbian_kongchao: never[];
yingbian_fujia: never[];
yingbian_canqu: never[];
yingbian_force: never[];
};
renku: any[];
prehidden_skills: any[];
postReconnect: {};
/**
* @type { string | void }
*/
extension: string | void;
/**
* @type { boolean | void }
*/
dragged: boolean | void;
/**
* @type { boolean | void }
*/
touchconfirmed: boolean | void;
/**
* @type { boolean | void }
*/
connectMode: boolean | void;
}
let renku: any[];
let prehidden_skills: any[];
let postReconnect: {};
let extension: string | void;
let dragged: boolean | void;
let touchconfirmed: 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 {
static identitycircle(): void;
static connectEvents(): void;
static connectClients(): void;
static autoskin(): void;
static skin(avatar: any, name: any, callback: any): void;
static touchpop(forced: any): void;
static exit(): void;
static shortcut(show: any): void;
static favouriteCharacter(e: any): void;
static buttonnameenter(): void;
static buttonnameleave(): void;
static dragtouchdialog(e: any): void;
static identity(e: any): void;
static identity2(): void;
static roundmenu(): void;
static pausehistory(): import("../../library/element/dialog.js").Dialog;
static pauseconfig(): import("../../library/element/dialog.js").Dialog;
static cardPileButton(): import("../../library/element/dialog.js").Dialog;
static chat(): import("../../library/element/dialog.js").Dialog;
static volumn(): import("../../library/element/dialog.js").Dialog;
static volumn_background(e: any): void;
static volumn_audio(e: any): void;
static hoverpopped(): void;
static hoverpopped_leave(): void;
static leavehoverpopped(): void;
static dierevive(): void;
static dieswap(): void;
static dieswap2(): void;
static touchconfirm(): void;
static windowtouchstart(e: any): void;
static windowtouchmove(e: any): void;
static windowtouchend(e: any): void;
static checkroundtranslate(translate: any): void;
static checkdialogtranslate(translate: any, dialog: any): void;
static windowmousewheel(e: any): void;
static windowmousemove(e: any): void;
static windowmousedown(e: any): void;
static cardtouchstart(e: any): void;
static cardtouchmove(e: any): void;
static windowmouseup(e: any): void;
static mousemove(): void;
static mouseenter(): void;
static mouseleave(): void;
static mousedown(): void;
static mouseentercancel(): void;
static hoverplayer(e: any): import("../../library/element/dialog.js").Dialog;
static longpressdown(e: any): void;
static longpresscallback(): void;
static longpresscancel(): void;
static window(): void;
static toggle(): void;
static editor(): void;
static switcher(): void;
static choice(): void;
static button(): void;
static touchintro(): void;
static card(...args: any[]): void;
static avatar(): void;
static avatar2(): void;
static connectroom(e: any): void;
static player(...args: any[]): any;
static target(e: any): void;
static control2(): void;
static control(): void;
static dialogcontrol(): void;
static skill(skill: any): void;
static ok(node: any): void;
static cancel(node: any): void;
static logv(e: any): void;
static logvleave(): void;
static charactercard(name: any, sourcenode: any, noedit: any, resume: any, avatar: any): void;
static intro(e: any): import("../../library/element/dialog.js").Dialog;
static intro2(): void;
static auto(...args: any[]): void;
static wuxie(): void;
static tempnowuxie(): void;
static pause(): void;
static resume(e: any): boolean;
static config(): void;
static swap(): void;
static mousewheel(evt: any): void;
static touchStart(e: any): void;
static dialogtouchStart(e: any): void;
static touchScroll(e: any): void;
static autoskill(bool: any, node: any): void;
static skillbutton(): void;
static autoskill2(e: any): void;
static hiddenskill(e: any): void;
static rightplayer(e: any): boolean;
static right(e: any): boolean;
export class Click {
/**
* @type {() => void}
*/
consoleMenu: () => void;
/**
* @type {(arg0: string) => void}
*/
menuTab: (arg0: string) => void;
identitycircle(): void;
connectEvents(): void;
connectClients(): void;
autoskin(): void;
skin(avatar: any, name: any, callback: any): void;
touchpop(forced: any): void;
exit(): void;
shortcut(show: any): void;
favouriteCharacter(e: any): void;
innerHTML: string | undefined;
buttonnameenter(): void;
buttonnameleave(): void;
dragtouchdialog(e: any): void;
_dragorigin: {
clientX: any;
clientY: any;
} | undefined;
_dragtransform: number[] | undefined;
_dragorigintransform: number[] | undefined;
identity(e: any): void;
_customintro: ((uiintro: any) => void) | undefined;
identity2(): void;
roundmenu(): void;
pausehistory(): import("../../library/element/dialog.js").Dialog | undefined;
pauseconfig(): import("../../library/element/dialog.js").Dialog | undefined;
cardPileButton(): import("../../library/element/dialog.js").Dialog;
chat(): import("../../library/element/dialog.js").Dialog;
volumn(): import("../../library/element/dialog.js").Dialog;
volumn_background(e: any): void;
volumn_audio(e: any): void;
hoverpopped(): void;
_uiintro: any;
hoverpopped_leave(): void;
_poppedalready: boolean | undefined;
leavehoverpopped(): void;
dierevive(): void;
dieswap(): void;
dieswap2(): void;
touchconfirm(): void;
windowtouchstart(e: any): void;
windowtouchmove(e: any): void;
windowtouchend(e: any): void;
checkroundtranslate(translate: any): void;
checkdialogtranslate(translate: any, dialog: any): void;
windowmousewheel(e: any): void;
windowmousemove(e: any): void;
windowmousedown(e: any): void;
cardtouchstart(e: any): void;
_waitingfordrag: {
clientX: any;
clientY: any;
} | undefined;
cardtouchmove(e: any): void;
windowmouseup(e: any): void;
mousemove(): void;
mouseenter(): void;
mouseleave(): void;
_mouseentercreated: boolean | undefined;
mousedown(): void;
mouseentercancel(): void;
hoverplayer(e: any): import("../../library/element/dialog.js").Dialog | undefined;
longpressdown(e: any): void;
_longpresstimeout: NodeJS.Timeout | undefined;
_longpressevent: any;
longpresscallback(): void;
longpresscancel(): void;
window(): void;
toggle(): void;
link: boolean | undefined;
editor(): void;
switcher(): void;
choice(): void;
button(): void;
touchintro(): void;
card(...args: any[]): void;
avatar(): void;
_doubleClicking: boolean | undefined;
avatar2(): void;
connectroom(e: any): void;
player(...args: any[]): void;
target(e: any): void;
control2(): void;
control(): void;
dialogcontrol(): void;
skill(skill: any): void;
ok(node: any): void;
cancel(node: any): void;
logv(e: any): void;
logvtimeout: any;
logvleave(): void;
charactercard(name: any, sourcenode: any, noedit: any, resume: any, avatar: any): void;
intro(e: any): import("../../library/element/dialog.js").Dialog | undefined;
intro2(): void;
auto(...args: any[]): void;
wuxie(): void;
tempnowuxie(): void;
pause(): void;
resume(e: any): false | undefined;
config(): void;
swap(): void;
mousewheel(evt: any): void;
touchStart(e: any): void;
startX: number | undefined;
startY: number | undefined;
dialogtouchStart(e: any): void;
touchScroll(e: any): void;
autoskill(bool: any, node: any): void;
skillbutton(): void;
autoskill2(e: any): void;
hiddenskill(e: any): void;
rightplayer(e: any): boolean;
right(e: any): false | undefined;
}
import { Uninstantable } from "../../util/index.js";

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编辑器
* @param {HTMLDivElement} container
* @param {Function} saveInput
*/
static editor(container: HTMLDivElement, saveInput: Function): HTMLDivElement;
static cardTempName(card: any, applyNode: any): any;
static connectRooms(list: any): void;
static rarity(button: any): void;
static div(...args: any[]): HTMLDivElement;
static filediv(...args: any[]): any;
static node(...args: any[]): any;
static iframe(src: any): void;
static identitycircle(list: any, target: any): void;
static chat(): void;
static exit(): void;
static connecting(bool: any): void;
static roomInfo(): void;
static templayer(time: any): void;
static selectlist(list: any, init: any, position: any, onchange: any): HTMLSelectElement;
editor(container: HTMLDivElement, saveInput: Function): HTMLDivElement;
cardTempName(card: any, applyNode: any): any;
connectRooms(list: any): void;
rarity(button: any): void;
div(...args: any[]): HTMLDivElement;
filediv(...args: any[]): HTMLDivElement;
node(...args: any[]): any;
iframe(src: any): void;
identitycircle(list: any, target: any): void;
chat(): void;
exit(): void;
connecting(bool: any): void;
roomInfo(): void;
templayer(time: any): void;
selectlist(list: any, init: any, position: any, onchange: any): HTMLSelectElement;
/** 创建菜单 */
static menu: typeof menu;
menu: typeof menu;
/** 创建“开始”菜单 */
static startMenu: (connectMenu: any) => HTMLDivElement;
startMenu: (connectMenu: any) => HTMLDivElement;
/** 创建“选项”菜单 */
static optionsMenu: (connectMenu: any) => void;
optionsMenu: (connectMenu: any) => void;
/** 创建“武将”菜单 */
static characterPackMenu: (connectMenu: any) => (packName: string) => void;
characterPackMenu: (connectMenu: any) => (packName: string) => void;
/** 创建“卡牌”菜单 */
static cardPackMenu: (connectMenu: any) => (packName: string) => void;
cardPackMenu: (connectMenu: any) => (packName: string) => void;
/** 创建“扩展”菜单 */
static extensionMenu: (connectMenu: any) => void;
extensionMenu: (connectMenu: any) => void;
/** 创建“其他”菜单 */
static otherMenu: (connectMenu: any) => void;
static statictable(...args: any[]): HTMLTableElement;
static giveup(): void;
static groupControl(dialog: any): import("../../library/element/control.js").Control;
static cardDialog(...args: any[]): any;
static characterDialog2(filter: any): import("../../library/element/dialog.js").Dialog;
static characterDialog(...args: any[]): import("../../library/element/dialog.js").Dialog;
static dialog(...args: any[]): import("../../library/element/dialog.js").Dialog;
static line2(...args: any[]): any;
static line(...args: any[]): HTMLDivElement;
static switcher(name: any, current: any, current2: any, ...args: any[]): HTMLDivElement;
static caption(str: any, position: any): HTMLDivElement;
static control(...args: any[]): import("../../library/element/control.js").Control;
static confirm(str: any, func: any): void;
static skills(skills: any): import("../../library/element/control.js").Control;
static skills2(skills: any): import("../../library/element/control.js").Control;
static skills3(skills: any): import("../../library/element/control.js").Control;
static arena(): void;
static system(str: any, func: any, right: any, before: any): HTMLDivElement;
static pause(): HTMLDivElement;
static prebutton(item: any, type: any, position: any, noclick: any): HTMLDivElement;
static buttonPresets: {
otherMenu: (connectMenu: boolean | undefined) => void;
statictable(...args: any[]): HTMLTableElement;
giveup(): void;
groupControl(dialog: any): import("../../library/element/control.js").Control;
cardDialog(...args: any[]): import("../../library/element/dialog.js").Dialog;
characterDialog2(filter: any): import("../../library/element/dialog.js").Dialog;
characterDialog(...args: any[]): import("../../library/element/dialog.js").Dialog;
dialog(...args: any[]): import("../../library/element/dialog.js").Dialog;
line2(...args: any[]): HTMLDivElement;
line(...args: any[]): HTMLDivElement;
switcher(name: any, current: any, current2: any, ...args: any[]): HTMLDivElement;
caption(str: any, position: any): HTMLDivElement;
control(...args: any[]): import("../../library/element/control.js").Control;
confirm(str: any, func: any): void;
skills(skills: any): any;
skills2(skills: any): any;
skills3(skills: any): any;
arena(): void;
system(str: any, func: any, right: any, before: any): HTMLDivElement;
pause(): HTMLDivElement | undefined;
prebutton(item: any, type: any, position: any, noclick: any): HTMLDivElement;
buttonPresets: {
/**
* @returns { import("../library/index.js").Button }
*/
@ -95,16 +99,15 @@ export class Create extends Uninstantable {
*/
player: (item: any, type: any, position: any, noclick: any, node: any) => any;
};
static button(item: any, type: any, position: any, noClick: any, button: any): import("../../library/element/button.js").Button;
static buttons(list: any, type: any, position: any, noclick: any, zoom: any): HTMLDivElement[];
static textbuttons(list: any, dialog: any, noclick: any): void;
static player(position: any, noclick: any): import("../../library/element/player.js").Player;
static connectPlayers(ip: any): void;
static players(numberOfPlayers: any): import("../../library/element/player.js").Player[];
static me(hasme: any): void;
static card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card;
static cardsAsync(...args: any[]): void;
static cards(ordered: any): void;
button(item: any, type: any, position: any, noClick: any, button: any): import("../../library/element/button.js").Button;
buttons(list: any, type: any, position: any, noclick: any, zoom: any): HTMLDivElement[];
textbuttons(list: any, dialog: any, noclick: any): void;
player(position: any, noclick: any): import("../../library/element/player.js").Player;
connectPlayers(ip: any): void;
players(numberOfPlayers: any): any[] | undefined;
me(hasme: any): void;
card(position: any, info: any, noclick: any): import("../../library/element/card.js").Card;
cardsAsync(...args: any[]): void;
cards(ordered: any): void;
}
import { Uninstantable } from "../../util/index.js";
import { menu } from "./menu/index.js";

View File

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

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

View File

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

View File

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

View File

@ -1,19 +1,23 @@
import { Get as get } from '../get/index.js';
import { Game as game } from '../game/index.js';
import { status as _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js';
import { Library as lib } from '../library/index.js';
import { GNC as gnc } from '../gnc/index.js';
import { Uninstantable } from "../util/index.js";
import { get } from '../get/index.js';
import { lib } from '../library/index.js';
import { Basic } from './basic.js';
export class AI extends Uninstantable {
static basic = Basic;
static get = get;
export class AI {
basic = new Basic();
get = get;
};
export const ai = AI;
export let ai = new AI();
/**
* @param { InstanceType<typeof AI> } [instance]
*/
export let setAI = (instance) => {
ai = instance || new AI();
if (lib.config.dev) {
window.ai = ai;
}
};
export {
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, Game } from "./index.js";
import { game } from "../../noname.js";
export class GamePromises extends Uninstantable {
export class GamePromises {
/**
* 模仿h5的prompt用于显示可提示用户进行输入的对话框
*
@ -32,7 +31,7 @@ export class GamePromises extends Uninstantable {
*
*/
// @ts-ignore
static prompt(alertOption, title, forced) {
prompt(alertOption, title, forced) {
return new Promise((resolve, reject) => {
if (alertOption !== 'alert') {
// @ts-ignore
@ -54,29 +53,33 @@ export class GamePromises extends Uninstantable {
* ```
* @returns { Promise<true> }
*/
static alert(title) {
alert(title) {
return new Promise((resolve, reject) => {
game.prompt(title, 'alert', resolve);
});
}
// 读写函数promises化(不用考虑其对应函数是否存在)
static download(url, folder, dev, onprogress) {
download(url, folder, dev, onprogress) {
return new Promise((resolve, reject) => {
// @ts-ignore
game.download(url, folder, resolve, reject, dev, onprogress);
});
}
static readFile(filename) {
readFile(filename) {
return new Promise((resolve, reject) => {
// @ts-ignore
game.readFile(filename, resolve, reject);
});
}
static readFileAsText(filename) {
readFileAsText(filename) {
return new Promise((resolve, reject) => {
// @ts-ignore
game.readFileAsText(filename, resolve, reject);
});
}
static writeFile(data, path, name) {
writeFile(data, path, name) {
return (new Promise((resolve, reject) => {
// @ts-ignore
game.writeFile(data, path, name, resolve);
})).then(result => {
return new Promise((resolve, reject) => {
@ -88,26 +91,30 @@ export class GamePromises extends Uninstantable {
});
});
}
static ensureDirectory(list, callback, file) {
ensureDirectory(list, callback, file) {
return new Promise((resolve, reject) => {
game.ensureDirectory(list, callback, file).then(resolve).catch(reject);
// @ts-ignore
game.ensureDirectory(list, resolve, file);
});
}
static createDir(directory) {
createDir(directory) {
return new Promise((resolve, reject) => {
// @ts-ignore
game.createDir(directory, resolve, reject);
});
}
static removeFile(filename) {
removeFile(filename) {
return /** @type {Promise<void>} */(new Promise((resolve, reject) => {
// @ts-ignore
game.removeFile(filename, err => {
if (err) reject(err);
else resolve();
});
}));
}
static removeDir(directory) {
removeDir(directory) {
return /** @type {Promise<void>} */(new Promise((resolve, reject) => {
// @ts-ignore
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 { AI as ai } from '../ai/index.js';
import { Game as game } from '../game/index.js';
import { Library as lib } from '../library/index.js';
import { status as _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js';
import { GNC as gnc } from '../gnc/index.js';
import { Get as get } from "./index.js";
import { userAgent } from "../util/index.js";
import { game } from '../game/index.js';
import { lib } from '../library/index.js';
import { _status } from '../status/index.js';
import { ui } from '../ui/index.js';
import { get } from "./index.js";
export class Is extends Uninstantable {
export class Is {
/**
* 判断是否为进攻坐骑
* @param { Card | VCard } card
* @param { false | Player } [player]
* @returns { boolean }
*/
static attackingMount(card, player) {
attackingMount(card, player) {
const subtype = get.subtype(card, player);
if (subtype == 'equip4') return true;
else if (subtype == 'equip6') {
@ -30,7 +28,7 @@ export class Is extends Uninstantable {
* @param { false | Player } [player]
* @returns { boolean }
*/
static defendingMount(card, player) {
defendingMount(card, player) {
const subtype = get.subtype(card, player);
if (subtype == 'equip3') return true;
else if (subtype == 'equip6') {
@ -44,7 +42,7 @@ export class Is extends Uninstantable {
* 判断坐骑栏是否被合并
* @returns { boolean }
*/
static mountCombined() {
mountCombined() {
if (lib.configOL.mount_combine) {
return lib.configOL.mount_combine;
}
@ -58,7 +56,7 @@ export class Is extends Uninstantable {
* @param {...} infos 要判断的属性列表
* @param {boolean} every 是否判断每一个传入的属性是否完全相同而不是存在部分相同
*/
static sameNature() {
sameNature() {
let processedArguments = [], every = false;
Array.from(arguments).forEach(argument => {
if (typeof argument == 'boolean') every = argument;
@ -90,7 +88,7 @@ export class Is extends Uninstantable {
* @param ...infos 要判断的属性列表
* @param every {boolean} 是否判断每一个传入的属性是否完全不同而不是存在部分不同
*/
static differentNature() {
differentNature() {
let processedArguments = [], every = false;
Array.from(arguments).forEach(argument => {
if (typeof argument == 'boolean') every = argument;
@ -121,7 +119,7 @@ export class Is extends Uninstantable {
* 判断一张牌是否为明置手牌
* @param { Card } card
*/
static shownCard(card) {
shownCard(card) {
if (!card) return false;
const gaintag = card.gaintag;
return Array.isArray(gaintag) && gaintag.some(tag => tag.startsWith('visible_'));
@ -131,7 +129,7 @@ export class Is extends Uninstantable {
* @param { Card | VCard } card
*/
// @ts-ignore
static virtualCard(card) {
virtualCard(card) {
return (!("cards" in card) || !Array.isArray(card.cards) || card.cards.length === 0);
}
/**
@ -139,7 +137,7 @@ export class Is extends Uninstantable {
* @param { Card | VCard } card
*/
// @ts-ignore
static convertedCard(card) {
convertedCard(card) {
return !card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length > 0;
}
/**
@ -147,7 +145,7 @@ export class Is extends Uninstantable {
* @param { Card | VCard } card
*/
// @ts-ignore
static ordinaryCard(card) {
ordinaryCard(card) {
return card.isCard && ("cards" in card) && Array.isArray(card.cards) && card.cards.length === 1
}
/**
@ -155,7 +153,7 @@ export class Is extends Uninstantable {
* @param { string } str1
* @param { string } str2
*/
static yayun(str1, str2) {
yayun(str1, str2) {
if (str1 == str2) return true;
let pinyin1 = get.pinyin(str1, false), pinyin2 = get.pinyin(str2, false);
if (!pinyin1.length || !pinyin2.length) return false;
@ -168,7 +166,7 @@ export class Is extends Uninstantable {
* @param { Player } player 玩家
* @returns
*/
static blocked(skill, player) {
blocked(skill, player) {
if (!player.storage.skill_blocker || !player.storage.skill_blocker.length) return false;
for (let i of player.storage.skill_blocker) {
if (lib.skill[i] && lib.skill[i].skillBlocker && lib.skill[i].skillBlocker(skill, player)) return true;
@ -181,7 +179,7 @@ export class Is extends Uninstantable {
* @param { string[] } array
* @returns { boolean | string[] }
*/
static double(name, array) {
double(name, array) {
const extraInformations = get.character(name, 4);
if (!extraInformations) return false;
for (const extraInformation of extraInformations) {
@ -196,11 +194,11 @@ export class Is extends Uninstantable {
* 检测此牌是否具有应变条件
* @param { Card | VCard } card
*/
static yingbianConditional(card) { return get.is.complexlyYingbianConditional(card) || get.is.simplyYingbianConditional(card) }
yingbianConditional(card) { return get.is.complexlyYingbianConditional(card) || get.is.simplyYingbianConditional(card) }
/**
* @param { Card | VCard } card
*/
static complexlyYingbianConditional(card) {
complexlyYingbianConditional(card) {
for (const key of lib.yingbian.condition.complex.keys()) {
if (get.cardtag(card, `yingbian_${key}`)) return true;
}
@ -209,7 +207,7 @@ export class Is extends Uninstantable {
/**
* @param { Card | VCard } card
*/
static simplyYingbianConditional(card) {
simplyYingbianConditional(card) {
for (const key of lib.yingbian.condition.simple.keys()) {
if (get.cardtag(card, `yingbian_${key}`)) return true;
}
@ -222,7 +220,7 @@ export class Is extends Uninstantable {
*
* @param { Card | VCard } card
*/
static yingbianEffective(card) {
yingbianEffective(card) {
for (const key of lib.yingbian.effect.keys()) {
if (get.cardtag(card, `yingbian_${key}`)) return true;
}
@ -231,11 +229,11 @@ export class Is extends Uninstantable {
/**
* @param { Card | VCard } card
*/
static yingbian(card) { return get.is.yingbianConditional(card) || get.is.yingbianEffective(card) }
yingbian(card) { return get.is.yingbianConditional(card) || get.is.yingbianEffective(card) }
/**
* @param { string } [substring]
*/
static emoji(substring) {
emoji(substring) {
if (substring) {
const reg = new RegExp("[~#^$@%&!?%*]", 'g');
if (substring.match(reg)) {
@ -284,23 +282,23 @@ export class Is extends Uninstantable {
/**
* @param { string } str
*/
static banWords(str) { return get.is.emoji(str) || window.bannedKeyWords.some(item => str.includes(item)) }
banWords(str) { return get.is.emoji(str) || window.bannedKeyWords.some(item => str.includes(item)) }
/**
* @param { GameEventPromise } event
*/
// @ts-ignore
static converted(event) { return !(event.card && event.card.isCard) }
static safari() { return userAgent.indexOf('safari') != -1 && userAgent.indexOf('chrome') == -1 }
converted(event) { return !(event.card && event.card.isCard) }
safari() { return userAgent.indexOf('safari') != -1 && userAgent.indexOf('chrome') == -1 }
/**
* @param { (Card | VCard)[]} cards
*/
// @ts-ignore
static freePosition(cards) { return !cards.some(card => !card.hasPosition || card.hasPosition()) }
freePosition(cards) { return !cards.some(card => !card.hasPosition || card.hasPosition()) }
/**
* @param { string } name
* @param { boolean } item
*/
static nomenu(name, item) {
nomenu(name, item) {
const menus = ['system', 'menu'];
const configs = {
show_round_menu: lib.config.show_round_menu,
@ -334,7 +332,7 @@ export class Is extends Uninstantable {
}
return true;
}
static altered(skillName) { return false; }
altered(skillName) { return false; }
/*
skill=>{
return false;
@ -346,25 +344,25 @@ export class Is extends Uninstantable {
* @param { any } obj
* @returns { boolean }
*/
static node(obj) {
node(obj) {
return Object.prototype.toString.call(obj).startsWith('[object HTML');
}
/**
* @param { any } obj
*/
static div(obj) { return Object.prototype.toString.call(obj) === '[object HTMLDivElement]' }
div(obj) { return Object.prototype.toString.call(obj) === '[object HTMLDivElement]' }
/**
* @param { any } obj
*/
static map(obj) { return Object.prototype.toString.call(obj) === '[object Map]' }
map(obj) { return Object.prototype.toString.call(obj) === '[object Map]' }
/**
* @param { any } obj
*/
static set(obj) { return Object.prototype.toString.call(obj) === '[object Set]' }
set(obj) { return Object.prototype.toString.call(obj) === '[object Set]' }
/**
* @param { any } obj
*/
static object(obj) { return Object.prototype.toString.call(obj) === '[object Object]' }
object(obj) { return Object.prototype.toString.call(obj) === '[object Object]' }
/**
* @overload
* @param { Function } func
@ -375,7 +373,7 @@ export class Is extends Uninstantable {
* @param { number | [number, number] } func
* @returns { boolean }
*/
static singleSelect(func) {
singleSelect(func) {
if (typeof func == 'function') return false;
const select = get.select(func);
return select[0] == 1 && select[1] == 1;
@ -383,7 +381,7 @@ export class Is extends Uninstantable {
/**
* @param { string | Player } name
*/
static jun(name) {
jun(name) {
if (get.mode() == 'guozhan') {
if (name instanceof lib.element.Player) {
if (name.isUnseen && name.isUnseen(0)) return false;
@ -395,23 +393,23 @@ export class Is extends Uninstantable {
}
return false;
}
static versus() { return !_status.connectMode && get.mode() == 'versus' && _status.mode == 'three' }
static changban() { return get.mode() == 'single' && _status.mode == 'changban' }
static single() { return get.mode() == 'single' && _status.mode == 'normal' }
versus() { return !_status.connectMode && get.mode() == 'versus' && _status.mode == 'three' }
changban() { return get.mode() == 'single' && _status.mode == 'changban' }
single() { return get.mode() == 'single' && _status.mode == 'normal' }
/**
* @param { Player } [player]
*/
static mobileMe(player) { return (game.layout == 'mobile' || game.layout == 'long') && !game.chess && player && player.dataset.position == '0' }
static newLayout() { return game.layout != 'default' }
static phoneLayout() {
mobileMe(player) { return (game.layout == 'mobile' || game.layout == 'long') && !game.chess && player && player.dataset.position == '0' }
newLayout() { return game.layout != 'default' }
phoneLayout() {
if (!lib.config.phonelayout) return false;
return (game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova');
}
static singleHandcard() { return game.singleHandcard || game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova' }
singleHandcard() { return game.singleHandcard || game.layout == 'mobile' || game.layout == 'long' || game.layout == 'long2' || game.layout == 'nova' }
/**
* @param { Player } player
*/
static linked2(player) {
linked2(player) {
if (game.chess) return true;
if (lib.config.link_style2 != 'rotate') return true;
// if(game.chess) return false;
@ -424,17 +422,17 @@ export class Is extends Uninstantable {
/**
* @param { {} } obj
*/
static empty(obj) { return Object.keys(obj).length == 0 }
empty(obj) { return Object.keys(obj).length == 0 }
/**
* @param { string } str
*/
static pos(str) { return str == 'h' || str == 'e' || str == 'j' || str == 'he' || str == 'hj' || str == 'ej' || str == 'hej' }
pos(str) { return str == 'h' || str == 'e' || str == 'j' || str == 'he' || str == 'hj' || str == 'ej' || str == 'hej' }
/**
* @param { string } skill
* @param { Player } player
* @returns
*/
static locked(skill, player) {
locked(skill, player) {
const info = lib.skill[skill];
if (typeof info.locked == 'function') return info.locked(skill, player);
if (info.locked == false) return false;
@ -448,7 +446,7 @@ export class Is extends Uninstantable {
* @param { Player } player
* @returns
*/
static zhuanhuanji(skill, player) {
zhuanhuanji(skill, player) {
const info = lib.skill[skill], { zhuanhuanji } = info;
if ('zhuanhuanji2' in info) {
const { zhuanhuanji2 } = info;

View File

@ -1,11 +1,10 @@
import { get } from "./index.js";
import { Uninstantable } from "../util/index.js";
export class Promises extends Uninstantable {
export class Promises {
/**
* @returns { Promise<JSZip> }
*/
static zip() {
zip() {
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";
// gnc: GeNCoroutine
export class GNC extends Uninstantable {
export class GNC {
/**
* @param {GeneratorFunction} fn
* @returns
*/
static of(fn) {
return Is.generatorFunc(fn) ?
of(fn) {
return this.is.generatorFunc(fn) ?
/**
* @param {Parameters<typeof fn>} args
* @returns {Promise<ReturnType<typeof fn>>}
@ -45,7 +45,14 @@ export class GNC extends Uninstantable {
return new Promise(callback);
} : (() => { throw new TypeError("gnc.of needs a GeneratorFunction."); })();
}
static is = Is;
is = new Is();
};
export const gnc = GNC;
export let gnc = new GNC();
/**
* @param { InstanceType<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
* @returns {boolean}
*/
static coroutine(item) {
coroutine(item) {
return typeof item == "function" && item.name == "genCoroutine";
}
@ -13,7 +13,7 @@ export class Is extends Uninstantable {
* @param {*} item
* @returns {boolean}
*/
static generatorFunc(item) {
generatorFunc(item) {
return item instanceof GeneratorFunction;
}
@ -21,7 +21,7 @@ export class Is extends Uninstantable {
* @param {*} item
* @returns {boolean}
*/
static generator(item) {
generator(item) {
return (typeof item == "object") && ("constructor" in item) && item.constructor && ("constructor" in item.constructor) && item.constructor.constructor === GeneratorFunction;
}
};

View File

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

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';
/**

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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