@wwawing/engine 3.13.0-acorn-statement.based-on.3.12.3.p.5 → 3.13.0-acorn-statement.based-on.3.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/wwa_data.d.ts CHANGED
@@ -255,12 +255,13 @@ export declare enum MacroType {
255
255
  MAP2 = 61,
256
256
  SHOW_STR2 = 62,
257
257
  CONSOLE_LOG2 = 63,
258
+ DELAYBGM = 64,
258
259
  GAMEPAD_BUTTON = 100,
259
260
  OLDMOVE = 101,
260
261
  LEGACY_IF = 10050
261
262
  }
262
- export declare type ConditionalExecuteMacroType = MacroType.IF | MacroType.ELSE_IF | MacroType.ELSE | MacroType.END_IF;
263
- export declare type PreprocessMacroType = ConditionalExecuteMacroType | MacroType.SHOW_STR | MacroType.SHOW_STR2;
263
+ export type ConditionalExecuteMacroType = MacroType.IF | MacroType.ELSE_IF | MacroType.ELSE | MacroType.END_IF;
264
+ export type PreprocessMacroType = ConditionalExecuteMacroType | MacroType.SHOW_STR | MacroType.SHOW_STR2;
264
265
  export declare var macrotable: {
265
266
  "": number;
266
267
  $imgplayer: number;
@@ -324,6 +325,7 @@ export declare var macrotable: {
324
325
  $map2: number;
325
326
  $show_str2: number;
326
327
  $console_log2: number;
328
+ $delaybgm: number;
327
329
  $gamepad_button: number;
328
330
  $oldmove: number;
329
331
  };
@@ -352,7 +354,7 @@ export declare enum SystemSound {
352
354
  export declare const speedList: number[];
353
355
  export declare const speedNameList: string[];
354
356
  export declare const StatusKind: readonly ["energy", "strength", "defence", "gold"];
355
- export declare type StatusKind = typeof StatusKind[number];
357
+ export type StatusKind = typeof StatusKind[number];
356
358
  export declare class WWAConsts {
357
359
  static WWA_HOME: string;
358
360
  static ITEMBOX_SIZE: number;
@@ -567,8 +569,8 @@ export declare enum IDTable {
567
569
  BITSHIFT = 16,
568
570
  BITMASK = 65535
569
571
  }
570
- export declare type StatusSolutionKind = "all" | "bare" | "equipment";
571
- export declare type UserVarNameListRequestErrorKind = JsonResponseErrorKind | "notObject" | "noFileSpecified";
572
+ export type StatusSolutionKind = "all" | "bare" | "equipment";
573
+ export type UserVarNameListRequestErrorKind = JsonResponseErrorKind | "notObject" | "noFileSpecified";
572
574
  export interface ScoreOptions {
573
575
  rates: ScoreRates;
574
576
  }
@@ -1,11 +1,11 @@
1
1
  import type { EquipmentStatus, Status, Coord, PartsType, Direction } from "../wwa_data";
2
- export declare type SetMacroType = 'VARIABLE' | 'MAP' | 'OBJECT' | 'ITEM' | 'NUMBER' | 'HP' | 'HPMAX' | 'AT' | 'AT_TOTAL' | 'AT_ITEMS' | 'DF' | 'DF_TOTAL' | 'DF_ITEMS' | 'GD' | 'TIME' | 'STEP' | 'X' | 'Y' | 'PX' | 'PY' | 'PDIR' | 'ID' | 'TYPE' | 'ITEM_COUNT_ALL' | 'RAND' | 'ITEM_COUNT';
3
- export declare type CNumberKind = "NUMBER";
4
- export declare type CVariableKind = "VARIABLE";
5
- export declare type CPartsKind = "MAP" | "OBJECT";
6
- export declare type CItemKind = "ITEM";
7
- export declare type CEnvKind = "HP" | "HPMAX" | "AT" | "AT_TOTAL" | "AT_ITEMS" | "DF" | "DF_TOTAL" | "DF_ITEMS" | "GD" | "STEP" | "TIME" | "X" | "Y" | "PX" | "PY" | "PDIR" | "ID" | "TYPE" | "ITEM_COUNT_ALL";
8
- export declare type CFunctionKind = "RAND" | "ITEM_COUNT";
2
+ export type SetMacroType = 'VARIABLE' | 'MAP' | 'OBJECT' | 'ITEM' | 'NUMBER' | 'HP' | 'HPMAX' | 'AT' | 'AT_TOTAL' | 'AT_ITEMS' | 'DF' | 'DF_TOTAL' | 'DF_ITEMS' | 'GD' | 'TIME' | 'STEP' | 'X' | 'Y' | 'PX' | 'PY' | 'PDIR' | 'ID' | 'TYPE' | 'ITEM_COUNT_ALL' | 'RAND' | 'ITEM_COUNT';
3
+ export type CNumberKind = "NUMBER";
4
+ export type CVariableKind = "VARIABLE";
5
+ export type CPartsKind = "MAP" | "OBJECT";
6
+ export type CItemKind = "ITEM";
7
+ export type CEnvKind = "HP" | "HPMAX" | "AT" | "AT_TOTAL" | "AT_ITEMS" | "DF" | "DF_TOTAL" | "DF_ITEMS" | "GD" | "STEP" | "TIME" | "X" | "Y" | "PX" | "PY" | "PDIR" | "ID" | "TYPE" | "ITEM_COUNT_ALL";
8
+ export type CFunctionKind = "RAND" | "ITEM_COUNT";
9
9
  export interface CNumber {
10
10
  type: CNumberKind;
11
11
  rawValue: number;
@@ -30,10 +30,10 @@ export interface CFunction {
30
30
  type: CFunctionKind;
31
31
  argument: CValue;
32
32
  }
33
- export declare type CValue = CNumber | CVariable | CParts | CItem | CEnv;
34
- export declare type Comparable = CValue | CFunction;
35
- export declare type ComparisionOperatorKind = "<" | ">" | "<=" | ">=" | "==" | "!=";
36
- export declare type Descriminant = boolean | {
33
+ export type CValue = CNumber | CVariable | CParts | CItem | CEnv;
34
+ export type Comparable = CValue | CFunction;
35
+ export type ComparisionOperatorKind = "<" | ">" | "<=" | ">=" | "==" | "!=";
36
+ export type Descriminant = boolean | {
37
37
  left: Comparable;
38
38
  right: Comparable;
39
39
  operator: ComparisionOperatorKind;
@@ -18,5 +18,5 @@ export interface NoExtraArgumentValueeAssignOperation {
18
18
  assignee: "energy" | "energyMax" | "strength" | "defence" | "gold" | "moveCount" | "playerDirection";
19
19
  rawValue: number;
20
20
  }
21
- export declare type ValueAssignOperation = VariableAssignOperation | CoordAssignOperation | ItemAssignOperation | NoExtraArgumentValueeAssignOperation;
21
+ export type ValueAssignOperation = VariableAssignOperation | CoordAssignOperation | ItemAssignOperation | NoExtraArgumentValueeAssignOperation;
22
22
  export declare function generateValueAssignOperation(calcResult: number, assigneeExpression: string): ValueAssignOperation;
@@ -1,18 +1,18 @@
1
1
  import { WWA } from "../wwa_main";
2
2
  import * as Wwa from "./wwa";
3
- export declare class EvalCalcWwaNode {
3
+ export declare class EvalCalcWwaNodeGenerator {
4
4
  wwa: WWA;
5
- for_id: {
6
- i: number;
7
- j: number;
8
- k: number;
9
- loopCount: number;
10
- };
11
- break_flag: boolean;
12
- continue_flag: boolean;
13
5
  loop_limit: number;
14
6
  constructor(wwa: WWA);
15
- evalWwaNodes(nodes: Wwa.WWANode[]): any[];
7
+ evalWwaNodes(nodes: Wwa.WWANode[]): void[];
8
+ evalWwaNode(node: Wwa.WWANode): void;
9
+ updateLoopLimit(limit: number): void;
10
+ }
11
+ export declare class EvalCalcWwaNode {
12
+ generator: EvalCalcWwaNodeGenerator;
13
+ private for_id;
14
+ constructor(generator: EvalCalcWwaNodeGenerator);
15
+ private evalWwaNodes;
16
16
  evalWwaNode(node: Wwa.WWANode): any;
17
17
  callDefinedFunction(node: Wwa.CallDefinedFunction): void;
18
18
  updateExpression(node: Wwa.UpdateExpression): void;
@@ -1,4 +1,4 @@
1
- export declare type Calcurable = Array1D | Array2D | Number | Symbol | UnaryOperation | BinaryOperation;
1
+ export type Calcurable = Array1D | Array2D | Number | Symbol | UnaryOperation | BinaryOperation;
2
2
  export declare function isCalcurable(node: WWANode): node is Calcurable;
3
3
  export interface PartsAssignment {
4
4
  type: "PartsAssignment";
@@ -110,4 +110,4 @@ export interface UpdateExpression {
110
110
  operator: string;
111
111
  argument: WWANode;
112
112
  }
113
- export declare type WWANode = PartsAssignment | ItemAssignment | UserVariableAssignment | SpecialParameterAssignment | UnaryOperation | BinaryOperation | Array1D | Array2D | Number | Symbol | Random | Jumpgate | Msg | IfStatement | BlockStatement | AnyFunction | DefinedFunction | CallDefinedFunction | ForStatement | AnyFunction | Break | Continue | UpdateExpression;
113
+ export type WWANode = PartsAssignment | ItemAssignment | UserVariableAssignment | SpecialParameterAssignment | UnaryOperation | BinaryOperation | Array1D | Array2D | Number | Symbol | Random | Jumpgate | Msg | IfStatement | BlockStatement | AnyFunction | DefinedFunction | CallDefinedFunction | ForStatement | AnyFunction | Break | Continue | UpdateExpression;
package/lib/wwa_main.d.ts CHANGED
@@ -98,7 +98,7 @@ export declare class WWA {
98
98
  private soundLoadedCheckTimer;
99
99
  private _startTime;
100
100
  private _dumpElement;
101
- private evalCalcWwaNode;
101
+ private evalCalcWwaNodeGenerator;
102
102
  private userDefinedFunctions;
103
103
  constructor(mapFileName: string, urlgateEnabled: boolean, titleImgName: string, classicModeEnabled: boolean, itemEffectEnabled: boolean, useGoToWWA: boolean, audioDirectory: string, disallowLoadOldSave: boolean, dumpElm: HTMLElement, userVarNamesFile: string | null, canDisplayUserVars: boolean, enableVirtualPad?: boolean, virtualpadControllerElm?: HTMLElement);
104
104
  callJumpGateUserDefineFunction(): void;
@@ -116,7 +116,7 @@ export declare class WWA {
116
116
  checkAllSoundLoaded(): void;
117
117
  private _setSoundLoadedCheckTimer;
118
118
  private _clearSoundLoadedCheckTimer;
119
- playSound(id: number): void;
119
+ playSound(id: number, bgmDelayDurationMs?: number): void;
120
120
  openGameWindow(): void;
121
121
  mainCaller: () => void;
122
122
  soundCheckCaller: () => void;
@@ -265,6 +265,7 @@ export declare class WWA {
265
265
  updateItemEffectEnabled(isEnabled: boolean): void;
266
266
  setOldMove(flag: boolean): void;
267
267
  setGameOverPolicy(gameOverPolicy: number): void;
268
+ setBgmDelay(delayMs: number): void;
268
269
  private _stylePos;
269
270
  private _styleElm;
270
271
  private _sheet;
@@ -4,8 +4,8 @@ import { Monster } from "./wwa_monster";
4
4
  import { WWAData } from "./wwa_data";
5
5
  import { WWASave } from "./wwa_save";
6
6
  import { type TokenValues, type Descriminant } from "./wwa_expression";
7
- export declare type LazyEvaluateValue = () => number;
8
- export declare type MessageSegments = (string | LazyEvaluateValue)[];
7
+ export type LazyEvaluateValue = () => number;
8
+ export type MessageSegments = (string | LazyEvaluateValue)[];
9
9
  export declare class Page {
10
10
  firstNode?: Node;
11
11
  isLastPage?: boolean;
@@ -55,9 +55,9 @@ export declare function isEmptyMessageTree(node: Node | undefined): boolean;
55
55
  export declare function getLastMessage(node: undefined): undefined;
56
56
  export declare function getLastMessage(node: Node): Node;
57
57
  export declare function concatMessage(node1: Node | undefined, node2: Node | undefined): Node | undefined;
58
- export declare type MessageLineType = PreprocessMacroType | "text" | "normalMacro";
58
+ export type MessageLineType = PreprocessMacroType | "text" | "normalMacro";
59
59
  export declare const messagLineIsText: (lineType: MessageLineType) => boolean;
60
- export declare type MessageLine = ({
60
+ export type MessageLine = ({
61
61
  type: PreprocessMacroType;
62
62
  text: string;
63
63
  macro: Macro;
@@ -141,6 +141,7 @@ export declare class Macro {
141
141
  private _executeOldMoveMacro;
142
142
  private _executeNoGameOverMacro;
143
143
  private _executeSetMacro;
144
+ private _executeDelayBgmMacro;
144
145
  }
145
146
  export declare function parseMacro(wwa: WWA, partsID: number, partsType: PartsType, position: Coord, macroStr: string): Macro;
146
147
  export declare class TextWindow {
@@ -1,7 +1,7 @@
1
1
  import { WWAData } from "../wwa_data";
2
2
  import WWASaveDataList from "./WWASaveDataList";
3
3
  import { OnCheckLoadingSaveDataFunction, OnCompleteLoadingSaveDataFunction } from "./common";
4
- declare type WWASaveDataItem = {
4
+ type WWASaveDataItem = {
5
5
  url?: string;
6
6
  id: number;
7
7
  hash: string;
@@ -4,8 +4,8 @@ export declare enum LoadErrorCode {
4
4
  UNMATCHED_WORLD_PASS_NUMBER = "UNMATCHED_WORLD_PASS_NUMBER",
5
5
  DISALLOW_OLD_REVISION_WORLD_SAVE_DATA = "DISALLOW_OLD_REVISION_WORLD_SAVE_DATA"
6
6
  }
7
- export declare type OnCompleteLoadingSaveDataFunction = (hasFailedLoadingSaveData: LoadErrorCode[]) => void;
8
- export declare type OnCheckLoadingSaveDataFunction = (saveDataWorldName: string | undefined, saveDataHash: string, mapDataRevisionKey: string | undefined) => LoadErrorCode | null;
9
- export declare type WWADataWithWorldNameStatus = [WWAData, {
7
+ export type OnCompleteLoadingSaveDataFunction = (hasFailedLoadingSaveData: LoadErrorCode[]) => void;
8
+ export type OnCheckLoadingSaveDataFunction = (saveDataWorldName: string | undefined, saveDataHash: string, mapDataRevisionKey: string | undefined) => LoadErrorCode | null;
9
+ export type WWADataWithWorldNameStatus = [WWAData, {
10
10
  isWorldNameEmpty: boolean;
11
11
  }];
@@ -7,6 +7,7 @@ export declare class Sound {
7
7
  private bufferSources;
8
8
  private isLoaded;
9
9
  private isExceededMaxRetryCount?;
10
+ private delayBgmTimeoutId;
10
11
  constructor(id: number, fileName: string, audioContext: AudioContext, audioGain: GainNode);
11
12
  private fetchSoundFile;
12
13
  private getArrayBuffer;
@@ -14,10 +15,11 @@ export declare class Sound {
14
15
  private retry;
15
16
  private setData;
16
17
  private cancelLoad;
17
- play(): void;
18
+ play(delayDurationMs?: number): void;
18
19
  pause(): void;
19
20
  isBgm(): boolean;
20
21
  hasData(): boolean;
22
+ isPlaying(): boolean;
21
23
  isLoading(): boolean;
22
24
  isError(): boolean;
23
25
  private disposeBufferSource;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wwawing/engine",
3
- "version": "3.13.0-acorn-statement.based-on.3.12.3.p.5",
3
+ "version": "3.13.0-acorn-statement.based-on.3.12.4",
4
4
  "description": "World Wide Adventure: an RPG Engine.",
5
5
  "main": "./lib/wwa.js",
6
6
  "files": [
@@ -9,7 +9,7 @@
9
9
  ],
10
10
  "sideEffects": false,
11
11
  "scripts": {
12
- "test": "echo \"Error: no test specified\" && exit 1",
12
+ "test": "jest",
13
13
  "start": "run-p build:dev deploy:dev server",
14
14
  "build": "npm-run-all clean build:prod",
15
15
  "build:prod": "webpack --config webpack.config.prod.ts",
@@ -41,29 +41,35 @@
41
41
  },
42
42
  "homepage": "https://github.com/WWAWing/WWAWing#readme",
43
43
  "devDependencies": {
44
+ "@swc/core": "^1.3.59",
45
+ "@swc/jest": "^0.2.26",
44
46
  "@types/crypto-js": "^4.1.1",
47
+ "@types/jest": "^29.5.1",
45
48
  "@types/pug": "^2.0.6",
46
49
  "@types/terser-webpack-plugin": "^5.2.0",
47
50
  "@types/webpack": "^5.28.0",
48
- "@wwawing/assets": "^3.13.0-acorn-statement.based-on.3.12.3.p.5",
49
- "@wwawing/common-interface": "^3.13.0-acorn-statement.based-on.3.12.3.p.5",
50
- "@wwawing/debug-server": "^3.13.0-acorn-statement.based-on.3.12.3.p.5",
51
- "@wwawing/event-emitter": "^3.13.0-acorn-statement.based-on.3.12.3.p.5",
52
- "@wwawing/loader": "^3.13.0-acorn-statement.based-on.3.12.3.p.5",
53
- "@wwawing/page-generator": "^3.13.0-acorn-statement.based-on.3.12.3.p.5",
54
- "@wwawing/styles": "^3.13.0-acorn-statement.based-on.3.12.3.p.5",
55
- "@wwawing/virtual-pad": "^3.13.0-acorn-statement.based-on.3.12.3.p.5",
51
+ "@wwawing/assets": "^3.13.0-acorn-statement.based-on.3.12.4",
52
+ "@wwawing/common-interface": "^3.13.0-acorn-statement.based-on.3.12.4",
53
+ "@wwawing/debug-server": "^3.13.0-acorn-statement.based-on.3.12.4",
54
+ "@wwawing/event-emitter": "^3.13.0-acorn-statement.based-on.3.12.4",
55
+ "@wwawing/loader": "^3.13.0-acorn-statement.based-on.3.12.4",
56
+ "@wwawing/page-generator": "^3.13.0-acorn-statement.based-on.3.12.4",
57
+ "@wwawing/styles": "^3.13.0-acorn-statement.based-on.3.12.4",
58
+ "@wwawing/virtual-pad": "^3.13.0-acorn-statement.based-on.3.12.4",
56
59
  "crypto-js": "^4.1.1",
60
+ "jest": "^29.5.0",
61
+ "jest-cli": "^29.5.0",
62
+ "jest-environment-jsdom": "^29.5.0",
57
63
  "npm-run-all": "^4.1.5",
58
64
  "pug": "^3.0.2",
59
65
  "shelljs": "^0.8.5",
60
66
  "shx": "^0.3.4",
61
- "terser-webpack-plugin": "^5.3.6",
62
- "ts-loader": "^9.4.1",
67
+ "terser-webpack-plugin": "^5.3.9",
68
+ "ts-loader": "^9.4.3",
63
69
  "ts-node": "^10.9.1",
64
- "typescript": "^4.8.4",
65
- "webpack": "^5.74.0",
66
- "webpack-cli": "^4.10.0"
70
+ "typescript": "^5.0.4",
71
+ "webpack": "^5.83.1",
72
+ "webpack-cli": "^5.1.1"
67
73
  },
68
74
  "publishConfig": {
69
75
  "access": "public"
@@ -72,5 +78,5 @@
72
78
  "node": ">=18",
73
79
  "npm": ">=8"
74
80
  },
75
- "gitHead": "e6cd633a6963c6bdb9598ae15a0fc475372a1c1d"
81
+ "gitHead": "b24896485130d7174bb5199c5c44bf769184d427"
76
82
  }