@wwawing/engine 3.11.6 → 3.12.1
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 +2 -2
- package/lib/wwa_data.d.ts +24 -15
- package/lib/wwa_expression/eval.d.ts +2 -2
- package/lib/wwa_expression/index.d.ts +3 -1
- package/lib/wwa_expression/regexp.d.ts +5 -0
- package/lib/wwa_expression/typedef.d.ts +23 -5
- package/lib/wwa_expression/value-assign-operation.d.ts +19 -2
- package/lib/wwa_main.d.ts +6 -3
- package/lib/wwa_message.d.ts +1 -1
- package/package.json +10 -10
package/lib/wwa_data.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { WWA } from "./wwa_main";
|
|
2
2
|
import { Camera } from "./wwa_camera";
|
|
3
|
-
import { KeyCode } from "./wwa_input";
|
|
4
3
|
import { WWAData } from "@wwawing/common-interface";
|
|
5
4
|
import type { JsonResponseErrorKind } from "./json_api_client";
|
|
6
5
|
export { WWAData };
|
|
@@ -72,20 +71,19 @@ export declare enum ControlPanelBottomButton {
|
|
|
72
71
|
GAME_END = 2
|
|
73
72
|
}
|
|
74
73
|
export declare enum Direction {
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
UNUSED = 0,
|
|
75
|
+
LEFT = 4,
|
|
76
|
+
RIGHT = 6,
|
|
77
77
|
DOWN = 2,
|
|
78
|
-
UP =
|
|
79
|
-
LEFT_DOWN =
|
|
80
|
-
LEFT_UP =
|
|
81
|
-
RIGHT_DOWN =
|
|
82
|
-
RIGHT_UP =
|
|
83
|
-
NO_DIRECTION =
|
|
84
|
-
}
|
|
85
|
-
export declare
|
|
86
|
-
export declare
|
|
87
|
-
export declare var dirToPos: number[];
|
|
88
|
-
export declare var dirToKey: KeyCode[];
|
|
78
|
+
UP = 8,
|
|
79
|
+
LEFT_DOWN = 1,
|
|
80
|
+
LEFT_UP = 7,
|
|
81
|
+
RIGHT_DOWN = 3,
|
|
82
|
+
RIGHT_UP = 9,
|
|
83
|
+
NO_DIRECTION = 5
|
|
84
|
+
}
|
|
85
|
+
export declare const vx: number[];
|
|
86
|
+
export declare const vy: number[];
|
|
89
87
|
export declare enum YesNoState {
|
|
90
88
|
YES = 0,
|
|
91
89
|
NO = 1,
|
|
@@ -254,12 +252,15 @@ export declare enum MacroType {
|
|
|
254
252
|
ELSE = 58,
|
|
255
253
|
END_IF = 59,
|
|
256
254
|
SET = 60,
|
|
255
|
+
MAP2 = 61,
|
|
256
|
+
SHOW_STR2 = 62,
|
|
257
|
+
CONSOLE_LOG2 = 63,
|
|
257
258
|
GAMEPAD_BUTTON = 100,
|
|
258
259
|
OLDMOVE = 101,
|
|
259
260
|
LEGACY_IF = 10050
|
|
260
261
|
}
|
|
261
262
|
export declare type ConditionalExecuteMacroType = MacroType.IF | MacroType.ELSE_IF | MacroType.ELSE | MacroType.END_IF;
|
|
262
|
-
export declare type PreprocessMacroType = ConditionalExecuteMacroType | MacroType.SHOW_STR;
|
|
263
|
+
export declare type PreprocessMacroType = ConditionalExecuteMacroType | MacroType.SHOW_STR | MacroType.SHOW_STR2;
|
|
263
264
|
export declare var macrotable: {
|
|
264
265
|
"": number;
|
|
265
266
|
$imgplayer: number;
|
|
@@ -320,6 +321,9 @@ export declare var macrotable: {
|
|
|
320
321
|
$else: number;
|
|
321
322
|
$endif: number;
|
|
322
323
|
$set: number;
|
|
324
|
+
$map2: number;
|
|
325
|
+
$show_str2: number;
|
|
326
|
+
$console_log2: number;
|
|
323
327
|
$gamepad_button: number;
|
|
324
328
|
$oldmove: number;
|
|
325
329
|
};
|
|
@@ -574,3 +578,8 @@ export interface ScoreRates {
|
|
|
574
578
|
defence: number;
|
|
575
579
|
gold: number;
|
|
576
580
|
}
|
|
581
|
+
export interface TriggerParts {
|
|
582
|
+
id: number;
|
|
583
|
+
type: PartsType;
|
|
584
|
+
position: Coord;
|
|
585
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Descriminant, TokenValues, Comparable } from "./typedef";
|
|
2
|
-
export declare function evaluateDescriminant(d: Descriminant, tokenValues: TokenValues): boolean;
|
|
3
|
-
export declare function evaluateValue(comparable: Comparable, tokenValues: TokenValues): number;
|
|
2
|
+
export declare function evaluateDescriminant(d: Descriminant, tokenValues: TokenValues, fallbackValue?: number): boolean;
|
|
3
|
+
export declare function evaluateValue(comparable: Comparable, tokenValues: TokenValues, fallbackValue?: number): number;
|
|
4
4
|
export declare function calc(operator: string, leftValue: number, rightValue: number): number;
|
|
5
5
|
export declare function compare(operator: string, leftValue: number, rightValue: number): boolean;
|
|
@@ -4,6 +4,8 @@ export * from "./typedef";
|
|
|
4
4
|
export * from "./parsers";
|
|
5
5
|
export * from "./eval";
|
|
6
6
|
export * from "./regexp";
|
|
7
|
-
export declare function parseAndEvaluateValue(value: string, tokenValues: TokenValues): number;
|
|
7
|
+
export declare function parseAndEvaluateValue(value: string, tokenValues: TokenValues, fallbackValue?: number): number;
|
|
8
8
|
export declare function evaluateSetMacroExpression(expression: string, tokenValues: TokenValues): ValueAssignOperation;
|
|
9
|
+
export declare function evaluateMacroArgExpression(expression: string, tokenValues: TokenValues, fallbackValue?: number): number;
|
|
10
|
+
export declare function isValidMacroArgExpression(expression: string): boolean;
|
|
9
11
|
export declare function parseDescriminant(expression: string): Descriminant | undefined;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export declare const regNumber: RegExp;
|
|
2
2
|
export declare const regUserVar: RegExp;
|
|
3
|
+
export declare const regMapByCoord: RegExp;
|
|
4
|
+
export declare const regObjectByCoord: RegExp;
|
|
5
|
+
export declare const regItemByBoxId: RegExp;
|
|
3
6
|
export declare const regRand: RegExp;
|
|
7
|
+
export declare const regItemCount: RegExp;
|
|
4
8
|
export declare const regAdvance: RegExp;
|
|
5
9
|
export declare const regNormal: RegExp;
|
|
10
|
+
export declare const regMacroArg: RegExp;
|
|
6
11
|
export declare const regIf: RegExp;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import type { EquipmentStatus, Status, Coord } from "../wwa_data";
|
|
2
|
-
export declare type SetMacroType = 'VARIABLE' | 'NUMBER' | 'HP' | 'HPMAX' | 'AT' | 'AT_TOTAL' | 'AT_ITEMS' | 'DF' | 'DF_TOTAL' | 'DF_ITEMS' | 'GD' | 'TIME' | 'STEP' | 'PX' | 'PY' | 'RAND';
|
|
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
3
|
export declare type CNumberKind = "NUMBER";
|
|
4
4
|
export declare type CVariableKind = "VARIABLE";
|
|
5
|
-
export declare type
|
|
6
|
-
export declare type
|
|
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";
|
|
7
9
|
export interface CNumber {
|
|
8
10
|
type: CNumberKind;
|
|
9
11
|
rawValue: number;
|
|
@@ -12,6 +14,15 @@ export interface CVariable {
|
|
|
12
14
|
type: CVariableKind;
|
|
13
15
|
index: number;
|
|
14
16
|
}
|
|
17
|
+
export interface CParts {
|
|
18
|
+
type: CPartsKind;
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
}
|
|
22
|
+
export interface CItem {
|
|
23
|
+
type: CItemKind;
|
|
24
|
+
boxIndex1To12: number;
|
|
25
|
+
}
|
|
15
26
|
export interface CEnv {
|
|
16
27
|
type: CEnvKind;
|
|
17
28
|
}
|
|
@@ -19,7 +30,7 @@ export interface CFunction {
|
|
|
19
30
|
type: CFunctionKind;
|
|
20
31
|
argument: CValue;
|
|
21
32
|
}
|
|
22
|
-
export declare type CValue = CNumber | CVariable | CEnv;
|
|
33
|
+
export declare type CValue = CNumber | CVariable | CParts | CItem | CEnv;
|
|
23
34
|
export declare type Comparable = CValue | CFunction;
|
|
24
35
|
export declare type ComparisionOperatorKind = "<" | ">" | "<=" | ">=" | "==" | "!=";
|
|
25
36
|
export declare type Descriminant = boolean | {
|
|
@@ -35,5 +46,12 @@ export interface TokenValues {
|
|
|
35
46
|
moveCount: number;
|
|
36
47
|
playTime: number;
|
|
37
48
|
userVars: number[];
|
|
49
|
+
partsPosition: Coord;
|
|
38
50
|
playerCoord: Coord;
|
|
51
|
+
partsId: number;
|
|
52
|
+
partsType: PartsType;
|
|
53
|
+
map: number[][];
|
|
54
|
+
mapObject: number[][];
|
|
55
|
+
itemBox: number[];
|
|
56
|
+
playerDirection: Direction;
|
|
39
57
|
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
export interface
|
|
2
|
-
assignee: "
|
|
1
|
+
export interface VariableAssignOperation {
|
|
2
|
+
assignee: "variable";
|
|
3
|
+
index: number;
|
|
3
4
|
rawValue: number;
|
|
4
5
|
}
|
|
6
|
+
export interface CoordAssignOperation {
|
|
7
|
+
assignee: "map" | "mapObject";
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
rawValue: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ItemAssignOperation {
|
|
13
|
+
assignee: "item";
|
|
14
|
+
boxIndex1to12: number;
|
|
15
|
+
rawValue: number;
|
|
16
|
+
}
|
|
17
|
+
export interface NoExtraArgumentValueeAssignOperation {
|
|
18
|
+
assignee: "energy" | "energyMax" | "strength" | "defence" | "gold" | "moveCount" | "playerDirection";
|
|
19
|
+
rawValue: number;
|
|
20
|
+
}
|
|
21
|
+
export declare type ValueAssignOperation = VariableAssignOperation | CoordAssignOperation | ItemAssignOperation | NoExtraArgumentValueeAssignOperation;
|
|
5
22
|
export declare function generateValueAssignOperation(calcResult: number, assigneeExpression: string): ValueAssignOperation;
|
package/lib/wwa_main.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Coord, Position, LoaderProgress, LoadStage, YesNoState, Face, SidebarButton, SpeedChange, PartsType, AppearanceTriggerType, EquipmentStatus, ChangeStyleType, MacroStatusIndex, UserDevice, MacroImgFrameIndex, StatusKind, StatusSolutionKind, ScoreOptions } from "./wwa_data";
|
|
1
|
+
import { Coord, Position, LoaderProgress, LoadStage, YesNoState, Face, 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";
|
|
5
5
|
import { IEventEmitter } from "@wwawing/event-emitter";
|
|
6
|
+
import * as ExpressionParser from "./wwa_expression";
|
|
6
7
|
export declare function getProgress(current: number, total: number, stage: LoadStage): LoaderProgress;
|
|
7
8
|
interface PartsAppearance {
|
|
8
9
|
pos: Coord;
|
|
@@ -294,10 +295,12 @@ export declare class WWA {
|
|
|
294
295
|
setUserValRandNum(x: number, num: number, bias: number): void;
|
|
295
296
|
private _generateShowStrString;
|
|
296
297
|
speedChangeJudge(speedChangeFlag: boolean): void;
|
|
297
|
-
execSetMacro(macroStr
|
|
298
|
+
execSetMacro(macroStr: string, option: {
|
|
299
|
+
triggerParts: TriggerParts;
|
|
300
|
+
}): {
|
|
298
301
|
isGameOver?: true;
|
|
299
302
|
};
|
|
300
|
-
|
|
303
|
+
generateTokenValues(triggerParts: TriggerParts): ExpressionParser.TokenValues;
|
|
301
304
|
userVarUserIf(_triggerPartsPosition: Coord, args: string[]): void;
|
|
302
305
|
private compareUserVar;
|
|
303
306
|
setPlayerSpeedIndex(speedIndex: number): void;
|
package/lib/wwa_message.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wwawing/engine",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.1",
|
|
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.
|
|
49
|
-
"@wwawing/common-interface": "^3.
|
|
50
|
-
"@wwawing/debug-server": "^3.
|
|
51
|
-
"@wwawing/event-emitter": "^3.
|
|
52
|
-
"@wwawing/loader": "^3.
|
|
53
|
-
"@wwawing/page-generator": "^3.
|
|
54
|
-
"@wwawing/styles": "^3.
|
|
55
|
-
"@wwawing/virtual-pad": "^3.
|
|
48
|
+
"@wwawing/assets": "^3.12.1",
|
|
49
|
+
"@wwawing/common-interface": "^3.12.1",
|
|
50
|
+
"@wwawing/debug-server": "^3.12.1",
|
|
51
|
+
"@wwawing/event-emitter": "^3.12.1",
|
|
52
|
+
"@wwawing/loader": "^3.12.1",
|
|
53
|
+
"@wwawing/page-generator": "^3.12.1",
|
|
54
|
+
"@wwawing/styles": "^3.12.1",
|
|
55
|
+
"@wwawing/virtual-pad": "^3.12.1",
|
|
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": "cf22adb7679d8421c18c82117476b32e15bb165c"
|
|
76
76
|
}
|