-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwwa.js
More file actions
43 lines (42 loc) · 334 KB
/
Copy pathwwa.js
File metadata and controls
43 lines (42 loc) · 334 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
@license WWA Wing
http://wwawing.com/
Copyright (c) 1996-2015 NAO
Copyright (c) 2015 WWA Wing Team
LICENSE: https://raw.githubusercontent.com/WWAWing/WWAWing/master/LICENSE
*/
!function(t){var e={};function n(a){if(e[a])return e[a].exports;var s=e[a]={i:a,l:!1,exports:{}};return t[a].call(s.exports,s,s.exports,n),s.l=!0,s.exports}n.m=t,n.c=e,n.d=function(t,e,a){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(n.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(a,s,function(e){return t[e]}.bind(null,s));return a},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s="./src/wwa_main.ts")}({"./src/wwa_camera.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar Camera = (function () {\n function Camera(position) {\n this._position = null;\n this.reset(position);\n }\n Camera.prototype.setPlayer = function (player) {\n this._player = player;\n };\n Camera.prototype.isResetting = function () {\n return this._isResetting;\n };\n Camera.prototype.getPosition = function () {\n return this._position;\n };\n Camera.prototype.getPreviousPosition = function () {\n return this._positionPrev;\n };\n Camera.prototype.resetPreviousPosition = function () {\n this._positionPrev = null;\n };\n Camera.prototype.move = function (dir) {\n var speed = wwa_data_1.speedList[this._player.getSpeedIndex()];\n this._position = this._position.getNextFramePosition(dir, speed * (wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW - 1), speed * (wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW - 1));\n };\n Camera.prototype.getTransitionStepNum = function () {\n return this._transitionStep;\n };\n Camera.prototype.advanceTransitionStepNum = function () {\n ++this._transitionStep;\n if (this._transitionStep === wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW) {\n this._isResetting = false;\n this._transitionStep = 0;\n }\n return this._transitionStep;\n };\n Camera.prototype.isFinalStep = function () {\n if (this._isResetting === false) {\n throw new Error("リセット中ではありません。");\n }\n return this._transitionStep === wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW - 1;\n };\n Camera.prototype.reset = function (position) {\n this._positionPrev = this._position;\n this._position = position.getDefaultCameraPosition();\n this._transitionStep = 0;\n this._isResetting = true;\n };\n return Camera;\n}());\nexports.Camera = Camera;\n\n\n//# sourceURL=webpack:///./src/wwa_camera.ts?')},"./src/wwa_cgmanager.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar CGManager = (function () {\n function CGManager(ctx, ctxSub, fileName, loadCompleteCallBack) {\n this._isLoaded = false;\n this._ctx = ctx;\n this._ctxSub = ctxSub;\n this._fileName = fileName;\n this._loadCompleteCallBack = loadCompleteCallBack;\n this._load();\n }\n CGManager.prototype._load = function () {\n var _this = this;\n if (this._isLoaded) {\n return;\n }\n this._image = new Image();\n this._image.addEventListener("load", function () {\n _this._loadCompleteCallBack();\n });\n this._image.addEventListener("error", function () {\n throw new Error("Image Load Failed!!\\nfile name:" + _this._fileName);\n });\n this._image.src = this._fileName;\n this._isLoaded = true;\n };\n CGManager.prototype.drawCanvas = function (chipX, chipY, canvasX, canvasY, isSub) {\n if (isSub === void 0) { isSub = false; }\n var ctx = isSub ? this._ctxSub : this._ctx;\n if (!this._isLoaded) {\n throw new Error("No image was loaded.");\n }\n ctx.drawImage(this._image, wwa_data_1.WWAConsts.CHIP_SIZE * chipX, wwa_data_1.WWAConsts.CHIP_SIZE * chipY, wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.CHIP_SIZE, canvasX, canvasY, wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.CHIP_SIZE);\n };\n CGManager.prototype.drawCanvasWithSize = function (chipX, chipY, width, height, canvasX, canvasY, isSub) {\n if (isSub === void 0) { isSub = false; }\n var ctx = isSub ? this._ctxSub : this._ctx;\n if (!this._isLoaded) {\n throw new Error("No image was loaded.");\n }\n ctx.drawImage(this._image, wwa_data_1.WWAConsts.CHIP_SIZE * chipX, wwa_data_1.WWAConsts.CHIP_SIZE * chipY, wwa_data_1.WWAConsts.CHIP_SIZE * width, wwa_data_1.WWAConsts.CHIP_SIZE * height, canvasX, canvasY, wwa_data_1.WWAConsts.CHIP_SIZE * width, wwa_data_1.WWAConsts.CHIP_SIZE * height);\n };\n CGManager.prototype.drawCanvasWithUpperYLimit = function (chipX, chipY, canvasX, canvasY, yLimit, isSub) {\n if (isSub === void 0) { isSub = false; }\n var ctx = isSub ? this._ctxSub : this._ctx;\n if (!this._isLoaded) {\n throw new Error("No image was loaded.");\n }\n var delLength = Math.max(0, canvasY + wwa_data_1.WWAConsts.CHIP_SIZE - yLimit);\n if (delLength >= wwa_data_1.WWAConsts.CHIP_SIZE) {\n return;\n }\n ctx.drawImage(this._image, wwa_data_1.WWAConsts.CHIP_SIZE * chipX, wwa_data_1.WWAConsts.CHIP_SIZE * chipY, wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.CHIP_SIZE - delLength, canvasX, canvasY, wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.CHIP_SIZE);\n };\n CGManager.prototype.drawCanvasWithLowerYLimit = function (chipX, chipY, canvasX, canvasY, yLimit, isSub) {\n if (isSub === void 0) { isSub = false; }\n var ctx = isSub ? this._ctxSub : this._ctx;\n if (!this._isLoaded) {\n throw new Error("No image was loaded.");\n }\n var delLength = Math.max(0, yLimit - canvasY);\n if (delLength >= wwa_data_1.WWAConsts.CHIP_SIZE) {\n return;\n }\n ctx.drawImage(this._image, wwa_data_1.WWAConsts.CHIP_SIZE * chipX, wwa_data_1.WWAConsts.CHIP_SIZE * chipY + delLength, wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.CHIP_SIZE - delLength, canvasX, canvasY + delLength, wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.CHIP_SIZE);\n };\n CGManager.prototype.clearCanvas = function (x, y, w, h, isSub) {\n if (isSub === void 0) { isSub = false; }\n var ctx = isSub ? this._ctxSub : this._ctx;\n ctx.clearRect(x, y, w, h);\n };\n CGManager.prototype.drawBase = function (x, y, w, h, isSub) {\n if (isSub === void 0) { isSub = false; }\n var ctx = isSub ? this._ctxSub : this._ctx;\n ctx.fillStyle = "#9E9E9E";\n ctx.fillRect(x, y, w, h);\n };\n return CGManager;\n}());\nexports.CGManager = CGManager;\n\n\n//# sourceURL=webpack:///./src/wwa_cgmanager.ts?')},"./src/wwa_data.ts":function(module,exports,__webpack_require__){"use strict";eval('\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_input_1 = __webpack_require__("./src/wwa_input.ts");\nvar EquipmentStatus = (function () {\n function EquipmentStatus(s, d) {\n this.strength = s;\n this.defence = d;\n }\n EquipmentStatus.prototype.add = function (s) {\n this.strength += s.strength;\n this.defence += s.defence;\n return this;\n };\n EquipmentStatus.prototype.plus = function (s) {\n return new EquipmentStatus(this.strength + s.strength, this.defence + s.defence);\n };\n EquipmentStatus.prototype.minus = function (s) {\n return new EquipmentStatus(this.strength - s.strength, this.defence - s.defence);\n };\n EquipmentStatus.prototype.equals = function (e) {\n return this.strength === e.strength && this.defence === e.defence;\n };\n return EquipmentStatus;\n}());\nexports.EquipmentStatus = EquipmentStatus;\nvar Status = (function (_super) {\n __extends(Status, _super);\n function Status(e, s, d, g) {\n var _this = _super.call(this, s, d) || this;\n _this.energy = e;\n _this.gold = g;\n return _this;\n }\n Status.prototype.add = function (s) {\n if (s instanceof Status) {\n this.energy += s.energy;\n this.gold += s.gold;\n }\n this.strength += s.strength;\n this.defence += s.defence;\n return this;\n };\n Status.prototype.plus = function (s) {\n if (s instanceof Status) {\n return new Status(this.energy + s.energy, this.strength + s.strength, this.defence + s.defence, this.gold + s.gold);\n }\n return new Status(this.energy, this.strength + s.strength, this.defence + s.defence, this.gold);\n };\n Status.prototype.minus = function (s) {\n if (s instanceof Status) {\n return new Status(this.energy - s.energy, this.strength - s.strength, this.defence - s.defence, this.gold - s.gold);\n }\n return new Status(this.energy, this.strength - s.strength, this.defence - s.defence, this.gold);\n };\n Status.prototype.equals = function (e) {\n return this.energy === e.energy && this.strength === e.strength && this.defence === e.defence && this.gold === e.gold;\n };\n Status.prototype.calculateScore = function (weight) {\n var _this = this;\n return Object.keys(weight).reduce(function (prev, key) { return prev + weight[key] * _this[key]; }, 0);\n };\n return Status;\n}(EquipmentStatus));\nexports.Status = Status;\nvar Coord = (function () {\n function Coord(x, y) {\n if (x === void 0) { x = 0; }\n if (y === void 0) { y = 0; }\n this.x = x;\n this.y = y;\n }\n Coord.prototype.equals = function (coord) {\n return this.x === coord.x && this.y === coord.y;\n };\n Coord.prototype.substract = function (c) {\n return new Coord(this.x - c.x, this.y - c.y);\n };\n Coord.prototype.clone = function () {\n return new Coord(this.x, this.y);\n };\n Coord.prototype.convertIntoPosition = function (wwa) {\n return new Position(wwa, this.x, this.y, 0, 0);\n };\n Coord.prototype.getDirectionTo = function (dest) {\n if (this.x < dest.x) {\n if (this.y > dest.y) {\n return Direction.RIGHT_UP;\n }\n if (this.y === dest.y) {\n return Direction.RIGHT;\n }\n return Direction.RIGHT_DOWN;\n }\n if (this.x === dest.x) {\n if (this.y > dest.y) {\n return Direction.UP;\n }\n if (this.y === dest.y) {\n return Direction.NO_DIRECTION;\n }\n return Direction.DOWN;\n }\n if (this.y > dest.y) {\n return Direction.LEFT_UP;\n }\n if (this.y === dest.y) {\n return Direction.LEFT;\n }\n return Direction.LEFT_DOWN;\n };\n Coord.prototype.toString = function () {\n return "(" + this.x + ", " + this.y + ")";\n };\n return Coord;\n}());\nexports.Coord = Coord;\nvar Position = (function () {\n function Position(wwa, x, y, offsetX, offsetY) {\n if (offsetX === void 0) { offsetX = 0; }\n if (offsetY === void 0) { offsetY = 0; }\n this._wwa = wwa;\n if (this._wwa === void 0) {\n throw new Error("WWAのインスタンスが存在しません. ");\n }\n var w = this._wwa.getMapWidth();\n if (x < 0 || x >= w || x >= w - 1 && offsetX > 0 || y < 0 || y >= w || y >= w - 1 && offsetY > 0) {\n throw new Error("範囲外の座標です!! parts:(" + x + ", " + y + "), offset:(" + offsetX + ", " + offsetY + "), mapWidth = " + w);\n }\n this._partsCoord = new Coord(x, y);\n this._offsetCoord = new Coord(offsetX, offsetY);\n }\n Position.prototype.getPartsCoord = function () {\n return this._partsCoord;\n };\n Position.prototype.getOffsetCoord = function () {\n return this._offsetCoord;\n };\n Position.prototype.getScreenTopPosition = function () {\n var newX = Math.floor(this._partsCoord.x / (WWAConsts.H_PARTS_NUM_IN_WINDOW - 1)) * (WWAConsts.H_PARTS_NUM_IN_WINDOW - 1);\n var newY = Math.floor(this._partsCoord.y / (WWAConsts.V_PARTS_NUM_IN_WINDOW - 1)) * (WWAConsts.V_PARTS_NUM_IN_WINDOW - 1);\n return new Position(this._wwa, newX, newY, 0, 0);\n };\n Position.prototype.getDefaultCameraPosition = function () {\n var pos = this.getScreenTopPosition();\n var coord = pos.getPartsCoord();\n var width = this._wwa.getMapWidth();\n var newCoord = pos.getPartsCoord().clone();\n if (coord.x === width - 1) {\n newCoord.x--;\n }\n if (coord.y === width - 1) {\n newCoord.y--;\n }\n return newCoord.convertIntoPosition(this._wwa).getScreenTopPosition();\n };\n Position.prototype.getNextJustPosition = function (dir) {\n if (dir !== void 0) {\n var p = this._partsCoord;\n return new Position(this._wwa, p.x + exports.vx[dir], p.y + exports.vy[dir], 0, 0);\n }\n var x = this._partsCoord.x, y = this._partsCoord.y;\n if (this._offsetCoord.x < 0) {\n x--;\n }\n else if (this._offsetCoord.x > 0) {\n x++;\n }\n if (this._offsetCoord.y < 0) {\n y--;\n }\n else if (this._offsetCoord.y > 0) {\n y++;\n }\n return new Position(this._wwa, x, y, 0, 0);\n };\n Position.prototype.getNextFramePosition = function (dir, speedX, speedY) {\n var nx = this._partsCoord.x;\n var ny = this._partsCoord.y;\n var nox = this._offsetCoord.x + (exports.vx[dir] * speedX);\n var noy = this._offsetCoord.y + (exports.vy[dir] * speedY);\n if (nox < 0) {\n var dx = Math.floor(Math.abs(nox) / WWAConsts.CHIP_SIZE);\n nx -= dx;\n nox = (nox + dx * WWAConsts.CHIP_SIZE) % WWAConsts.CHIP_SIZE;\n }\n if (noy < 0) {\n var dy = Math.floor(Math.abs(noy) / WWAConsts.CHIP_SIZE);\n ny -= dy;\n noy = (noy + dy * WWAConsts.CHIP_SIZE) % WWAConsts.CHIP_SIZE;\n }\n if (nox >= WWAConsts.CHIP_SIZE) {\n nx += Math.floor(nox / WWAConsts.CHIP_SIZE);\n nox = (nox + WWAConsts.CHIP_SIZE) % WWAConsts.CHIP_SIZE;\n }\n if (noy >= WWAConsts.CHIP_SIZE) {\n ny += Math.floor(noy / WWAConsts.CHIP_SIZE);\n noy = (noy + WWAConsts.CHIP_SIZE) % WWAConsts.CHIP_SIZE;\n }\n return new Position(this._wwa, nx, ny, nox, noy);\n };\n Position.prototype.isJustPosition = function () {\n return this._offsetCoord.x == 0 && this._offsetCoord.y == 0;\n };\n Position.prototype.isScreenTopPosition = function () {\n var stp = this.getScreenTopPosition();\n return this.equals(stp);\n };\n Position.prototype.equals = function (pos) {\n return (this._partsCoord.equals(pos.getPartsCoord()) &&\n this._offsetCoord.equals(pos.getOffsetCoord()));\n };\n Position.prototype.isInCameraRange = function (camera, exceptRightBottomEdge) {\n if (exceptRightBottomEdge === void 0) { exceptRightBottomEdge = false; }\n var camPos = camera.getPosition()._partsCoord;\n var x = this._partsCoord.x;\n var y = this._partsCoord.y;\n var m = exceptRightBottomEdge ? 1 : 0;\n return (camPos.x <= x && x < camPos.x + WWAConsts.H_PARTS_NUM_IN_WINDOW - m &&\n camPos.y <= y && y < camPos.y + WWAConsts.V_PARTS_NUM_IN_WINDOW - m);\n };\n Position.prototype.hasLocalGate = function () {\n return (this._wwa.getMapTypeByPosition(this) === WWAConsts.MAP_LOCALGATE ||\n this._wwa.getObjectTypeByPosition(this) === WWAConsts.OBJECT_LOCALGATE);\n };\n Position.prototype.clone = function () {\n return new Position(this._wwa, this._partsCoord.x, this._partsCoord.y, this._offsetCoord.x, this._offsetCoord.y);\n };\n return Position;\n}());\nexports.Position = Position;\nvar Face = (function () {\n function Face(destPos, srcPos, srcSize) {\n this.destPos = destPos.clone();\n this.srcPos = srcPos.clone();\n this.srcSize = srcSize.clone();\n }\n return Face;\n}());\nexports.Face = Face;\nvar Direction;\n(function (Direction) {\n Direction[Direction["LEFT"] = 0] = "LEFT";\n Direction[Direction["RIGHT"] = 1] = "RIGHT";\n Direction[Direction["DOWN"] = 2] = "DOWN";\n Direction[Direction["UP"] = 3] = "UP";\n Direction[Direction["LEFT_DOWN"] = 4] = "LEFT_DOWN";\n Direction[Direction["LEFT_UP"] = 5] = "LEFT_UP";\n Direction[Direction["RIGHT_DOWN"] = 6] = "RIGHT_DOWN";\n Direction[Direction["RIGHT_UP"] = 7] = "RIGHT_UP";\n Direction[Direction["NO_DIRECTION"] = 8] = "NO_DIRECTION";\n})(Direction = exports.Direction || (exports.Direction = {}));\n;\nexports.vx = [-1, 1, 0, 0, -1, -1, 1, 1, 0];\nexports.vy = [0, 0, 1, -1, 1, -1, 1, -1, 0];\nexports.dirToPos = [4, 6, 2, 0];\nexports.dirToKey = [wwa_input_1.KeyCode.KEY_LEFT, wwa_input_1.KeyCode.KEY_RIGHT, wwa_input_1.KeyCode.KEY_DOWN, wwa_input_1.KeyCode.KEY_UP];\nvar YesNoState;\n(function (YesNoState) {\n YesNoState[YesNoState["YES"] = 0] = "YES";\n YesNoState[YesNoState["NO"] = 1] = "NO";\n YesNoState[YesNoState["UNSELECTED"] = 2] = "UNSELECTED";\n})(YesNoState = exports.YesNoState || (exports.YesNoState = {}));\nvar AppearanceTriggerType;\n(function (AppearanceTriggerType) {\n AppearanceTriggerType[AppearanceTriggerType["MAP"] = 0] = "MAP";\n AppearanceTriggerType[AppearanceTriggerType["OBJECT"] = 1] = "OBJECT";\n AppearanceTriggerType[AppearanceTriggerType["CHOICE_YES"] = 2] = "CHOICE_YES";\n AppearanceTriggerType[AppearanceTriggerType["CHOICE_NO"] = 3] = "CHOICE_NO";\n})(AppearanceTriggerType = exports.AppearanceTriggerType || (exports.AppearanceTriggerType = {}));\nvar ItemMode;\n(function (ItemMode) {\n ItemMode[ItemMode["NORMAL"] = 0] = "NORMAL";\n ItemMode[ItemMode["CAN_USE"] = 1] = "CAN_USE";\n ItemMode[ItemMode["NOT_DISAPPEAR"] = 2] = "NOT_DISAPPEAR";\n})(ItemMode = exports.ItemMode || (exports.ItemMode = {}));\nvar PartsType;\n(function (PartsType) {\n PartsType[PartsType["MAP"] = 1] = "MAP";\n PartsType[PartsType["OBJECT"] = 0] = "OBJECT";\n})(PartsType = exports.PartsType || (exports.PartsType = {}));\nvar ChoiceCallInfo;\n(function (ChoiceCallInfo) {\n ChoiceCallInfo[ChoiceCallInfo["NONE"] = 0] = "NONE";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_MAP_PARTS"] = 1] = "CALL_BY_MAP_PARTS";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_OBJECT_PARTS"] = 2] = "CALL_BY_OBJECT_PARTS";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_ITEM_USE"] = 3] = "CALL_BY_ITEM_USE";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_QUICK_SAVE"] = 4] = "CALL_BY_QUICK_SAVE";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_QUICK_LOAD"] = 5] = "CALL_BY_QUICK_LOAD";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_RESTART_GAME"] = 6] = "CALL_BY_RESTART_GAME";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_GOTO_WWA"] = 7] = "CALL_BY_GOTO_WWA";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_PASSWORD_SAVE"] = 8] = "CALL_BY_PASSWORD_SAVE";\n ChoiceCallInfo[ChoiceCallInfo["CALL_BY_PASSWORD_LOAD"] = 9] = "CALL_BY_PASSWORD_LOAD";\n})(ChoiceCallInfo = exports.ChoiceCallInfo || (exports.ChoiceCallInfo = {}));\nvar SidebarButton;\n(function (SidebarButton) {\n SidebarButton[SidebarButton["QUICK_LOAD"] = 0] = "QUICK_LOAD";\n SidebarButton[SidebarButton["QUICK_SAVE"] = 1] = "QUICK_SAVE";\n SidebarButton[SidebarButton["RESTART_GAME"] = 2] = "RESTART_GAME";\n SidebarButton[SidebarButton["GOTO_WWA"] = 3] = "GOTO_WWA";\n})(SidebarButton = exports.SidebarButton || (exports.SidebarButton = {}));\nvar SpeedChange;\n(function (SpeedChange) {\n SpeedChange[SpeedChange["UP"] = 0] = "UP";\n SpeedChange[SpeedChange["DOWN"] = 1] = "DOWN";\n})(SpeedChange = exports.SpeedChange || (exports.SpeedChange = {}));\nvar LoadType;\n(function (LoadType) {\n LoadType[LoadType["QUICK_LOAD"] = 0] = "QUICK_LOAD";\n LoadType[LoadType["RESTART_GAME"] = 1] = "RESTART_GAME";\n LoadType[LoadType["PASSWORD"] = 2] = "PASSWORD";\n})(LoadType = exports.LoadType || (exports.LoadType = {}));\nvar MoveType;\n(function (MoveType) {\n MoveType[MoveType["STATIC"] = 0] = "STATIC";\n MoveType[MoveType["CHASE_PLAYER"] = 1] = "CHASE_PLAYER";\n MoveType[MoveType["RUN_OUT"] = 2] = "RUN_OUT";\n MoveType[MoveType["HANG_AROUND"] = 3] = "HANG_AROUND";\n})(MoveType = exports.MoveType || (exports.MoveType = {}));\nvar SecondCandidateMoveType;\n(function (SecondCandidateMoveType) {\n SecondCandidateMoveType[SecondCandidateMoveType["MODE_X"] = 0] = "MODE_X";\n SecondCandidateMoveType[SecondCandidateMoveType["MODE_Y"] = 1] = "MODE_Y";\n SecondCandidateMoveType[SecondCandidateMoveType["UNDECIDED"] = 2] = "UNDECIDED";\n})(SecondCandidateMoveType = exports.SecondCandidateMoveType || (exports.SecondCandidateMoveType = {}));\nexports.sidebarButtonCellElementID = ["cell-load", "cell-save", "cell-restart", "cell-gotowwa"];\nvar SystemMessage1;\n(function (SystemMessage1) {\n SystemMessage1[SystemMessage1["ASK_LINK"] = 5] = "ASK_LINK";\n SystemMessage1[SystemMessage1["NO_MONEY"] = 6] = "NO_MONEY";\n SystemMessage1[SystemMessage1["NO_ITEM"] = 7] = "NO_ITEM";\n SystemMessage1[SystemMessage1["USE_ITEM"] = 8] = "USE_ITEM";\n})(SystemMessage1 = exports.SystemMessage1 || (exports.SystemMessage1 = {}));\nvar SystemMessage2;\n(function (SystemMessage2) {\n SystemMessage2[SystemMessage2["CLICKABLE_ITEM"] = 0] = "CLICKABLE_ITEM";\n SystemMessage2[SystemMessage2["FULL_ITEM"] = 1] = "FULL_ITEM";\n SystemMessage2[SystemMessage2["LOAD_SE"] = 2] = "LOAD_SE";\n})(SystemMessage2 = exports.SystemMessage2 || (exports.SystemMessage2 = {}));\nvar MacroType;\n(function (MacroType) {\n MacroType[MacroType["UNDEFINED"] = 0] = "UNDEFINED";\n MacroType[MacroType["IMGPLAYER"] = 1] = "IMGPLAYER";\n MacroType[MacroType["IMGYESNO"] = 2] = "IMGYESNO";\n MacroType[MacroType["HPMAX"] = 3] = "HPMAX";\n MacroType[MacroType["SAVE"] = 4] = "SAVE";\n MacroType[MacroType["ITEM"] = 5] = "ITEM";\n MacroType[MacroType["DEFAULT"] = 6] = "DEFAULT";\n MacroType[MacroType["OLDMAP"] = 7] = "OLDMAP";\n MacroType[MacroType["PARTS"] = 8] = "PARTS";\n MacroType[MacroType["MOVE"] = 9] = "MOVE";\n MacroType[MacroType["MAP"] = 10] = "MAP";\n MacroType[MacroType["DIRMAP"] = 11] = "DIRMAP";\n MacroType[MacroType["IMGFRAME"] = 12] = "IMGFRAME";\n MacroType[MacroType["IMGBOM"] = 13] = "IMGBOM";\n MacroType[MacroType["DELPLAYER"] = 14] = "DELPLAYER";\n MacroType[MacroType["FACE"] = 15] = "FACE";\n MacroType[MacroType["EFFECT"] = 16] = "EFFECT";\n MacroType[MacroType["GAMEOVER"] = 17] = "GAMEOVER";\n MacroType[MacroType["IMGCLICK"] = 18] = "IMGCLICK";\n MacroType[MacroType["STATUS"] = 19] = "STATUS";\n MacroType[MacroType["EFFITEM"] = 20] = "EFFITEM";\n MacroType[MacroType["COLOR"] = 21] = "COLOR";\n MacroType[MacroType["WAIT"] = 22] = "WAIT";\n MacroType[MacroType["SOUND"] = 23] = "SOUND";\n})(MacroType = exports.MacroType || (exports.MacroType = {}));\nexports.macrotable = {\n "": 0,\n "$imgplayer": 1,\n "$imgyesno": 2,\n "$hpmax": 3,\n "$save": 4,\n "$item": 5,\n "$default": 6,\n "$oldmap": 7,\n "$parts": 8,\n "$move": 9,\n "$map": 10,\n "$dirmap": 11,\n "$imgframe": 12,\n "$imgbom": 13,\n "$delplayer": 14,\n "$face": 15,\n "$effect": 16,\n "$gameover": 17,\n "$imgclick": 18,\n "$status": 19,\n "$effitem": 20,\n "$color": 21,\n "$wait": 22,\n "$sound": 23\n};\nvar MacroStatusIndex;\n(function (MacroStatusIndex) {\n MacroStatusIndex[MacroStatusIndex["ENERGY"] = 0] = "ENERGY";\n MacroStatusIndex[MacroStatusIndex["STRENGTH"] = 1] = "STRENGTH";\n MacroStatusIndex[MacroStatusIndex["DEFENCE"] = 2] = "DEFENCE";\n MacroStatusIndex[MacroStatusIndex["GOLD"] = 3] = "GOLD";\n MacroStatusIndex[MacroStatusIndex["MOVES"] = 4] = "MOVES";\n})(MacroStatusIndex = exports.MacroStatusIndex || (exports.MacroStatusIndex = {}));\nvar MacroImgFrameIndex;\n(function (MacroImgFrameIndex) {\n MacroImgFrameIndex[MacroImgFrameIndex["ENERGY"] = 0] = "ENERGY";\n MacroImgFrameIndex[MacroImgFrameIndex["STRENGTH"] = 1] = "STRENGTH";\n MacroImgFrameIndex[MacroImgFrameIndex["DEFENCE"] = 2] = "DEFENCE";\n MacroImgFrameIndex[MacroImgFrameIndex["GOLD"] = 3] = "GOLD";\n MacroImgFrameIndex[MacroImgFrameIndex["WIDE_CELL_ROW"] = 4] = "WIDE_CELL_ROW";\n MacroImgFrameIndex[MacroImgFrameIndex["ITEM_BG"] = 5] = "ITEM_BG";\n MacroImgFrameIndex[MacroImgFrameIndex["MAIN_FRAME"] = 6] = "MAIN_FRAME";\n})(MacroImgFrameIndex = exports.MacroImgFrameIndex || (exports.MacroImgFrameIndex = {}));\nvar SystemSound;\n(function (SystemSound) {\n SystemSound[SystemSound["DECISION"] = 1] = "DECISION";\n SystemSound[SystemSound["ATTACK"] = 3] = "ATTACK";\n SystemSound[SystemSound["BGM_LB"] = 70] = "BGM_LB";\n SystemSound[SystemSound["NO_SOUND"] = 99] = "NO_SOUND";\n})(SystemSound = exports.SystemSound || (exports.SystemSound = {}));\nexports.speedList = [2, 5, 8, 10];\nexports.speedNameList = ["低速", "準低速", "中速", "高速"];\nvar WWAConsts = (function () {\n function WWAConsts() {\n }\n WWAConsts.VERSION_WWAJS = "3.1.8";\n WWAConsts.WWA_HOME = "http://wwajp.com";\n WWAConsts.ITEMBOX_SIZE = 12;\n WWAConsts.MAP_ATR_MAX = 60;\n WWAConsts.OBJ_ATR_MAX = 60;\n WWAConsts.OLD_MAP_ATR_MAX = 40;\n WWAConsts.OLD_OBJ_ATR_MAX = 40;\n WWAConsts.ATR_TYPE = 3;\n WWAConsts.ATR_MODE = 4;\n WWAConsts.ATR_STRING = 5;\n WWAConsts.ATR_X = 6;\n WWAConsts.ATR_Y = 7;\n WWAConsts.ATR_X2 = 8;\n WWAConsts.ATR_Y2 = 9;\n WWAConsts.ATR_ENERGY = 10;\n WWAConsts.ATR_STRENGTH = 11;\n WWAConsts.ATR_DEFENCE = 12;\n WWAConsts.ATR_GOLD = 13;\n WWAConsts.ATR_ITEM = 14;\n WWAConsts.ATR_NUMBER = 15;\n WWAConsts.ATR_JUMP_X = 16;\n WWAConsts.ATR_MOVE = 16;\n WWAConsts.ATR_JUMP_Y = 17;\n WWAConsts.ATR_SOUND = 19;\n WWAConsts.ATR_APPERANCE_BASE = 20;\n WWAConsts.REL_ATR_APPERANCE_ID = 0;\n WWAConsts.REL_ATR_APPERANCE_X = 1;\n WWAConsts.REL_ATR_APPERANCE_Y = 2;\n WWAConsts.REL_ATR_APPERANCE_TYPE = 3;\n WWAConsts.REL_ATR_APPERANCE_UNIT_LENGTH = 4;\n WWAConsts.ATR_RANDOM_BASE = 10;\n WWAConsts.RANDOM_ATR_NUM = 10;\n WWAConsts.RANDOM_ITERATION_MAX = 10;\n WWAConsts.MAP_STREET = 0;\n WWAConsts.MAP_WALL = 1;\n WWAConsts.MAP_LOCALGATE = 2;\n WWAConsts.MAP_URLGATE = 4;\n WWAConsts.OBJECT_NORMAL = 0;\n WWAConsts.OBJECT_MESSAGE = 1;\n WWAConsts.OBJECT_URLGATE = 2;\n WWAConsts.OBJECT_STATUS = 3;\n WWAConsts.OBJECT_ITEM = 4;\n WWAConsts.OBJECT_DOOR = 5;\n WWAConsts.OBJECT_MONSTER = 6;\n WWAConsts.OBJECT_SCORE = 11;\n WWAConsts.OBJECT_SELL = 14;\n WWAConsts.OBJECT_BUY = 15;\n WWAConsts.OBJECT_RANDOM = 16;\n WWAConsts.OBJECT_SELECT = 17;\n WWAConsts.OBJECT_LOCALGATE = 18;\n WWAConsts.SYSTEM_MESSAGE_NUM = 20;\n WWAConsts.IMGPOS_DEFAULT_YESNO_X = 3;\n WWAConsts.IMGPOS_DEFAULT_YESNO_Y = 1;\n WWAConsts.IMGRELPOS_YESNO_YES_X = 0;\n WWAConsts.IMGRELPOS_YESNO_NO_X = 1;\n WWAConsts.IMGRELPOS_YESNO_YESP_X = 2;\n WWAConsts.IMGRELPOS_YESNO_NOP_X = 3;\n WWAConsts.IMGPOS_DEFAULT_PLAYER_X = 2;\n WWAConsts.IMGPOS_DEFAULT_PLAYER_Y = 0;\n WWAConsts.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X = 0;\n WWAConsts.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y = 0;\n WWAConsts.IMGPOS_DEFAULT_FRAME_X = 0;\n WWAConsts.IMGPOS_DEFAULT_FRAME_Y = 1;\n WWAConsts.IMGPOS_DEFAULT_BATTLE_EFFECT_X = 3;\n WWAConsts.IMGPOS_DEFAULT_BATTLE_EFFECT_Y = 3;\n WWAConsts.DEFAULT_DISABLE_SAVE = false;\n WWAConsts.DEFAULT_OLDMAP = false;\n WWAConsts.DEFAULT_OBJECT_NO_COLLAPSE = false;\n WWAConsts.SPLASH_SCREEN_DISP_MILLS = 100;\n WWAConsts.DEFAULT_FRAME_INTERVAL = 20;\n WWAConsts.GAMEOVER_FRAME_INTERVAL = 50;\n WWAConsts.YESNO_PRESS_DISP_FRAME_NUM = 20;\n WWAConsts.CHIP_SIZE = 40;\n WWAConsts.MAP_WINDOW_WIDTH = 440;\n WWAConsts.MAP_WINDOW_HEIGHT = 440;\n WWAConsts.H_PARTS_NUM_IN_WINDOW = WWAConsts.MAP_WINDOW_WIDTH / WWAConsts.CHIP_SIZE;\n WWAConsts.V_PARTS_NUM_IN_WINDOW = WWAConsts.MAP_WINDOW_HEIGHT / WWAConsts.CHIP_SIZE;\n WWAConsts.DEFAULT_SPEED_INDEX = 2;\n WWAConsts.MIN_SPEED_INDEX = 0;\n WWAConsts.MAX_SPEED_INDEX = exports.speedList.length - 1;\n WWAConsts.ANIMATION_REP_HALF_FRAME = 22;\n WWAConsts.PLAYER_LOOKING_AROUND_START_FRAME = WWAConsts.ANIMATION_REP_HALF_FRAME * 4;\n WWAConsts.RELATIVE_COORD_BIAS = 10000;\n WWAConsts.RELATIVE_COORD_LOWER = WWAConsts.RELATIVE_COORD_BIAS - 1000;\n WWAConsts.PLAYER_COORD = WWAConsts.RELATIVE_COORD_BIAS - 1000;\n WWAConsts.LOCALGATE_PLAYER_WAIT_FRAME = 5;\n WWAConsts.STATUS_CHANGED_EFFECT_FRAME_NUM = 20;\n WWAConsts.PASSABLE_OBJECT = 1;\n WWAConsts.APPERANCE_PARTS_MIN_INDEX = 0;\n WWAConsts.APPERANCE_PARTS_MAX_INDEX = 9;\n WWAConsts.APPERANCE_PARTS_MIN_INDEX_NO = 5;\n WWAConsts.APPERANCE_PARTS_MAX_INDEX_YES = 4;\n WWAConsts.FADEOUT_SPEED = 8;\n WWAConsts.STATUS_MINUS_BORDER = 30000;\n WWAConsts.ITEMBOX_IS_FULL = -1;\n WWAConsts.BATTLE_INTERVAL_FRAME_NUM = 10;\n WWAConsts.BATTLE_SPEED_CHANGE_TURN_NUM = 40;\n WWAConsts.RANDOM_MOVE_ITERATION_NUM = 50;\n WWAConsts.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31 = 8;\n WWAConsts.BATTLE_ESTIMATE_MONSTER_TYPE_MAX = 8;\n WWAConsts.SOUND_MAX = 100;\n WWAConsts.ITEM_BORDER_IMG_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAArklEQVRYR" +\n "+2Y0QqAIAxFt///aENJHwxxuJUSxzeh3S7HXaNpEkly4FIRzba0GEyHeVTN7jqDWvb7V4Y1NLibZIY0" +\n "NbiL5G3MZLCe / 1fn3XJgJYjB7mgg6O1VCEKwXo79JeklY62nB62kRs9BEIKkeNIDhISQEBJC4k0BB" +\n "CF4D7D4cV9shf99ixdB + MrM0y3fa3zV05D45GOqhwPMGPkYlccIOEY2VKUN0UNVXxC7ADj7mDi9aF" +\n "ZZAAAAAElFTkSuQmCC";\n WWAConsts.LOAD_STAGE_MAX_EXCEPT_AUDIO = 7;\n WWAConsts.WWA_STYLE_TAG_ID = "wwa-additional-style";\n WWAConsts.DEFAULT_FRAME_COLOR_R = 0xff;\n WWAConsts.DEFAULT_FRAME_COLOR_G = 0xff;\n WWAConsts.DEFAULT_FRAME_COLOR_B = 0xff;\n WWAConsts.DEFAULT_FRAMEOUT_COLOR_R = 0x60;\n WWAConsts.DEFAULT_FRAMEOUT_COLOR_G = 0x60;\n WWAConsts.DEFAULT_FRAMEOUT_COLOR_B = 0x60;\n WWAConsts.DEFAULT_STRBACK_COLOR_R = 0x0;\n WWAConsts.DEFAULT_STRBACK_COLOR_G = 0x0;\n WWAConsts.DEFAULT_STRBACK_COLOR_B = 0x0;\n WWAConsts.DEFAULT_STATUS_COLOR_R = 0x0;\n WWAConsts.DEFAULT_STATUS_COLOR_G = 0x0;\n WWAConsts.DEFAULT_STATUS_COLOR_B = 0x0;\n WWAConsts.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM = 20;\n WWAConsts.WWAP_SERVER_OLD = "http://wwawing.com/wwap";\n WWAConsts.WWAP_SERVER = "https://wwaphoenix.github.io";\n WWAConsts.WWAP_SERVER_AUDIO_DIR = "audio";\n WWAConsts.WWAP_SERVER_TITLE_IMG = "cover_p.gif";\n WWAConsts.WWAP_SERVER_LOADER_NO_WORKER = "wwaload.noworker.js";\n WWAConsts.SCREEN_WIDTH = 560;\n WWAConsts.SCREEN_HEIGHT = 440;\n WWAConsts.LOADING_FONT = "Times New Roman";\n WWAConsts.MSG_STR_WIDTH = 16;\n WWAConsts.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME = 20;\n WWAConsts.ITEMBOX_TOP_Y = 140;\n return WWAConsts;\n}());\nexports.WWAConsts = WWAConsts;\nvar LoaderResponse = (function () {\n function LoaderResponse() {\n }\n return LoaderResponse;\n}());\nexports.LoaderResponse = LoaderResponse;\nvar LoaderError = (function () {\n function LoaderError() {\n }\n return LoaderError;\n}());\nexports.LoaderError = LoaderError;\nvar LoaderProgress = (function () {\n function LoaderProgress() {\n }\n return LoaderProgress;\n}());\nexports.LoaderProgress = LoaderProgress;\nvar LoadStage;\n(function (LoadStage) {\n LoadStage[LoadStage["INIT"] = 0] = "INIT";\n LoadStage[LoadStage["MAP_LOAD"] = 1] = "MAP_LOAD";\n LoadStage[LoadStage["OBJ_LOAD"] = 2] = "OBJ_LOAD";\n LoadStage[LoadStage["MAP_ATTR"] = 3] = "MAP_ATTR";\n LoadStage[LoadStage["OBJ_ATTR"] = 4] = "OBJ_ATTR";\n LoadStage[LoadStage["RAND_PARTS"] = 5] = "RAND_PARTS";\n LoadStage[LoadStage["MESSAGE"] = 6] = "MESSAGE";\n LoadStage[LoadStage["GAME_INIT"] = 7] = "GAME_INIT";\n LoadStage[LoadStage["AUDIO"] = 8] = "AUDIO";\n LoadStage[LoadStage["FINISH"] = 9] = "FINISH";\n})(LoadStage = exports.LoadStage || (exports.LoadStage = {}));\nexports.loadMessages = [\n "ロードの準備をしています。",\n "背景パーツを読み込んでいます。",\n "物体パーツを読み込んでます。",\n "背景パーツの属性を読み込んでます。",\n "物体パーツの属性を読み込んでます。",\n "ランダムパーツを置換しています。",\n "メッセージを読み込んでます。",\n "Welcome to WWA Wing!"\n];\nexports.loadMessagesClassic = [\n "Welcome to WWA Wing!",\n "Now Map Data Loading .....",\n "Now CG Data Loading .....",\n "Now Making chara CG ....."\n];\nvar LoadingMessagePosition;\n(function (LoadingMessagePosition) {\n LoadingMessagePosition[LoadingMessagePosition["LINE"] = 30] = "LINE";\n LoadingMessagePosition[LoadingMessagePosition["TITLE_X"] = 100] = "TITLE_X";\n LoadingMessagePosition[LoadingMessagePosition["TITLE_Y"] = 70] = "TITLE_Y";\n LoadingMessagePosition[LoadingMessagePosition["LOADING_X"] = 50] = "LOADING_X";\n LoadingMessagePosition[LoadingMessagePosition["LOADING_Y"] = 140] = "LOADING_Y";\n LoadingMessagePosition[LoadingMessagePosition["ERROR_X"] = 10] = "ERROR_X";\n LoadingMessagePosition[LoadingMessagePosition["ERROR_Y"] = 180] = "ERROR_Y";\n LoadingMessagePosition[LoadingMessagePosition["FOOTER_X"] = 160] = "FOOTER_X";\n LoadingMessagePosition[LoadingMessagePosition["FOOTER_Y"] = 360] = "FOOTER_Y";\n LoadingMessagePosition[LoadingMessagePosition["WORLD_Y"] = 330] = "WORLD_Y";\n LoadingMessagePosition[LoadingMessagePosition["COPYRIGHT_Y"] = 390] = "COPYRIGHT_Y";\n})(LoadingMessagePosition = exports.LoadingMessagePosition || (exports.LoadingMessagePosition = {}));\nvar LoadingMessageSize;\n(function (LoadingMessageSize) {\n LoadingMessageSize[LoadingMessageSize["TITLE"] = 32] = "TITLE";\n LoadingMessageSize[LoadingMessageSize["LOADING"] = 22] = "LOADING";\n LoadingMessageSize[LoadingMessageSize["FOOTER"] = 18] = "FOOTER";\n LoadingMessageSize[LoadingMessageSize["ERRROR"] = 16] = "ERRROR";\n})(LoadingMessageSize = exports.LoadingMessageSize || (exports.LoadingMessageSize = {}));\nvar ChangeStyleType;\n(function (ChangeStyleType) {\n ChangeStyleType[ChangeStyleType["COLOR_FRAME"] = 0] = "COLOR_FRAME";\n ChangeStyleType[ChangeStyleType["COLOR_FRAMEOUT"] = 1] = "COLOR_FRAMEOUT";\n ChangeStyleType[ChangeStyleType["COLOR_STR"] = 2] = "COLOR_STR";\n ChangeStyleType[ChangeStyleType["COLOR_STATUS_STR"] = 4] = "COLOR_STATUS_STR";\n})(ChangeStyleType = exports.ChangeStyleType || (exports.ChangeStyleType = {}));\n;\nvar SelectorType;\n(function (SelectorType) {\n SelectorType[SelectorType["MESSAGE_WINDOW"] = 0] = "MESSAGE_WINDOW";\n SelectorType[SelectorType["SIDEBAR"] = 1] = "SIDEBAR";\n})(SelectorType = exports.SelectorType || (exports.SelectorType = {}));\n;\nvar WWAData = (function () {\n function WWAData() {\n this.version = void 0;\n this.gameoverX = void 0;\n this.gameoverY = void 0;\n this.playerX = void 0;\n this.playerY = void 0;\n this.mapPartsMax = void 0;\n this.objPartsMax = void 0;\n this.isOldMap = void 0;\n this.statusEnergyMax = void 0;\n this.statusEnergy = void 0;\n this.statusStrength = void 0;\n this.statusDefence = void 0;\n this.statusGold = void 0;\n this.itemBox = void 0;\n this.mapWidth = void 0;\n this.messageNum = void 0;\n this.map = void 0;\n this.mapObject = void 0;\n this.mapCompressed = void 0;\n this.mapObjectCompressed = void 0;\n this.mapAttribute = void 0;\n this.objectAttribute = void 0;\n this.worldPassword = void 0;\n this.message = void 0;\n this.worldName = void 0;\n this.worldPassNumber = void 0;\n this.charCGName = void 0;\n this.mapCGName = void 0;\n this.systemMessage = void 0;\n this.moves = void 0;\n this.yesnoImgPosX = void 0;\n this.yesnoImgPosY = void 0;\n this.playerImgPosX = void 0;\n this.playerImgPosY = void 0;\n this.clickableItemSignImgPosX = void 0;\n this.clickableItemSignImgPosY = void 0;\n this.disableSaveFlag = void 0;\n this.compatibleForOldMapFlag = void 0;\n this.objectNoCollapseDefaultFlag = void 0;\n this.delPlayerFlag = void 0;\n this.bgm = void 0;\n this.imgClickX = void 0;\n this.imgClickY = void 0;\n this.frameColorR = void 0;\n this.frameColorG = void 0;\n this.frameColorB = void 0;\n this.frameOutColorR = void 0;\n this.frameOutColorG = void 0;\n this.frameOutColorB = void 0;\n this.fontColorR = void 0;\n this.fontColorG = void 0;\n this.fontColorB = void 0;\n this.statusColorR = void 0;\n this.statusColorG = void 0;\n this.statusColorB = void 0;\n this.checkOriginalMapString = void 0;\n this.checkString = void 0;\n this.isItemEffectEnabled = void 0;\n }\n return WWAData;\n}());\nexports.WWAData = WWAData;\n\n\n//# sourceURL=webpack:///./src/wwa_data.ts?')},"./src/wwa_estimate_battle.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar EstimateDisplayElements = (function () {\n function EstimateDisplayElements(id, imgFileName, parent) {\n this.id = id;\n this.imgFileName = imgFileName;\n this.parent = parent;\n this.elem = document.createElement("div");\n this.elem.classList.add("est");\n this.elem.setAttribute("id", "wwa-est-" + id);\n this.imgElem = document.createElement("div");\n this.imgElem.classList.add("est-img-wrapper");\n this.imgElem.style.backgroundImage = "url(" + this.imgFileName.replace("(", "\\\\(").replace(")", "\\\\)") + ")";\n this.statusElem = document.createElement("div");\n this.statusElem.classList.add("est-status-wrapper");\n this.energyElem = document.createElement("div");\n this.energyElem.classList.add("est-energy");\n this.energyDispElem = document.createElement("span");\n this.energyDispElem.classList.add("est-energy-disp");\n this.energyElem.appendChild(this.energyDispElem);\n this.statusElem.appendChild(this.energyElem);\n this.strengthElem = document.createElement("div");\n this.strengthElem.classList.add("est-strength");\n this.strengthDispElem = document.createElement("span");\n this.strengthDispElem.classList.add("est-strength-disp");\n this.strengthElem.appendChild(this.strengthDispElem);\n this.statusElem.appendChild(this.strengthElem);\n this.defenceElem = document.createElement("div");\n this.defenceElem.classList.add("est-defence");\n this.defenceDispElem = document.createElement("span");\n this.defenceDispElem.classList.add("est-defence-disp");\n this.defenceElem.appendChild(this.defenceDispElem);\n this.statusElem.appendChild(this.defenceElem);\n this.damageElem = document.createElement("div");\n this.damageElem.classList.add("est-damage");\n this.damageDispElem = document.createElement("span");\n this.damageDispElem.classList.add("est-damage-disp");\n this.damageElem.appendChild(this.damageDispElem);\n this.statusElem.appendChild(this.damageElem);\n this.elem.appendChild(this.imgElem);\n this.elem.appendChild(this.statusElem);\n }\n EstimateDisplayElements.prototype.hide = function () {\n this.elem.style.display = "none";\n };\n EstimateDisplayElements.prototype.show = function () {\n this.elem.style.display = "block";\n };\n EstimateDisplayElements.prototype.setResult = function (enemyImgPos, enemyStatus, result) {\n this.imgElem.style.backgroundPosition = "-" + enemyImgPos.x + "px -" + enemyImgPos.y + "px";\n this.energyDispElem.textContent = "生命力 " + enemyStatus.energy;\n this.strengthDispElem.textContent = "攻撃力 " + enemyStatus.strength;\n this.defenceDispElem.textContent = "防御力 " + enemyStatus.defence;\n if (result.isNoEffect) {\n this.damageDispElem.textContent = "攻撃無効";\n }\n else if (result.isOverMaxTurn) {\n this.damageDispElem.textContent = "長期戦が予想されます";\n }\n else {\n this.damageDispElem.textContent = "予測ダメージ " + result.damage;\n }\n };\n return EstimateDisplayElements;\n}());\nvar BattleEstimateWindow = (function () {\n function BattleEstimateWindow(_wwa, _imgFileName, _parent) {\n var _this = this;\n this._wwa = _wwa;\n this._imgFileName = _imgFileName;\n this._parent = _parent;\n var ede;\n this._element = document.createElement("div");\n this._element.setAttribute("id", "wwa-battle-estimate");\n this._element.style.display = "none";\n this._edes = [];\n for (var i = 0; i < wwa_data_1.WWAConsts.BATTLE_ESTIMATE_MONSTER_TYPE_MAX; i++) {\n ede = new EstimateDisplayElements(i, this._imgFileName, this._element);\n this._edes.push(ede);\n this._element.appendChild(ede.elem);\n }\n this._element.addEventListener("click", function () {\n _this._wwa.hideBattleEstimateWindow();\n });\n this._parent.appendChild(this._element);\n }\n BattleEstimateWindow.prototype.update = function (playerStatus, monsters) {\n for (var i = 0; i < wwa_data_1.WWAConsts.BATTLE_ESTIMATE_MONSTER_TYPE_MAX; i++) {\n if (i >= monsters.length) {\n this._edes[i].hide();\n continue;\n }\n var imgx = this._wwa.getObjectAttributeById(monsters[i], wwa_data_1.WWAConsts.ATR_X);\n var imgy = this._wwa.getObjectAttributeById(monsters[i], wwa_data_1.WWAConsts.ATR_Y);\n var imgPos = new wwa_data_1.Coord(imgx, imgy);\n var eng = this._wwa.getObjectAttributeById(monsters[i], wwa_data_1.WWAConsts.ATR_ENERGY);\n var str = this._wwa.getObjectAttributeById(monsters[i], wwa_data_1.WWAConsts.ATR_STRENGTH);\n var def = this._wwa.getObjectAttributeById(monsters[i], wwa_data_1.WWAConsts.ATR_DEFENCE);\n var enemyStatus = new wwa_data_1.Status(eng, str, def, 0);\n var result = calc(playerStatus, enemyStatus);\n this._edes[i].setResult(imgPos, enemyStatus, result);\n this._edes[i].show();\n }\n };\n BattleEstimateWindow.prototype.show = function () {\n this._element.style.display = "block";\n };\n BattleEstimateWindow.prototype.hide = function () {\n this._element.style.display = "none";\n };\n return BattleEstimateWindow;\n}());\nexports.BattleEstimateWindow = BattleEstimateWindow;\nvar EstimateResult = (function () {\n function EstimateResult(isNoEffect, isOverMaxTurn, damage) {\n this.isNoEffect = isNoEffect;\n this.isOverMaxTurn = isOverMaxTurn;\n this.damage = damage;\n }\n return EstimateResult;\n}());\nfunction calc(playerStatus, enemyStatus) {\n var energyE = enemyStatus.energy;\n var attackP = playerStatus.strength - enemyStatus.defence;\n var attackE = Math.max(0, enemyStatus.strength - playerStatus.defence);\n var turn = 0;\n var damage = 0;\n if (attackP > 0) {\n while (1) {\n turn++;\n energyE -= attackP;\n if (energyE <= 0) {\n return new EstimateResult(false, false, damage);\n }\n damage += attackE;\n if (turn > 10000) {\n return new EstimateResult(false, true, 0);\n }\n }\n }\n else {\n return new EstimateResult(true, false, 0);\n }\n}\n\n\n//# sourceURL=webpack:///./src/wwa_estimate_battle.ts?')},"./src/wwa_inject_html.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar util = __webpack_require__("./src/wwa_util.ts");\nvar inject_html = " <canvas id=\\"wwa-map\\" class=\\"wwa-canvas\\" width=\\"440\\" height=\\"440\\"> このブラウザは、Canvas要素をサポートしていません。 </canvas> <canvas id=\\"wwa-map-sub\\" class=\\"wwa-canvas\\" width=\\"440\\" height=\\"440\\"></canvas> <div id=\\"wwa-sidebar\\"> <div class=\\"wide-cell-row\\" id=\\"disp-energy\\"><div class=\\"status-icon\\"></div><div class=\\"status-value-box\\">0</div></div> <div class=\\"wide-cell-row\\" id=\\"disp-strength\\"><div class=\\"status-icon\\"></div><div class=\\"status-value-box\\"> 0 </div></div> <div class=\\"wide-cell-row\\" id=\\"disp-defence\\"><div class=\\"status-icon\\"></div><div class=\\"status-value-box\\">0</div></div> <div class=\\"wide-cell-row\\" id=\\"disp-gold\\"><div class=\\"status-icon\\"></div><div class=\\"status-value-box\\">0</div></div> <div class=\\"item-cell\\" id=\\"item0\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item1\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item2\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item3\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item4\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item5\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item6\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item7\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item8\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item9\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item10\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item11\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"wide-cell-row\\" id=\\"cell-load\\">Password</div><div class=\\"wide-button\\" id=\\"button-load\\"></div> <div class=\\"wide-cell-row\\" id=\\"cell-save\\">Quick Save</div><div class=\\"wide-button\\" id=\\"button-save\\"></div> <div class=\\"wide-cell-row\\" id=\\"cell-restart\\">Restart Game</div><div class=\\"wide-button\\" id=\\"button-restart\\"></div> <div class=\\"wide-cell-row\\" id=\\"cell-gotowwa\\">Goto WWA</div><div class=\\"wide-button\\" id=\\"button-gotowwa\\"></div> </div> <div id=\\"wwa-controller\\"></div> <div id=\\"wwa-fader\\"></div> <div id=\\"wwa-cover\\"> <div id=\\"version\\"></div> <div id=\\"progress-message-container\\">開始しています...</div> <div id=\\"progress-bar-bg\\"></div> <div id=\\"progress-bar\\" class=\\"progress-bar\\"></div> <div id=\\"progress-bar-audio\\" class=\\"progress-bar\\"></div> <div id=\\"progress-disp\\">---</div> </div> <div id=\\"wwa-audio-wrapper\\"></div> ";\nvar inject_html_no_img = " <canvas id=\\"wwa-map\\" class=\\"wwa-canvas\\" width=\\"440\\" height=\\"440\\"> このブラウザは、Canvas要素をサポートしていません。 </canvas> <canvas id=\\"wwa-map-sub\\" class=\\"wwa-canvas\\" width=\\"440\\" height=\\"440\\"></canvas> <div id=\\"wwa-sidebar\\"> <div class=\\"wide-cell-row\\" id=\\"disp-energy\\"><div class=\\"status-icon\\"></div><div class=\\"status-value-box\\">0</div></div> <div class=\\"wide-cell-row\\" id=\\"disp-strength\\"><div class=\\"status-icon\\"></div><div class=\\"status-value-box\\"> 0 </div></div> <div class=\\"wide-cell-row\\" id=\\"disp-defence\\"><div class=\\"status-icon\\"></div><div class=\\"status-value-box\\">0</div></div> <div class=\\"wide-cell-row\\" id=\\"disp-gold\\"><div class=\\"status-icon\\"></div><div class=\\"status-value-box\\">0</div></div> <div class=\\"item-cell\\" id=\\"item0\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item1\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item2\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item3\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item4\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item5\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item6\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item7\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item8\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item9\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item10\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"item-cell\\" id=\\"item11\\"><div class=\\"item-click-border\\"></div><div class=\\"item-disp\\"></div></div> <div class=\\"wide-cell-row\\" id=\\"cell-load\\">Password</div><div class=\\"wide-button\\" id=\\"button-load\\"></div> <div class=\\"wide-cell-row\\" id=\\"cell-save\\">Quick Save</div><div class=\\"wide-button\\" id=\\"button-save\\"></div> <div class=\\"wide-cell-row\\" id=\\"cell-restart\\">Restart Game</div><div class=\\"wide-button\\" id=\\"button-restart\\"></div> <div class=\\"wide-cell-row\\" id=\\"cell-gotowwa\\">Goto WWA</div><div class=\\"wide-button\\" id=\\"button-gotowwa\\"></div> </div> <div id=\\"wwa-controller\\"></div> <div id=\\"wwa-fader\\"></div> <div id=\\"wwa-cover\\"></div> <div id=\\"wwa-audio-wrapper\\"></div> ";\nfunction inject(parent, titleImgName) {\n var style = document.createElement("style");\n style.type = "text/css";\n style.setAttribute("id", wwa_data_1.WWAConsts.WWA_STYLE_TAG_ID);\n util.$tag("head")[0].appendChild(style);\n if (titleImgName === null) {\n parent.innerHTML = inject_html_no_img;\n var canvas = document.createElement("canvas");\n canvas.height = wwa_data_1.WWAConsts.SCREEN_HEIGHT;\n canvas.width = wwa_data_1.WWAConsts.SCREEN_WIDTH;\n canvas.id = "progress-panel";\n util.$id("wwa-cover").appendChild(canvas);\n }\n else {\n parent.innerHTML = inject_html;\n var img = document.createElement("img");\n img.src = titleImgName;\n util.$id("wwa-cover").appendChild(img);\n }\n}\nexports.inject = inject;\n\n\n//# sourceURL=webpack:///./src/wwa_inject_html.ts?')},"./src/wwa_input.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar KeyState;\n(function (KeyState) {\n KeyState[KeyState["NONE"] = 0] = "NONE";\n KeyState[KeyState["KEYDOWN"] = 1] = "KEYDOWN";\n KeyState[KeyState["KEYPRESS"] = 2] = "KEYPRESS";\n KeyState[KeyState["KEYUP"] = 3] = "KEYUP";\n KeyState[KeyState["KEYPRESS_MESSAGECHANGE"] = 4] = "KEYPRESS_MESSAGECHANGE";\n})(KeyState = exports.KeyState || (exports.KeyState = {}));\nvar KeyCode;\n(function (KeyCode) {\n KeyCode[KeyCode["KEY_ENTER"] = 13] = "KEY_ENTER";\n KeyCode[KeyCode["KEY_SHIFT"] = 16] = "KEY_SHIFT";\n KeyCode[KeyCode["KEY_ESC"] = 27] = "KEY_ESC";\n KeyCode[KeyCode["KEY_SPACE"] = 32] = "KEY_SPACE";\n KeyCode[KeyCode["KEY_LEFT"] = 37] = "KEY_LEFT";\n KeyCode[KeyCode["KEY_UP"] = 38] = "KEY_UP";\n KeyCode[KeyCode["KEY_RIGHT"] = 39] = "KEY_RIGHT";\n KeyCode[KeyCode["KEY_DOWN"] = 40] = "KEY_DOWN";\n KeyCode[KeyCode["KEY_1"] = 49] = "KEY_1";\n KeyCode[KeyCode["KEY_2"] = 50] = "KEY_2";\n KeyCode[KeyCode["KEY_3"] = 51] = "KEY_3";\n KeyCode[KeyCode["KEY_A"] = 65] = "KEY_A";\n KeyCode[KeyCode["KEY_C"] = 67] = "KEY_C";\n KeyCode[KeyCode["KEY_D"] = 68] = "KEY_D";\n KeyCode[KeyCode["KEY_E"] = 69] = "KEY_E";\n KeyCode[KeyCode["KEY_I"] = 73] = "KEY_I";\n KeyCode[KeyCode["KEY_M"] = 77] = "KEY_M";\n KeyCode[KeyCode["KEY_N"] = 78] = "KEY_N";\n KeyCode[KeyCode["KEY_P"] = 80] = "KEY_P";\n KeyCode[KeyCode["KEY_Q"] = 81] = "KEY_Q";\n KeyCode[KeyCode["KEY_S"] = 83] = "KEY_S";\n KeyCode[KeyCode["KEY_W"] = 87] = "KEY_W";\n KeyCode[KeyCode["KEY_X"] = 88] = "KEY_X";\n KeyCode[KeyCode["KEY_Y"] = 89] = "KEY_Y";\n KeyCode[KeyCode["KEY_Z"] = 90] = "KEY_Z";\n KeyCode[KeyCode["KEY_F1"] = 112] = "KEY_F1";\n KeyCode[KeyCode["KEY_F2"] = 113] = "KEY_F2";\n KeyCode[KeyCode["KEY_F3"] = 114] = "KEY_F3";\n KeyCode[KeyCode["KEY_F4"] = 115] = "KEY_F4";\n KeyCode[KeyCode["KEY_F5"] = 116] = "KEY_F5";\n KeyCode[KeyCode["KEY_F6"] = 117] = "KEY_F6";\n KeyCode[KeyCode["KEY_F7"] = 118] = "KEY_F7";\n KeyCode[KeyCode["KEY_F8"] = 119] = "KEY_F8";\n KeyCode[KeyCode["KEY_F12"] = 123] = "KEY_F12";\n})(KeyCode = exports.KeyCode || (exports.KeyCode = {}));\nvar KeyStore = (function () {\n function KeyStore() {\n var i;\n this._nextKeyState = new Array(KeyStore.KEY_BUFFER_MAX);\n this._keyState = new Array(KeyStore.KEY_BUFFER_MAX);\n this._prevKeyState = new Array(KeyStore.KEY_BUFFER_MAX);\n this._prevKeyStateOnControllable = new Array(KeyStore.KEY_BUFFER_MAX);\n this._keyInputContinueFrameNum = new Array(KeyStore.KEY_BUFFER_MAX);\n for (i = 0; i < KeyStore.KEY_BUFFER_MAX; i++) {\n this._nextKeyState[i] = false;\n this._keyState[i] = false;\n this._prevKeyState[i] = false;\n this._prevKeyStateOnControllable[i] = false;\n this._keyInputContinueFrameNum[i] = 0;\n }\n }\n KeyStore.prototype.checkHitKey = function (keyCode) {\n var s = this.getKeyState(keyCode);\n return (s === KeyState.KEYDOWN || s === KeyState.KEYPRESS);\n };\n KeyStore.prototype.getKeyState = function (keyCode) {\n if (this._prevKeyState[keyCode]) {\n if (this._keyState[keyCode]) {\n return KeyState.KEYPRESS;\n }\n return KeyState.KEYUP;\n }\n else {\n if (this._keyState[keyCode]) {\n return KeyState.KEYDOWN;\n }\n return KeyState.NONE;\n }\n };\n KeyStore.prototype.getKeyStateForControllPlayer = function (keyCode) {\n if (this._prevKeyStateOnControllable[keyCode]) {\n if (this._keyState[keyCode]) {\n return KeyState.KEYPRESS;\n }\n return KeyState.KEYUP;\n }\n else {\n if (this._keyState[keyCode]) {\n return KeyState.KEYDOWN;\n }\n return KeyState.NONE;\n }\n };\n KeyStore.prototype.getKeyStateForMessageCheck = function (keyCode) {\n if (this._prevKeyState[keyCode]) {\n if (this._keyState[keyCode]) {\n return (this._keyInputContinueFrameNum[keyCode] >=\n wwa_data_1.WWAConsts.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM ?\n KeyState.KEYPRESS_MESSAGECHANGE : KeyState.KEYPRESS);\n }\n return KeyState.KEYUP;\n }\n else {\n if (this._keyState[keyCode]) {\n return KeyState.KEYDOWN;\n }\n return KeyState.NONE;\n }\n };\n KeyStore.prototype.setPressInfo = function (keyCode) {\n this._nextKeyState[keyCode] = true;\n this._keyInputContinueFrameNum[keyCode] = -1;\n };\n KeyStore.prototype.setReleaseInfo = function (keyCode) {\n this._nextKeyState[keyCode] = false;\n this._keyInputContinueFrameNum[keyCode] = -1;\n };\n KeyStore.prototype.update = function () {\n var i;\n this._prevKeyState = this._keyState.slice();\n this._keyState = this._nextKeyState.slice();\n for (i = 0; i < KeyStore.KEY_BUFFER_MAX; i++) {\n if (this._keyState[i]) {\n this._keyInputContinueFrameNum[i]++;\n }\n }\n };\n KeyStore.prototype.memorizeKeyStateOnControllableFrame = function () {\n this._prevKeyStateOnControllable = this._keyState.slice();\n };\n KeyStore.prototype.allClear = function () {\n var i;\n this._nextKeyState = new Array(KeyStore.KEY_BUFFER_MAX);\n for (i = 0; i < KeyStore.KEY_BUFFER_MAX; i++) {\n this._nextKeyState[i] = false;\n }\n };\n KeyStore.KEY_BUFFER_MAX = 256;\n return KeyStore;\n}());\nexports.KeyStore = KeyStore;\nvar MouseState;\n(function (MouseState) {\n MouseState[MouseState["NONE"] = 0] = "NONE";\n MouseState[MouseState["MOUSEDOWN"] = 1] = "MOUSEDOWN";\n MouseState[MouseState["MOUSEPRESS"] = 2] = "MOUSEPRESS";\n MouseState[MouseState["MOUSEUP"] = 3] = "MOUSEUP";\n})(MouseState = exports.MouseState || (exports.MouseState = {}));\nvar MouseStore = (function () {\n function MouseStore() {\n this._prevMouseState = false;\n this._mouseState = false;\n this._nextMouseState = false;\n }\n MouseStore.prototype.checkClickMouse = function (dir) {\n var s;\n if (dir !== void 0) {\n s = this.getMouseState(dir);\n }\n else {\n s = this.getMouseState();\n }\n return (s === MouseState.MOUSEDOWN || s === MouseState.MOUSEPRESS);\n };\n MouseStore.prototype.getMouseState = function (dir) {\n if (dir !== void 0) {\n if (this._inputDir !== dir) {\n return MouseState.NONE;\n }\n }\n if (this._prevMouseState) {\n if (this._mouseState) {\n return MouseState.MOUSEPRESS;\n }\n return MouseState.MOUSEUP;\n }\n else {\n if (this._mouseState) {\n return MouseState.MOUSEDOWN;\n }\n return MouseState.NONE;\n }\n };\n MouseStore.prototype.getMouseStateForControllPlayer = function (dir) {\n if (dir !== void 0) {\n if (this._inputDir !== dir) {\n return MouseState.NONE;\n }\n }\n if (this._prevMouseStateOnControllable) {\n if (this._mouseState) {\n return MouseState.MOUSEPRESS;\n }\n return MouseState.MOUSEUP;\n }\n else {\n if (this._mouseState) {\n return MouseState.MOUSEDOWN;\n }\n return MouseState.NONE;\n }\n };\n MouseStore.prototype.setPressInfo = function (dir, touchID) {\n this._nextMouseState = true;\n this._inputDir = dir;\n this._touchID = touchID;\n };\n MouseStore.prototype.setReleaseInfo = function () {\n this._touchID = void 0;\n this._nextMouseState = false;\n };\n MouseStore.prototype.memorizeMouseStateOnControllableFrame = function () {\n this._prevMouseStateOnControllable = this._mouseState;\n };\n MouseStore.prototype.update = function () {\n this._prevMouseState = this._mouseState;\n this._mouseState = this._nextMouseState;\n };\n MouseStore.prototype.clear = function () {\n this._nextMouseState = false;\n };\n MouseStore.prototype.getTouchID = function () {\n return this._touchID;\n };\n return MouseStore;\n}());\nexports.MouseStore = MouseStore;\n\n\n//# sourceURL=webpack:///./src/wwa_input.ts?')},"./src/wwa_main.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar wwa_input_1 = __webpack_require__("./src/wwa_input.ts");\nvar util = __webpack_require__("./src/wwa_util.ts");\nvar wwa_cgmanager_1 = __webpack_require__("./src/wwa_cgmanager.ts");\nvar wwa_camera_1 = __webpack_require__("./src/wwa_camera.ts");\nvar wwa_parts_player_1 = __webpack_require__("./src/wwa_parts_player.ts");\nvar wwa_monster_1 = __webpack_require__("./src/wwa_monster.ts");\nvar wwa_motion_1 = __webpack_require__("./src/wwa_motion.ts");\nvar wwa_message_1 = __webpack_require__("./src/wwa_message.ts");\nvar wwa_estimate_battle_1 = __webpack_require__("./src/wwa_estimate_battle.ts");\nvar wwa_password_window_1 = __webpack_require__("./src/wwa_password_window.ts");\nvar wwa_inject_html_1 = __webpack_require__("./src/wwa_inject_html.ts");\nvar wwa;\nvar wwap_mode = false;\nfunction getProgress(current, total, stage) {\n var progress = new wwa_data_1.LoaderProgress();\n progress.current = current;\n progress.total = total;\n progress.stage = stage;\n return progress;\n}\nexports.getProgress = getProgress;\nvar WWA = (function () {\n function WWA(mapFileName, workerFileName, urlgateEnabled, titleImgName, classicModeEnabled, itemEffectEnabled, audioDirectory) {\n if (urlgateEnabled === void 0) { urlgateEnabled = false; }\n if (audioDirectory === void 0) { audioDirectory = ""; }\n var _this = this;\n var ctxCover;\n window.addEventListener("click", function (e) {\n _this._isActive = false;\n });\n util.$id("wwa-wrapper").addEventListener("click", function (e) {\n e.stopPropagation();\n _this._isActive = true;\n });\n this._isActive = true;\n if (titleImgName === null) {\n this._hasTitleImg = false;\n this._cvsCover = util.$id("progress-panel");\n ctxCover = this._cvsCover.getContext("2d");\n ctxCover.fillStyle = "rgb(0, 0, 0)";\n }\n else {\n this._hasTitleImg = true;\n }\n try {\n if (this._hasTitleImg) {\n util.$id("version").textContent = "WWA Wing Ver." + "3.1.8";\n }\n else {\n this._setLoadingMessage(ctxCover, 0);\n }\n }\n catch (e) { }\n this._isURLGateEnable = urlgateEnabled;\n this._isClassicModeEnable = classicModeEnabled;\n this._mainCallCounter = 0;\n this._animationCounter = 0;\n this._statusPressCounter = new wwa_data_1.Status(0, 0, 0, 0);\n if (!audioDirectory) {\n audioDirectory = "./audio/";\n }\n else if (audioDirectory[audioDirectory.length - 1] !== "/") {\n audioDirectory += "/";\n }\n this._audioDirectory = audioDirectory;\n var t_start = new Date().getTime();\n var isLocal = !!location.href.match(/^file/);\n if (isLocal) {\n alert("【警告】直接HTMLファイルを開いているようです。\\n" +\n "このプログラムは正常に動作しない可能性があります。\\n" +\n "マップデータの確認を行う場合には同梱の「WWA Debugger」をご利用ください。");\n }\n if (window["audiojs"] === void 0) {\n this._setErrorMessage("Audio.jsのロードに失敗しました。\\n" +\n "フォルダ" + this._audioDirectory + "の中にaudio.min.jsは配置されていますか? \\n" +\n "フォルダを変更される場合には data-wwa-audio-dir 属性を\\n" +\n "指定してください", ctxCover);\n return;\n }\n this._loadHandler = function (e) {\n if (e.data.error !== null && e.data.error !== void 0) {\n _this._setErrorMessage("下記のエラーが発生しました。: \\n" + e.data.error.message, ctxCover);\n return;\n }\n if (e.data.progress !== null && e.data.progress !== void 0) {\n _this._setProgressBar(e.data.progress);\n return;\n }\n _this._wwaData = e.data.wwaData;\n _this._wwaData.isItemEffectEnabled = itemEffectEnabled;\n try {\n if (_this._hasTitleImg) {\n util.$id("version").textContent += (" (Map data Ver. "\n + Math.floor(_this._wwaData.version / 10) + "." +\n +_this._wwaData.version % 10 + ")");\n }\n else {\n _this._setLoadingMessage(ctxCover, 1);\n }\n }\n catch (e) { }\n _this.initCSSRule();\n _this._setProgressBar(getProgress(0, 4, wwa_data_1.LoadStage.GAME_INIT));\n _this._setLoadingMessage(ctxCover, 2);\n var cgFile = new Image();\n cgFile.src = _this._wwaData.mapCGName;\n cgFile.addEventListener("error", function () {\n _this._setErrorMessage("画像ファイル「" + _this._wwaData.mapCGName + "」が見つかりませんでした。\\n" +\n "管理者の方へ: データがアップロードされているか、\\n" +\n "パーミッションを確かめてください。", ctxCover);\n });\n _this._restartData = JSON.parse(JSON.stringify(_this._wwaData));\n var escapedFilename = _this._wwaData.mapCGName.replace("(", "\\\\(").replace(")", "\\\\)");\n Array.prototype.forEach.call(util.$qsAll("div.item-cell"), function (node) {\n node.style.backgroundPosition = "-40px -80px";\n node.style.backgroundImage = "url(" + escapedFilename + ")";\n });\n Array.prototype.forEach.call(util.$qsAll("div.wide-cell-row"), function (node) {\n node.style.backgroundPosition = "-160px -120px";\n node.style.backgroundImage = "url(" + escapedFilename + ")";\n });\n Array.prototype.forEach.call(util.$qsAll(".item-cell>.item-click-border"), function (node) {\n node.style.backgroundImage = "url(\'" + wwa_data_1.WWAConsts.ITEM_BORDER_IMG_DATA_URL + "\')";\n node.style.backgroundPosition = "0 0";\n node.style.display = "none";\n node.style.cursor = "pointer";\n });\n Array.prototype.forEach.call(util.$qsAll(".item-cell>.item-disp"), function (node) {\n node.style.backgroundImage = "url(" + escapedFilename + ")";\n });\n var iconNode_energy = util.$qsh("#disp-energy>.status-icon");\n iconNode_energy.style.backgroundPosition = "-120px -80px";\n iconNode_energy.style.backgroundImage = "url(" + escapedFilename + ")";\n var iconNode_strength = util.$qsh("#disp-strength>.status-icon");\n iconNode_strength.style.backgroundPosition = "-160px -80px";\n iconNode_strength.style.backgroundImage = "url(" + escapedFilename + ")";\n var iconNode_defence = util.$qsh("#disp-defence>.status-icon");\n iconNode_defence.style.backgroundPosition = "-200px -80px";\n iconNode_defence.style.backgroundImage = "url(" + escapedFilename + ")";\n var iconNode_gold = util.$qsh("#disp-gold>.status-icon");\n iconNode_gold.style.backgroundPosition = "-240px -80px";\n iconNode_gold.style.backgroundImage = "url(" + escapedFilename + ")";\n _this._setProgressBar(getProgress(1, 4, wwa_data_1.LoadStage.GAME_INIT));\n _this._setLoadingMessage(ctxCover, 3);\n _this._replaceAllRandomObjects();\n var t_end = new Date().getTime();\n console.log("Loading Complete!" + (t_end - t_start) + "ms");\n _this._cvs = util.$id("wwa-map");\n _this._cvsSub = util.$id("wwa-map-sub");\n var ctx = _this._cvs.getContext("2d");\n var ctxSub = _this._cvsSub.getContext("2d");\n ctx.fillStyle = "rgba( 255, 255, 255, 0.5)";\n ctx.fillRect(0, 0, 440, 440);\n var playerPosition = new wwa_data_1.Position(_this, _this._wwaData.playerX, _this._wwaData.playerY);\n _this._camera = new wwa_camera_1.Camera(playerPosition);\n var status = new wwa_data_1.Status(_this._wwaData.statusEnergy, _this._wwaData.statusStrength, _this._wwaData.statusDefence, _this._wwaData.statusGold);\n _this._player = new wwa_parts_player_1.Player(_this, playerPosition, _this._camera, status, _this._wwaData.statusEnergyMax);\n _this._objectMovingDataManager = new wwa_motion_1.ObjectMovingDataManager(_this, _this._player);\n _this._camera.setPlayer(_this._player);\n _this._keyStore = new wwa_input_1.KeyStore();\n _this._mouseStore = new wwa_input_1.MouseStore();\n _this._messageQueue = [];\n _this._yesNoJudge = wwa_data_1.YesNoState.UNSELECTED;\n _this._yesNoJudgeInNextFrame = wwa_data_1.YesNoState.UNSELECTED;\n _this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.NONE;\n _this._prevFrameEventExected = false;\n _this._lastMessage = new wwa_message_1.MessageInfo("", false, false, []);\n _this._execMacroListInNextFrame = [];\n _this._passwordLoadExecInNextFrame = false;\n _this._setProgressBar(getProgress(2, 4, wwa_data_1.LoadStage.GAME_INIT));\n _this._setLoadingMessage(ctxCover, 4);\n window.addEventListener("keydown", function (e) {\n if (!_this._isActive) {\n return;\n }\n _this._keyStore.setPressInfo(e.keyCode);\n if (e.keyCode === wwa_input_1.KeyCode.KEY_F5) {\n e.preventDefault();\n return;\n }\n if (!_this._player.isWaitingMessage()) {\n if (!_this._player.isWaitingPasswordWindow()) {\n if (e.keyCode === wwa_input_1.KeyCode.KEY_DOWN ||\n e.keyCode === wwa_input_1.KeyCode.KEY_LEFT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_RIGHT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_UP ||\n e.keyCode === wwa_input_1.KeyCode.KEY_SHIFT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_ENTER ||\n e.keyCode === wwa_input_1.KeyCode.KEY_1 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_2 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_3 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_A ||\n e.keyCode === wwa_input_1.KeyCode.KEY_C ||\n e.keyCode === wwa_input_1.KeyCode.KEY_D ||\n e.keyCode === wwa_input_1.KeyCode.KEY_E ||\n e.keyCode === wwa_input_1.KeyCode.KEY_M ||\n e.keyCode === wwa_input_1.KeyCode.KEY_N ||\n e.keyCode === wwa_input_1.KeyCode.KEY_Q ||\n e.keyCode === wwa_input_1.KeyCode.KEY_S ||\n e.keyCode === wwa_input_1.KeyCode.KEY_W ||\n e.keyCode === wwa_input_1.KeyCode.KEY_X ||\n e.keyCode === wwa_input_1.KeyCode.KEY_Y ||\n e.keyCode === wwa_input_1.KeyCode.KEY_Z ||\n e.keyCode === wwa_input_1.KeyCode.KEY_ESC ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F1 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F2 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F3 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F4 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F6 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F7 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F8 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F12 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_SPACE) {\n e.preventDefault();\n }\n }\n }\n else {\n if (e.keyCode === wwa_input_1.KeyCode.KEY_DOWN ||\n e.keyCode === wwa_input_1.KeyCode.KEY_LEFT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_RIGHT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_UP ||\n e.keyCode === wwa_input_1.KeyCode.KEY_SHIFT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_ENTER ||\n e.keyCode === wwa_input_1.KeyCode.KEY_ESC ||\n e.keyCode === wwa_input_1.KeyCode.KEY_SPACE) {\n e.preventDefault();\n }\n }\n });\n window.addEventListener("keyup", function (e) {\n if (!_this._isActive) {\n return;\n }\n _this._keyStore.setReleaseInfo(e.keyCode);\n if (e.keyCode === wwa_input_1.KeyCode.KEY_F5) {\n e.preventDefault();\n }\n else if (e.keyCode === wwa_input_1.KeyCode.KEY_DOWN ||\n e.keyCode === wwa_input_1.KeyCode.KEY_LEFT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_RIGHT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_UP ||\n e.keyCode === wwa_input_1.KeyCode.KEY_SHIFT ||\n e.keyCode === wwa_input_1.KeyCode.KEY_ENTER ||\n e.keyCode === wwa_input_1.KeyCode.KEY_1 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_2 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_3 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_A ||\n e.keyCode === wwa_input_1.KeyCode.KEY_C ||\n e.keyCode === wwa_input_1.KeyCode.KEY_D ||\n e.keyCode === wwa_input_1.KeyCode.KEY_E ||\n e.keyCode === wwa_input_1.KeyCode.KEY_M ||\n e.keyCode === wwa_input_1.KeyCode.KEY_N ||\n e.keyCode === wwa_input_1.KeyCode.KEY_Q ||\n e.keyCode === wwa_input_1.KeyCode.KEY_S ||\n e.keyCode === wwa_input_1.KeyCode.KEY_W ||\n e.keyCode === wwa_input_1.KeyCode.KEY_X ||\n e.keyCode === wwa_input_1.KeyCode.KEY_Y ||\n e.keyCode === wwa_input_1.KeyCode.KEY_Z ||\n e.keyCode === wwa_input_1.KeyCode.KEY_ESC ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F1 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F3 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F4 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F6 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F7 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F8 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_F12 ||\n e.keyCode === wwa_input_1.KeyCode.KEY_SPACE) {\n if (!_this._player.isWaitingMessage() && !_this._player.isWaitingPasswordWindow()) {\n e.preventDefault();\n }\n }\n });\n window.addEventListener("blur", function (e) {\n _this._keyStore.allClear();\n _this._mouseStore.clear();\n });\n window.addEventListener("contextmenu", function (e) {\n _this._keyStore.allClear();\n _this._mouseStore.clear();\n });\n window.addEventListener("help", function (e) {\n if (!_this._isActive) {\n return;\n }\n e.preventDefault();\n });\n _this._wwaWrapperElement = (util.$id("wwa-wrapper"));\n _this._mouseControllerElement = (util.$id("wwa-controller"));\n _this._mouseControllerElement.addEventListener("mousedown", function (e) {\n if (!_this._isActive) {\n return;\n }\n if (e.which === 1) {\n if (_this._mouseStore.getMouseState() !== wwa_input_1.MouseState.NONE) {\n e.preventDefault();\n return;\n }\n var mousePos = util.$localPos(e.clientX, e.clientY);\n var playerPos = _this._player.getDrawingCenterPosition();\n var dist = mousePos.substract(playerPos);\n var dx = Math.abs(dist.x);\n var dy = Math.abs(dist.y);\n var dir;\n if (dist.y > 0 && dy > dx) {\n dir = wwa_data_1.Direction.DOWN;\n }\n else if (dist.y < 0 && dy > dx) {\n dir = wwa_data_1.Direction.UP;\n }\n else if (dist.x > 0 && dy < dx) {\n dir = wwa_data_1.Direction.RIGHT;\n }\n else if (dist.x < 0 && dy < dx) {\n dir = wwa_data_1.Direction.LEFT;\n }\n _this._mouseStore.setPressInfo(dir);\n e.preventDefault();\n }\n });\n _this._mouseControllerElement.addEventListener("mouseleave", function (e) {\n _this._mouseStore.clear();\n });\n _this._mouseControllerElement.addEventListener("mouseup", function (e) {\n if (!_this._isActive) {\n return;\n }\n if (e.which === 1) {\n _this._mouseStore.setReleaseInfo();\n e.preventDefault();\n }\n });\n if (window["TouchEvent"]) {\n _this._mouseControllerElement.addEventListener("touchstart", function (e) {\n if (!_this._isActive) {\n return;\n }\n if (_this._mouseStore.getMouseState() !== wwa_input_1.MouseState.NONE) {\n e.preventDefault();\n return;\n }\n var mousePos = util.$localPos(e.changedTouches[0].clientX, e.changedTouches[0].clientY);\n var playerPos = _this._player.getDrawingCenterPosition();\n var dist = mousePos.substract(playerPos);\n var dx = Math.abs(dist.x);\n var dy = Math.abs(dist.y);\n var dir;\n if (dist.y > 0 && dy > dx) {\n dir = wwa_data_1.Direction.DOWN;\n }\n else if (dist.y < 0 && dy > dx) {\n dir = wwa_data_1.Direction.UP;\n }\n else if (dist.x > 0 && dy < dx) {\n dir = wwa_data_1.Direction.RIGHT;\n }\n else if (dist.x < 0 && dy < dx) {\n dir = wwa_data_1.Direction.LEFT;\n }\n _this._mouseStore.setPressInfo(dir, e.changedTouches[0].identifier);\n if (e.cancelable) {\n e.preventDefault();\n }\n });\n _this._mouseControllerElement.addEventListener("touchend", function (e) {\n if (!_this._isActive) {\n return;\n }\n for (var i = 0; i < e.changedTouches.length; i++) {\n if (_this._mouseStore.getTouchID() === e.changedTouches[i].identifier) {\n _this._mouseStore.setReleaseInfo();\n e.preventDefault();\n break;\n }\n }\n });\n _this._mouseControllerElement.addEventListener("touchcancel", function (e) {\n if (!_this._isActive) {\n return;\n }\n for (var i = 0; i < e.changedTouches.length; i++) {\n if (_this._mouseStore.getTouchID() === e.changedTouches[i].identifier) {\n _this._mouseStore.setReleaseInfo();\n e.preventDefault();\n break;\n }\n }\n });\n }\n util.$id("button-load").addEventListener("click", function () {\n if (_this._player.isControllable()) {\n _this.onselectbutton(wwa_data_1.SidebarButton.QUICK_LOAD);\n }\n });\n util.$id("button-save").addEventListener("click", function () {\n if (_this._player.isControllable()) {\n _this.onselectbutton(wwa_data_1.SidebarButton.QUICK_SAVE);\n }\n });\n util.$id("button-restart").addEventListener("click", function () {\n if (_this._player.isControllable()) {\n _this.onselectbutton(wwa_data_1.SidebarButton.RESTART_GAME);\n }\n });\n util.$id("button-gotowwa").addEventListener("click", function () {\n if (_this._player.isControllable()) {\n _this.onselectbutton(wwa_data_1.SidebarButton.GOTO_WWA);\n }\n });\n Array.prototype.forEach.call(util.$qsAll(".wide-cell-row"), function (node) {\n node.addEventListener("click", function () {\n _this._displayHelp();\n });\n });\n _this._frameCoord = new wwa_data_1.Coord(wwa_data_1.WWAConsts.IMGPOS_DEFAULT_FRAME_X, wwa_data_1.WWAConsts.IMGPOS_DEFAULT_YESNO_Y);\n _this._battleEffectCoord = new wwa_data_1.Coord(wwa_data_1.WWAConsts.IMGPOS_DEFAULT_BATTLE_EFFECT_X, wwa_data_1.WWAConsts.IMGPOS_DEFAULT_BATTLE_EFFECT_Y);\n _this._battleEstimateWindow = new wwa_estimate_battle_1.BattleEstimateWindow(_this, _this._wwaData.mapCGName, util.$id("wwa-wrapper"));\n _this._passwordWindow = new wwa_password_window_1.PasswordWindow(_this, util.$id("wwa-wrapper"));\n _this._messageWindow = new wwa_message_1.MessageWindow(_this, 50, 180, 340, 0, "", _this._wwaData.mapCGName, false, true, util.$id("wwa-wrapper"));\n _this._monsterWindow = new wwa_message_1.MosterWindow(_this, new wwa_data_1.Coord(50, 180), 340, 60, false, util.$id("wwa-wrapper"), _this._wwaData.mapCGName);\n _this._scoreWindow = new wwa_message_1.ScoreWindow(_this, new wwa_data_1.Coord(50, 50), false, util.$id("wwa-wrapper"));\n _this._setProgressBar(getProgress(3, 4, wwa_data_1.LoadStage.GAME_INIT));\n _this._isLoadedSound = false;\n _this._temporaryInputDisable = false;\n _this._paintSkipByDoorOpen = false;\n _this._clearFacesInNextFrame = false;\n _this._useConsole = false;\n _this.clearFaces();\n var self = _this;\n _this._cgManager = new wwa_cgmanager_1.CGManager(ctx, ctxSub, _this._wwaData.mapCGName, function () {\n _this._isSkippedSoundMessage = true;\n if (_this._wwaData.systemMessage[wwa_data_1.SystemMessage2.LOAD_SE] === "ON") {\n _this._isLoadedSound = true;\n _this.setMessageQueue("ゲームを開始します。\\n画面をクリックしてください。\\n" +\n "※iOS, Android端末では、音楽は再生されないことがあります。", false, true);\n _this._setLoadingMessage(ctxCover, wwa_data_1.LoadStage.AUDIO);\n _this.loadSound();\n setTimeout(_this.soundCheckCaller, wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL, _this);\n return;\n }\n else if (_this._wwaData.systemMessage[wwa_data_1.SystemMessage2.LOAD_SE] === "OFF") {\n _this._isLoadedSound = false;\n _this.setMessageQueue("ゲームを開始します。\\n画面をクリックしてください。", false, true);\n _this.openGameWindow();\n return;\n }\n _this._isSkippedSoundMessage = false;\n if (!_this._hasTitleImg) {\n ctxCover.clearRect(0, 0, wwa_data_1.WWAConsts.SCREEN_WIDTH, wwa_data_1.WWAConsts.SCREEN_HEIGHT);\n }\n _this._messageWindow.setMessage((_this._wwaData.systemMessage[wwa_data_1.SystemMessage2.LOAD_SE] === "" ?\n "効果音・BGMデータをロードしますか?" :\n _this._wwaData.systemMessage[wwa_data_1.SystemMessage2.LOAD_SE]) + "\\n※iOS, Android端末では、選択に関わらず音楽が再生されないことがあります。");\n _this._messageWindow.show();\n _this._setProgressBar(getProgress(4, 4, wwa_data_1.LoadStage.GAME_INIT));\n var timer = setInterval(function () {\n self._keyStore.update();\n if (self._yesNoJudgeInNextFrame === wwa_data_1.YesNoState.UNSELECTED) {\n if (self._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_ENTER) === wwa_input_1.KeyState.KEYDOWN ||\n self._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_Y) === wwa_input_1.KeyState.KEYDOWN) {\n self._yesNoJudgeInNextFrame = wwa_data_1.YesNoState.YES;\n }\n else if (self._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_N) === wwa_input_1.KeyState.KEYDOWN ||\n self._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_ESC) === wwa_input_1.KeyState.KEYDOWN) {\n self._yesNoJudgeInNextFrame = wwa_data_1.YesNoState.NO;\n }\n }\n if (self._yesNoJudgeInNextFrame === wwa_data_1.YesNoState.YES) {\n clearInterval(timer);\n self._messageWindow.update();\n self._yesNoJudge = self._yesNoJudgeInNextFrame;\n self._messageWindow.setInputDisable();\n setTimeout(function () {\n self._messageWindow.update();\n setTimeout(function () {\n self._messageWindow.hide();\n self._yesNoJudge = wwa_data_1.YesNoState.UNSELECTED;\n self._yesNoJudgeInNextFrame = wwa_data_1.YesNoState.UNSELECTED;\n self._isLoadedSound = true;\n _this._setLoadingMessage(ctxCover, wwa_data_1.LoadStage.AUDIO);\n self.loadSound();\n setTimeout(_this.soundCheckCaller, wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL, _this);\n }, wwa_data_1.WWAConsts.YESNO_PRESS_DISP_FRAME_NUM * wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL);\n }, wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL);\n }\n else if (self._yesNoJudgeInNextFrame === wwa_data_1.YesNoState.NO) {\n clearInterval(timer);\n self._messageWindow.update();\n self._yesNoJudge = self._yesNoJudgeInNextFrame;\n self._messageWindow.setInputDisable();\n setTimeout(function () {\n self._messageWindow.update();\n setTimeout(function () {\n self._messageWindow.hide();\n self._yesNoJudge = wwa_data_1.YesNoState.UNSELECTED;\n self._yesNoJudgeInNextFrame = wwa_data_1.YesNoState.UNSELECTED;\n self._isLoadedSound = false;\n self.openGameWindow();\n }, wwa_data_1.WWAConsts.YESNO_PRESS_DISP_FRAME_NUM * wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL);\n }, wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL);\n }\n }, wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL);\n });\n };\n if (wwap_mode || Worker === void 0) {\n var script;\n if (!external_script_inject_mode) {\n script = document.createElement("script");\n if (wwap_mode) {\n script.src = wwa_data_1.WWAConsts.WWAP_SERVER + "/" + wwa_data_1.WWAConsts.WWAP_SERVER_LOADER_NO_WORKER;\n }\n else {\n script.src = "wwaload.noworker.js";\n }\n document.getElementsByTagName("head")[0].appendChild(script);\n }\n else {\n script = document.getElementById("wwaloader-ex");\n if (!script.src.match(/^http:\\/\\/wwawing\\.com/) &&\n !script.src.match(/^http:\\/\\/www\\.wwawing\\.com/) &&\n !script.src.match(/^https:\\/\\/wwaphoenix\\.github\\.io/) &&\n !script.src.match(/^https:\\/\\/www\\.wwaphoenix\\.github\\.io/)) {\n throw new Error("SCRIPT ORIGIN ERROR");\n }\n }\n var self1 = this;\n window.postMessage_noWorker = function (e) {\n self1._loadHandler(e);\n };\n try {\n loader_start({\n data: {\n fileName: mapFileName + "?date=" + t_start\n }\n });\n }\n catch (e) {\n script.onload = function () {\n loader_start({\n data: {\n fileName: mapFileName + "?date=" + t_start\n }\n });\n };\n }\n }\n else {\n try {\n var loadWorker = new Worker(workerFileName + "?date=" + t_start);\n loadWorker.postMessage({ "fileName": mapFileName + "?date=" + t_start });\n loadWorker.addEventListener("message", this._loadHandler);\n }\n catch (e) {\n alert("マップデータのロード時のエラーが発生しました。:\\nWebWorkerの生成に失敗しました。" + e.message);\n return;\n }\n }\n }\n WWA.prototype._setProgressBar = function (progress) {\n if (!this._hasTitleImg) {\n return;\n }\n if (progress.stage <= wwa_data_1.WWAConsts.LOAD_STAGE_MAX_EXCEPT_AUDIO) {\n (util.$id("progress-message-container")).textContent =\n (progress.stage === wwa_data_1.WWAConsts.LOAD_STAGE_MAX_EXCEPT_AUDIO ? "World Name: " + this._wwaData.worldName : wwa_data_1.loadMessages[progress.stage]);\n (util.$id("progress-bar")).style.width =\n (1 * progress.stage + (progress.current / progress.total) * 1) / (wwa_data_1.WWAConsts.LOAD_STAGE_MAX_EXCEPT_AUDIO + 1) * wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH + "px";\n (util.$id("progress-disp")).textContent =\n ((1 * progress.stage + (progress.current / progress.total) * 1) / (wwa_data_1.WWAConsts.LOAD_STAGE_MAX_EXCEPT_AUDIO + 1) * 100).toFixed(2) + "%";\n }\n else {\n (util.$id("progress-message-container")).textContent = "効果音/BGMを読み込んでいます。(スペースキーでスキップ)";\n (util.$id("progress-bar-audio")).style.width =\n (progress.current * wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH / progress.total) + "px";\n (util.$id("progress-disp")).textContent =\n ((progress.current / progress.total * 100).toFixed(2)) + "%";\n }\n };\n WWA.prototype._setLoadingMessage = function (ctx, mode) {\n if (this._hasTitleImg) {\n return;\n }\n if (mode <= 0) {\n ctx.font = wwa_data_1.LoadingMessageSize.TITLE + "px " + wwa_data_1.WWAConsts.LOADING_FONT;\n ctx.fillText(wwa_data_1.loadMessagesClassic[0], wwa_data_1.LoadingMessagePosition.TITLE_X, wwa_data_1.LoadingMessagePosition.TITLE_Y);\n ctx.font = wwa_data_1.LoadingMessageSize.FOOTER + "px " + wwa_data_1.WWAConsts.LOADING_FONT;\n ctx.fillText("WWA Wing Ver." + "3.1.8", wwa_data_1.LoadingMessagePosition.FOOTER_X, wwa_data_1.LoadingMessagePosition.COPYRIGHT_Y);\n }\n else if (mode <= wwa_data_1.loadMessagesClassic.length) {\n ctx.font = wwa_data_1.LoadingMessageSize.LOADING + "px " + wwa_data_1.WWAConsts.LOADING_FONT;\n if (mode >= 2) {\n ctx.clearRect(wwa_data_1.LoadingMessagePosition.LOADING_X, wwa_data_1.LoadingMessagePosition.LOADING_Y + (wwa_data_1.LoadingMessagePosition.LINE * (mode - 3)), wwa_data_1.WWAConsts.SCREEN_WIDTH - wwa_data_1.LoadingMessagePosition.LOADING_X, wwa_data_1.LoadingMessagePosition.LINE);\n ctx.fillText(wwa_data_1.loadMessagesClassic[mode - 1] + " Complete!", wwa_data_1.LoadingMessagePosition.LOADING_X, wwa_data_1.LoadingMessagePosition.LOADING_Y + (wwa_data_1.LoadingMessagePosition.LINE * (mode - 2)));\n }\n if (mode < wwa_data_1.loadMessagesClassic.length) {\n ctx.fillText(wwa_data_1.loadMessagesClassic[mode], wwa_data_1.LoadingMessagePosition.LOADING_X, wwa_data_1.LoadingMessagePosition.LOADING_Y + (wwa_data_1.LoadingMessagePosition.LINE * (mode - 1)));\n }\n if (mode == 1) {\n ctx.font = wwa_data_1.LoadingMessageSize.FOOTER + "px " + wwa_data_1.WWAConsts.LOADING_FONT;\n ctx.fillText("World Name " + this._wwaData.worldName, wwa_data_1.LoadingMessagePosition.FOOTER_X, wwa_data_1.LoadingMessagePosition.WORLD_Y);\n ctx.fillText(" (Map data Ver. " + Math.floor(this._wwaData.version / 10) + "." + this._wwaData.version % 10 + ")", wwa_data_1.LoadingMessagePosition.FOOTER_X, wwa_data_1.LoadingMessagePosition.WORLD_Y + wwa_data_1.LoadingMessagePosition.LINE);\n }\n }\n else {\n var messageY;\n if (this._isSkippedSoundMessage) {\n messageY = wwa_data_1.LoadingMessagePosition.LOADING_Y + (wwa_data_1.LoadingMessagePosition.LINE * (wwa_data_1.loadMessagesClassic.length - 1));\n }\n else {\n messageY = wwa_data_1.LoadingMessagePosition.FOOTER_Y;\n }\n if (mode <= wwa_data_1.LoadStage.AUDIO) {\n ctx.fillText("Now Sound data Loading .....", wwa_data_1.LoadingMessagePosition.LOADING_X, messageY);\n }\n else {\n ctx.clearRect(wwa_data_1.LoadingMessagePosition.LOADING_X, messageY - wwa_data_1.LoadingMessagePosition.LINE, wwa_data_1.WWAConsts.SCREEN_WIDTH - wwa_data_1.LoadingMessagePosition.LOADING_X, wwa_data_1.LoadingMessagePosition.LINE);\n ctx.fillText("Now Sound data Loading ..... Complete!", wwa_data_1.LoadingMessagePosition.LOADING_X, messageY);\n }\n }\n };\n WWA.prototype._setErrorMessage = function (message, ctx) {\n if (this._hasTitleImg) {\n alert(message);\n }\n else {\n ctx.clearRect(0, 0, wwa_data_1.WWAConsts.SCREEN_WIDTH, wwa_data_1.WWAConsts.SCREEN_HEIGHT);\n ctx.font = wwa_data_1.LoadingMessageSize.ERRROR + "px " + wwa_data_1.WWAConsts.LOADING_FONT;\n var errorMessage = message.split(\'\\n\');\n errorMessage.forEach(function (line, i) {\n ctx.fillText(line, wwa_data_1.LoadingMessagePosition.ERROR_X, wwa_data_1.LoadingMessagePosition.ERROR_Y + (wwa_data_1.LoadingMessagePosition.LINE * i));\n });\n }\n };\n WWA.prototype.createAudioJSInstance = function (idx, isSub) {\n if (isSub === void 0) { isSub = false; }\n if (idx === 0 || this._audioJSInstances[idx] !== void 0 || idx === wwa_data_1.SystemSound.NO_SOUND) {\n return;\n }\n var file = (wwap_mode ? wwa_data_1.WWAConsts.WWAP_SERVER + "/" + wwa_data_1.WWAConsts.WWAP_SERVER_AUDIO_DIR + "/" + idx + ".mp3" : this._audioDirectory + idx + ".mp3");\n var audioElement = new Audio(file);\n audioElement.preload = "auto";\n if (idx >= wwa_data_1.SystemSound.BGM_LB) {\n audioElement.loop = true;\n }\n util.$id("wwa-audio-wrapper").appendChild(audioElement);\n this._audioJSInstances[idx] = audiojs.create(audioElement);\n if (idx < wwa_data_1.SystemSound.BGM_LB) {\n var audioElementSub = new Audio(file);\n audioElementSub.preload = "auto";\n util.$id("wwa-audio-wrapper").appendChild(audioElementSub);\n this._audioJSInstancesSub[idx] = audiojs.create(audioElementSub);\n }\n };\n WWA.prototype.loadSound = function () {\n this._audioJSInstances = new Array(wwa_data_1.WWAConsts.SOUND_MAX + 1);\n this._audioJSInstancesSub = new Array(wwa_data_1.WWAConsts.SOUND_MAX + 1);\n this.createAudioJSInstance(wwa_data_1.SystemSound.DECISION);\n this.createAudioJSInstance(wwa_data_1.SystemSound.ATTACK);\n for (var pid = 1; pid < this._wwaData.mapPartsMax; pid++) {\n var idx = this._wwaData.mapAttribute[pid][wwa_data_1.WWAConsts.ATR_SOUND];\n this.createAudioJSInstance(idx);\n }\n for (var pid = 1; pid < this._wwaData.objPartsMax; pid++) {\n if (this._wwaData.objectAttribute[pid][wwa_data_1.WWAConsts.ATR_TYPE] === wwa_data_1.WWAConsts.OBJECT_RANDOM) {\n continue;\n }\n var idx = this._wwaData.objectAttribute[pid][wwa_data_1.WWAConsts.ATR_SOUND];\n this.createAudioJSInstance(idx);\n }\n this._wwaData.bgm = 0;\n this._soundLoadSkipFlag = false;\n };\n WWA.prototype.checkAllSoundLoaded = function () {\n var loadedNum = 0;\n var total = 0;\n if (!this._hasTitleImg) {\n var ctxCover = this._cvsCover.getContext("2d");\n }\n this._keyStore.update();\n if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_SPACE) === wwa_input_1.KeyState.KEYDOWN) {\n this._soundLoadSkipFlag = true;\n }\n for (var i = 1; i <= wwa_data_1.WWAConsts.SOUND_MAX; i++) {\n if (this._audioJSInstances[i] === void 0) {\n continue;\n }\n if (this._audioJSInstances[i].wrapper.classList.contains("error")) {\n continue;\n }\n total++;\n if (this._audioJSInstances[i].wrapper.classList.contains("loading")) {\n continue;\n }\n loadedNum++;\n }\n if (loadedNum < total && !this._soundLoadSkipFlag) {\n this._setProgressBar(getProgress(loadedNum, total, wwa_data_1.LoadStage.AUDIO));\n setTimeout(this.soundCheckCaller, wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL, this);\n return;\n }\n this._setProgressBar(getProgress(wwa_data_1.WWAConsts.SOUND_MAX, wwa_data_1.WWAConsts.SOUND_MAX, wwa_data_1.LoadStage.AUDIO));\n this._setLoadingMessage(ctxCover, wwa_data_1.LoadStage.FINISH);\n this.openGameWindow();\n };\n WWA.prototype.playSound = function (id) {\n var _this = this;\n if (!this._isLoadedSound) {\n if (id === wwa_data_1.SystemSound.NO_SOUND) {\n this._wwaData.bgm = 0;\n }\n else if (id >= wwa_data_1.SystemSound.BGM_LB) {\n this._wwaData.bgm = id;\n }\n return;\n }\n if (id < 0 || id > wwa_data_1.WWAConsts.SOUND_MAX) {\n throw new Error("サウンド番号が範囲外です。");\n }\n if (id >= wwa_data_1.SystemSound.BGM_LB && this._wwaData.bgm === id) {\n return;\n }\n if ((id === wwa_data_1.SystemSound.NO_SOUND || id >= wwa_data_1.SystemSound.BGM_LB) && this._wwaData.bgm !== 0) {\n if (!this._audioJSInstances[this._wwaData.bgm].wrapper.classList.contains("loading")) {\n this._audioJSInstances[this._wwaData.bgm].pause();\n }\n this._wwaData.bgm = 0;\n }\n if (id === 0 || id === wwa_data_1.SystemSound.NO_SOUND) {\n return;\n }\n if (this._audioJSInstances[id].wrapper.classList.contains("loading")) {\n if (id >= wwa_data_1.SystemSound.BGM_LB) {\n var loadi = (function (id, self) {\n var timer = setInterval(function () {\n if (self._wwaData.bgm === id) {\n if (!self._audioJSInstances[id].wrapper.classList.contains("loading")) {\n _this._audioJSInstances[id].skipTo(0);\n _this._audioJSInstances[id].play();\n _this._wwaData.bgm = id;\n clearInterval(timer);\n }\n }\n else {\n clearInterval(timer);\n if (self._wwaData.bgm !== wwa_data_1.SystemSound.NO_SOUND) {\n loadi(self._wwaData.bgm, self);\n }\n }\n }, 4);\n });\n loadi(id, this);\n }\n this._wwaData.bgm = id;\n return;\n }\n if (id !== 0 && !this._audioJSInstances[id].wrapper.classList.contains("error")) {\n if (id >= wwa_data_1.SystemSound.BGM_LB) {\n this._audioJSInstances[id].skipTo(0);\n this._audioJSInstances[id].play();\n this._wwaData.bgm = id;\n }\n else if (this._nextSoundIsSub) {\n this._audioJSInstancesSub[id].skipTo(0);\n this._audioJSInstancesSub[id].play();\n this._nextSoundIsSub = false;\n }\n else {\n this._audioJSInstances[id].skipTo(0);\n this._audioJSInstances[id].play();\n this._nextSoundIsSub = true;\n }\n }\n };\n WWA.prototype.openGameWindow = function () {\n var self = this;\n var ppos = this._player.getPosition();\n util.$id("wwa-cover").style.opacity = "0";\n if (this.getObjectIdByPosition(ppos) !== 0) {\n this._player.setPartsAppearedFlag();\n }\n setTimeout(function () {\n util.$id("wwa-wrapper").removeChild(util.$id("wwa-cover"));\n self._main();\n }, wwa_data_1.WWAConsts.SPLASH_SCREEN_DISP_MILLS);\n };\n WWA.prototype.mainCaller = function (self) {\n self._main();\n };\n WWA.prototype.soundCheckCaller = function (self) {\n self.checkAllSoundLoaded();\n };\n WWA.prototype.onselectitem = function (itemPos) {\n if (this._player.canUseItem(itemPos)) {\n var bg = (util.$id("item" + (itemPos - 1)));\n bg.classList.add("onpress");\n this.playSound(wwa_data_1.SystemSound.DECISION);\n if (this._wwaData.message[wwa_data_1.SystemMessage1.USE_ITEM] === "BLANK") {\n this._player.readyToUseItem(itemPos);\n var itemID = this._player.useItem();\n var mesID = this.getObjectAttributeById(itemID, wwa_data_1.WWAConsts.ATR_STRING);\n this.setMessageQueue(this.getMessageById(mesID), false, false, itemID, wwa_data_1.PartsType.OBJECT, this._player.getPosition().getPartsCoord());\n }\n else {\n this.setMessageQueue(this._wwaData.message[wwa_data_1.SystemMessage1.USE_ITEM] === "" ?\n "このアイテムを使います。\\nよろしいですか?" :\n this._wwaData.message[wwa_data_1.SystemMessage1.USE_ITEM], true, true);\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_ITEM_USE;\n this._yesNoUseItemPos = itemPos;\n }\n }\n };\n WWA.prototype.onselectbutton = function (button, forcePassword) {\n if (forcePassword === void 0) { forcePassword = false; }\n var bg = (util.$id(wwa_data_1.sidebarButtonCellElementID[button]));\n this.playSound(wwa_data_1.SystemSound.DECISION);\n bg.classList.add("onpress");\n if (button === wwa_data_1.SidebarButton.QUICK_LOAD) {\n if (this._quickSaveData !== void 0 && !forcePassword) {\n this.setMessageQueue("データを読み込みますか?\\n→Noでデータ復帰用パスワードの\\n 入力選択ができます。", true, true);\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_QUICK_LOAD;\n }\n else {\n this.onpasswordloadcalled();\n }\n }\n else if (button === wwa_data_1.SidebarButton.QUICK_SAVE) {\n if (!this._wwaData.disableSaveFlag) {\n this.setMessageQueue("データの一時保存をします。\\nよろしいですか?\\n→Noでデータ復帰用パスワードの\\n 表示選択ができます。", true, true);\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_QUICK_SAVE;\n }\n else {\n this.setMessageQueue("ここではセーブ機能は\\n使用できません。", false, true);\n }\n }\n else if (button === wwa_data_1.SidebarButton.RESTART_GAME) {\n this.setMessageQueue("初めからスタートしなおしますか?", true, true);\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_RESTART_GAME;\n }\n else if (button === wwa_data_1.SidebarButton.GOTO_WWA) {\n this.setMessageQueue("WWAの公式サイトを開きますか?", true, true);\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_GOTO_WWA;\n }\n };\n WWA.prototype.onpasswordloadcalled = function () {\n var bg = (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.QUICK_LOAD]));\n bg.classList.add("onpress");\n this.setMessageQueue("データ復帰用のパスワードを入力しますか?", true, true);\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_PASSWORD_LOAD;\n };\n WWA.prototype.onpasswordsavecalled = function () {\n var bg = (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.QUICK_SAVE]));\n bg.classList.add("onpress");\n if (!this._wwaData.disableSaveFlag) {\n this.setMessageQueue("データ復帰用のパスワードを表示しますか?", true, true);\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_PASSWORD_SAVE;\n }\n else {\n this.setMessageQueue("ここではセーブ機能は\\n使用できません。", false, true);\n }\n };\n WWA.prototype.onchangespeed = function (type) {\n var speedIndex;\n if (type === wwa_data_1.SpeedChange.UP) {\n speedIndex = this._player.speedUp();\n }\n else {\n speedIndex = this._player.speedDown();\n }\n this.setMessageQueue("移動速度を【" + wwa_data_1.speedNameList[speedIndex] + "】に切り替えました。\\n" +\n (speedIndex === wwa_data_1.WWAConsts.MAX_SPEED_INDEX ? "戦闘も速くなります。\\n" : "") +\n "(" + (wwa_data_1.WWAConsts.MAX_SPEED_INDEX + 1) + "段階中" + (speedIndex + 1) + ") 速度を落とすにはIキー, 速度を上げるにはPキーを押してください。", false, true);\n };\n WWA.prototype._main = function () {\n var _this = this;\n this._temporaryInputDisable = false;\n this._waitTimeInCurrentFrame = wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL;\n this._stopUpdateByLoadFlag = false;\n this._keyStore.update();\n this._mouseStore.update();\n if (this._yesNoJudgeInNextFrame !== void 0) {\n this._yesNoJudge = this._yesNoJudgeInNextFrame;\n this._yesNoJudgeInNextFrame = void 0;\n }\n if (this._clearFacesInNextFrame) {\n this.clearFaces();\n this._clearFacesInNextFrame = false;\n }\n for (var i = 0; i < this._execMacroListInNextFrame.length; i++) {\n this._execMacroListInNextFrame[i].execute();\n }\n if (this._lastMessage.message === "" && this._lastMessage.isEndOfPartsEvent && this._reservedMoveMacroTurn !== void 0) {\n this._player.setMoveMacroWaiting(this._reservedMoveMacroTurn);\n this._reservedMoveMacroTurn = void 0;\n }\n this._execMacroListInNextFrame = [];\n var prevPosition = this._player.getPosition();\n var pdir = this._player.getDir();\n if (this._player.isControllable()) {\n if (this._keyStore.getKeyStateForControllPlayer(wwa_input_1.KeyCode.KEY_LEFT) === wwa_input_1.KeyState.KEYDOWN ||\n this._mouseStore.getMouseStateForControllPlayer(wwa_data_1.Direction.LEFT) === wwa_input_1.MouseState.MOUSEDOWN) {\n this._player.controll(wwa_data_1.Direction.LEFT);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.getKeyStateForControllPlayer(wwa_input_1.KeyCode.KEY_UP) === wwa_input_1.KeyState.KEYDOWN ||\n this._mouseStore.getMouseStateForControllPlayer(wwa_data_1.Direction.UP) === wwa_input_1.MouseState.MOUSEDOWN) {\n this._player.controll(wwa_data_1.Direction.UP);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.getKeyStateForControllPlayer(wwa_input_1.KeyCode.KEY_RIGHT) === wwa_input_1.KeyState.KEYDOWN ||\n this._mouseStore.getMouseStateForControllPlayer(wwa_data_1.Direction.RIGHT) === wwa_input_1.MouseState.MOUSEDOWN) {\n this._player.controll(wwa_data_1.Direction.RIGHT);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.getKeyStateForControllPlayer(wwa_input_1.KeyCode.KEY_DOWN) === wwa_input_1.KeyState.KEYDOWN ||\n this._mouseStore.getMouseStateForControllPlayer(wwa_data_1.Direction.DOWN) === wwa_input_1.MouseState.MOUSEDOWN) {\n this._player.controll(wwa_data_1.Direction.DOWN);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_data_1.dirToKey[pdir])) {\n this._player.controll(pdir);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_LEFT) ||\n this._mouseStore.checkClickMouse(wwa_data_1.Direction.LEFT)) {\n this._player.controll(wwa_data_1.Direction.LEFT);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_UP) ||\n this._mouseStore.checkClickMouse(wwa_data_1.Direction.UP)) {\n this._player.controll(wwa_data_1.Direction.UP);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_RIGHT) ||\n this._mouseStore.checkClickMouse(wwa_data_1.Direction.RIGHT)) {\n this._player.controll(wwa_data_1.Direction.RIGHT);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_DOWN) ||\n this._mouseStore.checkClickMouse(wwa_data_1.Direction.DOWN)) {\n this._player.controll(wwa_data_1.Direction.DOWN);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_LEFT) ||\n this._mouseStore.checkClickMouse(wwa_data_1.Direction.LEFT)) {\n this._player.controll(wwa_data_1.Direction.LEFT);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_UP) ||\n this._mouseStore.checkClickMouse(wwa_data_1.Direction.UP)) {\n this._player.controll(wwa_data_1.Direction.UP);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_RIGHT) ||\n this._mouseStore.checkClickMouse(wwa_data_1.Direction.RIGHT)) {\n this._player.controll(wwa_data_1.Direction.RIGHT);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_DOWN) ||\n this._mouseStore.checkClickMouse(wwa_data_1.Direction.DOWN)) {\n this._player.controll(wwa_data_1.Direction.DOWN);\n this._objectMovingDataManager.update();\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_1) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(1);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_2) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(2);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_3) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(3);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_Q) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(4);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_W) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(5);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_E) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(6);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_A) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(7);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_S) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(8);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_D) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(9);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_Z) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(10);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_X) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(11);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_C) === wwa_input_1.KeyState.KEYDOWN) {\n this.onselectitem(12);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_I)) {\n this.onchangespeed(wwa_data_1.SpeedChange.DOWN);\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_P) ||\n this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_F2)) {\n this.onchangespeed(wwa_data_1.SpeedChange.UP);\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_F1) === wwa_input_1.KeyState.KEYDOWN ||\n this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_M) === wwa_input_1.KeyState.KEYDOWN) {\n if (this.launchBattleEstimateWindow()) {\n }\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_F3)) {\n this.playSound(wwa_data_1.SystemSound.DECISION);\n this.onselectbutton(wwa_data_1.SidebarButton.QUICK_LOAD, true);\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_F4)) {\n this.playSound(wwa_data_1.SystemSound.DECISION);\n this.onpasswordsavecalled();\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_F5)) {\n this.onselectbutton(wwa_data_1.SidebarButton.QUICK_LOAD);\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_F6)) {\n this.onselectbutton(wwa_data_1.SidebarButton.QUICK_SAVE);\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_F7)) {\n this.onselectbutton(wwa_data_1.SidebarButton.RESTART_GAME);\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_F8)) {\n this.onselectbutton(wwa_data_1.SidebarButton.GOTO_WWA);\n }\n else if (this._keyStore.checkHitKey(wwa_input_1.KeyCode.KEY_F12)) {\n this._displayHelp();\n }\n this._keyStore.memorizeKeyStateOnControllableFrame();\n this._mouseStore.memorizeMouseStateOnControllableFrame();\n }\n else if (this._player.isJumped()) {\n if (!this._camera.isResetting()) {\n this._player.processAfterJump();\n }\n }\n else if (this._player.isMoving()) {\n this._player.move();\n this._objectMovingDataManager.update();\n }\n else if (this._player.isWaitingMessage()) {\n if (!this._messageWindow.isVisible()) {\n this._messageWindow.show();\n }\n if (!this._messageWindow.isYesNoChoice()) {\n var enter = this._keyStore.getKeyStateForMessageCheck(wwa_input_1.KeyCode.KEY_ENTER);\n var space = this._keyStore.getKeyStateForMessageCheck(wwa_input_1.KeyCode.KEY_SPACE);\n var esc = this._keyStore.getKeyStateForMessageCheck(wwa_input_1.KeyCode.KEY_ESC);\n if (enter === wwa_input_1.KeyState.KEYDOWN || enter === wwa_input_1.KeyState.KEYPRESS_MESSAGECHANGE ||\n space === wwa_input_1.KeyState.KEYDOWN || space === wwa_input_1.KeyState.KEYPRESS_MESSAGECHANGE ||\n esc === wwa_input_1.KeyState.KEYDOWN || esc === wwa_input_1.KeyState.KEYPRESS_MESSAGECHANGE ||\n this._mouseStore.getMouseState() === wwa_input_1.MouseState.MOUSEDOWN) {\n for (var i = 0; i < wwa_data_1.sidebarButtonCellElementID.length; i++) {\n var elm = (util.$id(wwa_data_1.sidebarButtonCellElementID[i]));\n if (elm.classList.contains("onpress")) {\n elm.classList.remove("onpress");\n }\n }\n this._setNextMessage();\n }\n }\n else {\n if (!this._messageWindow.isInputDisable()) {\n if (this._yesNoJudge === wwa_data_1.YesNoState.UNSELECTED) {\n if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_ENTER) === wwa_input_1.KeyState.KEYDOWN ||\n this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_Y) === wwa_input_1.KeyState.KEYDOWN) {\n this._yesNoJudge = wwa_data_1.YesNoState.YES;\n }\n else if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_N) === wwa_input_1.KeyState.KEYDOWN ||\n this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_ESC) === wwa_input_1.KeyState.KEYDOWN) {\n this._yesNoJudge = wwa_data_1.YesNoState.NO;\n }\n }\n if (this._yesNoJudge === wwa_data_1.YesNoState.YES) {\n this.playSound(wwa_data_1.SystemSound.DECISION);\n this._yesNoDispCounter = wwa_data_1.WWAConsts.YESNO_PRESS_DISP_FRAME_NUM;\n this._messageWindow.setInputDisable();\n this._messageWindow.update();\n }\n else if (this._yesNoJudge === wwa_data_1.YesNoState.NO) {\n this.playSound(wwa_data_1.SystemSound.DECISION);\n this._yesNoDispCounter = wwa_data_1.WWAConsts.YESNO_PRESS_DISP_FRAME_NUM;\n this._messageWindow.setInputDisable();\n this._messageWindow.update();\n }\n }\n }\n }\n else if (this._player.isWatingEstimateWindow()) {\n if (this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_ENTER) === wwa_input_1.KeyState.KEYDOWN ||\n this._keyStore.getKeyState(wwa_input_1.KeyCode.KEY_SPACE) === wwa_input_1.KeyState.KEYDOWN) {\n this.hideBattleEstimateWindow();\n }\n }\n else if (this._player.isFighting()) {\n this._player.fight();\n this._monsterWindow.update(this._monster);\n }\n else if (this._player.isWaitingMoveMacro()) {\n if (this._player.isMoveObjectAutoExecTime()) {\n this.moveObjects(false);\n this._player.resetMoveObjectAutoExecTimer();\n }\n this._objectMovingDataManager.update();\n }\n this._prevFrameEventExected = false;\n if (this._player.getPosition().isJustPosition() && this._camera.getPosition().isScreenTopPosition()) {\n if (!this._player.isJumped() &&\n !this._player.isWaitingMessage() &&\n !this._player.isWatingEstimateWindow() &&\n !this._player.isWaitingMoveMacro() &&\n !this._player.isFighting()) {\n if (this._player.isPartsAppearedTime()) {\n this._player.clearPartsAppearedFlag();\n }\n this._replaceRandomObjectsInScreen();\n var eventExecuted = this.checkMap();\n if (!eventExecuted) {\n this.checkObject();\n }\n this._prevFrameEventExected = eventExecuted;\n }\n if (this._player.isWaitingMessage() &&\n this._messageWindow.isYesNoChoice() &&\n this._yesNoJudge !== wwa_data_1.YesNoState.UNSELECTED &&\n !this._player.isWaitingMoveMacro() &&\n !this._player.isFighting()) {\n this._execChoiceWindowRunningEvent();\n }\n }\n if (this._passwordLoadExecInNextFrame) {\n this._stopUpdateByLoadFlag = true;\n this._loadType = wwa_data_1.LoadType.PASSWORD;\n this._player.clearPasswordWindowWaiting();\n this._passwordLoadExecInNextFrame = false;\n }\n this._drawAll();\n this._mainCallCounter++;\n this._mainCallCounter %= 1000000000;\n if (!this._player.isWaitingMessage() || !this._isClassicModeEnable) {\n this._animationCounter = (this._animationCounter + 1) % (wwa_data_1.WWAConsts.ANIMATION_REP_HALF_FRAME * 2);\n }\n if (this._camera.isResetting()) {\n this._camera.advanceTransitionStepNum();\n }\n if (!this._player.isWaitingMessage()) {\n this._player.decrementLookingAroundTimer();\n if (this._statusPressCounter.energy > 0 && --this._statusPressCounter.energy === 0) {\n util.$id("disp-energy").classList.remove("onpress");\n }\n if (this._statusPressCounter.strength > 0 && --this._statusPressCounter.strength === 0) {\n util.$id("disp-strength").classList.remove("onpress");\n }\n if (this._statusPressCounter.defence > 0 && --this._statusPressCounter.defence === 0) {\n util.$id("disp-defence").classList.remove("onpress");\n }\n if (this._statusPressCounter.gold > 0 && --this._statusPressCounter.gold === 0) {\n util.$id("disp-gold").classList.remove("onpress");\n }\n }\n if (this._player.isWaitingMoveMacro()) {\n this._player.decrementMoveObjectAutoExecTimer();\n }\n if (!this._stopUpdateByLoadFlag) {\n setTimeout(this.mainCaller, this._waitTimeInCurrentFrame, this);\n }\n else {\n this._fadeout(function () {\n if (_this._loadType === wwa_data_1.LoadType.QUICK_LOAD) {\n _this._quickLoad();\n }\n else if (_this._loadType === wwa_data_1.LoadType.RESTART_GAME) {\n _this._restartGame();\n }\n else if (_this._loadType === wwa_data_1.LoadType.PASSWORD) {\n _this._applyQuickLoad(_this._passwordSaveExtractData);\n _this._passwordSaveExtractData = void 0;\n }\n setTimeout(_this.mainCaller, _this._waitTimeInCurrentFrame, _this);\n });\n }\n };\n WWA.prototype._drawAll = function () {\n var cpParts = this._camera.getPosition().getPartsCoord();\n var cpOffset = this._camera.getPosition().getOffsetCoord();\n var yLimit = wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT;\n var targetX;\n var targetY;\n var ppos = this._player.getPosition().getPartsCoord();\n if (this._paintSkipByDoorOpen) {\n this._paintSkipByDoorOpen = false;\n return;\n }\n this._cgManager.clearCanvas(0, 0, wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH, wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT);\n this._cgManager.drawBase(0, 0, wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH, wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT);\n if (this._camera.isResetting()) {\n if (this._camera.getPreviousPosition() !== null) {\n var cpPartsPrev = this._camera.getPreviousPosition().getPartsCoord();\n var cpOffsetPrev = this._camera.getPreviousPosition().getOffsetCoord();\n }\n yLimit = this._camera.getTransitionStepNum() * wwa_data_1.WWAConsts.CHIP_SIZE;\n this._drawMap(cpPartsPrev, cpOffsetPrev, yLimit, true);\n this._drawPlayer(cpPartsPrev, cpOffsetPrev, yLimit, true);\n this._drawObjects(cpPartsPrev, cpOffsetPrev, yLimit, true);\n if (this._camera.isFinalStep()) {\n var opacity = 255;\n var timer = setInterval(function () {\n var elm = util.$id("wwa-fader");\n opacity -= wwa_data_1.WWAConsts.FADEOUT_SPEED * 3;\n if (opacity <= 0) {\n clearInterval(timer);\n elm.style.backgroundColor = "transparent";\n elm.removeAttribute("style");\n elm.style.display = "none";\n return;\n }\n elm.style.opacity = (opacity / 255) + "";\n }, 20);\n }\n }\n this._drawMap(cpParts, cpOffset, yLimit);\n this._drawPlayer(cpParts, cpOffset, yLimit);\n this._drawObjects(cpParts, cpOffset, yLimit);\n if (this._player.isFighting() && !this._player.isBattleStartFrame()) {\n targetX = this._player.isTurn() ? this._monster.position.x : ppos.x;\n targetY = this._player.isTurn() ? this._monster.position.y : ppos.y;\n this._cgManager.drawCanvas(this._battleEffectCoord.x, this._battleEffectCoord.y, wwa_data_1.WWAConsts.CHIP_SIZE * (targetX - cpParts.x) - cpOffset.x, wwa_data_1.WWAConsts.CHIP_SIZE * (targetY - cpParts.y) - cpOffset.y, false);\n }\n this._drawEffect();\n this._drawFaces();\n this._drawFrame();\n };\n WWA.prototype._drawMap = function (cpParts, cpOffset, yLimit, isPrevCamera) {\n if (isPrevCamera === void 0) { isPrevCamera = false; }\n if (cpParts === void 0) {\n return;\n }\n var xLeft = Math.max(0, cpParts.x - 1);\n var xRight = Math.min(this._wwaData.mapWidth - 1, cpParts.x + wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW);\n var yTop = Math.max(0, cpParts.y - 1);\n var yBottom = Math.min(this._wwaData.mapWidth - 1, cpParts.y + wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW);\n for (var x = xLeft; x <= xRight; x++) {\n for (var y = yTop; y <= yBottom; y++) {\n var partsID = this._wwaData.map[y][x];\n var ppx = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_X] / wwa_data_1.WWAConsts.CHIP_SIZE;\n var ppy = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_Y] / wwa_data_1.WWAConsts.CHIP_SIZE;\n var canvasX = wwa_data_1.WWAConsts.CHIP_SIZE * (x - cpParts.x) - cpOffset.x;\n var canvasY = wwa_data_1.WWAConsts.CHIP_SIZE * (y - cpParts.y) - cpOffset.y;\n if (isPrevCamera) {\n this._cgManager.drawCanvasWithLowerYLimit(ppx, ppy, canvasX, canvasY, yLimit);\n }\n else {\n this._cgManager.drawCanvasWithUpperYLimit(ppx, ppy, canvasX, canvasY, yLimit);\n }\n }\n }\n };\n WWA.prototype._drawPlayer = function (cpParts, cpOffset, yLimit, isPrevCamera) {\n if (isPrevCamera === void 0) { isPrevCamera = false; }\n if (cpParts === void 0 || this._wwaData.delPlayerFlag) {\n return;\n }\n var pos = this._player.getPosition().getPartsCoord();\n var poso = this._player.getPosition().getOffsetCoord();\n var relpcrop = wwa_data_1.dirToPos[this._player.getDir()];\n var canvasX = (pos.x - cpParts.x) * wwa_data_1.WWAConsts.CHIP_SIZE + poso.x - cpOffset.x;\n var canvasY = (pos.y - cpParts.y) * wwa_data_1.WWAConsts.CHIP_SIZE + poso.y - cpOffset.y;\n var dx = Math.abs(poso.x);\n var dy = Math.abs(poso.y);\n var dir = this._player.getDir();\n var crop;\n var dirChanger = [2, 3, 4, 5, 0, 1, 6, 7];\n if (this._player.isLookingAround() && !this._player.isWaitingMessage()) {\n crop = this._wwaData.playerImgPosX + dirChanger[Math.floor(this._mainCallCounter % 64 / 8)];\n }\n else if (this._player.isMovingImage()) {\n crop = this._wwaData.playerImgPosX + relpcrop + 1;\n }\n else {\n crop = this._wwaData.playerImgPosX + relpcrop;\n }\n if (isPrevCamera) {\n this._cgManager.drawCanvasWithLowerYLimit(crop, this._wwaData.playerImgPosY, canvasX, canvasY, yLimit);\n }\n else {\n this._cgManager.drawCanvasWithUpperYLimit(crop, this._wwaData.playerImgPosY, canvasX, canvasY, yLimit);\n }\n };\n WWA.prototype._drawObjects = function (cpParts, cpOffset, yLimit, isPrevCamera) {\n if (isPrevCamera === void 0) { isPrevCamera = false; }\n if (cpParts === void 0) {\n return;\n }\n var xLeft = Math.max(0, cpParts.x - 1);\n var xRight = Math.min(this._wwaData.mapWidth - 1, cpParts.x + wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW);\n var yTop = Math.max(0, cpParts.y - 1);\n var yBottom = Math.min(this._wwaData.mapWidth - 1, cpParts.y + wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW);\n var offset;\n for (var x = xLeft; x <= xRight; x++) {\n for (var y = yTop; y <= yBottom; y++) {\n if (this._player.isFighting() &&\n this._player.isTurn() &&\n this._player.getPosition().getPartsCoord().equals(this._monster.position) &&\n new wwa_data_1.Coord(x, y).equals(this._monster.position)) {\n continue;\n }\n var partsIDObj = this._wwaData.mapObject[y][x];\n offset = new wwa_data_1.Coord(0, 0);\n if (this._wwaData.objectAttribute[partsIDObj][wwa_data_1.WWAConsts.ATR_MOVE] !== wwa_data_1.MoveType.STATIC) {\n var result = this._objectMovingDataManager.getOffsetByBeforePartsCoord(new wwa_data_1.Coord(x, y));\n if (result !== null) {\n offset = result;\n }\n }\n var imgType = (this._animationCounter > wwa_data_1.WWAConsts.ANIMATION_REP_HALF_FRAME ||\n this._wwaData.objectAttribute[partsIDObj][wwa_data_1.WWAConsts.ATR_X2] === 0 &&\n this._wwaData.objectAttribute[partsIDObj][wwa_data_1.WWAConsts.ATR_Y2] === 0);\n var ppxo = this._wwaData.objectAttribute[partsIDObj][imgType ? wwa_data_1.WWAConsts.ATR_X : wwa_data_1.WWAConsts.ATR_X2] / wwa_data_1.WWAConsts.CHIP_SIZE;\n var ppyo = this._wwaData.objectAttribute[partsIDObj][imgType ? wwa_data_1.WWAConsts.ATR_Y : wwa_data_1.WWAConsts.ATR_Y2] / wwa_data_1.WWAConsts.CHIP_SIZE;\n var canvasX = wwa_data_1.WWAConsts.CHIP_SIZE * (x - cpParts.x) + offset.x - cpOffset.x;\n var canvasY = wwa_data_1.WWAConsts.CHIP_SIZE * (y - cpParts.y) + offset.y - cpOffset.y;\n var type = this._wwaData.objectAttribute[partsIDObj][wwa_data_1.WWAConsts.ATR_TYPE];\n var num = this._wwaData.objectAttribute[partsIDObj][wwa_data_1.WWAConsts.ATR_NUMBER];\n if (partsIDObj !== 0 && !this._checkNoDrawObject(new wwa_data_1.Coord(x, y), type, num)) {\n if (isPrevCamera) {\n this._cgManager.drawCanvasWithLowerYLimit(ppxo, ppyo, canvasX, canvasY, yLimit);\n }\n else {\n this._cgManager.drawCanvasWithUpperYLimit(ppxo, ppyo, canvasX, canvasY, yLimit);\n }\n }\n }\n }\n };\n WWA.prototype._drawEffect = function () {\n if (this._wwaData.effectCoords.length === 0 || this._wwaData.effectWaits === 0) {\n return;\n }\n var i = Math.floor(this._mainCallCounter % (this._wwaData.effectCoords.length * this._wwaData.effectWaits) / this._wwaData.effectWaits);\n for (var y = 0; y < wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW; y++) {\n for (var x = 0; x < wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW; x++) {\n if (!this._wwaData.effectCoords[i]) {\n continue;\n }\n this._cgManager.drawCanvas(this._wwaData.effectCoords[i].x, this._wwaData.effectCoords[i].y, x * wwa_data_1.WWAConsts.CHIP_SIZE, y * wwa_data_1.WWAConsts.CHIP_SIZE, false);\n }\n }\n };\n WWA.prototype._drawFaces = function () {\n for (var i = 0; i < this._faces.length; i++) {\n this._cgManager.drawCanvasWithSize(this._faces[i].srcPos.x, this._faces[i].srcPos.y, this._faces[i].srcSize.x, this._faces[i].srcSize.y, this._faces[i].destPos.x, this._faces[i].destPos.y, false);\n }\n };\n WWA.prototype._drawFrame = function () {\n this._cgManager.drawCanvas(this._frameCoord.x, this._frameCoord.y, 0, 0, false);\n this._cgManager.drawCanvas(this._frameCoord.x + 2, this._frameCoord.y, wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH - wwa_data_1.WWAConsts.CHIP_SIZE, 0, false);\n this._cgManager.drawCanvas(this._frameCoord.x, this._frameCoord.y + 2, 0, wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT - wwa_data_1.WWAConsts.CHIP_SIZE, false);\n this._cgManager.drawCanvas(this._frameCoord.x + 2, this._frameCoord.y + 2, wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH - wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT - wwa_data_1.WWAConsts.CHIP_SIZE, false);\n for (var i = 1; i < wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW - 1; i++) {\n this._cgManager.drawCanvas(this._frameCoord.x + 1, this._frameCoord.y, wwa_data_1.WWAConsts.CHIP_SIZE * i, 0, false);\n this._cgManager.drawCanvas(this._frameCoord.x + 1, this._frameCoord.y + 2, wwa_data_1.WWAConsts.CHIP_SIZE * i, wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT - wwa_data_1.WWAConsts.CHIP_SIZE, false);\n }\n for (var i = 1; i < wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW - 1; i++) {\n this._cgManager.drawCanvas(this._frameCoord.x, this._frameCoord.y + 1, 0, wwa_data_1.WWAConsts.CHIP_SIZE * i, false);\n this._cgManager.drawCanvas(this._frameCoord.x + 2, this._frameCoord.y + 1, wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH - wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.CHIP_SIZE * i, false);\n }\n };\n WWA.prototype._checkNoDrawObject = function (objCoord, objType, atrNumber) {\n var pPos = this._player.getPosition();\n var pCoord = pPos.getPartsCoord();\n if (!pPos.isJustPosition() || pCoord.x !== objCoord.x || pCoord.y !== objCoord.y || this._wwaData.objectNoCollapseDefaultFlag) {\n return false;\n }\n if (objType === wwa_data_1.WWAConsts.OBJECT_DOOR && atrNumber === 0) {\n return true;\n }\n return (objType === wwa_data_1.WWAConsts.OBJECT_STATUS || objType === wwa_data_1.WWAConsts.OBJECT_MESSAGE ||\n objType === wwa_data_1.WWAConsts.OBJECT_ITEM || objType === wwa_data_1.WWAConsts.OBJECT_SELL ||\n objType === wwa_data_1.WWAConsts.OBJECT_BUY || objType === wwa_data_1.WWAConsts.OBJECT_SELL ||\n objType === wwa_data_1.WWAConsts.OBJECT_LOCALGATE);\n };\n WWA.prototype.getMapWidth = function () {\n if (this._wwaData === void 0) {\n throw new Error("マップデータがロードされていません");\n }\n return this._wwaData.mapWidth;\n };\n WWA.prototype.getMapIdByPosition = function (pos) {\n var pc = pos.getPartsCoord();\n return this._wwaData.map[pc.y][pc.x];\n };\n WWA.prototype.getObjectIdByPosition = function (pos) {\n var pc = pos.getPartsCoord();\n return this._wwaData.mapObject[pc.y][pc.x];\n };\n WWA.prototype.getMapTypeByPosition = function (pos) {\n var pc = pos.getPartsCoord();\n var pid = this._wwaData.map[pc.y][pc.x];\n return this._wwaData.mapAttribute[pid][wwa_data_1.WWAConsts.ATR_TYPE];\n };\n WWA.prototype.getObjectTypeByPosition = function (pos) {\n var pc = pos.getPartsCoord();\n var pid = this._wwaData.mapObject[pc.y][pc.x];\n return this._wwaData.objectAttribute[pid][wwa_data_1.WWAConsts.ATR_TYPE];\n };\n WWA.prototype.getMapAttributeByPosition = function (pos, attr) {\n var pc = pos.getPartsCoord();\n var pid = this._wwaData.map[pc.y][pc.x];\n return this._wwaData.mapAttribute[pid][attr];\n };\n WWA.prototype.isCurrentPosMapPartsIncludingMessage = function (pos) {\n var mesid = this.getMapAttributeByPosition(pos, wwa_data_1.WWAConsts.ATR_STRING);\n return mesid !== 0;\n };\n WWA.prototype.getObjectAttributeByPosition = function (pos, attr) {\n var pc = pos.getPartsCoord();\n var pid = this._wwaData.mapObject[pc.y][pc.x];\n return this._wwaData.objectAttribute[pid][attr];\n };\n WWA.prototype.getMapAttributeById = function (id, attr) {\n return this._wwaData.mapAttribute[id][attr];\n };\n WWA.prototype.getObjectAttributeById = function (id, attr) {\n return this._wwaData.objectAttribute[id][attr];\n };\n WWA.prototype.getObjectCropXById = function (id) {\n return this._wwaData.objectAttribute[id][wwa_data_1.WWAConsts.ATR_X];\n };\n WWA.prototype.getObjectCropYById = function (id) {\n return this._wwaData.objectAttribute[id][wwa_data_1.WWAConsts.ATR_Y];\n };\n WWA.prototype.getMessageById = function (messageID) {\n return this._wwaData.message[messageID];\n };\n WWA.prototype.getSystemMessageById = function (messageID) {\n return this._wwaData.systemMessage[messageID];\n };\n WWA.prototype.checkMap = function (pos) {\n var playerPos = this._player.getPosition().getPartsCoord();\n pos = (pos !== void 0 && pos !== null) ? pos : playerPos;\n var partsID = this._wwaData.map[pos.y][pos.x];\n var mapAttr = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_TYPE];\n var isPlayerPositionExec = (pos.x === playerPos.x && pos.y === playerPos.y);\n var eventExecuted = false;\n if (isPlayerPositionExec) {\n if (this._player.getLastExecPartsIDOnSamePosition(wwa_data_1.PartsType.MAP) === partsID) {\n return false;\n }\n }\n if (mapAttr === wwa_data_1.WWAConsts.MAP_STREET) {\n eventExecuted = this._execMapStreetEvent(pos, partsID, mapAttr);\n }\n else if (mapAttr === wwa_data_1.WWAConsts.MAP_WALL) {\n eventExecuted = this._execMapWallEvent(pos, partsID, mapAttr);\n }\n else if (mapAttr === wwa_data_1.WWAConsts.MAP_LOCALGATE) {\n eventExecuted = this._execMapLocalGateEvent(pos, partsID, mapAttr);\n }\n else if (mapAttr === wwa_data_1.WWAConsts.MAP_URLGATE) {\n eventExecuted = this._execMapUrlGateEvent(pos, partsID, mapAttr);\n }\n if (isPlayerPositionExec && !this._player.isJumped()) {\n this._player.setLastExecInfoOnSamePosition(wwa_data_1.PartsType.MAP, partsID);\n }\n return eventExecuted;\n };\n WWA.prototype.checkObject = function (pos) {\n var playerPos = this._player.getPosition().getPartsCoord();\n pos = (pos !== void 0 && pos !== null) ? pos : playerPos;\n var partsID = this._wwaData.mapObject[pos.y][pos.x];\n var objAttr = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_TYPE];\n var isPlayerPositionExec = (pos.x === playerPos.x && pos.y === playerPos.y);\n if (isPlayerPositionExec) {\n if (this._player.getLastExecPartsIDOnSamePosition(wwa_data_1.PartsType.OBJECT) === partsID) {\n return;\n }\n }\n if (objAttr === wwa_data_1.WWAConsts.OBJECT_NORMAL) {\n this._execObjectNormalEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_MESSAGE) {\n this._execObjectMessageEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_MONSTER) {\n this._execObjectMonsterEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_ITEM) {\n this._execObjectItemEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_DOOR) {\n this._execObjectDoorEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_STATUS) {\n this._execObjectStatusEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_BUY) {\n this._execObjectBuyEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_SELL) {\n this._execObjectSellEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_URLGATE) {\n this._execObjectUrlGateEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_SCORE) {\n this._execObjectScoreEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_SELECT) {\n this._execObjectYesNoChoiceEvent(pos, partsID, objAttr);\n }\n else if (objAttr === wwa_data_1.WWAConsts.OBJECT_LOCALGATE) {\n this._execObjectLocalGateEvent(pos, partsID, objAttr);\n }\n if (isPlayerPositionExec && !this._player.isJumped()) {\n this._player.setLastExecInfoOnSamePosition(wwa_data_1.PartsType.OBJECT, partsID);\n }\n };\n WWA.prototype._execMapStreetEvent = function (pos, partsID, mapAttr) {\n var itemID = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_ITEM];\n if (itemID !== 0 && !this._player.hasItem(itemID)) {\n return false;\n }\n this.appearParts(pos, wwa_data_1.AppearanceTriggerType.MAP);\n var messageID = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n this._waitTimeInCurrentFrame += this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_NUMBER] * 100;\n this._temporaryInputDisable = true;\n var messageDisplayed = this.setMessageQueue(message, false, false, partsID, wwa_data_1.PartsType.MAP, pos.clone());\n this.playSound(this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n return messageID !== 0 && messageDisplayed;\n };\n WWA.prototype._execMapWallEvent = function (pos, partsID, mapAttr) {\n var objID = this.getObjectIdByPosition(pos.convertIntoPosition(this));\n var objType = this.getObjectAttributeById(objID, wwa_data_1.WWAConsts.ATR_TYPE);\n if (objID === 0 ||\n objType === wwa_data_1.WWAConsts.OBJECT_NORMAL ||\n objType === wwa_data_1.WWAConsts.OBJECT_DOOR && (!this._player.hasItem(this.getObjectAttributeById(objID, wwa_data_1.WWAConsts.ATR_ITEM)) ||\n this.getObjectAttributeById(objType, wwa_data_1.WWAConsts.ATR_MODE) === wwa_data_1.WWAConsts.PASSABLE_OBJECT)) {\n this.appearParts(pos, wwa_data_1.AppearanceTriggerType.MAP);\n var messageID = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n this.setMessageQueue(message, false, false, partsID, wwa_data_1.PartsType.MAP, pos.clone());\n this.playSound(this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n return false;\n }\n return false;\n };\n WWA.prototype._execMapLocalGateEvent = function (pos, partsID, mapAttr) {\n var playerPos = this._player.getPosition().getPartsCoord();\n var jx = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_JUMP_X];\n var jy = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_JUMP_Y];\n if (jx > wwa_data_1.WWAConsts.RELATIVE_COORD_LOWER) {\n jx = pos.x + jx - wwa_data_1.WWAConsts.RELATIVE_COORD_BIAS;\n }\n if (jy > wwa_data_1.WWAConsts.RELATIVE_COORD_LOWER) {\n jy = pos.y + jy - wwa_data_1.WWAConsts.RELATIVE_COORD_BIAS;\n }\n this.appearParts(pos, wwa_data_1.AppearanceTriggerType.MAP);\n if (0 <= jx && 0 <= jy && jx < this._wwaData.mapWidth && jy < this._wwaData.mapWidth &&\n (jx !== playerPos.x || jy !== playerPos.y)) {\n this._player.jumpTo(new wwa_data_1.Position(this, jx, jy, 0, 0));\n this.playSound(this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n return true;\n }\n return false;\n };\n WWA.prototype._execMapUrlGateEvent = function (pos, partsID, mapAttr) {\n var messageID = this._wwaData.mapAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n if (!this._isURLGateEnable) {\n return true;\n }\n if (this._wwaData.message[wwa_data_1.SystemMessage1.ASK_LINK] === "BLANK") {\n location.href = util.$escapedURI(this._wwaData.message[messageID].split(/\\s/g)[0]);\n return;\n }\n this.setMessageQueue(this._wwaData.message[wwa_data_1.SystemMessage1.ASK_LINK] === "" ?\n "他のページにリンクします。\\nよろしいですか?" :\n this._wwaData.message[wwa_data_1.SystemMessage1.ASK_LINK], true, true);\n this._yesNoChoicePartsCoord = pos;\n this._yesNoChoicePartsID = partsID;\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_MAP_PARTS;\n this._yesNoURL = this._wwaData.message[messageID].split(/\\s/g)[0];\n return true;\n };\n WWA.prototype._execObjectNormalEvent = function (pos, partsID, objAttr) {\n };\n WWA.prototype._execObjectMessageEvent = function (pos, partsID, objAttr) {\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n var playerPos = this._player.getPosition().getPartsCoord();\n var soundID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND];\n if (pos.x === playerPos.x && pos.y === playerPos.y && !this._wwaData.objectNoCollapseDefaultFlag) {\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n }\n this.setMessageQueue(message, false, false, partsID, wwa_data_1.PartsType.OBJECT, pos);\n this._waitTimeInCurrentFrame += this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_NUMBER] * 100;\n this._temporaryInputDisable = true;\n this.appearParts(pos, wwa_data_1.AppearanceTriggerType.OBJECT, partsID);\n this.playSound(soundID);\n };\n WWA.prototype._execObjectStatusEvent = function (pos, partsID, objAttr) {\n var status = new wwa_data_1.Status(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_ENERGY], this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRENGTH], this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_DEFENCE], this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_GOLD]);\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n var pstatus = this._player.getStatusWithoutEquipments();\n if (status.strength > wwa_data_1.WWAConsts.STATUS_MINUS_BORDER &&\n pstatus.strength < status.strength - wwa_data_1.WWAConsts.STATUS_MINUS_BORDER ||\n status.defence > wwa_data_1.WWAConsts.STATUS_MINUS_BORDER &&\n pstatus.defence < status.defence - wwa_data_1.WWAConsts.STATUS_MINUS_BORDER ||\n status.gold > wwa_data_1.WWAConsts.STATUS_MINUS_BORDER &&\n pstatus.gold < status.gold - wwa_data_1.WWAConsts.STATUS_MINUS_BORDER) {\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n this._keyStore.allClear();\n this._mouseStore.clear();\n return;\n }\n status.energy = status.energy > wwa_data_1.WWAConsts.STATUS_MINUS_BORDER ?\n wwa_data_1.WWAConsts.STATUS_MINUS_BORDER - status.energy : status.energy;\n status.strength = status.strength > wwa_data_1.WWAConsts.STATUS_MINUS_BORDER ?\n wwa_data_1.WWAConsts.STATUS_MINUS_BORDER - status.strength : status.strength;\n status.defence = status.defence > wwa_data_1.WWAConsts.STATUS_MINUS_BORDER ?\n wwa_data_1.WWAConsts.STATUS_MINUS_BORDER - status.defence : status.defence;\n status.gold = status.gold > wwa_data_1.WWAConsts.STATUS_MINUS_BORDER ?\n wwa_data_1.WWAConsts.STATUS_MINUS_BORDER - status.gold : status.gold;\n this._player.addStatusAll(status);\n this.setStatusChangedEffect(status);\n if (this._player.isDead() && this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_ENERGY] !== 0) {\n this.gameover();\n return;\n }\n this.setMessageQueue(message, false, false, partsID, wwa_data_1.PartsType.OBJECT, pos.clone());\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n this.appearParts(pos, wwa_data_1.AppearanceTriggerType.OBJECT, partsID);\n this.playSound(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n };\n WWA.prototype._execObjectMonsterEvent = function (pos, partsID, objAttr) {\n var _this = this;\n var monsterImgCoord = new wwa_data_1.Coord(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_X], this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_Y]);\n var monsterStatus = new wwa_data_1.Status(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_ENERGY], this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRENGTH], this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_DEFENCE], this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_GOLD]);\n var monsterMessage = this._wwaData.message[this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING]];\n var monsterItemID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_ITEM];\n this._monster = new wwa_monster_1.Monster(partsID, pos, monsterImgCoord, monsterStatus, monsterMessage, monsterItemID, function () {\n _this._monsterWindow.hide();\n });\n this._player.startBattleWith(this._monster);\n };\n WWA.prototype._execObjectBuyEvent = function (pos, partsID, objAttr) {\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n var playerPos = this._player.getPosition().getPartsCoord();\n if (pos.x === playerPos.x && pos.y === playerPos.y && !this._wwaData.objectNoCollapseDefaultFlag) {\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n }\n this.setMessageQueue(message, true, false, partsID, wwa_data_1.PartsType.OBJECT, pos.clone());\n this._yesNoChoicePartsCoord = pos;\n this._yesNoChoicePartsID = partsID;\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_OBJECT_PARTS;\n this.playSound(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n };\n WWA.prototype._execObjectSellEvent = function (pos, partsID, objAttr) {\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n var playerPos = this._player.getPosition().getPartsCoord();\n if (pos.x === playerPos.x && pos.y === playerPos.y && !this._wwaData.objectNoCollapseDefaultFlag) {\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n }\n this.setMessageQueue(message, true, false, partsID, wwa_data_1.PartsType.OBJECT, pos.clone());\n this._yesNoChoicePartsCoord = pos;\n this._yesNoChoicePartsID = partsID;\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_OBJECT_PARTS;\n this.playSound(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n };\n WWA.prototype._execObjectItemEvent = function (pos, partsID, objAttr) {\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n try {\n var screenTopCoord = this._camera.getPosition().getScreenTopPosition().getPartsCoord();\n var screenXPixel = (pos.x - screenTopCoord.x) * wwa_data_1.WWAConsts.CHIP_SIZE;\n var screenYPixel = (pos.y - screenTopCoord.y) * wwa_data_1.WWAConsts.CHIP_SIZE;\n this._player.addItem(partsID, this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_NUMBER], false, this._wwaData.isItemEffectEnabled ? {\n screenPixelCoord: new wwa_data_1.Coord(screenXPixel, screenYPixel)\n } : undefined);\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n if (this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_MODE] !== 0) {\n }\n else {\n this.setMessageQueue(message, false, false, partsID, wwa_data_1.PartsType.OBJECT, pos.clone());\n this.appearParts(pos, wwa_data_1.AppearanceTriggerType.OBJECT, partsID);\n }\n }\n catch (e) {\n if (this._wwaData.systemMessage[wwa_data_1.SystemMessage2.FULL_ITEM] !== "BLANK") {\n this.setMessageQueue(this._wwaData.systemMessage[wwa_data_1.SystemMessage2.FULL_ITEM] === "" ?\n "これ以上、アイテムを持てません。" :\n this._wwaData.systemMessage[wwa_data_1.SystemMessage2.FULL_ITEM], false, true);\n }\n }\n this.playSound(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n };\n WWA.prototype._execObjectDoorEvent = function (pos, partsID, objAttr) {\n var itemID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_ITEM];\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n if (this._player.hasItem(itemID)) {\n if (this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_MODE] === 0) {\n this._player.removeItemByPartsID(itemID);\n }\n this.playSound(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n this.setMessageQueue(message, false, false, partsID, wwa_data_1.PartsType.OBJECT, pos.clone());\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n this.appearParts(pos, wwa_data_1.AppearanceTriggerType.OBJECT, partsID);\n this._paintSkipByDoorOpen = true;\n }\n };\n WWA.prototype._execObjectYesNoChoiceEvent = function (pos, partsID, objAttr) {\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var message = this._wwaData.message[messageID];\n var playerPos = this._player.getPosition().getPartsCoord();\n if (pos.x === playerPos.x && pos.y === playerPos.y && !this._wwaData.objectNoCollapseDefaultFlag) {\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n }\n this.setMessageQueue(message, true, false, partsID, wwa_data_1.PartsType.OBJECT, pos.clone());\n this._yesNoChoicePartsCoord = pos;\n this._yesNoChoicePartsID = partsID;\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_OBJECT_PARTS;\n this.playSound(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n };\n WWA.prototype._execObjectLocalGateEvent = function (pos, partsID, mapAttr) {\n var playerPos = this._player.getPosition().getPartsCoord();\n if (pos.x === playerPos.x && pos.y === playerPos.y && !this._wwaData.objectNoCollapseDefaultFlag) {\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n }\n var jx = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_JUMP_X];\n var jy = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_JUMP_Y];\n if (jx > wwa_data_1.WWAConsts.RELATIVE_COORD_LOWER) {\n jx = playerPos.x + jx - wwa_data_1.WWAConsts.RELATIVE_COORD_BIAS;\n }\n if (jy > wwa_data_1.WWAConsts.RELATIVE_COORD_LOWER) {\n jy = playerPos.y + jy - wwa_data_1.WWAConsts.RELATIVE_COORD_BIAS;\n }\n this.appearParts(pos, wwa_data_1.AppearanceTriggerType.OBJECT, partsID);\n if (0 <= jx && 0 <= jy && jx < this._wwaData.mapWidth && jy < this._wwaData.mapWidth &&\n (jx !== playerPos.x || jy !== playerPos.y)) {\n this._player.jumpTo(new wwa_data_1.Position(this, jx, jy, 0, 0));\n this.playSound(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n }\n };\n WWA.prototype._execObjectUrlGateEvent = function (pos, partsID, mapAttr) {\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n if (!this._isURLGateEnable) {\n return;\n }\n if (this._wwaData.message[wwa_data_1.SystemMessage1.ASK_LINK] === "BLANK") {\n location.href = util.$escapedURI(this._wwaData.message[messageID].split(/\\s/g)[0]);\n return;\n }\n this.setMessageQueue(this._wwaData.message[wwa_data_1.SystemMessage1.ASK_LINK] === "" ?\n "他のページにリンクします。\\nよろしいですか?" :\n this._wwaData.message[wwa_data_1.SystemMessage1.ASK_LINK], true, true);\n this._yesNoChoicePartsCoord = pos;\n this._yesNoChoicePartsID = partsID;\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.CALL_BY_OBJECT_PARTS;\n this._yesNoURL = this._wwaData.message[messageID].split(/\\s/g)[0];\n };\n WWA.prototype._execObjectScoreEvent = function (pos, partsID, mapAttr) {\n var messageID = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRING];\n var rawMessage = messageID === 0 ? "スコアを表示します。" : this._wwaData.message[messageID];\n var messageQueue = this.getMessageQueueByRawMessage(rawMessage, partsID, wwa_data_1.PartsType.OBJECT, pos);\n var existsMessage = messageQueue.reduce(function (existsMessageBefore, messageInfo) { return existsMessageBefore || !!messageInfo.message; }, false);\n if (existsMessage) {\n var score = this._player.getStatus().calculateScore({\n energy: this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_ENERGY],\n strength: this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_STRENGTH],\n defence: this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_DEFENCE],\n gold: this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_GOLD]\n });\n this._scoreWindow.update(score);\n this._scoreWindow.show();\n }\n this.setMessageQueue(rawMessage, false, false, partsID, wwa_data_1.PartsType.OBJECT, pos);\n this.playSound(this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_SOUND]);\n };\n WWA.prototype._execChoiceWindowRunningEvent = function () {\n var partsType;\n var gold;\n if (--this._yesNoDispCounter === 0) {\n if (this._yesNoJudge === wwa_data_1.YesNoState.YES) {\n if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_MAP_PARTS) {\n partsType = this._wwaData.mapAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_TYPE];\n if (partsType === wwa_data_1.WWAConsts.MAP_URLGATE) {\n location.href = util.$escapedURI(this._yesNoURL);\n }\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_OBJECT_PARTS) {\n partsType = this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_TYPE];\n if (partsType === wwa_data_1.WWAConsts.OBJECT_BUY) {\n if (this._player.hasItem(this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_ITEM])) {\n this._player.removeItemByPartsID(this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_ITEM]);\n gold = this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_GOLD];\n this._player.earnGold(gold);\n this.setStatusChangedEffect(new wwa_data_1.Status(0, 0, 0, gold));\n this.appearParts(this._yesNoChoicePartsCoord, wwa_data_1.AppearanceTriggerType.OBJECT, this._yesNoChoicePartsID);\n }\n else {\n if (this._wwaData.message[wwa_data_1.SystemMessage1.NO_ITEM] !== "BLANK") {\n this._messageQueue.push(new wwa_message_1.MessageInfo(this._wwaData.message[wwa_data_1.SystemMessage1.NO_ITEM] === "" ?\n "アイテムを持っていない。" : this._wwaData.message[wwa_data_1.SystemMessage1.NO_ITEM], true));\n }\n ;\n }\n }\n else if (partsType === wwa_data_1.WWAConsts.OBJECT_SELL) {\n if (this._player.hasGold(this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_GOLD])) {\n if (this._player.canHaveMoreItems() || this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_ITEM] === 0) {\n if (this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_ITEM] !== 0) {\n var pos = this._yesNoChoicePartsCoord;\n var screenTopCoord = this._camera.getPosition().getScreenTopPosition().getPartsCoord();\n var screenXPixel = (pos.x - screenTopCoord.x) * wwa_data_1.WWAConsts.CHIP_SIZE;\n var screenYPixel = (pos.y - screenTopCoord.y) * wwa_data_1.WWAConsts.CHIP_SIZE;\n this._player.addItem(this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_ITEM], 0, false, this._wwaData.isItemEffectEnabled ? {\n screenPixelCoord: new wwa_data_1.Coord(screenXPixel, screenYPixel)\n } : undefined);\n }\n var status = new wwa_data_1.Status(this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_ENERGY], this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_STRENGTH], this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_DEFENCE], -this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_GOLD]);\n var pstatus = this._player.getStatusWithoutEquipments();\n status.energy = status.energy > wwa_data_1.WWAConsts.STATUS_MINUS_BORDER ?\n wwa_data_1.WWAConsts.STATUS_MINUS_BORDER - status.energy : status.energy;\n this.setStatusChangedEffect(status);\n this._player.addStatusAll(status);\n if (this._player.isDead() && this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_ENERGY] !== 0) {\n this.gameover();\n return;\n }\n this.appearParts(this._yesNoChoicePartsCoord, wwa_data_1.AppearanceTriggerType.OBJECT, this._yesNoChoicePartsID);\n }\n else {\n if (this._wwaData.systemMessage[wwa_data_1.SystemMessage2.FULL_ITEM] !== "BLANK") {\n this._messageQueue.push(new wwa_message_1.MessageInfo(this._wwaData.systemMessage[wwa_data_1.SystemMessage2.FULL_ITEM] === "" ?\n "これ以上、アイテムを持てません。" : this._wwaData.systemMessage[wwa_data_1.SystemMessage2.FULL_ITEM], true));\n }\n }\n }\n else {\n if (this._wwaData.message[wwa_data_1.SystemMessage1.NO_MONEY] !== "BLANK") {\n this._messageQueue.push(new wwa_message_1.MessageInfo(this._wwaData.message[wwa_data_1.SystemMessage1.NO_MONEY] === "" ?\n "所持金がたりない。" : this._wwaData.message[wwa_data_1.SystemMessage1.NO_MONEY], true));\n }\n }\n }\n else if (partsType === wwa_data_1.WWAConsts.OBJECT_SELECT) {\n this.appearParts(this._yesNoChoicePartsCoord, wwa_data_1.AppearanceTriggerType.CHOICE_YES, this._yesNoChoicePartsID);\n }\n else if (partsType === wwa_data_1.WWAConsts.OBJECT_URLGATE) {\n location.href = util.$escapedURI(this._yesNoURL);\n }\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_ITEM_USE) {\n this._player.readyToUseItem(this._yesNoUseItemPos);\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_QUICK_LOAD) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.QUICK_LOAD])).classList.remove("onpress");\n this._stopUpdateByLoadFlag = true;\n this._loadType = wwa_data_1.LoadType.QUICK_LOAD;\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_QUICK_SAVE) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.QUICK_SAVE])).classList.remove("onpress");\n this._quickSave();\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_RESTART_GAME) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.RESTART_GAME])).classList.remove("onpress");\n this._stopUpdateByLoadFlag = true;\n this._loadType = wwa_data_1.LoadType.RESTART_GAME;\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_GOTO_WWA) {\n location.href = util.$escapedURI(wwa_data_1.WWAConsts.WWA_HOME);\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.GOTO_WWA])).classList.remove("onpress");\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_PASSWORD_LOAD) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.QUICK_LOAD])).classList.remove("onpress");\n this._player.setPasswordWindowWating();\n this._passwordWindow.show(wwa_password_window_1.Mode.LOAD);\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_PASSWORD_SAVE) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.QUICK_SAVE])).classList.remove("onpress");\n this._player.setPasswordWindowWating();\n this._passwordWindow.password = this._quickSave(true);\n this._passwordWindow.show(wwa_password_window_1.Mode.SAVE);\n }\n this._yesNoJudge = wwa_data_1.YesNoState.UNSELECTED;\n this._setNextMessage();\n this._yesNoChoicePartsCoord = void 0;\n this._yesNoChoicePartsID = void 0;\n this._yesNoUseItemPos = void 0;\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.NONE;\n this._messageWindow.setYesNoChoice(false);\n }\n else if (this._yesNoJudge === wwa_data_1.YesNoState.NO) {\n if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_MAP_PARTS) {\n partsType = this._wwaData.mapAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_TYPE];\n if (partsType === wwa_data_1.WWAConsts.MAP_URLGATE) {\n }\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_OBJECT_PARTS) {\n partsType = this._wwaData.objectAttribute[this._yesNoChoicePartsID][wwa_data_1.WWAConsts.ATR_TYPE];\n if (partsType === wwa_data_1.WWAConsts.OBJECT_BUY) {\n }\n else if (partsType === wwa_data_1.WWAConsts.OBJECT_SELL) {\n }\n else if (partsType === wwa_data_1.WWAConsts.OBJECT_SELECT) {\n this.appearParts(this._yesNoChoicePartsCoord, wwa_data_1.AppearanceTriggerType.CHOICE_NO, this._yesNoChoicePartsID);\n }\n else if (partsType === wwa_data_1.WWAConsts.OBJECT_URLGATE) {\n }\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_ITEM_USE) {\n var bg = (util.$id("item" + (this._yesNoUseItemPos - 1)));\n bg.classList.remove("onpress");\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_QUICK_LOAD) {\n this._yesNoJudge = wwa_data_1.YesNoState.UNSELECTED;\n this.onpasswordloadcalled();\n return;\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_QUICK_SAVE) {\n this._yesNoJudge = wwa_data_1.YesNoState.UNSELECTED;\n this.onpasswordsavecalled();\n return;\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_RESTART_GAME) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.RESTART_GAME])).classList.remove("onpress");\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_GOTO_WWA) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.GOTO_WWA])).classList.remove("onpress");\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_PASSWORD_LOAD) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.QUICK_LOAD])).classList.remove("onpress");\n }\n else if (this._yesNoChoiceCallInfo === wwa_data_1.ChoiceCallInfo.CALL_BY_PASSWORD_SAVE) {\n (util.$id(wwa_data_1.sidebarButtonCellElementID[wwa_data_1.SidebarButton.QUICK_SAVE])).classList.remove("onpress");\n }\n this._yesNoJudge = wwa_data_1.YesNoState.UNSELECTED;\n this._setNextMessage();\n this._yesNoChoicePartsCoord = void 0;\n this._yesNoChoicePartsID = void 0;\n this._yesNoUseItemPos = void 0;\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.NONE;\n this._messageWindow.setYesNoChoice(false);\n }\n }\n };\n WWA.prototype.setMessageQueue = function (message, showChoice, isSystemMessage, partsID, partsType, partsPosition, messageDisplayed) {\n if (partsID === void 0) { partsID = 0; }\n if (partsType === void 0) { partsType = wwa_data_1.PartsType.OBJECT; }\n if (partsPosition === void 0) { partsPosition = new wwa_data_1.Coord(0, 0); }\n if (messageDisplayed === void 0) { messageDisplayed = false; }\n this._messageQueue = this._messageQueue.concat(this.getMessageQueueByRawMessage(message, partsID, partsType, partsPosition));\n if (this._lastMessage.isEndOfPartsEvent && this._reservedMoveMacroTurn !== void 0) {\n this._player.setMoveMacroWaiting(this._reservedMoveMacroTurn);\n this._reservedMoveMacroTurn = void 0;\n }\n if (this._messageQueue.length !== 0) {\n var topmes = this._messageQueue.shift();\n for (var i = 0; i < topmes.macro.length; i++) {\n this._execMacroListInNextFrame.push(topmes.macro[i]);\n }\n this._lastMessage = topmes;\n if (topmes.message !== "") {\n this._messageWindow.setMessage(topmes.message);\n this._messageWindow.setYesNoChoice(showChoice);\n this._messageWindow.setPositionByPlayerPosition(this._faces.length !== 0, this._scoreWindow.isVisible(), isSystemMessage, this._player.getPosition(), this._camera.getPosition());\n this._player.setMessageWaiting();\n return true;\n }\n else {\n if (this._messageQueue.length === 0) {\n this._hideMessageWindow(messageDisplayed);\n }\n else {\n this._setNextMessage();\n }\n }\n }\n return false;\n };\n WWA.prototype.getMessageQueueByRawMessage = function (message, partsID, partsType, partsPosition, isSystemMessage) {\n if (isSystemMessage === void 0) { isSystemMessage = false; }\n var messageMain = message\n .split(/\\n\\<c\\>/i)[0]\n .split(/\\<c\\>/i)[0]\n .replace(/\\n\\<p\\>\\n/ig, "<P>")\n .replace(/\\n\\<p\\>/ig, "<P>")\n .replace(/\\<p\\>\\n/ig, "<P>")\n .replace(/\\<p\\>/ig, "<P>");\n var messageQueue = [];\n if (messageMain !== "") {\n var rawQueue = messageMain.split(/\\<p\\>/ig);\n for (var j = 0; j < rawQueue.length; j++) {\n var lines = rawQueue[j].split("\\n");\n var linesWithoutMacro = [];\n var macroQueue = [];\n for (var i = 0; i < lines.length; i++) {\n var matchInfo = lines[i].match(/(\\$(?:[a-zA-Z_][a-zA-Z0-9_]*)\\=(?:.*))/);\n if (matchInfo !== null && matchInfo.length >= 2) {\n var macro = wwa_message_1.parseMacro(this, partsID, partsType, partsPosition, matchInfo[1]);\n macroQueue.push(macro);\n }\n else if (!lines[i].match(/^\\$/)) {\n linesWithoutMacro.push(lines[i]);\n }\n }\n messageQueue.push(new wwa_message_1.MessageInfo(linesWithoutMacro.join("\\n"), isSystemMessage, j === rawQueue.length - 1, macroQueue));\n }\n }\n return messageQueue;\n };\n WWA.prototype.appearParts = function (pos, triggerType, triggerPartsID) {\n if (triggerPartsID === void 0) { triggerPartsID = 0; }\n var triggerPartsType;\n var rangeMin = (triggerType === wwa_data_1.AppearanceTriggerType.CHOICE_NO) ?\n wwa_data_1.WWAConsts.APPERANCE_PARTS_MIN_INDEX_NO : wwa_data_1.WWAConsts.APPERANCE_PARTS_MIN_INDEX;\n var rangeMax = (triggerType === wwa_data_1.AppearanceTriggerType.CHOICE_YES) ?\n wwa_data_1.WWAConsts.APPERANCE_PARTS_MAX_INDEX_YES : wwa_data_1.WWAConsts.APPERANCE_PARTS_MAX_INDEX;\n var targetPartsID;\n var targetPartsType;\n var targetX;\n var targetY;\n var targetPos;\n var i;\n if (triggerType === wwa_data_1.AppearanceTriggerType.MAP) {\n triggerPartsID = (triggerPartsID === 0) ? this._wwaData.map[pos.y][pos.x] : triggerPartsID;\n triggerPartsType = wwa_data_1.PartsType.MAP;\n }\n else {\n triggerPartsID = (triggerPartsID === 0) ? this._wwaData.mapObject[pos.y][pos.x] : triggerPartsID;\n triggerPartsType = wwa_data_1.PartsType.OBJECT;\n }\n for (i = rangeMin; i <= rangeMax; i++) {\n var base = wwa_data_1.WWAConsts.ATR_APPERANCE_BASE + i * wwa_data_1.WWAConsts.REL_ATR_APPERANCE_UNIT_LENGTH;\n var idxID = base + wwa_data_1.WWAConsts.REL_ATR_APPERANCE_ID;\n var idxX = base + wwa_data_1.WWAConsts.REL_ATR_APPERANCE_X;\n var idxY = base + wwa_data_1.WWAConsts.REL_ATR_APPERANCE_Y;\n var idxType = base + wwa_data_1.WWAConsts.REL_ATR_APPERANCE_TYPE;\n targetPartsID = (triggerPartsType === wwa_data_1.PartsType.MAP) ?\n this._wwaData.mapAttribute[triggerPartsID][idxID] :\n this._wwaData.objectAttribute[triggerPartsID][idxID];\n targetPartsType = (triggerPartsType === wwa_data_1.PartsType.MAP) ?\n this._wwaData.mapAttribute[triggerPartsID][idxType] :\n this._wwaData.objectAttribute[triggerPartsID][idxType];\n targetX = (triggerPartsType === wwa_data_1.PartsType.MAP) ?\n this._wwaData.mapAttribute[triggerPartsID][idxX] :\n this._wwaData.objectAttribute[triggerPartsID][idxX];\n targetY = (triggerPartsType === wwa_data_1.PartsType.MAP) ?\n this._wwaData.mapAttribute[triggerPartsID][idxY] :\n this._wwaData.objectAttribute[triggerPartsID][idxY];\n if (targetX === wwa_data_1.WWAConsts.PLAYER_COORD) {\n targetX = this._player.getPosition().getPartsCoord().x;\n this._player.resetEventExecutionInfo();\n }\n else if (targetX > wwa_data_1.WWAConsts.RELATIVE_COORD_LOWER) {\n targetX = pos.x + targetX - wwa_data_1.WWAConsts.RELATIVE_COORD_BIAS;\n }\n if (targetY === wwa_data_1.WWAConsts.PLAYER_COORD) {\n targetY = this._player.getPosition().getPartsCoord().y;\n this._player.resetEventExecutionInfo();\n }\n else if (targetY > wwa_data_1.WWAConsts.RELATIVE_COORD_LOWER) {\n targetY = pos.y + targetY - wwa_data_1.WWAConsts.RELATIVE_COORD_BIAS;\n }\n if (targetX === 0 && targetY === 0) {\n continue;\n }\n try {\n targetPos = new wwa_data_1.Position(this, targetX, targetY, 0, 0);\n if (targetPartsType === wwa_data_1.PartsType.MAP) {\n if (targetPartsID >= this._wwaData.mapPartsMax) {\n throw new Error("背景パーツの範囲外IDが指定されました");\n }\n this._wwaData.map[targetY][targetX] = targetPartsID;\n }\n else {\n if (targetPartsID >= this._wwaData.objPartsMax) {\n throw new Error("物体パーツの範囲外IDが指定されました");\n }\n this._wwaData.mapObject[targetY][targetX] = targetPartsID;\n this._replaceRandomObject(new wwa_data_1.Coord(targetX, targetY));\n if (targetX === this._player.getPosition().getPartsCoord().x &&\n targetY === this._player.getPosition().getPartsCoord().y) {\n this._player.setPartsAppearedFlag();\n }\n }\n }\n catch (e) {\n }\n }\n };\n WWA.prototype.appearPartsByDirection = function (distance, targetPartsID, targetPartsType) {\n var ppos = this._player.getPosition().getPartsCoord();\n var pdir = this._player.getDir();\n var signX = wwa_data_1.vx[pdir];\n var signY = wwa_data_1.vy[pdir];\n this.appearPartsEval(ppos, (signX >= 0 ? "+" : "-") + (Math.abs(signX) * distance), (signY >= 0 ? "+" : "-") + (Math.abs(signY) * distance), targetPartsID, targetPartsType);\n };\n WWA.prototype.appearPartsEval = function (triggerPartsPos, xstr, ystr, targetPartsID, targetPartsType) {\n var targetX;\n var targetY;\n var ppos = this._player.getPosition().getPartsCoord();\n if (xstr === "P" || xstr === "p") {\n targetX = ppos.x;\n }\n else if (xstr[0] === "+") {\n targetX = triggerPartsPos.x + parseInt(xstr.substr(1));\n }\n else if (xstr[0] === "-") {\n targetX = triggerPartsPos.x - parseInt(xstr.substr(1));\n }\n else {\n targetX = parseInt(xstr);\n if (isNaN(targetX)) {\n throw new Error("座標として解釈できない文字が含まれています。");\n }\n }\n if (ystr === "P" || ystr === "p") {\n targetY = ppos.y;\n }\n else if (ystr[0] === "+") {\n targetY = triggerPartsPos.y + parseInt(ystr.substr(1));\n }\n else if (ystr[0] === "-") {\n targetY = triggerPartsPos.y - parseInt(ystr.substr(1));\n }\n else {\n targetY = parseInt(ystr);\n if (isNaN(targetY)) {\n throw new Error("座標として解釈できない文字が含まれています。");\n }\n }\n try {\n var targetPos = new wwa_data_1.Position(this, targetX, targetY, 0, 0);\n if (targetPartsType === wwa_data_1.PartsType.MAP) {\n if (targetPartsID >= this._wwaData.mapPartsMax) {\n throw new Error("背景パーツの範囲外IDが指定されました");\n }\n this._wwaData.map[targetY][targetX] = targetPartsID;\n }\n else {\n if (targetPartsID >= this._wwaData.objPartsMax) {\n throw new Error("物体パーツの範囲外IDが指定されました");\n }\n this._wwaData.mapObject[targetY][targetX] = targetPartsID;\n this._replaceRandomObject(new wwa_data_1.Coord(targetX, targetY));\n if (targetX === this._player.getPosition().getPartsCoord().x &&\n targetY === this._player.getPosition().getPartsCoord().y) {\n this._player.setPartsAppearedFlag();\n }\n }\n }\n catch (e) {\n }\n };\n WWA.prototype._replaceRandomObject = function (pos) {\n var id = this._wwaData.mapObject[pos.y][pos.x];\n var type = this._wwaData.objectAttribute[id][wwa_data_1.WWAConsts.ATR_TYPE];\n var newId;\n var randv;\n if (type !== wwa_data_1.WWAConsts.OBJECT_RANDOM) {\n return;\n }\n for (var i = 0; i < wwa_data_1.WWAConsts.RANDOM_ITERATION_MAX; i++) {\n randv = Math.floor(Math.random() * 10);\n newId = this._wwaData.objectAttribute[id][wwa_data_1.WWAConsts.ATR_RANDOM_BASE + randv];\n if (newId >= this._wwaData.objPartsMax) {\n newId = 0;\n break;\n }\n if (this._wwaData.objectAttribute[newId][wwa_data_1.WWAConsts.ATR_TYPE] !== wwa_data_1.WWAConsts.OBJECT_RANDOM) {\n break;\n }\n id = newId;\n }\n this._wwaData.mapObject[pos.y][pos.x] = newId;\n };\n WWA.prototype._replaceRandomObjectsInScreen = function () {\n var camPos = this._camera.getPosition().getPartsCoord();\n var xLeft = Math.max(0, camPos.x - 1);\n var xRight = Math.min(this._wwaData.mapWidth - 1, camPos.x + wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW);\n var yTop = Math.max(0, camPos.y - 1);\n var yBottom = Math.min(this._wwaData.mapWidth - 1, camPos.y + wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW);\n for (var x = xLeft; x <= xRight; x++) {\n for (var y = yTop; y <= yBottom; y++) {\n this._replaceRandomObject(new wwa_data_1.Coord(x, y));\n }\n }\n };\n WWA.prototype._replaceAllRandomObjects = function () {\n for (var x = 0; x < this._wwaData.mapWidth; x++) {\n for (var y = 0; y < this._wwaData.mapWidth; y++) {\n this._replaceRandomObject(new wwa_data_1.Coord(x, y));\n }\n }\n };\n WWA.prototype.gameover = function () {\n var jx = this._wwaData.gameoverX;\n var jy = this._wwaData.gameoverY;\n if (this._messageWindow.isVisible()) {\n this._yesNoJudge = wwa_data_1.YesNoState.UNSELECTED;\n this._messageQueue = [];\n this._messageWindow.hide();\n this._yesNoChoicePartsCoord = void 0;\n this._yesNoChoicePartsID = void 0;\n this._yesNoUseItemPos = void 0;\n this._yesNoChoiceCallInfo = wwa_data_1.ChoiceCallInfo.NONE;\n this._messageWindow.setYesNoChoice(false);\n }\n this._waitTimeInCurrentFrame = wwa_data_1.WWAConsts.GAMEOVER_FRAME_INTERVAL;\n this._temporaryInputDisable = true;\n this._player.jumpTo(new wwa_data_1.Position(this, jx, jy, 0, 0));\n };\n WWA.prototype.setYesNoInput = function (yesNo) {\n this._yesNoJudgeInNextFrame = yesNo;\n };\n WWA.prototype.getYesNoState = function () {\n if (this._yesNoJudgeInNextFrame !== void 0) {\n return this._yesNoJudgeInNextFrame;\n }\n return this._yesNoJudge;\n };\n WWA.prototype.setStatusChangedEffect = function (additionalStatus) {\n if (!this._wwaData.isItemEffectEnabled) {\n return;\n }\n if (additionalStatus.strength !== 0) {\n util.$id("disp-strength").classList.add("onpress");\n this._statusPressCounter.strength = wwa_data_1.WWAConsts.STATUS_CHANGED_EFFECT_FRAME_NUM;\n }\n if (additionalStatus.defence !== 0) {\n util.$id("disp-defence").classList.add("onpress");\n this._statusPressCounter.defence = wwa_data_1.WWAConsts.STATUS_CHANGED_EFFECT_FRAME_NUM;\n }\n if (additionalStatus instanceof wwa_data_1.Status) {\n if (additionalStatus.energy !== 0) {\n util.$id("disp-energy").classList.add("onpress");\n this._statusPressCounter.energy = wwa_data_1.WWAConsts.STATUS_CHANGED_EFFECT_FRAME_NUM;\n }\n if (additionalStatus.gold !== 0) {\n util.$id("disp-gold").classList.add("onpress");\n this._statusPressCounter.gold = wwa_data_1.WWAConsts.STATUS_CHANGED_EFFECT_FRAME_NUM;\n }\n }\n };\n WWA.prototype.setPartsOnPosition = function (partsType, id, pos) {\n if (partsType === wwa_data_1.PartsType.MAP) {\n if (id >= this._wwaData.mapPartsMax) {\n this._wwaData.map[pos.y][pos.x] = 0;\n }\n this._wwaData.map[pos.y][pos.x] = id;\n }\n else {\n if (id >= this._wwaData.objPartsMax) {\n this._wwaData.mapObject[pos.y][pos.x] = 0;\n }\n this._wwaData.mapObject[pos.y][pos.x] = id;\n }\n };\n WWA.prototype._countSamePartsLength = function (data, startPos) {\n var i;\n for (i = startPos + 1; i < data.length; i++) {\n if (data[i] !== data[i - 1]) {\n break;\n }\n }\n return i - startPos;\n };\n WWA.prototype._compressMap = function (map) {\n var dest = [];\n for (var y = 0; y < map.length; y++) {\n dest[y] = [];\n for (var x = 0; x < map[y].length;) {\n var len = this._countSamePartsLength(map[y], x);\n dest[y].push([map[y][x], len]);\n x += (len);\n }\n }\n return dest;\n };\n WWA.prototype._decompressMap = function (compressedMap) {\n var dest = [];\n var x;\n for (var y = 0; y < compressedMap.length; y++) {\n dest[y] = [];\n x = 0;\n for (var i = 0; i < compressedMap[y].length; i++) {\n var len = compressedMap[y][i][1];\n for (var j = 0; j < len; j++) {\n dest[y].push(compressedMap[y][i][0]);\n }\n }\n }\n return dest;\n };\n WWA.prototype._generateMapDataHash = function (data) {\n var text = "A";\n var len = 0;\n var x = 0;\n var y = 0;\n for (y = 0; y < data.map.length; y++) {\n for (x = 0; x < data.map[y].length;) {\n len = this._countSamePartsLength(data.map[y], x);\n text += (data.map[y][x] + "|" + len + "/");\n x += (len);\n }\n for (x = 0; x < data.mapObject[y].length;) {\n len = this._countSamePartsLength(data.mapObject[y], x);\n text += (data.mapObject[y][x] + "|" + len + "/");\n x += (len);\n }\n }\n for (var mapi = 0; mapi < data.mapAttribute.length; mapi++) {\n for (var mapatri = 0; mapatri < data.mapAttribute[mapi].length; mapatri++) {\n text += data.mapAttribute[mapi][mapatri] + "/";\n }\n }\n for (var obji = 0; obji < data.objectAttribute.length; obji++) {\n for (var objatri = 0; objatri < data.objectAttribute[obji].length; objatri++) {\n text += data.objectAttribute[obji][objatri] + "/";\n }\n }\n text += "Z";\n return CryptoJS.MD5(text).toString();\n };\n WWA.prototype._generateSaveDataHash = function (data) {\n var maphash = this._generateMapDataHash(data);\n var text = maphash;\n var keyArray = [];\n for (var key in data) {\n if (key === "map" || key === "mapObject" ||\n key === "mapCompressed" || key === "mapObjectCompressed" ||\n key === "mapAttribute" || key === "objectAttribute" ||\n key === "checkString") {\n continue;\n }\n keyArray.push(key);\n }\n keyArray.sort();\n for (var i = 0; i < keyArray.length; i++) {\n text += util.arr2str4save(data[keyArray[i]]);\n }\n return CryptoJS.MD5(text).toString();\n };\n WWA.prototype._quickSave = function (isPassword) {\n if (isPassword === void 0) { isPassword = false; }\n var qd = JSON.parse(JSON.stringify(this._wwaData));\n var pc = this._player.getPosition().getPartsCoord();\n var st = this._player.getStatusWithoutEquipments();\n qd.itemBox = this._player.getCopyOfItemBox();\n qd.playerX = pc.x;\n qd.playerY = pc.y;\n qd.statusEnergyMax = this._player.getEnergyMax();\n qd.statusEnergy = st.energy;\n qd.statusStrength = st.strength;\n qd.statusDefence = st.defence;\n qd.statusGold = st.gold;\n qd.moves = this._player.getMoveCount();\n if (isPassword) {\n qd.checkOriginalMapString = this._generateMapDataHash(this._restartData);\n qd.mapCompressed = this._compressMap(qd.map);\n qd.mapObjectCompressed = this._compressMap(qd.mapObject);\n qd.checkString = this._generateSaveDataHash(qd);\n qd.map = void 0;\n qd.mapObject = void 0;\n }\n qd.message = void 0;\n qd.mapAttribute = void 0;\n qd.objectAttribute = void 0;\n if (isPassword) {\n var s = JSON.stringify(qd);\n return CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(s), "^ /" + (this._wwaData.worldPassNumber * 231 + 8310 + qd.checkOriginalMapString) + "P+>A[]").toString();\n }\n this._quickSaveData = qd;\n util.$id("cell-load").textContent = "Quick Load";\n return "";\n };\n WWA.prototype._decodePassword = function (pass) {\n var ori = this._generateMapDataHash(this._restartData);\n try {\n var json = CryptoJS.AES.decrypt(pass, "^ /" + (this._wwaData.worldPassNumber * 231 + 8310 + ori) + "P+>A[]").toString(CryptoJS.enc.Utf8);\n }\n catch (e) {\n throw new Error("データが破損しています。\\n" + e.message);\n }\n var obj;\n try {\n obj = JSON.parse(json);\n }\n catch (e) {\n throw new Error("マップデータ以外のものが暗号化されたか、マップデータに何かが不足しているようです。\\nJSON PARSE FAILED");\n }\n return obj;\n };\n WWA.prototype._quickLoad = function (restart, password, apply) {\n if (restart === void 0) { restart = false; }\n if (password === void 0) { password = null; }\n if (apply === void 0) { apply = true; }\n if (!restart && this._quickSaveData === void 0 && password === null) {\n throw new Error("セーブデータがありません。");\n }\n var newData;\n if (password !== null) {\n newData = this._decodePassword(password);\n }\n else {\n newData = JSON.parse(JSON.stringify(restart ? this._restartData : this._quickSaveData));\n }\n newData.message = JSON.parse(JSON.stringify(this._restartData.message));\n newData.mapAttribute = JSON.parse(JSON.stringify(this._restartData.mapAttribute));\n newData.objectAttribute = JSON.parse(JSON.stringify(this._restartData.objectAttribute));\n if (newData.map === void 0) {\n newData.map = this._decompressMap(newData.mapCompressed);\n newData.mapCompressed = void 0;\n }\n if (newData.mapObject === void 0) {\n newData.mapObject = this._decompressMap(newData.mapObjectCompressed);\n newData.mapObjectCompressed = void 0;\n }\n if (password !== null) {\n var checkString = this._generateSaveDataHash(newData);\n if (newData.checkString !== checkString) {\n throw new Error("データが壊れているようです。\\nInvalid hash (ALL DATA)= " + newData.checkString + " " + this._generateSaveDataHash(newData));\n }\n var checkOriginalMapString = this._generateMapDataHash(this._restartData);\n if (newData.checkOriginalMapString !== checkOriginalMapString) {\n throw new Error("管理者によってマップが変更されたようです。\\nInvalid hash (ORIGINAL MAP)= " + newData.checkString + " " + this._generateSaveDataHash(newData));\n }\n console.log("Valid Password!");\n }\n if (apply) {\n this._applyQuickLoad(newData);\n }\n return newData;\n };\n WWA.prototype._applyQuickLoad = function (newData) {\n this._player.setEnergyMax(newData.statusEnergyMax);\n this._player.setEnergy(newData.statusEnergy);\n this._player.setStrength(newData.statusStrength);\n this._player.setDefence(newData.statusDefence);\n this._player.setGold(newData.statusGold);\n this._player.setMoveCount(newData.moves);\n this._player.clearItemBox();\n for (var i = 0; i < newData.itemBox.length; i++) {\n this._player.addItem(newData.itemBox[i], i + 1, true);\n }\n this._player.systemJumpTo(new wwa_data_1.Position(this, newData.playerX, newData.playerY, 0, 0));\n if (newData.bgm === 0) {\n this.playSound(wwa_data_1.SystemSound.NO_SOUND);\n }\n else {\n this.playSound(newData.bgm);\n }\n this.setImgClick(new wwa_data_1.Coord(newData.imgClickX, newData.imgClickY));\n if (this.getObjectIdByPosition(this._player.getPosition()) !== 0) {\n this._player.setPartsAppearedFlag();\n }\n this._wwaData = newData;\n this._replaceAllRandomObjects();\n this.updateCSSRule();\n };\n WWA.prototype._restartGame = function () {\n this._quickLoad(true);\n };\n WWA.prototype._fadeout = function (callback) {\n var borderWidth = 0;\n var size = wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH;\n var v = wwa_data_1.WWAConsts.FADEOUT_SPEED;\n var elm = util.$id("wwa-fader");\n elm.style.display = "block";\n var timer = setInterval(function () {\n borderWidth += v;\n size -= v * 2;\n if (size <= 0 || borderWidth * 2 > wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH) {\n elm.removeAttribute("style");\n elm.style.display = "block";\n elm.style.borderWidth = "0";\n elm.style.width = wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH + "px";\n elm.style.height = wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT + "px";\n elm.style.backgroundColor = "#808080";\n clearInterval(timer);\n callback();\n return;\n }\n elm.style.width = size + "px";\n elm.style.height = size + "px";\n elm.style.borderWidth = borderWidth + "px";\n }, 20);\n };\n WWA.prototype.moveObjects = function (playerIsMoving) {\n var camPos = this._camera.getPosition();\n var pPos = this._player.getPosition();\n var camCoord = camPos.getPartsCoord();\n var leftX = camPos.getPartsCoord().x;\n var topY = camPos.getPartsCoord().y;\n var objectsInNextFrame;\n var localX, localY;\n if (this.getMapAttributeByPosition(this._player.getPosition(), wwa_data_1.WWAConsts.ATR_TYPE) === wwa_data_1.WWAConsts.MAP_LOCALGATE ||\n this.getObjectAttributeByPosition(this._player.getPosition(), wwa_data_1.WWAConsts.ATR_TYPE) === wwa_data_1.WWAConsts.OBJECT_LOCALGATE) {\n return;\n }\n objectsInNextFrame = new Array(wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW + 2);\n this.hoge = new Array(wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW + 2);\n for (localY = -1; localY <= wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW; localY++) {\n objectsInNextFrame[localY + 1] = new Array(wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW + 2);\n this.hoge[localY + 1] = new Array(wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW + 2);\n for (localX = -1; localX <= wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW; localX++) {\n if (topY + localY < 0 || topY + localY >= this._wwaData.mapWidth ||\n leftX + localX < 0 || leftX + localX >= this._wwaData.mapWidth) {\n objectsInNextFrame[localY + 1][localX + 1] = 0;\n this.hoge[localY + 1][localX + 1] = 0;\n continue;\n }\n try {\n var pos = new wwa_data_1.Position(this, leftX + localX, topY + localY, 0, 0);\n var posc = pos.getPartsCoord();\n }\n catch (e) {\n objectsInNextFrame[localY + 1][localX + 1] = 0;\n this.hoge[localY + 1][localX + 1] = 0;\n continue;\n }\n var objID = this._wwaData.mapObject[posc.y][posc.x];\n objectsInNextFrame[localY + 1][localX + 1] = this._wwaData.mapObject[posc.y][posc.x];\n this.hoge[localY + 1][localX + 1] = -this._wwaData.mapObject[posc.y][posc.x];\n }\n }\n for (localX = -1; localX <= wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW; localX++) {\n if (leftX + localX < 0 || leftX + localX >= this._wwaData.mapWidth) {\n continue;\n }\n for (localY = -1; localY <= wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW; localY++) {\n if (topY + localY < 0 || topY + localY >= this._wwaData.mapWidth) {\n continue;\n }\n try {\n var pos = new wwa_data_1.Position(this, leftX + localX, topY + localY, 0, 0);\n var posc = pos.getPartsCoord();\n }\n catch (e) {\n continue;\n }\n var partsID = this._wwaData.mapObject[posc.y][posc.x];\n if (partsID === 0 ||\n this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_TYPE] === wwa_data_1.WWAConsts.OBJECT_LOCALGATE ||\n this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_TYPE] === wwa_data_1.WWAConsts.OBJECT_RANDOM) {\n continue;\n }\n if (this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_MOVE] !== wwa_data_1.MoveType.CHASE_PLAYER &&\n this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_MOVE] !== wwa_data_1.MoveType.RUN_OUT &&\n this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_MOVE] !== wwa_data_1.MoveType.HANG_AROUND) {\n continue;\n }\n var moveMode = this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_MOVE];\n if (moveMode !== wwa_data_1.MoveType.HANG_AROUND) {\n var candCoord = this._getCandidateCoord(playerIsMoving, pos, moveMode);\n var xCand = new wwa_data_1.Coord(candCoord.x, posc.y);\n var yCand = new wwa_data_1.Coord(posc.x, candCoord.y);\n var thirdCand = null;\n var randomCand;\n if (this._objectCanMoveTo(playerIsMoving, candCoord, objectsInNextFrame)) {\n this._setObjectsInNextFrame(posc, candCoord, leftX, topY, objectsInNextFrame, partsID);\n }\n else {\n var mode = this._getSecondCandidateMoveMode(playerIsMoving, posc, candCoord, xCand, yCand, this._wwaData.objectAttribute[partsID][wwa_data_1.WWAConsts.ATR_TYPE] === wwa_data_1.WWAConsts.OBJECT_MONSTER, objectsInNextFrame);\n if (mode === wwa_data_1.SecondCandidateMoveType.MODE_X) {\n this._setObjectsInNextFrame(posc, xCand, leftX, topY, objectsInNextFrame, partsID);\n }\n else if (mode === wwa_data_1.SecondCandidateMoveType.MODE_Y) {\n this._setObjectsInNextFrame(posc, yCand, leftX, topY, objectsInNextFrame, partsID);\n }\n else {\n thirdCand = this._getThirdCandidate(playerIsMoving, pos, candCoord, moveMode, objectsInNextFrame);\n if (thirdCand !== null && this._wwaData.version >= 31) {\n this._setObjectsInNextFrame(posc, thirdCand, leftX, topY, objectsInNextFrame, partsID);\n }\n else {\n randomCand = this._getRandomMoveCoord(playerIsMoving, pos, objectsInNextFrame);\n this._setObjectsInNextFrame(posc, randomCand, leftX, topY, objectsInNextFrame, partsID);\n }\n }\n }\n }\n else {\n randomCand = this._getRandomMoveCoord(playerIsMoving, pos, objectsInNextFrame);\n this._setObjectsInNextFrame(posc, randomCand, leftX, topY, objectsInNextFrame, partsID);\n }\n }\n }\n };\n WWA.prototype._getCandidateCoord = function (playerIsMoving, currentPos, moveType) {\n var currentCoord = currentPos.getPartsCoord();\n var playerOffsetCoord = this._player.getPosition().getOffsetCoord();\n var playerCoord = this._player.getPosition().getPartsCoord();\n try {\n var playerNextCoord = playerIsMoving ? this._player.getPosition().getNextJustPosition().getPartsCoord() : this._player.getPosition().getPartsCoord();\n }\n catch (e) {\n throw new Error("予期せぬ方向への移動のようです。");\n }\n var candidateCoord = currentCoord.clone();\n var dx = 0;\n var dy = 0;\n if (moveType === wwa_data_1.MoveType.CHASE_PLAYER) {\n dx =\n currentCoord.x > playerNextCoord.x ? 1 :\n currentCoord.x < playerNextCoord.x ? -1 : 0;\n dy =\n currentCoord.y > playerNextCoord.y ? 1 :\n currentCoord.y < playerNextCoord.y ? -1 : 0;\n }\n else if (moveType === wwa_data_1.MoveType.RUN_OUT) {\n dx =\n currentCoord.x > playerNextCoord.x ? -1 :\n currentCoord.x < playerNextCoord.x ? 1 : 0;\n dy =\n currentCoord.y > playerNextCoord.y ? -1 :\n currentCoord.y < playerNextCoord.y ? 1 : 0;\n }\n candidateCoord.x -= dx;\n candidateCoord.y -= dy;\n candidateCoord.x = Math.min(this._wwaData.mapWidth - 1, Math.max(0, candidateCoord.x));\n candidateCoord.y = Math.min(this._wwaData.mapWidth - 1, Math.max(0, candidateCoord.y));\n return candidateCoord;\n };\n WWA.prototype._getSecondCandidateMoveMode = function (playerIsMoving, current, firstCandidate, xCand, yCand, isMonster, objectsInNextFrame) {\n if (playerIsMoving && ((this._player.getDir() === wwa_data_1.Direction.UP || this._player.getDir() === wwa_data_1.Direction.DOWN) && isMonster ||\n (this._player.getDir() === wwa_data_1.Direction.LEFT || this._player.getDir() === wwa_data_1.Direction.RIGHT) && !isMonster)) {\n if (this._objectCanMoveTo(playerIsMoving, yCand, objectsInNextFrame)) {\n return wwa_data_1.SecondCandidateMoveType.MODE_Y;\n }\n if (this._objectCanMoveTo(playerIsMoving, xCand, objectsInNextFrame)) {\n return wwa_data_1.SecondCandidateMoveType.MODE_X;\n }\n return wwa_data_1.SecondCandidateMoveType.UNDECIDED;\n }\n if (this._objectCanMoveTo(playerIsMoving, xCand, objectsInNextFrame)) {\n return wwa_data_1.SecondCandidateMoveType.MODE_X;\n }\n if (this._objectCanMoveTo(playerIsMoving, yCand, objectsInNextFrame)) {\n return wwa_data_1.SecondCandidateMoveType.MODE_Y;\n }\n return wwa_data_1.SecondCandidateMoveType.UNDECIDED;\n };\n WWA.prototype._getThirdCandidate = function (playerIsMoving, currentPos, firstCandidate, mode, objectsInNextFrame) {\n var dir = mode === wwa_data_1.MoveType.CHASE_PLAYER ? 1 :\n mode === wwa_data_1.MoveType.RUN_OUT ? -1 : 0;\n var npCoord = playerIsMoving ? this._player.getPosition().getNextJustPosition().getPartsCoord() : this._player.getPosition().getPartsCoord();\n var currentCoord = currentPos.getPartsCoord();\n var testCoord;\n if (npCoord.x !== currentCoord.x) {\n testCoord = new wwa_data_1.Coord(firstCandidate.x, currentCoord.y + 1 * dir);\n if (this._objectCanMoveTo(playerIsMoving, testCoord, objectsInNextFrame)) {\n return testCoord;\n }\n testCoord = new wwa_data_1.Coord(firstCandidate.x, currentCoord.y - 1 * dir);\n if (this._objectCanMoveTo(playerIsMoving, testCoord, objectsInNextFrame)) {\n return testCoord;\n }\n testCoord = new wwa_data_1.Coord(currentCoord.x, currentCoord.y + 1 * dir);\n if (this._objectCanMoveTo(playerIsMoving, testCoord, objectsInNextFrame)) {\n return testCoord;\n }\n testCoord = new wwa_data_1.Coord(currentCoord.x, currentCoord.y - 1 * dir);\n if (this._objectCanMoveTo(playerIsMoving, testCoord, objectsInNextFrame)) {\n return testCoord;\n }\n }\n if (npCoord.y !== currentCoord.y) {\n testCoord = new wwa_data_1.Coord(currentCoord.x + 1 * dir, firstCandidate.y);\n if (this._objectCanMoveTo(playerIsMoving, testCoord, objectsInNextFrame)) {\n return testCoord;\n }\n testCoord = new wwa_data_1.Coord(currentCoord.x - 1 * dir, firstCandidate.y);\n if (this._objectCanMoveTo(playerIsMoving, testCoord, objectsInNextFrame)) {\n return testCoord;\n }\n testCoord = new wwa_data_1.Coord(currentCoord.x + 1 * dir, currentCoord.y);\n if (this._objectCanMoveTo(playerIsMoving, testCoord, objectsInNextFrame)) {\n return testCoord;\n }\n testCoord = new wwa_data_1.Coord(currentCoord.x - 1 * dir, currentCoord.y);\n if (this._objectCanMoveTo(playerIsMoving, testCoord, objectsInNextFrame)) {\n return testCoord;\n }\n }\n return null;\n };\n WWA.prototype._getRandomMoveCoord = function (playerIsMoving, currentPos, objectsInNextFrame) {\n var currentCoord = currentPos.getPartsCoord();\n var resultCoord = currentCoord.clone();\n var iterNum = this._wwaData.version < 31 ? wwa_data_1.WWAConsts.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31 : wwa_data_1.WWAConsts.RANDOM_MOVE_ITERATION_NUM;\n for (var i = 0; i < iterNum; i++) {\n var rand = Math.floor(Math.random() * 8);\n resultCoord.x = currentCoord.x + wwa_data_1.vx[rand];\n resultCoord.y = currentCoord.y + wwa_data_1.vy[rand];\n if (this._objectCanMoveTo(playerIsMoving, resultCoord, objectsInNextFrame)) {\n return resultCoord;\n }\n }\n return currentCoord;\n };\n WWA.prototype.isPrevFrameEventExecuted = function () {\n return this._prevFrameEventExected;\n };\n WWA.prototype._objectCanMoveTo = function (playerIsMoving, candCoord, objectsInNextFrame) {\n if (candCoord.x < 0 || candCoord.y < 0 || this._wwaData.mapWidth <= candCoord.x || this._wwaData.mapWidth <= candCoord.y) {\n return false;\n }\n var mapID = this._wwaData.map[candCoord.y][candCoord.x];\n var objID = this._wwaData.mapObject[candCoord.y][candCoord.x];\n var mapType = this._wwaData.mapAttribute[mapID][wwa_data_1.WWAConsts.ATR_TYPE];\n var camPos = this._camera.getPosition();\n var leftX = camPos.getPartsCoord().x;\n var topY = camPos.getPartsCoord().y;\n if (mapID === 0 && !this.isOldMap() || mapType === wwa_data_1.WWAConsts.MAP_WALL) {\n return false;\n }\n var targetX = candCoord.x - leftX + 1;\n var targetY = candCoord.y - topY + 1;\n if (0 <= targetX && 0 <= targetY &&\n targetX < objectsInNextFrame.length && targetY < objectsInNextFrame.length) {\n if (objectsInNextFrame[targetY][targetX] !== 0) {\n return false;\n }\n }\n else {\n if (objID !== 0) {\n return false;\n }\n }\n if (playerIsMoving) {\n if (this._player.getPosition().getNextJustPosition().getPartsCoord().equals(candCoord)) {\n return false;\n }\n }\n else {\n if (this._player.getPosition().getPartsCoord().equals(candCoord)) {\n return false;\n }\n }\n return true;\n };\n WWA.prototype._setObjectsInNextFrame = function (currentCoord, candCoord, leftX, topY, objectsInNextFrame, partsID) {\n var targetX = candCoord.x - leftX + 1;\n var targetY = candCoord.y - topY + 1;\n if (0 <= candCoord.x && candCoord.x <= this._wwaData.mapWidth && 0 <= candCoord.y && candCoord.y <= this._wwaData.mapWidth) {\n if (0 <= targetX && targetX < objectsInNextFrame.length && 0 <= targetY && targetY < objectsInNextFrame.length) {\n objectsInNextFrame[currentCoord.y - topY + 1][currentCoord.x - leftX + 1] = 0;\n objectsInNextFrame[candCoord.y - topY + 1][candCoord.x - leftX + 1] = partsID;\n this.hoge[candCoord.y - topY + 1][candCoord.x - leftX + 1] = partsID;\n }\n this._objectMovingDataManager.add(partsID, currentCoord.convertIntoPosition(this), candCoord.convertIntoPosition(this), currentCoord.getDirectionTo(candCoord));\n }\n };\n WWA.prototype.launchBattleEstimateWindow = function () {\n var cpParts = this._camera.getPosition().getPartsCoord();\n var xLeft = Math.max(0, cpParts.x);\n var xRight = Math.min(this._wwaData.mapWidth - 1, cpParts.x + wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW - 1);\n var yTop = Math.max(0, cpParts.y);\n var yBottom = Math.min(this._wwaData.mapWidth - 1, cpParts.y + wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW - 1);\n var monsterList = [];\n this.playSound(wwa_data_1.SystemSound.DECISION);\n for (var x = xLeft; x <= xRight; x++) {\n for (var y = yTop; y <= yBottom; y++) {\n var pid = this._wwaData.mapObject[y][x];\n if (this._wwaData.objectAttribute[pid][wwa_data_1.WWAConsts.ATR_TYPE] === wwa_data_1.WWAConsts.OBJECT_MONSTER) {\n if (monsterList.indexOf(pid) === -1) {\n monsterList.push(pid);\n }\n }\n }\n }\n if (monsterList.length === 0) {\n return false;\n }\n this._battleEstimateWindow.update(this._player.getStatus(), monsterList);\n this._battleEstimateWindow.show();\n this._player.setEstimateWindowWating();\n return true;\n };\n WWA.prototype.hideBattleEstimateWindow = function () {\n this._battleEstimateWindow.hide();\n this._player.clearEstimateWindowWaiting();\n };\n WWA.prototype.hidePasswordWindow = function (isCancel) {\n if (isCancel === void 0) { isCancel = false; }\n this._passwordWindow.hide();\n if (isCancel || this._passwordWindow.mode === wwa_password_window_1.Mode.SAVE) {\n this._player.clearPasswordWindowWaiting();\n return;\n }\n try {\n var data = this._quickLoad(false, this._passwordWindow.password, false);\n }\n catch (e) {\n this._player.clearPasswordWindowWaiting();\n alert("パスワードが正常ではありません。\\nエラー詳細:\\n" + e.message);\n return;\n }\n this._passwordLoadExecInNextFrame = true;\n this._passwordSaveExtractData = data;\n };\n WWA.prototype._displayHelp = function () {\n if (this._player.isControllable()) {\n this.setMessageQueue(" 【ショートカットキーの一覧】\\n" +\n "F1、M:戦闘結果予測の表示\\n" +\n "F3:復帰用パスワード入力\\n" +\n "F4:復帰用パスワード表示\\n" +\n "F5:一時保存データの読み込み\\n" +\n "F6:データの一時保存\\n" +\n "F7:初めからスタート\\n" +\n "F8:WWA公式ページにリンク\\n" +\n "F12:このリストの表示\\n" +\n "キーボードの「123、QWE、ASD、ZXC」は右のアイテムボックスに対応。\\n" +\n "「Enter、Y」はYes,\\n" +\n "「Esc、N」はNoに対応。\\n" +\n " I: 移動速度を落とす/\\n" +\n "F2、P: 移動速度を上げる\\n" +\n " 現在の移動回数:" + this._player.getMoveCount() + "\\n" +\n " WWA Wing バージョン:" + "3.1.8" + "\\n" +\n " マップデータ バージョン: " +\n Math.floor(this._wwaData.version / 10) + "." + this._wwaData.version % 10, false, true);\n }\n };\n WWA.prototype._setNextMessage = function (displayCenter) {\n if (displayCenter === void 0) { displayCenter = false; }\n this._clearFacesInNextFrame = true;\n if (this._scoreWindow.isVisible()) {\n this._scoreWindow.hide();\n }\n if (this._lastMessage.isEndOfPartsEvent && this._reservedMoveMacroTurn !== void 0) {\n this._player.setMoveMacroWaiting(this._reservedMoveMacroTurn);\n this._reservedMoveMacroTurn = void 0;\n }\n if (this._messageQueue.length === 0) {\n this._hideMessageWindow();\n }\n else {\n var mi = this._messageQueue.shift();\n var message = mi.message;\n var macro = mi.macro;\n this._lastMessage = mi;\n for (var i = 0; i < macro.length; i++) {\n this._execMacroListInNextFrame.push(macro[i]);\n }\n if (message !== "") {\n this._messageWindow.hide();\n this._messageWindow.setMessage(message);\n this._messageWindow.setPositionByPlayerPosition(this._faces.length !== 0, this._scoreWindow.isVisible(), displayCenter, this._player.getPosition(), this._camera.getPosition());\n this._messageWindow.show();\n this._player.setMessageWaiting();\n }\n else {\n if (this._messageQueue.length === 0) {\n this._hideMessageWindow();\n }\n else {\n this._setNextMessage();\n }\n }\n }\n };\n WWA.prototype._hideMessageWindow = function (messageDisplayed) {\n if (messageDisplayed === void 0) { messageDisplayed = true; }\n var itemID = 0;\n if (this._player.isReadyToUseItem()) {\n itemID = this._player.useItem();\n }\n var mesID = this.getObjectAttributeById(itemID, wwa_data_1.WWAConsts.ATR_STRING);\n this.clearFaces();\n if (mesID === 0) {\n if (messageDisplayed) {\n this._messageWindow.hide();\n this._keyStore.allClear();\n this._mouseStore.clear();\n }\n this._player.clearMessageWaiting();\n }\n else {\n this.setMessageQueue(this.getMessageById(mesID), false, false, itemID, wwa_data_1.PartsType.OBJECT, this._player.getPosition().getPartsCoord(), true);\n }\n };\n WWA.prototype.replaceParts = function (srcID, destID, partsType, onlyThisSight) {\n if (partsType === void 0) { partsType = wwa_data_1.PartsType.OBJECT; }\n if (onlyThisSight === void 0) { onlyThisSight = false; }\n var cpParts = this._camera.getPosition().getPartsCoord();\n var xLeft = onlyThisSight ? Math.max(0, cpParts.x) : 0;\n var xRight = onlyThisSight ? Math.min(this._wwaData.mapWidth - 1, cpParts.x + wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW - 1) : this._wwaData.mapWidth - 1;\n var yTop = onlyThisSight ? Math.max(0, cpParts.y) : 0;\n var yBottom = onlyThisSight ? Math.min(this._wwaData.mapWidth - 1, cpParts.y + wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW) - 1 : this._wwaData.mapWidth - 1;\n for (var x = xLeft; x <= xRight; x++) {\n for (var y = yTop; y <= yBottom; y++) {\n if (partsType === wwa_data_1.PartsType.OBJECT) {\n var pid = this._wwaData.mapObject[y][x];\n if (pid === srcID) {\n this._wwaData.mapObject[y][x] = destID;\n }\n }\n else {\n var pid = this._wwaData.map[y][x];\n if (pid === srcID) {\n this._wwaData.map[y][x] = destID;\n }\n }\n }\n }\n };\n WWA.prototype.getYesNoImgCoord = function () {\n return new wwa_data_1.Coord(this._wwaData.yesnoImgPosX, this._wwaData.yesnoImgPosY);\n };\n WWA.prototype.setYesNoImgCoord = function (coord) {\n this._wwaData.yesnoImgPosX = coord.x;\n this._wwaData.yesnoImgPosY = coord.y;\n return coord;\n };\n WWA.prototype.getPlayerImgCoord = function () {\n return new wwa_data_1.Coord(this._wwaData.playerImgPosX, this._wwaData.playerImgPosY);\n };\n WWA.prototype.setPlayerImgCoord = function (coord) {\n this._wwaData.playerImgPosX = coord.x;\n this._wwaData.playerImgPosY = coord.y;\n return coord;\n };\n WWA.prototype.setPlayerEnergyMax = function (eng) {\n return this._player.setEnergyMax(eng);\n };\n WWA.prototype.getMapPartsNum = function () {\n return this._wwaData.mapPartsMax;\n };\n WWA.prototype.getObjectPartsNum = function () {\n return this._wwaData.objPartsMax;\n };\n WWA.prototype.setMoveMacroWaitingToPlayer = function (moveNum) {\n this._reservedMoveMacroTurn = moveNum;\n };\n WWA.prototype.disableSave = function (flag) {\n return this._wwaData.disableSaveFlag = flag;\n };\n WWA.prototype.isOldMap = function () {\n return this._wwaData.isOldMap;\n };\n WWA.prototype.setOldMap = function (flag) {\n return this._wwaData.isOldMap = flag;\n };\n WWA.prototype.setObjectNotCollapseOnPartsOnPlayer = function (flag) {\n return this._wwaData.objectNoCollapseDefaultFlag = flag;\n };\n WWA.prototype.setGameOverPosition = function (pos) {\n if (pos.x < 0 || pos.x >= this.getMapWidth() || pos.y < 0 || pos.y >= this.getMapWidth()) {\n throw new Error("マップの範囲外が指定されています!");\n }\n this._wwaData.gameoverX = pos.x;\n this._wwaData.gameoverY = pos.y;\n return pos;\n };\n WWA.prototype.setPlayerStatus = function (type, value) {\n if (type === wwa_data_1.MacroStatusIndex.ENERGY) {\n this._player.setEnergy(value);\n }\n else if (type === wwa_data_1.MacroStatusIndex.STRENGTH) {\n this._player.setStrength(value);\n }\n else if (type === wwa_data_1.MacroStatusIndex.DEFENCE) {\n this._player.setDefence(value);\n }\n else if (type === wwa_data_1.MacroStatusIndex.GOLD) {\n this._player.setGold(value);\n }\n else if (type === wwa_data_1.MacroStatusIndex.MOVES) {\n this._player.setMoveCount(value);\n }\n else {\n throw new Error("未定義のステータスタイプです");\n }\n };\n WWA.prototype.setDelPlayer = function (flag) {\n return this._wwaData.delPlayerFlag = flag;\n };\n WWA.prototype.setPlayerGetItem = function (pos, id) {\n try {\n this._player.addItem(id, pos, true);\n }\n catch (e) {\n }\n };\n WWA.prototype.setFrameCoord = function (coord) {\n return this._frameCoord = coord.clone();\n };\n WWA.prototype.setBattleEffectCoord = function (coord) {\n return this._battleEffectCoord = coord.clone();\n };\n WWA.prototype.canInput = function () {\n return !this._temporaryInputDisable;\n };\n WWA.prototype.setWaitTime = function (time) {\n this._waitTimeInCurrentFrame += time;\n this._temporaryInputDisable = true;\n };\n WWA.prototype.setEffect = function (waits, coords) {\n this._wwaData.effectWaits = waits;\n this._wwaData.effectCoords = coords;\n };\n WWA.prototype.stopEffect = function () {\n this._wwaData.effectCoords = [];\n };\n WWA.prototype.setImgClick = function (pos) {\n this._wwaData.imgClickX = pos.x;\n this._wwaData.imgClickY = pos.y;\n if (pos.equals(new wwa_data_1.Coord(0, 0))) {\n Array.prototype.forEach.call(util.$qsAll(".item-cell>.item-click-border"), function (node) {\n node.style.backgroundImage = "url(\'" + wwa_data_1.WWAConsts.ITEM_BORDER_IMG_DATA_URL + "\')";\n node.style.backgroundPosition = "0 0";\n });\n }\n else {\n var escapedFilename = this._wwaData.mapCGName.replace("(", "\\\\(").replace(")", "\\\\)");\n Array.prototype.forEach.call(util.$qsAll(".item-cell>.item-click-border"), function (node) {\n node.style.backgroundImage = "url(\'" + escapedFilename + "\')";\n node.style.backgroundPosition = "-" + pos.x * wwa_data_1.WWAConsts.CHIP_SIZE + "px -" + pos.y * wwa_data_1.WWAConsts.CHIP_SIZE + "px";\n });\n }\n };\n WWA.prototype.addFace = function (face) {\n this._faces.push(face);\n };\n WWA.prototype.clearFaces = function () {\n this._faces = [];\n };\n WWA.prototype.updateItemEffectEnabled = function (isEnabled) {\n this._wwaData.isItemEffectEnabled = isEnabled;\n };\n WWA.prototype.initCSSRule = function () {\n this._styleElm = util.$id(wwa_data_1.WWAConsts.WWA_STYLE_TAG_ID);\n this._sheet = this._styleElm.sheet;\n this.updateCSSRule();\n };\n WWA.prototype.updateCSSRule = function () {\n if (this._stylePos === void 0) {\n this._stylePos = new Array(2);\n }\n else {\n if (this._sheet.addRule !== void 0) {\n for (var i = 0; i < this._stylePos.length; i++) {\n this._sheet.removeRule(this._stylePos[this._styleElm[i]]);\n }\n }\n else {\n for (var i = 0; i < this._stylePos.length; i++) {\n this._sheet.deleteRule(this._stylePos[this._styleElm[i]]);\n }\n }\n }\n var messageWindowStyleSelector = "div.wwa-message-window, div#wwa-battle-estimate, div#wwa-password-window";\n var messageWindowOpacity = this._isClassicModeEnable ? 1 : 0.9;\n var messageWindowStyleRules = "\\nbackground-color: rgba(" + this._wwaData.frameColorR + ", " + this._wwaData.frameColorG + ", " + this._wwaData.frameColorB + ", " + messageWindowOpacity + ");\\nborder-color: rgba(" + this._wwaData.frameOutColorR + ", " + this._wwaData.frameOutColorG + ", " + this._wwaData.frameOutColorB + ", 1);\\ncolor: rgba(" + this._wwaData.fontColorR + ", " + this._wwaData.fontColorG + ", " + this._wwaData.fontColorB + ", 1);\\nwhite-space: pre-wrap;\\n";\n var sidebarStyleSelector = "div#wwa-sidebar";\n var sidebarStyleRules = "\\ncolor: rgba(" + this._wwaData.statusColorR + ", " + this._wwaData.statusColorG + ", " + this._wwaData.statusColorB + ",1);\\nfont-weight: bold;\\n";\n if (this._sheet.addRule !== void 0) {\n this._stylePos[wwa_data_1.SelectorType.MESSAGE_WINDOW] = this._sheet.addRule(messageWindowStyleSelector, messageWindowStyleRules);\n this._stylePos[wwa_data_1.SelectorType.SIDEBAR] = this._sheet.addRule(sidebarStyleSelector, sidebarStyleRules);\n }\n else {\n this._stylePos[wwa_data_1.SelectorType.MESSAGE_WINDOW] = this._sheet.insertRule(messageWindowStyleSelector + " { " + messageWindowStyleRules + " }", 0);\n this._stylePos[wwa_data_1.SelectorType.SIDEBAR] = this._sheet.insertRule(sidebarStyleSelector + " { " + sidebarStyleRules + " }", 1);\n }\n };\n WWA.prototype.changeStyleRule = function (type, r, g, b) {\n if (type === wwa_data_1.ChangeStyleType.COLOR_FRAME) {\n this._wwaData.frameColorR = r;\n this._wwaData.frameColorG = g;\n this._wwaData.frameColorB = b;\n }\n else if (type === wwa_data_1.ChangeStyleType.COLOR_FRAMEOUT) {\n this._wwaData.frameOutColorR = r;\n this._wwaData.frameOutColorG = g;\n this._wwaData.frameOutColorB = b;\n }\n else if (type === wwa_data_1.ChangeStyleType.COLOR_STR) {\n this._wwaData.fontColorR = r;\n this._wwaData.fontColorG = g;\n this._wwaData.fontColorB = b;\n }\n else if (type === wwa_data_1.ChangeStyleType.COLOR_STATUS_STR) {\n this._wwaData.statusColorR = r;\n this._wwaData.statusColorG = g;\n this._wwaData.statusColorB = b;\n }\n this.updateCSSRule();\n };\n WWA.prototype.showMonsterWindow = function () {\n this._monsterWindow.show();\n };\n WWA.prototype.isClassicMode = function () {\n return this._isClassicModeEnable;\n };\n WWA.prototype.isConsoleOutputMode = function () {\n return this._useConsole;\n };\n return WWA;\n}());\nexports.WWA = WWA;\n;\nvar isCopyRightClick = false;\nfunction start() {\n wwap_mode = !!window["wwap_mode"];\n Array.prototype.forEach.call(util.$qsAll("a.wwa-copyright"), function (node) {\n node.addEventListener("click", function () {\n isCopyRightClick = true;\n });\n });\n window.addEventListener("beforeunload", function (e) {\n var mes = "このページを離れますか?";\n if (isCopyRightClick) {\n isCopyRightClick = false;\n e.returnValue = mes;\n return mes;\n }\n });\n var titleImgName = wwap_mode ?\n null :\n util.$id("wwa-wrapper").getAttribute("data-wwa-title-img");\n wwa_inject_html_1.inject(util.$id("wwa-wrapper"), titleImgName);\n var mapFileName = util.$id("wwa-wrapper").getAttribute("data-wwa-mapdata");\n var loaderFileName = util.$id("wwa-wrapper").getAttribute("data-wwa-loader");\n var audioDirectory = util.$id("wwa-wrapper").getAttribute("data-wwa-audio-dir");\n var urlgateEnabled = true;\n if (util.$id("wwa-wrapper").getAttribute("data-wwa-urlgate-enable").match(/^false$/i)) {\n urlgateEnabled = false;\n }\n var classicModeAttribute = util.$id("wwa-wrapper").getAttribute("data-wwa-classic-mode-enable");\n var classicModeEnabled = false;\n if (classicModeAttribute !== null && classicModeAttribute.match(/^true$/i)) {\n classicModeEnabled = true;\n }\n var itemEffectEnabled = true;\n var itemEffectAttribute = util.$id("wwa-wrapper").getAttribute("data-wwa-item-effect-enable");\n if (itemEffectAttribute !== null && itemEffectAttribute.match(/^false$/i)) {\n itemEffectEnabled = false;\n }\n wwa = new WWA(mapFileName, loaderFileName, urlgateEnabled, titleImgName, classicModeEnabled, itemEffectEnabled, audioDirectory);\n}\nif (document.readyState === "complete") {\n start();\n}\nelse {\n window.addEventListener("load", start);\n}\n\n\n//# sourceURL=webpack:///./src/wwa_main.ts?')},"./src/wwa_message.ts":function(module,exports,__webpack_require__){"use strict";eval('\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar wwa_message_1 = __webpack_require__("./src/wwa_message.ts");\nvar util = __webpack_require__("./src/wwa_util.ts");\nvar MessageInfo = (function () {\n function MessageInfo(message, isSystemMessage, isEndOfPartsEvent, macro) {\n this.message = message;\n this.isSystemMessage = isSystemMessage;\n this.isEndOfPartsEvent = isEndOfPartsEvent;\n this.macro = macro;\n if (this.macro === void 0) {\n this.macro = [];\n }\n }\n return MessageInfo;\n}());\nexports.MessageInfo = MessageInfo;\nfunction strArrayToMessageInfoArray(strArray, isSystemMessage) {\n var newq = [];\n strArray.forEach(function (s) {\n newq.push(new MessageInfo(s, isSystemMessage));\n });\n return newq;\n}\nexports.strArrayToMessageInfoArray = strArrayToMessageInfoArray;\nvar Macro = (function () {\n function Macro(_wwa, _triggerPartsID, _triggerPartsType, _triggerPartsPosition, macroType, macroArgs) {\n this._wwa = _wwa;\n this._triggerPartsID = _triggerPartsID;\n this._triggerPartsType = _triggerPartsType;\n this._triggerPartsPosition = _triggerPartsPosition;\n this.macroType = macroType;\n this.macroArgs = macroArgs;\n }\n Macro.prototype.execute = function () {\n try {\n if (this.macroType === wwa_data_1.MacroType.IMGPLAYER) {\n this._executeImgPlayerMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.IMGYESNO) {\n this._executeImgYesNoMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.HPMAX) {\n this._executeHPMaxMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.SAVE) {\n this._executeSaveMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.ITEM) {\n this._executeItemMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.DEFAULT) {\n this._executeDefaultMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.OLDMAP) {\n this._executeOldMapMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.PARTS) {\n this._executePartsMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.MOVE) {\n this._executeMoveMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.MAP) {\n this._executeMapMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.DIRMAP) {\n this._executeDirMapMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.IMGFRAME) {\n this._executeImgFrameMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.IMGBOM) {\n this._executeImgBomMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.DELPLAYER) {\n this._executeDelPlayerMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.FACE) {\n this._executeFaceMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.EFFECT) {\n this._executeEffectMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.GAMEOVER) {\n this._executeGameOverMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.IMGCLICK) {\n this._executeImgClickMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.STATUS) {\n this._executeStatusMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.EFFITEM) {\n this._executeEffItemMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.COLOR) {\n this._executeColorMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.WAIT) {\n this._executeWaitMacro();\n }\n else if (this.macroType === wwa_data_1.MacroType.SOUND) {\n this._executeSoundMacro();\n }\n }\n catch (e) {\n }\n };\n Macro.prototype._concatEmptyArgs = function (requiredLength) {\n if (this.macroArgs.length < requiredLength) {\n var ap = new Array(requiredLength - this.macroArgs.length);\n for (var i = 0; i < ap.length; i++) {\n ap[i] = "";\n }\n this.macroArgs = this.macroArgs.concat(ap);\n }\n };\n Macro.prototype._parseInt = function (argIndex, fallback) {\n if (fallback === void 0) { fallback = 0; }\n var x = parseInt(this.macroArgs[argIndex]);\n if (isNaN(x)) {\n return fallback;\n }\n return x;\n };\n Macro.prototype._executeImgPlayerMacro = function () {\n this._concatEmptyArgs(2);\n var x = this._parseInt(0);\n var y = this._parseInt(1);\n this._wwa.setPlayerImgCoord(new wwa_data_1.Coord(x, y));\n };\n Macro.prototype._executeImgYesNoMacro = function () {\n this._concatEmptyArgs(2);\n var x = this._parseInt(0);\n var y = this._parseInt(1);\n this._wwa.setYesNoImgCoord(new wwa_data_1.Coord(x, y));\n };\n Macro.prototype._executeHPMaxMacro = function () {\n this._concatEmptyArgs(1);\n var hpmax = Math.max(0, this._parseInt(0));\n this._wwa.setPlayerEnergyMax(hpmax);\n };\n Macro.prototype._executeSaveMacro = function () {\n this._concatEmptyArgs(1);\n var disableSaveFlag = !!this._parseInt(0);\n this._wwa.disableSave(disableSaveFlag);\n };\n Macro.prototype._executeItemMacro = function () {\n this._concatEmptyArgs(2);\n var pos = this._parseInt(0);\n var id = this._parseInt(1);\n this._wwa.setPlayerGetItem(pos, id);\n };\n Macro.prototype._executeDefaultMacro = function () {\n this._concatEmptyArgs(1);\n var defaultFlag = !!this._parseInt(0);\n this._wwa.setObjectNotCollapseOnPartsOnPlayer(defaultFlag);\n };\n Macro.prototype._executeOldMapMacro = function () {\n this._concatEmptyArgs(1);\n var oldMapFlag = !!this._parseInt(0);\n this._wwa.setOldMap(oldMapFlag);\n };\n Macro.prototype._executePartsMacro = function () {\n this._concatEmptyArgs(4);\n var srcID = this._parseInt(0);\n var destID = this._parseInt(1);\n var partsType = this._parseInt(2, wwa_data_1.PartsType.OBJECT);\n var onlyThisSight = this._parseInt(3);\n if (partsType !== wwa_data_1.PartsType.OBJECT && partsType !== wwa_data_1.PartsType.MAP) {\n throw new Error("パーツ種別が不明です");\n }\n if (onlyThisSight !== 0 && onlyThisSight !== 1) {\n onlyThisSight = 1;\n }\n if (srcID < 0 || destID < 0) {\n throw new Error("パーツ番号が不正です");\n }\n if (partsType === wwa_data_1.PartsType.OBJECT) {\n if (srcID >= this._wwa.getObjectPartsNum() || destID >= this._wwa.getObjectPartsNum()) {\n throw new Error("パーツ番号が不正です");\n }\n }\n else {\n if (srcID >= this._wwa.getMapPartsNum() || destID >= this._wwa.getMapPartsNum()) {\n throw new Error("パーツ番号が不正です");\n }\n }\n this._wwa.replaceParts(srcID, destID, partsType, !!onlyThisSight);\n };\n Macro.prototype._executeMoveMacro = function () {\n this._concatEmptyArgs(1);\n var moveNum = this._parseInt(0);\n this._wwa.setMoveMacroWaitingToPlayer(moveNum);\n };\n Macro.prototype._executeMapMacro = function () {\n this._concatEmptyArgs(4);\n var partsID = this._parseInt(0);\n var xstr = this.macroArgs[1];\n var ystr = this.macroArgs[2];\n var partsType = this._parseInt(3, wwa_data_1.PartsType.OBJECT);\n if (partsID < 0) {\n throw new Error("パーツ番号が不正です");\n }\n if (partsType === wwa_data_1.PartsType.OBJECT) {\n if (partsID >= this._wwa.getObjectPartsNum()) {\n throw new Error("パーツ番号が不正です");\n }\n }\n else {\n if (partsID >= this._wwa.getMapPartsNum()) {\n throw new Error("パーツ番号が不正です");\n }\n }\n this._wwa.appearPartsEval(this._triggerPartsPosition, xstr, ystr, partsID, partsType);\n };\n Macro.prototype._executeDirMapMacro = function () {\n this._concatEmptyArgs(3);\n var partsID = this._parseInt(0);\n var dist = this._parseInt(1);\n var partsType = this._parseInt(2, wwa_data_1.PartsType.OBJECT);\n if (isNaN(partsID) || isNaN(dist) || isNaN(partsType)) {\n throw new Error("引数が整数ではありません");\n }\n if (partsID < 0) {\n throw new Error("パーツ番号が不正です");\n }\n if (partsType === wwa_data_1.PartsType.OBJECT) {\n if (partsID >= this._wwa.getObjectPartsNum()) {\n throw new Error("パーツ番号が不正です");\n }\n }\n else {\n if (partsID >= this._wwa.getMapPartsNum()) {\n throw new Error("パーツ番号が不正です");\n }\n }\n this._wwa.appearPartsByDirection(dist, partsID, partsType);\n };\n Macro.prototype._executeImgFrameMacro = function () {\n this._concatEmptyArgs(3);\n var type = this._parseInt(0);\n var posX = this._parseInt(1);\n var posY = this._parseInt(2);\n var x = posX * wwa_data_1.WWAConsts.CHIP_SIZE;\n var y = posY * wwa_data_1.WWAConsts.CHIP_SIZE;\n if (posX < 0 || posY < 0) {\n throw new Error("座標は正でなければなりません。");\n }\n if (type === wwa_data_1.MacroImgFrameIndex.ENERGY) {\n var iconNode_energy = util.$qsh("#disp-energy>.status-icon");\n iconNode_energy.style.backgroundPosition = "-" + x + "px -" + y + "px";\n }\n else if (type === wwa_data_1.MacroImgFrameIndex.STRENGTH) {\n var iconNode_strength = util.$qsh("#disp-strength>.status-icon");\n iconNode_strength.style.backgroundPosition = "-" + x + "px -" + y + "px";\n }\n else if (type === wwa_data_1.MacroImgFrameIndex.DEFENCE) {\n var iconNode_defence = util.$qsh("#disp-defence>.status-icon");\n iconNode_defence.style.backgroundPosition = "-" + x + "px -" + y + "px";\n }\n else if (type === wwa_data_1.MacroImgFrameIndex.GOLD) {\n var iconNode_gold = util.$qsh("#disp-gold>.status-icon");\n iconNode_gold.style.backgroundPosition = "-" + x + "px -" + y + "px";\n }\n else if (type === wwa_data_1.MacroImgFrameIndex.WIDE_CELL_ROW) {\n Array.prototype.forEach.call(util.$qsAll("div.wide-cell-row"), function (node) {\n node.style.backgroundPosition = "-" + x + "px -" + y + "px";\n });\n }\n else if (type === wwa_data_1.MacroImgFrameIndex.ITEM_BG) {\n Array.prototype.forEach.call(util.$qsAll("div.item-cell"), function (node) {\n node.style.backgroundPosition = "-" + x + "px -" + y + "px";\n });\n }\n else if (type === wwa_data_1.MacroImgFrameIndex.MAIN_FRAME) {\n this._wwa.setFrameCoord(new wwa_data_1.Coord(posX, posY));\n }\n else {\n throw new Error("種別が不正です。");\n }\n };\n Macro.prototype._executeImgBomMacro = function () {\n this._concatEmptyArgs(2);\n var posX = this._parseInt(0);\n var posY = this._parseInt(1);\n if (posX < 0 || posY < 0) {\n throw new Error("座標は正でなければなりません。");\n }\n this._wwa.setBattleEffectCoord(new wwa_data_1.Coord(posX, posY));\n };\n Macro.prototype._executeDelPlayerMacro = function () {\n this._concatEmptyArgs(1);\n var flag = parseInt(this.macroArgs[0]);\n this._wwa.setDelPlayer(!!flag);\n };\n Macro.prototype._executeFaceMacro = function () {\n this._concatEmptyArgs(6);\n var destPosX = this._parseInt(0);\n var destPosY = this._parseInt(1);\n var srcPosX = this._parseInt(2);\n var srcPosY = this._parseInt(3);\n var srcWidth = this._parseInt(4);\n var srcHeight = this._parseInt(5);\n var face;\n if (destPosX < 0 || destPosY < 0 ||\n srcPosX < 0 || srcPosY < 0 ||\n srcWidth < 0 || srcHeight < 0) {\n throw new Error("各引数は0以上の整数でなければなりません。");\n }\n face = new wwa_data_1.Face(new wwa_data_1.Coord(destPosX, destPosY), new wwa_data_1.Coord(srcPosX, srcPosY), new wwa_data_1.Coord(srcWidth, srcHeight));\n this._wwa.addFace(face);\n };\n Macro.prototype._executeEffectMacro = function () {\n this._concatEmptyArgs(1);\n var waitTime = this._parseInt(0);\n if (waitTime < 0) {\n throw new Error("待ち時間は0以上の整数でなければなりません。");\n }\n if (waitTime === 0) {\n this._wwa.stopEffect();\n return;\n }\n var coords = [];\n for (var i = 1; i < this.macroArgs.length; i += 2) {\n var cropX = this._parseInt(i);\n var cropY = 0;\n if (cropX < 0) {\n throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");\n }\n if (i + 1 === this.macroArgs.length) {\n throw new Error("画像のパーツ座標指定で、Y座標が指定されていません。");\n }\n cropY = this._parseInt(i + 1);\n if (cropY < 0) {\n throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");\n }\n coords.push(new wwa_data_1.Coord(cropX, cropY));\n }\n this._wwa.setEffect(waitTime, coords);\n };\n Macro.prototype._executeGameOverMacro = function () {\n this._concatEmptyArgs(2);\n var x = this._parseInt(0);\n var y = this._parseInt(1);\n if (x < 0 || x >= this._wwa.getMapWidth() || y < 0 || y >= this._wwa.getMapWidth()) {\n throw new Error("マップの範囲外が指定されています!");\n }\n this._wwa.setGameOverPosition(new wwa_data_1.Coord(x, y));\n };\n Macro.prototype._executeImgClickMacro = function () {\n this._concatEmptyArgs(2);\n if (this.macroArgs.length < 1) {\n throw new Error("引数が少なすぎます");\n }\n var x = this._parseInt(0);\n var y = this._parseInt(1);\n if (x < 0 || y < 0) {\n throw new Error("引数が0以上の整数ではありません");\n }\n this._wwa.setImgClick(new wwa_data_1.Coord(x, y));\n };\n Macro.prototype._executeEffItemMacro = function () {\n if (this.macroArgs.length < 1) {\n throw new Error("引数が少なすぎます");\n }\n var mode = this._parseInt(0);\n this._wwa.updateItemEffectEnabled(!!mode);\n };\n Macro.prototype._executeStatusMacro = function () {\n this._concatEmptyArgs(2);\n var type = this._parseInt(0);\n var value = this._parseInt(1);\n if (type < 0 || 4 < type) {\n throw new Error("ステータス種別が範囲外です。");\n }\n this._wwa.setPlayerStatus(type, value);\n };\n Macro.prototype._executeColorMacro = function () {\n this._concatEmptyArgs(4);\n var type = this._parseInt(0);\n var r = this._parseInt(1);\n var g = this._parseInt(2);\n var b = this._parseInt(3);\n if (type < 0 || type > 5) {\n throw new Error("種別は0から5までです");\n }\n if (r < 0 || r > 255 ||\n g < 0 || g > 255 ||\n b < 0 || b > 255) {\n throw new Error("色が範囲外です");\n }\n this._wwa.changeStyleRule(type, r, g, b);\n };\n Macro.prototype._executeWaitMacro = function () {\n throw new Error("Not implemented!");\n };\n Macro.prototype._executeSoundMacro = function () {\n this._concatEmptyArgs(1);\n var id = parseInt(this.macroArgs[0]);\n this._wwa.playSound(id);\n };\n return Macro;\n}());\nexports.Macro = Macro;\nfunction parseMacro(wwa, partsID, partsType, position, macroStr) {\n var matchInfo = macroStr.match(/^\\$([a-zA-Z_][a-zA-Z0-9_]*)\\=(.*)$/);\n if (matchInfo === null || matchInfo.length !== 3) {\n throw new Error("マクロではありません");\n }\n var macroType = matchInfo[1];\n var macroIndex = wwa_data_1.macrotable["$" + macroType.toLowerCase()];\n if (macroIndex === void 0) {\n return new Macro(wwa, partsID, partsType, position, wwa_data_1.MacroType.UNDEFINED, matchInfo[2].split(","));\n }\n return new Macro(wwa, partsID, partsType, position, macroIndex, matchInfo[2].split(",").map(function (e) { return e.trim(); }));\n}\nexports.parseMacro = parseMacro;\nvar TextWindow = (function () {\n function TextWindow(_wwa, _coord, _width, _height, _isVisible, _parentElement, zIndex) {\n this._wwa = _wwa;\n this._coord = _coord;\n this._width = _width;\n this._height = _height;\n this._isVisible = _isVisible;\n this._parentElement = _parentElement;\n this._element = document.createElement("div");\n this._element.style.position = "absolute";\n this._element.style.borderWidth = "2px";\n this._element.style.borderStyle = "solid";\n if (_wwa.isClassicMode()) {\n this._element.style.borderRadius = "15px";\n }\n else {\n this._element.style.borderRadius = "10px";\n }\n this._element.classList.add("wwa-message-window");\n this._element.style.zIndex = zIndex + "";\n this._element.style.left = this._coord.x + "px";\n this._element.style.top = this._coord.y + "px";\n this._element.style.width = this._width + "px";\n this._element.style.height = this._height + "px";\n this._parentElement.appendChild(this._element);\n }\n TextWindow.prototype.update = function (a) {\n };\n TextWindow.prototype.show = function () {\n this._isVisible = true;\n this._element.style.display = "block";\n this.update();\n };\n TextWindow.prototype.hide = function () {\n this._isVisible = false;\n this._element.style.display = "none";\n this.update();\n };\n TextWindow.prototype.isVisible = function () {\n return this._isVisible;\n };\n return TextWindow;\n}());\nexports.TextWindow = TextWindow;\nvar MosterWindow = (function (_super) {\n __extends(MosterWindow, _super);\n function MosterWindow(wwa, coord, width, height, isVisible, parentElement, _cgFileName) {\n var _this = _super.call(this, wwa, new wwa_data_1.Coord(coord.x, coord.y), width, height, isVisible, parentElement, 201) || this;\n _this._cgFileName = _cgFileName;\n _this._monsterBox = document.createElement("div");\n _this._monsterBox.style.width = wwa_data_1.WWAConsts.CHIP_SIZE + "px";\n _this._monsterBox.style.height = wwa_data_1.WWAConsts.CHIP_SIZE + "px";\n _this._monsterBox.style.position = "absolute";\n _this._monsterBox.style.left = "10px";\n _this._monsterBox.style.top = "10px";\n _this._monsterBox.style.backgroundImage = "url(" + _this._cgFileName.replace("(", "\\\\(").replace(")", "\\\\)") + ")";\n _this._monsterBox.style.backgroundPosition = "0 0";\n _this._element.appendChild(_this._monsterBox);\n _this._energyBox = document.createElement("div");\n _this._energyBox.style.position = "absolute";\n _this._energyBox.style.left = "80px";\n _this._energyBox.style.top = "10px";\n _this._energyBox.textContent = "生命力 0";\n _this._element.appendChild(_this._energyBox);\n _this._strengthBox = document.createElement("div");\n _this._strengthBox.style.position = "absolute";\n _this._strengthBox.style.left = "80px";\n _this._strengthBox.style.top = "30px";\n _this._strengthBox.textContent = "攻撃力 0";\n _this._element.appendChild(_this._strengthBox);\n _this._defenceBox = document.createElement("div");\n _this._defenceBox.style.position = "absolute";\n _this._defenceBox.style.left = "180px";\n _this._defenceBox.style.top = "30px";\n _this._defenceBox.textContent = "防御力 0";\n _this._element.appendChild(_this._defenceBox);\n if (_this._isVisible) {\n _this._element.style.display = "block";\n }\n else {\n _this._element.style.display = "none";\n }\n return _this;\n }\n MosterWindow.prototype.update = function (monster) {\n if (monster !== void 0) {\n this._monsterBox.style.backgroundPosition =\n "-" + monster.imgCoord.x + "px -" + monster.imgCoord.y + "px";\n this._energyBox.textContent = "生命力 " + monster.status.energy;\n this._strengthBox.textContent = "攻撃力 " + monster.status.strength;\n this._defenceBox.textContent = "防御力 " + monster.status.defence;\n }\n };\n return MosterWindow;\n}(TextWindow));\nexports.MosterWindow = MosterWindow;\nvar ScoreWindow = (function (_super) {\n __extends(ScoreWindow, _super);\n function ScoreWindow(wwa, coord, isVisible, parentElement) {\n var _this = this;\n if (wwa.isClassicMode()) {\n _this = _super.call(this, wwa, new wwa_data_1.Coord(wwa_data_1.WWAConsts.CHIP_SIZE * 2, 30), wwa_data_1.WWAConsts.CHIP_SIZE * 7, 40, isVisible, parentElement, 202) || this;\n _this._element.style.borderWidth = "0";\n _this._element.style.borderRadius = "4px";\n _this._element.style.fontSize = "20px";\n _this._element.style.lineHeight = "40px";\n }\n else {\n _this = _super.call(this, wwa, new wwa_data_1.Coord(coord.x, coord.y), 340, 30, isVisible, parentElement, 202) || this;\n }\n _this._element.style.textAlign = "center";\n if (_this._isVisible) {\n _this._element.style.display = "block";\n }\n else {\n _this._element.style.display = "none";\n }\n _this.update(0);\n return _this;\n }\n ScoreWindow.prototype.update = function (score) {\n if (score !== void 0) {\n this._element.textContent = "Score: " + score;\n }\n };\n return ScoreWindow;\n}(TextWindow));\nexports.ScoreWindow = ScoreWindow;\nvar Positioning;\n(function (Positioning) {\n Positioning[Positioning["TOP"] = 0] = "TOP";\n Positioning[Positioning["CENTER"] = 1] = "CENTER";\n Positioning[Positioning["BOTTOM"] = 2] = "BOTTOM";\n Positioning[Positioning["SCORE"] = 3] = "SCORE";\n})(Positioning = exports.Positioning || (exports.Positioning = {}));\nvar MessageWindow = (function () {\n function MessageWindow(wwa, x, y, width, height, message, cgFileName, isVisible, isYesno, parentElement) {\n var thisA = this;\n var escapedFilename = cgFileName.replace("(", "\\\\(").replace(")", "\\\\)");\n this._wwa = wwa;\n this._cgFileName = cgFileName;\n this._x = x;\n this._y = y;\n this._width = width;\n this._height = height;\n this._message = message;\n this._isVisible = isVisible;\n this._isYesno = isYesno;\n this._element = document.createElement("div");\n this._element.style.position = "absolute";\n this._element.style.borderWidth = "2px";\n this._element.style.borderStyle = "solid";\n if (wwa.isClassicMode()) {\n this._element.style.borderRadius = "15px";\n }\n else {\n this._element.style.borderRadius = "10px";\n }\n this._element.classList.add("wwa-message-window");\n this._element.style.zIndex = "400";\n this._msgWrapperElement = document.createElement("div");\n this._msgWrapperElement.style.textAlign = "left";\n this._msgWrapperElement.style.wordWrap = "break-word";\n if (wwa.isClassicMode()) {\n this._msgWrapperElement.style.margin = "8px 0 8px 16px";\n }\n else {\n this._msgWrapperElement.style.margin = "0";\n this._msgWrapperElement.style.padding = "7px";\n }\n this._element.appendChild(this._msgWrapperElement);\n this._dummyElement = document.createElement("div");\n this._dummyElement.style.display = "none";\n this._dummyElement.style.padding = "0";\n this._dummyElement.style.margin = "0";\n this._dummyElement.style.height = "55px";\n this._element.appendChild(this._dummyElement);\n this._ynWrapperElement = document.createElement("div");\n this._ynWrapperElement.style.padding = "0";\n this._ynWrapperElement.style.margin = "0";\n this._ynWrapperElement.style.position = "absolute";\n this._ynWrapperElement.style.left = "246px";\n this._ynWrapperElement.style.bottom = "10px";\n this._ynWrapperElement.style.width = "80px";\n this._ynWrapperElement.style.height = "40px";\n this._ynWrapperElement.style.zIndex = "10";\n this._element.appendChild(this._ynWrapperElement);\n this._parentElement = parentElement;\n this._parentElement.appendChild(this._element);\n this._divYesElement = document.createElement("div");\n this._divYesElement.style.padding = "0";\n this._divYesElement.style.margin = "0";\n this._divYesElement.style.cssFloat = "left";\n this._divYesElement.style.width = "40px";\n this._divYesElement.style.height = "40px";\n this._divYesElement.style.background =\n "url(" + escapedFilename + ")";\n this._divYesElement.onclick = function () {\n if (!thisA._isInputDisable) {\n wwa.setYesNoInput(wwa_data_1.YesNoState.YES);\n thisA.update();\n }\n };\n this._divYesElement.style.cursor = "pointer";\n this._divNoElement = document.createElement("div");\n this._divNoElement.style.padding = "0";\n this._divNoElement.style.margin = "0";\n this._divNoElement.style.cssFloat = "left";\n this._divNoElement.style.width = "40px";\n this._divNoElement.style.height = "40px";\n this._divNoElement.style.background =\n "url(" + escapedFilename + ")";\n this._divNoElement.onclick = function () {\n if (!thisA._isInputDisable) {\n wwa.setYesNoInput(wwa_data_1.YesNoState.NO);\n thisA.update();\n }\n };\n this._divNoElement.style.cursor = "pointer";\n this._ynWrapperElement.appendChild(this._divYesElement);\n this._ynWrapperElement.appendChild(this._divNoElement);\n thisA._isInputDisable = false;\n this.update();\n }\n MessageWindow.prototype.setPosition = function (x, y, width, height) {\n this._x = x;\n this._y = y;\n this._width = width;\n this._height = height;\n this.update();\n };\n MessageWindow.prototype.setPositionByPlayerPosition = function (existsFaces, existsScoreWindow, displayCenter, playerPos, cameraPos) {\n var playerInScreenY = playerPos.getPartsCoord().substract(cameraPos.getPartsCoord()).y;\n var pos;\n if (existsFaces) {\n pos = wwa_message_1.Positioning.BOTTOM;\n }\n else if (existsScoreWindow) {\n pos = wwa_message_1.Positioning.SCORE;\n }\n else if (displayCenter) {\n pos = wwa_message_1.Positioning.CENTER;\n }\n else if (playerInScreenY >= Math.ceil(wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW / 2)) {\n pos = wwa_message_1.Positioning.TOP;\n }\n else {\n pos = wwa_message_1.Positioning.BOTTOM;\n }\n this.setPositionEasy(pos);\n };\n MessageWindow.prototype.setPositionEasy = function (pos) {\n var centerPos = Math.floor(this._element.clientHeight / 2);\n if (pos === Positioning.CENTER) {\n this._y = wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT / 2 - centerPos;\n this.update();\n return;\n }\n if (pos === Positioning.TOP) {\n this._y = Math.max(20, wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT / 4 - centerPos) + 10;\n this.update();\n return;\n }\n if (pos === Positioning.BOTTOM) {\n this._y = Math.min(wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT - 20 - this._element.clientHeight, wwa_data_1.WWAConsts.MAP_WINDOW_HEIGHT * 3 / 4 - centerPos);\n this.update();\n return;\n }\n if (pos === Positioning.SCORE) {\n this._y = 80;\n this.update();\n return;\n }\n };\n MessageWindow.prototype.setMessage = function (message) {\n this._message = message;\n this.update();\n };\n MessageWindow.prototype.setYesNoChoice = function (isYesNo) {\n this._isInputDisable = false;\n this._isYesno = isYesNo;\n this.update();\n return this._isYesno;\n };\n MessageWindow.prototype.isYesNoChoice = function () {\n return this._isYesno;\n };\n MessageWindow.prototype.setInputDisable = function () {\n this._isInputDisable = true;\n };\n MessageWindow.prototype.isInputDisable = function () {\n return this._isInputDisable;\n };\n MessageWindow.prototype.show = function () {\n this._isVisible = true;\n this.update();\n };\n MessageWindow.prototype.hide = function () {\n this._isVisible = false;\n this.update();\n };\n MessageWindow.prototype.isVisible = function () {\n return this._isVisible;\n };\n MessageWindow.prototype.isWideChar = function (char) {\n return (char.match(/^[^\\x01-\\x7E\\xA1-\\xDF]+$/) !== null);\n };\n MessageWindow.prototype.update = function () {\n var _this = this;\n var base = this._wwa.getYesNoImgCoord();\n if (this._isYesno) {\n if (this._wwa.getYesNoState() === wwa_data_1.YesNoState.YES) {\n this._divYesElement.style.backgroundPosition =\n "-" + (base.x + wwa_data_1.WWAConsts.IMGRELPOS_YESNO_YESP_X) * wwa_data_1.WWAConsts.CHIP_SIZE + "px " +\n "-" + (base.y * wwa_data_1.WWAConsts.CHIP_SIZE) + "px";\n this._divNoElement.style.backgroundPosition =\n "-" + (base.x + wwa_data_1.WWAConsts.IMGRELPOS_YESNO_NO_X) * wwa_data_1.WWAConsts.CHIP_SIZE + "px " +\n "-" + (base.y * wwa_data_1.WWAConsts.CHIP_SIZE) + "px";\n }\n else if (this._wwa.getYesNoState() === wwa_data_1.YesNoState.NO) {\n this._divYesElement.style.backgroundPosition =\n "-" + (base.x + wwa_data_1.WWAConsts.IMGRELPOS_YESNO_YES_X) * wwa_data_1.WWAConsts.CHIP_SIZE + "px " +\n "-" + (base.y * wwa_data_1.WWAConsts.CHIP_SIZE) + "px";\n this._divNoElement.style.backgroundPosition =\n "-" + (base.x + wwa_data_1.WWAConsts.IMGRELPOS_YESNO_NOP_X) * wwa_data_1.WWAConsts.CHIP_SIZE + "px " +\n "-" + (base.y * wwa_data_1.WWAConsts.CHIP_SIZE) + "px";\n }\n else {\n this._divYesElement.style.backgroundPosition =\n "-" + (base.x + wwa_data_1.WWAConsts.IMGRELPOS_YESNO_YES_X) * wwa_data_1.WWAConsts.CHIP_SIZE + "px " +\n "-" + (base.y * wwa_data_1.WWAConsts.CHIP_SIZE) + "px";\n this._divNoElement.style.backgroundPosition =\n "-" + (base.x + wwa_data_1.WWAConsts.IMGRELPOS_YESNO_NO_X) * wwa_data_1.WWAConsts.CHIP_SIZE + "px " +\n "-" + (base.y * wwa_data_1.WWAConsts.CHIP_SIZE) + "px";\n }\n this._ynWrapperElement.style.display = "block";\n }\n else {\n this._ynWrapperElement.style.display = "none";\n }\n this._msgWrapperElement.textContent = "";\n var mesArray = this._message.split("\\n");\n mesArray.forEach(function (line, i) {\n var lsp = document.createElement("span");\n if (_this._wwa.isClassicMode()) {\n var count = 0, lineStr = "";\n for (var j = 0; j < mesArray[i].length || count != 0; j++) {\n if (_this.isWideChar(mesArray[i].charAt(j))) {\n count += 2;\n }\n else {\n count += 1;\n }\n lineStr += mesArray[i].charAt(j);\n if (count + 1 > wwa_data_1.WWAConsts.MSG_STR_WIDTH * 2) {\n if (mesArray[i].charAt(j + 1) === "。" || mesArray[i].charAt(j + 1) === "、") {\n lineStr += mesArray[i].charAt(j + 1);\n j++;\n }\n var vsp = document.createElement("span");\n vsp.style.display = "inline-block";\n vsp.style.width = "100%";\n vsp.textContent = lineStr;\n lsp.appendChild(vsp);\n count = 0;\n lineStr = "";\n }\n }\n }\n else {\n lsp.textContent = mesArray[i];\n }\n _this._msgWrapperElement.appendChild(lsp);\n _this._msgWrapperElement.appendChild(document.createElement("br"));\n });\n if (this._isVisible) {\n this._element.style.left = this._x + "px";\n this._element.style.top = this._y + "px";\n }\n else {\n this._element.style.left = "-999999px";\n this._element.style.top = "-999999px";\n }\n this._element.style.width = this._width + "px";\n this._element.style.minHeight = this._height + "px";\n this._dummyElement.style.display = this._isYesno ? "block" : "none";\n };\n return MessageWindow;\n}());\nexports.MessageWindow = MessageWindow;\n\n\n//# sourceURL=webpack:///./src/wwa_message.ts?')},"./src/wwa_monster.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar Monster = (function () {\n function Monster(_partsID, _position, _imgCoord, _status, _message, _item, _battleEndCallback) {\n this._partsID = _partsID;\n this._position = _position;\n this._imgCoord = _imgCoord;\n this._status = _status;\n this._message = _message;\n this._item = _item;\n this._battleEndCallback = _battleEndCallback;\n }\n Object.defineProperty(Monster.prototype, "partsID", {\n get: function () { return this._partsID; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Monster.prototype, "position", {\n get: function () { return this._position; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Monster.prototype, "imgCoord", {\n get: function () { return this._imgCoord; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Monster.prototype, "status", {\n get: function () { return this._status; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Monster.prototype, "message", {\n get: function () { return this._message; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Monster.prototype, "item", {\n get: function () { return this._item; },\n enumerable: true,\n configurable: true\n });\n Monster.prototype.damage = function (amount) {\n this._status.energy = Math.max(0, this._status.energy - amount);\n };\n Monster.prototype.battleEndProcess = function () {\n this._battleEndCallback();\n };\n return Monster;\n}());\nexports.Monster = Monster;\n\n\n//# sourceURL=webpack:///./src/wwa_monster.ts?')},"./src/wwa_motion.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar ObjectMovingData = (function () {\n function ObjectMovingData(_player, _objectID, _srcPos, _destPos, _dir) {\n this._player = _player;\n this._objectID = _objectID;\n this._srcPos = _srcPos;\n this._destPos = _destPos;\n this._dir = _dir;\n this._currentPos = this._srcPos.clone();\n }\n ObjectMovingData.prototype.update = function () {\n var speedIndex = this._player.getSpeedIndex();\n this._currentPos = this._currentPos.getNextFramePosition(this._dir, wwa_data_1.speedList[speedIndex], wwa_data_1.speedList[speedIndex]);\n return this._currentPos;\n };\n Object.defineProperty(ObjectMovingData.prototype, "isAchievedDestination", {\n get: function () {\n return this._currentPos.equals(this._destPos);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ObjectMovingData.prototype, "currentPosition", {\n get: function () {\n return this._currentPos;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ObjectMovingData.prototype, "beforePosition", {\n get: function () {\n return this._srcPos;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ObjectMovingData.prototype, "destination", {\n get: function () {\n return this._destPos;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ObjectMovingData.prototype, "objID", {\n get: function () {\n return this._objectID;\n },\n enumerable: true,\n configurable: true\n });\n return ObjectMovingData;\n}());\nexports.ObjectMovingData = ObjectMovingData;\nvar ObjectMovingDataManager = (function () {\n function ObjectMovingDataManager(_wwa, _player) {\n this._wwa = _wwa;\n this._player = _player;\n this.clear();\n }\n ObjectMovingDataManager.prototype.add = function (objectID, srcPos, destPos, dir) {\n this._queue.push(new ObjectMovingData(this._player, objectID, srcPos, destPos, dir));\n };\n ObjectMovingDataManager.prototype.update = function () {\n var endObjects = [];\n var continueObjects = [];\n for (var i = 0; i < this._queue.length; i++) {\n this._queue[i].update();\n if (this._queue[i].isAchievedDestination) {\n endObjects.push(this._queue[i]);\n this._wwa.setPartsOnPosition(wwa_data_1.PartsType.OBJECT, 0, this._queue[i].beforePosition.getPartsCoord());\n this._wwa.setPartsOnPosition(wwa_data_1.PartsType.OBJECT, this._queue[i].objID, this._queue[i].destination.getPartsCoord());\n }\n else {\n continueObjects.push(this._queue[i]);\n }\n }\n this._queue = continueObjects;\n return endObjects;\n };\n ObjectMovingDataManager.prototype.clear = function () {\n this._queue = [];\n };\n Object.defineProperty(ObjectMovingDataManager.prototype, "objectMovingData", {\n get: function () {\n return this.objectMovingData;\n },\n enumerable: true,\n configurable: true\n });\n ObjectMovingDataManager.prototype.getOffsetByBeforePartsCoord = function (coord) {\n var result = this._queue.filter(function (x) {\n return x.beforePosition.getPartsCoord().equals(coord);\n });\n if (result.length === 0) {\n return null;\n }\n return result[0].currentPosition.getOffsetCoord();\n };\n return ObjectMovingDataManager;\n}());\nexports.ObjectMovingDataManager = ObjectMovingDataManager;\n\n\n//# sourceURL=webpack:///./src/wwa_motion.ts?')},"./src/wwa_parts_player.ts":function(module,exports,__webpack_require__){"use strict";eval('\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nvar util = __webpack_require__("./src/wwa_util.ts");\nvar Parts = (function () {\n function Parts(pos) {\n this._position = pos;\n }\n Parts.prototype.getPosition = function () {\n return this._position;\n };\n return Parts;\n}());\nexports.Parts = Parts;\nvar PartsObject = (function (_super) {\n __extends(PartsObject, _super);\n function PartsObject(pos) {\n return _super.call(this, pos) || this;\n }\n return PartsObject;\n}(Parts));\nexports.PartsObject = PartsObject;\nvar PartsMap = (function (_super) {\n __extends(PartsMap, _super);\n function PartsMap(pos) {\n return _super.call(this, pos) || this;\n }\n return PartsMap;\n}(Parts));\nexports.PartsMap = PartsMap;\nvar PlayerState;\n(function (PlayerState) {\n PlayerState[PlayerState["CONTROLLABLE"] = 0] = "CONTROLLABLE";\n PlayerState[PlayerState["MOVING"] = 1] = "MOVING";\n PlayerState[PlayerState["CAMERA_MOVING"] = 2] = "CAMERA_MOVING";\n PlayerState[PlayerState["MESSAGE_WAITING"] = 3] = "MESSAGE_WAITING";\n PlayerState[PlayerState["LOCALGATE_JUMPED"] = 4] = "LOCALGATE_JUMPED";\n PlayerState[PlayerState["BATTLE"] = 5] = "BATTLE";\n PlayerState[PlayerState["ESTIMATE_WINDOW_WAITING"] = 6] = "ESTIMATE_WINDOW_WAITING";\n PlayerState[PlayerState["PASSWORD_WINDOW_WAITING"] = 7] = "PASSWORD_WINDOW_WAITING";\n})(PlayerState = exports.PlayerState || (exports.PlayerState = {}));\nvar Player = (function (_super) {\n __extends(Player, _super);\n function Player(wwa, pos, camera, status, em) {\n var _this = _super.call(this, pos) || this;\n _this.itemTransitioningClassName = "item-transitioning";\n _this.overwittenItemClassName = "item-overwritten";\n _this.overwittenItemSelector = "." + _this.overwittenItemClassName;\n _this._status = status;\n _this._equipStatus = new wwa_data_1.EquipmentStatus(0, 0);\n _this._itemBox = new Array(wwa_data_1.WWAConsts.ITEMBOX_SIZE);\n _this._itemBoxElement = new Array(wwa_data_1.WWAConsts.ITEMBOX_SIZE);\n _this._itemUsingEvent = new Array(wwa_data_1.WWAConsts.ITEMBOX_SIZE);\n for (var i = 0; i < _this._itemBox.length; i++) {\n _this._itemBox[i] = 0;\n _this._itemBoxElement[i] = util.$qsh("#item" + i + ">.item-disp");\n }\n _this.updateItemBox();\n _this._energyMax = em;\n _this._dir = wwa_data_1.Direction.DOWN;\n _this._isMovingImage = false;\n _this._wwa = wwa;\n _this._state = PlayerState.CONTROLLABLE;\n _this._camera = camera;\n _this._isPartsEventExecuted = false;\n _this._energyValueElement = util.$qsh("#disp-energy>.status-value-box");\n _this._strengthValueElement = util.$qsh("#disp-strength>.status-value-box");\n _this._defenceValueElement = util.$qsh("#disp-defence>.status-value-box");\n _this._goldValueElement = util.$qsh("#disp-gold>.status-value-box");\n _this._isReadyToUseItem = false;\n _this._isClickableItemGot = false;\n _this._moves = 0;\n _this._moveMacroWaitingRemainMoves = 0;\n _this._moveObjectAutoExecTimer = 0;\n _this.updateStatusValueBox();\n _this._partsAppeared = false;\n _this._afterMoveMacroFlag = false;\n _this._isPreparedForLookingAround = true;\n _this._lookingAroundTimer = wwa_data_1.WWAConsts.PLAYER_LOOKING_AROUND_START_FRAME;\n _this._speedIndex = wwa_data_1.WWAConsts.DEFAULT_SPEED_INDEX;\n return _this;\n }\n Player.prototype.move = function () {\n if (this.isControllable()) {\n this.controll(this._dir);\n return;\n }\n if (this._state === PlayerState.CAMERA_MOVING) {\n try {\n this._camera.move(this._dir);\n }\n catch (e) {\n }\n if (this._isOnCameraStopPosition()) {\n this._state = PlayerState.CONTROLLABLE;\n }\n }\n else if (this._state === PlayerState.MOVING) {\n try {\n var next = this._position.getNextFramePosition(this._dir, wwa_data_1.speedList[this._speedIndex], wwa_data_1.speedList[this._speedIndex]);\n }\n catch (e) {\n }\n if (next.isJustPosition()) {\n this._state = PlayerState.CONTROLLABLE;\n this.toggleMovingImage();\n this._moves++;\n this._isPartsEventExecuted = false;\n this._samePosLastExecutedMapID = void 0;\n this._samePosLastExecutedObjID = void 0;\n }\n this._position = next;\n }\n };\n Player.prototype.controll = function (moveDir) {\n var nextFramePos;\n var nextJustPos;\n if (this.isControllable()) {\n this._isPreparedForLookingAround = false;\n this._dir = moveDir;\n try {\n nextFramePos = this._position.getNextFramePosition(this._dir, wwa_data_1.speedList[this._speedIndex], wwa_data_1.speedList[this._speedIndex]);\n nextJustPos = this._position.getNextJustPosition(moveDir);\n }\n catch (e) {\n return;\n }\n if (this._isOnCameraMovingPosition()) {\n if (this._wwa.getMapIdByPosition(nextJustPos) !== 0 || this._wwa.isOldMap() || this._wwa.debug) {\n try {\n this._camera.move(this._dir);\n this._state = PlayerState.CAMERA_MOVING;\n }\n catch (e) {\n this._state = PlayerState.CONTROLLABLE;\n }\n }\n return;\n }\n if (!this.canMoveTo(nextJustPos)) {\n if (this._wwa.getMapTypeByPosition(nextJustPos) === wwa_data_1.WWAConsts.MAP_WALL) {\n this._wwa.checkMap(nextJustPos.getPartsCoord());\n }\n this._wwa.checkObject(nextJustPos.getPartsCoord());\n return;\n }\n this._position = nextFramePos;\n this._state = PlayerState.MOVING;\n if (this._wwa.getMapAttributeByPosition(this._position.getNextJustPosition(moveDir), wwa_data_1.WWAConsts.ATR_TYPE) !== wwa_data_1.WWAConsts.MAP_LOCALGATE) {\n this._wwa.moveObjects(true);\n }\n }\n };\n Player.prototype.canMoveTo = function (pos) {\n if (pos === null) {\n return false;\n }\n if (this._wwa.debug) {\n return true;\n }\n var w = this._wwa.getMapWidth();\n var pc = pos.getPartsCoord();\n var po = pos.getOffsetCoord();\n if (this._wwa.getMapIdByPosition(pos) === 0 && !this._wwa.isOldMap()) {\n return false;\n }\n if (this._wwa.getMapTypeByPosition(pos) === wwa_data_1.WWAConsts.MAP_WALL) {\n return false;\n }\n if (this._wwa.getObjectIdByPosition(pos) === 0) {\n return true;\n }\n if (this._wwa.getObjectTypeByPosition(pos) === wwa_data_1.WWAConsts.OBJECT_NORMAL &&\n this._wwa.getObjectAttributeByPosition(pos, wwa_data_1.WWAConsts.ATR_MODE) === wwa_data_1.WWAConsts.PASSABLE_OBJECT) {\n return true;\n }\n if (this._wwa.getObjectTypeByPosition(pos) === wwa_data_1.WWAConsts.OBJECT_DOOR &&\n this._wwa.getObjectAttributeByPosition(pos, wwa_data_1.WWAConsts.ATR_NUMBER) === wwa_data_1.WWAConsts.PASSABLE_OBJECT) {\n if (this.hasItem(this._wwa.getObjectAttributeByPosition(pos, wwa_data_1.WWAConsts.ATR_ITEM))) {\n return false;\n }\n return true;\n }\n return false;\n };\n Player.prototype.isMoving = function () {\n return this._state == PlayerState.MOVING || this._state == PlayerState.CAMERA_MOVING;\n };\n Player.prototype._isOnCameraMovingPosition = function () {\n var camPos = this._camera.getPosition().getPartsCoord();\n var pPos = this.getPosition().getPartsCoord();\n return ((pPos.x - camPos.x === wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW - 1 && this._dir === wwa_data_1.Direction.RIGHT) ||\n (pPos.x === camPos.x && this._dir === wwa_data_1.Direction.LEFT) ||\n (pPos.y - camPos.y === wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW - 1 && this._dir === wwa_data_1.Direction.DOWN) ||\n (pPos.y === camPos.y && this._dir === wwa_data_1.Direction.UP));\n };\n Player.prototype._isOnCameraStopPosition = function () {\n var camPos = this._camera.getPosition().getPartsCoord();\n var pPos = this.getPosition().getPartsCoord();\n return ((pPos.x - camPos.x === wwa_data_1.WWAConsts.H_PARTS_NUM_IN_WINDOW - 1 && this._dir === wwa_data_1.Direction.LEFT) ||\n (pPos.x === camPos.x && this._dir === wwa_data_1.Direction.RIGHT) ||\n (pPos.y - camPos.y === wwa_data_1.WWAConsts.V_PARTS_NUM_IN_WINDOW - 1 && this._dir === wwa_data_1.Direction.UP) ||\n (pPos.y === camPos.y && this._dir === wwa_data_1.Direction.DOWN));\n };\n Player.prototype.isControllable = function () {\n var isAfterMoveMacro = this._afterMoveMacroFlag;\n this._afterMoveMacroFlag = false;\n return (this._state === PlayerState.CONTROLLABLE &&\n !this._partsAppeared &&\n ((this._wwa.getMapTypeByPosition(this._position) !== wwa_data_1.WWAConsts.MAP_LOCALGATE &&\n this._wwa.getMapTypeByPosition(this._position) !== wwa_data_1.WWAConsts.MAP_URLGATE) ||\n !this._wwa.isPrevFrameEventExecuted()) &&\n this._moveMacroWaitingRemainMoves === 0 && this._moveObjectAutoExecTimer === 0 &&\n !isAfterMoveMacro && this._wwa.canInput());\n };\n Player.prototype.getCopyOfItemBox = function () {\n return this._itemBox.slice();\n };\n Player.prototype.getDir = function () {\n return this._dir;\n };\n Player.prototype.isMovingImage = function () {\n return this._isMovingImage;\n };\n Player.prototype.toggleMovingImage = function () {\n if (this._isMovingImage) {\n this._isMovingImage = false;\n }\n else {\n this._isMovingImage = true;\n }\n };\n Player.prototype.getEnergyMax = function () {\n return this._energyMax;\n };\n Player.prototype.isJumped = function () {\n return this._state === PlayerState.LOCALGATE_JUMPED;\n };\n Player.prototype.setMessageWaiting = function () {\n this._state = PlayerState.MESSAGE_WAITING;\n };\n Player.prototype.isWaitingMessage = function () {\n return this._state === PlayerState.MESSAGE_WAITING;\n };\n Player.prototype.clearMessageWaiting = function () {\n if (this._state === PlayerState.MESSAGE_WAITING) {\n this._state = PlayerState.CONTROLLABLE;\n this._isPartsEventExecuted = true;\n if (this._isPreparedForLookingAround) {\n this._lookingAroundTimer = wwa_data_1.WWAConsts.PLAYER_LOOKING_AROUND_START_FRAME;\n }\n }\n };\n Player.prototype.setEstimateWindowWating = function () {\n this._state = PlayerState.ESTIMATE_WINDOW_WAITING;\n };\n Player.prototype.isWatingEstimateWindow = function () {\n return this._state === PlayerState.ESTIMATE_WINDOW_WAITING;\n };\n Player.prototype.clearEstimateWindowWaiting = function () {\n if (this._state === PlayerState.ESTIMATE_WINDOW_WAITING) {\n this._state = PlayerState.CONTROLLABLE;\n }\n };\n Player.prototype.setPasswordWindowWating = function () {\n this._state = PlayerState.PASSWORD_WINDOW_WAITING;\n };\n Player.prototype.isWaitingPasswordWindow = function () {\n return this._state === PlayerState.PASSWORD_WINDOW_WAITING;\n };\n Player.prototype.clearPasswordWindowWaiting = function () {\n if (this._state === PlayerState.PASSWORD_WINDOW_WAITING) {\n this._state = PlayerState.CONTROLLABLE;\n }\n };\n Player.prototype.isPartsEventExecuted = function () {\n return this._isPartsEventExecuted;\n };\n Player.prototype.resetEventExecutionInfo = function () {\n this._isPartsEventExecuted = false;\n };\n Player.prototype.getLastExecPartsIDOnSamePosition = function (type) {\n return type === wwa_data_1.PartsType.MAP ? this._samePosLastExecutedMapID : this._samePosLastExecutedObjID;\n };\n Player.prototype.setLastExecInfoOnSamePosition = function (type, id) {\n if (type === wwa_data_1.PartsType.MAP) {\n this._samePosLastExecutedMapID = id;\n }\n else {\n this._samePosLastExecutedObjID = id;\n }\n };\n Player.prototype.processAfterJump = function () {\n if (this._state !== PlayerState.LOCALGATE_JUMPED) {\n return;\n }\n if (--this._jumpWaitFramesRemain === 0) {\n this._state = PlayerState.CONTROLLABLE;\n }\n };\n Player.prototype.jumpTo = function (pos) {\n var prevCameraPos = this._camera.getPosition();\n var prevPos = this.getPosition();\n if (this._position.equals(pos)) {\n return false;\n }\n this._position = pos;\n if (!pos.isInCameraRange(this._camera, true)) {\n this._camera.reset(pos);\n }\n this._state = PlayerState.LOCALGATE_JUMPED;\n this._jumpWaitFramesRemain = wwa_data_1.WWAConsts.LOCALGATE_PLAYER_WAIT_FRAME;\n this._samePosLastExecutedMapID = void 0;\n this._samePosLastExecutedObjID = void 0;\n if (pos.hasLocalGate()) {\n this._dir = wwa_data_1.Direction.DOWN;\n }\n else if (pos.getPartsCoord().y <= this._wwa.getMapWidth() - 2 && pos.getNextJustPosition(wwa_data_1.Direction.DOWN).hasLocalGate()) {\n this._dir = wwa_data_1.Direction.UP;\n }\n else if (pos.getPartsCoord().y >= 1 && pos.getNextJustPosition(wwa_data_1.Direction.UP).hasLocalGate()) {\n this._dir = wwa_data_1.Direction.DOWN;\n }\n else if (pos.getPartsCoord().x <= this._wwa.getMapWidth() - 2 && pos.getNextJustPosition(wwa_data_1.Direction.RIGHT).hasLocalGate()) {\n this._dir = wwa_data_1.Direction.LEFT;\n }\n else if (pos.getPartsCoord().x >= 1 && pos.getNextJustPosition(wwa_data_1.Direction.LEFT).hasLocalGate()) {\n this._dir = wwa_data_1.Direction.RIGHT;\n }\n else {\n this._dir = wwa_data_1.Direction.DOWN;\n }\n if (!this._camera.getPosition().equals(prevCameraPos)) {\n this._isPreparedForLookingAround = true;\n this._lookingAroundTimer = wwa_data_1.WWAConsts.PLAYER_LOOKING_AROUND_START_FRAME;\n }\n return true;\n };\n Player.prototype.systemJumpTo = function (pos) {\n this._position = pos;\n this._camera.reset(pos);\n this._camera.resetPreviousPosition();\n this._state = PlayerState.LOCALGATE_JUMPED;\n this._jumpWaitFramesRemain = wwa_data_1.WWAConsts.LOCALGATE_PLAYER_WAIT_FRAME;\n this._samePosLastExecutedMapID = void 0;\n this._samePosLastExecutedObjID = void 0;\n this._dir = wwa_data_1.Direction.DOWN;\n this._isPreparedForLookingAround = true;\n this._lookingAroundTimer = wwa_data_1.WWAConsts.PLAYER_LOOKING_AROUND_START_FRAME;\n };\n Player.prototype.addStatusAll = function (s) {\n this._status.add(s);\n if (this.isDead()) {\n this._status.energy = 0;\n }\n if (this._energyMax !== 0) {\n this._status.energy = Math.min(this._status.energy, this._energyMax);\n }\n this.updateStatusValueBox();\n return this._status;\n };\n Player.prototype.setEnergyMax = function (em) {\n this._energyMax = em;\n if (em !== 0) {\n this._status.energy = Math.min(this._status.energy, this._energyMax);\n }\n this.updateStatusValueBox();\n return em;\n };\n Player.prototype.setEnergy = function (e) {\n this._status.energy = e;\n if (this.isDead()) {\n this._status.energy = 0;\n }\n if (this._energyMax !== 0) {\n this._status.energy = Math.min(this._status.energy, this._energyMax);\n }\n this.updateStatusValueBox();\n return e;\n };\n Player.prototype.damage = function (amount) {\n this._status.energy = Math.max(0, this._status.energy - amount);\n if (this.isDead()) {\n this._status.energy = 0;\n }\n if (this._energyMax !== 0) {\n this._status.energy = Math.min(this._status.energy, this._energyMax);\n }\n this.updateStatusValueBox();\n };\n Player.prototype.setStrength = function (s) {\n this._status.strength = s;\n this.updateStatusValueBox();\n return s;\n };\n Player.prototype.setDefence = function (d) {\n this._status.defence = d;\n this.updateStatusValueBox();\n return d;\n };\n Player.prototype.setGold = function (g) {\n this._status.gold = g;\n this.updateStatusValueBox();\n return g;\n };\n Player.prototype.getStatus = function () {\n return this._status.plus(this._equipStatus);\n };\n Player.prototype.getStatusWithoutEquipments = function () {\n return this._status.plus(new wwa_data_1.EquipmentStatus(0, 0));\n };\n Player.prototype.updateStatusValueBox = function () {\n var totalStatus = this._status.plus(this._equipStatus);\n var e = totalStatus.energy;\n var s = totalStatus.strength;\n var d = totalStatus.defence;\n var g = totalStatus.gold;\n this._energyValueElement.textContent = e + "";\n this._strengthValueElement.textContent = s + "";\n this._defenceValueElement.textContent = d + "";\n this._goldValueElement.textContent = g + "";\n };\n Player.prototype.updateItemBox = function (animationOption) {\n var _this = this;\n var _loop_1 = function (i) {\n var targetItemBoxElement = this_1._itemBoxElement[i];\n var parentElement = util.$qs("#item" + i);\n if (this_1._itemBox[i] === 0) {\n targetItemBoxElement.style.backgroundPosition = "-40px 0px";\n this_1.disposeItemEffect(this_1._itemBoxElement[i], parentElement);\n return "continue";\n }\n var cx = this_1._wwa.getObjectCropXById(this_1._itemBox[i]);\n var cy = this_1._wwa.getObjectCropYById(this_1._itemBox[i]);\n if (!animationOption || i !== animationOption.insertPos - 1) {\n targetItemBoxElement.style.backgroundPosition = "-" + cx + "px -" + cy + "px";\n this_1.disposeItemEffect(this_1._itemBoxElement[i], parentElement);\n return "continue";\n }\n var dx = animationOption.itemScreenPixelCoord.x - animationOption.itemBoxScreenPixelCoord.x;\n var dy = animationOption.itemScreenPixelCoord.y - animationOption.itemBoxScreenPixelCoord.y;\n var durationMs = (-dx) * wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL / wwa_data_1.WWAConsts.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME;\n var useBlank = animationOption.overwrittenObjectId === 0 || animationOption.overwrittenObjectId === undefined;\n var overwrittenCx = useBlank ? 40 : this_1._wwa.getObjectCropXById(animationOption.overwrittenObjectId);\n var overwrittenCy = useBlank ? 80 : this_1._wwa.getObjectCropYById(animationOption.overwrittenObjectId);\n targetItemBoxElement.style.left = dx + "px";\n targetItemBoxElement.style.top = dy + "px";\n window.setTimeout(function () { return _this.startItemEffect(targetItemBoxElement, parentElement, {\n target: { x: cx, y: cy },\n overwritten: { x: overwrittenCx, y: overwrittenCy },\n }, durationMs); }, wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL);\n };\n var this_1 = this;\n for (var i = 0; i < this._itemBoxElement.length; i++) {\n _loop_1(i);\n }\n };\n Player.prototype.startItemEffect = function (targetItemBoxElement, parentElement, crops, durationMs) {\n var _this = this;\n var prevOverwrittenItemElement = parentElement.querySelector(this.overwittenItemSelector);\n if (prevOverwrittenItemElement) {\n parentElement.removeChild(prevOverwrittenItemElement);\n }\n var overwrittenItemElement = document.createElement("div");\n overwrittenItemElement.classList.add(this.overwittenItemClassName);\n overwrittenItemElement.style.backgroundPosition = "-" + crops.overwritten.x + "px -" + crops.overwritten.y + "px";\n overwrittenItemElement.style.backgroundImage = parentElement.style.backgroundImage;\n parentElement.appendChild(overwrittenItemElement);\n targetItemBoxElement.style.backgroundPosition = "-" + crops.target.x + "px -" + crops.target.y + "px";\n targetItemBoxElement.style.transitionDuration = durationMs + "ms";\n targetItemBoxElement.style.transitionProperty = "left,top";\n targetItemBoxElement.style.transitionTimingFunction = "linear";\n targetItemBoxElement.style.left = "0";\n targetItemBoxElement.style.top = "0";\n parentElement.classList.add(this.itemTransitioningClassName);\n targetItemBoxElement.addEventListener("transitionend", function () {\n _this.disposeItemEffect(targetItemBoxElement, parentElement);\n }, { once: true });\n };\n Player.prototype.disposeItemEffect = function (itemBoxElement, parentElement) {\n itemBoxElement.style.transitionDuration = "0s";\n itemBoxElement.style.transitionProperty = "";\n itemBoxElement.style.left = "0";\n itemBoxElement.style.top = "0";\n if (parentElement.classList.contains(this.itemTransitioningClassName)) {\n parentElement.classList.remove(this.itemTransitioningClassName);\n }\n var overwrittenItemElement = parentElement.querySelector(this.overwittenItemSelector);\n if (overwrittenItemElement) {\n parentElement.removeChild(overwrittenItemElement);\n }\n };\n Player.prototype.isDead = function () {\n return this._status.energy <= 0;\n };\n Player.prototype.addItem = function (objID, itemPos, isOverwrite, animationOption) {\n if (itemPos === void 0) { itemPos = 0; }\n if (isOverwrite === void 0) { isOverwrite = false; }\n var insertPos;\n var oldInsertPos;\n var oldObjID;\n var itemPos_partsData = this._wwa.getObjectAttributeById(objID, wwa_data_1.WWAConsts.ATR_NUMBER);\n var overwrittenObjectId = 0;\n if (itemPos === 0 && itemPos_partsData !== 0) {\n itemPos = itemPos_partsData;\n }\n if (itemPos === 0) {\n if (objID === 0) {\n return;\n }\n insertPos = this._getBlankItemPos();\n if (insertPos === wwa_data_1.WWAConsts.ITEMBOX_IS_FULL) {\n throw new Error("これ以上、アイテムを持てません。");\n }\n overwrittenObjectId = this._itemBox[insertPos - 1];\n this._forceSetItemBox(insertPos, objID);\n }\n else if (isOverwrite === false) {\n insertPos = itemPos;\n oldObjID = this._itemBox[insertPos - 1];\n if (this._wwa.getObjectAttributeById(oldObjID, wwa_data_1.WWAConsts.ATR_NUMBER) !==\n this._wwa.getObjectAttributeById(objID, wwa_data_1.WWAConsts.ATR_NUMBER)) {\n oldInsertPos = this._getBlankItemPos();\n if (oldInsertPos !== wwa_data_1.WWAConsts.ITEMBOX_IS_FULL) {\n this._forceSetItemBox(oldInsertPos, oldObjID);\n this._forceSetItemBox(insertPos, objID);\n }\n else {\n throw new Error("これ以上、アイテムを持てません。");\n }\n }\n else {\n overwrittenObjectId = this._itemBox[insertPos - 1];\n this._forceSetItemBox(insertPos, objID);\n }\n }\n else {\n insertPos = itemPos;\n overwrittenObjectId = this._itemBox[insertPos - 1];\n this._forceSetItemBox(insertPos, objID);\n }\n this._updateEquipmentStatus();\n this.updateItemBox(animationOption ? {\n insertPos: insertPos,\n itemScreenPixelCoord: animationOption.screenPixelCoord,\n itemBoxScreenPixelCoord: new wwa_data_1.Coord(wwa_data_1.WWAConsts.MAP_WINDOW_WIDTH + (insertPos - 1) % 3 * wwa_data_1.WWAConsts.CHIP_SIZE, wwa_data_1.WWAConsts.ITEMBOX_TOP_Y + Math.floor((insertPos - 1) / 3) * wwa_data_1.WWAConsts.CHIP_SIZE),\n overwrittenObjectId: overwrittenObjectId\n } : undefined);\n };\n Player.prototype._forceSetItemBox = function (pos, id) {\n var self = this;\n var border = util.$qsh("#item" + (pos - 1) + ">.item-click-border");\n var itemType = this._wwa.getObjectAttributeById(id, wwa_data_1.WWAConsts.ATR_MODE);\n this.removeItemByItemPosition(pos);\n this._itemBox[pos - 1] = id;\n if (id !== 0 && itemType !== wwa_data_1.ItemMode.NORMAL) {\n var mes = this._wwa.getSystemMessageById(wwa_data_1.SystemMessage2.CLICKABLE_ITEM);\n if (!this._isClickableItemGot) {\n if (mes !== "BLANK") {\n this._wwa.setMessageQueue(mes === "" ?\n "このアイテムは右のボックスをクリックすることで使用できます。\\n" +\n "使用できるアイテムは色枠で囲まれます。" : mes, false, true);\n }\n this._isClickableItemGot = true;\n }\n border.style.display = "block";\n (function (pos) {\n self._itemUsingEvent[pos - 1] = function () {\n if (self.isControllable()) {\n self._wwa.onselectitem(pos);\n }\n };\n })(pos);\n border.addEventListener("click", this._itemUsingEvent[pos - 1]);\n }\n };\n Player.prototype._getBlankItemPos = function () {\n var insertPos;\n for (insertPos = 1; insertPos < this._itemBox.length + 1; insertPos++) {\n if (this._itemBox[insertPos - 1] === 0) {\n return insertPos;\n }\n }\n return wwa_data_1.WWAConsts.ITEMBOX_IS_FULL;\n };\n Player.prototype._updateEquipmentStatus = function () {\n var i;\n var newStatus = new wwa_data_1.EquipmentStatus(0, 0);\n for (i = 0; i < wwa_data_1.WWAConsts.ITEMBOX_SIZE; i++) {\n if (this._itemBox[i] !== 0) {\n newStatus.strength += this._wwa.getObjectAttributeById(this._itemBox[i], wwa_data_1.WWAConsts.ATR_STRENGTH);\n newStatus.defence += this._wwa.getObjectAttributeById(this._itemBox[i], wwa_data_1.WWAConsts.ATR_DEFENCE);\n }\n }\n var diff = newStatus.minus(this._equipStatus);\n this._wwa.setStatusChangedEffect(diff);\n this._equipStatus = newStatus;\n this.updateStatusValueBox();\n };\n Player.prototype.hasItem = function (partsID) {\n for (var i = 0; i < wwa_data_1.WWAConsts.ITEMBOX_SIZE; i++) {\n if (this._itemBox[i] === partsID) {\n return true;\n }\n }\n return false;\n };\n Player.prototype.canUseItem = function (itemPos) {\n var partsID = this._itemBox[itemPos - 1];\n if (partsID === 0) {\n return false;\n }\n if (this._wwa.getObjectAttributeById(partsID, wwa_data_1.WWAConsts.ATR_MODE) === wwa_data_1.ItemMode.NORMAL) {\n return false;\n }\n return true;\n };\n Player.prototype.useItem = function () {\n var itemID;\n var messageID;\n itemID = this._itemBox[this._readyToUseItemPos - 1];\n if (this._wwa.getObjectAttributeById(itemID, wwa_data_1.WWAConsts.ATR_MODE) !== wwa_data_1.ItemMode.NOT_DISAPPEAR) {\n this.removeItemByItemPosition(this._readyToUseItemPos);\n }\n var bg = (util.$id("item" + (this._readyToUseItemPos - 1)));\n setTimeout(function () {\n if (bg.classList.contains("onpress")) {\n bg.classList.remove("onpress");\n }\n }, wwa_data_1.WWAConsts.DEFAULT_FRAME_INTERVAL);\n this._isReadyToUseItem = false;\n this._readyToUseItemPos = void 0;\n return itemID;\n };\n Player.prototype.canHaveMoreItems = function () {\n return this._getBlankItemPos() !== wwa_data_1.WWAConsts.ITEMBOX_IS_FULL;\n };\n Player.prototype.removeItemByItemPosition = function (itemPos) {\n var border;\n if (this._itemBox[itemPos - 1] === 0) {\n return;\n }\n if (this._wwa.getObjectAttributeById(this._itemBox[itemPos - 1], wwa_data_1.WWAConsts.ATR_MODE) !== wwa_data_1.ItemMode.NORMAL) {\n border = util.$qsh("#item" + (itemPos - 1) + ">.item-click-border");\n border.removeEventListener("click", this._itemUsingEvent[itemPos - 1]);\n border.style.display = "none";\n }\n this._itemBox[itemPos - 1] = 0;\n this._updateEquipmentStatus();\n this.updateItemBox();\n };\n Player.prototype.removeItemByPartsID = function (partsID) {\n var border;\n if (!this.hasItem(partsID)) {\n throw new Error("アイテムを持っていない");\n }\n for (var i = 0; i < wwa_data_1.WWAConsts.ITEMBOX_SIZE; i++) {\n if (this._itemBox[i] === partsID) {\n if (this._wwa.getObjectAttributeById(this._itemBox[i], wwa_data_1.WWAConsts.ATR_MODE) !== wwa_data_1.ItemMode.NORMAL) {\n border = util.$qsh("#item" + i + ">.item-click-border");\n border.removeEventListener("click", this._itemUsingEvent[i]);\n border.style.display = "none";\n }\n this._itemBox[i] = 0;\n this._updateEquipmentStatus();\n this.updateItemBox();\n return;\n }\n }\n };\n Player.prototype.clearItemBox = function () {\n for (var i = 1; i <= wwa_data_1.WWAConsts.ITEMBOX_SIZE; i++) {\n this.removeItemByItemPosition(i);\n }\n this._updateEquipmentStatus();\n this.updateItemBox();\n };\n Player.prototype.hasGold = function (gold) {\n return this._status.gold >= gold;\n };\n Player.prototype.payGold = function (gold) {\n if (!this.hasGold(gold)) {\n throw new Error("お金が足りない");\n }\n this.setGold(this._status.gold - gold);\n };\n Player.prototype.earnGold = function (gold) {\n this.setGold(this._status.gold + gold);\n };\n Player.prototype.setPartsAppearedFlag = function () {\n this._partsAppeared = true;\n };\n Player.prototype.clearPartsAppearedFlag = function () {\n this._partsAppeared = false;\n };\n Player.prototype.isPartsAppearedTime = function () {\n return this._partsAppeared === true;\n };\n Player.prototype.startBattleWith = function (enemy) {\n this._isPlayerTurn = true;\n this._battleFrameCounter = wwa_data_1.WWAConsts.BATTLE_INTERVAL_FRAME_NUM;\n this._battleTurnNum = 0;\n this._enemy = enemy;\n this._state = PlayerState.BATTLE;\n };\n Player.prototype.isFighting = function () {\n return this._state === PlayerState.BATTLE;\n };\n Player.prototype.isTurn = function () {\n return this._isPlayerTurn;\n };\n Player.prototype.getTurnNum = function () {\n return this._battleTurnNum;\n };\n Player.prototype.isBattleStartFrame = function () {\n return this._battleFrameCounter === wwa_data_1.WWAConsts.BATTLE_INTERVAL_FRAME_NUM && this._battleTurnNum === 0;\n };\n Player.prototype.fight = function () {\n if (!this.isFighting()) {\n throw new Error("バトルが開始されていません。");\n }\n if (this._battleTurnNum === 0 && this._battleFrameCounter === wwa_data_1.WWAConsts.BATTLE_INTERVAL_FRAME_NUM) {\n this._wwa.showMonsterWindow();\n }\n if (--this._battleFrameCounter > 0) {\n return;\n }\n this._battleTurnNum++;\n if (this._speedIndex === wwa_data_1.WWAConsts.MAX_SPEED_INDEX || this._battleTurnNum > wwa_data_1.WWAConsts.BATTLE_SPEED_CHANGE_TURN_NUM) {\n if (this._battleTurnNum === 1) {\n this._wwa.playSound(wwa_data_1.SystemSound.ATTACK);\n }\n this._battleFrameCounter = 1;\n }\n else {\n this._battleFrameCounter = wwa_data_1.WWAConsts.BATTLE_INTERVAL_FRAME_NUM;\n this._wwa.playSound(wwa_data_1.SystemSound.ATTACK);\n }\n var playerStatus = this.getStatus();\n var enemyStatus = this._enemy.status;\n if (this._isPlayerTurn) {\n if (playerStatus.strength > enemyStatus.defence ||\n playerStatus.defence < enemyStatus.strength) {\n if (enemyStatus.energy > playerStatus.strength - enemyStatus.defence) {\n if (playerStatus.strength > enemyStatus.defence) {\n this._enemy.damage(playerStatus.strength - enemyStatus.defence);\n }\n }\n else {\n this._wwa.playSound(this._wwa.getObjectAttributeById(this._enemy.partsID, wwa_data_1.WWAConsts.ATR_SOUND));\n this.earnGold(enemyStatus.gold);\n this._wwa.setStatusChangedEffect(new wwa_data_1.Status(0, 0, 0, enemyStatus.gold));\n if (this._enemy.item !== 0) {\n this._wwa.setPartsOnPosition(wwa_data_1.PartsType.OBJECT, this._enemy.item, this._enemy.position);\n }\n else {\n this._wwa.setPartsOnPosition(wwa_data_1.PartsType.OBJECT, 0, this._enemy.position);\n }\n this._wwa.appearParts(this._enemy.position, wwa_data_1.AppearanceTriggerType.OBJECT, this._enemy.partsID);\n this._state = PlayerState.CONTROLLABLE;\n this._wwa.setMessageQueue(this._enemy.message, false, false, this._enemy.partsID, wwa_data_1.PartsType.OBJECT, this._enemy.position);\n this._enemy.battleEndProcess();\n this._battleTurnNum = 0;\n this._enemy = null;\n }\n this._isPlayerTurn = false;\n return;\n }\n this._enemy.battleEndProcess();\n this._wwa.setMessageQueue("相手の防御能力が高すぎる!", false, true);\n this._battleTurnNum = 0;\n this._enemy = null;\n }\n else {\n if (enemyStatus.strength > playerStatus.defence) {\n if (playerStatus.energy > enemyStatus.strength - playerStatus.defence) {\n this.damage(enemyStatus.strength - playerStatus.defence);\n }\n else {\n this.setEnergy(0);\n this._enemy.battleEndProcess();\n this._state = PlayerState.CONTROLLABLE;\n this._battleTurnNum = 0;\n this._enemy = null;\n this._wwa.gameover();\n }\n }\n }\n this._isPlayerTurn = true;\n };\n Player.prototype.readyToUseItem = function (itemPos) {\n var itemID;\n var messageID;\n if (!this.canUseItem(itemPos)) {\n throw new Error("アイテムがないか、アイテムが使えません。");\n }\n itemID = this._itemBox[itemPos - 1];\n messageID = this._wwa.getObjectAttributeById(itemID, wwa_data_1.WWAConsts.ATR_STRING);\n this._wwa.appearParts(this._position.getPartsCoord(), wwa_data_1.AppearanceTriggerType.OBJECT, itemID);\n this._readyToUseItemPos = itemPos;\n this._isReadyToUseItem = true;\n };\n Player.prototype.isReadyToUseItem = function () {\n return this._isReadyToUseItem;\n };\n Player.prototype.getDrawingCenterPosition = function () {\n var pos = this._position.getPartsCoord();\n var poso = this._position.getOffsetCoord();\n var cameraPos = this._camera.getPosition();\n var cpParts = cameraPos.getPartsCoord();\n var cpOffset = cameraPos.getOffsetCoord();\n var targetX = (pos.x - cpParts.x) * wwa_data_1.WWAConsts.CHIP_SIZE + poso.x - cpOffset.x + wwa_data_1.WWAConsts.CHIP_SIZE / 2;\n var targetY = (pos.y - cpParts.y) * wwa_data_1.WWAConsts.CHIP_SIZE + poso.y - cpOffset.y + wwa_data_1.WWAConsts.CHIP_SIZE / 2;\n return new wwa_data_1.Coord(targetX, targetY);\n };\n Player.prototype.getMoveCount = function () {\n return this._moves;\n };\n Player.prototype.setMoveCount = function (count) {\n return this._moves = count;\n };\n Player.prototype.isMoveObjectAutoExecTime = function () {\n return this._moveObjectAutoExecTimer === 0;\n };\n Player.prototype.setMoveMacroWaiting = function (moveNum) {\n if (moveNum < 0) {\n return;\n }\n this._moveMacroWaitingRemainMoves = moveNum;\n this._moveObjectAutoExecTimer = 0;\n };\n Player.prototype.resetMoveObjectAutoExecTimer = function () {\n this._moveObjectAutoExecTimer = wwa_data_1.WWAConsts.CHIP_SIZE / wwa_data_1.speedList[this._speedIndex];\n this._moveMacroWaitingRemainMoves--;\n };\n Player.prototype.decrementMoveObjectAutoExecTimer = function () {\n if (this._moveMacroWaitingRemainMoves >= 0 && this._moveObjectAutoExecTimer > 0) {\n this._moveObjectAutoExecTimer--;\n if (this._moveMacroWaitingRemainMoves === 0 && this._moveObjectAutoExecTimer === 0) {\n this._afterMoveMacroFlag = true;\n }\n }\n return 0;\n };\n Player.prototype.isWaitingMoveMacro = function () {\n return this._moveMacroWaitingRemainMoves !== 0 || this._moveObjectAutoExecTimer !== 0;\n };\n Player.prototype.decrementLookingAroundTimer = function () {\n if (this._isPreparedForLookingAround && this._lookingAroundTimer > 0) {\n return --this._lookingAroundTimer;\n }\n return 0;\n };\n Player.prototype.isLookingAround = function () {\n return this._isPreparedForLookingAround && this._lookingAroundTimer === 0;\n };\n Player.prototype.getSpeedIndex = function () {\n return this._speedIndex;\n };\n Player.prototype.speedUp = function () {\n return this._speedIndex = Math.min(wwa_data_1.WWAConsts.MAX_SPEED_INDEX, this._speedIndex + 1);\n };\n Player.prototype.speedDown = function () {\n return this._speedIndex = Math.max(wwa_data_1.WWAConsts.MIN_SPEED_INDEX, this._speedIndex - 1);\n };\n return Player;\n}(PartsObject));\nexports.Player = Player;\n\n\n//# sourceURL=webpack:///./src/wwa_parts_player.ts?')},"./src/wwa_password_window.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar Mode;\n(function (Mode) {\n Mode[Mode["SAVE"] = 0] = "SAVE";\n Mode[Mode["LOAD"] = 1] = "LOAD";\n})(Mode = exports.Mode || (exports.Mode = {}));\nvar DESCRIPTION_LOAD = ("下のボックスに前回のプレイで取得した\\n" +\n "復帰用パスワードを入力してください。\\n" +\n "テキストは、Ctrl+Cでコピー、Ctrl+Vで貼り付けできます。\\n" +\n "現在、Java版WWAで取得したパスワードはご利用になれません。\\n" +\n "作成者がマップの内容を変更した場合は\\n" +\n "それ以前に取得したパスワードは使えなくなります。");\nvar DESCRIPTION_SAVE = ("下記テキストがデータ復帰用のパスワードになっています。\\n" +\n "コピーしてメモ帳などのテキストエディタに貼り付けて\\n" +\n "保存してください。ボックスをクリックで全体を選択、\\n" +\n "「Ctrl+C」でコピー、「Ctrl+V」で貼り付けできます。\\n" +\n "通常数万文字程度ありますので、ご注意ください。");\nvar PasswordWindow = (function () {\n function PasswordWindow(_wwa, _parent) {\n var _this = this;\n this._wwa = _wwa;\n this._parent = _parent;\n this._element = document.createElement("div");\n this._element.setAttribute("id", "wwa-password-window");\n this._element.style.display = "none";\n this._descriptionElement = document.createElement("div");\n this._descriptionElement.classList.add("wwa-password-description");\n this._passwordBoxElement = document.createElement("textarea");\n this._passwordBoxElement.setAttribute("cols", "50");\n this._passwordBoxElement.setAttribute("rows", "16");\n this._passwordBoxElement.addEventListener("focus", function (e) {\n _this._passwordBoxElement.select();\n });\n this._buttonWrapperElement = document.createElement("div");\n this._okButtonElement = document.createElement("button");\n this._okButtonElement.textContent = "OK";\n this._okButtonElement.addEventListener("click", function () {\n _this._wwa.hidePasswordWindow();\n });\n this._cancelButtonElement = document.createElement("button");\n this._cancelButtonElement.textContent = "キャンセル";\n this._cancelButtonElement.addEventListener("click", function () {\n _this._wwa.hidePasswordWindow(true);\n });\n this._buttonWrapperElement.appendChild(this._okButtonElement);\n this._buttonWrapperElement.appendChild(this._cancelButtonElement);\n this._mode = Mode.LOAD;\n this._element.appendChild(this._descriptionElement);\n this._element.appendChild(this._passwordBoxElement);\n this._element.appendChild(this._buttonWrapperElement);\n this._parent.appendChild(this._element);\n this.update();\n }\n Object.defineProperty(PasswordWindow.prototype, "mode", {\n get: function () {\n return this._mode;\n },\n set: function (mode) {\n this._mode = mode;\n if (mode === Mode.LOAD) {\n this.password = "";\n }\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PasswordWindow.prototype, "password", {\n get: function () {\n return this._passwordBoxElement.value;\n },\n set: function (password) {\n this._passwordBoxElement.value = password;\n },\n enumerable: true,\n configurable: true\n });\n PasswordWindow.prototype.show = function (mode) {\n if (mode !== void 0) {\n this.mode = mode;\n }\n this._isVisible = true;\n this.update();\n };\n PasswordWindow.prototype.hide = function () {\n this._isVisible = false;\n this.update();\n };\n PasswordWindow.prototype.update = function () {\n var msg = "";\n if (this._mode === Mode.LOAD) {\n msg = DESCRIPTION_LOAD;\n try {\n this._passwordBoxElement.removeAttribute("readonly");\n }\n catch (e) { }\n this._cancelButtonElement.style.display = "inline";\n }\n else {\n msg = DESCRIPTION_SAVE;\n this._passwordBoxElement.setAttribute("readonly", "readonly");\n this._cancelButtonElement.style.display = "none";\n }\n var mesArray = msg.split("\\n");\n this._descriptionElement.textContent = "";\n for (var i = 0; i < mesArray.length; i++) {\n var sp = document.createElement("span");\n sp.textContent = mesArray[i];\n this._descriptionElement.appendChild(sp);\n this._descriptionElement.appendChild(document.createElement("br"));\n }\n if (this._isVisible) {\n this._element.style.display = "block";\n }\n else {\n this._element.style.display = "none";\n }\n };\n return PasswordWindow;\n}());\nexports.PasswordWindow = PasswordWindow;\n\n\n//# sourceURL=webpack:///./src/wwa_password_window.ts?')},"./src/wwa_util.ts":function(module,exports,__webpack_require__){"use strict";eval('\nObject.defineProperty(exports, "__esModule", { value: true });\nvar wwa_data_1 = __webpack_require__("./src/wwa_data.ts");\nexports.$id = function (id) {\n return document.getElementById(id);\n};\nexports.$class = function (className) {\n return document.getElementsByClassName(className);\n};\nexports.$tag = function (tagName) {\n return document.getElementsByTagName(tagName);\n};\nexports.$qs = function (selector) {\n return document.querySelector(selector);\n};\nexports.$qsh = function (selector) {\n return document.querySelector(selector);\n};\nexports.$qsAll = function (selector) {\n return document.querySelectorAll(selector);\n};\nexports.$localPos = function (mouseX, mouseY) {\n var cx, cy;\n var sx = window.pageXOffset ||\n document.body.scrollLeft ||\n document.documentElement.scrollLeft;\n var sy = window.pageYOffset ||\n document.body.scrollTop ||\n document.documentElement.scrollTop;\n cx = mouseX - exports.$id("wwa-wrapper").offsetLeft + sx;\n cy = mouseY - exports.$id("wwa-wrapper").offsetTop + sy;\n return new wwa_data_1.Coord(cx, cy);\n};\nexports.$escapedURI = function (uri) {\n if (uri.match(/^https?:\\/\\//) || uri.match(/^\\.\\.\\//)) {\n return uri;\n }\n else {\n return (location.href = "./" + uri);\n }\n};\nexports.arr2str4save = function (x) {\n var txt = "";\n if (x instanceof Array) {\n for (var i = 0; i < x.length; i++) {\n txt += exports.arr2str4save(x[i]) + "/";\n }\n return txt;\n }\n else {\n return x + "";\n }\n};\n\n\n//# sourceURL=webpack:///./src/wwa_util.ts?')}});/**
@license CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/
var CryptoJS=CryptoJS||function(u,p){var d={},l=d.lib={},s=function(){},t=l.Base={extend:function(a){s.prototype=this;var c=new s;a&&c.mixIn(a);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var c in a)a.hasOwnProperty(c)&&(this[c]=a[c]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}},
r=l.WordArray=t.extend({init:function(a,c){a=this.words=a||[];this.sigBytes=c!=p?c:4*a.length},toString:function(a){return(a||v).stringify(this)},concat:function(a){var c=this.words,e=a.words,j=this.sigBytes;a=a.sigBytes;this.clamp();if(j%4)for(var k=0;k<a;k++)c[j+k>>>2]|=(e[k>>>2]>>>24-8*(k%4)&255)<<24-8*((j+k)%4);else if(65535<e.length)for(k=0;k<a;k+=4)c[j+k>>>2]=e[k>>>2];else c.push.apply(c,e);this.sigBytes+=a;return this},clamp:function(){var a=this.words,c=this.sigBytes;a[c>>>2]&=4294967295<<
32-8*(c%4);a.length=u.ceil(c/4)},clone:function(){var a=t.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var c=[],e=0;e<a;e+=4)c.push(4294967296*u.random()|0);return new r.init(c,a)}}),w=d.enc={},v=w.Hex={stringify:function(a){var c=a.words;a=a.sigBytes;for(var e=[],j=0;j<a;j++){var k=c[j>>>2]>>>24-8*(j%4)&255;e.push((k>>>4).toString(16));e.push((k&15).toString(16))}return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j<c;j+=2)e[j>>>3]|=parseInt(a.substr(j,
2),16)<<24-4*(j%8);return new r.init(e,c/2)}},b=w.Latin1={stringify:function(a){var c=a.words;a=a.sigBytes;for(var e=[],j=0;j<a;j++)e.push(String.fromCharCode(c[j>>>2]>>>24-8*(j%4)&255));return e.join("")},parse:function(a){for(var c=a.length,e=[],j=0;j<c;j++)e[j>>>2]|=(a.charCodeAt(j)&255)<<24-8*(j%4);return new r.init(e,c)}},x=w.Utf8={stringify:function(a){try{return decodeURIComponent(escape(b.stringify(a)))}catch(c){throw Error("Malformed UTF-8 data");}},parse:function(a){return b.parse(unescape(encodeURIComponent(a)))}},
q=l.BufferedBlockAlgorithm=t.extend({reset:function(){this._data=new r.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=x.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var c=this._data,e=c.words,j=c.sigBytes,k=this.blockSize,b=j/(4*k),b=a?u.ceil(b):u.max((b|0)-this._minBufferSize,0);a=b*k;j=u.min(4*a,j);if(a){for(var q=0;q<a;q+=k)this._doProcessBlock(e,q);q=e.splice(0,a);c.sigBytes-=j}return new r.init(q,j)},clone:function(){var a=t.clone.call(this);
a._data=this._data.clone();return a},_minBufferSize:0});l.Hasher=q.extend({cfg:t.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){q.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,e){return(new a.init(e)).finalize(b)}},_createHmacHelper:function(a){return function(b,e){return(new n.HMAC.init(a,
e)).finalize(b)}}});var n=d.algo={};return d}(Math);
(function(){var u=CryptoJS,p=u.lib.WordArray;u.enc.Base64={stringify:function(d){var l=d.words,p=d.sigBytes,t=this._map;d.clamp();d=[];for(var r=0;r<p;r+=3)for(var w=(l[r>>>2]>>>24-8*(r%4)&255)<<16|(l[r+1>>>2]>>>24-8*((r+1)%4)&255)<<8|l[r+2>>>2]>>>24-8*((r+2)%4)&255,v=0;4>v&&r+0.75*v<p;v++)d.push(t.charAt(w>>>6*(3-v)&63));if(l=t.charAt(64))for(;d.length%4;)d.push(l);return d.join("")},parse:function(d){var l=d.length,s=this._map,t=s.charAt(64);t&&(t=d.indexOf(t),-1!=t&&(l=t));for(var t=[],r=0,w=0;w<
l;w++)if(w%4){var v=s.indexOf(d.charAt(w-1))<<2*(w%4),b=s.indexOf(d.charAt(w))>>>6-2*(w%4);t[r>>>2]|=(v|b)<<24-8*(r%4);r++}return p.create(t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}})();
(function(u){function p(b,n,a,c,e,j,k){b=b+(n&a|~n&c)+e+k;return(b<<j|b>>>32-j)+n}function d(b,n,a,c,e,j,k){b=b+(n&c|a&~c)+e+k;return(b<<j|b>>>32-j)+n}function l(b,n,a,c,e,j,k){b=b+(n^a^c)+e+k;return(b<<j|b>>>32-j)+n}function s(b,n,a,c,e,j,k){b=b+(a^(n|~c))+e+k;return(b<<j|b>>>32-j)+n}for(var t=CryptoJS,r=t.lib,w=r.WordArray,v=r.Hasher,r=t.algo,b=[],x=0;64>x;x++)b[x]=4294967296*u.abs(u.sin(x+1))|0;r=r.MD5=v.extend({_doReset:function(){this._hash=new w.init([1732584193,4023233417,2562383102,271733878])},
_doProcessBlock:function(q,n){for(var a=0;16>a;a++){var c=n+a,e=q[c];q[c]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360}var a=this._hash.words,c=q[n+0],e=q[n+1],j=q[n+2],k=q[n+3],z=q[n+4],r=q[n+5],t=q[n+6],w=q[n+7],v=q[n+8],A=q[n+9],B=q[n+10],C=q[n+11],u=q[n+12],D=q[n+13],E=q[n+14],x=q[n+15],f=a[0],m=a[1],g=a[2],h=a[3],f=p(f,m,g,h,c,7,b[0]),h=p(h,f,m,g,e,12,b[1]),g=p(g,h,f,m,j,17,b[2]),m=p(m,g,h,f,k,22,b[3]),f=p(f,m,g,h,z,7,b[4]),h=p(h,f,m,g,r,12,b[5]),g=p(g,h,f,m,t,17,b[6]),m=p(m,g,h,f,w,22,b[7]),
f=p(f,m,g,h,v,7,b[8]),h=p(h,f,m,g,A,12,b[9]),g=p(g,h,f,m,B,17,b[10]),m=p(m,g,h,f,C,22,b[11]),f=p(f,m,g,h,u,7,b[12]),h=p(h,f,m,g,D,12,b[13]),g=p(g,h,f,m,E,17,b[14]),m=p(m,g,h,f,x,22,b[15]),f=d(f,m,g,h,e,5,b[16]),h=d(h,f,m,g,t,9,b[17]),g=d(g,h,f,m,C,14,b[18]),m=d(m,g,h,f,c,20,b[19]),f=d(f,m,g,h,r,5,b[20]),h=d(h,f,m,g,B,9,b[21]),g=d(g,h,f,m,x,14,b[22]),m=d(m,g,h,f,z,20,b[23]),f=d(f,m,g,h,A,5,b[24]),h=d(h,f,m,g,E,9,b[25]),g=d(g,h,f,m,k,14,b[26]),m=d(m,g,h,f,v,20,b[27]),f=d(f,m,g,h,D,5,b[28]),h=d(h,f,
m,g,j,9,b[29]),g=d(g,h,f,m,w,14,b[30]),m=d(m,g,h,f,u,20,b[31]),f=l(f,m,g,h,r,4,b[32]),h=l(h,f,m,g,v,11,b[33]),g=l(g,h,f,m,C,16,b[34]),m=l(m,g,h,f,E,23,b[35]),f=l(f,m,g,h,e,4,b[36]),h=l(h,f,m,g,z,11,b[37]),g=l(g,h,f,m,w,16,b[38]),m=l(m,g,h,f,B,23,b[39]),f=l(f,m,g,h,D,4,b[40]),h=l(h,f,m,g,c,11,b[41]),g=l(g,h,f,m,k,16,b[42]),m=l(m,g,h,f,t,23,b[43]),f=l(f,m,g,h,A,4,b[44]),h=l(h,f,m,g,u,11,b[45]),g=l(g,h,f,m,x,16,b[46]),m=l(m,g,h,f,j,23,b[47]),f=s(f,m,g,h,c,6,b[48]),h=s(h,f,m,g,w,10,b[49]),g=s(g,h,f,m,
E,15,b[50]),m=s(m,g,h,f,r,21,b[51]),f=s(f,m,g,h,u,6,b[52]),h=s(h,f,m,g,k,10,b[53]),g=s(g,h,f,m,B,15,b[54]),m=s(m,g,h,f,e,21,b[55]),f=s(f,m,g,h,v,6,b[56]),h=s(h,f,m,g,x,10,b[57]),g=s(g,h,f,m,t,15,b[58]),m=s(m,g,h,f,D,21,b[59]),f=s(f,m,g,h,z,6,b[60]),h=s(h,f,m,g,C,10,b[61]),g=s(g,h,f,m,j,15,b[62]),m=s(m,g,h,f,A,21,b[63]);a[0]=a[0]+f|0;a[1]=a[1]+m|0;a[2]=a[2]+g|0;a[3]=a[3]+h|0},_doFinalize:function(){var b=this._data,n=b.words,a=8*this._nDataBytes,c=8*b.sigBytes;n[c>>>5]|=128<<24-c%32;var e=u.floor(a/
4294967296);n[(c+64>>>9<<4)+15]=(e<<8|e>>>24)&16711935|(e<<24|e>>>8)&4278255360;n[(c+64>>>9<<4)+14]=(a<<8|a>>>24)&16711935|(a<<24|a>>>8)&4278255360;b.sigBytes=4*(n.length+1);this._process();b=this._hash;n=b.words;for(a=0;4>a;a++)c=n[a],n[a]=(c<<8|c>>>24)&16711935|(c<<24|c>>>8)&4278255360;return b},clone:function(){var b=v.clone.call(this);b._hash=this._hash.clone();return b}});t.MD5=v._createHelper(r);t.HmacMD5=v._createHmacHelper(r)})(Math);
(function(){var u=CryptoJS,p=u.lib,d=p.Base,l=p.WordArray,p=u.algo,s=p.EvpKDF=d.extend({cfg:d.extend({keySize:4,hasher:p.MD5,iterations:1}),init:function(d){this.cfg=this.cfg.extend(d)},compute:function(d,r){for(var p=this.cfg,s=p.hasher.create(),b=l.create(),u=b.words,q=p.keySize,p=p.iterations;u.length<q;){n&&s.update(n);var n=s.update(d).finalize(r);s.reset();for(var a=1;a<p;a++)n=s.finalize(n),s.reset();b.concat(n)}b.sigBytes=4*q;return b}});u.EvpKDF=function(d,l,p){return s.create(p).compute(d,
l)}})();
CryptoJS.lib.Cipher||function(u){var p=CryptoJS,d=p.lib,l=d.Base,s=d.WordArray,t=d.BufferedBlockAlgorithm,r=p.enc.Base64,w=p.algo.EvpKDF,v=d.Cipher=t.extend({cfg:l.extend(),createEncryptor:function(e,a){return this.create(this._ENC_XFORM_MODE,e,a)},createDecryptor:function(e,a){return this.create(this._DEC_XFORM_MODE,e,a)},init:function(e,a,b){this.cfg=this.cfg.extend(b);this._xformMode=e;this._key=a;this.reset()},reset:function(){t.reset.call(this);this._doReset()},process:function(e){this._append(e);return this._process()},
finalize:function(e){e&&this._append(e);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(b,k,d){return("string"==typeof k?c:a).encrypt(e,b,k,d)},decrypt:function(b,k,d){return("string"==typeof k?c:a).decrypt(e,b,k,d)}}}});d.StreamCipher=v.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var b=p.mode={},x=function(e,a,b){var c=this._iv;c?this._iv=u:c=this._prevBlock;for(var d=0;d<b;d++)e[a+d]^=
c[d]},q=(d.BlockCipherMode=l.extend({createEncryptor:function(e,a){return this.Encryptor.create(e,a)},createDecryptor:function(e,a){return this.Decryptor.create(e,a)},init:function(e,a){this._cipher=e;this._iv=a}})).extend();q.Encryptor=q.extend({processBlock:function(e,a){var b=this._cipher,c=b.blockSize;x.call(this,e,a,c);b.encryptBlock(e,a);this._prevBlock=e.slice(a,a+c)}});q.Decryptor=q.extend({processBlock:function(e,a){var b=this._cipher,c=b.blockSize,d=e.slice(a,a+c);b.decryptBlock(e,a);x.call(this,
e,a,c);this._prevBlock=d}});b=b.CBC=q;q=(p.pad={}).Pkcs7={pad:function(a,b){for(var c=4*b,c=c-a.sigBytes%c,d=c<<24|c<<16|c<<8|c,l=[],n=0;n<c;n+=4)l.push(d);c=s.create(l,c);a.concat(c)},unpad:function(a){a.sigBytes-=a.words[a.sigBytes-1>>>2]&255}};d.BlockCipher=v.extend({cfg:v.cfg.extend({mode:b,padding:q}),reset:function(){v.reset.call(this);var a=this.cfg,b=a.iv,a=a.mode;if(this._xformMode==this._ENC_XFORM_MODE)var c=a.createEncryptor;else c=a.createDecryptor,this._minBufferSize=1;this._mode=c.call(a,
this,b&&b.words)},_doProcessBlock:function(a,b){this._mode.processBlock(a,b)},_doFinalize:function(){var a=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){a.pad(this._data,this.blockSize);var b=this._process(!0)}else b=this._process(!0),a.unpad(b);return b},blockSize:4});var n=d.CipherParams=l.extend({init:function(a){this.mixIn(a)},toString:function(a){return(a||this.formatter).stringify(this)}}),b=(p.format={}).OpenSSL={stringify:function(a){var b=a.ciphertext;a=a.salt;return(a?s.create([1398893684,
1701076831]).concat(a).concat(b):b).toString(r)},parse:function(a){a=r.parse(a);var b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=s.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return n.create({ciphertext:a,salt:c})}},a=d.SerializableCipher=l.extend({cfg:l.extend({format:b}),encrypt:function(a,b,c,d){d=this.cfg.extend(d);var l=a.createEncryptor(c,d);b=l.finalize(b);l=l.cfg;return n.create({ciphertext:b,key:c,iv:l.iv,algorithm:a,mode:l.mode,padding:l.padding,blockSize:a.blockSize,formatter:d.format})},
decrypt:function(a,b,c,d){d=this.cfg.extend(d);b=this._parse(b,d.format);return a.createDecryptor(c,d).finalize(b.ciphertext)},_parse:function(a,b){return"string"==typeof a?b.parse(a,this):a}}),p=(p.kdf={}).OpenSSL={execute:function(a,b,c,d){d||(d=s.random(8));a=w.create({keySize:b+c}).compute(a,d);c=s.create(a.words.slice(b),4*c);a.sigBytes=4*b;return n.create({key:a,iv:c,salt:d})}},c=d.PasswordBasedCipher=a.extend({cfg:a.cfg.extend({kdf:p}),encrypt:function(b,c,d,l){l=this.cfg.extend(l);d=l.kdf.execute(d,
b.keySize,b.ivSize);l.iv=d.iv;b=a.encrypt.call(this,b,c,d.key,l);b.mixIn(d);return b},decrypt:function(b,c,d,l){l=this.cfg.extend(l);c=this._parse(c,l.format);d=l.kdf.execute(d,b.keySize,b.ivSize,c.salt);l.iv=d.iv;return a.decrypt.call(this,b,c,d.key,l)}})}();
(function(){for(var u=CryptoJS,p=u.lib.BlockCipher,d=u.algo,l=[],s=[],t=[],r=[],w=[],v=[],b=[],x=[],q=[],n=[],a=[],c=0;256>c;c++)a[c]=128>c?c<<1:c<<1^283;for(var e=0,j=0,c=0;256>c;c++){var k=j^j<<1^j<<2^j<<3^j<<4,k=k>>>8^k&255^99;l[e]=k;s[k]=e;var z=a[e],F=a[z],G=a[F],y=257*a[k]^16843008*k;t[e]=y<<24|y>>>8;r[e]=y<<16|y>>>16;w[e]=y<<8|y>>>24;v[e]=y;y=16843009*G^65537*F^257*z^16843008*e;b[k]=y<<24|y>>>8;x[k]=y<<16|y>>>16;q[k]=y<<8|y>>>24;n[k]=y;e?(e=z^a[a[a[G^z]]],j^=a[a[j]]):e=j=1}var H=[0,1,2,4,8,
16,32,64,128,27,54],d=d.AES=p.extend({_doReset:function(){for(var a=this._key,c=a.words,d=a.sigBytes/4,a=4*((this._nRounds=d+6)+1),e=this._keySchedule=[],j=0;j<a;j++)if(j<d)e[j]=c[j];else{var k=e[j-1];j%d?6<d&&4==j%d&&(k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255]):(k=k<<8|k>>>24,k=l[k>>>24]<<24|l[k>>>16&255]<<16|l[k>>>8&255]<<8|l[k&255],k^=H[j/d|0]<<24);e[j]=e[j-d]^k}c=this._invKeySchedule=[];for(d=0;d<a;d++)j=a-d,k=d%4?e[j]:e[j-4],c[d]=4>d||4>=j?k:b[l[k>>>24]]^x[l[k>>>16&255]]^q[l[k>>>
8&255]]^n[l[k&255]]},encryptBlock:function(a,b){this._doCryptBlock(a,b,this._keySchedule,t,r,w,v,l)},decryptBlock:function(a,c){var d=a[c+1];a[c+1]=a[c+3];a[c+3]=d;this._doCryptBlock(a,c,this._invKeySchedule,b,x,q,n,s);d=a[c+1];a[c+1]=a[c+3];a[c+3]=d},_doCryptBlock:function(a,b,c,d,e,j,l,f){for(var m=this._nRounds,g=a[b]^c[0],h=a[b+1]^c[1],k=a[b+2]^c[2],n=a[b+3]^c[3],p=4,r=1;r<m;r++)var q=d[g>>>24]^e[h>>>16&255]^j[k>>>8&255]^l[n&255]^c[p++],s=d[h>>>24]^e[k>>>16&255]^j[n>>>8&255]^l[g&255]^c[p++],t=
d[k>>>24]^e[n>>>16&255]^j[g>>>8&255]^l[h&255]^c[p++],n=d[n>>>24]^e[g>>>16&255]^j[h>>>8&255]^l[k&255]^c[p++],g=q,h=s,k=t;q=(f[g>>>24]<<24|f[h>>>16&255]<<16|f[k>>>8&255]<<8|f[n&255])^c[p++];s=(f[h>>>24]<<24|f[k>>>16&255]<<16|f[n>>>8&255]<<8|f[g&255])^c[p++];t=(f[k>>>24]<<24|f[n>>>16&255]<<16|f[g>>>8&255]<<8|f[h&255])^c[p++];n=(f[n>>>24]<<24|f[g>>>16&255]<<16|f[h>>>8&255]<<8|f[k&255])^c[p++];a[b]=q;a[b+1]=s;a[b+2]=t;a[b+3]=n},keySize:8});u.AES=p._createHelper(d)})();