@wwawing/engine 3.13.0-unstable.based-on.3.12.11.p.12 → 4.0.0

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.
@@ -0,0 +1,2 @@
1
+ import { DataWWAOptions } from "./typedef";
2
+ export declare function makeDefaultWWAOptions(): DataWWAOptions;
@@ -0,0 +1,20 @@
1
+ export interface DataWWAOptions {
2
+ mapdata: string;
3
+ urlGateEnable?: boolean;
4
+ titleImg?: string;
5
+ audioDir?: string;
6
+ classicModeEnable?: boolean;
7
+ itemEffectEnable?: boolean;
8
+ useGoToWwa?: boolean;
9
+ lookingAround?: boolean;
10
+ autoSave?: boolean;
11
+ disallowLoadOldSave?: boolean;
12
+ resumeSaveData?: string;
13
+ varDumpElm?: HTMLElement;
14
+ userVarNamesFile?: string;
15
+ displayUserVars?: boolean;
16
+ virtualPadEnable?: boolean;
17
+ virtualPadViewportFitEnable?: boolean;
18
+ virtualPadControllerElm?: HTMLElement;
19
+ userDefinedScriptsFile?: string;
20
+ }
package/lib/wwa_data.d.ts CHANGED
@@ -1,6 +1,6 @@
1
+ import { type WWAData } from "@wwawing/common-interface";
1
2
  import { WWA } from "./wwa_main";
2
3
  import { Camera } from "./wwa_camera";
3
- import { type WWAData } from "@wwawing/common-interface";
4
4
  import type { JsonResponseErrorKind } from "./json_api_client";
5
5
  export { type WWAData };
