@wwawing/engine 3.12.2 → 3.13.0-acorn-statement.based-on.3.12.3
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.js +3 -3
- package/lib/wwa_expression2/acorn.d.ts +65 -0
- package/lib/wwa_expression2/converter.d.ts +4 -0
- package/lib/wwa_expression2/eval.d.ts +31 -0
- package/lib/wwa_expression2/index.d.ts +4 -0
- package/lib/wwa_expression2/wwa.d.ts +91 -0
- package/lib/wwa_main.d.ts +17 -1
- package/package.json +10 -10
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { parse, type Node } from "acorn";
|
|
2
|
+
export { parse, Node };
|
|
3
|
+
export interface Program extends Node {
|
|
4
|
+
type: "Program";
|
|
5
|
+
body: Node[];
|
|
6
|
+
}
|
|
7
|
+
export interface ExpressionStatement extends Node {
|
|
8
|
+
type: "ExpressionStatement";
|
|
9
|
+
expression: Node;
|
|
10
|
+
}
|
|
11
|
+
export interface AssignmentExpression extends Node {
|
|
12
|
+
type: "AssignmentExpression";
|
|
13
|
+
operator: string;
|
|
14
|
+
left: Node;
|
|
15
|
+
right: Node;
|
|
16
|
+
}
|
|
17
|
+
export interface MemberExpression extends Node {
|
|
18
|
+
type: "MemberExpression";
|
|
19
|
+
object: Node;
|
|
20
|
+
property: Node;
|
|
21
|
+
}
|
|
22
|
+
export interface UnaryExpression extends Node {
|
|
23
|
+
type: "UnaryExpression";
|
|
24
|
+
operator: string;
|
|
25
|
+
argument: Node;
|
|
26
|
+
}
|
|
27
|
+
export interface BinaryExpression extends Node {
|
|
28
|
+
type: "BinaryExpression";
|
|
29
|
+
operator: string;
|
|
30
|
+
left: Node;
|
|
31
|
+
right: Node;
|
|
32
|
+
}
|
|
33
|
+
export interface Identifier extends Node {
|
|
34
|
+
type: "Identifier";
|
|
35
|
+
name: string;
|
|
36
|
+
}
|
|
37
|
+
export interface Literal extends Node {
|
|
38
|
+
type: "Literal";
|
|
39
|
+
value: number;
|
|
40
|
+
}
|
|
41
|
+
export interface CallExpression extends Node {
|
|
42
|
+
type: "CallExpression";
|
|
43
|
+
arguments: Literal[];
|
|
44
|
+
callee: Identifier;
|
|
45
|
+
}
|
|
46
|
+
export interface IfStatement extends Node {
|
|
47
|
+
type: "IfStatement";
|
|
48
|
+
consequent: Node;
|
|
49
|
+
test: Node;
|
|
50
|
+
alternate?: IfStatement;
|
|
51
|
+
}
|
|
52
|
+
export interface BlockStatement extends Node {
|
|
53
|
+
type: "BlockStatement";
|
|
54
|
+
body: Node[];
|
|
55
|
+
}
|
|
56
|
+
export interface ForStatement extends Node {
|
|
57
|
+
type: "ForStatement";
|
|
58
|
+
body: BlockStatement;
|
|
59
|
+
init: Node;
|
|
60
|
+
test: Node;
|
|
61
|
+
update: Node;
|
|
62
|
+
}
|
|
63
|
+
export interface UpdateExpression extends Node {
|
|
64
|
+
type: "UpdateExpression";
|
|
65
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { WWA } from "../wwa_main";
|
|
2
|
+
import * as Wwa from "./wwa";
|
|
3
|
+
export declare class EvalCalcWwaNode {
|
|
4
|
+
wwa: WWA;
|
|
5
|
+
for_id: {
|
|
6
|
+
i: number;
|
|
7
|
+
j: number;
|
|
8
|
+
k: number;
|
|
9
|
+
loopCount: number;
|
|
10
|
+
};
|
|
11
|
+
constructor(wwa: WWA);
|
|
12
|
+
evalWwaNodes(nodes: Wwa.Node[]): any[];
|
|
13
|
+
evalWwaNode(node: Wwa.Node): any;
|
|
14
|
+
forStateMent(node: Wwa.ForStatement): void;
|
|
15
|
+
evalAnyFunction(node: Wwa.AnyFunction): void;
|
|
16
|
+
partsAssignment(node: Wwa.PartsAssignment): void;
|
|
17
|
+
blockStatement(node: Wwa.BlockStatement): void;
|
|
18
|
+
ifStatement(node: Wwa.IfStatement): number;
|
|
19
|
+
itemAssignment(node: Wwa.ItemAssignment): number;
|
|
20
|
+
evalMessage(node: Wwa.Msg): number;
|
|
21
|
+
evalJumpgate(node: Wwa.Jumpgate): void;
|
|
22
|
+
evalRandom(node: Wwa.Random): any;
|
|
23
|
+
evalSetSpecialParameter(node: Wwa.SpecialParameterAssignment): any;
|
|
24
|
+
evalSetUserVariable(node: Wwa.UserVariableAssignment): number;
|
|
25
|
+
evalUnaryOperation(node: Wwa.UnaryOperation): any;
|
|
26
|
+
evalBinaryOperation(node: Wwa.BinaryOperation): any;
|
|
27
|
+
evalSymbol(node: Wwa.Symbol): number;
|
|
28
|
+
evalArray1D(node: Wwa.Array1D): number;
|
|
29
|
+
evalArray2D(node: Wwa.Array2D): void;
|
|
30
|
+
evalNumber(node: Wwa.Number): number;
|
|
31
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
export declare type Calcurable = Array1D | Array2D | Number | Symbol | UnaryOperation | BinaryOperation;
|
|
2
|
+
export declare function isCalcurable(node: Node): node is Calcurable;
|
|
3
|
+
export interface PartsAssignment {
|
|
4
|
+
type: "PartsAssignment";
|
|
5
|
+
partsKind: "map" | "object";
|
|
6
|
+
operator?: "+" | "-" | "*" | "/" | "%";
|
|
7
|
+
destinationX: Calcurable;
|
|
8
|
+
destinationY: Calcurable;
|
|
9
|
+
value: Calcurable;
|
|
10
|
+
}
|
|
11
|
+
export interface ItemAssignment {
|
|
12
|
+
type: "ItemAssignment";
|
|
13
|
+
itemBoxPosition1to12: Calcurable;
|
|
14
|
+
value: Calcurable;
|
|
15
|
+
}
|
|
16
|
+
export interface UserVariableAssignment {
|
|
17
|
+
type: "UserVariableAssignment";
|
|
18
|
+
index: Calcurable;
|
|
19
|
+
value: Calcurable;
|
|
20
|
+
}
|
|
21
|
+
export interface SpecialParameterAssignment {
|
|
22
|
+
type: "SpecialParameterAssignment";
|
|
23
|
+
kind: "X" | "Y" | "PX" | "PY" | "HP" | "HPMAX" | "AT" | "DF" | "GD" | "STEP" | "TIME" | "PRID" | "i" | "j" | "k";
|
|
24
|
+
value: Calcurable;
|
|
25
|
+
}
|
|
26
|
+
export interface UnaryOperation {
|
|
27
|
+
type: "UnaryOperation";
|
|
28
|
+
operator: "+" | "-";
|
|
29
|
+
argument: Calcurable;
|
|
30
|
+
}
|
|
31
|
+
export interface BinaryOperation {
|
|
32
|
+
type: "BinaryOperation";
|
|
33
|
+
operator: "+" | "-" | "*" | "/" | "%" | ">" | "<" | ">=" | "<=" | "==" | "!=";
|
|
34
|
+
left: Calcurable;
|
|
35
|
+
right: Calcurable;
|
|
36
|
+
}
|
|
37
|
+
export interface Symbol {
|
|
38
|
+
type: "Symbol";
|
|
39
|
+
name: "ITEM" | "m" | "o" | "v" | "X" | "Y" | "PX" | "PY" | "HP" | "HPMAX" | "AT" | "DF" | "GD" | "STEP" | "TIME" | "PRID" | "i" | "j" | "k";
|
|
40
|
+
}
|
|
41
|
+
export interface Array1D {
|
|
42
|
+
type: "Array1D";
|
|
43
|
+
name: "ITEM" | "m" | "o" | "v";
|
|
44
|
+
index0: Calcurable;
|
|
45
|
+
}
|
|
46
|
+
export interface Array2D {
|
|
47
|
+
type: "Array2D";
|
|
48
|
+
name: "m" | "o";
|
|
49
|
+
index0: Calcurable;
|
|
50
|
+
index1: Calcurable;
|
|
51
|
+
}
|
|
52
|
+
export interface Number {
|
|
53
|
+
type: "Number";
|
|
54
|
+
value: number;
|
|
55
|
+
}
|
|
56
|
+
export interface Random {
|
|
57
|
+
type: "Random";
|
|
58
|
+
value: Node;
|
|
59
|
+
}
|
|
60
|
+
export interface Jumpgate {
|
|
61
|
+
type: "Jumpgate";
|
|
62
|
+
x: Node;
|
|
63
|
+
y: Node;
|
|
64
|
+
}
|
|
65
|
+
export interface Msg {
|
|
66
|
+
type: "Msg";
|
|
67
|
+
value: Node;
|
|
68
|
+
}
|
|
69
|
+
export interface IfStatement {
|
|
70
|
+
type: "IfStatement";
|
|
71
|
+
consequent: Node;
|
|
72
|
+
test: Node;
|
|
73
|
+
alternate?: Node;
|
|
74
|
+
}
|
|
75
|
+
export interface BlockStatement {
|
|
76
|
+
type: "BlockStatement";
|
|
77
|
+
value: Node[];
|
|
78
|
+
}
|
|
79
|
+
export interface ForStatement {
|
|
80
|
+
type: "ForStatement";
|
|
81
|
+
body: Node[];
|
|
82
|
+
init: Node;
|
|
83
|
+
test: Node;
|
|
84
|
+
update: Node;
|
|
85
|
+
}
|
|
86
|
+
export interface AnyFunction {
|
|
87
|
+
type: "AnyFunction";
|
|
88
|
+
functionName: string;
|
|
89
|
+
value: Node[];
|
|
90
|
+
}
|
|
91
|
+
export declare type Node = PartsAssignment | ItemAssignment | UserVariableAssignment | SpecialParameterAssignment | UnaryOperation | BinaryOperation | Array1D | Array2D | Number | Symbol | Random | Jumpgate | Msg | IfStatement | BlockStatement | ForStatement | AnyFunction;
|
package/lib/wwa_main.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Coord, Position, LoaderProgress, LoadStage, YesNoState, Face, SidebarButton, SpeedChange, PartsType, AppearanceTriggerType, EquipmentStatus, ChangeStyleType, MacroStatusIndex, UserDevice, MacroImgFrameIndex, StatusKind, StatusSolutionKind, ScoreOptions, TriggerParts } from "./wwa_data";
|
|
1
|
+
import { Coord, Position, LoaderProgress, LoadStage, YesNoState, Status, Face, Direction, SidebarButton, SpeedChange, PartsType, AppearanceTriggerType, EquipmentStatus, ChangeStyleType, MacroStatusIndex, UserDevice, MacroImgFrameIndex, StatusKind, StatusSolutionKind, ScoreOptions, TriggerParts } from "./wwa_data";
|
|
2
2
|
import { MessageWindow, Page } from "./wwa_message";
|
|
3
3
|
import { ItemMenu } from "./wwa_item_menu";
|
|
4
4
|
import { WWACompress } from "./wwa_save";
|
|
@@ -218,6 +218,7 @@ export declare class WWA {
|
|
|
218
218
|
private _displayHelp;
|
|
219
219
|
_setNextPage(): void;
|
|
220
220
|
private _hideMessageWindow;
|
|
221
|
+
getPlayerPositon(): Position;
|
|
221
222
|
loadMapPartsObjectID(id: number): number;
|
|
222
223
|
loadMapPartsID(id: number): number;
|
|
223
224
|
replaceParts(srcID: number, destID: number, partsType?: PartsType, onlyThisSight?: boolean): void;
|
|
@@ -271,6 +272,8 @@ export declare class WWA {
|
|
|
271
272
|
getUserVar(no: number): number;
|
|
272
273
|
recUserPosition(x: number, y: number): void;
|
|
273
274
|
jumpRecUserPosition(x: number, y: number): void;
|
|
275
|
+
jumpSpecifiedXPos(x: number): void;
|
|
276
|
+
jumpSpecifiedYPos(y: number): void;
|
|
274
277
|
outputUserVar(num: number): void;
|
|
275
278
|
setUserVarHP(num: number): void;
|
|
276
279
|
setUserVarHPMAX(num: number): void;
|
|
@@ -324,5 +327,18 @@ export declare class WWA {
|
|
|
324
327
|
shouldApplyGameOver({ isCalledByMacro }: {
|
|
325
328
|
isCalledByMacro: boolean;
|
|
326
329
|
}): boolean;
|
|
330
|
+
getGameStatus(): {
|
|
331
|
+
totalStatus: Status;
|
|
332
|
+
bareStatus: Status;
|
|
333
|
+
itemStatus: EquipmentStatus;
|
|
334
|
+
energyMax: number;
|
|
335
|
+
moveCount: number;
|
|
336
|
+
playTime: number;
|
|
337
|
+
userVars: number[];
|
|
338
|
+
playerCoord: Coord;
|
|
339
|
+
playerDirection: Direction;
|
|
340
|
+
itemBox: number[];
|
|
341
|
+
};
|
|
342
|
+
private _debugEvalString;
|
|
327
343
|
}
|
|
328
344
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wwawing/engine",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.13.0-acorn-statement.based-on.3.12.3",
|
|
4
4
|
"description": "World Wide Adventure: an RPG Engine.",
|
|
5
5
|
"main": "./lib/wwa.js",
|
|
6
6
|
"files": [
|
|
@@ -45,14 +45,14 @@
|
|
|
45
45
|
"@types/pug": "^2.0.6",
|
|
46
46
|
"@types/terser-webpack-plugin": "^5.2.0",
|
|
47
47
|
"@types/webpack": "^5.28.0",
|
|
48
|
-
"@wwawing/assets": "^3.12.
|
|
49
|
-
"@wwawing/common-interface": "^3.12.
|
|
50
|
-
"@wwawing/debug-server": "^3.12.
|
|
51
|
-
"@wwawing/event-emitter": "^3.12.
|
|
52
|
-
"@wwawing/loader": "^3.12.
|
|
53
|
-
"@wwawing/page-generator": "^3.12.
|
|
54
|
-
"@wwawing/styles": "^3.12.
|
|
55
|
-
"@wwawing/virtual-pad": "^3.12.
|
|
48
|
+
"@wwawing/assets": "^3.13.0-acorn-statement.based-on.3.12.3",
|
|
49
|
+
"@wwawing/common-interface": "^3.13.0-acorn-statement.based-on.3.12.3",
|
|
50
|
+
"@wwawing/debug-server": "^3.13.0-acorn-statement.based-on.3.12.3",
|
|
51
|
+
"@wwawing/event-emitter": "^3.13.0-acorn-statement.based-on.3.12.3",
|
|
52
|
+
"@wwawing/loader": "^3.13.0-acorn-statement.based-on.3.12.3",
|
|
53
|
+
"@wwawing/page-generator": "^3.13.0-acorn-statement.based-on.3.12.3",
|
|
54
|
+
"@wwawing/styles": "^3.13.0-acorn-statement.based-on.3.12.3",
|
|
55
|
+
"@wwawing/virtual-pad": "^3.13.0-acorn-statement.based-on.3.12.3",
|
|
56
56
|
"crypto-js": "^4.1.1",
|
|
57
57
|
"npm-run-all": "^4.1.5",
|
|
58
58
|
"pug": "^3.0.2",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"node": ">=18",
|
|
73
73
|
"npm": ">=8"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "a8dbb1c0df7146aefad367e72b3a82bf1e6f2ce6"
|
|
76
76
|
}
|