6
6
  export declare class EquipmentStatus {
@@ -19,7 +19,7 @@ export declare class Status extends EquipmentStatus {
19
19
  plus(s: EquipmentStatus): Status;
20
20
  minus(s: EquipmentStatus): Status;
21
21
  equals(e: Status): boolean;
22
- calculateScore(scoreOption: ScoreOptions): number;
22
+ calculateScore(scoreOption: ScoreOption): number;
23
23
  clone(): Status;
24
24
  constructor(e: number, s: number, d: number, g: number);
25
25
  }
@@ -564,7 +564,7 @@ export declare enum IDTable {
564
564
  }
565
565
  export type StatusSolutionKind = "all" | "bare" | "equipment";
566
566
  export type UserVarNameListRequestErrorKind = JsonResponseErrorKind | "notObject" | "noFileSpecified";
567
- export interface ScoreOptions {
567
+ export interface ScoreOption {
568
568
  rates: ScoreRates;
569
569
  }
570
570
  export interface ScoreRates {
@@ -46,10 +46,10 @@ export interface TokenValues {
46
46
  moveCount: number;
47
47
  playTime: number;
48
48
  userVars: (number | string | boolean)[];
49
- partsPosition: Coord;
49
+ partsPosition?: Coord;
50
50
  playerCoord: Coord;
51
- partsId: number;
52
- partsType: PartsType;
51
+ partsId?: number;
52
+ partsType?: PartsType;
53
53
  map: number[][];
54
54
  mapObject: number[][];
55
55
  itemBox: number[];
@@ -1,26 +1,37 @@
1
- import { BattleEstimateParameters } from "../wwa_data";
1
+ import { BattleEstimateParameters, Coord, PartsType } from "../wwa_data";
2
2
  import { WWA } from "../wwa_main";
3
3
  import * as Wwa from "./wwa";
4
+ import { PageAdditionalItem } from "./typedef";
4
5
  export declare class EvalCalcWwaNodeGenerator {
5
6
  wwa: WWA;
6
7
  loop_limit: number;
7
8
  state: {
9
+ readonly triggerParts?: {
10
+ id?: number;
11
+ type?: PartsType;
12
+ position?: Coord;
13
+ };
8
14
  readonly earnedItem?: {
9
15
  partsId?: number;
10
- itemPos?: number;
16
+ itemPos1To12?: number;
11
17
  };
12
18
  readonly battleDamageCalculation?: {
13
19
  aborted?: boolean;
14
20
  estimatingParams?: BattleEstimateParameters;
15
21
  };
22
+ messagePageAdditionalQueue: PageAdditionalItem[];
16
23
  };
17
24
  constructor(wwa: WWA);
18
- setEarnedItem(partsId: number, itemPos: number): void;
25
+ setTriggerParts(partsId: number, partsType: PartsType, position: Coord): void;
26
+ clearTemporaryState(): void;
27
+ setEarnedItem(partsId: number, itemPos1To12: number): void;
19
28
  clearEarnedItem(): void;
20
29
  setBattleDamageCalculationMode(estimatingParams: BattleEstimateParameters): void;
21
30
  clearBattleDamageCalculationMode(): void;
22
31
  evalWwaNodes(nodes: Wwa.WWANode[]): any;
23
32
  evalWwaNode(node: Wwa.WWANode): any;
33
+ addPageAdditionalItem(item: PageAdditionalItem): void;
34
+ pickPageAdditionalQueue(): PageAdditionalItem[];
24
35
  updateLoopLimit(limit: number): void;
25
36
  }
26
37
  export declare class EvalCalcWwaNode {
@@ -29,8 +40,9 @@ export declare class EvalCalcWwaNode {
29
40
  constructor(generator: EvalCalcWwaNodeGenerator);
30
41
  evalWwaNodes(nodes: Wwa.WWANode[]): any;
31
42
  evalWwaNode(node: Wwa.WWANode): any;
43
+ private wrapCallFunction;
32
44
  callDefinedFunction(node: Wwa.CallDefinedFunction): any;
33
- updateExpression(node: Wwa.UpdateExpression): void;
45
+ updateExpression(node: Wwa.UpdateExpression): any;
34
46
  logicalExpression(node: Wwa.LogicalExpression): any;
35
47
  convertTemplateLiteral(node: Wwa.TemplateLiteral): string;
36
48
  contunueStatment(node: Wwa.Continue): void;
@@ -41,9 +53,11 @@ export declare class EvalCalcWwaNode {
41
53
  evalAnyFunction(node: Wwa.AnyFunction): any;
42
54
  private resolveSystemMessageKeyFromMacroArg;
43
55
  partsAssignment(node: Wwa.PartsAssignment): void;
56
+ private resolveParts;
44
57
  blockStatement(node: Wwa.BlockStatement): any;
45
58
  ifStatement(node: Wwa.IfStatement): any;
46
59
  convertConditionalExpression(node: Wwa.ConditionalExpression): any;
60
+ convertLoopPointerExpression(node: Wwa.LoopPointerAssignment): number;
47
61
  itemAssignment(node: Wwa.ItemAssignment): any;
48
62
  evalMessage(node: Wwa.Msg): any;
49
63
  evalJumpgate(node: Wwa.Jumpgate): any;
@@ -52,7 +66,7 @@ export declare class EvalCalcWwaNode {
52
66
  evalSetUserVariable(node: Wwa.UserVariableAssignment): any;
53
67
  evalUnaryOperation(node: Wwa.UnaryOperation): any;
54
68
  evalBinaryOperation(node: Wwa.BinaryOperation): any;
55
- evalSymbol(node: Wwa.Symbol): number;
69
+ evalSymbol(node: Wwa.Symbol): number | number[];
56
70
  evalArray1D(node: Wwa.Array1D): any;
57
71
  evalArray2D(node: Wwa.Array2D): number;
58
72
  evalNumber(node: Wwa.Literal): string | number;
@@ -0,0 +1,9 @@
1
+ import { Face } from "../wwa_data";
2
+ interface PageAdditionalFaceItem {
3
+ type: "face";
4
+ data: {
5
+ face: Face;
6
+ };
7
+ }
8
+ export type PageAdditionalItem = PageAdditionalFaceItem;
9
+ export {};
@@ -20,9 +20,15 @@ export interface UserVariableAssignment {
20
20
  value: Calcurable;
21
21
  operator?: "=" | "+=" | "-=" | "*=" | "/=";
22
22
  }
23
+ export interface LoopPointerAssignment {
24
+ type: "LoopPointerAssignment";
25
+ index: Calcurable;
26
+ value: Calcurable;
27
+ operator?: "=" | "+=" | "-=" | "*=" | "/=";
28
+ }
23
29
  export interface SpecialParameterAssignment {
24
30
  type: "SpecialParameterAssignment";
25
- kind: "X" | "Y" | "PX" | "PY" | "HP" | "HPMAX" | "AT" | "DF" | "GD" | "STEP" | "TIME" | "PDIR" | "i" | "j" | "k" | "LOOPLIMIT" | "ITEM_ID" | "ITEM_POS";
31
+ kind: "PX" | "PY" | "HP" | "HPMAX" | "AT" | "DF" | "GD" | "STEP" | "TIME" | "PDIR" | "i" | "j" | "k" | "LOOPLIMIT" | "ITEM_ID" | "ITEM_POS";
26
32
  value: Calcurable;
27
33
  operator?: "=" | "+=" | "-=" | "*=" | "/=";
28
34
  }
@@ -39,11 +45,11 @@ export interface BinaryOperation {
39
45
  }
40
46
  export interface Symbol {
41
47
  type: "Symbol";
42
- name: "ITEM" | "m" | "o" | "v" | "X" | "Y" | "PX" | "PY" | "HP" | "HPMAX" | "AT" | "AT_TOTAL" | "DF" | "DF_TOTAL" | "GD" | "STEP" | "TIME" | "PDIR" | "i" | "j" | "k" | "LOOPLIMIT" | "ITEM_ID" | "ITEM_POS" | "ENEMY_HP" | "ENEMY_AT" | "ENEMY_DF" | "ENEMY_GD";
48
+ name: "ITEM" | "m" | "o" | "v" | "X" | "Y" | "ID" | "TYPE" | "PX" | "PY" | "CX" | "CY" | "HP" | "HPMAX" | "AT" | "AT_TOTAL" | "DF" | "DF_TOTAL" | "GD" | "STEP" | "TIME" | "PDIR" | "i" | "j" | "k" | "LOOPLIMIT" | "ITEM_ID" | "ITEM_POS" | "ENEMY_HP" | "ENEMY_AT" | "ENEMY_DF" | "ENEMY_GD" | "LP";
43
49
  }
44
50
  export interface Array1D {
45
51
  type: "Array1D";
46
- name: "ITEM" | "m" | "o" | "v";
52
+ name: "ITEM" | "m" | "o" | "v" | "LP";
47
53
  index0: Calcurable;
48
54
  }
49
55
  export interface Array2D {
@@ -141,4 +147,4 @@ export interface ConditionalExpression {
141
147
  test: WWANode;
142
148
  alternate: WWANode;
143
149
  }
144
- export type WWANode = PartsAssignment | ItemAssignment | UserVariableAssignment | SpecialParameterAssignment | UnaryOperation | BinaryOperation | Array1D | Array2D | Literal | Symbol | Random | Jumpgate | Msg | IfStatement | BlockStatement | AnyFunction | DefinedFunction | CallDefinedFunction | ForStatement | AnyFunction | Break | Continue | Return | UpdateExpression | LogicalExpression | TemplateLiteral | TemplateElement | ConditionalExpression;
150
+ export type WWANode = PartsAssignment | ItemAssignment | UserVariableAssignment | SpecialParameterAssignment | UnaryOperation | BinaryOperation | Array1D | Array2D | Literal | Symbol | Random | Jumpgate | Msg | IfStatement | BlockStatement | AnyFunction | DefinedFunction | CallDefinedFunction | ForStatement | AnyFunction | Break | Continue | Return | UpdateExpression | LogicalExpression | TemplateLiteral | TemplateElement | ConditionalExpression | LoopPointerAssignment;
@@ -0,0 +1,76 @@
1
+ import { WWA } from "./wwa_main";
2
+ import { MacroType, TriggerParts } from "./wwa_data";
3
+ export declare class Macro {
4
+ private _wwa;
5
+ private _triggerParts;
6
+ macroType: MacroType;
7
+ macroArgs: string[];
8
+ constructor(_wwa: WWA, _triggerParts: TriggerParts, macroType: MacroType, macroArgs: string[]);
9
+ isJunction(): boolean;
10
+ execute(): {
11
+ isGameOver?: true;
12
+ };
13
+ private _concatEmptyArgs;
14
+ private _evaluateIntValue;
15
+ private _executeJumpGateMacro;
16
+ private _executeRecPositionMacro;
17
+ private _executeJumpRecPositionMacro;
18
+ private _executeConsoleLogMacro;
19
+ private _executeCopyHpToMacro;
20
+ private _executeCopyHpMaxToMacro;
21
+ private _executeCopyAtToMacro;
22
+ private _executeCopyDfToMacro;
23
+ private _parseStatusKind;
24
+ private _executeCopyMoneyToMacro;
25
+ private _executeSetHPMacro;
26
+ private _executeSetHpMaxMacro;
27
+ private _executeSetAtMacro;
28
+ private _executeSetDfMacro;
29
+ private _executeSetMoneyMacro;
30
+ private _executeSetStepCountMacro;
31
+ private _executeVarSetValMacro;
32
+ private _executeVarSetMacro;
33
+ private _executeVarAddMacro;
34
+ private _executeVarSubMacro;
35
+ private _executeVarMulMacro;
36
+ private _executeVarDivMacro;
37
+ private _executeVarModMacro;
38
+ private _executeVarSetRandMacro;
39
+ private _executeGameSpeedMacro;
40
+ private _executeLegacyIfMacro;
41
+ private _executeSetSpeedMacro;
42
+ private _executeCopyTimeToMacro;
43
+ private _executeHideStatusMacro;
44
+ private _executeVarMapMacro;
45
+ private _executeImgPlayerMacro;
46
+ private _executeImgYesNoMacro;
47
+ private _executeHPMaxMacro;
48
+ private _executeSaveMacro;
49
+ private _executeItemMacro;
50
+ private _executeDefaultMacro;
51
+ private _executeOldMapMacro;
52
+ private _executePartsMacro;
53
+ private _executeMoveMacro;
54
+ private _executeMapMacro;
55
+ private _executeDirMapMacro;
56
+ private _executeImgFrameMacro;
57
+ private _executeImgBomMacro;
58
+ private _executeDelPlayerMacro;
59
+ private _executeFaceMacro;
60
+ private _executeEffectMacro;
61
+ private _executeGameOverMacro;
62
+ private _executeImgClickMacro;
63
+ private _executeEffItemMacro;
64
+ private _executeStatusMacro;
65
+ private _executeColorMacro;
66
+ private _executeWaitMacro;
67
+ private _executeSoundMacro;
68
+ private _executeGamePadButtonMacro;
69
+ private _executeOldMoveMacro;
70
+ private _executeNoGameOverMacro;
71
+ private _executeSetMacro;
72
+ private _executeDelayBgmMacro;
73
+ private _executeSysMsgMacro;
74
+ private resolveSystemMessageKeyFromMacroArg;
75
+ }
76
+ export declare function parseMacro(wwa: WWA, triggerParts: TriggerParts, macroStr: string): Macro;
package/lib/wwa_main.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import { SystemMessage } from "@wwawing/common-interface";
2
- import { Coord, Position, LoaderProgress, LoadStage, YesNoState, Status, Face, Direction, SidebarButton, SpeedChange, PartsType, AppearanceTriggerType, EquipmentStatus, ChangeStyleType, MacroStatusIndex, UserDevice, MacroImgFrameIndex, StatusKind, StatusSolutionKind, ScoreOptions, TriggerParts, type BattleTurnResult, BattleEstimateParameters, BattleDamageDirection } from "./wwa_data";
3
- import { MessageWindow, Page } from "./wwa_message";
2
+ import { WWAData as Data, Coord, Position, LoaderProgress, LoadStage, YesNoState, Status, Face, Direction, SidebarButton, SpeedChange, PartsType, AppearanceTriggerType, EquipmentStatus, ChangeStyleType, MacroStatusIndex, UserDevice, MacroImgFrameIndex, StatusKind, StatusSolutionKind, ScoreOption, TriggerParts, type BattleTurnResult, BattleEstimateParameters, BattleDamageDirection } from "./wwa_data";
3
+ import { MessageRequestPage } from "./wwa_message";
4
+ import { MessageWindow } from "./wwa_window";
4
5
  import { ItemMenu } from "./wwa_item_menu";
5
6
  import { WWACompress } from "./wwa_save";
6
7
  import { IEventEmitter } from "@wwawing/event-emitter";
7
8
  import * as ExpressionParser from "./wwa_expression";
8
9
  import { WWANode } from "./wwa_expression2/wwa";
10
+ import { DataWWAOptions } from "./wwa_data/typedef";
11
+ import { PageAdditionalItem } from "./wwa_expression2/typedef";
9
12
  export declare function getProgress(current: number, total: number, stage: LoadStage): LoaderProgress;
10
13
  interface PartsAppearance {
11
14
  pos: Coord;
@@ -81,6 +84,7 @@ export declare class WWA {
81
84
  private _useLookingAround;
82
85
  private _isDisallowLoadOldSave;
83
86
  private _userVar;
87
+ private _pageExecuting;
84
88
  private _inlineUserVarViewer;
85
89
  private _userVarNameList;
86
90
  private _userVarNameListRequestError;
@@ -107,8 +111,8 @@ export declare class WWA {
107
111
  private _dumpElement;
108
112
  private evalCalcWwaNodeGenerator;
109
113
  private userDefinedFunctions;
110
- 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);
111
- setEvalCalcWwaNodeEarnedItem(itemObjectId: number, itemPos: number): void;
114
+ constructor(options?: DataWWAOptions);
115
+ setEvalCalcWwaNodeEarnedItem(itemObjectId: number, itemPos1To12: number): void;
112
116
  clearEvalCalcWwaNodeEarnedItem(): void;
113
117
  callGetItemUserDefineFunction(): void;
114
118
  callGetItemFullUserDefineFunction(): void;
@@ -117,6 +121,7 @@ export declare class WWA {
117
121
  callUserDefinedBattleDamageFunction(damageDirection: BattleDamageDirection, estimatingParams?: BattleEstimateParameters): BattleTurnResult | undefined;
118
122
  private getUserDefinedDamageFunctionNode;
119
123
  callMoveUserDefineFunction(): void;
124
+ callCameraMoveUserDefineFunction(): void;
120
125
  getUserScript(functionName: string): WWANode | null;
121
126
  private setUsertScript;
122
127
  private convertWwaNodes;
@@ -134,7 +139,7 @@ export declare class WWA {
134
139
  openGameWindow(): void;
135
140
  mainCaller: () => void;
136
141
  soundCheckCaller: () => void;
137
- onselectitem(itemPos: number): boolean;
142
+ onselectitem(itemPos1To12: number): boolean;
138
143
  onselectbutton(button: SidebarButton, forcePassword?: boolean, forceGoToWWA?: boolean): void;
139
144
  onpasswordloadcalled(): void;
140
145
  onpasswordsavecalled(): void;
@@ -143,8 +148,6 @@ export declare class WWA {
143
148
  onchangespeed(type: SpeedChange): void;
144
149
  isBattleSpeedIndexForQuickBattle(battleSpeedIndex: number): boolean;
145
150
  private _checkTurnKeyPressed;
146
- private _executeNode;
147
- private _executeNodes;
148
151
  private _main;
149
152
  vibration(isStrong: boolean): void;
150
153
  private _drawAll;
@@ -169,7 +172,9 @@ export declare class WWA {
169
172
  getObjectCropYById(id: number): number;
170
173
  getMessageById(messageID: number): string;
171
174
  getSystemMessageById(messageID: number): string;
175
+ getMapInfo(partsID: number): number[];
172
176
  checkMap(pos?: Coord): boolean;
177
+ getObjectInfo(partsID: number): number[];
173
178
  checkObject(pos?: Coord): void;
174
179
  private _execMapStreetEvent;
175
180
  private _shouldTreatWillMessageDisplay;
@@ -188,20 +193,24 @@ export declare class WWA {
188
193
  private _execObjectLocalGateEvent;
189
194
  private _execObjectUrlGateEvent;
190
195
  private _execObjectScoreEvent;
191
- updateScore(scoreOption?: ScoreOptions): void;
196
+ updateScore(scoreOption?: ScoreOption): void;
192
197
  private _execChoiceWindowObjectSellEvent;
193
198
  private _execChoiceWindowRunningEvent;
194
199
  private _dispatchWindowClosedTimeRequests;
195
200
  private _dispatchPlayerAndObjectsStopTimeRequests;
196
201
  private _clearAllRequests;
197
- reserveMessageDisplayWhenShouldOpen(message: string): void;
198
- generatePageAndReserveExecution(message: string, showChoice: boolean, isSystemMessage: boolean, partsID?: number, partsType?: PartsType, partsPosition?: Coord, scoreOption?: ScoreOptions | undefined): void;
199
- generatePagesByRawMessage(message: string, partsId: number, partsType: PartsType, partsPosition: Coord, isSystemMessage: boolean, showChoice: boolean, scoreOption: ScoreOptions): Page[];
200
- private parseMessageLines;
201
- private createNewNode;
202
- private processConditionalExecuteMacroLine;
203
- private connectOrMergeToPreviousNode;
204
- private connectToFinalNode;
202
+ reserveMessageDisplayWhenShouldOpen(messageRequest: MessageRequestPage): void;
203
+ handleMsgFunction(messageRequest: MessageRequestPage): void;
204
+ registerSystemMessagePage(message: string, showChoice?: boolean): void;
205
+ registerSystemMessagePageByKey(systemMessageKey: SystemMessage.Key): void;
206
+ private _createSimpleMessage;
207
+ registerPageByMessage(message: string, { showChoice, isSystemMessage, triggerParts, scoreOption, additionalItems, }?: {
208
+ showChoice?: boolean;
209
+ isSystemMessage?: boolean;
210
+ triggerParts?: TriggerParts;
211
+ scoreOption?: ScoreOption;
212
+ additionalItems?: PageAdditionalItem[];
213
+ }): void;
205
214
  appearParts({ pos, triggerType, triggerPartsId }: PartsAppearance): void;
206
215
  reserveAppearPartsInNextFrame(pos: Coord, triggerType: AppearanceTriggerType, triggerPartsId?: number): void;
207
216
  reserveJumpInNextFrame(position: Position): void;
@@ -330,14 +339,13 @@ export declare class WWA {
330
339
  setUserValDiv(x: number, y: number): void;
331
340
  setUserValMod(x: number, y: number): void;
332
341
  setUserValRandNum(x: number, num: number, bias: number): void;
333
- private _generateShowStrString;
334
342
  speedChangeJudge(speedChangeFlag: boolean): void;
335
343
  execSetMacro(macroStr: string, option: {
336
344
  triggerParts: TriggerParts;
337
345
  }): {
338
346
  isGameOver?: true;
339
347
  };
340
- generateTokenValues(triggerParts: TriggerParts): ExpressionParser.TokenValues;
348
+ generateTokenValues(triggerParts?: TriggerParts): ExpressionParser.TokenValues;
341
349
  userVarUserIf(_triggerPartsPosition: Coord, args: string[]): void;
342
350
  private compareUserVar;
343
351
  setPlayerSpeedIndex(speedIndex: number): void;
@@ -371,7 +379,9 @@ export declare class WWA {
371
379
  userVars: (string | number | boolean)[];
372
380
  playerCoord: Coord;
373
381
  playerDirection: Direction;
382
+ cameraCoord: Coord;
374
383
  itemBox: number[];
384
+ wwaData: Data;
375
385
  };
376
386
  private _debugEvalString;
377
387
  private _execEvalString;
@@ -0,0 +1,32 @@
1
+ import { MacroType, type TriggerParts } from "../../wwa_data";
2
+ import type { Macro } from "../../wwa_macro";
3
+ import { Node, Page, MessageLineType, Junction, MessageLine, MessageSegments, PageGeneratingOption } from "../data";
4
+ import * as ExpressionParser from "../../wwa_expression";
5
+ export declare function normalizeMessage(message: string): string;
6
+ export declare function splitMessageByTags(message: string): {
7
+ pageContents: string[];
8
+ script?: string;
9
+ };
10
+ export declare function createPage({ content, script, generatingOption, pageType, parseMacro, evalScript, generateTokenValuesCallback, }: {
11
+ content: string;
12
+ script?: string;
13
+ generatingOption: PageGeneratingOption;
14
+ pageType: "first" | "last" | "other";
15
+ parseMacro: (macroStr: string) => Macro;
16
+ evalScript: (script: string, triggerParts?: TriggerParts) => void;
17
+ generateTokenValuesCallback: (triggerParts: TriggerParts) => ExpressionParser.TokenValues;
18
+ }): Page;
19
+ export declare const messageLineIsText: (lineType: MessageLineType) => lineType is "text" | MacroType.SHOW_STR | MacroType.SHOW_STR2 | "normalMacro";
20
+ export declare function parseMessageLines(pageContent: string, parseMacro: (macroStr: string) => Macro): MessageLine[];
21
+ export declare function createNewNode(currentLine: MessageLine, shouldCreateParsedMessage: boolean, generateTokenValues: (triggerParts?: TriggerParts) => ExpressionParser.TokenValues, evalScript: (script: string, triggerParts?: TriggerParts) => void, option: {
22
+ triggerParts: TriggerParts;
23
+ }): Node | undefined;
24
+ export declare function processConditionalExecuteMacroLine(newNode: Node, currentLine: MessageLine, parentJunction: Junction | undefined, junctionNodeStack: Junction[]): Junction | undefined;
25
+ export declare function connectOrMergeToPreviousNode(currentLine: MessageLine, previousLineType: MessageLineType, nodeByPrevLine: Node | undefined, newNode: Node | undefined, parentJunction: Junction, endIfTargetJunction: Junction | undefined, generateTokenValues: (triggerParts: TriggerParts) => ExpressionParser.TokenValues, option: {
26
+ triggerParts: TriggerParts;
27
+ }): void;
28
+ export declare function connectToFinalNode(firstNode: Node, targetNode: Node): void;
29
+ export declare function generateShowStrString(macroArgs: string[], generateTokenValues: (triggerParts?: TriggerParts) => ExpressionParser.TokenValues, option: {
30
+ triggerParts: TriggerParts;
31
+ version: 1 | 2;
32
+ }): MessageSegments;
@@ -0,0 +1,18 @@
1
+ import { PreprocessMacroType } from "../../wwa_data";
2
+ import { Macro } from "../../wwa_macro";
3
+ export { Node, Branch, Junction, LazyEvaluateValue, ParsedMessage, MessageSegments } from "./node";
4
+ export { Page, PageGeneratingOption } from "./page";
5
+ export type MessageLineType = PreprocessMacroType | "text" | "normalMacro";
6
+ export type MessageLine = {
7
+ type: PreprocessMacroType;
8
+ text: string;
9
+ macro: Macro;
10
+ } | {
11
+ type: "normalMacro";
12
+ text: string;
13
+ macro: Macro;
14
+ } | {
15
+ type: "text";
16
+ text: string;
17
+ macro?: undefined;
18
+ };
@@ -0,0 +1,46 @@
1
+ import type { TriggerParts } from "../../wwa_data";
2
+ import { type TokenValues, type Descriminant } from "../../wwa_expression";
3
+ import { Macro } from "../../wwa_macro";
4
+ export declare abstract class Node {
5
+ protected generateTokenValues: (triggerParts?: TriggerParts) => TokenValues;
6
+ constructor(generateTokenValues: (triggerParts?: TriggerParts) => TokenValues);
7
+ abstract execute(triggerParts?: TriggerParts): ParsedMessage[];
8
+ static executeNodes(firstNode: Node | undefined, triggerParts?: TriggerParts): {
9
+ isError: false;
10
+ messages: ParsedMessage[];
11
+ } | {
12
+ isError: true;
13
+ };
14
+ }
15
+ export interface Branch {
16
+ descriminant?: Descriminant;
17
+ elseBranch?: {
18
+ type: "real" | "pesudo-else";
19
+ };
20
+ next?: Node;
21
+ }
22
+ export declare class Junction extends Node {
23
+ branches: Branch[];
24
+ constructor(branches: Branch[], generateTokenValues: (triggerParts?: TriggerParts) => TokenValues);
25
+ appendBranch(branch: Branch): void;
26
+ getLastUnconnectedBranch(): Branch | undefined;
27
+ evaluateAndGetNextNode(triggerParts?: TriggerParts): Node | undefined;
28
+ hasElseBranch(): boolean;
29
+ execute(triggerParts?: TriggerParts): ParsedMessage[];
30
+ }
31
+ export type LazyEvaluateValue = () => number | string | boolean;
32
+ export type MessageSegments = (string | LazyEvaluateValue)[];
33
+ export declare class ParsedMessage extends Node {
34
+ private evalScript;
35
+ macro?: Macro[];
36
+ next?: Node;
37
+ script?: string;
38
+ private messageSegments;
39
+ constructor(textOrMessageSegments: string | MessageSegments, generateTokenValues: (triggerParts?: TriggerParts) => TokenValues, evalScript: (script: string, triggerParts?: TriggerParts) => void, macro?: Macro[], next?: Node, script?: string);
40
+ isEmpty(): boolean;
41
+ generatePrintableMessage(): string;
42
+ appendMessage(message: string | MessageSegments, withNewLine?: boolean): void;
43
+ static createEmptyMessage(generateTokenValues: (triggerParts?: TriggerParts) => TokenValues, evalScript: (script: string, triggerParts?: TriggerParts) => void, script?: string): ParsedMessage;
44
+ private parseMessage;
45
+ execute(triggerParts?: TriggerParts): ParsedMessage[];
46
+ }
@@ -0,0 +1,13 @@
1
+ import type { ScoreOption, TriggerParts } from "../../wwa_data";
2
+ import { PageAdditionalItem } from "../../wwa_expression2/typedef";
3
+ import { Node } from "./node";
4
+ export interface Page {
5
+ firstNode?: Node;
6
+ isLastPage: boolean;
7
+ triggerParts: TriggerParts;
8
+ isSystemMessage: boolean;
9
+ showChoice: boolean;
10
+ scoreOption?: ScoreOption;
11
+ additionalItems?: PageAdditionalItem[];
12
+ }
13
+ export type PageGeneratingOption = Pick<Page, "triggerParts" | "isSystemMessage" | "showChoice" | "scoreOption" | "additionalItems">;
@@ -0,0 +1,10 @@
1
+ import { TriggerParts } from "../wwa_data";
2
+ import { Node, Page, PageGeneratingOption } from "./data";
3
+ import * as ExpressionParser from "../wwa_expression";
4
+ import { Macro } from "../wwa_macro";
5
+ export * from "./data";
6
+ export * from "./typedef";
7
+ export declare function generatePagesByRawMessage(message: string, generatingOption: PageGeneratingOption, parseMacro: (macroStr: string) => Macro, evalScript: (script: string, triggerParts?: TriggerParts) => void, generateTokenValuesCallback: (triggerParts: TriggerParts) => ExpressionParser.TokenValues): Page[];
8
+ export declare function isEmptyMessageTree(node: Node | undefined): boolean;
9
+ export declare function getLastMessage(node: undefined): undefined;
10
+ export declare function getLastMessage(node: Node): Node;
@@ -0,0 +1,5 @@
1
+ import { PageAdditionalItem } from "../wwa_expression2/typedef";
2
+ export interface MessageRequestPage {
3
+ message: string;
4
+ additionalItems: PageAdditionalItem[];
5
+ }
@@ -46,7 +46,7 @@ export declare class Player extends PartsObject {
46
46
  protected _itemBox: number[];
47
47
  protected _itemBoxElement: HTMLDivElement[];
48
48
  protected _itemUsingEvent: EventListener[];
49
- protected _readyToUseItemPos: number;
49
+ protected _readyToUseItemPos1To12: number;
50
50
  protected _isReadyToUseItem: boolean;
51
51
  protected _battleFrameCounter: number;
52
52
  protected _isPlayerTurn: boolean;
@@ -150,7 +150,7 @@ export declare class Player extends PartsObject {
150
150
  calcBattleResultForEnemyTurn(enemyStatus: Status, playerStatus: Status, estimating?: boolean): BattleTurnResult;
151
151
  private _calcDamageDefault;
152
152
  fight(): void;
153
- readyToUseItem(itemPos: number): void;
153
+ readyToUseItem(itemPos1To12: number): void;
154
154
  isReadyToUseItem(): boolean;
155
155
  getDrawingCenterPosition(): Coord;
156
156
  mainFrameCount(): void;
@@ -0,0 +1,97 @@
1
+ import { WWA } from "./wwa_main";
2
+ import { WWAData, Coord, Position, Direction } from "./wwa_data";
3
+ import { Monster } from "./wwa_monster";
4
+ import { WWASave } from "./wwa_save";
5
+ export declare class TextWindow {
6
+ protected _wwa: WWA;
7
+ protected _coord: Coord;
8
+ protected _width: number;
9
+ protected _height: number;
10
+ protected _isVisible: boolean;
11
+ protected _parentElement: HTMLElement;
12
+ protected _element: HTMLElement;
13
+ constructor(_wwa: WWA, _coord: Coord, _width: number, _height: number, _isVisible: boolean, _parentElement: HTMLElement, zIndex: number);
14
+ update(a?: any): void;
15
+ show(): void;
16
+ hide(): void;
17
+ isVisible(): boolean;
18
+ protected get windowName(): string;
19
+ }
20
+ export declare class MonsterWindow extends TextWindow {
21
+ protected _cgFileName: string;
22
+ protected _monsterBox: HTMLDivElement;
23
+ protected _energyBox: HTMLDivElement;
24
+ protected _strengthBox: HTMLDivElement;
25
+ protected _defenceBox: HTMLDivElement;
26
+ constructor(wwa: WWA, coord: Coord, width: number, height: number, isVisible: boolean, parentElement: HTMLElement, _cgFileName: string);
27
+ update(monster?: Monster): void;
28
+ protected get windowName(): string;
29
+ }
30
+ export declare class ScoreWindow extends TextWindow {
31
+ protected static WINDOW_NAME: string;
32
+ constructor(wwa: WWA, coord: Coord, isVisible: boolean, parentElement: HTMLElement);
33
+ update(score?: number): void;
34
+ protected get windowName(): string;
35
+ }
36
+ export declare enum Positioning {
37
+ TOP = 0,
38
+ CENTER = 1,
39
+ BOTTOM = 2,
40
+ SCORE = 3
41
+ }
42
+ export declare class MessageWindow {
43
+ private _wwa;
44
+ private _x;
45
+ private _y;
46
+ private _width;
47
+ private _height;
48
+ private _message;
49
+ private _cgFileName;
50
+ private _isVisible;
51
+ private _isYesno;
52
+ private _isSave;
53
+ private _isItemMenu;
54
+ private _isInputDisable;
55
+ private _element;
56
+ private _msgWrapperElement;
57
+ private _dummyElement;
58
+ private _saveElement;
59
+ private _ynWrapperElement;
60
+ private _divYesElement;
61
+ private _divNoElement;
62
+ private _parentElement;
63
+ private _wwaSave;
64
+ private _save_select_id;
65
+ private _save_counter;
66
+ private _save_close;
67
+ constructor(wwa: WWA, x: number, y: number, width: number, height: number, cgFileName: string, isVisible: boolean, isYesno: boolean, isItemMenu: boolean, parentElement: HTMLElement);
68
+ setPosition(x: number, y: number, width: number, height: number): void;
69
+ setPositionByPlayerPosition(existsFaces: boolean, existsScoreWindow: boolean, displayCenter: boolean, playerPos: Position, cameraPos: Position): void;
70
+ setPositionEasy(pos: Positioning): void;
71
+ setMessage(message: string): void;
72
+ clear(): void;
73
+ setYesNoChoice(isYesNo: boolean): boolean;
74
+ isYesNoChoice(): boolean;
75
+ isSaveChoice(): boolean;
76
+ setItemMenuChoice(isItemMenu: boolean): boolean;
77
+ isItemMenuChoice(): boolean;
78
+ setInputDisable(): void;
79
+ isInputDisable(): boolean;
80
+ show(): void;
81
+ hide(): void;
82
+ isVisible(): boolean;
83
+ private isWideChar;
84
+ private createClassicTextElement;
85
+ update(): void;
86
+ setWWASave(wwaSave: WWASave): void;
87
+ createSaveDom(): void;
88
+ deleteSaveDom(): void;
89
+ setSaveID(save_select_id: number): void;
90
+ save(gameCvs: HTMLCanvasElement, _quickSaveData: WWAData): boolean;
91
+ load(): WWAData;
92
+ saveUpdate(): void;
93
+ isSaveClose(): boolean;
94
+ private cursor_wait;
95
+ saveControll(moveDir: Direction): void;
96
+ protected get windowName(): string;
97
+ }